Skip to navigation


Loader: CopyZeroPage

[Commodore 64 version, Disk Loader 2]

Name: CopyZeroPage [Show more] Type: Subroutine Category: Loader Summary: Copy a page of data in a specified direction between zero page and the page at $CE00, omitting the first two bytes
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * Elite GMA loader (Part 4 of 4) calls CopyZeroPage

Arguments: C flag Configures the source page: * Clear = copy data from zero page to $CE00 * Set = copy data from the page at $CE00 to zero page
.CopyZeroPage LDX #2 ; We copy the contents of either $0002 to $00FF (if the ; C flag is clear) or $CE02 to $CEFF (if the C flag is ; set), so set an index in X to start from offset 2 .swap1 LDA $0000,X ; Set A to the X-th byte of zero page BCC swap2 ; If the C flag is clear then skip the following ; instruction LDA $CE00,X ; Set A to the X-th byte of the page at $CE00 .swap2 STA $0000,X ; Store the copied byte in the X-th byte of both zero STA $CE00,X ; page and the page at $CE00 INX ; Increment the byte counter BNE swap1 ; Loop back until we have copied all of zero page RTS ; Return from the subroutine