![]() |
Routines |
| Prev: 63FC | Up: Map | Next: 654B |
|
Used by the routine at PlotCharacter.
Draws character A at the print position, using the ROM font. The eight bytes are shifted into whichever pixel column the cursor occupies inside its display byte, then ORed into the screen.
|
||||
|
The ROM character set lives at Character set. Subtracting 0100 makes the character code times 8 land on its glyph.
|
||||
| PlotGlyph | 6483 | LD DE,($5B87) | Keep the screen address. The font is the ROM character set minus 0100. | |
| 6487 | LD BC,$3C00 | |||
| 648A | LD H,$00 | Character A, widened. | ||
| 648C | LD L,A | |||
| 648D | ADD HL,HL | Times eight, plus the font base. | ||
| 648E | ADD HL,HL | |||
| 648F | ADD HL,HL | |||
| 6490 | ADD HL,BC | |||
| 6491 | PUSH DE | The screen address and the glyph address are restored after the copy. | ||
| 6492 | PUSH HL | |||
| 6493 | LD DE,$6B23 | The eight glyph bytes are copied into GlyphBuffer. C starts clear. | ||
| 6496 | LD BC,$0800 | |||
| PlotGlyph_Copy | 6499 | LD A,(HL) | Copy one byte of the glyph. | |
| 649A | LD (DE),A | |||
| 649B | INC HL | |||
| 649C | INC DE | |||
| 649D | BIT 1,A | Bit 1 of a byte marks a descender. | ||
| 649F | JR Z,PlotGlyph_Copied | |||
| 64A1 | LD C,$FF | |||
| PlotGlyph_Copied | 64A3 | DJNZ PlotGlyph_Copy | The next byte. | |
|
Tip the glyph so it sits in the right-hand pixels of its byte. A descender in the source sets the marker in C.
|
||||
| PlotGlyph_Align | 64A5 | LD DE,$6B23 | Eight glyph bytes are shifted in GlyphBuffer. | |
| 64A8 | LD B,$08 | |||
| PlotGlyph_Row | 64AA | LD A,(DE) | A source bit carried out sets the top bit. | |
| 64AB | RLA | |||
| 64AC | JR NC,PlotGlyph_Nibble | |||
| 64AE | OR $80 | |||
| PlotGlyph_Nibble | 64B0 | BIT 0,C | The descender marker shifts the glyph one place further. | |
| 64B2 | JR Z,PlotGlyph_Mask | |||
| 64B4 | LD H,A | Split the byte into nibbles. | ||
| 64B5 | AND $0F | |||
| 64B7 | LD L,A | |||
| 64B8 | LD A,H | The low nibble moves into the neighbouring byte. | ||
| 64B9 | AND $F0 | |||
| 64BB | RL L | |||
| 64BD | OR L | |||
| PlotGlyph_Mask | 64BE | AND $FC | Store the aligned byte and do the next row. | |
| 64C0 | LD (DE),A | |||
| 64C1 | INC DE | |||
| 64C2 | DJNZ PlotGlyph_Row | |||
| 64C4 | POP HL | Restore the glyph address and the screen address from the stack. | ||
| 64C5 | POP DE | |||
| 64C6 | LD HL,$6B23 | Point DE at the buffer and HL at the screen byte. | ||
| 64C9 | EX DE,HL | |||
| 64CA | PUSH HL | |||
|
The column within the byte chooses how the shifted glyph is merged with the pixels already there.
|
||||
| PlotGlyph_Column | 64CB | LD A,($5B8A) | The column within the byte is 0, 1, 2 or 3. | |
| 64CE | AND $03 | |||
| 64D0 | DEC A | Column 1 uses the two-pixel shift. | ||
| 64D1 | JR Z,PlotGlyph_Byte1 | |||
| 64D3 | DEC A | Column 2 uses the four-pixel shift. | ||
| 64D4 | JR Z,PlotGlyph_Byte2 | |||
| 64D6 | DEC A | Column 3 keeps the top two pixels. | ||
| 64D7 | JR Z,PlotGlyph_Byte3 | |||
| 64D9 | LD B,$08 | Column 0 copies eight fresh bytes. | ||
| PlotGlyph_Byte0 | 64DB | LD A,(DE) | Copy one glyph byte and step to the next pixel row. | |
| 64DC | LD (HL),A | |||
| 64DD | INC DE | |||
| 64DE | INC H | |||
| 64DF | DJNZ PlotGlyph_Byte0 | All eight bytes. | ||
| PlotGlyph_Stored | 64E1 | POP HL | The print address moves on one byte. | |
| 64E2 | INC HL | |||
| 64E3 | LD ($5B87),HL | |||
| 64E6 | JR PlotGlyph_Advance | Join PlotGlyph_Advance to advance the column. | ||
| PlotGlyph_Byte1 | 64E8 | LD B,$08 | Eight pixel rows. | |
| PlotGlyph_Shift2 | 64EA | LD A,(DE) | Take the glyph byte and the previous screen byte. | |
| 64EB | DEC HL | |||
| 64EC | SRL (HL) | Make room for two pixels. | ||
| 64EE | SRL (HL) | |||
| 64F0 | SLA A | Shift two pixels of the glyph in. | ||
| 64F2 | RL (HL) | |||
| 64F4 | SLA A | |||
| 64F6 | RL (HL) | |||
| 64F8 | INC HL | Store the shifted byte. | ||
| 64F9 | LD (HL),A | |||
| 64FA | INC H | The next pixel row. | ||
| 64FB | INC DE | |||
| 64FC | DJNZ PlotGlyph_Shift2 | All eight. | ||
| 64FE | JR PlotGlyph_Stored | Join the shared advance at PlotGlyph_Stored. | ||
| PlotGlyph_Byte2 | 6500 | LD B,$08 | Eight pixel rows. | |
| PlotGlyph_Shift4 | 6502 | LD A,(DE) | Take one glyph byte and the previous screen byte. | |
| 6503 | DEC HL | |||
| 6504 | SRL (HL) | Make room for four pixels. | ||
| 6506 | SRL (HL) | |||
| 6508 | SRL (HL) | |||
| 650A | SRL (HL) | |||
| 650C | SLA A | Shift the first two pixels in. | ||
| 650E | RL (HL) | |||
| 6510 | SLA A | |||
| 6512 | RL (HL) | |||
| 6514 | SLA A | Shift the other two pixels in. | ||
| 6516 | RL (HL) | |||
| 6518 | SLA A | |||
| 651A | RL (HL) | |||
| 651C | INC HL | Store the shifted byte on this pixel row. | ||
| 651D | LD (HL),A | |||
| 651E | INC H | The next pixel row. | ||
| 651F | INC DE | |||
| 6520 | DJNZ PlotGlyph_Shift4 | All eight. | ||
| 6522 | POP HL | This column restores the screen address itself and advances. | ||
| 6523 | JR PlotGlyph_Advance | |||
| PlotGlyph_Byte3 | 6525 | LD B,$08 | Eight pixel rows. | |
| PlotGlyph_Top | 6527 | LD A,$C0 | Keep the top two pixels already on screen. | |
| 6529 | AND (HL) | |||
| 652A | LD (HL),A | |||
| 652B | LD A,(DE) | Shift the glyph right by two. | ||
| 652C | SRL A | |||
| 652E | SRL A | |||
| 6530 | OR (HL) | OR it into the screen byte. | ||
| 6531 | LD (HL),A | |||
| 6532 | INC H | The next pixel row, then the shared advance. | ||
| 6533 | INC DE | |||
| 6534 | DJNZ PlotGlyph_Top | |||
| 6536 | JR PlotGlyph_Stored | |||
|
The next character moves one column right. Column 29 is the margin, so the cursor wraps.
|
||||
| PlotGlyph_Advance | 6538 | POP AF | Keep the character and read the column. | |
| 6539 | PUSH AF | |||
| 653A | LD A,($5B8A) | |||
| 653D | CP $29 | Column 29 wraps to the next row. | ||
| 653F | JP Z,PlotCharacter_Newline | |||
| 6542 | INC A | Otherwise the cursor moves one column right. | ||
| 6543 | LD ($5B8A),A | |||
|
This entry point is used by the routine at PlotCharacter.
|
||||
| PlotGlyph_Done | 6546 | POP AF | Restore the registers saved around the glyph from the stack. | |
| 6547 | POP DE | |||
| 6548 | POP BC | |||
| 6549 | POP HL | |||
| 654A | RET | Return. | ||
| Prev: 63FC | Up: Map | Next: 654B |