0 Members and 1 Guest are viewing this topic.
#include "ti83plus.inc"#define progStart $9D95.org progStart-2.db $BB,$6Dx .equ AppBackUpScreeny .equ AppBackUpScreen+1 push bc push de ld hl,x ld (hl),0 ld hl,y ld (hl),0MainLoop: call EraseSpr ld a,%11111110 out ($01),a in a,($01) ld b,a bit 0,b call z,Down bit 1,b call z,Left bit 2,b call z,Right bit 3,b call z,Up call DrawSpr ld a,%11111101 out ($01),a in a,($01) cp %10111111 jr nz,MainLoop pop de pop bc retDown: ld hl,y ld a,(hl) cp 55 ret z inc (hl) retUp: ld hl,y ld a,(hl) cp 0 ret z dec (hl) retLeft: ld hl,x ld a,(hl) cp 0 ret z dec (hl) retRight: ld hl,x ld a,(hl) cp 87 ret z inc (hl) retBoxPic:.db 1,8.db %11111111.db %10000001.db %10000001.db %10000001.db %10000001.db %11111111BoxErase:.db 1,8.db 0.db 0.db 0.db 0.db 0.db 0DrawSpr: ld hl,y ld d,(hl) ld hl,x ld e,(hl) ld hl,BoxPic bcall(_DisplayImage) retEraseSpr: ld hl,y ld d,(hl) ld hl,x ld e,(hl) ld hl,BoxErase bcall(_DisplayImage) ret
ionPutSprite: Draw a sprite to the graph buffer (XOR). Input: b=sprite height a=x coordinate l=y coordinate ix->sprite Output: Sprite is XORed to the graph buffer. ix->next sprite Destroys: af bc de hl ix
putSprite: ld e,l ld h,$00 ld d,h add hl,de add hl,de add hl,hl add hl,hl ;Find the Y displacement offset ld e,a and $07 ;Find the bit number ld c,a srl e srl e srl e add hl,de ;Find the X displacement offset ld de,gbuf add hl,deputSpriteLoop1:sl1: ld d,(ix) ;loads image byte into D ld e,$00 ld a,c or a jr z,putSpriteSkip1putSpriteLoop2: srl d ;rotate to give out smooth moving rr e dec a jr nz,putSpriteLoop2putSpriteSkip1: ld a,(hl) xor d ld (hl),a inc hl ld a,(hl) xor e ld (hl),a ;copy to buffer using XOR logic ld de,$0B add hl,de inc ix ;Set for next byte of image djnz putSpriteLoop1 ret