Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ; Let the input B=offset from byte (like if X=1, then B=1. X=7, then B=7.
  2. ; You must have already adjusted HL for X position wrt bytes, so if X=9
  3. ; then you must've incremented HL by 1 and take the modulo of X so then X is now 1
  4. ;IX=location of the sprite. We're only writing one sprite byte. You should know
  5. ;what to do with the rest...
  6.  
  7. ld a,(ix+0) ;let this be the sprite byte for now.
  8. ld c,0
  9. inc b
  10. dec b ;checking to see if input B=0
  11. jr z,$+8 ;jump over rotating if the sprite is actually aligned.
  12. rrca
  13. scf
  14. rr c
  15. djnz $-4
  16. ld b,a ;saving the sprite byte in B
  17. ld a,(hl) ;getting the byte from the screen
  18. xor b ;masking in the sprite data
  19. and c ;removing screen data bits.
  20. xor b ;masking sprite data. That which was zero above will have sprite.
  21. ld (hl),a
  22. inc hl
  23. ld a,c
  24. cpl ;inverting the sprite mask so we can get the other half in
  25. ld c,a
  26. ld a,(hl)
  27. xor b
  28. and c
  29. xor b
  30. ld (hl),a
  31. ret ;sprite byte write is complete. Deal with the incremented HL somehow.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement