![]() |
Routines |
Prev: 27272 | Up: Map |
Used by the routines at 29716, 29896 and 62668. Returns with the carry flag set if the message box would be off-screen. Otherwise copies the area of the screen that will be overwritten by the message box into the buffer at 58152, and returns with the attribute file address for the top-left corner of the message box in DE.
|
|||||||||
27276 | LD A,(32767) | B=leftmost column of the play area on screen | |||||||
27279 | LD B,A | ||||||||
27280 | LD A,E | A=x-coordinate of the character's head | |||||||
27281 | AND 248 | A=x-coordinate of the left edge of the message box | |||||||
27283 | SUB B | Return with the carry flag set if the message box would be off-screen to the right | |||||||
27284 | CP 32 | ||||||||
27286 | CCF | ||||||||
27287 | RET C | ||||||||
27288 | LD E,A | E=0, 8, 16 or 24: screen x-coordinate of the left edge of the message box | |||||||
27289 | LD A,D | A=y-coordinate of the point above the character's head | |||||||
27290 | SUB 3 | A=y-coordinate of the top line of the message box | |||||||
27292 | RET C | Return with the carry flag set if this would be off the top of the screen | |||||||
The message box is going to be printed. Prepare for that by saving the area of the screen that will be overwritten.
|
|||||||||
27293 | LD D,0 | DE=0, 8, 16 or 24 | |||||||
27295 | PUSH HL | Save HL | |||||||
27296 | ADD A,A | Set HL the to the attribute file address for the top left corner of the message box | |||||||
27297 | ADD A,A | ||||||||
27298 | ADD A,A | ||||||||
27299 | LD L,A | ||||||||
27300 | LD H,22 | ||||||||
27302 | ADD HL,HL | ||||||||
27303 | ADD HL,HL | ||||||||
27304 | ADD HL,DE | ||||||||
27305 | PUSH HL | Save this base attribute file address | |||||||
27306 | LD DE,58152 | Point DE at the buffer used to save the screen area overwritten by the message box (at 58152) | |||||||
27309 | LD A,3 | Copy three rows of eight attribute bytes each from the screen into the first 24 bytes of the buffer | |||||||
27311 | LD BC,8 | ||||||||
27314 | LDIR | ||||||||
27316 | LD C,24 | ||||||||
27318 | ADD HL,BC | ||||||||
27319 | DEC A | ||||||||
27320 | JR NZ,27311 | ||||||||
27322 | POP HL | Restore the base attribute file address to HL | |||||||
27323 | PUSH HL | And save it again | |||||||
27324 | LD A,H | Set HL to the display file address for the top left corner of the message box | |||||||
27325 | SUB 80 | ||||||||
27327 | ADD A,A | ||||||||
27328 | ADD A,A | ||||||||
27329 | ADD A,A | ||||||||
27330 | LD H,A | ||||||||
27331 | LD C,3 | There are 3 rows of UDGs to copy | |||||||
27333 | LD A,8 | 8 pixel rows per UDG | |||||||
27335 | PUSH BC | ||||||||
27336 | PUSH HL | ||||||||
27337 | LD C,8 | 8 UDGs per row | |||||||
27339 | LDIR | Copy one row of pixels into the buffer | |||||||
27341 | POP HL | ||||||||
27342 | INC H | Move HL to the next row of pixels on screen | |||||||
27343 | DEC A | ||||||||
27344 | JR NZ,27336 | Jump back until all 8 pixel rows for this row of UDGs have been copied into the buffer | |||||||
27346 | LD A,L | Move HL to the display file address for the start of the top row of pixels for the next row of UDGs | |||||||
27347 | ADD A,32 | ||||||||
27349 | LD L,A | ||||||||
27350 | JR C,27356 | ||||||||
27352 | LD A,H | ||||||||
27353 | SUB 8 | ||||||||
27355 | LD H,A | ||||||||
27356 | POP BC | ||||||||
27357 | DEC C | One more row of UDGs copied | |||||||
27358 | JR NZ,27333 | Jump back until all 3 rows have been done | |||||||
27360 | POP DE | Drop the base attribute file address into DE | |||||||
27361 | POP HL | Restore the original contents of HL | |||||||
27362 | RET | Return with the carry flag reset |
Prev: 27272 | Up: Map |