![]() |
Routines |
| Prev: 40232 | Up: Map | Next: 40406 |
|
Used by the routine at Draw_Room.
Draws the frame of a special room (one with a room y below 16).
In these rooms the first byte of the world map entry is not a set of flags (see Draw_Room) but four codes of three bits each, which overlap by one bit. Each code selects one of eight routines from a table of eight addresses (see Special_Room_Frame_Tables) and each routine draws the pictures for one part of the frame. The codes are:
The first three routines run with the shadow registers, which keeps DE safe, and the last runs with the main registers.
|
|||||||||||||||||||||||||||
| Draw_Special_Room_Frame | 40352 | LD A,E | Fetch the first byte of the world map entry. | ||||||||||||||||||||||||
| 40353 | EXX | Switch to the shadow registers. | |||||||||||||||||||||||||
| 40354 | AND %00000111 | Keep bits 0 to 2 (the code for the top right). | |||||||||||||||||||||||||
| 40356 | LD HL,40406 | Point at the table for the top right (Special_Room_Frame_Tables). | |||||||||||||||||||||||||
| 40359 | CALL Draw_Frame_Part | Draw the top right of the frame. | |||||||||||||||||||||||||
| 40362 | EXX | Switch to the main registers. | |||||||||||||||||||||||||
| 40363 | LD A,E | Fetch the first byte of the world map entry. | |||||||||||||||||||||||||
| 40364 | EXX | Switch to the shadow registers. | |||||||||||||||||||||||||
| 40365 | RRA | Move bits 2 to 4 down to bits 0 to 2. | |||||||||||||||||||||||||
| 40366 | RRA | ||||||||||||||||||||||||||
| 40367 | LD HL,40422 | Point at the table for the bottom right (Special_Room_Frame_Tables_Bottom_Right). | |||||||||||||||||||||||||
| 40370 | CALL Draw_Frame_Part | Draw the bottom right of the frame. | |||||||||||||||||||||||||
| 40373 | EXX | Switch to the main registers. | |||||||||||||||||||||||||
| 40374 | LD A,E | Fetch the first byte of the world map entry. | |||||||||||||||||||||||||
| 40375 | EXX | Switch to the shadow registers. | |||||||||||||||||||||||||
| 40376 | RRA | Move bits 4 to 6 down to bits 0 to 2. | |||||||||||||||||||||||||
| 40377 | RRA | ||||||||||||||||||||||||||
| 40378 | RRA | ||||||||||||||||||||||||||
| 40379 | RRA | ||||||||||||||||||||||||||
| 40380 | LD HL,40438 | Point at the table for the bottom left (Special_Room_Frame_Tables_Bottom_Left). | |||||||||||||||||||||||||
| 40383 | CALL Draw_Frame_Part | Draw the bottom left of the frame. | |||||||||||||||||||||||||
| 40386 | EXX | Switch to the main registers. | |||||||||||||||||||||||||
| 40387 | LD A,E | Fetch the first byte of the world map entry. | |||||||||||||||||||||||||
| 40388 | RLCA | Rotate bits 6, 7 and 0 into bits 0 to 2. | |||||||||||||||||||||||||
| 40389 | RLCA | ||||||||||||||||||||||||||
| 40390 | LD HL,40454 | Point at the table for the top left (Special_Room_Frame_Tables_Top_Left). | |||||||||||||||||||||||||
|
Run the routine that the code selects from the table. The routine returns to the caller of this one.
|
|||||||||||||||||||||||||||
| Draw_Frame_Part | 40393 | AND %00000111 | Keep bits 0 to 2 (the code). | ||||||||||||||||||||||||
| 40395 | LD E,A | Make the code into an offset in DE. | |||||||||||||||||||||||||
| 40396 | LD D,0 | ||||||||||||||||||||||||||
| 40398 | ADD HL,DE | Add the code to the address of the table. | |||||||||||||||||||||||||
| 40399 | ADD HL,DE | Add the code to the address of the table again, as the entries are two bytes long. | |||||||||||||||||||||||||
| 40400 | LD A,(HL) | Fetch the low byte of the address of the routine. | |||||||||||||||||||||||||
| 40401 | INC HL | Move on to the high byte. | |||||||||||||||||||||||||
| 40402 | LD H,(HL) | Fetch the high byte of the address of the routine. | |||||||||||||||||||||||||
| 40403 | LD L,A | Copy the low byte into L. | |||||||||||||||||||||||||
| 40404 | JP (HL) | Jump to the routine. | |||||||||||||||||||||||||
|
Several codes in the tables lead here, so nothing is drawn.
|
|||||||||||||||||||||||||||
| Draw_Nothing | 40405 | RET | Return. | ||||||||||||||||||||||||
| Prev: 40232 | Up: Map | Next: 40406 |