Prev: 9F27 Up: Map Next: 9F67
9F28: Print Room Image
Used by the routine at Handler_Images.
Input
IX Pointer to room image data
Print_RoomImage 9F28 PUSH IX Copy the room-image pointer from IX into HL (using the stack).
9F2A POP HL
Step over the 0200 mask bytes and aim at the display file.
9F2B LD DE,$0200 Move HL past the 0200-byte mask to the pixel data.
9F2E ADD HL,DE
9F2F LD DE,$4000 Set DE to the start of the screen buffer (4000).
Expand each mask byte. Each bit stands for one screen byte (08 pixels).
9F32 LD BC,$0200 0200 mask bytes cover the screen, eight screen bytes at a time.
PixelControl_Loop 9F35 PUSH BC Stash the mask byte counter on the stack.
9F36 LD B,$08 Set B to 08 for the 08 bits in a byte.
9F38 LD C,(IX+$00) 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 08 pixels stay blank.
PixelBit_Loop 9F3B SLA C Jump to PixelBit_Next if the mask bit is clear (skip that screen byte).
9F3D JR NC,PixelBit_Next
9F3F LD A,(HL) Copy the next pixel byte onto the screen.
9F40 LD (DE),A
9F41 INC HL Move to the next pixel byte.
PixelBit_Next 9F42 INC DE Move along the screen.
9F43 DJNZ PixelBit_Loop Decrease the bit counter by one and loop back to PixelBit_Loop until the counter is zero.
9F45 INC IX Move IX on to the next mask byte.
9F47 POP BC Restore the mask byte counter from the stack.
9F48 DEC BC Decrease the mask byte counter by one.
9F49 LD A,B Jump back to PixelControl_Loop until all the mask bytes are done.
9F4A OR C
9F4B JR NZ,PixelControl_Loop
The bytes that follow are the attribute stream.
9F4D PUSH HL Copy the attribute-stream pointer from HL into IX (using the stack).
9F4E POP IX
Paint attributes from 5800 until the display ends at 5A00.
9F50 LD HL,$5800 Start at the attribute file.
Attribute_Loop 9F53 LD A,(IX+$00) Fetch the colour into A and the number of cells into B from *IX (00 means 0100).
9F56 LD B,(IX+$01)
9F59 INC IX Move IX to the next pair.
9F5B INC IX
Attribute_Paint 9F5D LD (HL),A Write the colour into this attribute cell.
9F5E INC HL Move along the attribute file.
9F5F DJNZ Attribute_Paint Decrease the counter by one and loop back to Attribute_Paint until the counter is zero.
9F61 LD A,H Jump back to Attribute_Loop until the attribute file is full.
9F62 CP $5A
9F64 JR NZ,Attribute_Loop
9F66 RET Return.
Prev: 9F27 Up: Map Next: 9F67