                       Quick Packer v1.00
               (C)2026 Andrey Bogdanovich/Spectre
                          www.zxby.org


    Quick  Packer  (QP  from  here  on) packs files into ZX0 and
unpacks ZX0, Hrust 1 and Hrust 2 on the ZX Spectrum 128K itself,
from  tape  or from an SD card under esxDOS. Its packer is Quick
Commander's  (the  P command): the streams are of Einar Saukas's
ZX0,  in its standard format (zx0 v2), a few percent longer than
those of his zx0 on a PC.

    :: What it needs

    A 128K Spectrum: the Spectrum 128, +2, +2A or +3, a Pentagon
or  a  Scorpion.  On  a  48K,  or  a  128K  in 48K mode, QP says
"Quick Packer needs a 128K Spectrum."  and  goes  back to BASIC.
Else  it  takes  all the memory and doesn't go back to BASIC: to
leave it, reset the machine.

    For  files on an SD card: a DivMMC with esxDOS (checked with
esxDOS 0.8.9).

    :: Starting

    QP  comes  as  the  tape  file  QP_1_00.TAP:  a BASIC loader
"QPacker"  and the code. From tape it loads with LOAD "" (or the
128's  Tape  Loader);  under esxDOS copy it onto the SD card and
choose  it  in  the  browser.  Under  esxDOS QP starts in the SD
card's  list  (T goes to the tape's screen and back), without it
in the tape's screen.

    :: The tape

    The  tape's  screen  shows  the file loaded (its name, type,
start or line, length), the packing's progress and the keys:

  - L: load the next file on the tape, whatever its name: start
    the tape (Space stops). Files of 1 to 40960 bytes.
  - P: pack the file. "Read" and "Packed" show how far it has
    gone; A stops. The file becomes the stream: Bytes of its
    length, the name with ".z" (its first 8 characters kept),
    the start kept for Bytes, else 32768 (a Program becomes
    Bytes).
  - U: unpack the file: a ZX0 stream or a Hrust 1 or Hrust 2
    block, ".z" taken off its name. The data of up to 40960
    bytes, else the file is kept.
  - S: save the file: start recording, then press a key.

    QP  loads  and saves through the ROM's own tape routines, so
esxDOS's  .tapein and .tapeout (a TAP file on the SD card as the
tape), the Next's tape and the emulators' tape traps all work as
a real tape does.

    If  the  packing  is stopped, or the stream comes out longer
than  40960  bytes,  the  file  is  kept while the stream hasn't
reached  it  ("Stopped.");  else  it  is  gone,  and QP says so:
"Stopped: the file is gone, load it again."

    :: The SD card

    The  current  folder in two columns: folders with "/", files
with their length (64K or more: "64K+"); hidden and system files
and names longer than 8.3 aren't shown. The cursor keys or 6, 7,
8, 9 move the cursor, Enter opens a folder ("../" goes back up).

  - P: pack the file under the cursor into NAME.ZX0 beside it (a
    .ZX0 file isn't packed again).
  - U: unpack it into NAME.BIN.
  - T: the tape's screen.

    Files  and  results of up to 65280 bytes. The file itself is
never changed. If the folder has a file of the result's name, QP
asks  whether  to  write  over  it  (Y:  yes;  N  or  Edit: no):
"GAME.ZX0 is there: overwrite it?"

    QP  packs  a  file  in place: the stream is written over the
file  it  reads.  So a file near 64K packs only if its beginning
does:  one  with  20K  or  more  that  doesn't pack at its start
(packed  data,  a  compressed picture) wouldn't get much shorter
anyway, and QP refuses it: "Can't pack it in place: not saved."

    :: Speed

    At  3.5  MHz  QP packs a screen in about 3.5 seconds, 16K of
code  in  about 10 seconds, 40K of text in about 1.5 minutes and
64K of text in about 2.5 minutes. Unpacking takes seconds.

    :: Unpacking in your programs

    QP's  streams  are  ZX0's  standard format. Unpack them with
Einar  Saukas's  depackers: dzx0_standard.asm (68 bytes), or the
faster dzx0_turbo.asm and dzx0_mega.asm, at

              https://github.com/einar-saukas/ZX0

    :: Thanks

    Hrust  1 and Hrust 2: Dmitry Pyankov (Hrumer). The idea of a
tape  version:  Art  on Spectrum Computing, after Hrust 2's tape
version.  ZX0  and  its  depacker dzx0, which QP's U uses: Einar
Saukas, under the BSD 3-clause licence (at the address above).

          Andrey Bogdanovich/Spectre, spectre@zxby.org
