A86: Re: moving a sprite


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

A86: Re: moving a sprite




Shouldn't it be:
    cp K_RIGHT
    jp z,move_sprite_right

The zero flag is set if the key if pressed, not reset.
--------------
Jbrett
tbarwick@esn.net
http://ww2.esn.net/~tbarwick
I just added a TI-86 page, Check it out!!!
-----Original Message-----
From: BlAsTo1414@aol.com <BlAsTo1414@aol.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Wednesday, September 16, 1998 8:41 PM
Subject: 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
>