Prev: E34A Up: Map Next: E3C7
E376: Draw Message Character
Used by the routine at Centre_AndDrawMessageRow.
Draw one double-height message character from the buffer at IX into the attribute/screen pair at HL, then advance. Maps punctuation to fixed glyph indices and ASCII from 0 onward to even glyph slots (two 0008-byte halves per character in Font_MessageCharacters).
Input
HL Attribute-file address for this character
IX Pointer into the decoded message buffer
Stop on row/message terminators; otherwise map the character to a glyph index.
Draw_MessageCharacter E376 LD A,(IX+$00) Fetch the next buffer byte through IX, then advance the buffer pointer.
E379 INC IX
E37B CP $24 Is it $? If so, return (end of alternate/row run).
E37D RET Z
E37E CP $2B Is it a new-row marker (+)? If so, return.
E380 RET Z
E381 CP $5D Is it the message terminator (])? If so, return.
E383 RET Z
E384 PUSH HL Stash HL on the stack.
E385 CP $2E Is it a full stop (.)? If so, use glyph index 14 at Draw_MessageCharacter_FullStop.
E387 JR Z,Draw_MessageCharacter_FullStop
E389 CP $2C Is it a comma (,)? If so, use glyph index 16 at Draw_MessageCharacter_Comma.
E38B JR Z,Draw_MessageCharacter_Comma
E38D CP $21 Is it an exclamation mark (!)? If so, use glyph index 1A at Draw_MessageCharacter_Bang.
E38F JR Z,Draw_MessageCharacter_Bang
E391 CP $27 Is it an apostrophe (')? If so, use glyph index 18 at Draw_MessageCharacter_Apostrophe.
E393 JR Z,Draw_MessageCharacter_Apostrophe
E395 CP $20 Is it a space ( )? If so, keep index 20 at Draw_MessageCharacter_Plot.
E397 JR Z,Draw_MessageCharacter_Plot
E399 SUB $30 Convert ASCII ≥ 0 into an even glyph index.
E39B SLA A Double the glyph index to address the double-height font halves.
E39D JR Draw_MessageCharacter_Plot Jump to Draw_MessageCharacter_Plot to plot the letter glyph.
Map a full stop to glyph index 14 in the double-height message font.
Draw_MessageCharacter_FullStop E39F LD A,$14 Load glyph index 14.
E3A1 JR Draw_MessageCharacter_Plot Jump to Draw_MessageCharacter_Plot to plot the full-stop glyph.
Map a comma to glyph index 16 in the double-height message font.
Draw_MessageCharacter_Comma E3A3 LD A,$16 Load glyph index 16.
E3A5 JR Draw_MessageCharacter_Plot Jump to Draw_MessageCharacter_Plot to plot the comma glyph.
Map an exclamation mark to glyph index 1A in the double-height message font.
Draw_MessageCharacter_Bang E3A7 LD A,$1A Load glyph index 1A.
E3A9 JR Draw_MessageCharacter_Plot Jump to Draw_MessageCharacter_Plot to plot the exclamation glyph.
Map an apostrophe to glyph index 18 in the double-height message font.
Draw_MessageCharacter_Apostrophe E3AB LD A,$18 Load glyph index 18.
Plot the top 08 rows, step one attribute row down, plot the bottom 08 rows, then advance.
Draw_MessageCharacter_Plot E3AD LD E,A Keep the glyph index in E, then clear D.
E3AE LD D,$00
E3B0 LD A,$08 Load A with 08, then call PseudoRandom (jitter / roll seed for DD9F). Store the roll mode at DD9F.
E3B2 CALL PseudoRandom
E3B5 LD ($DD9F),A
E3B8 CALL Plot_MessageGlyphHalf Call Plot_MessageGlyphHalf to plot the top half of the glyph.
E3BB LD BC,$0020 Step HL down one attribute row (0020 bytes).
E3BE ADD HL,BC Step HL down one character row (0020 bytes).
E3BF INC DE Advance the glyph index onto the bottom half.
E3C0 CALL Plot_MessageGlyphHalf Call Plot_MessageGlyphHalf to plot the bottom half.
E3C3 POP HL Restore HL from the stack.
E3C4 INC HL Advance the attribute address onto the next character column.
E3C5 JR Draw_MessageCharacter Jump to Draw_MessageCharacter to draw the next character.
Prev: E34A Up: Map Next: E3C7