Prev: 27934 Up: Map Next: 28070
27951: Room drawing: (000) Draw floor, paint attributes / terrain interaction data, draw Magic Knight, characters and objects then return
Floods 7th - 23rd rows of attribute file with attribute value in byte at HL+1.
Used by the routine at 27762.
27951 INC HL Advance HL to room attribute...
27952 LD A,(HL) ...load into A...
27953 LD (23446),A ...and store at 23446
27956 INC HL Advance HL to floor attribute
27957 PUSH HL Store HL (points to floor attribute data)
27958 LD H,A Load room attribute into both bytes of HL...
27959 LD L,A ...
27960 CALL 28716 Wait for interrupt then flood 7th - 23rd rows of attribute file with attribute in HL
27963 LD HL,20704 Load HL with display file address corresponding to (0, 23) (characters)...
27966 LD (54110),HL ...and move bitmap virtual text cursor here
27969 POP HL Restore HL (points to floor attribute data)
27970 LD A,(HL) Load floor attribute into A...
27971 LD (23695),A ...and store at 23695
27974 INC HL Advance HL to floor UDG code...
27975 LD A,(HL) ...load into A...
27976 LD (54235),A ...and also load into operand of instruction at 54234
27979 LD HL,32 Load HL with 32 as we need to draw across 32 character blocks
27982 CALL 54231 Draw run of 32 characters (i.e. draw the room's floor)
The operand of the instruction at 27985 represents the address of start of room layout data for the current room. This is modified by the instruction at 27891.
27985 LD IX,0 Load IX with start address of room layout data for current room
This entry point is used by the routines at 28095 and 29060.
27989 LD A,(IX+0) Load first byte of room layout data instruction
27992 OR A If this byte is zero (i.e. last entry so no more painting to do)...
27993 JP Z,28101 ...then draw all objects and characters in current room, draw Magic Knight, set action flags and validate I.D. card, then return
27996 CP 252 If this byte is 252 or more...
27998 JP NC,29060 ...then skip IX over current room layout data entry and jump back to 27989 for next one
28001 INC IX Advance to RLE attribute data index and load into L...
28003 LD L,(IX+0) ...
28006 INC IX Advance to RLE terrain interaction data index and load into E...
28008 LD E,(IX+0) ...
28011 INC IX Advance to x-coordinate...
28013 LD A,(IX+0) ...
28016 LD (23493),A ...and store at 23493
28019 INC IX Advance to y-coordinate...
28021 LD A,(IX+0) ...
28024 LD (23494),A ...and store at 23494
28027 LD H,0 Load H with zero (RLE attribute data index already in L)...
28029 ADD HL,HL ...and multiply by four...
28030 ADD HL,HL ...
28031 LD BC,51997 Point BC at start of lookup table for RLE attribute data (room layout graphics)...
28034 ADD HL,BC ...and add HL as offset, loading result into HL
28035 EX DE,HL Swap DE (now points to entry in RLE attribute lookup table at 51997) and HL (L now RLE terrain interaction data index)
28036 LD H,0 Load H with zero (RLE terrain interaction data index already in L)...
28038 ADD HL,HL ...and multiply by four...
28039 ADD HL,HL ...
28040 LD BC,52397 Point BC at start of lookup table for RLE terrain interaction data (room layout graphics)...
28043 ADD HL,BC ...and add HL as offset, loading result into HL
28044 EX DE,HL Swap DE and HL
At this point, DE points to entry in RLE terrain interaction lookup table at 52397 and HL points to entry in RLE attribute lookup table at 51997
28045 PUSH DE Store DE (pointer to required entry in RLE terrain interaction lookup table)
28046 INC IX Advance to mirror options...
28048 LD A,(IX+0) ...and load into A
28051 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 27989 occurs to process this next entry.
28053 OR A Paint room layout data entry's attributes and terrain interaction data applying appropriate mirrors, then process next entry
28054 JP Z,28938
28057 CP 1
28059 JP Z,28906
28062 CP 2
28064 JP Z,28874
28067 JP 28846
Prev: 27934 Up: Map Next: 28070