Prev: 57344 Up: Map Next: 59281
59136: Draw Slot Table
Used by the routine at Dispatch_Phase_One.
For each occupied slot at Slot_Table, calls Plot_Pixel if the calculated point is in range.
Draw_Slot_Table 59136 LD HL,(60952) Stash *View_Range on the stack.
59139 PUSH HL
59140 LD HL,16 Write 16 to *View_Range.
59143 LD (60952),HL
59146 LD A,(60973) Fetch *View_Angle.
59149 CALL Fetch_Sine_Cosine Call Fetch_Sine_Cosine.
59152 LD A,(61341) Fetch *Slot_Count.
59155 LD B,A Copy the slot count to B.
59156 LD IX,23296 Point IX at Slot_Table.
Process one slot.
Draw_Slot_Table_0 59160 LD A,(IX+0) Jump to Draw_Slot_Table_2 if this slot is empty.
59163 AND A
59164 JR Z,Draw_Slot_Table_2
59166 EXX Switch to the shadow registers.
59167 LD L,(IX+3) Copy the second word to *Depth.
59170 LD H,(IX+4)
59173 LD (60946),HL
59176 LD L,(IX+1) Copy the first word to *Rotated_X.
59179 LD H,(IX+2)
59182 LD (60942),HL
59185 LD DE,(61042) Fetch *Heading.
59189 LD A,E Negate the coordinate.
59190 CPL
59191 LD E,A
59192 LD A,D
59193 CPL
59194 LD D,A
59195 INC DE
59196 LD (60944),DE Write the coordinate to *Rotated_Y.
59200 CALL Test_In_View Call Test_In_View.
59203 EXX Switch back.
59204 JR NZ,Draw_Slot_Table_2 Jump to Draw_Slot_Table_2 if the point is out of view.
59206 EXX Switch to the shadow registers.
59207 LD DE,(60944) Fetch *Rotated_Y.
59211 LD HL,(60942) Fetch *Rotated_X.
59214 CALL Rotate_Coordinates Call Rotate_Coordinates.
59217 LD (60944),DE Write the rotated coordinate to *Rotated_Y.
59221 LD DE,(60946) Fetch *Depth.
59225 CALL Divide Call Divide.
59228 LD HL,128 Set the offset to 128.
59231 ADD HL,BC Add the quotient.
59232 INC H Jump to Draw_Slot_Table_1 if the high byte is not zero.
59233 DEC H
59234 JR NZ,Draw_Slot_Table_1
59236 PUSH HL Stash the coordinate on the stack.
59237 LD DE,(60946) Fetch *Depth.
59241 LD HL,(60944) Fetch *Rotated_Y.
59244 CALL Divide Call Divide.
59247 LD HL,64 Set the offset to 64.
59250 ADD HL,BC Add the quotient.
59251 POP DE Restore the other coordinate from the stack.
59252 BIT 7,L Jump to Draw_Slot_Table_1 if bit 7 of the low byte is set.
59254 JR NZ,Draw_Slot_Table_1
59256 INC H Jump to Draw_Slot_Table_1 if the high byte is not zero.
59257 DEC H
59258 JR NZ,Draw_Slot_Table_1
59260 LD H,L Set the Y coordinate from the low byte.
59261 LD L,E Set the X coordinate from the other low byte.
59262 LD A,(IX+5) Fetch the attribute.
59265 CALL Plot_Pixel Call Plot_Pixel.
Draw_Slot_Table_1 59268 EXX Switch back to the main registers.
Next slot.
Draw_Slot_Table_2 59269 LD DE,6 Advance to the next slot, and loop back to Draw_Slot_Table_0 until all slots are processed.
59272 ADD IX,DE
59274 DJNZ Draw_Slot_Table_0
59276 POP HL Restore *View_Range from the stack.
59277 LD (60952),HL
59280 RET Return.
Prev: 57344 Up: Map Next: 59281