A83: moving a sprite


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

A83: moving a sprite




I am making a simple program to help me understand asm graphics in ION

I am trying to make this program work but i just won't do the job

all i want it to do is when you press the left key go left and that's it

here is the code

.nolist
#include "ion.inc"
.list
#ifdef TI83P
        .org    progstart-2
        .db     $BB,6D
#else
        .org    progstart
#endif

#DEFINE kLeft       02h
#DEFINE kRight      01h
#DEFINE kUp         03h
#DEFINE kDown       04h
#DEFINE kMode       45h
#DEFINE moveby      8d
        xor a
        jr      nc,begin               ;where to go to start the program
        .db     "My First Animation",0 ;the title
begin:
        ld b,8                  ;the sprite is 8 high
        ld a,0                  ;make register a equal zero (0)
        ld l,a                  ;now make register l equal (0)
psprite:
        ld ix,sprite            ;load the sprite into register ix
        call ionPutSprite       ;call the library
        bcall(_grbufcpy)        ;copy the graph buffer to the 
screen--displays the sprite!
dud:
        bcall(_getkey)          ;pause until key pressed
        cp kRight
        jp z, left
        cp kMode
        jp z, endprog
        jp nz, dud
endprog:
        ret                     ;return to ION
left:
        ld c, a
        ld a, l
        add a, moveby
        ld l, a
        ld a, c
        jp psprite
sprite: ;defines the sprite! 1=pixel on and 0=pixel off
        .db %00111100
        .db %01000010
        .db %10001001
        .db %10000101
        .db %10000001
        .db %10000001
        .db %01000010
        .db %00111100
.end
END

Please help


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com