hmm.
ZXNet echo conference «code.zx»
From Mihail Zharov → To All 1 January 1998
Greetings, All!
=== Begin file DEHRUST@.C ===
;Unpacker of files packed using the
;Hrust1: (programs Hrust1.0, Hrust1.1)
;
;Does not use the SP register, so
;packing can be carried out even when the
;nomal interruptions. Length #121(289) bytes.
; !!!Unmovable!!!
;
;You can use “standard”, re-
;placeable decompressor 256 bytes long.
;However, it uses the SP register.
;
;file format:
;+0(2):"HR" - sign of belonging
;+2(2) - length of the source file
;+4(2) - length of the packed file
;
;To unpack the file, you need to set it to:
;HL - where to unpack
;DE - where to unpack
;and call the depacker (CALL DEHRUST).
;Areas from/where to unpack can
;to intersect, the depacker takes this into account.
;If these areas do not intersect, then
;you can unpack the file several times.
;The depacker no longer uses any
;areas (excluding 6 bytes on the stack).
;
;Example:
;1) LD HL,#8000:LD DE,#8000:CALL DEHRUST
;2) LD HL,#C000:LD DE,#8000:CALL DEHRUST
;
; Any questions?
;
;**************************************
;* E-mail: dp@fmf.gasu.gorny.ru *
;* tel:(38822) 244-21. Dmitry. *
;* Russia. Gorno-Altaisk. *
;* 03/01/97 - 12/28/98 *
;**************************************
DEHRUST PUSH DE
PUSH HL
INC HL
INC HL
LD C,(HL)
INC HL
LD B,(HL)
INC HL DEC BC
EX DE,HL
ADD HL,BC
EX DE,HL
LD C,(HL)
INC HL
LD B,(HL)
DEC BC
POP HL
ADD HL,BC
SBC HL,DE
ADD HL,DE
JR C,LL4019
LD D,H
LD E,L
LL4019 LDDR
EX DE,HL
POP DE
LD C,#0C
ADD HL,BC
PUSH HL
POP IX
LD A,#03
LL4025 DEC HL
LD B,(HL)
DEC HL
LD C,(HL)
PUSH BC
DEC A
JR NZ,LL4025
LD B,A
EXX
LD D,#BF
LD C,#10
CALL LL4115
LL4036 LD A,(IX+#00)
INC IX
EXX
LL403C LD (DE),A
INC DE
LL403E EXX
LL403F ADD HL,HL
DJNZ LL4045
CALL LL4115
LL4045 JR C,LL4036
LD E,#01
LL4049 LD A,#80
LL404B ADD HL,HL
DJNZ LL4051
CALL LL4115
LL4051 RLA
JR C,LL404B
CP #03
JR C,LL405D
ADD A,E
LD E,A
XOR C
JR NZ,LL4049
LL405D ADD A,E
CP #04
JR Z,LL40C4
ADC A,#FF
CP #02
EXX
LL4067 LD C,A
LL4068 EXX
LD A,#BF
JR C,LL4082
LL406D ADD HL,HL
DJNZ LL4073
CALL LL4115
LL4073 RLA
JR C,LL406D
JR Z,LL407D
INC A
ADD A,D
JR NC,LL4084
SUB D
LL407D INC A
JR NZ,LL408D
LD A,#EF
LL4082 RRCA
CP A
LL4084 ADD HL,HL
DJNZ LL408A
CALL LL4115
LL408A RLA
JR C,LL4084
LL408D EXX
LD H,#FF
JR Z,LL409B
LD H,A
INC A
LD A,(IX+#00)
INC IX
JR Z,LL40A6
LL409B LD L,A
ADD HL,DE
LDIR
LL409F JR LL403E
LL40A1 EXX
RRC D
JR LL403F
LL40A6 CP #E0
JR C,LL409B
RLCA
XOR C
INC A
JR Z,LL40A1
SUB #10
LL40B1 LD L,A
LD C,A
LD H,#FF
ADD HL,DE
LDI
LD A,(IX+#00)
INC IX
LD (DE),A
INC HL
INC DE
LD A,(HL)
JP LL403C
LL40C4 LD A,#80
LL40C6 ADD HL,HL
DJNZ LL40CC
CALL LL4115
LL40CC ADC A,A
JR NZ,LL40F3
JR C,LL40C6
LD A,#FC
JR LL40F6
LL40D5 LD B,A
LD C,(IX+#00)
INC IX
CCF
JR LL4068
LL40DE CP #0F
JR C,LL40D5
JR NZ,LL4067
LD B,#03
EX DE,HL
LL40E7 POP DE
LD (HL),E
INC HL
LD (HL),D
INC HL
DJNZ LL40E7
LD HL,#2758
EXX
RET
LL40F3 SBC A,A
LD A,#EF
LL40F6 ADD HL,HL
DJNZ LL40FC
CALL LL4115
LL40FC RLA
JR C,LL40F6
EXX
JR NZ,LL40B1
BIT 7,A
JR Z,LL40DE
SUB #EA
ADD A,A
LD B,A
LL410A LD A,(IX+#00)
INC IX
LD(DE),A
INC DE
DJNZ LL410A
JR LL409F
LL4115 LD B,C
LD L,(IX+#00)
INC IX
LD H,(IX+#00)
INC IX
RET
LCODE EQU $-DEHRUST
=== End file DEHRUST@.C ===
Also, just in case:
=== Cut ===
In version 1.0 of the packager of this program,
we found 2 errors!
1. If the bytes are written at the end of the file:
ABCXXXXX, and in the last 88 bytes of the file
there is a byte sequence: AXC, where X
- any byte, then when unpacking the file can-
may be 1 byte longer and the last
5 bytes may be incorrect.
2. In 128 kb mode. files longer than
#3000 bytes are packed incorrectly and HRUST
reset if one of the file parts
length #2000, compressed to #100 or less
bytes. (For example, in a file 16kb long in a row
there are 8kb of zeros).
=== Cut ===
In general, v1.0 did not communicate well with a bunch of zeros.
HRUST v1.1 itself?
Happily. Michael.