Skip to navigation

Setup: Entry

Name: Entry [Show more] Type: Subroutine Category: Setup Summary: The main entry point for the game
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
ORG &6D00 \ Set the assembly address to &6D00 .Entry \ We start by copying the game code in memory as \ follows: \ \ * &1900-&6CFF is copied to &0400-&57FF \ \ The game binary has a load address of &1900 and an \ execution address of &6D00 (the address of this \ routine) LDA #&00 \ Set (Q P) = &1900 STA P \ STA R \ We use this as the source address for the copy LDA #&19 STA Q LDA #&04 \ Set (S R) = &0400 STA S \ \ We use this as the destination address for the copy .entr1 LDY #0 \ Set up a byte counter in Y .entr2 LDA (P),Y \ Copy the Y-th byte of (Q P) to the Y-th byte of (S R) STA (R),Y INY \ Increment the byte counter BNE entr2 \ Loop back until we have copied a whole page of bytes INC Q \ Increment the high byte of (Q P) to point to the next \ page in memory INC S \ Increment the high byte of (S R) to point to the next \ page in memory LDA Q \ Loop back until (Q P) reaches &6D00, at which point we CMP #&6D \ have copied all the game code BNE entr1 JMP ConfigureMachine \ Jump to ConfigureMachine to configure the computer, \ ready for a new game