Got the erase to work by doing a 4D44h bcall (ClearRect, too lazy to look for name in the .inc). For reference:
Code:
; Program Name:
; Author(s):
; Description:
.nolist
#include "ti84pcse.inc"
#define PutMapFlags $4a
#define PutMapUseColor 4
.list
.db tExtTok,tAsm84CCmp
.org userMem
menuStart: ;Start of menu routine
bcall(_maybe_ClrLCDFull) ;Display the Header
ld b,1 ;Which group is being displayed
dispMenu: ;display the menu
ld c,1 ;Which item is highlighted
push bc
ld hl,txtHeader ;display the header
call dispHeader
ld a,b
cp 1
jr nz,dispMenu2
ld b,3
ld hl,txtItem1_1 ;Display Items in GA
call dispItems
jr dispMenu4
dispMenu2:
cp 2
jr nz,dispMenu3
ld b,3
ld hl,txtItem2_1 ;Display Items in GB
call dispItems
jr dispMenu4
dispMenu3:
ld b,3
ld hl,txtItem3_1 ;Display Items in GC
call dispItems
dispMenu4: ;Since every group has a quit, display it here
bcall(_NewLine)
ld hl,txtItemQuit
bcall(_PutS)
pop bc
menuLoop: ;Scan key loop to get user input
call curDraw
push bc ;save BC for later
bcall(_GetKey)
pop bc ;we'll need this for some routines with the new keypresses
cp kleft
jr z,mLeft
cp kright
jr z,mRight
cp kup
jr z, mUp
cp kdown
jr z, mDown
cp kenter
jr z, selection
cp k1 ;If user pressed 1, do action 1
jr z,item1
cp k2 ;If user pressed 2, do action 2
jp z,item2
cp k3 ;If user pressed 3, do action 3
jp z,item3
cp k4 ;If user pressed 4, quit
jp z,quit
jr menuLoop ;Else, invalid input. Wait for user to input new key
mUp:
call curErase1 ;erase the cursor
ld a,c ;check if the cursor is out of bounds
cp 1
jr z,menuLoop
dec c ;if not, decrease and return
jr menuLoop
mDown:
call curErase1 ;erase the cursor
ld a,c ;check if the cursor is out of bounds
cp 4
jr z,menuLoop
inc c ;if not, increase and return
jr menuLoop
mRight: ;change group
call curErase2
ld a,b ;check if already as far right as possible
cp 3
jr z,menuLoop
inc b
jp dispMenu
mLeft: ;change group
call curErase2
ld a,b ;check if already as far right as possible
cp 1
jr z,menuLoop
dec b
jp dispMenu
selection:
ld a,c
cp 1
jr z,item1
cp 2
jr z,item2
cp 3
jr z,item3
jp quit
item1: ;Action 1
push bc
bcall(_maybe_ClrLCDFull)
pop bc
ld de,0
ld (curRow),de
ld a,b
cp 1
jr nz,item1B
ld hl,txtSelect1_1 ;action 1 for group A
jr item1Done
item1B:
cp 2
jr nz,item1C
ld hl,txtSelect2_1 ;action 1 for group B
jr item1Done
item1C:
ld hl,txtSelect3_1 ;action 1 for group C
item1Done:
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
bcall(_PutS) ;we'll display the text now
bcall(_GetKey)
jp menuStart
item2: ;Action 2
push bc
bcall(_maybe_ClrLCDFull)
pop bc
ld de,0
ld (curRow),de
ld a,b
cp 1
jr nz,item2B
ld hl,txtSelect1_2 ;action 2 for group A
jr item2Done
item2B:
cp 2
jr nz,item2C
ld hl,txtSelect2_2 ;action 2 for group B
jr item2Done
item2C:
ld hl,txtSelect3_2 ;action 2 for group C
item2Done:
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
bcall(_PutS)
bcall(_GetKey)
jp menuStart
item3: ;Action 3
push bc
bcall(_maybe_ClrLCDFull)
pop bc
ld de,0
ld (curRow),de
ld a,b
cp 1
jr nz,item3B
ld hl,txtSelect1_3 ;action 3 for group A
jr item2Done
item3B:
cp 2
jr nz,item3C
ld hl,txtSelect2_3 ;action 3 for group B
jr item1Done
item3C:
ld hl,txtSelect3_3 ;action 3 for group C
item3Done:
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
bcall(_PutS)
bcall(_GetKey)
jp menuStart
quit: ;quit the program
bcall(_maybe_ClrLCDFull)
ret
;dispHeader
;
;displays the header centered and at the top
;
;Inputs: HL points to null-terminating string
;
;Output: text displayed, with the current group in inverse text
;
;Destroyed: a,de,hl
;
;Note: text string must be large text and take up the full line
;(use blank spaces to fill in gaps)
;
dispHeader: ;displays the header centered and at the top
ld de,0
ld (curRow),de
ld a,b
cp 1
jr nz,dispHeader1
set textInverse,(IY+TextFlags)
dispHeader1: ;group A
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
bcall(_PutS)
res textInverse,(IY+TextFlags)
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
bcall(_PutS)
cp 2
jr nz,dispHeader2
set textInverse,(IY+TextFlags)
dispHeader2: ;group B
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
bcall(_PutS)
res textInverse,(IY+TextFlags)
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
bcall(_PutS)
cp 3
jr nz,dispHeader3
set textInverse,(IY+TextFlags)
dispHeader3: ;group C
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
bcall(_PutS)
res textInverse,(IY+TextFlags)
ld hl,0
ld (curRow),hl
ret
;dispItems
;
;displays menu items at the start of the next line
;
;Inputs: HL points to null-terminating string
;
;Output: text displayed
;
;Destroyed: all
;
dispItems: ;displays menu items at the start of the next line
push bc
push hl
bcall(_NewLine)
pop hl
pop bc
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
bcall(_PutS)
djnz dispItems
ret
;curDraw
;
;Draws the cursor
;
;Inputs: C holds the highlighted item
;
;Outputs: Cursor displayed
;
;Destroyed: A
;
curDraw:
set textInverse,(IY+TextFlags) ;set inverse text
push af
ld a,5
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
xor a
ld (curCol),a
ld a,c
ld (curRow),a
add a,$30 ;Character offset
bcall(_PutC)
ld a,':'
bcall(_PutC)
push af
ld a,1
bcall(_GetColorValue) ;from a to de
ld (textFGcolor),de
set PutMapUseColor,(iy+PutMapFlags)
pop af
res textInverse,(IY+TextFlags)
ret
;curErase1
;
;Erase the cursor on list
;
;Inputs: C highlighted item
;
;Ouputs: Cursor erased
;
;Destroyed: A
;
curErase1: ;erase list
xor a
ld (curCol),a
ld a,c
ld (curRow),a
add a,$30 ;Character offset
bcall(_PutC)
ld a,':'
bcall(_PutC)
res textInverse,(IY+TextFlags)
push hl
push de
push bc
ld hl,0
ld de,1
ld b,55
ld c,160
bcall(4D44h) ;ClearRect
pop bc
pop de
pop hl
ret
;curErase2
;
;Erase the cursor on header
;
;Inputs: C highlighted item
;
;Ouputs: Cursor erased
;
;Destroyed: A
;
curErase2: ;erase header
xor a
ld (curCol),a
ld a,c
ld (curRow),a
add a,$30 ;Character offset
bcall(_PutC)
ld a,':'
bcall(_PutC)
res textInverse,(IY+TextFlags)
push hl
push de
push bc
ld hl,0
ld de,1
ld b,30
ld c,160
bcall(4D44h) ;ClearRect
pop bc
pop de
pop hl
ret
;========================================
;data
;========================================
txtHeader:
.db "GA",0
.db " ",0 ;space x 5
.db "GB",0
.db " ",0
.db "GC",0
txtItem1_1:
.db "1:A1",0
txtItem1_2:
.db "2:A2",0
txtItem1_3:
.db "3:A3",0
txtItem2_1:
.db "1:B1",0
txtItem2_2:
.db "2:B2",0
txtItem2_3:
.db "3:B3",0
txtItem3_1:
.db "1:C1",0
txtItem3_2:
.db "2:C2",0
txtItem3_3:
.db "3:C3",0
txtSelect1_1:
.db "You selected A1",0
txtSelect1_2:
.db "You selected A2",0
txtSelect1_3:
.db "You selected A3",0
txtSelect2_1:
.db "You selected B1",0
txtSelect2_2:
.db "You selected B2",0
txtSelect2_3:
.db "You selected B3",0
txtSelect3_1:
.db "You selected C1",0
txtSelect3_2:
.db "You selected C2",0
txtSelect3_3:
.db "You selected C3",0
txtItemQuit:
.db "4:Quit",0
ret
.end
.end