Prev: 8583 Up: Map Next: 860D
858B: Print: One Character
Print_Character 858B CALL PrintGateOnTheTimeOfDay Call PrintGateOnTheTimeOfDay to gate printing on the time of day.
858E RET Z Return if PrintGateOnTheTimeOfDay found the day flag does not meet the message gate.
858F PUSH AF If WaitCountdown is not zero then jump to Print_Character_TestForAReturn.
8590 LD A,($B701)
8593 AND A
8594 JR NZ,Print_Character_TestForAReturn
8596 POP AF Restore the character from the stack and call PrintWriteACharacterToTheScreen_0 to draw it.
8597 CALL PrintWriteACharacterToTheScreen_0
859A PUSH AF If B700 is not zero then jump to Print_Character_TestForAnS.
859B LD A,($B700)
859E AND A
859F JR NZ,Print_Character_TestForAnS
85A1 POP AF Restore the character from the stack.
85A2 RET Return.
Print_Character_TestForAnS 85A3 POP AF If this is ASCII "S" then jump to Print_Character_PrintAnH.
85A4 CP $53
85A6 JR Z,Print_Character_PrintAnH
85A8 CP $73 If this is not ASCII "s" then return.
85AA RET NZ
Print_Character_PrintAnH 85AB PUSH AF Use the character 'H'.
85AC LD A,$48
85AE CALL PrintWriteACharacterToTheScreen_0 Call PrintWriteACharacterToTheScreen_0 to draw the character on the screen.
85B1 POP AF Restore AF from the stack.
85B2 RET Return.
85B3 NOP Characters left on the current line (20 at the start of a line).
PercentageBuffer 85B4 DEFB $00,$00,$00 Percentage buffer.
Print_Character_TestForAReturn 85B7 POP AF Save the character and the text pointer, and jump to
This entry point is used by the routine at TurnReadAndTokeniseTheCommand.
Print_Character_0 85B8 PUSH HL Print_Character_TestForBackspace if the character is not a carriage return
85B9 PUSH AF (0D).
85BA LD HL,($85B4)
85BD CP $0D
85BF JR NZ,Print_Character_TestForBackspace }
Print a space.
85C1 LD A,$20 Print a space.
85C3 CALL Print_RomFont
85C6 JR Print_Character_StartANewLine Jump to Print_Character_StartANewLine to start a new line.
Print_Character_TestForBackspace 85C8 CP $08 Jump to Print_Character_RubOut if the character is 08.
85CA JR Z,Print_Character_RubOut
85CC CP $61 Jump to Print_Character_DrawThisCharacterWithTheROMFont if the character is below 61.
85CE JR C,Print_Character_DrawThisCharacterWithTheROMFont
85D0 CP $7B Jump to Print_Character_DrawThisCharacterWithTheROMFont if the character is not below 7B.
85D2 JR NC,Print_Character_DrawThisCharacterWithTheROMFont
85D4 AND $5F Keep bits 0, 1, 2, 3, 4, 6.
Draw this character with the ROM font.
Print_Character_DrawThisCharacterWithTheROMFont 85D6 CALL Print_RomFont Call Print_RomFont to draw this character with the ROM font.
85D9 LD A,($85B3) Count down the characters left on the line, and jump to Print_Character_StoreTheCharactersLeft unless the line is now full.
85DC DEC A
85DD JR NZ,Print_Character_StoreTheCharactersLeft
Print_Character_StartANewLine 85DF LD L,$E0 Move the print position back to the start of the line (E0).
85E1 CALL Print_ScrollTheLineBuffer Call Print_ScrollTheLineBuffer to scroll the line buffer up.
85E4 LD A,$20 Reset the count to 20 for the new line.
Print_Character_StoreTheCharactersLeft 85E6 LD ($85B3),A Store the result at 85B3.
85E9 LD A,($85B6) Read the spare grammar byte.
85EC LD ($85B4),HL Store HL at PercentageBuffer.
Draw this character with the ROM font.
85EF CALL Print_RomFont Call Print_RomFont to draw this character with the ROM font.
85F2 POP AF Restore AF and HL from the stack.
85F3 POP HL
85F4 RET Return.
Print a space.
Print_Character_RubOut 85F5 LD A,$20 Print a space over the character being rubbed out.
85F7 CALL Print_RomFont
85FA DEC L Step the print position back, add one to the characters left, and jump back to Print_Character_StoreTheCharactersLeft unless that goes past the start of the line (21).
85FB DEC L
85FC LD A,($85B3)
85FF INC A
8600 CP $21
8602 JR NZ,Print_Character_StoreTheCharactersLeft
8604 LD L,$FF The previous pattern byte is at offset FF.
8606 CALL Print_ScrollTheAttributeLine Call Print_ScrollTheAttributeLine to scroll the attribute line up.
8609 LD A,$01 Continue with 01 now that the character is drawn.
860B JR Print_Character_StoreTheCharactersLeft Jump back to Print_Character_StoreTheCharactersLeft to draw this character.
Prev: 8583 Up: Map Next: 860D