;FastSprite_______________________________ ;Input: Sprite in (HL), (b,c) | ;Output: Sprite xor'ed onto the screen | ;Destroyed: none | ;----------------------------------------- FastSprite: push af push bc push de push ix push hl push hl ;\ pop ix ; > hl -> ix ld hl, FSByte ;> point to Tempbyte ld (hl), c ;> put c into Byte for later use ld a, b rrca ;\ rrca ; > divide x by 8 in accumulator rrca ;/ rld ;> Rotate left 4 bytes or $FC ;> add a and $FC ld l, (hl) ;\ ld h, a ; > buncha loading going on ld a, b ;/ and 7 ;> mask out the shift number ld d, a ;> save the shift number ld e, 8 FSLoop: ld a, (ix) ;> get sprite data ld b, a inc ix ;> point to new sprite data byte ld c, 0 ;> clear c for shift use ld a, d ;> restore shift # for use cp 0 jp z, NoShift ld a, b ld b, d FSShift: srl a ;\ rr c ; \ dec b ; > shift until b < 0 jp z, Shiftend ; / jp FSShift ;/ NoShift: ld a, b Shiftend: xor (hl) ;> mix the shifted sprite w/screen ld (hl), a ;> and draw it to the screen inc hl ;> hl points to next screen byte ld a, c ;> accumulate the remaining shifted data xor (hl) ;> mix 'em ld (hl), a ;> draw it ld a, 15 ;\ add a, l ; \ ld l, a ; > Inc the 1 y value. jp nc, FSNoinc ; / inc h ;/ FSNoinc: dec e ; >check if loop is finished jp nz, FSLoop ;/ pop hl ;\ pop ix ; \ pop de ; > mmmpop boop be doop mmmpop pop bc ; / pop af ;/ ret FSByte: .db $00