![]() |
Routines |
| Prev: 867A | Up: Map | Next: 8761 |
|
Writes one character into the text window, scrolling when the line is full.
|
||||
| PrintWriteACharacterToTheScreen | 869B | DEFB $00 | ||
| 869C | DEFW $0000 | |||
| 869E | DEFB $00 | |||
| 869F | DEFB $00 | |||
| 86A0 | DEFB $00 | |||
|
This entry point is used by the routine at Print_Character.
|
||||
| PrintWriteACharacterToTheScreen_0 | 86A1 | PUSH HL | Save HL, BC and AF, and bring HL back from 869C. | |
| 86A2 | PUSH BC | |||
| 86A3 | PUSH AF | |||
| 86A4 | LD HL,($869C) | |||
| 86A7 | LD A,($869E) | Read the print column. | ||
| 86AA | LD C,A | Copy the result into C. | ||
|
Test this flag.
|
||||
| 86AB | LD A,($86A0) | Jump to PrintWriteACharacterToTheScreen_TestForAReturn if *86A0 is not zero. | ||
| 86AE | AND A | |||
| 86AF | JR NZ,PrintWriteACharacterToTheScreen_TestForAReturn | |||
|
Test this flag.
|
||||
| 86B1 | LD A,($869F) | Jump to PrintWriteACharacterToTheScreen_TestForAReturn if *869F is zero. | ||
| 86B4 | AND A | |||
| 86B5 | JR Z,PrintWriteACharacterToTheScreen_TestForAReturn | |||
| 86B7 | LD B,A | Copy the result into B. | ||
| PrintWriteACharacterToTheScreen_Loop | 86B8 | LD A,$20 | Use the character ' '. | |
|
Draw this character with the game font.
|
||||
| 86BA | CALL Print_ProportionalCharacter | Call Print_ProportionalCharacter to draw this character with the game's font. | ||
| 86BD | LD A,($869B) | Read the room left on the line at PrintWriteACharacterToTheScreen. | ||
| 86C0 | DEC A | Drop one from the room left on the line. | ||
| 86C1 | LD ($869B),A | Update the room left on the line. | ||
| 86C4 | DJNZ PrintWriteACharacterToTheScreen_Loop | Loop back to PrintWriteACharacterToTheScreen_Loop until the space count runs out. | ||
| PrintWriteACharacterToTheScreen_TestForAReturn | 86C6 | POP AF | Restore the character from the stack, keeping a copy there. | |
| 86C7 | PUSH AF | |||
| 86C8 | CP $0D | Jump to PrintWriteACharacterToTheScreen_TestBackspace unless the character is 0D. | ||
| 86CA | JR NZ,PrintWriteACharacterToTheScreen_TestBackspace | |||
| 86CC | LD A,$01 | Set the capitalise-the-next-letter flag after a carriage return. | ||
| 86CE | LD ($B704),A | |||
| PrintWriteACharacterToTheScreen_ClearTheFlag | 86D1 | XOR A | Clear *86A0. | |
| 86D2 | LD ($86A0),A | |||
| 86D5 | CALL ZXPrinter | Call ZXPrinter to copy this text line to the ZX printer. | ||
| 86D8 | PUSH BC | Save BC. | ||
|
Test how many words will be accepted.
|
||||
| 86D9 | LD A,($B716) | Jump to PrintWriteACharacterToTheScreen_CountDownTheWords if *B716 is not zero. | ||
| 86DC | AND A | |||
| 86DD | JR NZ,PrintWriteACharacterToTheScreen_CountDownTheWords | |||
| 86DF | LD BC,$8000 | Point BC at 8000. | ||
| PrintWriteACharacterToTheScreen_PollKeys | 86E2 | XOR A | Select every keyboard row. | |
| 86E3 | IN A,($FE) | Read port FE into A. | ||
| 86E5 | AND $1F | Jump to PrintWriteACharacterToTheScreen_DropTheTimeout unless the low five bits are all set. | ||
| 86E7 | CP $1F | |||
| 86E9 | JR NZ,PrintWriteACharacterToTheScreen_DropTheTimeout | |||
| 86EB | DEC BC | Loop back to PrintWriteACharacterToTheScreen_PollKeys until the keyboard timeout reaches zero. | ||
| 86EC | LD A,B | |||
| 86ED | OR C | |||
| 86EE | JR NZ,PrintWriteACharacterToTheScreen_PollKeys | |||
| 86F0 | POP BC | Jump to PrintWriteACharacterToTheScreen_PointAtTheTextLine to scroll line. | ||
| 86F1 | JR PrintWriteACharacterToTheScreen_PointAtTheTextLine | |||
| PrintWriteACharacterToTheScreen_CountDownTheWords | 86F3 | DEC A | Count down how many words will be accepted. | |
| 86F4 | LD ($B716),A | Update *B716. | ||
| PrintWriteACharacterToTheScreen_DropTheTimeout | 86F7 | POP BC | Drop the timeout and select every keyboard row. | |
| PrintWriteACharacterToTheScreen_WaitForRelease | 86F8 | XOR A | ||
| 86F9 | IN A,($FE) | Read port FE into A. | ||
| 86FB | AND $1F | Jump back to PrintWriteACharacterToTheScreen_WaitForRelease unless the low five bits are all set. | ||
| 86FD | CP $1F | |||
| 86FF | JR NZ,PrintWriteACharacterToTheScreen_WaitForRelease | |||
| PrintWriteACharacterToTheScreen_PointAtTheTextLine | 8701 | LD HL,$5020 | Point HL at the text line. | |
| 8704 | LD C,$01 | One pixel row of the character. | ||
| 8706 | CALL ScrollLine | Call ScrollLine to scroll line. | ||
| 8709 | LD A,$2A | Reset the room left on the line to 2A. | ||
| 870B | JR PrintWriteACharacterToTheScreen_StoreTheRoomLeft | Jump to PrintWriteACharacterToTheScreen_StoreTheRoomLeft to store the room left on the line. | ||
| PrintWriteACharacterToTheScreen_TestBackspace | 870D | CP $08 | Jump to PrintWriteACharacterToTheScreen_TestForALetter if the character is not 08. | |
| 870F | JR NZ,PrintWriteACharacterToTheScreen_TestForALetter | |||
| 8711 | CALL Print_WrapTheColumn | Call Print_WrapTheColumn to wrap the print column. | ||
| 8714 | LD A,$20 | Use the character ' '. | ||
|
Draw this character with the game font.
|
||||
| 8716 | CALL Print_ProportionalCharacter | Call Print_ProportionalCharacter to draw this character with the game's font. | ||
| 8719 | CALL Print_WrapTheColumn | Call Print_WrapTheColumn to wrap the print column. | ||
| 871C | LD A,($869B) | Read the room left on the line at PrintWriteACharacterToTheScreen. | ||
| 871F | INC A | Count one more character on the line. | ||
| 8720 | JR PrintWriteACharacterToTheScreen_StoreTheRoomLeft | Jump to PrintWriteACharacterToTheScreen_StoreTheRoomLeft to store the room left on the line. | ||
| PrintWriteACharacterToTheScreen_TestForALetter | 8722 | CP $41 | Jump to PrintWriteACharacterToTheScreen_TestCapitalise if the character is below 41. | |
| 8724 | JR C,PrintWriteACharacterToTheScreen_TestCapitalise | |||
| 8726 | CP $5B | Jump to PrintWriteACharacterToTheScreen_TestCapitalise if the character is 5B or above. | ||
| 8728 | JR NC,PrintWriteACharacterToTheScreen_TestCapitalise | |||
| 872A | OR $20 | Merge in 20. | ||
| PrintWriteACharacterToTheScreen_TestCapitalise | 872C | PUSH HL | Point HL at the capitalise-the-next-letter flag. | |
| 872D | LD HL,$B704 | |||
| 8730 | INC (HL) | Test the capitalise-the-next-letter flag without changing it. | ||
| 8731 | DEC (HL) | |||
| 8732 | JR Z,PrintWriteACharacterToTheScreen_TestForAFullStop | Jump to PrintWriteACharacterToTheScreen_TestForAFullStop if the next letter should not be capitalised. | ||
| 8734 | CP $61 | Jump to PrintWriteACharacterToTheScreen_TestForAFullStop if the character is below 61. | ||
| 8736 | JR C,PrintWriteACharacterToTheScreen_TestForAFullStop | |||
| 8738 | CP $7B | Jump to PrintWriteACharacterToTheScreen_TestForAFullStop if it is 7B or above. | ||
| 873A | JR NC,PrintWriteACharacterToTheScreen_TestForAFullStop | |||
| 873C | RES 5,A | Clear bit 5. | ||
| 873E | LD (HL),$00 | Clear the capitalise-the-next-letter flag once the letter is upper case. | ||
| PrintWriteACharacterToTheScreen_TestForAFullStop | 8740 | CP $2E | Jump to PrintWriteACharacterToTheScreen_DrawTheGlyph unless it is 2E. | |
| 8742 | JR NZ,PrintWriteACharacterToTheScreen_DrawTheGlyph | |||
| 8744 | INC (HL) | A full stop bumps the capitalise-the-next-letter flag. | ||
| PrintWriteACharacterToTheScreen_DrawTheGlyph | 8745 | POP HL | Pop the screen address and call Print_ProportionalCharacter to draw the glyph. | |
|
Draw this character with the game font.
|
||||
| 8746 | CALL Print_ProportionalCharacter | |||
| 8749 | LD ($86A0),A | Store the column and jump back to PrintWriteACharacterToTheScreen_ClearTheFlag when the room left on the line reaches zero. | ||
| 874C | LD A,($869B) | |||
| 874F | DEC A | |||
| 8750 | JP Z,PrintWriteACharacterToTheScreen_ClearTheFlag | |||
| PrintWriteACharacterToTheScreen_StoreTheRoomLeft | 8753 | LD ($869B),A | Update the room left on the line. | |
| 8756 | LD ($869C),HL | Store HL at 869C. | ||
| 8759 | LD A,C | Store the print column. | ||
| 875A | LD ($869E),A | |||
| 875D | POP AF | Restore AF, BC and HL from the stack. | ||
| 875E | POP BC | |||
| 875F | POP HL | |||
| 8760 | RET | Return. | ||
| Prev: 867A | Up: Map | Next: 8761 |