A86: moving a sprite


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

A86: moving a sprite




I've been working with this code for hours.  I can't see anything wrong with
it but it doesn't work.  I think, maybe, whats wrong is the get_key calls.
K_rightand K_left aren't right maybe?  could someone PLEASE take a glance at
this code and maybe let me know whats wrong?  Thanks a whole lot!

#include "asm86.h"
#include "ti86asm.inc"

.org _asm_exec_ram


draw_first_sprite:
     ld d,1
     ld e,5
     ld hl,Sprite
     call Draw_Sprite

key_loop:
     call GET_KEY
     cp K_RIGHT
     jp nz,move_sprite_right
     cp K_LEFT
     jp nz,move_sprite_left
     jp key_loop

move_sprite_right:
     inc d
     ld hl,Sprite
     call Draw_Sprite
     jp key_loop

move_sprite_left:
     dec d
     ld hl,Sprite
     call Draw_Sprite
     jp key_loop

Draw_Sprite:
 ld h,63		 ld a,c add a,a			 add a,a ld l,a add hl,hl		 add hl,hl ld a,b		 rra
rra rra or l			 ld l,a ld a,7		 and b ld d,a			 ld e,8			 push bc
 retSprite:
	.db %00111000
	.db %00111000
	.db %00010100
	.db %00111111
	.db %01010100
	.db %11110000
	.db %00011000
	.db %00100100
.end