![]() |
Routines |
| Prev: 57595 | Up: Map | Next: 57773 |
|
Used by the routine at CopyBuffersToScreen.
Copies the pixels of the screen buffer onto the screen, using the stack to copy two bytes at a time.
|
||||
|
Keep the stack pointer, and point it at the playfield on the screen.
|
||||
| CopyPixelsToScreen | 57672 | LD (48046),SP | Save the stack pointer. | |
| 57676 | LD SP,20477 | Point the stack pointer at the end of the last row of the playing area on the screen. | ||
| 57679 | LD B,112 | Set a count of 112 rows. | ||
| 57681 | LD HL,58843 | Point HL at the end of the first row of the buffer. | ||
|
Copy a row from the buffer to the screen.
|
||||
| CopyPixelsToScreen_Row | 57684 | LD D,(HL) | Copy the last twenty bytes of the row from the buffer onto the screen, two at a time. | |
| 57685 | DEC HL | |||
| 57686 | LD E,(HL) | |||
| 57687 | DEC HL | |||
| 57688 | PUSH DE | |||
| 57689 | LD D,(HL) | |||
| 57690 | DEC HL | |||
| 57691 | LD E,(HL) | |||
| 57692 | DEC HL | |||
| 57693 | PUSH DE | |||
| 57694 | LD D,(HL) | |||
| 57695 | DEC HL | |||
| 57696 | LD E,(HL) | |||
| 57697 | DEC HL | |||
| 57698 | PUSH DE | |||
| 57699 | LD D,(HL) | |||
| 57700 | DEC HL | |||
| 57701 | LD E,(HL) | |||
| 57702 | DEC HL | |||
| 57703 | PUSH DE | |||
| 57704 | LD D,(HL) | |||
| 57705 | DEC HL | |||
| 57706 | LD E,(HL) | |||
| 57707 | DEC HL | |||
| 57708 | PUSH DE | |||
| 57709 | LD D,(HL) | |||
| 57710 | DEC HL | |||
| 57711 | LD E,(HL) | |||
| 57712 | DEC HL | |||
| 57713 | PUSH DE | |||
| 57714 | LD D,(HL) | |||
| 57715 | DEC HL | |||
| 57716 | LD E,(HL) | |||
| 57717 | DEC HL | |||
| 57718 | PUSH DE | |||
| 57719 | LD D,(HL) | |||
| 57720 | DEC HL | |||
| 57721 | LD E,(HL) | |||
| 57722 | DEC HL | |||
| 57723 | PUSH DE | |||
| 57724 | LD D,(HL) | |||
| 57725 | DEC HL | |||
| 57726 | LD E,(HL) | |||
| 57727 | DEC HL | |||
| 57728 | PUSH DE | |||
| 57729 | LD D,(HL) | |||
| 57730 | DEC HL | |||
| 57731 | LD E,(HL) | |||
| 57732 | DEC HL | |||
| 57733 | PUSH DE | |||
| 57734 | LD D,(HL) | Copy the first two bytes of the row onto the screen. | ||
| 57735 | DEC HL | |||
| 57736 | LD E,(HL) | |||
| 57737 | PUSH DE | |||
| 57738 | EX DE,HL | Keep the address in the buffer in DE. | ||
|
Move up one pixel line on the screen.
|
||||
| 57739 | LD HL,65302 | Work out the address on the screen of the end of the row above, which is one pixel row up. | ||
| 57742 | ADD HL,SP | |||
|
Jump to CopyPixelsToScreen_Next unless that is the last pixel row of a character row.
|
||||
| 57743 | LD A,H | Test whether it has crossed into the previous character row. | ||
| 57744 | CPL | |||
| 57745 | AND %00000111 | Keep the bits for the pixel line. | ||
| 57747 | JP NZ,CopyPixelsToScreen_Next | Jump to CopyPixelsToScreen_Next if it has not. | ||
|
Move to the previous character row.
|
||||
| 57750 | LD A,L | Subtract 32 from the low byte. | ||
| 57751 | SUB 32 | |||
| 57753 | LD L,A | |||
| 57754 | JP C,CopyPixelsToScreen_Next | Jump to CopyPixelsToScreen_Next if that is in the previous third. | ||
| 57757 | LD A,H | Move up to the last pixel row of the character row. | ||
| 57758 | ADD A,8 | |||
| 57760 | LD H,A | |||
|
Point at the next row.
|
||||
| CopyPixelsToScreen_Next | 57761 | LD SP,HL | Point the stack pointer at the row on the screen. | |
| 57762 | LD HL,45 | Move on to the end of the next row of the buffer. | ||
| 57765 | ADD HL,DE | |||
| 57766 | DJNZ CopyPixelsToScreen_Row | Loop back until all of the rows have been copied. | ||
|
Restore the stack pointer.
|
||||
| 57768 | LD SP,(48046) | Get the stack pointer back. | ||
| 57772 | RET | Return. | ||
|
View the equivalent code in;
The buffer holds 112 rows of 24 bytes, and the top row of the buffer is the bottom row of the playing area, so the rows of the buffer are copied from the bottom of the screen upwards. Only the 22 bytes of each row that are inside the border are copied, which are bytes 2 to 23 of the row.
|
||||
| Prev: 57595 | Up: Map | Next: 57773 |