From 1386613b44a356bd11e89b9a4835af8e6ee7f41d Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Tue, 12 Oct 2021 23:05:41 -0700 Subject: [PATCH] add size field to okvs --- bin/buildfx.js | 8 +++-- bin/buildhelp.js | 8 ++++- bin/buildss.js | 11 +++++-- bin/{buildssful.bat => buildssall.bat} | 1 + src/ui.credits.a | 11 +++++-- winmake.bat | 42 +++++++++----------------- 6 files changed, 45 insertions(+), 36 deletions(-) rename bin/{buildssful.bat => buildssall.bat} (71%) diff --git a/bin/buildfx.js b/bin/buildfx.js index 7a2bc186d..3c26d19a4 100644 --- a/bin/buildfx.js +++ b/bin/buildfx.js @@ -38,8 +38,12 @@ groups = "*=0\n" + "!le16 " + entries.length.toString() + ", 0\n" for (i = 0; i < entries.length; i++) { - groups += "!byte " + (1 + 1 + entries[i].length + 3).toString() + "\n" + "!byte " + entries[i].length.toString() + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + fx_off.toString() + "\n" - fx_off += a.getfile(y + entries[i]).size + groups += "!byte " + (1 + 1 + entries[i].length + 5).toString() + "\n" + "!byte " + entries[i].length.toString() + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + fx_off.toString() + "\n" + size = a.getfile(y + entries[i]).size + // if offset+size does not cross a block boundary, use the size + // otherwise adjust size until it ends at the next block boundary to avoid a partial copy on the last block + groups += "!le16 " + ((Math.floor(fx_off / 512) == Math.floor((fx_off + size) / 512)) ? size : (((fx_off + size + 511) & -512) - fx_off)).toString() + "\n" + fx_off += size } f = a.createtextfile(WScript.Arguments(1)) diff --git a/bin/buildhelp.js b/bin/buildhelp.js index 690671708..a92f65a65 100644 --- a/bin/buildhelp.js +++ b/bin/buildhelp.js @@ -38,6 +38,7 @@ y = "res\\GAMEHELP\\" f = a.createtextfile(WScript.Arguments(0)) f.write(entry = a.opentextfile(y + "STANDARD").readall().replace(/\r\n/g, "\n")) help_off = entry.length +osize = help_off groups = "*=0\n" + "!le16 " + entries.length.toString() + ", 0\n" i = 0 @@ -45,15 +46,20 @@ i = 0 while (i < entries.length) { c = 0 + size = osize if (a.fileexists(y + entries[i])) { c = help_off f.write(entry = a.opentextfile(y + entries[i]).readall().replace(/\r\n/g, "\n")) help_off += entry.length + size = entry.length } - groups += "!byte " + (1 + 1 + entries[i].length + 3).toString() + "\n" + "!byte " + entries[i].length + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + c + "\n\n" + groups += "!byte " + (1 + 1 + entries[i].length + 5).toString() + "\n" + "!byte " + entries[i].length + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + c + "\n" + // if offset+size does not cross a block boundary, use the size + // otherwise adjust size until it ends at the next block boundary to avoid a partial copy on the last block + groups += "!le16 " + ((Math.floor(c / 512) == Math.floor((c + size) / 512)) ? size : (((c + size + 511) & -512) - c)).toString() + "\n" ++i } diff --git a/bin/buildss.js b/bin/buildss.js index 9dd3b94cc..2587e1f40 100644 --- a/bin/buildss.js +++ b/bin/buildss.js @@ -7,13 +7,18 @@ for (b = new Enumerator(a.GetFolder(WScript.Arguments(0)).files); !b.atEnd(); b. entries.push(b.item().name) } -fx_off = 0 +entries.sort() +ss_off = 0 groups = "*=0\n" + "!le16 " + entries.length.toString() + ", 0\n" for (i = 0; i < entries.length; i++) { - groups += "!byte " + (1 + 1 + entries[i].length + 3).toString() + "\n" + "!byte " + entries[i].length.toString() + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + fx_off.toString() + "\n" - fx_off += a.getfile(WScript.Arguments(0) + "\\" + entries[i]).size + groups += "!byte " + (1 + 1 + entries[i].length + 5).toString() + "\n" + "!byte " + entries[i].length.toString() + "\n" + "!text \"" + entries[i] + "\"\n" + "!be24 " + ss_off.toString() + "\n" + size = a.getfile(WScript.Arguments(0) + "\\" + entries[i]).size + // if offset+size does not cross a block boundary, use the size + // otherwise adjust size until it ends at the next block boundary to avoid a partial copy on the last block + groups += "!le16 " + ((Math.floor(ss_off / 512) == Math.floor((ss_off + size) / 512)) ? size : (((ss_off + size + 511) & -512) - ss_off)).toString() + "\n" + ss_off += size } f = a.createtextfile(WScript.Arguments(1)) diff --git a/bin/buildssful.bat b/bin/buildssall.bat similarity index 71% rename from bin/buildssful.bat rename to bin/buildssall.bat index 5b3c34cd7..dfb921b4d 100644 --- a/bin/buildssful.bat +++ b/bin/buildssall.bat @@ -1,3 +1,4 @@ @echo off 1>nul copy /y nul %2 +rem requires sorted file-system for %%a in (%1\*) do 1>nul copy /b /y %2+%%a %2 diff --git a/src/ui.credits.a b/src/ui.credits.a index 97d0ce16b..288521aea 100644 --- a/src/ui.credits.a +++ b/src/ui.credits.a @@ -73,7 +73,7 @@ Help !word $8000 jsr LoadHelpOffscreen ; load fancy backdrop ldx #7 - bne - ; always branches + bne -- ; always branches ;------------------------------------------------------------------------------ ; LoadFulFile @@ -102,6 +102,12 @@ LoadFulFile sta @offset, x dex bpl - + dex +- iny + lda (zpword), y + sta @size - $fe, x + inx + bmi - jsr $bf00 ; yes, ProDOS abstraction !byte $c8 !word @c8_parms @@ -132,4 +138,5 @@ LoadFulFile @cc_parms !byte 1 @address !word $DFDF ; SMC - !word $600 +@size !word $DFDF ; SMC + !word $ffff diff --git a/winmake.bat b/winmake.bat index ca590da5c..b5687daaf 100644 --- a/winmake.bat +++ b/winmake.bat @@ -26,19 +26,12 @@ if "%1" equ "asm" ( :asm call :md call :asmlauncher -call :asmhelp call :asmfx -call :asmss call :asmprelaunch call :asmproboot goto :EOF ) -if "%1" equ "ss" ( -call :asmss -goto :EOF -) - if "%1" equ "clean" ( :clean echo y|1>nul 2>nul rd build /s @@ -55,6 +48,18 @@ call :compress %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\LAUNCHER.SYSTEM" >>build\log cscript /nologo bin\rsync.js "res\PREFS.CONF" "build\" >>build\log cscript /nologo bin\padto.js 512 build\PREFS.CONF +cscript /nologo bin\buildhelp.js "build\GAMEHELP.ALL" "build\help.inc" "build\GAMEHELP.IDX" >>build\log +cscript /nologo bin\buildokvs.js "res\ATTRACT.CONF" "build\ATTRACT.IDX" >>build\log +call bin\buildfxful.bat res\FX.CONF "build\FX.ALL" >>build\log +call bin\buildfxful.bat res\DFX.CONF "build\DFX.ALL" >>build\log +cscript /nologo bin\buildfx.js "res\FX.CONF" "build\fx.inc" "build\FX.IDX" >>build\log +cscript /nologo bin\buildfx.js "res\DFX.CONF" "build\dfx.inc" "build\DFX.IDX" >>build\log +for %%q in (res\SS\*) do cscript /nologo bin\buildokvs.js "%%q" "build\SS\%%~nxq" >>build\log +call bin\buildssall.bat build\SS build\SLIDESHOW.ALL >>build\log +cscript /nologo bin\buildss.js "build\SS" "build\ss.inc" "build\SLIDESHOW.IDX" >>build\log +for %%q in (res\ATTRACT\*) do cscript /nologo bin\buildokvs.js "%%q" "build\ATTRACT\%%~nxq" >>build\log +call bin\buildssall.bat build\ATTRACT build\MINIATTRACT.ALL>>build\log +cscript /nologo bin\buildss.js "build\ATTRACT" "build\attract.inc" "build\MINIATTRACT.IDX" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\TITLE" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\COVER" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\HELP" >>build\log @@ -66,9 +71,8 @@ cscript /nologo bin\dumpcr.js "build\CREDITS" cscript /nologo bin\rsync.js "res\HELPTEXT" "build\" >>build\log cscript /nologo bin\dumpcr.js "build\HELPTEXT" %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\HELPTEXT" >>build\log -for %%q in (build\*.DATA) do %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "%%q" >>build\log -for %%q in (build\*FUL) do %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "%%q" >>build\log -%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\ATTRACTIVE" >>build\log +for %%q in (build\*.IDX) do %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "%%q" >>build\log +for %%q in (build\*.ALL) do %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "%%q" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\DECRUNCH" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\JOYSTICK" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\Finder.Data" >>build\log @@ -129,10 +133,6 @@ for /f "tokens=*" %%q in (build\relbase.log) do set _make=%%q %ACME% -DBUILDNUMBER=%_build% -DRELBASE=$!_make:~-5,4! -r build\4cade.lst src\4cade.a goto :EOF -:asmhelp -cscript /nologo bin\buildhelp.js "build\HELPFUL" "build\help.inc" "build\HELP.DATA" >>build\log -goto :EOF - :asmfx for %%q in (src\fx\*.a) do ( for /f "tokens=* usebackq" %%k in (`find "^!to" %%q`) do set _to=%%k @@ -140,20 +140,6 @@ for %%q in (src\fx\*.a) do ( if !_to!==t %ACME% %%q ) cscript /nologo bin\buildfileinfo.js build\FX "06" "6000" -call bin\buildfxful.bat res\FX.CONF "build\FXFUL" >>build\log -call bin\buildfxful.bat res\DFX.CONF "build\DFXFUL" >>build\log -cscript /nologo bin\buildfx.js "res\FX.CONF" "build\fx.inc" "build\FX.DATA" >>build\log -cscript /nologo bin\buildfx.js "res\DFX.CONF" "build\dfx.inc" "build\DFX.DATA" >>build\log -goto :EOF - -:asmss -for %%q in (res\SS\*) do cscript /nologo bin\buildokvs.js "%%q" "build\SS\%%~nxq" >>build\log -call bin\buildssful.bat build\SS build\SSFUL >>build\log -cscript /nologo bin\buildss.js "build\SS" "build\ss.inc" "build\SS.DATA" >>build\log -for %%q in (res\ATTRACT\*) do cscript /nologo bin\buildokvs.js "%%q" "build\ATTRACT\%%~nxq" >>build\log -call bin\buildssful.bat build\ATTRACT build\ATTRACTFUL>>build\log -cscript /nologo bin\buildokvs.js "res\ATTRACT.CONF" "build\ATTRACT.DATA" >>build\log -cscript /nologo bin\buildss.js "build\ATTRACT" "build\attract.inc" "build\ATTRACTIVE" >>build\log goto :EOF :asmprelaunch