Prev: DA7C Up: Map Next: DAE9
DA88: Handler: Messaging
Used by the routines at 89F5, A48D, B934, C13D, CF80 and SetMessagingArea.
Input
B Message ID
Handler_Messaging DA88 LD A,$28 Write 28 to *6D8B.
DA8A LD ($6D8B),A
DA8D PUSH BC Stash the message ID on the stack.
DA8E LD IY,$DB22 Load IY with Table_Messaging.
DA92 LD A,($85EA) Load A with the current *SelectedLanguage.
Keep doubling the *SelectedLanguage value until it equals 0100.
FindLanguage DA95 SLA A Double the value in A.
DA97 JR C,FoundLanguage Jump to FoundLanguage when A crosses the FF/ 00 boundary.
DA99 INC IY Increment the language pointer by two, to point to the next language.
DA9B INC IY
DA9D JR FindLanguage Loop back to FindLanguage.
Found the desired language.
FoundLanguage DA9F LD L,(IY+$00) Load IY with the address at this location.
DAA2 INC IY
DAA4 LD H,(IY+$00)
DAA7 PUSH HL
DAA8 POP IY
DAAA CALL ColouriseBackground Call ColouriseBackground.
DAAD POP BC Restore the message ID from the stack.
LocateMessage_Loop DAAE LD A,(IY+$00) Load the current character from the message pointer.
DAB1 CP $24 Is this a terminator character?
DAB3 INC IY Increment the message pointer by one.
DAB5 JR NZ,LocateMessage_Loop Loop back to LocateMessage_Loop if the character is not a terminator character.
DAB7 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.
DAB9 LD DE,$0000 DE=0000.
DABC PUSH IY Stash the start of the message on the stack.
FindLengthOfMessage_Loop DABE LD A,(IY+$00) Read the next character in the message string.
DAC1 CP $24 If this is a terminator character, jump to CalculatePrintPosition.
DAC3 JR Z,CalculatePrintPosition
DAC5 INC IY Increment the message pointer by one.
DAC7 INC E Increment the message length by one.
DAC8 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 DACA LD A,$20 Subtract the message length from the maximum width of the screen (20 characters), and divide the result by two. Add this left padding to HL to set the print position.
DACC SUB E
DACD SRL A
DACF LD E,A
DAD0 ADD HL,DE
DAD1 POP IY Restore the message string pointer from the stack.
DAD3 LD A,$4F Load A with INK: WHITE, PAPER: BLUE (BRIGHT) .
This entry point is used by the routine at PrintMenuItems.
PrintMessage DAD5 LD ($6D96),A Write A to *StoredAttribute.
PrintMessage_Loop DAD8 LD A,(IY+$00) Read the next character in the message string.
DADB CP $24 Return if this is the terminator character.
DADD RET Z
DADE LD E,A Set the character to print in DE.
DADF LD D,$00
DAE1 CALL PrintDoubleHeightCharacter Call PrintDoubleHeightCharacter.
DAE4 INC HL Increment the attribute buffer position by one.
DAE5 INC IY Increment the message pointer by one.
DAE7 JR PrintMessage_Loop Loop back round to PrintMessage_Loop.
Prev: DA7C Up: Map Next: DAE9