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.
9F2A POP HL
Step over the 0200 mask bytes and aim at the display file.
9F2B LD DE,$0200 The pixel data follows the mask.
9F2E ADD HL,DE
9F2F LD DE,$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 Take the next mask byte.
9F36 LD B,$08
9F38 LD C,(IX+$00)
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 Print_RoomImage_0 if the mask bit is clear (skip that screen byte).
9F3D JR NC,Print_RoomImage_0
9F3F LD A,(HL) Copy the next pixel byte onto the screen.
9F40 LD (DE),A
9F41 INC HL
Print_RoomImage_0 9F42 INC DE Move along the screen.
9F43 DJNZ PixelBit_Loop This mask byte's eight screen bytes are done.
9F45 INC IX
9F47 POP BC Restore the mask-byte counter from the stack and decrease it.
9F48 DEC BC
9F49 LD A,B Another mask byte remains.
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.
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) The colour, and how many cells it covers (00 means 0100).
9F56 LD B,(IX+$01)
9F59 INC IX
9F5B INC IX
Print_RoomImage_1 9F5D LD (HL),A Paint that many cells (B=00 runs the DJNZ loop 0100 times).
9F5E INC HL
9F5F DJNZ Print_RoomImage_1
9F61 LD A,H Continue until the attribute file is full.
9F62 CP $5A
9F64 JR NZ,Attribute_Loop
The picture is on screen.
9F66 RET Return.
View the equivalent code in;
Prev: 9F27 Up: Map Next: 9F67