Prev: E73B Up: Map Next: E7BB
E73F: Process Graphic Layout Data
Input
IX Current position in graphic layout data
HL Drawing coordinates (H = x, L = y)
Ordinary tile: if it sits inside the 20×14 window, plot it into the display buffer.
Process_GraphicLayoutData E73F LD A,(IX+$00) Fetch the next graphic-layout byte (tile index / opcode) into A.
E742 CP $EE Is A less than EE? If not, jump to Jump_GraphicLayoutRoutine.
E744 JP NC,Jump_GraphicLayoutRoutine
E747 LD A,H Copy H into A.
E748 CP $20 Is A less than 20? If not, jump to Process_GraphicLayoutDataContinueB5.
E74A JP NC,Process_GraphicLayoutDataContinueB5
E74D LD A,L Copy L into A.
E74E CP $14 Is A less than 14? If not, jump to Process_GraphicLayoutDataContinueB5.
E750 JP NC,Process_GraphicLayoutDataContinueB5
E753 PUSH HL Stash HL on the stack.
E754 LD A,H Copy H into A.
E755 ADD A,A Double A to form a word index into the table.
E756 ADD A,H A+=H.
E757 LD C,A Keep the summed coordinate in C.
E758 LD A,L Copy L into A.
E759 ADD A,A Double A to form a word index into the table.
E75A LD E,A Copy A into E as a saved coordinate / value.
E75B LD D,$00 Clear D (high byte of a pointer/offset).
E75D LD B,D Copy D into B.
E75E LD HL,$E967 Point HL at Table: Display Buffer Row Offsets (Table_DisplayBufferRowOffsets).
E761 ADD HL,DE HL+=DE.
E762 LD E,(HL) Fetch the word at HL into DE.
E763 INC HL
E764 LD D,(HL)
E765 LD HL,($72F5) Load HL with the current display-buffer pointer (Pointer_CurrentDisplayBuffer).
E768 ADD HL,DE HL+=DE.
E769 ADD HL,BC HL+=BC.
E76A EX DE,HL Exchange DE and HL.
Write the current graphic-set index into the buffer cell and advance the layout cursor.
E76B LD A,($7306) Load A with the current graphic-set index (CurrentGraphicSetIndex).
E76E LD (DE),A Set the byte at DE.
E76F INC DE Advance the destination drawing coordinate by one.
E770 LD A,(IX+$00) Fetch the current entity's type into A.
E773 LD (DE),A Set the byte at DE.
E774 INC DE Advance the destination drawing coordinate by one.
E775 LD A,($7308) Load A with the current attribute (CurrentAttribute).
E778 OR A Is the current attribute (CurrentAttribute) zero? If not, jump to ProcessLayout_DrawTile.
E779 JR NZ,ProcessLayout_DrawTile
E77B INC IX Advance IX past the graphic-layout operand byte.
E77D LD A,(IX+$00) Fetch the current entity's type for the layout path.
Compose the tile's attribute from CurrentAttribute / entity flags and write it into the display buffer.
ProcessLayout_DrawTile E780 LD L,A Copy A into L.
E781 AND %11000000 A&=C0.
E783 LD B,A Keep a copy of A in B.
E784 LD A,L Copy L into A.
E785 AND %00111111 A&=3F.
E787 LD C,A Keep the masked attribute bits in C.
E788 AND %00111000 A&=38.
E78A JR NZ,Process_GraphicLayoutDataContinueB Jump to Process_GraphicLayoutDataContinueB to continue if the comparison did not match.
E78C BIT 7,(IX+$01) Is bit 07 of the layout step byte at IX+01 set? If so, jump to Process_GraphicLayoutDataContinueB.
E790 JR NZ,Process_GraphicLayoutDataContinueB
E792 LD A,(DE) Load A from the byte at DE.
E793 BIT 6,A Is bit 06 of A set? If not, jump to Process_GraphicLayoutDataContinue.
E795 JR Z,Process_GraphicLayoutDataContinue
E797 ADD A,A Multiply A by 08.
E798 ADD A,A
E799 ADD A,A
Mask the ink/paper bits of the composed attribute before merging.
Process_GraphicLayoutDataContinue E79A AND $38 A&=38.
Merge the masked attribute halves and store the tile triple in the display buffer.
Process_GraphicLayoutDataContinueB E79C OR B Set in A every bit that is set in B.
E79D OR C Set in A every bit that is set in C.
E79E LD (DE),A Set the byte at DE.
E79F POP HL Restore HL from the stack.
Apply the layout delta/flags byte to step the drawing coordinates for the next tile.
Process_GraphicLayoutDataContinueB2 E7A0 LD A,(IX+$01) Fetch the layout delta/flags byte at IX+01 into A.
E7A3 AND %01111111 A&=7F.
E7A5 SUB $20 A-=20.
E7A7 JR Z,Process_GraphicLayoutDataContinueB3 Jump to Process_GraphicLayoutDataContinueB3 to continue if the comparison matched.
E7A9 JR NC,Process_GraphicLayoutDataContinueB4 Jump to Process_GraphicLayoutDataContinueB4 if the result did not underflow.
Step the drawing Y down one character when the signed delta underflows.
Process_GraphicLayoutDataContinueB3 E7AB INC L Advance the low drawing coordinate by one.
Add the signed X delta into H and continue via Advance_GraphicLayoutPointerByTwo.
Process_GraphicLayoutDataContinueB4 E7AC ADD A,H A+=H.
E7AD LD H,A Copy A into H.
E7AE JP Advance_GraphicLayoutPointerByTwo Jump to Advance_GraphicLayoutPointerByTwo to advance the graphic layout pointer and continue.
Skip drawing an off-screen tile, but still consume its layout operand and delta.
Process_GraphicLayoutDataContinueB5 E7B1 LD A,($7308) Load A with the current attribute (CurrentAttribute).
E7B4 OR A Is the current attribute (CurrentAttribute) zero? If not, jump to Process_GraphicLayoutDataContinueB2.
E7B5 JR NZ,Process_GraphicLayoutDataContinueB2
E7B7 INC IX Advance IX past the graphic-layout operand byte.
E7B9 JR Process_GraphicLayoutDataContinueB2 Jump to Process_GraphicLayoutDataContinueB2 to continue this routine.
View the equivalent code in;
Prev: E73B Up: Map Next: E7BB