Prev: EBFF Up: Map Next: ECDA
EC2C: Renders a single character
Compare draw_char
Input
Used by the routine at menu_draw_string.
I:A The character to plot (ASCII) I:F' Carry flag set to draw single height characters I:DE' Screen address (UDG aligned) I:HL' Attribute address
menu_draw_char EC2C SUB $20 Handle spaces
EC2E JR NZ,menu_draw_char_0
EC30 EXX
EC31 INC E
EC32 INC L Advance attribute address
EC33 EXX
EC34 RET
menu_draw_char_0 EC35 LD C,$12 Map character ranges:
EC37 CP $21 >= 'A' then glyph offset C=(65-32-18)=15
EC39 JR NC,menu_draw_char_1
EC3B LD C,$0B >= '0' then glyph offset C=(48-32-11)=5
EC3D CP $10
EC3F JR NC,menu_draw_char_1
EC41 LD C,$00 == '!' then glyph offset C=0
EC43 DEC A
EC44 JR Z,menu_draw_char_2
EC46 INC C == '(' then glyph offset C=1
EC47 SUB $07
EC49 JR Z,menu_draw_char_2
EC4B INC C == ')' then glyph offset C=2
EC4C DEC A
EC4D JR Z,menu_draw_char_2
EC4F INC C == ',' then glyph offset C=3
EC50 SUB $03
EC52 JR Z,menu_draw_char_2
EC54 INC C Anything else becomes a full stop
EC55 JR menu_draw_char_2
menu_draw_char_1 EC57 SUB C ASCII - 32 - offset in C
EC58 LD C,A
menu_draw_char_2 EC59 LD A,C Multiply C by seven - the height of a glyph
EC5A RLCA
EC5B LD B,A
EC5C RLCA
EC5D ADD A,B
EC5E ADD A,C
EC5F LD B,$00 BC = A -- Why the RL?
EC61 RL B
EC63 LD C,A
EC64 LD HL,$A27A Point HL at 8x7 font
EC67 ADD HL,BC Point at glyph
EC68 EXX
EC69 PUSH DE
EC6A INC E
EC6B EXX
EC6C POP DE
EC6D EX AF,AF'
EC6E JR C,=menu_draw_char_single_height If the carry flag is set then draw single height characters
EC70 EX AF,AF'
menu_draw_char_double_height EC71 LD A,(HL) Load a row of glyph
EC72 LD (DE),A Put it on the screen
EC73 INC D Move to next scanline
EC74 LDI Put another row
EC76 DEC E Undo LDI
EC77 INC D Move to next scanline
EC78 LD A,(HL) Repeat ...
EC79 LD (DE),A
EC7A INC D
EC7B LDI
EC7D DEC E
EC7E INC D
EC7F LD A,(HL)
EC80 LD (DE),A
EC81 INC D
EC82 LDI
EC84 DEC E
EC85 INC D
EC86 LD A,(HL)
EC87 LD (DE),A
EC88 INC D
EC89 LDI
EC8B LD A,E Move to next scanline after boundary (DE += $F81F)
EC8C ADD A,$1F
EC8E LD E,A
EC8F LD A,D
EC90 SUB $07
EC92 LD D,A Repeat ...
EC93 LD A,(HL)
EC94 LD (DE),A
EC95 INC D
EC96 LDI
EC98 DEC E
EC99 INC D
EC9A LD A,(HL)
EC9B LD (DE),A
EC9C INC D
EC9D LDI
EC9F DEC E
ECA0 INC D
ECA1 LD A,(HL)
ECA2 LD (DE),A
ECA3 INC D
ECA4 LDI
ECA6 DEC E
ECA7 INC D
ECA8 XOR A ..
ECA9 LD (DE),A
ECAA EXX
ECAB LD B,L Save L
ECAC SET 6,C Set the BRIGHT bit
ECAE LD (HL),C Set the screen attribute
ECAF LD A,L Move to the next attribute row
ECB0 ADD A,$20
ECB2 LD L,A
ECB3 RES 6,C Clear the BRIGHT bit
ECB5 LD (HL),C Set the screen attribute
ECB6 LD L,B Restore L
ECB7 INC L Advance cursor
ECB8 EXX
ECB9 RET Return
=menu_draw_char_single_height ECBA EX AF,AF' Plot 8x7 character HL->character, DE->screen
ECBB LDI
ECBD DEC E
ECBE INC D
ECBF LDI
ECC1 DEC E
ECC2 INC D
ECC3 LDI
ECC5 DEC E
ECC6 INC D
ECC7 LDI
ECC9 DEC E
ECCA INC D
ECCB LDI
ECCD DEC E
ECCE INC D
ECCF LDI
ECD1 DEC E
ECD2 INC D
ECD3 LDI
ECD5 EXX
ECD6 LD (HL),C Set the screen attribute
ECD7 INC L Advance cursor
ECD8 EXX
ECD9 RET Return
Prev: EBFF Up: Map Next: ECDA