![]() |
Routines |
| Prev: 43299 | Up: Map | Next: 43502 |
|
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 | 43386 | PUSH DE | Save the address of the character. | |||||||||||
| 43387 | LD A,(DE) | Fetch the character. | ||||||||||||
| 43388 | EX DE,HL | Exchange DE and HL. | ||||||||||||
| 43389 | PUSH DE | Save the screen address. | ||||||||||||
| 43390 | LD L,A | Copy the character into L. | ||||||||||||
| 43391 | LD H,0 | Clear H. | ||||||||||||
| 43393 | LD D,H | Clear D. | ||||||||||||
| 43394 | ADD HL,HL | Multiply the character by two... | ||||||||||||
| 43395 | ADD HL,HL | ...four... | ||||||||||||
| 43396 | ADD HL,HL | ...and eight. | ||||||||||||
| 43397 | LD E,A | Copy the character into E. | ||||||||||||
| 43398 | SBC HL,DE | Subtract it, to make seven times the character. | ||||||||||||
| 43400 | LD DE,25824 | Point DE at Font. | ||||||||||||
| 43403 | ADD HL,DE | Add the offset to find the shape of the character. | ||||||||||||
| 43404 | POP DE | Restore the screen address into DE. | ||||||||||||
| 43405 | EX DE,HL | Exchange DE and HL, so that DE is the shape and HL is the screen address. | ||||||||||||
| 43406 | PUSH HL | Save the screen address. | ||||||||||||
| 43407 | LD B,7 | Set the number of lines to 7. | ||||||||||||
| PrintCharacter_Patched | 43409 | JR PrintCharacter_Patched | Jump to the routine for the size of text (this is patched at 43410). | |||||||||||
| PrintCharacter_Normal | 43411 | LD A,(DE) | Fetch a line of the shape. | |||||||||||
| 43412 | LD (HL),A | Write it to the screen. | ||||||||||||
| 43413 | INC DE | Move onto the next line of the shape. | ||||||||||||
| 43414 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| 43417 | DJNZ PrintCharacter_Normal | Jump back until all of the lines have been written. | ||||||||||||
| 43419 | POP HL | Restore the screen address. | ||||||||||||
| 43420 | INC L | Move onto the next character cell. | ||||||||||||
| 43421 | POP DE | Restore the address of the character. | ||||||||||||
| 43422 | RET | Return. | ||||||||||||
| PrintCharacter_DoubleHeight | 43423 | LD A,(DE) | Fetch a line of the shape. | |||||||||||
| 43424 | LD (HL),A | Write it to the screen. | ||||||||||||
| 43425 | PUSH AF | Save it. | ||||||||||||
| 43426 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| 43429 | POP AF | Restore it. | ||||||||||||
| 43430 | LD (HL),A | Write it to the screen again. | ||||||||||||
| 43431 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| 43434 | INC DE | Move onto the next line of the shape. | ||||||||||||
| 43435 | DJNZ PrintCharacter_DoubleHeight | Jump back until all of the lines have been written. | ||||||||||||
| 43437 | POP HL | Restore the screen address. | ||||||||||||
| 43438 | INC L | Move onto the next character cell. | ||||||||||||
| 43439 | POP DE | Restore the address of the character. | ||||||||||||
| 43440 | RET | Return. | ||||||||||||
| PrintCharacter_DoubleBoth | 43441 | LD A,B | Fetch the number of lines. | |||||||||||
| PrintCharacter_DoubleBothLine | 43442 | EX AF,AF' | Save the number of lines in the alternate A. | |||||||||||
| 43443 | LD BC,43502 | Point BC at DoubledNibbles. | ||||||||||||
| 43446 | LD A,(DE) | Fetch a line of the shape. | ||||||||||||
| 43447 | RRA | Move the upper four bits... | ||||||||||||
| 43448 | RRA | ...down... | ||||||||||||
| 43449 | RRA | ...to the lower... | ||||||||||||
| 43450 | RRA | ...four bits. | ||||||||||||
| 43451 | AND %00001111 | Keep the upper nibble. | ||||||||||||
| 43453 | ADD A,C | Add it to the address of the table. | ||||||||||||
| 43454 | LD C,A | Store the low byte. | ||||||||||||
| 43455 | LD A,B | Fetch the high byte. | ||||||||||||
| 43456 | ADC A,0 | Add the carry. | ||||||||||||
| 43458 | LD B,A | Store the high byte. | ||||||||||||
| 43459 | LD A,(BC) | Fetch the doubled bits. | ||||||||||||
| 43460 | LD (HL),A | Write them to the left cell. | ||||||||||||
| 43461 | LD C,A | Keep them in C. | ||||||||||||
| 43462 | PUSH HL | Save the screen address. | ||||||||||||
| 43463 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| 43466 | LD (HL),C | Write the doubled bits again. | ||||||||||||
| 43467 | POP HL | Restore the screen address. | ||||||||||||
| 43468 | INC L | Move onto the right cell. | ||||||||||||
| 43469 | LD BC,43502 | Point BC at DoubledNibbles. | ||||||||||||
| 43472 | LD A,(DE) | Fetch the line of the shape. | ||||||||||||
| 43473 | AND %00001111 | Keep the lower nibble. | ||||||||||||
| 43475 | ADD A,C | Add it to the address of the table. | ||||||||||||
| 43476 | LD C,A | Store the low byte. | ||||||||||||
| 43477 | LD A,B | Fetch the high byte. | ||||||||||||
| 43478 | ADC A,0 | Add the carry. | ||||||||||||
| 43480 | LD B,A | Store the high byte. | ||||||||||||
| 43481 | LD A,(BC) | Fetch the doubled bits. | ||||||||||||
| 43482 | LD (HL),A | Write them to the right cell. | ||||||||||||
| 43483 | LD C,A | Keep them in C. | ||||||||||||
| 43484 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| 43487 | LD (HL),C | Write the doubled bits again. | ||||||||||||
| 43488 | DEC L | Move back to the left cell. | ||||||||||||
| 43489 | CALL MoveUpALine | Move up a pixel line on the screen. | ||||||||||||
| 43492 | INC DE | Move onto the next line of the shape. | ||||||||||||
| 43493 | EX AF,AF' | Fetch the number of lines. | ||||||||||||
| 43494 | DEC A | Decrease it by one. | ||||||||||||
| 43495 | JR NZ,PrintCharacter_DoubleBothLine | Jump back until all of the lines have been written. | ||||||||||||
| 43497 | POP HL | Restore the screen address. | ||||||||||||
| 43498 | INC L | Move onto the next cell... | ||||||||||||
| 43499 | INC L | ...which is two cells further on. | ||||||||||||
| 43500 | POP DE | Restore the address of the character. | ||||||||||||
| 43501 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 43299 | Up: Map | Next: 43502 |