Prev: 28906 Up: Map Next: 29036
28938: Paint room layout data entry's attributes (room drawing)
Used by the routine at 27951.
See also analogous routine at 29174 (RLE terrain interaction data painting)
Input
HL Points to entry in lookup table for RLE attribute data (room layout graphics) at 51997
DE Points to entry in lookup table for RLE terrain interaction data (room layout graphics) at 52397
28938 PUSH HL Store HL (pointer to entry in lookup table for RLE attribute data)
28939 LD HL,23495 Modify instruction at 28984 to load x-coordinate of graphic's right edge into A...
28942 LD (28985),HL ...i.e. set end x-coordinate for painting left-to-right
28945 LD HL,29005 Modify instruction at 28988 to jump to 29005...
28948 LD (28989),HL ...i.e. advance HL down one character row in attribute file
28951 LD A,35 Modify instruction at 28991 with opcode 35 (INC HL)...
28953 LD (28991),A ...
28956 POP HL Restore HL (pointer to entry in lookup table for RLE attribute data)
28957 CALL 29036 Store coordinates of area to be coloured and point IX at RLE attribute data
28960 LD BC,(23493) Load BC with x- and y-coordinates (top-left) defined in current room layout data entry
This entry point is used by the routines at 28846, 28874 and 28906.
At this point, BC holds the initial coordinates in characters, from which to start painting attributes. IX points to the required RLE attribute data.
28964 PUSH BC Store BC (B = current y-coordinate, C = initial x-coordinate)
28965 CALL 54148 Point HL at attribute file address for character coordinates (C, B)
28968 LD A,(IX+0) Load A with repeat count value
28971 OR A If repeat count is zero...
28972 JP Z,29001 ...then jump to 29001
28975 LD B,A Load B with repeat count
28976 LD C,(IX+1) Load C with attribute to paint
28979 LD (HL),C Apply attribute in C to current attribute file location in HL
28980 LD A,L Load E with x-coordinate (characters) of current attribute file location...
28981 AND 31 ...
28983 LD E,A ...
The operand of the instruction at 28984 is modified by instructions at 28850, 28878, 28910, 28942, to 23493 (x-coordinate of left edge), 23495 (x-coordinate of right edge), 23493 (x-coordinate of left edge), or 23495 (x-coordinate of right edge) respectively.
28984 LD A,(23495) Load A with end x-coordinate for painting...
28987 CP E ...and if this is the same as the x-coordinate...
The operand of the instruction at 28988 (i.e. the destination of the jump) is modified by the instructions at 28856, 28884, 28916 and 28948 to be 29026 (move up one character row), 29026 (move up one character row), 29005 (move down one character row) or 29005 (move down one character row) respectively.
28988 JP Z,29005 ...then jump to routine to move up or down one character row
The instruction at 28991 is modified by the instructions at 28861, 28889, 28921 and 28953 to 43 (DEC HL), 35 (INC HL), 43 (DEC HL) or 35 (INC HL) respectively.
28991 INC HL Advance HL to next (or previous) byte in attribute file
28992 DJNZ 28979 Decrease B (repeat count) and loop back to 28979 if not zero
28994 INC IX Advance IX by two bytes in RLE attribute data...
28996 INC IX ...
28998 JP 28968 Loop back to 28968 for this new data
29001 POP BC Restore BC (B = current y-coordinate, C = initial x-coordinate)
29002 JP 28070 Advance to next room layout data entry and paint its attributes
Move down one character row
29005 EXX Switch registers
29006 LD A,(23496) Load A with one more than y-coordinate of bottom edge of area to paint...
29009 INC A ...
29010 POP BC Restore BC (B = current y-coordinate, C = initial x-coordinate)
29011 INC B Increase B (i.e. move down a character row)
29012 PUSH BC Store BC (B = updated y-coordinate, C = initial x-coordinate)
29013 CP B If B is the same as A (i.e. we are now outside the area to be painted)...
29014 JP Z,29001 ...then jump to 29001
29017 CALL 54148 Load HL with attribute file address for coordinates (C, B) and load E with x-coordinate (characters)
29020 PUSH HL Store HL (new attribute file address)
29021 EXX Switch registers
29022 POP HL Restore HL (new attribute file address)
29023 JP 28992 Jump back to 28992 and continue painting
Move up one character row
29026 EXX Switch registers
29027 LD A,(23494) Load A with one less than y-coordinate of top edge of area to paint...
29030 DEC A ...
29031 POP BC Restore BC (B = current y-coordinate, C = initial x-coordinate)
29032 DEC B Increase B (i.e. move down a character row)
29033 JP 29012 Jump back to 29012
Prev: 28906 Up: Map Next: 29036