Prev: A0C9 Up: Map Next: A104
A0CB: Draw Icon
Used by the routines at RechargeBattery and QueueProgram.
Draws the pixels of a sprite that is three bytes wide, without its mask. The sprite is drawn from the bottom upwards, leaving out its first two rows (at the bottom) and its last row (at the top). This is used to draw the picture that shows the lives that are left.
Input
DE Address of the height byte of the sprite
HL Screen address of the bottom left of the icon
Output
HL Screen address four characters to the right of the icon
DrawIcon A0CB PUSH HL Save the screen address...
A0CC PUSH DE ...and the sprite address.
A0CD LD A,(DE) Fetch the height of the sprite...
A0CE SUB $03 ...and take three rows off it, as that is the number that are drawn.
A0D0 LD B,A Use that as the counter.
A0D1 LD A,E Skip the height byte and the first two rows of the sprite.
A0D2 ADD A,$0D
A0D4 LD E,A
A0D5 LD A,D
A0D6 ADC A,$00
A0D8 LD D,A
A0D9 EX DE,HL Point HL at the sprite data and DE at the screen.
Each row of the sprite has three pairs of bytes. The mask byte and the other byte are combined to find the pixels.
DrawIcon_Row A0DA LD A,(HL) Fetch the first mask byte...
A0DB INC HL ...and move on to the other byte.
A0DC XOR (HL) Combine the two...
A0DD LD (DE),A ...and write the pixels to the screen.
A0DE INC E Move on to the next byte of the screen.
A0DF INC HL Move on to the next pair.
A0E0 LD A,(HL) Fetch the second mask byte...
A0E1 INC HL ...and move on to the other byte.
A0E2 XOR (HL) Combine the two...
A0E3 LD (DE),A ...and write the pixels to the screen.
A0E4 INC E Move on to the next byte of the screen.
A0E5 INC HL Move on to the next pair.
A0E6 LD A,(HL) Fetch the third mask byte...
A0E7 INC HL ...and move on to the other byte.
A0E8 XOR (HL) Combine the two...
A0E9 LD (DE),A ...and write the pixels to the screen.
A0EA INC HL Move on to the next row of the sprite.
A0EB DEC E Move back to the start of the row on the screen.
A0EC DEC E
A0ED LD A,D Move up one pixel row on the screen.
A0EE DEC D
A0EF AND $07 Jump if that is still inside the same character row.
A0F1 JR NZ,DrawIcon_NextRow
A0F3 LD A,D Otherwise go back to the bottom pixel row of the character row...
A0F4 ADD A,$08
A0F6 LD D,A
A0F7 LD A,E ...and move up to the next character row.
A0F8 SUB $20
A0FA LD E,A
DrawIcon_NextRow A0FB DJNZ DrawIcon_Row Loop back until every row has been drawn.
A0FD POP DE Restore the sprite address...
A0FE POP HL ...and the screen address.
A0FF LD A,L Move four characters to the right.
A100 ADD A,$04
A102 LD L,A
A103 RET Return.
Prev: A0C9 Up: Map Next: A104