Prev: C16A Up: Map Next: C2B1
C25D: Cycle the selected letter and draw it
Entered from name_entry_input with C = the masked direction bits. Advances or retreats the letter code at (HL) by one (wrapping through the blank marker $40), then falls through to redraw the corresponding glyph on screen.
Used by the routine at name_entry_input.
cycle_and_draw_letter C25D LD C,A C = masked input bits (bit 0 = next, bit 1 = previous)
C25E LD A,(HL) A = current letter code
C25F RR C Bit 0 -> A += 1
C261 ADC A,$00
C263 RR C Bit 1 -> A -= 1
C265 SBC A,$00
C267 CP $3F Wrap below the range to the top code ($5A)
C269 JR NZ,cycle_and_draw_letter_0
C26B LD A,$5A
cycle_and_draw_letter_0 C26D CP $5B Wrap above the range to the blank marker ($40)
C26F JR NZ,cycle_and_draw_letter_1
C271 LD A,$40
cycle_and_draw_letter_1 C273 LD (HL),A Store the new letter code
This entry point is used by the routine at name_entry_input.
cad_clear_locked C274 XOR A
This entry point is used by the routine at name_entry_input.
cycle_and_draw_letter_2 C275 LD ($C599),A Clear the "locked" flag (see name_entry_input)
This entry point is used by the routine at name_entry_input.
cad_draw_entry C278 LD A,(HL) A = letter code to draw
C279 LD C,$04
C27B CP $40 Test for the blank marker
C27D JR Z,cycle_and_draw_letter_3
C27F SUB $32 Map the letter code to a font-table index
C281 LD C,A
cycle_and_draw_letter_3 C282 LD A,C Compute this glyph's offset into the font bitmap table (index * 7, matching font[]'s 7-byte stride)
C283 RLCA
C284 LD B,A
C285 RLCA
C286 ADD A,B
C287 ADD A,C
C288 LD B,$00
C28A RL B
C28C LD C,A
C28D LD HL,($800C) HL = font bitmap table base
C290 ADD HL,BC HL -> this glyph's bitmap
This entry point is used by the routine at name_entry_input.
cad_draw_glyph C291 PUSH DE Save the screen address
C292 LD B,$04 Draw the top 4 pixel rows of the glyph, each row 256 bytes further down the ZX screen (same third)
cycle_and_draw_letter_4 C294 LD A,(HL)
C295 LD (DE),A
C296 INC D
C297 LD (DE),A
C298 INC D
C299 INC HL
C29A DJNZ cycle_and_draw_letter_4
C29C LD A,D Adjust DE across the screen-third boundary and down one character row (standard ZX non-linear screen addressing)
C29D SUB $08
C29F LD D,A
C2A0 LD A,E
C2A1 ADD A,$20
C2A3 LD E,A
C2A4 LD B,$03 Draw the remaining 3 pixel rows the same way
cycle_and_draw_letter_5 C2A6 LD A,(HL)
C2A7 LD (DE),A
C2A8 INC D
C2A9 LD (DE),A
C2AA INC D
C2AB INC HL
C2AC DJNZ cycle_and_draw_letter_5
C2AE POP DE Restore the screen address
C2AF INC E Advance one column, ready for the next glyph
C2B0 RET
Prev: C16A Up: Map Next: C2B1