Prev: C2B1 Up: Map Next: C3AF
C2F6: Redraw a high-score row's name text, letter by letter
Reached from scroll_score_rows when a row's scroll position hits the bottom of its window, and from insert_high_score_entry (via the redraw_name_frame entry point) once per name-entry frame. Draws each character of the row's name field (terminated by a byte with bit 7 set) using the shadow register set, so the caller's main BC/DE/HL (the scroll_score_rows row loop, or the caller's own state) survive the call unharmed. The per-character glyph offset/address arithmetic here mirrors cycle_and_draw_letter and is not traced line-by-line.
Used by the routine at scroll_score_rows.
redraw_score_name C2F6 LD A,B
C2F7 CP $09
C2F9 JR NZ,rsn_char_loop
This entry point is used by the routine at insert_high_score_entry.
redraw_name_frame C2FB PUSH HL Toggle a blink flag at $C58D
C2FC LD HL,$C58D
C2FF RLC (HL)
C301 POP HL
C302 JR C,rsn_char_loop2 Alternate blink phase -> the second name-draw loop below
rsn_char_loop C304 LD A,(HL) A = next name character
C305 AND $7F
C307 SUB $20
C309 JP NZ,redraw_score_name_1 Non-space -> draw it
redraw_score_name_0 C30C INC E Space -> just advance one column
C30D BIT 7,(HL) Test for end of name (bit 7 set)
C30F INC HL
C310 JP Z,rsn_char_loop No -> next character
C313 JP ssr_continue Yes -> resume the scroll_score_rows scroll loop
redraw_score_name_1 C316 PUSH DE Move the screen address into the shadow DE
C317 EXX
C318 POP DE
C319 LD C,$12
C31B CP $21
C31D JR NC,redraw_score_name_2
C31F LD C,$0B
C321 CP $10
C323 JP NC,redraw_score_name_2
C326 LD C,$00
C328 DEC A
C329 JR Z,redraw_score_name_3
C32B INC C
C32C SUB $07
C32E JR Z,redraw_score_name_3
C330 INC C
C331 DEC A
C332 JR Z,redraw_score_name_3
C334 INC C
C335 SUB $03
C337 JR Z,redraw_score_name_3
C339 INC C
C33A JR redraw_score_name_3
redraw_score_name_2 C33C SUB C
C33D LD C,A
redraw_score_name_3 C33E LD A,C Compute this glyph's bitmap address in font table $800C (offset = index * 7, as in cycle_and_draw_letter)
C33F RLCA
C340 LD B,A
C341 RLCA
C342 ADD A,B
C343 ADD A,C
C344 LD B,$00
C346 RL B
C348 LD C,A
C349 LD HL,($800C)
C34C ADD HL,BC
C34D LD BC,$0007
C350 XOR A
C351 LD (DE),A
C352 INC E
rsn_draw_row C353 INC D Draw one pixel row of the glyph, handling the screen third-boundary wrap (as in cycle_and_draw_letter / scroll_score_rows)
C354 LD A,D
C355 AND $07
C357 JR Z,redraw_score_name_5
C359 DEC E
redraw_score_name_4 C35A LDI
C35C JP PE,rsn_draw_row More glyph rows to draw
C35F EXX Restore the caller's BC/DE/HL
C360 JP redraw_score_name_0 Next character
redraw_score_name_5 C363 LD A,D Screen-third boundary wrap
C364 SUB $08
C366 LD D,A
C367 LD A,E
C368 ADD A,$1F
C36A LD E,A
C36B JP NC,redraw_score_name_4
C36E LD A,D
C36F ADD A,$08
C371 LD D,A
C372 LDI
C374 JP PE,rsn_draw_row
C377 EXX Restore the caller's BC/DE/HL
C378 JP redraw_score_name_0 Next character
Second name-draw loop, used on the alternate blink phase ($C302): scans the same string as the draw loop above (bit-7-terminated, checked at $C37C/$C384) but instead of looking up and blitting each glyph's bitmap, it writes 8 rows of zero bytes per character ($C390-$C3A9, same screen-third-wrap handling as $C363-$C371) -- i.e. this erases the text rather than drawing it, giving the name-entry cursor its blink effect by alternating between rsn_char_loop (draw) and this loop (erase) each frame.
rsn_char_loop2 C37B LD A,(HL)
C37C AND $7F
C37E SUB $20
C380 JP NZ,redraw_score_name_7
redraw_score_name_6 C383 INC E
C384 BIT 7,(HL)
C386 INC HL
C387 JP Z,rsn_char_loop2
C38A JP ssr_continue Resume the scroll_score_rows scroll loop
redraw_score_name_7 C38D PUSH DE
C38E EXX
C38F POP DE
C390 LD B,$08
redraw_score_name_8 C392 XOR A
C393 LD (DE),A
C394 INC D
C395 LD A,D
C396 AND $07
C398 JR NZ,redraw_score_name_9
C39A LD A,D
C39B SUB $08
C39D LD D,A
C39E LD A,E
C39F ADD A,$20
C3A1 LD E,A
C3A2 JP NC,redraw_score_name_9
C3A5 LD A,D
C3A6 ADD A,$08
C3A8 LD D,A
redraw_score_name_9 C3A9 DJNZ redraw_score_name_8
C3AB EXX Restore the caller's BC/DE/HL
C3AC JP redraw_score_name_6 Next character
Prev: C2B1 Up: Map Next: C3AF