more efficient

This commit is contained in:
Peter Ferrie 2018-11-06 11:07:06 -08:00
parent 3d958303e9
commit 3684510a30
2 changed files with 28 additions and 20 deletions

View File

@ -147,7 +147,7 @@ AttractMode
iny iny
iny iny
sty ProDOS_prefix sty ProDOS_prefix
lda gPathname-2, y - lda gPathname-2, y
sta ProDOS_prefix, y sta ProDOS_prefix, y
dey dey
bne - bne -
@ -156,7 +156,7 @@ AttractMode
lda #'X' lda #'X'
sta ProDOS_prefix+2 sta ProDOS_prefix+2
+LOAD_FILE kDemoDirectory, @key +LOAD_FILE_IMM @key
ldx #(@end_prelaunch-@prelaunch-1) ldx #(@end_prelaunch-@prelaunch-1)
- lda @prelaunch,x ; copy pre-launch code to main memory - lda @prelaunch,x ; copy pre-launch code to main memory
@ -170,6 +170,24 @@ AttractMode
bpl - bpl -
jmp $106 ; jump to pre-launch code 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 @Slideshow
pha ; save module type pha ; save module type
@ -196,24 +214,6 @@ AttractMode
!word HGRLoad !word HGRLoad
rts 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 HGRLoad
ldx $C000 ldx $C000
bpl + bpl +

View File

@ -101,3 +101,11 @@
+LDADDR kPathSeparator +LDADDR kPathSeparator
jsr AddToPath jsr AddToPath
} }
!macro LOAD_FILE_IMM .filename {
+LDAY .filename
jsr AddToPath
jsr LoadFile
!word gPathname
}