load decrunch on-the-fly

This commit is contained in:
Peter Ferrie 2020-03-13 19:04:03 -07:00
parent b27770246e
commit bd85b43606
11 changed files with 76 additions and 35 deletions

View File

@ -31,7 +31,7 @@ dsk: md asm compress
$(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "build/LAUNCHER.SYSTEM" >>build/log $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "build/LAUNCHER.SYSTEM" >>build/log
rsync -aP res/PREFS.CONF build/PREFS.CONF >> build/log rsync -aP res/PREFS.CONF build/PREFS.CONF >> build/log
bin/padto.sh 512 build/PREFS.CONF >>build/log bin/padto.sh 512 build/PREFS.CONF >>build/log
for f in res/TITLE res/COVER res/HELP res/GAMES.CONF res/ATTRACT.CONF res/FX.CONF res/DFX.CONF build/PREFS.CONF res/CREDITS res/HELPTEXT; do $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "$$f" >>build/log; done for f in res/TITLE res/COVER res/HELP res/GAMES.CONF res/ATTRACT.CONF res/FX.CONF res/DFX.CONF build/PREFS.CONF res/CREDITS res/HELPTEXT res/DECRUNCH; do $(CADIUS) ADDFILE build/"$(DISK)" "/$(VOLUME)/" "$$f" >>build/log; done
bin/buildfileinfo.sh res/TITLE.HGR "06" "4000" >>build/log bin/buildfileinfo.sh res/TITLE.HGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000" >>build/log bin/buildfileinfo.sh res/TITLE.DHGR "06" "4000" >>build/log
bin/buildfileinfo.sh res/ACTION.HGR "06" "3FF8" >>build/log bin/buildfileinfo.sh res/ACTION.HGR "06" "3FF8" >>build/log

BIN
res/DECRUNCH Normal file

Binary file not shown.

View File

@ -9,3 +9,4 @@ TITLE=Type(06),AuxType(2000),Access(C3)
HELP=Type(06),AuxType(2000),Access(C3) HELP=Type(06),AuxType(2000),Access(C3)
CREDITS=Type(04),AuxType(8000),Access(C3) CREDITS=Type(04),AuxType(8000),Access(C3)
HELPTEXT=Type(04),AuxType(8000),Access(C3) HELPTEXT=Type(04),AuxType(8000),Access(C3)
DECRUNCH=Type(06),AuxType(0200),Access(C3)

View File

@ -110,8 +110,6 @@ ResetVector ; 6 bytes, copied to $100
!source "src/glue.prorwts2.a" !source "src/glue.prorwts2.a"
!source "src/ui.common.a" !source "src/ui.common.a"
!source "src/exodecrunch.a"
; add new files above here so ui.wait stays last ; add new files above here so ui.wait stays last
!source "src/ui.attract.dhgr.a" ; \-- execution falls through !source "src/ui.attract.dhgr.a" ; \-- execution falls through

View File

@ -9,7 +9,7 @@
; D000..E8A7 - persistent data structures (per-game cheat categories, ; D000..E8A7 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore) ; gGlobalPrefsStore, gGamesListStore)
; ...unused... ; ...unused...
; EA96..FFF9 - main program code ; EB91..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors ; FFFA..FFFF - NMI, reset, IRQ vectors
; ;
; LC RAM BANK 2 ; LC RAM BANK 2

View File

@ -1,6 +1,9 @@
; This source code is altered and is not the original version found on ; This source code is altered and is not the original version found on
; the Exomizer homepage. ; the Exomizer homepage.
; It contains modifications made by qkumba to work with ACME assembler. ; It contains modifications made by qkumba to work with ACME assembler.
!cpu 6502
!to "DECRUNCH",plain
*=$200
; ;
; Copyright (c) 2002 - 2018 Magnus Lind. ; Copyright (c) 2002 - 2018 Magnus Lind.
@ -118,25 +121,8 @@ skip:
!MACRO mac_get_bits { !MACRO mac_get_bits {
jsr get_bits jsr get_bits
} }
get_bits:
adc #$80 ; needs c=0, affects v
asl
bpl gb_skip
gb_next:
asl zp_bitbuf
bne gb_ok
+mac_refill_bits
gb_ok:
rol
bmi gb_next
gb_skip:
bvs gb_get_hi
rts
gb_get_hi:
sec
sta zp_bits_hi
jmp get_crunched_byte
} }
; ------------------------------------------------------------------- ; -------------------------------------------------------------------
; no code below this comment has to be modified in order to generate ; no code below this comment has to be modified in order to generate
; a working decruncher of this source file. ; a working decruncher of this source file.
@ -390,6 +376,26 @@ tabl_bit:
; end of decruncher ; end of decruncher
; ------------------------------------------------------------------- ; -------------------------------------------------------------------
!IFNDEF INLINE_GET_BITS {
get_bits:
adc #$80 ; needs c=0, affects v
asl
bpl gb_skip
gb_next:
asl zp_bitbuf
bne gb_ok
+mac_refill_bits
gb_ok:
rol
bmi gb_next
gb_skip:
bvs gb_get_hi
rts
gb_get_hi:
sec
sta zp_bits_hi
; fall through
}
get_crunched_byte: get_crunched_byte:
lda _byte_lo lda _byte_lo
bne _byte_skip_hi bne _byte_skip_hi
@ -406,7 +412,27 @@ _byte_hi = * + 2
; this 156 (204) byte table area may be relocated. It may also be ; this 156 (204) byte table area may be relocated. It may also be
; clobbered by other data between decrunches. ; clobbered by other data between decrunches.
; ------------------------------------------------------------------- ; -------------------------------------------------------------------
decrunch_table=$200;;: decrunch_table:
!warn "entry=",*
pla
tay
pla
tax
clc
pla
adc #$F8
sta _byte_lo
pla
sta zp_bitbuf
pla
adc zp_bitbuf
sta _byte_hi
txa
pha
tya
pha
jmp decrunch
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

