Prev: 45278 Up: Map Next: 45386
45323: Print Room Image
Used by the routine at DisplayImage_WoodedVale.
Input
IX Pointer to room image data
Print_RoomImage 45323 PUSH IX HL=IX (using the stack).
45325 POP HL
45326 LD DE,512 Add 512 to the image data to skip the header.
45329 ADD HL,DE
45330 LD DE,16384 Initialise the screen buffer pointer in DE to 16384 (the beginning of the screen buffer).
45333 LD BC,512 Set a counter in BC for 512 bytes to process.
DecompressPixelData_Loop 45336 PUSH BC Stash the byte counter on the stack.
45337 LD B,8 B=8.
45339 LD C,(IX+0) C=*IX+0.
Print_RoomImage_0 45342 SLA C Shift C left (with carry).
45344 JR NC,Print_RoomImage_1 Jump to Print_RoomImage_1 if ?? is greater than or equal to 8.
45346 LD A,(HL) A=*HL.
45347 LD (DE),A Write A to *DE.
45348 INC HL Increment HL by one.
Print_RoomImage_1 45349 INC DE Increment DE by one.
45350 DJNZ Print_RoomImage_0 Decrease counter by one and loop back to Print_RoomImage_0 until counter is zero.
45352 INC IX Increment IX by one.
45354 POP BC Restore the byte counter from the stack.
45355 DEC BC Decrease the byte counter by one.
45356 LD A,B Jump back to DecompressPixelData_Loop until all bytes have been processed.
45357 OR C
45358 JR NZ,DecompressPixelData_Loop
Decompress the attribute data.
45360 PUSH HL IX=HL (using the stack).
45361 POP IX
45363 LD HL,22528 Initialise the attribute buffer pointer in HL to 22528 (the beginning of the attribute buffer).
DecompressAttributeData_Loop 45366 LD A,(IX+0) Fetch the attribute byte from *IX+0 and store it in A.
45369 LD B,(IX+1) Fetch the repeat count from *IX+1 and store this in B.
45372 INC IX Increment IX by two.
45374 INC IX
RepeatAttribute_Loop 45376 LD (HL),A Write the attribute byte to the attribute buffer pointer.
45377 INC HL Increment the attribute buffer pointer by one.
45378 DJNZ RepeatAttribute_Loop Decrease the repeat counter by one and loop back to RepeatAttribute_Loop until the counter is zero.
Keep looping back until the end of the attribute buffer is reached.
45380 LD A,H Jump back to DecompressAttributeData_Loop until H is equal to 90.
45381 CP 90
45383 JR NZ,DecompressAttributeData_Loop
45385 RET Return.
Prev: 45278 Up: Map Next: 45386