Prev: E000 Up: Map Next: E791
E700: 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 E700 LD HL,($EE18) Stash *View_Range on the stack.
E703 PUSH HL
E704 LD HL,$0010 Write 10 to *View_Range.
E707 LD ($EE18),HL
E70A LD A,($EE2D) Fetch *View_Angle.
E70D CALL Fetch_Sine_Cosine Call Fetch_Sine_Cosine.
E710 LD A,($EF9D) Fetch *Slot_Count.
E713 LD B,A Copy the slot count to B.
E714 LD IX,$5B00 Point IX at Slot_Table.
Process one slot.
Draw_Slot_Table_0 E718 LD A,(IX+$00) Jump to Draw_Slot_Table_2 if this slot is empty.
E71B AND A
E71C JR Z,Draw_Slot_Table_2
E71E EXX Switch to the shadow registers.
E71F LD L,(IX+$03) Copy the second word to *Depth.
E722 LD H,(IX+$04)
E725 LD ($EE12),HL
E728 LD L,(IX+$01) Copy the first word to *Rotated_X.
E72B LD H,(IX+$02)
E72E LD ($EE0E),HL
E731 LD DE,($EE72) Fetch *Heading.
E735 LD A,E Negate the coordinate.
E736 CPL
E737 LD E,A
E738 LD A,D
E739 CPL
E73A LD D,A
E73B INC DE
E73C LD ($EE10),DE Write the coordinate to *Rotated_Y.
E740 CALL Test_In_View Call Test_In_View.
E743 EXX Switch back.
E744 JR NZ,Draw_Slot_Table_2 Jump to Draw_Slot_Table_2 if the point is out of view.
E746 EXX Switch to the shadow registers.
E747 LD DE,($EE10) Fetch *Rotated_Y.
E74B LD HL,($EE0E) Fetch *Rotated_X.
E74E CALL Rotate_Coordinates Call Rotate_Coordinates.
E751 LD ($EE10),DE Write the rotated coordinate to *Rotated_Y.
E755 LD DE,($EE12) Fetch *Depth.
E759 CALL Divide Call Divide.
E75C LD HL,$0080 Set the offset to 80.
E75F ADD HL,BC Add the quotient.
E760 INC H Jump to Draw_Slot_Table_1 if the high byte is not zero.
E761 DEC H
E762 JR NZ,Draw_Slot_Table_1
E764 PUSH HL Stash the coordinate on the stack.
E765 LD DE,($EE12) Fetch *Depth.
E769 LD HL,($EE10) Fetch *Rotated_Y.
E76C CALL Divide Call Divide.
E76F LD HL,$0040 Set the offset to 40.
E772 ADD HL,BC Add the quotient.
E773 POP DE Restore the other coordinate from the stack.
E774 BIT 7,L Jump to Draw_Slot_Table_1 if bit 7 of the low byte is set.
E776 JR NZ,Draw_Slot_Table_1
E778 INC H Jump to Draw_Slot_Table_1 if the high byte is not zero.
E779 DEC H
E77A JR NZ,Draw_Slot_Table_1
E77C LD H,L Set the Y coordinate from the low byte.
E77D LD L,E Set the X coordinate from the other low byte.
E77E LD A,(IX+$05) Fetch the attribute.
E781 CALL Plot_Pixel Call Plot_Pixel.
Draw_Slot_Table_1 E784 EXX Switch back to the main registers.
Next slot.
Draw_Slot_Table_2 E785 LD DE,$0006 Advance to the next slot, and loop back to Draw_Slot_Table_0 until all slots are processed.
E788 ADD IX,DE
E78A DJNZ Draw_Slot_Table_0
E78C POP HL Restore *View_Range from the stack.
E78D LD ($EE18),HL
E790 RET Return.
Prev: E000 Up: Map Next: E791