#include "86.inc" #include "86Keys.inc" .org $D748 call _clrScrn ld hl, $0500 ld ($C00F), hl ;_curRow-Some of those friggin constants ld hl, Title ;don't work right... call _puts ld b, 104 ld c, 48 push bc ld de, Ship call drawsprite pop bc Top: ld a, 7 WaitLoop: HALT dec a or a jr NZ, WaitLoop PageKeys(Buttons) Key(Exit) ret Z PageKeys(Arrows) push af Key(Left) call Z, decb pop af Key(Right) call Z, incb jr Top Incb: ld a, 120 cp b ret Z call drawsprite inc b call drawsprite ret Decb: ld a, 1 cp b ret Z call drawsprite dec b call drawsprite ret DrawSprite: ;©1997 James Yopp. If you use it, leave this comment in the source. push hl push de push bc call FP ex de, hl ld b, (hl) inc hl DS_Loop: push bc push af push af ld b, (hl) ld c, (hl) add a, a jr C, DS_EndB DS_BLoop: SRL b add a, a jr nc, DS_BLoop DS_EndB: pop af DS_CLoop: SLA c SRL a jr nc, DS_CLoop inc hl ld a, (de) xor b ld (de), a inc de ld a, (de) xor c ld (de), a push hl ld hl, 15 add hl, de ex de, hl pop hl pop af pop bc DJNZ DS_Loop pop bc pop de pop hl ret FP: ;©1997 James Yopp. If you use it, leave this comment in the source. push de push bc push bc ld h, $FC SRL b SRL b SRL b ld l, b ld b, c ld de, 16 xor a ;A very short way of doing ld a, 0. This, however, BLoop: ;updates the flags (sometimes a bad thing) add hl, de cp b ;If I didn't use this stuff, the top display line jr Z, XitLoop ;wouldn't work. b would be decreased, leaving 255. dec b ;If you won't use the top line, change it. jr BLoop XitLoop: pop bc ld a, b and %00000111 ld b, a inc b ld a, %00000001 ALoop: RRCA DJNZ ALoop pop bc pop de ret Ship: .db 7 .db %00010000 .db %00010000 .db %00101000 .db %00101000 .db %01010100 .db %11000110 .db %11111110 Title: .db "Sprite Demo", 0 .end