![]() |
Routines |
| Prev: A921 | Up: Map | Next: A97A |
|
Used by the routines at ShowTitleMenu, PrintScore, CollectBottle, ScrollMessage, ShowExitMessage, RunFrame, CollectItem, ShowPlayerNumber, RunGame and PrintTextRecords.
Prints a text record. A text record has four bytes followed by the characters: the x position in pixels, the y position in pixels of the bottom line of the text, the attribute and the number of characters in bits 0-5. Bit 7 of the number of characters selects double height, and bits 6 and 7 together select double height and double width.
|
|||||||||||||
| PrintText | A923 | EX DE,HL | Exchange DE and HL, so that HL is the address of the record. | ||||||||||
| A924 | LD E,(HL) | Fetch the x position. | |||||||||||
| A925 | INC HL | Move onto the y position. | |||||||||||
| A926 | LD D,(HL) | Fetch it. | |||||||||||
| A927 | INC HL | Move onto the attribute. | |||||||||||
| A928 | LD A,(HL) | Fetch it. | |||||||||||
| A929 | LD ($AAE4),A | Store it in the attribute of the rectangle at AAE4. | |||||||||||
| A92C | INC HL | Move onto the number of characters and the flags. | |||||||||||
| A92D | LD B,(HL) | Fetch them. | |||||||||||
| A92E | INC HL | Move onto the first character. | |||||||||||
| A92F | XOR A | A is 00. | |||||||||||
| A930 | LD ($A992),A | Store it in the operand of the jump at A992 to select the normal size. | |||||||||||
| A933 | INC A | A is 01. | |||||||||||
| A934 | LD ($AAE3),A | Store it as the height of the rectangle at AAE3. | |||||||||||
| A937 | LD A,B | Fetch the number of characters. | |||||||||||
| A938 | AND %00111111 | Keep the number of characters. | |||||||||||
| A93A | LD ($AAE2),A | Store it as the width of the rectangle at AttributeRectangle. | |||||||||||
| A93D | BIT 7,B | Jump to PrintText_Attributes if bit 7, the flag for double height, is reset. | |||||||||||
| A93F | JR Z,PrintText_Attributes | ||||||||||||
| A941 | BIT 6,B | Jump to PrintText_Double if bit 6, the flag for double width, is set. | |||||||||||
| A943 | JR NZ,PrintText_Double | ||||||||||||
| A945 | LD A,$0C | Set the distance to jump to 0C... | |||||||||||
| A947 | LD ($A992),A | ...to select double height. | |||||||||||
| A94A | LD A,$02 | Set the height of the rectangle to 02. | |||||||||||
| A94C | LD ($AAE3),A | Store it. | |||||||||||
| A94F | JR PrintText_Attributes | Jump to PrintText_Attributes. | |||||||||||
| PrintText_Double | A951 | LD A,$1E | Set the distance to jump to 1E... | ||||||||||
| A953 | LD ($A992),A | ...to select double height and width. | |||||||||||
| A956 | LD A,$02 | Set the height of the rectangle to 02. | |||||||||||
| A958 | LD ($AAE3),A | Store it. | |||||||||||
| A95B | LD A,($AAE2) | Fetch the width of the rectangle. | |||||||||||
| A95E | ADD A,A | Double it. | |||||||||||
| A95F | LD ($AAE2),A | Store it. | |||||||||||
| PrintText_Attributes | A962 | EX DE,HL | Exchange DE and HL, so that DE is the address of the first character and HL is the position. | ||||||||||
| A963 | PUSH BC | Save the number of characters. | |||||||||||
| A964 | PUSH DE | Save the address of the first character. | |||||||||||
| A965 | CALL FillScratchRectangle | Call FillScratchRectangle to set the attributes. | |||||||||||
| A968 | POP DE | Restore the address of the first character. | |||||||||||
| A969 | POP BC | Restore the number of characters. | |||||||||||
| A96A | CALL GetScreenAddress | Convert the pixel position into a screen address. | |||||||||||
| A96D | LD A,B | Fetch the number of characters. | |||||||||||
| A96E | AND %00111111 | Keep the number of characters. | |||||||||||
| A970 | LD B,A | Store it in B. | |||||||||||
| PrintText_Character | A971 | PUSH BC | Save the number of characters. | ||||||||||
| A972 | CALL PrintCharacter | Print a character. | |||||||||||
| A975 | POP BC | Restore the number of characters. | |||||||||||
| A976 | INC DE | Move onto the next character. | |||||||||||
| A977 | DJNZ PrintText_Character | Jump back until all of the characters have been printed. | |||||||||||
| A979 | RET | Return. | |||||||||||
| Prev: A921 | Up: Map | Next: A97A |