![]() |
Routines |
| Prev: 9985 | Up: Map | Next: 99AF |
|
Used by the routines at BLIT_SPRITE, BLIT_SPRITE_MIRRORED, DRAW_TURNED_RIGHT, DRAW_FLIP_ANTIDIAGONAL, DRAW_UPSIDE_DOWN, BLIT_SPRITE_FLIPPED, DRAW_FLIP_DIAGONAL and DRAW_TURNED_LEFT.
Sprite numbers are 1-based, so the number is decremented before being doubled into the table of addresses at FURNITURE_SPRITES. The first two bytes of the data are its size, and the pointer is left just past them.
|
||||||||||||||||
| FETCH_SPRITE | 9995 | LD HL,FURNITURE_SPRITES | The table of sprite addresses. | |||||||||||||
| 9998 | DEC C | Numbered from 1, two bytes each. | ||||||||||||||
| 9999 | LD B,$00 | |||||||||||||||
| 999B | SLA C | |||||||||||||||
| 999D | RL B | |||||||||||||||
| 999F | ADD HL,BC | |||||||||||||||
| 99A0 | LD A,(HL) | The address of the bitmap itself. | ||||||||||||||
| 99A1 | INC HL | |||||||||||||||
| 99A2 | LD H,(HL) | |||||||||||||||
| 99A3 | LD L,A | |||||||||||||||
| 99A4 | EX DE,HL | |||||||||||||||
| 99A5 | CALL PIXEL_TO_SCREEN | Turn the pixel coordinates into a display file address. | ||||||||||||||
| 99A8 | LD A,(DE) | Width then height, and step past them to the first row. | ||||||||||||||
| 99A9 | LD B,A | |||||||||||||||
| 99AA | INC DE | |||||||||||||||
| 99AB | LD A,(DE) | |||||||||||||||
| 99AC | LD C,A | |||||||||||||||
| 99AD | INC DE | |||||||||||||||
| 99AE | RET | |||||||||||||||
|
Watched live, the sizes coming back are 4 by 24 for the characters and 6 by 5 or 6 by 6 for smaller pieces -- so width really is in bytes, eight pixels at a time.
FURNITURE_SPRITES is not a table of its own. It is the 161st entry of SPRITE_TABLE, and this routine does the same arithmetic SPRITE_ADDRESS does, so asking it for sprite 1 fetches entry 161. The base is what says which family of sprites is wanted. An earlier reading of this routine took the 39 entries between FURNITURE_SPRITES and FURNITURE_COLOURS for the whole table and concluded it held the knight, the wizard and seven frames of the serf; that was an accident of where the next base happens to fall.
|
||||||||||||||||
| Prev: 9985 | Up: Map | Next: 99AF |