Well, I've officially made my most complicated program in z80 asm ever...and pretty proud of it B) All it does is move a dot around the screen in response to arrow presses, but that in itself involves a fair bit of syntax knowledge, as I'm sure you all know. Unfortunately, while the compiled .8xp does work on my WabbitEmu emulator, it does not work on my actual TI-84 plus, which I find very confusing. Instead, the dot makes erratic jumps to the right and left whenever I press a different vertical (up/down) arrow key, and the horizontal keys won't even respond. Moreover, the screen doesn't seem to erase the point every time it moves, and even turns on several points at once sometimes. In short, the basic functionality of a moving dot is there, and the calculator seems to be responding to my key presses (quitting when I press clear/enter, etc) but the program has several bugs that never showed up when I was running it on an emulator. The code for this program is below...any idea what's wrong? Also, if you have any tips for optimizing this code, I'm always up for streamlining suggestions. Thanks in advance!
Code:
Code:
#include "ti83plus.inc"
.org $9D93
.db $BB, $6D
bcall(_clrLCDfull)
set fullScrnDraw, (IY + apiFlg4) ;So we can use last column/row
ld bc,$2F1E ;Initialize pixel coordinates at (47, 30)
ld a, kUp
jp prog
Loop:
bcall(_getKey)
prog:
cp kEnter ;End if Enter or Clear is pressed
jp z,End
cp kClear
jp z,End
cp kLeft
jp z,Left
cp kRight
jp z,Right
cp kUp
jp z,Up
cp kDown
jp z,Down
jp nz,loop
Left: ;Move dot left by one pixel if not at the left screen edge
ld a,b
cp 1
jp c,loop
ld d, 0
bcall(_Ipoint)
dec b
ld d,1
bcall(_Ipoint)
jp loop
Right: ;Move dot right by one pixel if not at the right screen edge
ld a,b
cp 95
jp nc,loop
ld d, 0
bcall(_Ipoint)
inc b
ld d,1
bcall(_Ipoint)
jp loop
Up: ;Move dot up by one pixel if not at the top screen edge
ld a,c
cp 63
jp nc,loop
ld d, 0
bcall(_Ipoint)
inc c
ld d,1
bcall(_Ipoint)
jp loop
Down: ;Move dot down by one pixel if not at the bottom screen edge
ld a,c
cp 1
jp c,loop
ld d, 0
bcall(_Ipoint)
dec c
ld d,1
bcall(_Ipoint)
jp loop
End:
bcall(_clrLCDfull)
ret
.end