add size field to okvs

This commit is contained in:
Peter Ferrie 2021-10-12 23:05:41 -07:00
parent c89c6fa758
commit 1386613b44
6 changed files with 45 additions and 36 deletions

View File

@ -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))

View File

@ -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
}

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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