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.
40746 POP HL
Step over the 512 mask bytes and aim at the display file.
40747 LD DE,512 The pixel data follows the mask.
40750 ADD HL,DE
40751 LD DE,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 Take the next mask byte.
40758 LD B,8
40760 LD C,(IX+0)
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 Print_RoomImage_0 if the mask bit is clear (skip that screen byte).
40765 JR NC,Print_RoomImage_0
40767 LD A,(HL) Copy the next pixel byte onto the screen.
40768 LD (DE),A
40769 INC HL
Print_RoomImage_0 40770 INC DE Move along the screen.
40771 DJNZ PixelBit_Loop This mask byte's eight screen bytes are done.
40773 INC IX
40775 POP BC Restore the mask-byte counter from the stack and decrease it.
40776 DEC BC
40777 LD A,B Another mask byte remains.
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.
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) The colour, and how many cells it covers (0 means 256).
40790 LD B,(IX+1)
40793 INC IX
40795 INC IX
Print_RoomImage_1 40797 LD (HL),A Paint that many cells (B=0 runs the DJNZ loop 256 times).
40798 INC HL
40799 DJNZ Print_RoomImage_1
40801 LD A,H Continue until the attribute file is full.
40802 CP 90
40804 JR NZ,Attribute_Loop
The picture is on screen.
40806 RET Return.
View the equivalent code in;
Prev: 40743 Up: Map Next: 40807