Prev: B7A1 Up: Map Next: B841
B7B9: Print message in terminal screen.
Used by the routine at Main_routine.
The message is displayed in the terminal screen, bottom right of display.
Print_TerminalMessage B7B9 CALL CountDown
B7BC LD HL,Print_Delay Timer delay set at end of each word, before printing next word.
B7BF LD A,(HL)
B7C0 AND A
B7C1 JR Z,Print_TerminalMessage_0
B7C3 DEC (HL)
B7C4 RET
Print_TerminalMessage_0 B7C5 LD HL,(Message_Next_Ptr) See if end of string and exit.
B7C8 LD A,(HL)
B7C9 CP $5E
B7CB RET Z
B7CC LD A,$01 Set up output ready for next character.
B7CE CALL $1601
B7D1 CALL PRINT_AT
B7D4 LD B,$02 Number of characters to print.
Print_TerminalMessage_1 B7D6 LD DE,(Message_Next_Ptr) Address of next character in string.
B7DA LD HL,Message_X Address of cursor X
B7DD LD A,(DE) Get next character
B7DE CP $20 Is it a space?
B7E0 JR Z,Print_TerminalMessage_2
B7E2 CP $2B Is it a '+'?
B7E4 JR Z,Print_TerminalMessage_2
B7E6 AND $7F Adjust to valid characters.
B7E8 INC DE Update to next character in string.
B7E9 LD (Message_Next_Ptr),DE
B7ED INC (HL) Update X position to next column.
B7EE CALL Print_Character Print character in A.
B7F1 LD A,(DE) Get next character.
B7F2 CP $5E See if at end of string, and exit if so.
B7F4 RET Z
B7F5 CP $20 If a space, then just update cursor.
B7F7 JP Z,Print_TerminalCursor
B7FA CP $2B If a '+', then just update cursor.
B7FC JP Z,Print_TerminalCursor
B7FF DJNZ Print_TerminalMessage_1 If not, go on to next character.
B801 JP Print_TerminalCursor Update cursor.
Print_TerminalMessage_2 B804 LD A,$02 Set a delay timer on when to print next character.
B806 LD (Print_Delay),A
B809 LD A,(DE) Get character again.
B80A CP $2B '+' is a newline.
B80C JR Z,Print_TerminalMessage_3
B80E LD A,(HL) If X is beginning of line, don't print a space.
B80F CP $13
B811 JR Z,Print_TerminalMessage_4
Print_TerminalMessage_3 B813 INC (HL) Next column.
B814 LD A,$20 Print a space.
B816 CALL Print_Character
B819 LD A,(DE)
B81A CP $2B If character is a '+', set cursor to end of line, so a newline is next.
B81C JR NZ,Print_TerminalMessage_4
B81E LD (HL),$1F
Print_TerminalMessage_4 B820 INC DE Point to next character in string
B821 LD (Message_Next_Ptr),DE Store for next print.
B825 LD C,(HL) Get X pos
Print_TerminalMessage_5 B826 LD A,(DE) Scan through string looking for end of next word.
B827 CP $20
B829 JR Z,Print_TerminalMessage_6
B82B CP $2B
B82D JR Z,Print_TerminalMessage_6
B82F CP $5E
B831 JR Z,Print_TerminalMessage_6
B833 INC C Increasing position and string ptr.
B834 INC DE
B835 JR Print_TerminalMessage_5
Print_TerminalMessage_6 B837 LD A,$1F End of string found.
B839 CP C If the word fits, then just update cursor.
B83A JR NC,Print_TerminalMessage_7
B83C LD (HL),$FF Set curor so a newline is reached.
Print_TerminalMessage_7 B83E JP Print_TerminalCursor Update cursor based on current positions.
Prev: B7A1 Up: Map Next: B841