Prev: B67C Up: Map Next: B76C
B716: Masked sprite plotter
This plots a lot of the game's masked graphics.
The stack points to pairs of bitmap and mask bytes and HL must point to the screen buffer. Uses AND-OR type masking. Proceeds left-right. Doesn't flip the bytes so there must be an alternative for that.
Input
B Rows
DE Stride (e.g. 10 for 40px wide)
HL Address of data to plot
plot_masked_sprite B716 LD ($B720),SP Save SP for restoration on exit
B71A JR plot_masked_sprite_entry
plot_masked_sprite_loop B71C EXX
B71D DJNZ plot_masked_sprite_0
B71F LD SP,$0000 Restore original SP
B722 RET
plot_masked_sprite_0 B723 ADD HL,DE
This entry point is used by the routine at sub_b7ef.
plot_masked_sprite_entry B724 LD SP,HL Point HL at the graphic data
B725 EXX
B726 LD C,L
B727 JP (IX)
plot_masked_sprite_core_thingy B729 POP DE Load a bitmap and mask pair (D,E)
B72A LD A,(HL) Load the screen pixels and AND with mask
B72B AND E
B72C OR D OR in new pixels and store back to screen
B72D LD (HL),A
B72E INC L Move to next screen pixel
B72F POP DE <Repeat 8 times>
B730 LD A,(HL)
B731 AND E
B732 OR D
B733 LD (HL),A
B734 INC L
B735 POP DE
B736 LD A,(HL)
B737 AND E
B738 OR D
B739 LD (HL),A
B73A INC L
B73B POP DE
B73C LD A,(HL)
B73D AND E
B73E OR D
B73F LD (HL),A
B740 INC L
B741 POP DE
B742 LD A,(HL)
B743 AND E
B744 OR D
B745 LD (HL),A
B746 INC L
B747 POP DE
B748 LD A,(HL)
B749 AND E
B74A OR D
B74B LD (HL),A
B74C INC L
B74D POP DE
B74E LD A,(HL)
B74F AND E
B750 OR D
B751 LD (HL),A
B752 INC L
B753 POP DE
B754 LD A,(HL)
B755 AND E
B756 OR D
B757 LD (HL),A
B758 LD L,C Handle end of row. This must be adjusting the screen pointer.
B759 LD A,H
B75A DEC H
B75B AND B
B75C JP NZ,plot_masked_sprite_loop
B75F LD A,L
B760 SUB $20
B762 LD L,A
B763 JR C,plot_masked_sprite_loop
B765 LD A,H
B766 ADD A,$10
B768 LD H,A
B769 JP plot_masked_sprite_loop
Prev: B67C Up: Map Next: B76C