; Date: Thu, 16 May 1996 00:10:42 -0400 ; From: Andy Selle [aselle@mat.net] ; Subject: LZ: Menu Generation ; Here is the code I wrote for drawing menus. You just substitute the ; f1,f2,f3,f4, and f5 strings at the end for the desired choice and set the ; key loop to recognize these and take appropriate action. Here it is: ; The menu is drawn by calling the DrawMenu routine (simple enough :)) ; This is my menu drawing routine. This is pretty crude ; but it works. Please give me appropriate credit if you ; use this :). ; ;By Andy Selle (aselle@mat.net) ; #include "ti-85.h" .org 0 .db "Menu Drawer",0 ProgStart: ld a,4 out (5),a ROM_CALL(CLEARLCD) ld hl,(PROGRAM_ADDR) ;display text ld de,titlestr add hl,de ROM_CALL(D_ZT_STR) CALL_(DrawMenu) Wait: call GET_KEY cp K_EXIT ; Temporarily Enter is Exit As Well ret z HALT HALT JUMP_(Wait) ret DrawMenu: ; Draws the Menu ld C,7 ; | Top 2 lines drawn here CALL_(HLine) ; | ld C,8 ; | CALL_(HLine) ; | ld C,1 ; All the rest here is the dividers of the menu CALL_(Vline) ld C,2 CALL_(Vline) ld C,25 CALL_(Vline) ld C,26 CALL_(Vline) ld C,50 CALL_(Vline) ld C,51 CALL_(Vline) ld C,75 CALL_(Vline) ld C,76 CALL_(Vline) ld C,100 CALL_(Vline) ld C,101 CALL_(Vline) ld C,125 CALL_(Vline) ld C,126 CALL_(Vline) ; NOW DISPLAY TEXT ld hl,$3904 ; X=4 Y=57 ld ($8333),hl ld hl,(PROGRAM_ADDR) ld de,strf1 add hl,de ROM_CALL(D_ZM_STR) ; The F1 choice on the menu ld hl,$391C ; X=28 Y=57 ld ($8333),hl ld hl,(PROGRAM_ADDR) ld de,strf2 add hl,de ROM_CALL(D_ZM_STR) ; The F2 Choice on the Menu ld hl,$3935 ; X=53 Y=57 ld ($8333),hl ld hl,(PROGRAM_ADDR) ld de,strf3 add hl,de ROM_CALL(D_ZM_STR) ; The F3 Choice on the menu ld hl,$394E ; X=78 Y=57 ld ($8333),hl ld hl,(PROGRAM_ADDR) ld de,strf4 add hl,de ROM_CALL(D_ZM_STR) ; The F3 Choice on the menu ld hl,$3967 ; X=103 Y=57 ld ($8333),hl ld hl,(PROGRAM_ADDR) ld de,strf5 add hl,de ROM_CALL(D_ZM_STR) ; The F3 Choice on the menu ret Hline: ; Draws a Horizontal Line C=Y Coordinate ld B,126 HlineLoop: CALL_(PlotPixel) DJNZ HlineLoop ret Vline: ld B,7 Vlineloop: push BC ld A,B ld B,C ld C,A CALL_(PlotPixel) pop BC DJNZ Vlineloop ret PlotPixel: ; Routine By Magnus Hagander ROM_CALL(FIND_PIXEL) ld de,$FC00 add hl,de or (HL) ld (HL),a ret ;return to program. titlestr: .db "Menu Program",0 strf1: .db "F1",0 strf2: .db "F2",0 strf3: .db "F3",0 strf4: .db "F4",0 strf5: .db "F5",0 .end