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


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

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




The height was set to 0 (256).  You need to load 8 into b each time.
Because the height was set to 0 (256), it overwrote the memory after the 
graph memory and caused Bad Things to happen.

See, ionPutSprite DESTROYS bc, so you need to set b to 8 every time you call 
it.

>From: "Dustin Davis" <titan2782@hotmail.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: <assembly-83@lists.ticalc.org>
>Subject: [A83] tell me why this Why does this not work?
>Date: Wed, 4 Apr 2001 17:52:31 -0700
>
>
>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
>
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com





Follow-Ups: