home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 83 / asm / source / zdoshell.z80 < prev   
Encoding:
Text File  |  2001-07-01  |  5.8 KB  |  306 lines

  1. ;DosShell 83z v. 0.93
  2. ;By: Ahmed El-Helw
  3. ;August 5, 1997
  4. ;Copyright (C) 1997
  5.  
  6. .NOLIST
  7. #define equ .equ
  8. #define EQU .equ
  9. #define end .end
  10. #include "Ti83asm.inc"
  11. .INCLUDE "tokens.inc"            
  12. .LIST
  13. #DEFINE curcont    8265h        ;This is var for the contrast
  14. kEnter .EQU  05h                
  15. kQuit  .EQU  40h
  16.  
  17. .org 9327h
  18.  
  19. maininit:
  20.     call    _clrLCDFull         ;Clear Screen    
  21.     call    _runIndicOff        ;Turns off Runindicator
  22.     ld     a,44d            
  23.       ld    (curcont),a
  24.     
  25. init:
  26.     call    _clrLCDFull
  27.     call    _grbufcpy_v            ;Copys Graph to screen
  28.     SET     textinverse, (iy+textflags)    ;Toggle text inverse on
  29.     call    _homeup                ;Goto 0,0 of screen
  30.     ld    hl,doshell            ;Load String DosShell
  31.     call    _puts                ;Required to end string on screen
  32.     RES     textinverse, (iy+textflags)    ;Reset text inverse (off)
  33.     ld    hl,10*256+15            ;ld Penrow*256+pencol into hl
  34.     ld    (pencol),hl            ;load hl into pencol
  35.     ld    hl,author            ;Load string author
  36.     call    _vputs                ;Required string to end string on screen
  37.     ld    hl,17*256+25        
  38.     ld    (pencol),hl
  39.     ld    hl,dir
  40.     call    _vputs
  41.  
  42. ;------------Edit Here ----------------------------
  43.     ld    hl,25*256+15
  44.     ld    (pencol),hl
  45.     ld    hl,option1
  46.     call    _vputs
  47.     ld    hl,32*256+15
  48.     ld    (pencol),hl
  49.     ld    hl,option2
  50.     call    _vputs
  51.     ld    hl,39*256+15
  52.     ld    (pencol),hl
  53.     ld    hl,option3
  54.     call    _vputs
  55.  
  56. ;------------End Edit Here ----------------------------
  57.  
  58.  
  59. ;------------Edit Here ----------------------------        
  60.     
  61. mainloop:                    ;Main program loop, with direct input       
  62.     ld     a,0ffh                ;Reset port
  63.     out     (1),a                
  64.     ld     a,0fdh                ;Loads in the new key port to search for key in
  65.     out     (1),a
  66.     in     a,(1)
  67.     cp     191                ;If key is clear
  68.     jp     z,quit                ;Exit label (quit)
  69.     cp     253                ;If key is plus
  70.     jp     z,more                ;Increase contrast label (more)
  71.     cp     251                ;If key is minus
  72.     jp     z,less                ;decrease contrast label  (less)
  73.     cp    239                ;If key is Divided By
  74.     jp    z,directory
  75.     cp    247
  76.     jp    z,off
  77.     ld     a,0ffh
  78.     out     (1),a
  79.     ld     a,0efh
  80.     out     (1),a
  81.     in     a,(1)
  82.     cp     253
  83.     jp    z,one
  84.     ld     a,0ffh
  85.     out     (1),a
  86.     ld     a,0f7h
  87.     out     (1),a
  88.     in     a,(1)
  89.     cp     253
  90.     jp     z,two
  91.     ld     a,0ffh
  92.     out     (1),a
  93.     ld     a,0fbh
  94.     out     (1),a
  95.     in     a,(1)
  96.     cp     253
  97.     jp     z,three
  98.     jp    nz,mainloop
  99.  
  100. ;-----------End Editions-----------------
  101.  
  102. more:                                          ;increase contrast by 1d
  103.     call     delay
  104.       ld     a,(curcont)            ;Loads current contrast from var into a
  105.       cp     62d                ;If max
  106.       jp     z,nomore            ;Goto no more
  107.       ld     a,(curcont)            
  108.       ld     b,1d                ;Load 1d to b
  109.       add     a,b                ;Add a and b
  110.       ld     (curcont),a            ;Load a into var
  111.       ld     a,(curcont)            
  112.       or     0C0h                ;Actually change contrast
  113.       call     _lcd_busy
  114.       out     (LCDINSTPORT),a
  115.       jp     mainloop
  116. less:                               ;decrease contrast
  117.     call    delay
  118.       ld     a,(curcont)
  119.       cp     23d
  120.       jr     z,noless
  121.       ld     a,(curcont)
  122.       ld     b,1d
  123.       sub     b
  124.       ld     (curcont),a
  125.       ld     a,(curcont)
  126.       or     0C0h
  127.       call     _lcd_busy
  128.       out     (LCDINSTPORT),a
  129.       jp     mainloop
  130. nomore:
  131.       jp mainloop
  132. noless:
  133.       jp mainloop
  134.  
  135. ;-------------------Edit Here-------------------------------
  136. one:
  137.     call    _clrLCDFull        ;Clear Screen
  138.     ld    a,1            ;Load 1->a
  139.     call    _setxxop1        ;Store a to OP1
  140.     call    _stox            ;Store op 1 to "X", the calculator basic x
  141.     jp    exit            ;Goto exit
  142.  
  143. two:
  144.     call    _clrLCDFull
  145.     ld    a,2
  146.     call    _setxxop1
  147.     call    _stox
  148.     jp    exit
  149.  
  150. three:
  151.     call    _clrLCDFull
  152.     ld    a,3
  153.     call    _setxxop1
  154.     call    _stox
  155.     jp    exit
  156.  
  157. ;--------------------End Editions Here ----------------------------------
  158.  
  159. delay:                    ;Produces a delay
  160.     PUSH AF
  161.     PUSH BC
  162.     LD BC, $3000
  163. delayLoop:
  164.     DEC BC
  165.     LD A, B
  166.     OR C
  167.     JR NZ, delayLoop
  168.     POP BC
  169.     POP AF
  170.     ret
  171.  
  172. Directory:
  173.     call    _clrLCDFull
  174.     LD    HL, (PROGPTR)        ; get offset to program/list table
  175.  
  176.     LD    A, 4            ; four programs/keypress
  177.  
  178. main_loop:
  179.     LD    (count), A        ; store latest update of count
  180.  
  181.     LD    A, (HL)            ; get type of data
  182.     AND    01FH            ; mask out bits 0-4
  183.  
  184.     CP    05H            ; program
  185.     JR    Z, program
  186.     CP    06H            ; protected program
  187.     JR    Z, program
  188.  
  189.     CP    01H            ; real list
  190.     JR    Z, list
  191.  
  192.     CP    0DH            ; complex list
  193.     JR    Z, list
  194.  
  195.     JR    the_end            ; unknown/end of list
  196.  
  197. program:
  198.     DEC    HL            ; move back 3 bytes to length-of-name
  199.     DEC    HL
  200.     DEC    HL
  201.  
  202.     CP    06h            ; display '*' for protected programs
  203.     JR    Z, protected
  204.     LD    A, ' '
  205.     JR    go_on
  206.  
  207. protected:
  208.     LD    A, '*'
  209.  
  210. go_on:
  211.     CALL    _PUTC
  212.  
  213.     LD    B, (HL)                ; load length-of-string
  214.  
  215. program_loop:
  216.     DEC    HL                ; move backwards to next char
  217.     LD    A, (HL)                ; load char
  218.        CALL    _PUTC                ; display char
  219.     DJNZ    program_loop
  220.  
  221.     DEC    HL                ; move backwards to next item
  222.         CALL    _NEWLINE
  223.  
  224.     LD    A, (count)            ; have we displayed four programs?
  225.     DEC    A
  226.     JR    NZ, main_loop
  227.  
  228. key_loop:
  229.     PUSH    HL
  230.         CALL    _GETKEY                ; wait for key
  231.     POP    HL
  232.         CP    kQuit
  233.     JR    Z, the_end
  234.         CP      kEnter                ; enter key?
  235.         JR      NZ, key_loop            ; no
  236.     LD    A, 4                ; four programs/keypress
  237.     JR    main_loop
  238.     
  239. list:
  240.     DEC    HL                    ; move back 3 bytes to length-of-name
  241.     DEC    HL
  242.     DEC    HL
  243.     LD    B, (HL)                ; load length-of-string
  244. list_loop:
  245.     DEC    HL                    ; move backwards to next char
  246.     DJNZ    list_loop
  247.  
  248.     DEC    HL                    ; move backwards to next item
  249.     
  250.     LD    A, (count)            ; no change really, load A
  251.     JP    main_loop
  252.  
  253. the_end:
  254.     call    wfk
  255.     jp    init
  256. wfk:
  257.     call    _getkey
  258.     cp    kEnter
  259.     jp    nz,wfk
  260.     ret
  261.  
  262. quit:
  263.     ld    a,0                
  264.     call    _setxxop1
  265.     call    _stox
  266.     jp    exit
  267.  
  268.  
  269. exit:
  270.       call _clrLCDFULL
  271.       ret
  272.  
  273. off:            
  274.        DI                 ; disable interrupts
  275.         LD A,001H
  276.         OUT (003H),A       ; turn off screen
  277.         LD A,000H
  278.         OUT (004H),A
  279.         EX AF,AF'
  280.         EXX
  281.         EI                 ; enable interrupts
  282.     jp    init
  283.  
  284. doshell:
  285.     .db    "DosShell v. 0.93",0
  286. author:
  287.     .db    "By: Ahmed El-Helw",0
  288. dir:
  289.     .db    "M - Dir C:\>",0
  290. count:
  291.     .DB        00h
  292.  
  293. ;----------------Edit Here ---------------
  294.  
  295. option1:
  296.     .db    "  1.  Spaze Invaders  ",0
  297. option2:
  298.     .db    "  2.  Insane Game  ",0
  299. option3:
  300.     .db    "  3.  Turbo Breakout II  ",0
  301.  
  302. ;--------------End Edit Here -------------
  303.  
  304. .end
  305. END
  306.