mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-06 16:29:33 +00:00
chiptune: lz4 decode
doesn't work :( problem seems to be in lz4 code
This commit is contained in:
parent
345efc18bb
commit
e0946b1bdf
|
@ -3,8 +3,11 @@
|
||||||
|
|
||||||
; FIXME: make these a parameter
|
; FIXME: make these a parameter
|
||||||
; filename
|
; filename
|
||||||
disk_buff EQU $6000
|
;disk_buff EQU $6000
|
||||||
read_size EQU $2A00 ; (3*256*14)
|
;read_size EQU $2A00 ; (3*256*14)
|
||||||
|
|
||||||
|
disk_buff EQU $4000
|
||||||
|
read_size EQU $1000 ; 4kB
|
||||||
|
|
||||||
;; For the disk-read code
|
;; For the disk-read code
|
||||||
;RWTSL EQU $F0
|
;RWTSL EQU $F0
|
||||||
|
@ -240,8 +243,8 @@ dos33_read:
|
||||||
|
|
||||||
filename:
|
filename:
|
||||||
; OUT.0
|
; OUT.0
|
||||||
.byte 'O'+$80,'U'+$80,'T'+$80,'.'+$80,'0'+$80
|
.byte 'O'+$80,'U'+$80,'T'+$80,'.'+$80,'L'+$80
|
||||||
.byte $A0,$A0,$A0,$A0,$A0
|
.byte 'Z'+$80,'4'+$80,$A0,$A0,$A0
|
||||||
.byte $A0,$A0,$A0,$A0,$A0
|
.byte $A0,$A0,$A0,$A0,$A0
|
||||||
.byte $A0,$A0,$A0,$A0,$A0
|
.byte $A0,$A0,$A0,$A0,$A0
|
||||||
.byte $A0,$A0,$A0,$A0,$A0
|
.byte $A0,$A0,$A0,$A0,$A0
|
||||||
|
|
|
@ -17,16 +17,17 @@ A4L EQU $42
|
||||||
A4H EQU $43
|
A4H EQU $43
|
||||||
|
|
||||||
size EQU 794
|
size EQU 794
|
||||||
orgoff EQU $8000 ; offset of first unpacked byte
|
orgoff EQU $6000 ; offset of first unpacked byte
|
||||||
paksize EQU size-$b-8 ; minus 4 for checksum at end
|
paksize EQU size-$b-8
|
||||||
|
; size of packed data
|
||||||
|
; minus 4 for checksum at end
|
||||||
; not sure what other 4 is from?
|
; not sure what other 4 is from?
|
||||||
; block checksum? though had that disabled?
|
; block checksum? though had that disabled?
|
||||||
|
|
||||||
; size of packed data
|
pakoff EQU $400b ; 11 byte offset to data?
|
||||||
pakoff EQU $200b ; 11 byte offset to data?
|
|
||||||
|
|
||||||
|
|
||||||
lz4_unpack:
|
lz4_decode:
|
||||||
lda #<pakoff ; packed data offset
|
lda #<pakoff ; packed data offset
|
||||||
sta src
|
sta src
|
||||||
lda #<(pakoff+paksize) ; packed data size
|
lda #<(pakoff+paksize) ; packed data size
|
||||||
|
|
|
@ -203,6 +203,9 @@ interrupt_handler:
|
||||||
|
|
||||||
bit $C404 ; can clear 6522 interrupt by reading T1C-L
|
bit $C404 ; can clear 6522 interrupt by reading T1C-L
|
||||||
|
|
||||||
|
;=====================
|
||||||
|
; Update time counter
|
||||||
|
;=====================
|
||||||
|
|
||||||
inc FRAME_COUNT
|
inc FRAME_COUNT
|
||||||
lda FRAME_COUNT
|
lda FRAME_COUNT
|
||||||
|
@ -320,6 +323,8 @@ new_song:
|
||||||
|
|
||||||
jsr read_file
|
jsr read_file
|
||||||
|
|
||||||
|
jsr lz4_decode
|
||||||
|
|
||||||
lda #>CHUNK_BUFFER
|
lda #>CHUNK_BUFFER
|
||||||
sta INH
|
sta INH
|
||||||
lda #<CHUNK_BUFFER
|
lda #<CHUNK_BUFFER
|
||||||
|
@ -400,6 +405,7 @@ bloop3:
|
||||||
jsr print_both_pages
|
jsr print_both_pages
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;=========
|
;=========
|
||||||
;routines
|
;routines
|
||||||
;=========
|
;=========
|
||||||
|
|
|
@ -83,8 +83,8 @@ docopy_label:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define ORGOFFSET 0x6000
|
||||||
|
#define PAKOFFSET 0x4000
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
@ -111,7 +111,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
fclose(fff);
|
fclose(fff);
|
||||||
|
|
||||||
memcpy(&ram[0x2000],input,size);
|
memcpy(&ram[PAKOFFSET],input,size);
|
||||||
|
|
||||||
//LZ4 data decompressor for Apple II
|
//LZ4 data decompressor for Apple II
|
||||||
//Peter Ferrie (peter.ferrie@gmail.com)
|
//Peter Ferrie (peter.ferrie@gmail.com)
|
||||||
|
@ -121,14 +121,14 @@ int main(int argc, char **argv) {
|
||||||
//hipak = 0 ;packed data entirely in high memory (requires hiunp)
|
//hipak = 0 ;packed data entirely in high memory (requires hiunp)
|
||||||
|
|
||||||
//oep = 0; //first unpacked byte to run, you must set this by yourself
|
//oep = 0; //first unpacked byte to run, you must set this by yourself
|
||||||
orgoff = 0x8000; //offset of first unpacked byte, you must set this by yourself
|
orgoff = ORGOFFSET; //offset of first unpacked byte, you must set this by yourself
|
||||||
paksize = size-0xb-8;
|
paksize = size-0xb-8;
|
||||||
// minus 4 for checksum at end
|
// minus 4 for checksum at end
|
||||||
// not sure what other 4 is from?
|
// not sure what other 4 is from?
|
||||||
// block checksum? though had that disabled?
|
// block checksum? though had that disabled?
|
||||||
|
|
||||||
//size of packed data, you must set this by yourself if hiunp=0
|
//size of packed data, you must set this by yourself if hiunp=0
|
||||||
pakoff = 0x200b; // 11 byte offset to data?
|
pakoff = PAKOFFSET+11; // 11 byte offset to data?
|
||||||
|
|
||||||
|
|
||||||
//LCBANK2 = $c083
|
//LCBANK2 = $c083
|
||||||
|
@ -236,12 +236,12 @@ done:
|
||||||
|
|
||||||
|
|
||||||
int out_size=(ram[dst+1]<<8)+ram[dst];
|
int out_size=(ram[dst+1]<<8)+ram[dst];
|
||||||
out_size-=0x8000;
|
out_size-=ORGOFFSET;
|
||||||
|
|
||||||
printf("dest addr : %02X%02X\n",ram[dst+1],ram[dst]);
|
printf("dest addr : %02X%02X\n",ram[dst+1],ram[dst]);
|
||||||
|
|
||||||
int i,j,addr,temp;
|
int i,j,addr,temp;
|
||||||
addr=0x8000;
|
addr=ORGOFFSET;
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
for(i=0;i<256;i++) {
|
for(i=0;i<256;i++) {
|
||||||
|
@ -268,7 +268,7 @@ done:
|
||||||
|
|
||||||
printf("Out size=%d\n",out_size);
|
printf("Out size=%d\n",out_size);
|
||||||
|
|
||||||
fwrite(&ram[0x8000],1,out_size,fff);
|
fwrite(&ram[ORGOFFSET],1,out_size,fff);
|
||||||
|
|
||||||
fclose(fff);
|
fclose(fff);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user