diff --git a/src/4cade.a b/src/4cade.a index 1a722be5f..718987b2b 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -147,7 +147,7 @@ AttractMode iny iny sty ProDOS_prefix - lda gPathname-2, y +- lda gPathname-2, y sta ProDOS_prefix, y dey bne - @@ -156,7 +156,7 @@ AttractMode lda #'X' sta ProDOS_prefix+2 - +LOAD_FILE kDemoDirectory, @key + +LOAD_FILE_IMM @key ldx #(@end_prelaunch-@prelaunch-1) - lda @prelaunch,x ; copy pre-launch code to main memory @@ -170,6 +170,24 @@ AttractMode bpl - jmp $106 ; jump to pre-launch code +@prelaunch ; this runs from main memory + lda $C088 ; entry point used by some self-running demos + jmp Reenter + +READ_ROM_NO_WRITE ; entry point to launch game (called above) + jsr $FE89 ; initialize machine like a cold boot + jsr $FE93 ; (many games assume a 'clean slate') + sta $C000 + sta $C002 + sta $C004 + sta $C00C + sta $C00E + jsr $FB2F + jsr $FC58 + ldx #$FF + txs + jmp (ldrlo2) ; jump to game +@end_prelaunch + @Slideshow pha ; save module type @@ -196,24 +214,6 @@ AttractMode !word HGRLoad rts -@prelaunch ; this runs from main memory - lda $C088 ; entry point used by some self-running demos - jmp Reenter - +READ_ROM_NO_WRITE ; entry point to launch game (called above) - jsr $FE89 ; initialize machine like a cold boot - jsr $FE93 ; (many games assume a 'clean slate') - sta $C000 - sta $C002 - sta $C004 - sta $C00C - sta $C00E - jsr $FB2F - jsr $FC58 - ldx #$FF - txs - jmp (ldrlo2) ; jump to game -@end_prelaunch - HGRLoad ldx $C000 bpl + diff --git a/src/macros.a b/src/macros.a index 5074e93fc..476cac09c 100644 --- a/src/macros.a +++ b/src/macros.a @@ -101,3 +101,11 @@ +LDADDR kPathSeparator jsr AddToPath } + +!macro LOAD_FILE_IMM .filename { + +LDAY .filename + jsr AddToPath + jsr LoadFile + !word gPathname +} +