Prev: B716 Up: Map Next: B7EF
B76C: Masked sprite plotter which flips
Used by the routine at draw_object_right.
plot_masked_sprite_flipped B76C LD D,$00 DE = A
B76E LD E,A
B76F ADD HL,DE HL += DE
This entry point is used by the routine at sub_b67c.
plot_masked_sprite_flipped_0 B770 EX DE,HL
B771 LD ($B792),SP Save SP for restoration on exit
B775 LD IX,$B79C Point IX at jump table
B779 CPL Subtract 8
B77A ADD A,$09
B77C RLCA Multiply by 8 -- length of jump table sequences
B77D RLCA
B77E RLCA
B77F LD C,A Add to IX
B780 LD B,$00
B782 ADD IX,BC
B784 LD H,$EF H = $EF
B786 EXX
B787 LD D,$00
B789 JR plot_masked_sprite_flipped_4
plot_masked_sprite_flipped_1 B78B EX AF,AF'
B78C LD E,A
plot_masked_sprite_flipped_2 B78D EX AF,AF'
B78E EXX Bank
B78F DJNZ plot_masked_sprite_flipped_3 Next scanline
B791 LD SP,$0000 Restore SP (self modified)
B794 RET Return
plot_masked_sprite_flipped_3 B795 ADD HL,DE Calculate address of next bitmap scanline
plot_masked_sprite_flipped_4 B796 LD SP,HL Put it in SP (so we can use POP for speed)
B797 EXX Unbank
B798 LD A,E
B799 EX AF,AF'
B79A JP (IX) Jump
pmsf_jumptable B79C POP BC Load a bitmap and mask pair (B,C)
B79D LD L,C Set flip table index (assuming table is aligned)
B79E LD A,(DE) Load the screen pixels
B79F AND (HL) AND screen pixels with flipped mask
B7A0 LD L,B Set flip table index
B7A1 OR (HL) OR in new flipped pixels
B7A2 LD (DE),A Store back to the screen
B7A3 DEC E Move to next screen pixel (downwards in memory)
B7A4 POP BC <Repeat 9 times>
B7A5 LD L,C
B7A6 LD A,(DE)
B7A7 AND (HL)
B7A8 LD L,B
B7A9 OR (HL)
B7AA LD (DE),A
B7AB DEC E
B7AC POP BC
B7AD LD L,C
B7AE LD A,(DE)
B7AF AND (HL)
B7B0 LD L,B
B7B1 OR (HL)
B7B2 LD (DE),A
B7B3 DEC E
B7B4 POP BC
B7B5 LD L,C
B7B6 LD A,(DE)
B7B7 AND (HL)
B7B8 LD L,B
B7B9 OR (HL)
B7BA LD (DE),A
B7BB DEC E
B7BC POP BC
B7BD LD L,C
B7BE LD A,(DE)
B7BF AND (HL)
B7C0 LD L,B
B7C1 OR (HL)
B7C2 LD (DE),A
B7C3 DEC E
B7C4 POP BC
B7C5 LD L,C
B7C6 LD A,(DE)
B7C7 AND (HL)
B7C8 LD L,B
B7C9 OR (HL)
B7CA LD (DE),A
B7CB DEC E
B7CC POP BC
B7CD LD L,C
B7CE LD A,(DE)
B7CF AND (HL)
B7D0 LD L,B
B7D1 OR (HL)
B7D2 LD (DE),A
B7D3 DEC E
B7D4 POP BC
B7D5 LD L,C
B7D6 LD A,(DE)
B7D7 AND (HL)
B7D8 LD L,B
B7D9 OR (HL)
B7DA LD (DE),A
B7DB LD A,D
B7DC DEC D
B7DD AND $0F
B7DF JP NZ,plot_masked_sprite_flipped_1
B7E2 EX AF,AF'
B7E3 SUB $20
B7E5 LD E,A
B7E6 JR C,plot_masked_sprite_flipped_2 Loop
B7E8 LD A,D
B7E9 ADD A,$10
B7EB LD D,A
B7EC JP plot_masked_sprite_flipped_2 Loop
Prev: B716 Up: Map Next: B7EF