Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Let the input B=offset from byte (like if X=1, then B=1. X=7, then B=7.
- ; You must have already adjusted HL for X position wrt bytes, so if X=9
- ; then you must've incremented HL by 1 and take the modulo of X so then X is now 1
- ;IX=location of the sprite. We're only writing one sprite byte. You should know
- ;what to do with the rest...
- ld a,(ix+0) ;let this be the sprite byte for now.
- ld c,0
- inc b
- dec b ;checking to see if input B=0
- jr z,$+8 ;jump over rotating if the sprite is actually aligned.
- rrca
- scf
- rr c
- djnz $-4
- ld b,a ;saving the sprite byte in B
- ld a,(hl) ;getting the byte from the screen
- xor b ;masking in the sprite data
- and c ;removing screen data bits.
- xor b ;masking sprite data. That which was zero above will have sprite.
- ld (hl),a
- inc hl
- ld a,c
- cpl ;inverting the sprite mask so we can get the other half in
- ld c,a
- ld a,(hl)
- xor b
- and c
- xor b
- ld (hl),a
- ret ;sprite byte write is complete. Deal with the incremented HL somehow.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement