diff --git a/Makefile b/Makefile index 908ff1762..4c59e7ceb 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,8 @@ ACME=acme CADIUS=cadius asm: md - $(ACME) -r build/4cade.lst src/4cade.a + $(ACME) -r build/4cade.lst src/4cade.a >build/relbase.log + $(ACME) -r build/4cade.lst -DRELBASE=`cat build/relbase.log | grep "RELBASE =" | cut -d"=" -f2 | cut -d"(" -f2 | cut -d")" -f1` src/4cade.a $(ACME) src/fx/fx.dhgr.ripple.a $(ACME) src/fx/fx.dhgr.iris.a $(ACME) src/fx/fx.dhgr.radial.a diff --git a/src/4cade.a b/src/4cade.a index 5c14304ab..3e2d2ac19 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -5,6 +5,10 @@ !to "build/LAUNCHER.SYSTEM",plain *=$2000 +!ifndef RELBASE { +RELBASE=$2000 +} + !source "src/constants.a" !source "src/macros.a" @@ -12,7 +16,7 @@ !source "src/4cade.init.a" FirstMover -!pseudopc $D000 { +!pseudopc RELBASE { Reenter ; self-running demos should call this to exit back to 4cade cld cli @@ -68,6 +72,13 @@ Main !source "src/ui.font.a" !source "src/ui.font.data.a" gGlobalPrefsStore - !word *+2 ; address of first okvs store + !word $D000 ; address of first okvs store } LastMover +!if RELBASE = $2000 { + !ifdef PASS2 { + } else { ;PASS2 + !set PASS2=1 + !warn "RELBASE = ", $FE00 - (LastMover - FirstMover) + } +} diff --git a/src/4cade.init.a b/src/4cade.init.a index 30953f159..ab1220550 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -26,11 +26,10 @@ ; bit 6 = 1 if 128K ; bit 7 = 1 if joystick - jsr init ; initialize ProRWTS2 (bye bye ProDOS) - +READ_RAM1_WRITE_RAM1 + +READ_ROM_WRITE_RAM1 ldx #$00 ; relocate rest of program to RAM bank 1 in language card @FM lda FirstMover,x - sta $D000,x + sta RELBASE,x inx bne @FM lda @FM+2 @@ -40,6 +39,7 @@ inc @FM+5 bne @FM + + jsr init ; initialize ProRWTS2 (bye bye ProDOS) jmp OneTimeSetup @no64K diff --git a/src/glue.prorwts2.a b/src/glue.prorwts2.a index 0d39777b6..9d6cc1928 100644 --- a/src/glue.prorwts2.a +++ b/src/glue.prorwts2.a @@ -288,6 +288,7 @@ traverse pla sta (namlo), y + lda $c08b @go rts @@ -404,7 +405,7 @@ ProDOS_enter !ifdef PASS2 { !set CloseHandles = @imp_close } else { ;PASS2 - !set PASS2=1 +!set CloseHandles = * } stx ProDOS_savedX+1 sty ProDOS_savedY+1 diff --git a/src/prorwts2.a b/src/prorwts2.a index e1da87fd2..c7333190b 100644 --- a/src/prorwts2.a +++ b/src/prorwts2.a @@ -463,8 +463,8 @@ unrentry1 jsr $d1d1 bankram !if load_banked = 1 { - lda LCBANK2 - ((lc_bank - 1) * 8) - lda LCBANK2 - ((lc_bank - 1) * 8) + lda LCBANK2 + 2 - ((lc_bank - 1) * 8) + lda LCBANK2 + 2 - ((lc_bank - 1) * 8) } ;load_banked !if load_aux = 1 { sta SETAUXWR + (load_banked * 4) ;SETAUXWR or SETAUXZP @@ -550,15 +550,8 @@ unrdrvoff1 lda MOTOROFF ;and code is less than two pages long (e.g. aligned_read, no write) ;can't insert code during pass two because it breaks existing offsets - !ifdef PASS2 { - !if >(hddcodeend - reloc) > 0 { - !set hack=$100 - } ;hddcodeend - } else { ;PASS2 not defined - !set hack=0 - } ;PASS2 - lda unrelochdd + hack, y - sta reloc + hack, y + lda unrelochdd + $100, y + sta reloc + $100, y } ;one_page iny bne - @@ -2877,7 +2870,6 @@ hdddataend ;math magic to determine ideal loading address, and information dump !ifdef PASS2 { } else { ;PASS2 not defined - !set PASS2=1 !if enable_floppy = 1 { !if reloc < $c000 { !if ((dataend + $ff) & -256) > $c000 { diff --git a/winmake.bat b/winmake.bat index 69878efc9..0dab4e7a7 100644 --- a/winmake.bat +++ b/winmake.bat @@ -6,6 +6,7 @@ rem rem a qkumba monstrosity from 2018-10-29 rem +setlocal enabledelayedexpansion set DISK=4cade.2mg set VOLUME=A.4AM.PACK @@ -30,7 +31,9 @@ if "%1" equ "asm" ( 2>nul md build\DEMO 2>nul md build\FX -%ACME% -r build\4cade.lst src\4cade.a +2>build\out.txt %ACME% -r build\4cade.lst src\4cade.a +for /f "tokens=2,3 delims=)" %%q in ('find "RELBASE =" build\out.txt') do set _make=%%q +%ACME% -DRELBASE=$%_make:~-4% -r build\4cade.lst src\4cade.a %ACME% src\fx\fx.dhgr.ripple.a %ACME% src\fx\fx.dhgr.iris.a %ACME% src\fx\fx.dhgr.radial.a