![]() |
Routines |
| Prev: 53185 | Up: Map | Next: 53329 |
|
Used by the routine at 53115.
|
||||
| 53278 | LD DE,24037 | Point DE at table of background attribute data | ||
| 53281 | LD A,(25157) | Load A with Magic Knight's current y-coordinate (pixels) | ||
| 53284 | AND 248 | Clear lowest three bits to round down to nearest multiple of 8 | ||
| 53286 | LD L,A | Load this value into HL... | ||
| 53287 | LD H,0 | ... | ||
| 53289 | ADD HL,HL | Multiply by four to obtain 32 × y-coordinate (characters)... | ||
| 53290 | ADD HL,HL | ... | ||
| 53291 | LD A,(25156) | Load A with Magic Knight's current x-coordinate (pixels) | ||
| 53294 | RRCA | Divide this by eight, rounding down to nearest integer... | ||
| 53295 | RRCA | ...to convert from pixels to characters... | ||
| 53296 | RRCA | ... | ||
| 53297 | AND 31 | ... | ||
| 53299 | LD C,A | Load x-coordinate (characters) into BC... | ||
| 53300 | LD B,0 | ... | ||
| 53302 | ADD HL,BC | Add x-coordinate to 32 × y-coordinate in HL... | ||
| 53303 | LD BC,22528 | ...then add this to start address of attribute file... | ||
| 53306 | ADD HL,BC | ...so that HL points to required byte in attribute file | ||
| 53307 | LD B,4 | Load B with 4 as Magic Knight is four characters tall | ||
| 53309 | PUSH BC | Store BC (B = remaining number of character rows) | ||
| 53310 | LD A,(DE) | Copy byte from table of background attribute data... | ||
| 53311 | LD (HL),A | ...into attribute file | ||
| 53312 | INC HL | Advance current position in attribute file | ||
| 53313 | INC DE | Advance current position in table of background attribute data | ||
| 53314 | LD A,(DE) | Copy byte from table of background attribute data... | ||
| 53315 | LD (HL),A | ...into attribute file | ||
| 53316 | INC HL | Advance current position in attribute file | ||
| 53317 | INC DE | Advance current position in table of background attribute data | ||
| 53318 | LD A,(DE) | Copy byte from table of background attribute data... | ||
| 53319 | LD (HL),A | ...into attribute file | ||
| 53320 | INC DE | Advance current position in table of background attribute data | ||
| 53321 | LD BC,30 | Advance current position in attribute file by 30 bytes... | ||
| 53324 | ADD HL,BC | ...i.e. down one character and left two characters | ||
| 53325 | POP BC | Restore BC (B = remaining number of character rows) | ||
| 53326 | DJNZ 53309 | If character rows to be coloured remain then loop back to 53309 | ||
| 53328 | RET | Return | ||
| Prev: 53185 | Up: Map | Next: 53329 |