Re: A83: Help a newbie


[Prev][Next][Index][Thread]

Re: A83: Help a newbie




I think i see the problem (scroll down)

In a message dated 10/12/1999 6:53:29 PM Eastern Daylight Time, 
smithrh@ispchannel.com writes:

<< 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?  <<of, course, but you forgot a ret 
at the end of                   ;clears to return back to here>> (scroll down)
    cp yequ         
 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
<<<<<<<<insert 'ret' here>>>>>>>>>
 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 >>