[A83] tell me why this Why does this not work?


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

[A83] tell me why this Why does this not work?




I am trying to move my 8x8 sprite over by 1 on the x axis each time a key is
pressed, but i try to move it and it says ram or rom (i got both) failed
then
mem cleared!! Let me know what i did wrong...the code is below.

I set PLAYER_X and PLAYER_Y = to TEXT_MEM2 + 8 / +9
and i also included my sprite

I had it simple, but then it wouldnt work so i got it complicated....it
should move the guy +1 on the X axis everytime a button is pressed
but it shows the guy at first. I press a button and it makes a
8x(screen_height) rectangle and then displays a 0 (zero) in the middle of
the screen
then it says rom failed and mem cleared.

Game:
 ld b,8
 ld a,(PLAYER_Y)
 ld l,a
 ld a,(PLAYER_X)

loop:
 ld ix,SPRITE_MAN
 call ionPutSprite
 bcall(_grbufcpy)

 bcall(_getkey)

 ld c,1
 ld a,(PLAYER_X)
 add a,c
 ld (PLAYER_X),a

 ld a,(PLAYER_Y)
 add a,c
 ld (PLAYER_Y),a

 ld a,(PLAYER_Y)
 ld l,a
 ld a,(PLAYER_X)


 cp 20
 jp nz,loop

 ret

SPRITE_MAN:
 .db %00011000
 .db %01111110
 .db %11111111
 .db %10011001
 .db %00011000
 .db %00111100
 .db %01000010
 .db %11000011


Dustin Davis
Lead Software Developer
Vision Works Studios





References: