Routines |
Prev: 51152 | Up: Map | Next: 51255 |
Used by the routine at 54053.
|
||||||||
Get a room data set at 31744 and copy it into the working buffer at 60227, ready to deal with:
|
||||||||
51178 | LD A,(HL) | Check for end-of-data byte | ||||||
51179 | CP 255 | |||||||
51181 | JP Z,54065 | If found, skip out of routine | ||||||
51184 | LD BC,16 | Prep counter to copy 16 bytes | ||||||
51187 | CP 0 | If the first byte is zero... | ||||||
51189 | JR NZ,51194 | |||||||
51191 | ADD HL,BC | ...then this room item is no longer present, so skip to the next data bank of 16 bytes | ||||||
51192 | JR 51178 | ...and keep checking the data banks | ||||||
Copy room item data from data bank into working data buffer at 60227
|
||||||||
51194 | LD DE,60227 | Copy data from 16 byte data bank at 31744 to 60227 | ||||||
51197 | LDIR | |||||||
51199 | LD (60092),HL | Store address pointer, now at the start of the next 16 byte data set | ||||||
51202 | LD A,(60238) | Item properties byte | ||||||
51205 | AND %11111011 | Reset bit 2 of this data byte - to indicate this particular room item doesn't needs erasing prior to drawing | ||||||
51207 | LD (60238),A | ...and restore | ||||||
51210 | LD HL,(60241) | Get graphic address pointer to this item's graphics, in the address pointer table at 38851 | ||||||
51213 | LD (60109),HL | ...and store. | ||||||
Calculate and store this item's horizontal room co-ordinates. Horizontal half-character (4-pixel) position is converted to pixel position and stored at 60115.
The carry bit is used in the calculation to store (at 60116) a flag indicating where the item is in the room, and is set to 0 (visible part of screen), 1 (right of the visible screen) or 255 (left of the visible screen).
|
||||||||
51216 | LD HL,(60231) | H = Graphic horizontal position within current room, in half character (4 pixel) steps (H = 60232, L = 60231). L contains an overflow from this. | ||||||
51219 | ADD HL,HL | x 2 | ||||||
51220 | SBC A,A | If carry set, set A to 255, otherwise 0 | ||||||
51221 | ADD HL,HL | x 4 to complete conversion of horizontal position from half-characters to pixels | ||||||
51222 | RLA | If carry set, rotate carry bit into A register | ||||||
51223 | LD (60116),A | ...and store as the high byte, e.g. 0 = in room viewport, 1 = to the right of the viewport, 255 = to the left of the viewport | ||||||
51226 | LD A,H | Get horizontal screen pixel position | ||||||
51227 | LD (60115),A | ...and store. | ||||||
The next instructions check bit 4 of the Graphic properties byte (this bit is unused).
|
||||||||
51230 | LD A,(60239) | This is the pre-graphics data byte (Graphic properties) | ||||||
51233 | AND 16 | Check if bit 4 set (16) | ||||||
51235 | JR Z,51255 | If it's NOT set, jump to 51255 | ||||||
None of the graphics has bit 4 (16) set, so these instructions aren't run (which add an offset to the graphic address pointer):
|
||||||||
51237 | LD HL,(60241) | --- | ||||||
51240 | ADD HL,DE | --- | ||||||
51241 | ADD HL,DE | --- | ||||||
51242 | LD (60241),HL | --- | ||||||
51245 | LD A,(60238) | --- | ||||||
51248 | OR 4 | --- | ||||||
51250 | LD (60238),A | --- | ||||||
51253 | JR 51265 | --- |
Prev: 51152 | Up: Map | Next: 51255 |