View File

@ -149,3 +149,7 @@ kGRFizzleFile
kSFXFizzleFile kSFXFizzleFile
!byte 10 !byte 10
!raw "SHR.FIZZLE" !raw "SHR.FIZZLE"
kDecrunchFile
!byte 8
!raw "DECRUNCH"

View File

@ -315,11 +315,9 @@ RedrawForDHGR
; $00A7..$00A8 clobbered by decompressor ; $00A7..$00A8 clobbered by decompressor
; $00AE..$00AF clobbered by decompressor ; $00AE..$00AF clobbered by decompressor
; $00FC..$00FF clobbered by decompressor ; $00FC..$00FF clobbered by decompressor
; $0200..$02CB clobbered by decompressor ; $0200..$03CB clobbered by decompressor
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
DecompressDHGR DecompressDHGR
sta $C003
sta $C005
jsr DecompressHGR jsr DecompressHGR
sta $C004 sta $C004
lda #$60 lda #$60

View File

@ -170,7 +170,7 @@ HGRActionCallback
; $00A7..$00A8 clobbered by decompressor ; $00A7..$00A8 clobbered by decompressor
; $00AE..$00AF clobbered by decompressor ; $00AE..$00AF clobbered by decompressor
; $00FC..$00FF clobbered by decompressor ; $00FC..$00FF clobbered by decompressor
; $0200..$02CB clobbered by decompressor ; $0200..$03CB clobbered by decompressor
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
DecompressHGR DecompressHGR
lda #$3F lda #$3F
@ -179,12 +179,25 @@ DecompressCommon
pha pha
jsr SwitchToBank2 jsr SwitchToBank2
jsr EnableAccelerator jsr EnableAccelerator
clc lda sizehi2
pha
lda sizelo2 lda sizelo2
adc #$F8 pha
sta _byte_lo lda #>(@loaddecrunch - 1)
pla pha
adc sizehi2 lda #<(@loaddecrunch - 1)
sta _byte_hi pha
jsr decrunch lda auxreq
bne +
jmp LoadFile ; load decompression code to $200
+ jmp LoadAuxFile ; load decompression code to $200/aux
@loaddecrunch
!word kRootDirectory
!word kDecrunchFile
!word $200
ldx auxreq
sta $C002,x
sta $C004,x
jsr $314 ; decrunch entry
jsr SwitchToBank2
jmp DisableAcceleratorAndSwitchToBank1 jmp DisableAcceleratorAndSwitchToBank1

View File

@ -151,7 +151,7 @@ BlankSHR
; $00A7..$00A8 clobbered by decompressor ; $00A7..$00A8 clobbered by decompressor
; $00AE..$00AF clobbered by decompressor ; $00AE..$00AF clobbered by decompressor
; $00FC..$00FF clobbered by decompressor ; $00FC..$00FF clobbered by decompressor
; $0200..$02CB clobbered by decompressor ; $0200..$03CB clobbered by decompressor
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
DecompressSHR DecompressSHR
lda #$1F lda #$1F

View File

@ -56,6 +56,7 @@ for %%q in (res\*.CONF) do if "%%q" neq "res\PREFS.CONF" %CADIUS% ADDFILE "build
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\PREFS.CONF" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\PREFS.CONF" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\CREDITS" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\CREDITS" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\HELPTEXT" >>build\log %CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "build\HELPTEXT" >>build\log
%CADIUS% ADDFILE "build\%DISK%" "/%VOLUME%/" "res\DECRUNCH" >>build\log
%CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/TITLE.HGR" "res\TITLE.HGR" >>build\log %CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/TITLE.HGR" "res\TITLE.HGR" >>build\log
%CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/TITLE.DHGR" "res\TITLE.DHGR" >>build\log %CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/TITLE.DHGR" "res\TITLE.DHGR" >>build\log
%CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/ACTION.HGR" "res\ACTION.HGR" >>build\log %CADIUS% ADDFOLDER "build\%DISK%" "/%VOLUME%/ACTION.HGR" "res\ACTION.HGR" >>build\log