Prev: 876B Up: Map Next: 8822
87C9: Print a character in the six-pixel font
Used by the routines at STORY_CHAR and SCROLL_STORY.
A character six pixels wide seldom sits in one byte: each row is shifted to the pixel in C and, when it runs over, the rest put into the next byte along. The font is at FONT, from the space: STORY_CHAR_9 + 8 times the character.
Input
A The character
HL The screen byte
C The pixel within it where the character starts
Output
HL The byte the next character starts in
C The pixel within it
NARROW_CHAR 87C9 PUSH AF
87CA PUSH BC
87CB PUSH DE
87CC PUSH HL
87CD LD L,A
87CE LD H,$00
87D0 ADD HL,HL
87D1 ADD HL,HL
87D2 ADD HL,HL
87D3 LD DE,STORY_CHAR_9
87D6 ADD HL,DE
87D7 EX DE,HL
87D8 POP HL
87D9 PUSH HL
87DA LD B,$08
NARROW_CHAR_0 87DC LD A,(DE)
87DD PUSH BC
87DE DEC C
87DF INC C
87E0 LD B,$FF
87E2 JR Z,NARROW_CHAR_2
NARROW_CHAR_1 87E4 SRL A
87E6 SRL B
87E8 DEC C
87E9 JR NZ,NARROW_CHAR_1
NARROW_CHAR_2 87EB LD C,A
87EC LD A,B
87ED CPL
87EE AND (HL)
87EF OR C
87F0 LD (HL),A
87F1 POP BC
87F2 DEC C
87F3 INC C
87F4 JR Z,NARROW_CHAR_4
87F6 PUSH BC
87F7 LD A,$08
87F9 SUB C
87FA LD C,A
87FB LD A,(DE)
87FC LD B,$FF
NARROW_CHAR_3 87FE SLA A
8800 SLA B
8802 DEC C
8803 JR NZ,NARROW_CHAR_3
8805 LD C,A
8806 LD A,B
8807 CPL
8808 INC HL
8809 AND (HL)
880A OR C
880B LD (HL),A
880C DEC HL
880D POP BC
NARROW_CHAR_4 880E INC DE
880F INC H
8810 DJNZ NARROW_CHAR_0
8812 POP HL
8813 POP DE
8814 POP BC
8815 LD A,C
8816 ADD A,$06
8818 CP $08
881A JR C,NARROW_CHAR_5
881C SUB $08
881E INC L
NARROW_CHAR_5 881F LD C,A
8820 POP AF
8821 RET
Prev: 876B Up: Map Next: 8822