![]() |
Routines |
| Prev: 36147 | Up: Map |
|
||||||||
| 36203 | LD HL,32768 | Point HL at the first room layout byte at 32768 | ||||||
| 36206 | LD IX,24064 | Point IX at the first byte of the attribute buffer at 24064 | ||||||
|
The following loop copies the attribute bytes for the background, floor, wall and nasty tiles into the buffer at 24064.
|
||||||||
| 36210 | LD A,(HL) | Pick up a room layout byte | ||||||
| 36211 | RLCA | Move bits 6 and 7 into bits 0 and 1 | ||||||
| 36212 | RLCA | |||||||
| 36213 | CALL 36288 | Copy the attribute byte for this tile into the buffer at 24064 | ||||||
| 36216 | LD A,(HL) | Pick up the room layout byte again | ||||||
| 36217 | RRCA | Move bits 4 and 5 into bits 0 and 1 | ||||||
| 36218 | RRCA | |||||||
| 36219 | RRCA | |||||||
| 36220 | RRCA | |||||||
| 36221 | CALL 36288 | Copy the attribute byte for this tile into the buffer at 24064 | ||||||
| 36224 | LD A,(HL) | Pick up the room layout byte again | ||||||
| 36225 | RRCA | Move bits 2 and 3 into bits 0 and 1 | ||||||
| 36226 | RRCA | |||||||
| 36227 | CALL 36288 | Copy the attribute byte for this tile into the buffer at 24064 | ||||||
| 36230 | LD A,(HL) | Pick up the room layout byte again; this time the required bit-pair is already in bits 0 and 1 | ||||||
| 36231 | CALL 36288 | Copy the attribute byte for this tile into the buffer at 24064 | ||||||
| 36234 | INC HL | Point HL at the next room layout byte | ||||||
| 36235 | LD A,L | Have we processed all 128 room layout bytes yet? | ||||||
| 36236 | AND 128 | |||||||
| 36238 | JR Z,36210 | If not, jump back to process the next one | ||||||
|
Next consider the conveyor tiles (if any).
|
||||||||
| 36240 | LD A,(32985) | Pick up the length of the conveyor from 32985 | ||||||
| 36243 | OR A | Is there a conveyor in the room? | ||||||
| 36244 | JR Z,36257 | Jump if not | ||||||
| 36246 | LD HL,(32983) | Pick up the address of the conveyor's location in the attribute buffer at 24064 from 32983 | ||||||
| 36249 | LD B,A | B will count the conveyor tiles | ||||||
| 36250 | LD A,(32973) | Pick up the attribute byte for the conveyor tile from 32973 | ||||||
| 36253 | LD (HL),A | Copy the attribute bytes for the conveyor tiles into the buffer at 24064 | ||||||
| 36254 | INC HL | |||||||
| 36255 | DJNZ 36253 | |||||||
|
And finally consider the ramp tiles (if any).
|
||||||||
| 36257 | LD A,(32989) | Pick up the length of the ramp from 32989 | ||||||
| 36260 | OR A | Is there a ramp in the room? | ||||||
| 36261 | RET Z | Return if not | ||||||
| 36262 | LD HL,(32987) | Pick up the address of the ramp's location in the attribute buffer at 24064 from 32987 | ||||||
| 36265 | LD A,(32986) | Pick up the ramp direction from 32986; A=0 (ramp goes up to the left) or 1 (ramp goes up to the right) | ||||||
| 36268 | AND 1 | |||||||
| 36270 | RLCA | Now DE=-33 (ramp goes up to the left) or -31 (ramp goes up to the right) | ||||||
| 36271 | ADD A,223 | |||||||
| 36273 | LD E,A | |||||||
| 36274 | LD D,255 | |||||||
| 36276 | LD A,(32989) | Pick up the length of the ramp from 32989 | ||||||
| 36279 | LD B,A | B will count the ramp tiles | ||||||
| 36280 | LD A,(32964) | Pick up the attribute byte for the ramp tile from 32964 | ||||||
| 36283 | LD (HL),A | Copy the attribute bytes for the ramp tiles into the buffer at 24064 | ||||||
| 36284 | ADD HL,DE | |||||||
| 36285 | DJNZ 36283 | |||||||
| 36287 | RET | |||||||
| Prev: 36147 | Up: Map |