![]() |
Routines |
| Prev: A923 | Up: Map | Next: A9EE |
|
Used by the routine at PrintText.
Prints a character of a text record. The shapes of the characters are in the font at Font, and each is seven bytes with the bottom line first.
|
||||||||||||||
| PrintCharacter | A97A | PUSH DE | Save the address of the character. | |||||||||||
| A97B | LD A,(DE) | Fetch the character. | ||||||||||||
| A97C | EX DE,HL | Exchange DE and HL. | ||||||||||||
| A97D | PUSH DE | Save the screen address. | ||||||||||||
| A97E | LD L,A | Copy the character into L. | ||||||||||||
| A97F | LD H,$00 | Clear H. | ||||||||||||
| A981 | LD D,H | Clear D. | ||||||||||||
| A982 | ADD HL,HL | Multiply the character by two... | ||||||||||||
| A983 | ADD HL,HL | ...four... | ||||||||||||
| A984 | ADD HL,HL | ...and eight. | ||||||||||||
| A985 | LD E,A | Copy the character into E. | ||||||||||||
| A986 | SBC HL,DE | Subtract it, to make seven times the character. | ||||||||||||
| A988 | LD DE,$64E0 | Point DE at Font. | ||||||||||||
| A98B | ADD HL,DE | Add the offset to find the shape of the character. | ||||||||||||
| A98C | POP DE | Restore the screen address into DE. | ||||||||||||
| A98D | EX DE,HL | Exchange DE and HL, so that DE is the shape and HL is the screen address. | ||||||||||||
| A98E | PUSH HL | Save the screen address. | ||||||||||||
| A98F | LD B,$07 | Set the number of lines to 07. | ||||||||||||
| PrintCharacter_Patched | A991 | JR PrintCharacter_Patched | Jump to the routine for the size of text (this is patched at A992). | |||||||||||
| PrintCharacter_Normal | A993 | LD A,(DE) | Fetch a line of the shape. | |||||||||||
| A994 | LD (HL),A | Write it to the screen. | ||||||||||||
| A995 | INC DE | Move onto the next line of the shape. | ||||||||||||
| A996 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| A999 | DJNZ PrintCharacter_Normal | Jump back until all of the lines have been written. | ||||||||||||
| A99B | POP HL | Restore the screen address. | ||||||||||||
| A99C | INC L | Move onto the next character cell. | ||||||||||||
| A99D | POP DE | Restore the address of the character. | ||||||||||||
| A99E | RET | Return. | ||||||||||||
| PrintCharacter_DoubleHeight | A99F | LD A,(DE) | Fetch a line of the shape. | |||||||||||
| A9A0 | LD (HL),A | Write it to the screen. | ||||||||||||
| A9A1 | PUSH AF | Save it. | ||||||||||||
| A9A2 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| A9A5 | POP AF | Restore it. | ||||||||||||
| A9A6 | LD (HL),A | Write it to the screen again. | ||||||||||||
| A9A7 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| A9AA | INC DE | Move onto the next line of the shape. | ||||||||||||
| A9AB | DJNZ PrintCharacter_DoubleHeight | Jump back until all of the lines have been written. | ||||||||||||
| A9AD | POP HL | Restore the screen address. | ||||||||||||
| A9AE | INC L | Move onto the next character cell. | ||||||||||||
| A9AF | POP DE | Restore the address of the character. | ||||||||||||
| A9B0 | RET | Return. | ||||||||||||
| PrintCharacter_DoubleBoth | A9B1 | LD A,B | Fetch the number of lines. | |||||||||||
| PrintCharacter_DoubleBothLine | A9B2 | EX AF,AF' | Save the number of lines in the alternate A. | |||||||||||
| A9B3 | LD BC,$A9EE | Point BC at DoubledNibbles. | ||||||||||||
| A9B6 | LD A,(DE) | Fetch a line of the shape. | ||||||||||||
| A9B7 | RRA | Move the upper four bits... | ||||||||||||
| A9B8 | RRA | ...down... | ||||||||||||
| A9B9 | RRA | ...to the lower... | ||||||||||||
| A9BA | RRA | ...four bits. | ||||||||||||
| A9BB | AND %00001111 | Keep the upper nibble. | ||||||||||||
| A9BD | ADD A,C | Add it to the address of the table. | ||||||||||||
| A9BE | LD C,A | Store the low byte. | ||||||||||||
| A9BF | LD A,B | Fetch the high byte. | ||||||||||||
| A9C0 | ADC A,$00 | Add the carry. | ||||||||||||
| A9C2 | LD B,A | Store the high byte. | ||||||||||||
| A9C3 | LD A,(BC) | Fetch the doubled bits. | ||||||||||||
| A9C4 | LD (HL),A | Write them to the left cell. | ||||||||||||
| A9C5 | LD C,A | Keep them in C. | ||||||||||||
| A9C6 | PUSH HL | Save the screen address. | ||||||||||||
| A9C7 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| A9CA | LD (HL),C | Write the doubled bits again. | ||||||||||||
| A9CB | POP HL | Restore the screen address. | ||||||||||||
| A9CC | INC L | Move onto the right cell. | ||||||||||||
| A9CD | LD BC,$A9EE | Point BC at DoubledNibbles. | ||||||||||||
| A9D0 | LD A,(DE) | Fetch the line of the shape. | ||||||||||||
| A9D1 | AND %00001111 | Keep the lower nibble. | ||||||||||||
| A9D3 | ADD A,C | Add it to the address of the table. | ||||||||||||
| A9D4 | LD C,A | Store the low byte. | ||||||||||||
| A9D5 | LD A,B | Fetch the high byte. | ||||||||||||
| A9D6 | ADC A,$00 | Add the carry. | ||||||||||||
| A9D8 | LD B,A | Store the high byte. | ||||||||||||
| A9D9 | LD A,(BC) | Fetch the doubled bits. | ||||||||||||
| A9DA | LD (HL),A | Write them to the right cell. | ||||||||||||
| A9DB | LD C,A | Keep them in C. | ||||||||||||
| A9DC | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| A9DF | LD (HL),C | Write the doubled bits again. | ||||||||||||
| A9E0 | DEC L | Move back to the left cell. | ||||||||||||
| A9E1 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| A9E4 | INC DE | Move onto the next line of the shape. | ||||||||||||
| A9E5 | EX AF,AF' | Fetch the number of lines. | ||||||||||||
| A9E6 | DEC A | Decrease it by one. | ||||||||||||
| A9E7 | JR NZ,PrintCharacter_DoubleBothLine | Jump back until all of the lines have been written. | ||||||||||||
| A9E9 | POP HL | Restore the screen address. | ||||||||||||
| A9EA | INC L | Move onto the next cell... | ||||||||||||
| A9EB | INC L | ...which is two cells further on. | ||||||||||||
| A9EC | POP DE | Restore the address of the character. | ||||||||||||
| A9ED | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: A923 | Up: Map | Next: A9EE |