Prev: 40743 Up: Map Next: 40807
40744: Print Room Image
Used by the routine at Handler_Images.
Input
IX Pointer to room image data
Print_RoomImage 40744 PUSH IX Copy the room-image pointer from IX into HL (using the stack).
40746 POP HL
Step over the 512 mask bytes and aim at the display file.
40747 LD DE,512 Move HL past the 512-byte mask to the pixel data.
40750 ADD HL,DE
40751 LD DE,16384 Set DE to the start of the screen buffer (16384).
Expand each mask byte. Each bit stands for one screen byte (8 pixels).
40754 LD BC,512 512 mask bytes cover the screen, eight screen bytes at a time.
PixelControl_Loop 40757 PUSH BC Stash the mask byte counter on the stack.
40758 LD B,8 Set B to 8 for the 8 bits in a byte.
40760 LD C,(IX+0) Fetch the mask byte from *IX into C.
A set bit copies the next pixel byte onto the screen. When the bit is clear, DE still advances but nothing is written, so those 8 pixels stay blank.
PixelBit_Loop 40763 SLA C Jump to PixelBit_Next if the mask bit is clear (skip that screen byte).
40765 JR NC,PixelBit_Next
40767 LD A,(HL) Copy the next pixel byte onto the screen.
40768 LD (DE),A
40769 INC HL Move to the next pixel byte.
PixelBit_Next 40770 INC DE Move along the screen.
40771 DJNZ PixelBit_Loop Decrease the bit counter by one and loop back to PixelBit_Loop until the counter is zero.
40773 INC IX Move IX on to the next mask byte.
40775 POP BC Restore the mask byte counter from the stack.
40776 DEC BC Decrease the mask byte counter by one.
40777 LD A,B Jump back to PixelControl_Loop until all the mask bytes are done.
40778 OR C
40779 JR NZ,PixelControl_Loop
The bytes that follow are the attribute stream.
40781 PUSH HL Copy the attribute-stream pointer from HL into IX (using the stack).
40782 POP IX
Paint attributes from 22528 until the display ends at 23040.
40784 LD HL,22528 Start at the attribute file.
Attribute_Loop 40787 LD A,(IX+0) Fetch the colour into A and the number of cells into B from *IX (0 means 256).
40790 LD B,(IX+1)
40793 INC IX Move IX to the next pair.
40795 INC IX
Attribute_Paint 40797 LD (HL),A Write the colour into this attribute cell.
40798 INC HL Move along the attribute file.
40799 DJNZ Attribute_Paint Decrease the counter by one and loop back to Attribute_Paint until the counter is zero.
40801 LD A,H Jump back to Attribute_Loop until the attribute file is full.
40802 CP 90
40804 JR NZ,Attribute_Loop
40806 RET Return.
Prev: 40743 Up: Map Next: 40807