LZ: Me agian Same Problem


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

LZ: Me agian Same Problem



Well i still cannot figure out why the program (etch a sketch ) has this 
bug... the bug is that it will only draw a few pixels to the left (but as many 
as wanted to all other directions).... the only thing i noticed is that maybe 
the problem comes into play b/c left: is the last of the directional labels 
here is the new code... if anyone sees the problem let me know thanx...


#include "ti-85.h"
.org 0
.db "By Frank Apap",0


Init:
 ld a,4
 out (5),a
 ROM_CALL(CLEARLCD)
 ld b,40                   ; x start
 ld c,40                   ; y start


Start:
    call GET_KEY   ; get a key
    cp K_UP
    CALL_Z(up)
    cp K_DOWN
    CALL_Z(down)
    cp K_LEFT
    CALL_Z(left)
    cp K_RIGHT
    CALL_Z(right)
    cp 0F
    JUMP_Z(clear)
    cp $37
    JUMP_Z(exit)
    jr Start
up:
  inc c  ; x=x+1
  CALL_(PlotPixel) ; draw it
  ret


down:
     dec c ; x=x-1
     CALL_(PlotPixel)
     ret


right:
  inc b  ; y=y+1
  CALL_(PlotPixel) ; draw it
  ret    ; go back


left:
  dec b  ; y=y-1
  CALL_(PlotPixel) ; draw it
  ret   ;                                 Maybe this is wrong? not sure
clear:
    ROM_CALL(CLEARLCD)
    JUMP_(init)


PlotPixel:
    ROM_CALL(FIND_PIXEL)
    ld de,$FC00
    add hl,de
    or (HL)
    ld (HL),a
    ret


exit:
     ROM_CALL(CLEARLCD)
     ld hl,$1A1A
     ld ($8333), hl
     ld hl, (PROGRAM_ADDR)
     ld de,bye
     add hl,de
     ROM_CALL(D_ZM_STR)
exitloop: 
   call GET_KEY
   cp $37
   ret z
   jr nz,exitloop  


bye: .db "BYE THANKS FOR TESTING",0
.end
  


Follow-Ups: