Inaccuracy in the description of the HRIP archive header
ZXNet echo conference «code.zx»
From Ivan Roshin → To All 25 April 2003
Hello, All!
In the HRIP_DOC.WRD file supplied with HRIP 1.05
contains the following:
=== cut ===
The archive begins with the following heading:
IDARCH DB "HRi" ; identifier
IDALL DB 0 ; number of files in the archive (used in
; Hrip when adding to the archive, so as not to
; there were more than 255 files
SMESH DB 0 ; see below (BYTE)
LAST DW 0 ; see below (SECS)
CAT DB 0 ; 1 - the directory is present in the archive
; 0 - no directory
The following formula shows how the end can be determined
archive (in bytes from the beginning of the archive):
END_ARCH=[LAST]*256-(256-[SMESH]) bytes
The location of the directory, if present, can be
determined by this formula:
START_CAT=[LAST]*256 bytes
That is, the directory is located in the last sector after the archive.
As can be understood from the two formulas listed - between the end
archive and the beginning of the directory have free space <256 bytes. Here
This is where the “sharpening” under Tr-Dos comes into play. So simple
implementation is made so that everyone can open
archive with a catalog (especially since the catalog is almost similar to
Tr-Dos'ovsky).
=== cut ===
In fact, the formula for calculating END_ARCH (i.e.
archive length in bytes, excluding directory) should look like
like this:END_ARCH=[LAST]*256-(256-[SMESH]) bytes, if SMESH>0;
END_ARCH=[LAST]*256 bytes, if SMESH=0.
Or like this:
END_ARCH=[LAST-1]*256+[SMESH]) bytes, if SMESH>0;
END_ARCH=[LAST]*256 bytes, if SMESH=0.
Without branching, the formula can be written like this:
END_ARCH=[LAST]*256-((256-[SMESH]) mod 256) bytes.
Calculating END_ARCH in assembler (we get the result
in HL:A):
LD HL,(LAST)
LD A,(SMESH)
AND A
JR Z,$+3
DEC HL
The END_ARCH-1 calculation can be shorter and faster:
LD HL,(LAST)
LD A,(SMESH)
DEC HL
DEC A
Best regards, Ivan Roshchin.
From Maxim Shelepov → To Ivan Roshin 22 July 2003
Hello Ivan!
On April 25, 2003 you wrote to All:
───────═════ Beginning of the F.txt file
─ Personal letters to me (2:5002/81.8) ───────────────────── MY_MAIL (81.LOCAL) ─
Post: 50 out of 90 Rcv
From: Kirill Trofimov 2:5002/81.14 Mon 23 Jun 03 22:39
To: Maxim Shelepov Mon 23 Jun 03 22:55
Subject: hrip
─────────────────── ──────────────────── ──────────────────── ────────────────────
Copied from area 81.LOCAL by ParToss 1.06.15/W32 alpha
Greetings, Maxim!
June 21, 2003 22:56, Maxim Shelepov wrote to Kirill Trofimov:
MS> END_ARCH=[LAST]*256-(256-[SMESH]) bytes, if SMESH>0;
MS> END_ARCH=[LAST]*256 bytes, if SMESH=0.
MS> END_ARCH=[LAST-1]*256+[SMESH]) bytes, if SMESH>0;
MS> END_ARCH=[LAST]*256 bytes, if SMESH=0.
256 in byte = 0 :)
sinn'delirium tremens'freedom
-+- Violet Cancer
───────═════ End of file F.txt
..:: freedom://delirium_tremens/~tiden ::..