Now to my real problem. I'm trying out my first attempt at a full fledged game, but I can't seem to get past the whole title screen menu thing. I have a picture for the title screen in hex as a variable in the code with the different choices in it already ('Play' at row 36, 'Rules' at row 43, 'Credits' at row 50, and 'Quit' at row 57), and my code works when displaying the cursor (a * character) but I can't get it to clear out the previous space that the cursor was at when up or down was pressed.
This code clears the space that the cursor was at, but move the cursor up to the top of the screen for some reason. (am I going about it all wrong)? Thanks in advance!
Code: Select all
;Heavily commented just so I can keep my train of thought going
.nolist ;standard ION header
#define TI83P ;change this if on 83 to TI83
#define equ .EQU
#define EQU .EQU
#define end .END
#define END .END
_Random EQU 4B79h
_Intgr EQU 405Dh
#include "ion.inc"
#include "keys.inc"
.list
.org ProgStart-2
.db $BB,$6D
ret
jr nc,Start
.db "LCR Alpha",0
Start: ;title menu routine
bcall(_indicatoroff) ;Runindicator off and Clear screen
bcall(_clrlcdf)
ld bc,12*64 ;Prepare Graph Buffer for _grbufcpy to display Title screen
ld de,PlotSScreen
ld hl,Title
ldir
bcall(_grbufcpy) ;Display Title Screen
Drawcursor:
ld a,(Menucurpos) ;Load the cursor position to draw cursor
ld (penrow),a
ld a,0
ld (pencol),a
ld a,'*'
bcall(_vputmap) ;Draw it.
Keyloop:
bcall(_getkey) ;Simple, get a key and check it
cp $03
jr z,Up
cp $04
jr z,Down
cp $05
jr z,Enter
jr Keyloop
Up:
ld a,(Menucurpos) ;Check if cursor can go up
cp $21
jr z,Keyloop
ld a,(pencol) ;Set column back 6 to clear previous space
sub 6
ld (pencol),a
ld b,5 ;load a number into B to set # of times to put a space to clear
call Clearspace ;call Clearspace to put next instruction on stack to be returned to
ld a,(Menucurpos)
sub 7 ;move the penrow up 7 pixels to display cursor up 1 space
ld (Menucurpos),a
jr Drawcursor ;Go draw the new cursor
Down:
ld a,(Menucurpos)
cp $36
jr z,Keyloop
ld a,(pencol) ;Set column back 6 to clear previous space
sub 6
ld (pencol),a
ld b,5 ;load a number into B to set # of times to put a space to clear
call Clearspace ;call Clearspace to put next instruction on stack to be returned to
ld a,(Menucurpos)
add a,7 ;move the penrow down 7 pixels to display cursor down 1 space
ld (Menucurpos),a
jr Drawcursor ;Go draw the new cursor
Clearspace:
ld a,$20 ;Draw a space in column 0 and advance it 5 times to clear space
bcall(_vputmap)
dec b
jr nz,Clearspace
add a,7
ld (Menucurpos),a
ret ;go back to whichever label it came from
Enter:
jr Quit
Quit:
ret
........
....
Menucurpos:
.db $21