Prev: D2B0 Up: Map Next: D2DD
D2C9: Draw Character
Used by the routines at GameMenu, HandleMenuBullet and DrawDigits.
Draws a character which is 08 pixels wide and 10 high, from a font of 08 bytes for each character. The first four bytes are drawn as the upper half and the last four as the lower half, with every byte drawn on two lines.
Input
A The number of the character
BC The address of the font
HL The screen address
A' The attribute
Output
HL The screen address of the next character on the right
Find the character in the font.
DrawCharacter D2C9 PUSH BC Stash the registers on the stack.
D2CA PUSH DE
D2CB PUSH HL
D2CC EX DE,HL Keep the screen address in DE.
D2CD LD L,A Move the number of the character to HL.
D2CE LD H,$00
D2D0 ADD HL,HL Multiply it by 08 and add the address of the font.
D2D1 ADD HL,HL
D2D2 ADD HL,HL
D2D3 ADD HL,BC
D2D4 EX DE,HL Put the address of the character in DE and the screen address in HL.
Draw the character.
D2D5 CALL DrawDoubleHeightCharacter Call DrawDoubleHeightCharacter.
D2D8 POP HL Restore the screen address from the stack.
D2D9 INC L Move on to the next column.
D2DA POP DE Restore the registers from the stack.
D2DB POP BC
D2DC RET Return.
Prev: D2B0 Up: Map Next: D2DD