A83: demo that moves a sprite around the screen
[Prev][Next][Index][Thread]
A83: demo that moves a sprite around the screen
For the heck of it, here's code that moves a sprite around the screen:
GDown = 01h
GLeft = 02h
GRight = 03h
GUp = 04h
GClear = 0Fh
tTitle: .db "DEMO",0
xpos = saferam3
ypos = xpos+1
lblStart:
;Position sprite at 16,16
ld hl,$1010
ld (xpos),hl
Loop:
call DrawSprites
bcall(_grbufcpy)
bcall(_cleargbuf)
call WaitKey
cp gClear
ret z
cp gLeft
jr z,Left
cp gRight
jr z,Right
cp gUp
jr z,Up
cp gDown
jr z,Down
jr Loop
Left:
ld a,(xpos)
sub 4
jr c,Loop
ld (xpos),a
jr Loop
Right:
ld a,(xpos)
add a,4
cp 96-8
jr nc,Loop
ld (xpos),a
jp Loop
Up:
ld a,(ypos)
sub 4
jp c,Loop
ld (ypos),a
jp loop
Down:
ld a,(ypos)
add a,4
cp 64-8
jp nc,Loop
ld (ypos),a
jp loop
DrawSprites:
ld a,(xpos)
ld b,8
ld hl,(ypos)
ld ix,smiley
jp ionputsprite
WaitKey:
ei
WaitKeyLoop:
halt
bcall(_getcsc)
or a
jr z,WaitKeyLoop
ret
smiley:
.db %00111100
.db %01000010
.db %10100101
.db %10000001
.db %10100101
.db %10011001
.db %01000010
.db %00111100
>From: Sk8a4good@aol.com
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: A83: Sprite Routine 83+
>Date: Sun, 14 Jan 2001 13:54:09 EST
>
>
>I have started programming asm for the 83+, and I can do the basics like
>shut
>off the calc, use get key and compare to jump to a label, but I cant seem
>to
>find an 83+ (MUST BE 83+) sprite routine. All I want is a small piece of
>code that moves a sprite left, right, up and down. Can somebody help me
>out?
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com