From 3d958303e9b648445a5f34cc990d0f79756bd6a0 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Mon, 5 Nov 2018 22:16:35 -0800 Subject: [PATCH 1/2] sync, cache prefix --- src/4cade.a | 51 ++++++++++++++++++++++++++++++--------------- src/glue.prorwts2.a | 38 +++------------------------------ src/macros.a | 8 +++++++ winmake.bat | 27 ++++++++++++++++++++++-- 4 files changed, 70 insertions(+), 54 deletions(-) diff --git a/src/4cade.a b/src/4cade.a index c3358ad4f..1a722be5f 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -142,6 +142,20 @@ AttractMode cmp #$03 bne @Slideshow + +LOAD_PATH kDemoDirectory + ldy gPathname + iny + iny + sty ProDOS_prefix + lda gPathname-2, y + sta ProDOS_prefix, y + dey + bne - + lda #'/' + sta ProDOS_prefix+1 + lda #'X' + sta ProDOS_prefix+2 + +LOAD_FILE kDemoDirectory, @key ldx #(@end_prelaunch-@prelaunch-1) @@ -155,23 +169,6 @@ AttractMode dex 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 @@ -199,6 +196,24 @@ 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 + @@ -284,6 +299,8 @@ ProDOS_fatal ;only for debugging, will be removed jsr $fe89 jsr $fe93 jmp $ff3a +ProDOS_prefix=$bfd0 +; !fill $2e } end_promote diff --git a/src/glue.prorwts2.a b/src/glue.prorwts2.a index 92d1cc6d2..94bf7d493 100644 --- a/src/glue.prorwts2.a +++ b/src/glue.prorwts2.a @@ -252,47 +252,15 @@ ProDOS_enter jsr @imp_seek jmp ProDOS_exit - -PREV_BLOCK_LO = $0 ;ProDOS constant -PREV_BLOCK_HI = $1 ;ProDOS constant @imp_prefix ldx #buffer jsr @setbuffer1 - lda gPrefix - sta packet - lda gPrefix+1 - sta packet+1 - ldy #0 - lda (packet), y - tax - inx - !byte $2c + ldy ProDOS_prefix @copy_prefix - lda (packet), y - iny - iny - iny - cmp #$2e - bcs @skip_slash1 - lda #'/' -@skip_slash1 + lda ProDOS_prefix, y sta (buffer), y - bcs @skip_slash2 - tya - ldy #0 - sta (buffer), y - tay -@skip_slash2 dey - dey - dex - bne @copy_prefix - ldy #1 - lda #'/' - sta (buffer), y - iny - lda #'X' - sta (buffer), y + bpl @copy_prefix rts @imp_open diff --git a/src/macros.a b/src/macros.a index cd914f3ae..5074e93fc 100644 --- a/src/macros.a +++ b/src/macros.a @@ -93,3 +93,11 @@ jsr LoadFile !word gPathname } + +!macro LOAD_PATH .subdirectory { + jsr ResetPath + +LDADDR .subdirectory + jsr AddToPath + +LDADDR kPathSeparator + jsr AddToPath +} diff --git a/winmake.bat b/winmake.bat index d6350e18e..db6e09c5d 100644 --- a/winmake.bat +++ b/winmake.bat @@ -29,16 +29,39 @@ if "%1" equ "asm" ( %ACME% -r build\4cade.lst src\4cade.a %ACME% src\fx\fx.hgr.diagonal.a -%ACME% src\fx\fx.hgr.iris.a %ACME% src\fx\fx.hgr.interlock.ud.a %ACME% src\fx\fx.hgr.interlock.lr.a %ACME% src\fx\fx.hgr.spiral.a +%ACME% src\fx\fx.hgr.fourspiral.a %ACME% src\fx\fx.hgr.fizzle.a %ACME% src\fx\fx.hgr.bar.dissolve.a %ACME% src\fx\fx.hgr.block.fizzle.a -%ACME% src\fx\fx.hgr.block.mosaic.a +%ACME% src\fx\fx.hgr.block.fizzle.white.a %ACME% src\fx\fx.hgr.2pass.lr.a %ACME% src\fx\fx.hgr.crystal.a +%ACME% src\fx\fx.hgr.foursquare.white.a +%ACME% src\fx\fx.hgr.onesquare.white.a +%ACME% src\fx\fx.hgr.diamond.a +%ACME% src\fx\fx.hgr.checkerboard.white.a +%ACME% src\fx\fx.hgr.halfblock.fizzle.a +%ACME% src\fx\fx.hgr.halfblock.fizzle.white.a +%ACME% src\fx\fx.hgr.stagger.ud.a +%ACME% src\fx\fx.hgr.stagger.ud.white.a +%ACME% src\fx\fx.hgr.stagger.lr.a +%ACME% src\fx\fx.hgr.stagger.lr.white.a +%ACME% src\fx\fx.hgr.corner.circle.a +%ACME% src\fx\fx.hgr.sunrise.a +%ACME% src\fx\fx.hgr.sunset.a +%ACME% src\fx\fx.hgr.radial.a +%ACME% src\fx\fx.hgr.radial2.a +%ACME% src\fx\fx.hgr.radial3.a +%ACME% src\fx\fx.hgr.radial4.a +%ACME% src\fx\fx.hgr.radial5.a +%ACME% src\fx\fx.hgr.split.ud.intro.a +%ACME% src\fx\fx.hgr.iris.a +%ACME% src\fx\fx.hgr.ripple.a +%ACME% src\fx\fx.hgr.ripple2.a +%ACME% src\fx\fx.hgr.star.a goto :EOF ) From 3684510a30c6fc3c989c8ac78588daa87a8430dd Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Tue, 6 Nov 2018 11:07:06 -0800 Subject: [PATCH 2/2] more efficient --- src/4cade.a | 40 ++++++++++++++++++++-------------------- src/macros.a | 8 ++++++++ 2 files changed, 28 insertions(+), 20 deletions(-) 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 +} +