Prev: 9AAB Up: Map Next: 9BA7
9AEC: Plot mini font characters
Entry point with BC zero, so both of the extra bitmap bytes are zero and no cursor block is drawn beneath the character.
Used by the routines at drive_chatter and drive_noise_effect.
Input
A Column index, counting from zero, or $FF for the off-screen cursor position
D The character to plot (ASCII)
plot_mini_font_cursor_off 9AEC LD BC,$0000
9AEF JR plot_mini_font_char Jump to plot_mini_font_char
This entry point is used by the routines at drive_chatter, print_chatter and drive_noise_effect.
plot_mini_font_cursor_on 9AF1 LD BC,$0780 values to self modify with
plot_mini_font_char 9AF4 EX AF,AF' Preserve A
9AF5 LD A,B self modify LD C and OR 7 later
9AF6 LD ($9B64),A
9AF9 LD A,C
9AFA LD ($9B61),A
9AFD EX AF,AF' Restore A
9AFE CP $FF If A is not $FF (slot -1, the idle cursor) goto pmf_regular_char
9B00 JR NZ,pmf_regular_char
Slot -1 would put the cursor at pixel -3, which the unsigned division below cannot handle. Instead, start the loop part-way with A = 5 (-3 mod 8) and E one lower, so it ends as it would for x = -3: column byte $C0 with A = 3.
9B02 LD E,$BF E = $BF, one less than column byte $C0
9B04 LD A,$05
9B06 JR pmf_divider
pmf_regular_char 9B08 LD E,A A = pixel x = slot*5+2 (5-pixel cells, 2-pixel margin)
9B09 ADD A,A
9B0A ADD A,A
9B0B ADD A,E
9B0C ADD A,$02
9B0E LD E,$C0 E = $C0, low byte of the message line's screen row; C = 8
pmf_divider 9B10 LD C,$08
pmf_divide_loop 9B12 INC E Divide x by 8: E = $C1 + x / 8, the left of the two bytes the glyph spans, and A = 8 - x mod 8 (the glyph is shifted right by x mod 8)
9B13 SUB C
9B14 JP NC,pmf_divide_loop
9B17 NEG
9B19 LD B,A Modify jump table - A * 4 - 4 bytes per sequence
9B1A ADD A,A
9B1B ADD A,A
9B1C LD ($9B67),A
9B1F LD A,$FF
pmf_multiplier 9B21 ADD A,A General multiplier by A
9B22 DJNZ pmf_multiplier
9B24 LD ($9B89),A Self modify 9B88 which is a mask
9B27 LD A,D Get ASCII character
Turn ASCII into glyph IDs
9B28 LD D,$45 D = $45, the screen address high byte for the message line
9B2A CP $2E Is it '.'? glyph ID = 26; goto pmf_have_glyph_id
9B2C LD C,$1A
9B2E JR Z,pmf_have_glyph_id
9B30 INC C Is it ','? glyph ID = 27; goto pmf_have_glyph_id
9B31 CP $2C
9B33 JR Z,pmf_have_glyph_id
9B35 INC C Is it '!'? glyph ID = 28; goto pmf_have_glyph_id
9B36 CP $21
9B38 JR Z,pmf_have_glyph_id
9B3A INC C Is it ' '? glyph ID = 29; goto pmf_have_glyph_id
9B3B CP $20
9B3D JR Z,pmf_have_glyph_id
9B3F INC C Is it '''? glyph ID = 30; goto pmf_have_glyph_id
9B40 CP $27
9B42 JR Z,pmf_have_glyph_id
9B44 CP $3A Is it >= ';'? goto pmf_have_ascii
9B46 JR NC,pmf_have_ascii
9B48 SUB $2F C += A - 47 -- assigns glyph IDs 31-40 to '0'-'9'. No chatter message string contains a digit and the scoreboard uses draw_string_screen instead, so this path is dead
9B4A ADD A,C
9B4B LD C,A
pmf_have_glyph_id 9B4C LD A,C Turn the glyph ID in C into ASCII in A
9B4D ADD A,$41
pmf_have_ascii 9B4F SUB $41 BC = (A - 'A') * 6
9B51 ADD A,A
9B52 LD C,A
9B53 ADD A,A
9B54 ADD A,C
9B55 LD C,A
9B56 LD B,$00
9B58 LD HL,$DFF8 Point HL at minifont
9B5B ADD HL,BC
9B5C EX DE,HL
9B5D LD A,$06
pmf_row_loop 9B5F EX AF,AF'
9B60 LD C,$80 Self modified earlier
9B62 LD A,(DE)
9B63 OR $07 Self modified earlier
9B65 LD B,A
plot_mini_font_cursor_off_0 9B66 JR plot_mini_font_cursor_off_0 Jump table (self modified)
9B68 SRL B
9B6A RR C
9B6C SRL B
9B6E RR C
9B70 SRL B
9B72 RR C
9B74 SRL B
9B76 RR C
9B78 SRL B
9B7A RR C
9B7C SRL B
9B7E RR C
9B80 SRL B
9B82 RR C
9B84 SRL B
9B86 RR C
9B88 LD A,$00 This must be self modified
9B8A AND (HL) *scr++ = (*scr AND A) OR B
9B8B OR B
9B8C LD (HL),A
9B8D INC L
9B8E LD (HL),C *scr-- = C
9B8F DEC L
9B90 INC DE Next glyph byte
9B91 INC H Move to next scanline
9B92 LD A,H
9B93 AND $07
9B95 JR NZ,pmf_next_row
9B97 LD A,L
9B98 ADD A,$20
9B9A LD L,A
9B9B JR C,pmf_next_row
9B9D LD A,H
9B9E SUB $08
9BA0 LD H,A
pmf_next_row 9BA1 EX AF,AF' Decrement row counter
9BA2 DEC A
9BA3 JP NZ,pmf_row_loop Loop while rows remain
9BA6 RET Return
Prev: 9AAB Up: Map Next: 9BA7