Prev: 76e5 Up: Map Next: 7747
7705: Erase sprite pixels when actor/sprite moves.
Used by the routines at 7239, 7270, 7280 and 775b.
Input
B Loop counter.
C Actor Y position, or zero?
DE Address into a sprite/buffer.
HL Address in the DISPLAY_FILE.
Output
BC is this the unchanged input value?
HL is this the unchanged input value?
7705 ld a,c Jump if vertical position is zero
7706 and a
7707 jr z,$7742
7709 dec c else decrement
770a push bc
770b push hl
Loop to create a mask of the sprite and it write to the screen.
770c ld a,(de) A=sprite byte
770d cpl Create mask and write to screen
770e and (hl)
770f ld (hl),a
7710 inc de Next byte
7711 inc l Next column
7712 ld a,l
7713 and $1f
7715 jr nz,$771b If column is zero, subtract 32
7717 ld a,l
7718 sub $20
771a ld l,a
771b djnz $770c Repeat and process for next byte
771d pop hl Restore HL to be the display file address
771e call $72b6 Calculate new pixel position
7721 pop bc
7722 exx NOTE: what is in C' register before this swap?
7723 ld a,c Jump back to the top of routine if C is zero
7724 and a
7725 jr z,$773f
7727 dec c else decrement (vertical position?)
7728 push bc
7729 push hl
Merging sprite with current on-screen sprite (the mask?)
772a ld a,(de) Merge with current on-screen byte (mask?)
772b or (hl)
772c ld (hl),a
772d inc de Next sprite byte
772e inc l
772f ld a,l A=next column number
7730 and $1f
7732 jr nz,$7738 Set L to beginning of line if > 0 && < 32, and repeat process for next byte
7734 ld a,l
7735 sub $20
7737 ld l,a
7738 djnz $772a Repeat and process next byte
Calculate position for next pixel location
773a pop hl
773b call $72b6 Calculate new pixel position
773e pop bc
773f exx
7740 jr $7705 Loop back to top of routine
7742 exx
7743 ld a,c Jump if C != 0
7744 and a
7745 jr nz,$7727
Prev: 76e5 Up: Map Next: 7747