Prev: BE55 Up: Map Next: BEAC
BE5E: Print Room Graphic
Used by the routine at Print_RoomImage.
Unpack a room picture into the display, drawing it in the paper colour.
Input
IX Pointer to room image data
Print_RoomGraphic BE5E CALL SwitchToNormalScreenOutput Call SwitchToNormalScreenOutput to select the screen channel.
BE61 LD BC,$1821 Set the cursor to row 18, column 21.
BE64 CALL $0DD9 Call CL_SET.
Draw the picture in the paper colour.
BE67 LD HL,$5C8F Take the current attribute from *ATTR_T.
BE6A LD A,(HL) Fetch the attribute byte.
BE6B AND $38 Keep only the PAPER bits.
BE6D RRA Move the PAPER bits into the INK bits.
BE6E RRA
BE6F RRA
BE70 LD B,A Keep that ink colour.
BE71 LD A,(HL) Fetch the attribute byte again.
BE72 AND $F8 Keep everything except the old INK bits.
BE74 OR B Combine the two values.
BE75 LD (HL),A Write the result back to *ATTR_T.
BE76 LD BC,$0200 Count 0200 picture bytes.
Print_RoomGraphic_Loop BE79 PUSH BC Keep the byte counter safe.
BE7A LD HL,$BB45 Use the scanline buffer (BB45).
BE7D LD B,$08 Count 08 bits.
BE7F LD C,(IX+$00) Read the next control byte and advance through the picture.
BE82 INC IX
BE84 JR Print_RoomGraphic_ShiftBit Jump to Print_RoomGraphic_ShiftBit to test the first control bit.
Print_RoomGraphic_NextByte BE86 INC HL Advance to the next byte of the scanline.
Print_RoomGraphic_ShiftBit BE87 SRL C Take the next control bit; a set bit means this scanline byte comes from the picture data.
BE89 JR NC,Print_RoomGraphic_BlankByte Jump to Print_RoomGraphic_BlankByte when that bit is reset, so the byte is blank.
BE8B LD A,(IX+$00) Read the next picture byte and advance through the picture.
BE8E INC IX
BE90 JR Print_RoomGraphic_StoreByte Jump to Print_RoomGraphic_StoreByte to store the picture byte.
Print_RoomGraphic_BlankByte BE92 XOR A Use a blank byte.
Print_RoomGraphic_StoreByte BE93 LD (HL),A Store the byte in the scanline buffer.
BE94 DJNZ Print_RoomGraphic_NextByte Repeat from Print_RoomGraphic_NextByte until the eight bits of this control byte are used.
BE96 LD DE,$BB45 Take the finished scanline (BB45).
BE99 CALL $0B03 Call PO_FETCH.
BE9C CALL $0B7F Call PR_ALL at 0B7F, part of PO_ANY.
BE9F CALL $0ADC Call PO_STORE.
BEA2 POP BC Restore the byte counter from the stack.
BEA3 DEC BC Step the byte counter down.
BEA4 LD A,C Jump back to Print_RoomGraphic_Loop until every picture byte has been drawn.
BEA5 OR B
BEA6 JR NZ,Print_RoomGraphic_Loop
BEA8 CALL $0D4D Call TEMPS.
BEAB RET Return.
View the equivalent code in;
Prev: BE55 Up: Map Next: BEAC