Prev: 39036 Up: Map Next: 39158
39047: Room drawing: (000) Draw floor, paint attributes / terrain interaction data, draw Magic Knight, characters and objects then return
Used by the routine at 38841.
39047 LD A,(23452) If drawing-layout-data-fragment flag is zero (reset)...
39050 OR A ...
39051 JR Z,39063 ...then skip ahead to 39063
39053 XOR A Set drawing-layout-data-fragment flag to zero (reset)...
39054 LD (23452),A ...
39057 LD HL,(23453) Load HL with previously stored position in room layout data
39060 JP 38977 Loop back to 38977 for next byte of room layout data
The operand of the instruction at 39063 represents the address of start of room layout data for the current room. This is modified by the instruction at 38974.
39063 LD IX,0 Load IX with start address of room layout data for current room
This entry point is used by the routines at 39183, 39189, 39216, 39291 and 39393.
39067 LD A,(IX+0) Load first byte of room layout data instruction
39070 OR A If this byte is zero (i.e. last entry so no more painting to do)...
39071 JP Z,39393 ...then finalise room drawing, draw objects and characters, and animate the arrival of any new characters, then return
39074 CP 127 If this byte is 127 (i.e. horizontal block drawing)...
39076 JP Z,39216 ...then draw run of 2 × 2 blocks horizontally
39079 CP 126 If this byte is 126 (i.e. vertical block drawing)...
39081 JP Z,39291 ...then draw run of 2 × 2 blocks vertically
39084 BIT 7,A If bit 7 (draw-layout-data-fragment flag) is set...
39086 JP NZ,39189 ...then jump to 39189 (start painting attribute / terrain interaction data for layout data fragment)
39089 INC IX Advance to RLE attribute data index and load into L...
39091 LD L,(IX+0) ...
39094 INC IX Advance to RLE terrain interaction data index and load into E...
39096 LD E,(IX+0) ...
39099 INC IX Advance to x-coordinate...
39101 LD A,(IX+0) ...
39104 LD (23408),A ...and store at 23408
39107 INC IX Advance to y-coordinate...
39109 LD A,(IX+0) ...
39112 LD (23409),A ...and store at 23409
39115 LD H,0 Load H with zero (RLE attribute data index already in L)...
39117 ADD HL,HL ...and multiply by four...
39118 ADD HL,HL ...
39119 LD BC,60487 Point BC at start of lookup table for RLE attribute data (room layout graphics)...
39122 ADD HL,BC ...and add HL as offset, loading result into HL
39123 EX DE,HL Swap DE (now points to entry in RLE attribute lookup table at 60487) and HL (L now RLE terrain interaction data index)
39124 LD H,0 Load H with zero (RLE terrain interaction data index already in L)...
39126 ADD HL,HL ...and multiply by four...
39127 ADD HL,HL ...
39128 LD BC,60889 Point BC at start of lookup table for RLE terrain interaction data (room layout graphics)...
39131 ADD HL,BC ...and add HL as offset, loading result into HL
39132 EX DE,HL Swap DE and HL
At this point, DE points to entry in RLE terrain interaction lookup table at 60889 and HL points to entry in RLE attribute lookup table at 60487
39133 PUSH DE Store DE (pointer to required entry in RLE terrain interaction lookup table)
39134 INC IX Advance to mirror options...
39136 LD A,(IX+0) ...and load into A
39139 PUSH IX Store IX (current position in room layout data)
The following jumps handle the painting of the current room layout data entry's attribute and terrain interaction data. After this painting is completed, IX is advanced to the start of the next room layout data entry and a jump back to 39067 occurs to process this next entry.
39141 OR A Paint room layout data entry's attributes and terrain interaction data applying appropriate mirrors, then process next entry
39142 JP Z,40937
39145 CP 1
39147 JP Z,40905
39150 CP 2
39152 JP Z,40873
39155 JP 40845
Prev: 39036 Up: Map Next: 39158