Routines |
Prev: 54704 | Up: Map | Next: 54793 |
Used by the routine at DemoEntryPoint.
|
||||||||
Start by clearing the screen and attribute buffers.
|
||||||||
UnpackScreenData | 54706 | PUSH HL | Stash the pointer to the image data on the stack temporarily. | |||||
54707 | LD HL,22528 | HL=22528 (attribute buffer location). | ||||||
54710 | LD DE,22529 | DE=22529. | ||||||
54713 | LD (HL),0 | Write 0 to *HL. | ||||||
54715 | LD BC,767 | Copy 0 to 767 more bytes, filling the whole of the attribute buffer. | ||||||
54718 | LDIR | |||||||
54720 | POP HL | Restore the pointer to the image data from the stack. | ||||||
54721 | LD DE,16384 | Initialise the target screen buffer location (16384) in DE. | ||||||
The main loop
|
||||||||
UnpackScreenData_Loop | 54724 | LD A,(HL) | Jump to Handler_Zeroes if *HL is equal to 0. | |||||
54725 | CP 0 | |||||||
54727 | JR Z,Handler_Zeroes | |||||||
54729 | LD (DE),A | Write A to *DE. | ||||||
54730 | INC HL | Increment HL by one. | ||||||
54731 | INC DE | Increment DE by one. | ||||||
54732 | JR UnpackScreenData_Loop | Jump to UnpackScreenData_Loop. | ||||||
Handle multiple zeroes.
|
||||||||
Handler_Zeroes | 54734 | INC HL | Move the pointer to the length byte. | |||||
54735 | LD A,(HL) | Load the length into A. | ||||||
54736 | CP 0 | Jump to Handler_Attributes if *A is equal to 0. | ||||||
54738 | JR Z,Handler_Attributes | |||||||
54740 | LD B,A | Store the length in B. | ||||||
54741 | XOR A | Set A to 0 the value to write. | ||||||
Write the zeroes to the screen buffer.
|
||||||||
Write_Zeroes | 54742 | LD (DE),A | Write 0 to the screen buffer location held by *DE. | |||||
54743 | INC DE | Increment the screen buffer pointer by one. | ||||||
54744 | DJNZ Write_Zeroes | Decrease counter by one and loop back to Write_Zeroes until counter is zero. | ||||||
54746 | INC HL | Increment HL by one. | ||||||
54747 | JR UnpackScreenData_Loop | Jump to UnpackScreenData_Loop. | ||||||
Process attributes.
|
||||||||
Handler_Attributes | 54749 | INC HL | Increment HL by one. | |||||
54750 | PUSH HL | IX=HL (using the stack). | ||||||
54751 | POP IX | |||||||
54753 | LD HL,22528 | HL=22528 (attribute buffer location). | ||||||
54756 | LD B,24 | Initialise B to 24 (number of character rows). | ||||||
Handler_Attributes_Loop | 54758 | PUSH BC | Stash the row counter and attribute buffer pointer on the stack. | |||||
54759 | PUSH HL | |||||||
54760 | LD A,0 | Initialise the column counter in A to 0. | ||||||
Process the attribute bytes in a row.
|
||||||||
UnpackScreenData_ProcessAttributesRow | 54762 | LD C,(IX+0) | C=attribute value. | |||||
54765 | INC IX | |||||||
54767 | LD B,(IX+0) | B=run length. | ||||||
54770 | INC IX | |||||||
54772 | ADD A,B | A=run length plus the column counter. | ||||||
Write the run of attributes.
|
||||||||
UnpackScreenData_WriteAttributes_Loop | 54773 | LD (HL),C | Write attribute byte to the attribute buffer. | |||||
54774 | INC HL | Increment the attribute pointer by one. | ||||||
54775 | DJNZ UnpackScreenData_WriteAttributes_Loop | Decrease the length counter by one and loop back to UnpackScreenData_WriteAttributes_Loop until counter is zero. | ||||||
54777 | CP 32 | Jump to UnpackScreenData_ProcessAttributesRow if A is not equal to 32. | ||||||
54779 | JR NZ,UnpackScreenData_ProcessAttributesRow | |||||||
54781 | POP HL | Restore the start of the row into HL from the stack. | ||||||
54782 | LD BC,32 | Move HL 0032 bytes to point to the next row. | ||||||
54785 | ADD HL,BC | |||||||
54786 | POP BC | Restore the row counter from the stack. | ||||||
54787 | DJNZ Handler_Attributes_Loop | Decrease the row counter by one and loop back to Handler_Attributes_Loop until all the rows have been processed. | ||||||
54789 | PUSH IX | BC=current position in attribute data (using the stack). | ||||||
54791 | POP BC | |||||||
54792 | RET | Return. |
Prev: 54704 | Up: Map | Next: 54793 |