A83: Help a newbie
[Prev][Next][Index][Thread]
A83: Help a newbie
Hello everyone,
I'm just into asm now, and I was writing this program modeled after one of
James' tutorials. Basically, this program starts with a pixel in the middle
of the screen and draws a continuos line (in the direction of keypad
presses), until the y-equals key is pressed. Then a single dot moves around
until you press y-equals again, at which point it will draw the line again.
Also, if the dot is moving around, it will erase any previously drawn
pixels it encounters. Finally, pressing clear is supposed to clear the
screen. The dot is supposed to begin moving from that point again. The
problem I have is that after I press clear, the screen clears, but after
that nothing moves (you'll see when you run it). It is just a blank screen.
It's not frozen though. You can still 2nd quit out of it. I'll comment it
at the points I am unsure of. Could anyone show me what's wrong? Thanks,
Nathan Smith
.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "tokens.inc"
.LIST
#define left 02h
#define right 01h
#define up 03h
#define down 04h
#define clear 09h
#define yequ 49h
#define enter 05h
.org 9327h
call _clrLCDFull
call _grbufclr
ld b,47
ld c,32
ld d,1
call _IPoint
call _runIndicOff
;This draws a line
getkey:
call _getkey
cp left
jp z,Left
cp right
jp z,Right
cp up
jp z,Up
cp down
jp z,Down
cp clear
call z,clears ;Is this legal? I don't do it down below where i have jp
z,clears (i just want it to
cp yequ ;do the instructions in clears and return back to this point in
the loop
jp z,getkeya
cp enter
jp z,quit
jp getkey
clears: ;this originally was only the clear lcd and grafbuf, but I was
attempting to get the pixel
;to display where it was before it was cleared
ld h,b
ld l,c
ld a,d
call _clrLCDFull
call _grbufclr
ld b,h
ld c,l
ld d,a
call _IPoint
Left:
dec b
ld d,1 ;Is it necessary to have ld d,1 every time? I don't change it myself
call _IPoint
jp getkey
Right:
inc b
ld d,1
call _IPoint
jp getkey
Up:
inc c
ld d,1
call _IPoint
jp getkey
Down:
dec c
ld d,1
call _IPoint
jp getkey
quit:
call _clrLCDFull
call _grbufclr
ld hl,0000h
ld (pencol),hl
ld hl,texta
call _vputs
ret
;This moves a point around, modeled after James' tutorial: the labels all
are similar to above, but an "a" is added
getkeya:
call _getkey
cp left
jp z,Lefta
cp right
jp z,Righta
cp up
jp z,Upa
cp down
jp z,Downa
cp clear
jp z,clears
cp yequ
jp z,getkey
cp enter
jp z,quit
jp getkeya
Lefta:
ld d,0
call _IPoint
dec b
jp draw
Righta:
ld d,0
call _IPoint
inc b
jp draw
Upa:
ld d,0
call _IPoint
inc c
jp draw
Downa:
ld d,0
call _IPoint
dec c
jp draw
Draw:
ld d,1
call _Ipoint
jp getkeya
texta:
.db "Draw-Nathan Smith 10-9-99",0
.end
END