LZ: New method didnt work either


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

LZ: New method didnt work either



I am really getting confused i tried Barrym's idea of storing the X and Y 
values in memory but i still get the bug that it wont go left more the 3 or 4 
pixels but all other directions work... here is the new code:


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


X = $80E0                   ;X in mem
Y = $80E1                   ; Y in mem   
Init:
 ld a,4
 out (5),a
 ROM_CALL(CLEARLCD)
 ld a,30                   ; x start
 ld (X),a
 ld a,60                   ; y start
 ld (Y),a


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:
  ld a,(X)  ; x=x+1
  inc a
  ld (X),a
  CALL_(PlotPixel) ; draw it
  ret


down:
     ld a,(X)
     dec a
     ld (X),a ; x=x-1
     CALL_(PlotPixel)
     ret


right:
  ld a,(Y)  ; y=y+1
  inc a
  ld (Y),a
  CALL_(PlotPixel) ; draw it
  ret    ; go back


left:
  ld a,(Y)                           \
  dec a                               \ 
  ld (Y),a                             >  IS SOMETHING WRONG? 
  CALL_(PlotPixel) ; draw it          / 
  ret   ; go back                    /


clear:
    
    ROM_CALL(CLEARLCD)
    JUMP_(init)


PlotPixel:
    ld a,(Y) ; LOAD Y into B
    ld b,a
    ld a,(X)  ; LOAD X into C
    ld c,a
    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: