Вектор-06Ц/Сжатие данных: различия между версиями
Nzeemin (обсуждение | вклад) (Новая страница: «Собрание распаковщиков различных форматов. == ZX0 / ZX1 / ZX2 == https://github.com/ivagorRetrocomp/DeZX Быстрый…») |
Nzeemin (обсуждение | вклад) |
||
(не показаны 4 промежуточные версии этого же участника) | |||
Строка 1: | Строка 1: | ||
{{Emuverse}} | |||
(Права на описание — Emuverse, права на фрагменты кода — см. в шапке фрагмента.) | |||
Собрание распаковщиков различных форматов. | Собрание распаковщиков различных форматов. | ||
== ZX0 / ZX1 / ZX2 == | == ZX0 / ZX1 / ZX2 == | ||
https://github.com/ivagorRetrocomp/DeZX | Быстрый упаковщик в ZX0 под Windows: https://github.com/emmanuel-marty/salvador | ||
Распаковщики под Вектор: https://github.com/ivagorRetrocomp/DeZX | |||
https://github.com/ivagorRetrocomp/DeZX/blob/main/ZX0/8080/OLD_V1/dzx0_CLASSIC.asm | |||
<pre> | |||
; ----------------------------------------------------------------------------- | |||
; ZX0 8080 decoder by Ivan Gorodetsky - OLD FILE FORMAT v1 | |||
; Based on ZX0 z80 decoder by Einar Saukas | |||
; v7 (2022-04-30) - 92 bytes forward / 94 bytes backward (source address now in DE, slightly faster) | |||
; ----------------------------------------------------------------------------- | |||
; Parameters (forward): | |||
; DE: source address (compressed data) | |||
; BC: destination address (decompressing) | |||
; | |||
; Parameters (backward): | |||
; DE: last source address (compressed data) | |||
; BC: last destination address (decompressing) | |||
; ----------------------------------------------------------------------------- | |||
; compress forward with <-c> option (<-classic> for salvador) | |||
; | |||
; compress backward with <-b -c> options (<-b -classic> for salvador) | |||
; | |||
; Compile with The Telemark Assembler (TASM) 3.2 | |||
; ----------------------------------------------------------------------------- | |||
;#define BACKWARD | |||
#ifdef BACKWARD | |||
#define NEXT_HL dcx h | |||
#define NEXT_DE dcx d | |||
#define NEXT_BC dcx b | |||
#else | |||
#define NEXT_HL inx h | |||
#define NEXT_DE inx d | |||
#define NEXT_BC inx b | |||
#endif | |||
dzx0: | |||
#ifdef BACKWARD | |||
lxi h,1 | |||
push h | |||
dcr l | |||
#else | |||
lxi h,0FFFFh | |||
push h | |||
inx h | |||
#endif | |||
mvi a,080h | |||
dzx0_literals: | |||
call dzx0_elias | |||
call dzx0_ldir | |||
jc dzx0_new_offset | |||
call dzx0_elias | |||
dzx0_copy: | |||
xchg | |||
xthl | |||
push h | |||
dad b | |||
xchg | |||
call dzx0_ldir | |||
xchg | |||
pop h | |||
xthl | |||
xchg | |||
jnc dzx0_literals | |||
dzx0_new_offset: | |||
call dzx0_elias | |||
#ifdef BACKWARD | |||
inx sp | |||
inx sp | |||
dcr h | |||
rz | |||
dcr l | |||
push psw | |||
mov a,l | |||
#else | |||
mov h,a | |||
pop psw | |||
xra a | |||
sub l | |||
rz | |||
push h | |||
#endif | |||
rar\ mov h,a | |||
ldax d | |||
rar\ mov l,a | |||
NEXT_DE | |||
#ifdef BACKWARD | |||
inx h | |||
#endif | |||
xthl | |||
mov a,h | |||
lxi h,1 | |||
#ifdef BACKWARD | |||
cc dzx0_elias_backtrack | |||
#else | |||
cnc dzx0_elias_backtrack | |||
#endif | |||
inx h | |||
jmp dzx0_copy | |||
dzx0_elias: | |||
inr l | |||
dzx0_elias_loop: | |||
add a | |||
jnz dzx0_elias_skip | |||
ldax d | |||
NEXT_DE | |||
ral | |||
dzx0_elias_skip: | |||
#ifdef BACKWARD | |||
rnc | |||
#else | |||
rc | |||
#endif | |||
dzx0_elias_backtrack: | |||
dad h | |||
add a | |||
jnc dzx0_elias_loop | |||
jmp dzx0_elias | |||
dzx0_ldir: | |||
push psw | |||
dzx0_ldir1: | |||
ldax d | |||
stax b | |||
NEXT_DE | |||
NEXT_BC | |||
dcx h | |||
mov a,h | |||
ora l | |||
jnz dzx0_ldir1 | |||
pop psw | |||
add a | |||
ret | |||
.end | |||
</pre> | |||
== ZX7 mini == | == ZX7 mini == | ||
Строка 108: | Строка 246: | ||
== LZSA1 / LZSA2 == | == LZSA1 / LZSA2 == | ||
https://github.com/ivagorRetrocomp/DeLZSA/tree/main/8080 | Упаковщик под Windows: https://github.com/emmanuel-marty/lzsa | ||
Код распаковщиков под Вектор: https://github.com/ivagorRetrocomp/DeLZSA/tree/main/8080 | |||
[[Категория:Вектор-06Ц]] |
Текущая версия от 13:04, 28 сентября 2022
Этот документ создан для Emuverse и распространяется на условиях лицензии CC-BY-SA-3.0. |
(Права на описание — Emuverse, права на фрагменты кода — см. в шапке фрагмента.)
Собрание распаковщиков различных форматов.
ZX0 / ZX1 / ZX2
Быстрый упаковщик в ZX0 под Windows: https://github.com/emmanuel-marty/salvador
Распаковщики под Вектор: https://github.com/ivagorRetrocomp/DeZX
https://github.com/ivagorRetrocomp/DeZX/blob/main/ZX0/8080/OLD_V1/dzx0_CLASSIC.asm
; ----------------------------------------------------------------------------- ; ZX0 8080 decoder by Ivan Gorodetsky - OLD FILE FORMAT v1 ; Based on ZX0 z80 decoder by Einar Saukas ; v7 (2022-04-30) - 92 bytes forward / 94 bytes backward (source address now in DE, slightly faster) ; ----------------------------------------------------------------------------- ; Parameters (forward): ; DE: source address (compressed data) ; BC: destination address (decompressing) ; ; Parameters (backward): ; DE: last source address (compressed data) ; BC: last destination address (decompressing) ; ----------------------------------------------------------------------------- ; compress forward with <-c> option (<-classic> for salvador) ; ; compress backward with <-b -c> options (<-b -classic> for salvador) ; ; Compile with The Telemark Assembler (TASM) 3.2 ; ----------------------------------------------------------------------------- ;#define BACKWARD #ifdef BACKWARD #define NEXT_HL dcx h #define NEXT_DE dcx d #define NEXT_BC dcx b #else #define NEXT_HL inx h #define NEXT_DE inx d #define NEXT_BC inx b #endif dzx0: #ifdef BACKWARD lxi h,1 push h dcr l #else lxi h,0FFFFh push h inx h #endif mvi a,080h dzx0_literals: call dzx0_elias call dzx0_ldir jc dzx0_new_offset call dzx0_elias dzx0_copy: xchg xthl push h dad b xchg call dzx0_ldir xchg pop h xthl xchg jnc dzx0_literals dzx0_new_offset: call dzx0_elias #ifdef BACKWARD inx sp inx sp dcr h rz dcr l push psw mov a,l #else mov h,a pop psw xra a sub l rz push h #endif rar\ mov h,a ldax d rar\ mov l,a NEXT_DE #ifdef BACKWARD inx h #endif xthl mov a,h lxi h,1 #ifdef BACKWARD cc dzx0_elias_backtrack #else cnc dzx0_elias_backtrack #endif inx h jmp dzx0_copy dzx0_elias: inr l dzx0_elias_loop: add a jnz dzx0_elias_skip ldax d NEXT_DE ral dzx0_elias_skip: #ifdef BACKWARD rnc #else rc #endif dzx0_elias_backtrack: dad h add a jnc dzx0_elias_loop jmp dzx0_elias dzx0_ldir: push psw dzx0_ldir1: ldax d stax b NEXT_DE NEXT_BC dcx h mov a,h ora l jnz dzx0_ldir1 pop psw add a ret .end
ZX7 mini
https://github.com/svofski/bazis-bbstro/tree/master/zx7mini
ZX7
https://zx-pk.ru/threads/9532-vektor-06ts-sredstva-razrabotki.html?p=983364&viewfull=1#post983364
; ----------------------------------------------------------------------------- ; ZX7 decoder by Einar Saukas, Antonio Villena & Metalbrain ; ----------------------------------------------------------------------------- ; Parameters: ; HL: source address (compressed data) ; DE: destination address (decompressing) ; ----------------------------------------------------------------------------- ; 8080 version - Ivan Gorodetsky, 2018 ; 104 bytes - single-use ; 109 bytes - reusable dzx7_standard: ;следующие две строки не нужны при одноразовом использовании распаковщика ; mvi a,80h ; sta dzx7s_next_bit+1 dzx7s_copy_byte_loop: mov a,m stax d inx h inx d dzx7s_main_loop: call dzx7s_next_bit jnc dzx7s_copy_byte_loop ; next bit indicates either literal or sequence ; determine number of bits used for length (Elias gamma coding) push d lxi b,0 mov d,b dzx7s_len_size_loop: inr d call dzx7s_next_bit jnc dzx7s_len_size_loop ; determine length dzx7s_len_value_loop: cnc dzx7s_next_bit mov a,c\ ral\ mov c,a mov a,b\ ral\ mov b,a jc dzx7s_exit dcr d jnz dzx7s_len_value_loop inx b ; determine offset mov a,m\ stc\ ral\ mov e,a inx h jnc dzx7s_offset_end mvi d,10h dzx7s_rld_next_bit: call dzx7s_next_bit mov a,d\ ral\ mov d,a jnc dzx7s_rld_next_bit mvi a,1\ add d\ rar\ mov d,a dzx7s_offset_end: mov a,e\ rar\ mov e,a ; copy previous sequence xthl xchg mov a,e\ sbb l\ mov l,a mov a,d\ sbb h\ mov h,a push psw ldir: mov a,m stax d inx h inx d dcx b mov a,b ora c jnz ldir pop psw dzx7s_exit: pop h jnc dzx7s_main_loop dzx7s_next_bit: mvi a,80h add a sta dzx7s_next_bit+1 rnz mov a,m inx h ral sta dzx7s_next_bit+1 ret .end
UCL NRV2d
https://github.com/usr38259/nrv2d-i80
LZSA1 / LZSA2
Упаковщик под Windows: https://github.com/emmanuel-marty/lzsa
Код распаковщиков под Вектор: https://github.com/ivagorRetrocomp/DeLZSA/tree/main/8080