Prev: 55932 Up: Map Next: 56041
55944: Handler: Messaging
Used by the routines at 35317, 42125, 47412, 49469, 53120 and SetMessagingArea.
Input
B Message ID
Handler_Messaging 55944 LD A,40 Write 40 to *28043.
55946 LD (28043),A
55949 PUSH BC Stash the message ID on the stack.
55950 LD IY,56098 Load IY with Table_Messaging.
55954 LD A,(34282) Load A with the current *SelectedLanguage.
Keep doubling the *SelectedLanguage value until it equals 256.
FindLanguage 55957 SLA A Double the value in A.
55959 JR C,FoundLanguage Jump to FoundLanguage when A crosses the 255/ 0 boundary.
55961 INC IY Increment the language pointer by two, to point to the next language.
55963 INC IY
55965 JR FindLanguage Loop back to FindLanguage.
Found the desired language.
FoundLanguage 55967 LD L,(IY+0) Load IY with the address at this location.
55970 INC IY
55972 LD H,(IY+0)
55975 PUSH HL
55976 POP IY
55978 CALL ColouriseBackground Call ColouriseBackground.
55981 POP BC Restore the message ID from the stack.
LocateMessage_Loop 55982 LD A,(IY+0) Load the current character from the message pointer.
55985 CP 36 Is this a terminator character?
55987 INC IY Increment the message pointer by one.
55989 JR NZ,LocateMessage_Loop Loop back to LocateMessage_Loop if the character is not a terminator character.
55991 DJNZ LocateMessage_Loop Decrease the message number by one, and loop back to LocateMessage_Loop until it is zero (and so the correct message has been located).
The correct message has now been found. Now work out how many characters it is in length.
55993 LD DE,0 DE=0000.
55996 PUSH IY Stash the start of the message on the stack.
FindLengthOfMessage_Loop 55998 LD A,(IY+0) Read the next character in the message string.
56001 CP 36 If this is a terminator character, jump to CalculatePrintPosition.
56003 JR Z,CalculatePrintPosition
56005 INC IY Increment the message pointer by one.
56007 INC E Increment the message length by one.
56008 JR FindLengthOfMessage_Loop Loop back to FindLengthOfMessage_Loop.
E contains the message length. Now print the message string to the screen but centre it first.
CalculatePrintPosition 56010 LD A,32 Subtract the message length from the maximum width of the screen (32 characters), and divide the result by two. Add this left padding to HL to set the print position.
56012 SUB E
56013 SRL A
56015 LD E,A
56016 ADD HL,DE
56017 POP IY Restore the message string pointer from the stack.
56019 LD A,79 Load A with INK: WHITE, PAPER: BLUE (BRIGHT) .
This entry point is used by the routine at PrintMenuItems.
PrintMessage 56021 LD (28054),A Write A to *StoredAttribute.
PrintMessage_Loop 56024 LD A,(IY+0) Read the next character in the message string.
56027 CP 36 Return if this is the terminator character.
56029 RET Z
56030 LD E,A Set the character to print in DE.
56031 LD D,0
56033 CALL PrintDoubleHeightCharacter Call PrintDoubleHeightCharacter.
56036 INC HL Increment the attribute buffer position by one.
56037 INC IY Increment the message pointer by one.
56039 JR PrintMessage_Loop Loop back round to PrintMessage_Loop.
Prev: 55932 Up: Map Next: 56041