                 ░            ░▓▄▄▄▄▄
▄             ▓  ▓▀ ▀▀▀▓▄▄▄▄▄  ▀▓█▄ ▀▀▀████▓▄▄▄▄              ▓
██▓██▄▄▄     ▓░        ░    ▀▀▀▀▒▀█▓▄       ▀▀▀▀██▓██▄▄▄     ▓░
  ░▀▀▀▓███▓▄█▒                  ░  ▒   ▀░         ░▀▀▀▓███▓▄█▒
      ░  ▀▀█ ░                     ░                  ░  ▀▀█ ░


                     Quick Commander v3.20
                         For developers


    This text is for those who write programs that work together
with  QC,  or  check  QC  on their machine: what QC needs of the
computer; which configurations beyond a ZX Spectrum 128K with an
AY  and  TR-DOS  5.04T it supports, through which ports and how;
where  QC's settings lie in its file; how the resident works and
how  a  program  goes  back  to QC; how QC works with TR-DOS and
which  file  formats  it  knows.  The  user's manual is the file
guide_en.txt. All the numbers are of QC 3.20's release build.


    :: What QC needs

    A  Z80  and  IM  1  interrupts  (QC sets I = #3F) 50 times a
second:  the player and the waits for keys run on them. While QC
runs, the BASIC 48 ROM is in (bit 4 of the port #7FFD always 1):
QC  calls  its routines PO_MSG (#0C0A), MAIN_4 (#1303), STMT_RET
(#1B76),  BREAK_KEY  (#1F54),  CLEAR_1  (#1EB7),  and  #22B0 and
#30A9.  QC  takes  the keys from LAST_K (#5C08), which the ROM's
interrupt routine fills; QC puts the mouse's clicks there too.

    The  TR-DOS  ROM is 5.03 or later: the addresses QC uses are
the  same in 5.03, 5.04, 5.04T, 5.04S, 5.5H, 6.07+, 6.10E, 6.11E
and the SMUC ROMs; 5.01 has others. The drives have 80 cylinders
and  two  sides: QC counts a track as cylinder*2+side and writes
the disk type #16 into the catalogue. The catalogue's copy is on
track  161  by  default  (cylinder  80), so the drive must reach
cylinder 80.

    The memory while QC runs:

        #5B00-#5B7F  the page table (2 bytes a page)
        #5B80, #5B90 a name being typed, the mask
        #5B98        the code that starts a program
        #5C00-#5D3A  the system variables
        #5D3B-#5E51  the BASIC loader with the settings
        #5FE8        the stack (growing down)
        #6000-#AD7E  QC's code
        #AD7F-#ADFF  the files' marks
        #AE00-#B6FF  the working disk's catalogue (at the start:
                     QC's set-up and the memory test, run once)
        #B700-#BFFF  the catalogue of the disk copied to
        #C000-#FFFF  the pages' window: the buffer, the viewers

    The  code  page  is  #D7 (the value of the port #7FFD): from
#C000  the launcher and QC's code packed with ZX0, from #FD45 to
#FF97  the  copy  of  the  system variables and the BASIC loader
taken  at  the  load, from #FFF0 the mark "Residentpresent!". QC
never switches pages 2 and 5; the others (but the code page, see
below) are the buffer of Copy and Move, 64 sectors a page.


    :: The disk: the VG93 directly

    The  Beta  Disk's  ports answer only while the TR-DOS ROM is
in:  it comes in when an instruction is fetched from #3D00-#3DFF
and goes out on a fetch from the RAM. So QC writes and reads the
controller's  ports  with  pieces of the ROM's own code: it puts
their  addresses  on  the stack and enters the ROM through #3D2F
(NOP; RET there), often as a chain of several pieces. The ports:
#1F  the  command and the status, #3F the track, #5F the sector,
#7F  the data, #FF the system register (read: bit 7 INTRQ, bit 6
DRQ).

    QC  writes  #2C  plus  the  drive  (bits  0-1) to the system
register:  bit  2  =  1  no  reset,  bit 3 = 1 HLT, bit 5 = 1 as
TR-DOS,  bit  6 = 0 MFM; bit 4 = 1 (#3C) selects the first side,
TR-DOS's  even tracks. The commands: #08 to cylinder 0, #18 seek
(6  ms  steps,  no verify), #80 and #A0 read and write a sector,
#C0  read  an  address,  #F0  write  a  track, #D0 interrupt the
command.

    The addresses of the TR-DOS ROM QC uses:

        #3D2F - the way into the ROM (NOP; RET);
        #3D13 - function 5, read sectors: loading QC and a code
                file before its start;
        #2A53 - OUT (C),A; RET: the VG93's registers, ATM2;
        #3EF5 - wait for the command's end;
        #3FE5, #3FCA - read (INI) and write (OUTI) the data;
        #2740 - the status and the seek;
        #2090, #2093, #2099 - read and write a sector;
        #294A, #2920, #2970 - load a BASIC program;
        #0048 - the exit to TR-DOS (the key T);
        #3FF0, #3FF3 - OUT and IN for the SMUC clock.

    The  speed  (CONFDRV, see "The settings in QC's file"): each
drive  has  its bits of fast reading and writing; slow waits one
frame  more (EI; HALT) after each seek. Besides, the first write
after  a  reset or a seek to track 0 waits about 0.3 s unless QC
saw the disk turning.

    QC  loads  its own code with the function #3D13 (as made for
QC  4.00),  so it loads wherever TR-DOS works, from its RAM disk
too.  Till 3.20 the default was the fast loader Ursula 2.4 (Nick
Patlaenko):  0.4 s faster, but it drove the VG93's ports itself,
checked  no  errors  and  didn't work in emulators without those
ports.

    Disk  errors: after 4 failed tries QC shows the menu Retry /
Abort  /  Ignore  /  Skip; between the tries it reads an address
(#C0)  to set the track register right, or seeks cylinder 0. The
right  mouse button held for 5 frames during a disk operation is
Break.

    Formatting:  tracks 159 down to 0, the sectors 1..16 of each
in  order  (no  interleave:  that  is why a disk formatted by QC
reads faster), the side in the IDs 0, the sector size 256 bytes;
each  track  is  read  back  after  it  is written. Restore disk
formats  every  track  the  same way anew and writes its sectors
back, Check disk only the tracks with errors.

    QC  doesn't  see TR-DOS 6.1xE's RAM disk: it is reached only
through #3D13, and QC works with the VG93 directly.


    :: The extended memory

    QC finds the memory at every start, with the interrupts off.
First  it  checks  for 128K: it switches page 1 in (#7FFD = #11)
and  looks whether page 0 (#10) has changed. If not, it is a 48K
(or  #7FFD  is  locked:  QC  run  in  48K),  and  QC  tries only
ZX-Evolution's  port #F7F7: there the clock must leave its #EFF7
as  it  is  (see  Gluk's clock). Otherwise it tries the ports in
order, and the first one that answers tells the machine:

        port   machine                the page bits
        #F7F7  ZX-Evolution           3-7, inverted
        #FFF7  ATM Turbo 2+           3-5, inverted
        #AFF7  Pentagon 4096          0, 1
        #1FFD  Scorpion, KAY          4, 6, 7
        #DFFD  Profi                  0-2
        #FDFD  ATM1                   0-2
        #7FFD  Pentagon 1024          5 (with Caps shift)
        #7FFD  128K, Pentagon 512     0-2, 6, 7

    The ATM ports go first, with bits 0-2 of #7FFD (bits 6 and 7
choose  no  page there). ZX-Evolution answers both, but only its
x7F7  port (#F7F7: the page number's 8 bits, bits 0-2 still from
#7FFD)  pages  all its 4M; if #F7F7 finds no more than 1024K, it
is an ATM. Pentagon 4096 (#AFF7: "Pentagon 4M" in QC since 3.04,
and   ALASM   4.46   has   its  driver)  is  tried  after  them:
ZX-Evolution's BaseConf takes #AFF7 for its #EFF7 (any port with
A12  = 0, A8 = 1 and the low byte #F7, out of TR-DOS), where a 0
switches  on  its Pentagon 1024 mode and the turbo, in which its
ATM  ports  page  nothing: QC 3.11, trying #AFF7 first, saw 512K
there.  Scorpion  GMX  (#DFFD  with  bit  4  of  #1FFD)  and the
Pentagon-4096  on  GitHub  (#7FFD, #1FFD and #DFFD as it is set)
aren't supported.

    QC  counts  the pages so: for each combination of the ports'
values it keeps the byte at #C000, clears it and takes the pages
where  the  byte  stayed  zero  (a non-zero one is the same page
under  another  number); then all the bytes are put back, so the
memory's  contents,  a  RAM disk's for one, survive a start (but
not  Copy  and  Move).  QC  takes 64 pages at most (1024K, as QC
3.11:  a whole disk copies with 40) but counts all it finds: the
window  of the modes shows the machine (zx - 48K and 128K, pen -
Pentagon,  evo  -  ZX-Evolution,  atm  -  ATM1  and  ATM2, k/s -
Scorpion  and  KAY, pro - Profi) and all its memory, "evo 4096k"
for  one. On Pentagon 4096 the probe finds 128 pages (bits 0 and
1 of #AFF7 with bits 0-2, 6 and 7 of #7FFD): "pen 2048k".

    The  page  table  (#5B00)  has  2 bytes a page: the extended
port's value and #7FFD's; the 8 pages of the 128K come first. On
Pentagon  the page bits are added to #7FFD's value; on the other
machines  QC writes the extended port first, then #7FFD. On ATM2
and  ZX-Evolution  the value is inverted and written to #FFF7 or
#F7F7  through the TR-DOS ROM (#2A53): the ATM ports answer only
while the TR-DOS ROM is in (Real Commander does the same).

    Keys held at the start: W, 128K only (QC works with the port
#7FFD  alone);  Caps  shift,  Pentagon  1024  by  bit 5 of #7FFD
(without it 512K are found). On machines where bit 5 of #7FFD is
the  lock (all but Pentagon 1024), Caps shift at the start locks
the  port till a reset: QC thinks it has 128K, but every page is
page 0.

    Page  8  is used only if bit 5 of CONFIG2 is 1 and the BASIC
48  ROM has no JP (#C3) at #0008. Scorpion's ROM has one: page 8
holds its shadow monitor.

    QC keeps the code page (the resident's) out of the buffer if
bit  1 of CONFIG2 is 1 and there is more than 128K; on 128K (and
with  W) it is in the buffer, and Copy or Move may overwrite the
resident.  The  code  page is the one #D7 switches in: page 7 on
128K,  Scorpion,  Profi,  ATM  and  ZX-Evolution, 31 on Pentagon
512/1024/4096,  23  on  KAY  1024. QC finds it at the start: the
memory  test marks each page with the number of its entry in the
page  table,  and the code page's entry is swapped with entry 7,
which  the  memory  driver skips. Till 3.20 page number 7 of the
table  itself  (#17)  was skipped, and on Pentagon 512/1024/4096
and KAY 1024 the resident wasn't safe from Copy and Move.

    48K:  the  buffer of Copy and Move is the window #C000 (16K,
64 sectors), files are read for the viewers and the music search
up to 16K, unpacking goes up to 16K too, the text viewer doesn't
work.

    QC  doesn't  support  the +2A/+3 (the port #1FFD with the +3
ROMs).  QC  has  no  code  for  the  timings of Pentagon and the
others: its waits are counted loops, shorter with a turbo.


    :: The Shadow RAM and the Magic button

    If  I  is  held  while  QC  loads  from the disk, QC clicks,
flashes the border green, turns the shadow RAM (the cache) on by
reading the port #FB and writes the resident into it twice: with
#7FFD  =  #C7  and #D7 (bit 4 selects a 16K bank of a 32K shadow
RAM).  QC  doesn't check that there is a shadow RAM; reading the
port #7B turns it off.

    Each  bank:  #0000-#003E  zeros  (NOPs: Gluk's Reset Service
enters  the  shadow  RAM  at 0 and slides down to the resident),
#003F-#0067 the resident (41 bytes, its JR at #0066 is the NMI's
entry), from #0068 a copy of the code page from #C000 to #FF97.

    Magic  must give an NMI with the shadow RAM in. The resident
sets   the   stack  to  #5FE8,  switches  page  #D7  in,  copies
#0068-#3FFF  back to #C000, clears the screen and the border and
goes  to  #C000. The launcher puts back the system variables and
the  BASIC  loader (#5C00-#5E52), unpacks QC to #6000 and starts
it;  QC turns the shadow RAM off and takes the settings from the
CMOS, as on a start from the ROM.


    :: QC in the ROM in place of Basic 128

    QC_3_20.rom  (16K)  goes in place of the Basic 128 ROM, i.e.
as  ROM  0  (bit  4 of #7FFD = 0); ROM 1 must be BASIC 48, and a
Beta  Disk  is  needed. The settings come from the CMOS; without
one  QC  starts  with the build's settings (the boot mode, drive
A).

    The image: from #0000 DI and NOPs to #0037, so both an entry
at  0  and  an IM 1 interrupt at #0038 start QC. From #0038: the
stack  #5FE8, border 0, the attributes cleared, #7FFD = #C7 (the
code  page:  the same as #D7, while QC's ROM stays in; till 3.20
#07,  page  7,  and  on  Pentagon  512/1024/4096 and KAY 1024 QC
looked  for  its  code,  settings  and resident in another), the
image  copied  from  #005B to #C000, and a jump to the launcher.
From  #005B  are  the  launcher  and the packed code (they go to
#C000),  from  #3DA0  the  system variables #5C00-#5D3A with the
descriptor  of  the file "QC 3.20" and the BASIC loader with the
settings  (they  go  to  #FD45).  An NMI with QC's ROM in has no
entry: #0066 is inside the launcher there.


    :: The CMOS clock

    CONFIG2  sets  the  work with the clock: bit 2 use the CMOS,
bit  3  Gluk (1) or SMUC (0), bit 4 read and write (0: the clock
alone).

    Gluk:   OUT  (#EFF7),#80  (bit  7  opens  the  access),  the
register's  number  to  #DFF7, the data IN or OUT through #BFF7,
then  OUT  (#EFF7),0.  The port can't be read, and QC writes the
whole  of  it,  every  frame while it waits for a key: its other
bits, if the machine has them, become 0. Where an ATM port pages
(ZX-Evolution's  #F7F7  or  ATM2's  #FFF7;  on ZX-Evolution with
#7FFD  locked too, QC run in 48K, and with W), it writes #94 and
#14  instead:  bit 2 = 1 keeps the Pentagon 1024 mode off (in it
the pages' bits 3-5 come from #7FFD, and the buffer's pages from
8  on fall on the first eight) and bit 4 = 1 the 3.5 MHz, as the
boot menu sets them for TR-DOS.

    SMUC:  the ports answer only while the TR-DOS ROM is in, and
QC  reaches them through pieces of the SMUC ROMs: OUT (C),A; RET
at  #3FF0  and  IN  A,(C); RET at #3FF3. Reading: the register's
number  to  #DFBA,  then  IN from #DFBA. Writing: the register's
number  to #DFBA, #F7 to #FFBA, the data to #DFBA, #77 to #FFBA.
These pieces are in the SMUC TR-DOS ROMs and in 6.10E/6.11E, but
not in 5.04T: don't choose the SMUC clock with 5.04T.

    The  clock:  QC  reads the register #0B; #FF means no clock,
and  no  time  is  printed. If writing is allowed, QC sets #0B =
%00000010 (24 hours, BCD) while it reads and puts it back after.
While  bit  7  (UIP)  of  the  register  #0A  is 1, the frame is
skipped.  The  time  is  the  registers  4, 2, 0 (the hours, the
minutes, the seconds in BCD).

    QC's cells: #10 the input drive (0..3); #15 CONFIG (bits 0-2
the  output  drive,  4 fullcat off, 5 QC's mark, 6 no looping, 7
the  boot mode); #16 the number of the file under the cursor + 1
(1..#80;  0:  nothing).  QC  writes them at every drawing of the
cursor  if bits 2 and 4 of CONFIG2 are 1, and reads them only on
a  start  from the ROM or by Magic with the same bits; CONFIG is
taken  from  #15  only if its bit 5 is 1. The cell #10 is shared
with  Real  Commander  1.96  and  TR-DOS 6.05E+ (the autostart's
drive). Its bit 7 set (Mr Gluk Reset Service 6.3+: the drive not
to be kept), QC leaves #10 as it is, as Gluk does.


    :: The Kempston mouse

    The ports: #FBDF X, #FFDF Y (inverted: QC inverts it so that
Y grows down), #FADF the buttons in bits 0-2 (0: pressed): bit 0
the right one, bit 1 the left, bit 2 the third, as on a Kempston
mouse.  ZX-Evolution  (and MAME's pentevo) gives the left one in
bit 0:  with  bit 7  of  CONFIG2  = 0 QC swaps bits 0 and 1 back
(Quick Setup: Mouse: swapped). No wheel is read. A button counts
as pressed after 3 frames unchanged.

    QC  looks  for  the mouse at its start: it reads the buttons
for  a  whole  frame  (1202  reads of #FADF), and if one of them
reads  as  pressed, the mouse is turned off: so holding a button
turns  it  off.  Without an interface the ports read #FF on most
machines, and the mouse stays on but does nothing. On a grey 128
or +2 they read the floating bus: the screen's bytes while it is
drawn,  #FF  in  the  border; in a frame some byte of the screen
almost  always  has a 0 in bits 0-2, and the mouse is turned off
too.  Unreal  Speccy  needs  SwapMouse=1  for a Kempston mouse's
order.


    :: The AY

    The  release  build's  player (Sergey Bulba's PTxPlay) works
with  one  AY:  #FFFD the register's number, #BFFD the data. The
registers 0-12 are written every frame, 13 only when it changes.
The indicators take the registers 0-5 and 8-10 from the player's
copy in memory: what it has just written to the AY (the AY isn't
read). QC 3.20 doesn't select a second AY (TurboSound).


    :: The settings in QC's file

    The file "QC 3.20" (type B, start and length 279) is a BASIC
loader: the line 1 CLEAR 24575: RANDOMIZE USR 23925 (the numbers
hidden  behind  dots),  then  the  settings,  the loader and the
depacker;  from  the  file's 3rd sector on, the packed code. The
settings start at offset 23 (#17) of the file and take 35 bytes,
in  the  memory  after  the  load #5D52-#5D74. The number of the
packed  code's  sectors is at offset 74 (#4A): the file's length
depends  on  the  build,  take  it  from the catalogue. A boot.B
written by Save boot is the same, with the current settings.

    Below  are these bytes with their defaults and their offsets
in the file (the labels as in QC 3.11's source; in 3.20 they are
Config,   Config2,   DriveConfig,   DirectoryCopy,   FileColors,
OtherColors,  Colors,  ViewerTextColor  and  ViewerInfoColor  in
src/loader/settings.asm):

        ;0-2: output drive (kept for a return)
        ;3: unused in 3.20 (3.11: H packs with LE)
        ;4: 1 - fullcat off, 0 - fullcat on.
        ;5: 1 - QC config ID, 0 - RC config ID.
        ;6: 1 - play without loop, 0 - loop on.
        ;7: 1 - boot mode, 0 - commander mode.
CONFIG  DB %10111000                        ;#17

        ;0: not used (till 3.20: 1 - fast load QC, Ursula).
        ;1: 1 - keep the code page off the buffer (>128K).
        ;2: 1 - use CMOS, 0 - don't use.
        ;3: 1 - Gluk CMOS, 0 - SMUC CMOS.
        ;4: 1 - read & write CMOS, 0 - clock only.
        ;5: 1 - use page 8 (not on Scorpion), 0 - never.
        ;6: not used.
        ;7: 1 - Kempston mouse buttons, 0 - swapped.
CONFIG2 DB %11111111                        ;#18

        ;0: 1 - fast load, 0 - slow load: Drive A.
        ;1: 1 - fast save, 0 - slow save: Drive A.
        ;2: 1 - fast load, 0 - slow load: Drive B.
        ;3: 1 - fast save, 0 - slow save: Drive B.
        ;4: 1 - fast load, 0 - slow load: Drive C.
        ;5: 1 - fast save, 0 - slow save: Drive C.
        ;6: 1 - fast load, 0 - slow load: Drive D.
        ;7: 1 - fast save, 0 - slow save: Drive D.
            ;D C B A
CONFDRV DB %11111111                        ;#19

KEEP_TS DW #A107                            ;#1A

COLORSF DB #47,#07,#43             ;B C s   ;#1C
        DB #45,#45,#45,#45,#45,#45 ;m M - - S w
        DB #44,#44,#44,#44         ;W t T d
        DB #02,#42,#42,#42,#42     ;p z Z r h
        DB #05,#05,#05,#05,#05     ;H R a A X
COLORSO DB #04,#01,#06             ;scr del oth ;#33
COLORS  DB #5F,#78,#05,#30                  ;#36

    CONFIG:  bits  0-2 are the output drive: QC keeps it when it
runs  a  program  (in  the resident and the CMOS), while a start
from  the  disk  takes both drives from TR-DOS's system variable
#5CF6, and the file's bits aren't used. Bit 3 is unused in 3.20.
Bit  5  =  1  tells QC's settings byte from Real Commander's: QC
doesn't  take  a CONFIG with bit 5 = 0 back from the resident or
the  CMOS  (it  takes the drives and the cursor). The other bits
are the default modes. It is the only settings byte that changes
while QC runs.

    CONFIG2:  bit  0  unused  (till  3.20 what loaded QC's code:
Ursula  or  #3D13);  bit  1 keep the code page out of the buffer
with more than 128K; bits 2-4 the CMOS clock (with bit 4 = 0 the
settings  are neither written to the CMOS nor read from it, only
the clock is shown); bit 5 page 8. More in "The extended memory"
and "The CMOS clock".

    CONFDRV  sets  the  speed  of  reading  and writing for each
drive: fast is ~1.5-2 times faster but may write wrongly on slow
drives  (under  an  emulator  always  choose  fast); slow writes
correctly  on  any  drive  thanks  to an extra delay (one frame)
after the head's positioning.

    KEEP_TS  is where the catalogue's copy for Keep and autoKeep
is kept: the low byte the sector (counted from 0), the high byte
the  track  (#A107:  sector  7  of track 161). Keep formats that
track anew and writes the catalogue's 9 sectors from that sector
on,  so  the  sector must be 7 at most. QC doesn't check whether
the track has files.

    COLORSF:  the colours of 21 file types, in the reverse order
of the panel's type table ("XAaRHhrZzpdTtWwSXXMmsCB"); the bytes
6  and 7, where .v and .V were till 3.20, are not used. COLORSO:
the  colours  of  screen files and fonts (QC knows them by their
length:  6912,  6144,  2048, 768), of deleted files, of files of
the  other  types.  COLORS:  QC's  own  colours: the cursor on a
marked file, the marked files, the viewer's text by default, the
viewer's info line. 24 colour groups of files in all.

    A  setup  program  can know QC's file by its BASIC line (the
file's  bytes 4-21: FD 2E 0E 00 00 FF 5F 00 3A F9 C0 2E 0E 00 00
75  5D  00) and by LD SP,#5FFF (#31 #FF #5F) at the start of the
3rd  sector.  The settings' layout hasn't changed since 3.11. In
the ROM image the settings start at offset #3EF2.


    :: The resident and the return to QC

    The  resident  is the whole code page #D7: the launcher with
QC's  packed code (from #C000), the copy of the system variables
and  the  BASIC  loader  with the settings (#FD45-#FF97) and the
mark  "Residentpresent!" (#FFF0-#FFFF), which QC writes at every
start:  by  it TR-DOS 6.10E and later start QC after a reset. QC
checks  that the resident is whole by the word #FF31 at #C000 of
page #D7 (the launcher's LD SP,#5FFF) and by the mark's last two
bytes ("t!" at #FFFE: a program's stack spoils them first): that
is  "res"  in  the window of the modes and the condition of Save
boot.

    Why  #D7  and not #17: till 3.10 QC, as Real Commander, kept
the  resident  in  page  #17;  since  3.11  it  is in Pentagon's
standard page #C7, for TR-DOS 6.05E+ and 6.10E to find it (bit 4
selects  the  ROM  alone, so #D7 is the same page as #C7). Where
#7FFD  ignores  bits 6 and 7 (128K, Scorpion, Profi, ATM), #D7 =
#17  is  page 7; on Pentagon 512/1024 it is page 31, on KAY 1024
page 23, and a program that switches #17 in won't find QC there.

    Going back to QC from a program:

        LD BC,#7FFD
        LD A,#D7 ;(not #17!!!)
        OUT (C),A
        LD HL,(#C000)
        LD DE,#FF31
        XOR A
        SBC HL,DE
        JP Z,#C000
        LD H,A
        LD L,A
        PUSH HL
        LD A,#10
        OUT (C),A
        JP #3D2F

    If  the  resident is whole, JP #C000 starts the launcher: it
sets  the  stack,  puts  back the system variables and the BASIC
loader  (#5C00-#5E52),  unpacks  QC  to  #6000  and  starts  it.
Otherwise  page  0  and  the BASIC 48 ROM come in, 0 goes on the
stack,  and  JP  #3D2F  (NOP; RET in the TR-DOS ROM) goes to the
TR-DOS  ROM's  address  0:  TR-DOS 6.10E and later find the mark
"Residentpresent!"  and  start  QC,  the  others just start. The
program's stack must be under #C000 (the PUSH runs with page #D7
in),  and  the  interrupts are better turned off beforehand: the
launcher  turns  them  off  only with its second instruction. QC
writes  the  port  #7FFD  alone, so a program had better set the
extended port (#1FFD, #DFFD, #FDFD) back to 0 before it leaves.

    What  a program must leave alone to come back: page #D7 from
#C000 to #FF97 and the mark from #FFF0. On 128K that page is the
second  screen  (#C000-#DAFF):  a  program that shows the second
screen  overwrites  the  resident. A program run in the 48K mode
(R) can't come back: the port #7FFD is locked.

    What  QC  keeps  when it runs a program: before the start it
writes  the  number  of  the  file under the cursor + 1 (#FD42),
CONFIG  (#FD43)  and  the  input drive (#FD44) into page #D7 and
sets  LaunchedFrom  (#C01E)  to  2.  On  the  return through the
resident  QC  takes them from there: the cursor if it is 1..#80,
CONFIG  if its bit 5 is 1 (the output drive from its bits 0-1 in
any  case), the input drive from the third byte. So both drives,
the  menu,  the  cursor,  fullcat  and  the  looping  come back.
LaunchedFrom:  0  a  start  from  the disk, 1 from the ROM or by
Magic, 2 a return from a program.


    :: Running programs

    Before  any  run  QC writes what it keeps into the resident,
switches  page  0 and the BASIC 48 ROM in (#7FFD = #10, the port
not  locked),  sets  CURCHL  =  #5D26  and HL' = #2758, puts the
file's  catalogue entry into the TR-DOS descriptor (#5CDD-#5CEC)
and  the  file's track into #5CF5 (the head goes there), DosHook
(#5CC2) = RET, the current drive into #5CF6, #5D19, #5CF8, #5CF9
and  bits 0-1 of #5D16, and turns the interrupts on (IY = #5C3A,
IM  1,  I = #3F). The system variables: LAST_K = 0, REPDEL = 16,
REPPER = 1, FLAGS = #CD, FLAGS2 = 0, P_POSN = 0.

    A  code file is loaded at its start field and started there,
nothing  asked  (till 3.20 the load and the start addresses were
asked  for on line 23); a code file whose start is in the screen
(#4000-#5AFF)  is  shown  by  the viewer as V shows it; files of
other  types  but  BASIC are not run. The screen is cleared (the
border  and  the attributes 0), the memory #5D3B-#FFFF of page 0
is  zeroed,  the  file's  sectors are read by the function #3D13
(not  past #FFFF), the program starts through PUSH IX; JP #3D13,
the stack #5FE8. A start address under #4000 lands in the TR-DOS
ROM.

    A BASIC program: the border white, CLEAR (#1EB7) with RAMTOP
#FF00,  the  memory  #5D3B-#FE4B  zeroed, the file loaded by the
TR-DOS  ROM  by  its  descriptor,  with  no catalogue search (so
deleted  files  and  files  with  the  same  names run too), the
autostart  line  taken  from  the  bytes #80, #AA and the line's
number  after  the  program,  the  run  started through STMT_RET
(#1B76).

    A  run  in  the  48K  mode (R in the main menu): #7FFD = #30
(page  0,  the  BASIC 48 ROM, bit 5 the lock), the extended port
page  0's  value.  On Pentagon 1024 bit 5 is a page bit, not the
lock.

    The  exit to TR-DOS (T): border 7, P_RAMT = #FFFF, a jump to
#0048 of the TR-DOS ROM; nothing is written into the resident.


    :: The peculiarities of QC's TR-DOS support

    QC  doesn't  use  TR-DOS's  catalogue  and file routines: it
reads  and  writes  the catalogue's 9 sectors itself through the
VG93. Of the TR-DOS ROM it takes only function 5 (#3D13: loading
its  own  code  and  code files), the loading of a BASIC program
(#294A, #2920, #2970) and the exit to TR-DOS (#0048); everything
else  is  pieces  of  the  ROM's  code  (see "The disk: the VG93
directly").

    The  geometry:  track  D is cylinder D/2, the even tracks on
the first side (#3C in the system register), the odd ones on the
second  (#2C).  Sector  E  is  0..15,  as TR-DOS's, numbered E+1
(1..16)  on  the disk, 256 bytes each; the side in a sector's ID
isn't checked on reading. The error messages and the file's info
show  sectors  0..15.  A track number may be anything up to 255;
reads and writes go on from a track to the next.

    QC  takes  the  disk's size from the disk's own info sector:
the  number  of  the  first free sector (#E1, #E2) plus the free
sectors  (#E5-#E6).  So  disks of any size, more than 160 tracks
too,  keep  their  size. But Format, Check disk and Restore disk
work  with  the  tracks 0-159 alone, and the catalogue's copy on
track 161 lands on a bigger disk's files: QC doesn't check that.

    QC  doesn't  read the disk type (#E3) and always writes #16;
it  has  no  double  stepping  and no one side. By the code (not
tried)  this  means:  a  40-track  disk  (#17)  works  only in a
40-track  drive,  a  one-sided  one  (#18,  #19) is read wrongly
everywhere  but  track  0, and after a QC write TR-DOS too takes
the  disk  as  80x2.  Format  always  makes 160 tracks, Keep and
autoKeep need cylinder 80.

    QC counts the info sector (sector 8 of track 0, counted from
0)  anew  in  the  memory  after every read of the catalogue and
before  every write: #00 = 0; #E1, #E2 the first free sector and
track,  after  the  catalogue's  last  entry,  the  deleted ones
counted;  #E3  =  #16;  #E4  the  number  of  entries  up to the
catalogue's  end; #E5-#E6 the free sectors (the disk's size less
the  first  free  sector's number); #E7 = #10; #F4 the number of
the deleted. So the panel's Files, Deleted and Free are QC's own
count,  not  the  numbers on the disk. The byte #10 at #E7 isn't
checked on reading: QC shows a foreign or unformatted disk as it
is,  and  sets  #10  when  it writes (TR-DOS takes the disk then
too).  QC  writes  the sector's other bytes back as it read them
(the exception: an aborted Copy, see below).

    QC's  disk  name  is 11 characters: #F5-#FF, to the sector's
end;  TR-DOS's  is  8 (#F5-#FC). TR-DOS's Format writes zeros to
#FD-#FF, and QC shows them as ▒. The name is seen in the panel's
right  column and changed by N: the bytes not typed over stay as
they  were,  Delete puts a space. QC's Format writes 9 spaces to
#EA-#F2,  as  TR-DOS  does, and leaves the name's characters not
typed  zeros. TR-DOS 5.04T's CAT and LIST print the name up to a
0 byte or a byte with bit 7 set: with no zero in #F5-#FF (all 11
characters  typed)  they  print  on  past  the name (by TR-DOS's
source, not tried).

    The  catalogue  is 128 entries of 16 bytes; the name's first
byte 0 is the catalogue's end, 1 a deleted file. The panel shows
the  entries up to the catalogue's end, the deleted ones too; in
the Fullcat mode (F) all 128, those past the end as ▒ and in the
colour  of  the  deleted. Deleted entries and those past the end
can't  be  marked.  Delete  sets  1,  and if the catalogue's end
follows  the  deleted  ones,  the  whole  run of deleted entries
before  it  becomes  the  end  (0) and their room free; only the
catalogue is written.

    Before  each  write of the catalogue (Delete, R, CS+R, N, M,
C, G, K, Save boot, U) QC reads the catalogue's sectors 0-7 into
the  second  buffer  and compares them with the catalogue in the
memory;   the  info  sector  isn't  compared.  If  they  differ:
Bad disk., the command is dropped, the catalogue read again. Two
disks  with  the same sectors 0-7 (two empty ones, say) pass the
check,  and QC writes the first one's info sector (the name, the
size)  onto  the  second.  QC  doesn't  notice  a disk change by
itself:  the  catalogue  is  read  again by 1-4 and 5, the third
mouse button, Format, rEstore and after Bad disk.

    Copy: the files are copied in the order they were marked in;
QC  keeps  the  table  of  that order (129 bytes) in the working
disk's  info  sector in the memory, #40-#C0. The files are added
after  the  output  catalogue's  last  entry,  the  deleted ones
counted, from its first free sector: deleted entries aren't used
again,  same names aren't checked. Before copying QC checks that
the  sectors  are enough (else No Space. Free: n) and that there
will be 128 entries at most (else Cat Over. Free: n); the output
disk's  size  is  from  its  info  sector. After an aborted Copy
(Abort,  No  Space,  Cat Over) the order table stays in the info
sector in the memory and goes to the disk with the next write of
the  working  disk's catalogue. With one drive QC asks to change
the  disks  (Insert  OUTPUT,  Insert INPUT) and reads the output
catalogue  only  at  the  first  change.  If the output disk has
autoKeep's mark, its catalogue's copy is written too.

    Move  (M):  from  the first deleted file on (after the first
marked  one,  if  there are marked files) all the live files are
read  and  written one after another from the first free sector;
the  deleted  entries  past  that  place are gone. If the memory
can't  take them all at once, the catalogue is written in parts,
without  autoKeep's  copy.  Merge  (G):  the marked entries must
follow  one another in the catalogue (QC doesn't check that they
do on the disk). The first entry keeps its name, type, start and
length,  only its sectors grow, so the length no longer fits the
sectors (see below). Over 255 sectors: the first entry gets 255,
the  next  marked  one (with its own name) the rest; the rest of
the catalogue moves up.

    A file's length for View, U and the viewers: the sectors are
the  entry's byte 13 (a file of 0 sectors isn't read: the panels
again).  The  length  field  is  taken  if  its high byte is the
sectors less 1 (the low byte not 0) or the sectors (the low byte
0);  otherwise  the  length  is (sectors-1)*256+#FF. On 48K more
than  64  sectors  count as 64 sectors and 16383 bytes. Copy and
the  start  of  a  code  file take byte 13 as it is: a file of 0
sectors  is  copied  as  an  empty  entry,  and  its start loads
nothing.

    Names  and  extensions: the name's 8 characters and the type
(byte  8);  TR-DOS  knows the type alone. QC shows a 3-character
extension:  the  type  and the start field's two bytes (the low,
the  high) if both are #20..#7F (#7F is printed as the copyright
sign),  otherwise  the  type  and two spaces. So for any type, B
too,  whose  start  is the program's length: CODE 30000 (#7530),
say, looks like .C0u. A panel's line: the name's 8 characters, a
narrow  dot,  the  type,  the extension's two characters and the
sectors  (3 digits, the leading zeros as narrow dots). The bytes
#00-#1F and #B0-#DF are printed as the chequered sign ▒, #80-#AF
and #E0-#EF as Russian letters, #F0-#FF as QC's signs; a deleted
file's first byte (1) is ▒ too.

    How  the  commands write the extension. R writes the type as
typed,  and the two characters into the start field only if both
are printable (#20..#7F); two spaces give #2020 if the extension
was  long  and  leave  the  start alone if it was short; Russian
letters don't change the start. The masks (CS+L, CS+X, CS+R) are
12  characters:  the name, the dot (not compared), the type, the
start's low and high byte; the bytes are compared as they are, ▒
is any byte. CS+R writes every character of the mask but ▒ as it
is,  Russian  letters  too.  U  gives  type  X  for p_X and z_X,
otherwise  C,  and two spaces in the start. Copy takes the entry
over as it is.

    A  file's colour in the panel, in the order of the checks: a
deleted  file  the  colour  of  the  deleted;  a length field of
exactly  6912,  6144,  2048  or  768  the pictures' colour, even
before the type (11136 and 49152 aren't among them); type p or z
with  "_"  in the start's low byte the colour of the type in the
high  byte;  otherwise  the type is looked for (case matters) in
the  table "XAaRHhrZzpdTtWwSXXMmsCB", and one not found gets the
colour  of the other files (so do TR-DOS's D and #). The table's
types:

        B  BASIC               p  Hrust
        C  code                z  .zip, .zx0
        s  .scr, .scl          Z  ZXZip
        m  ProTracker 3        r  .rar, .rzx, .rom
        M  ProTracker 2        h  Hrip
        S  Sound Tracker       H  ALASM
        w  .wav                R  Storm
        W  ZXWord              a  Masm, ZASM
        t  .txt                A  TASM, GENS
        T  .TXT                X  Xas
        d  .diz, .doc

    QC  acts  on the type only for B (Enter runs BASIC, the boot
list,  Save  boot)  and  p_X,  z_X (the colour and U's type); it
knows  pictures by their length, packed files and music by their
contents.

    Russian  letters:  Edit  switches  the  YAWERTY  layout, the
letters  go  to  #80-#AF  and #E0-#EF (cp866); Ё can't be typed.
Only  CS+R  and  U  write  them  into the start field: R and the
extension's display take only #20..#7F there. TR-DOS prints such
names  through  BASIC's  PRINT  (#80-#8F block graphics, #90-#A4
UDGs, #A5-#FF keywords) and compares names byte for byte.

    BASIC  files:  the  boot  list has type B alone, without the
deleted  ones,  in  the  catalogue's  order.  A file runs by its
catalogue entry, with no search, so deleted and same-named files
run  from  the  file  menu;  the autostart line is the two bytes
before  WORKSP,  which  TR-DOS takes from the #AA and the line's
number after the program (QC doesn't check the #AA itself). Save
boot  always  adds  one more boot.B (TR-DOS runs the first one);
its  start,  length  and  sectors  are  those of the file QC was
loaded from.

    TR-DOS's  variables:  QC reads #5CF6 (both drives on a start
from  the  disk),  #5CE6-#5CEA  (its  own file's entry, for Save
boot) and #5CF4, #5CF5, the code's place on the disk that TR-DOS
leaves  after  loading the BASIC part (a program that loads QC's
file  itself must leave them so). DosHook (#5CC2) = POP AF; RET:
TR-DOS's  calls of BASIC's routines (through #2F72) are skipped,
so  the  BREAK  test  never  fires in the ROM's pieces QC calls;
before  a  program runs QC puts RET there. The drives' step time
(#5CFA-#5CFD) = 8: bit 7 = 0 (TR-DOS doesn't test the drive when
it  selects  it),  6  ms steps; the seeks of the pieces at #2740
step at 30 ms (#1B).

    AutoKeep's  mark  is  the  16  bytes "Quick Commander " from
offset  #C8  of the info sector. K writes or erases (with zeros)
the  mark  and writes that sector alone. The "DIRS" table of the
8th sector's standard isn't made in 3.20.

    The  catalogue's  copy: by default the sectors 7-15 (counted
from  0)  of  track  161,  cylinder  80,  the  second  side (see
KEEP_TS).  Each  Keep  formats that track anew (the IDs 8..16 in
the  first  9  places,  cylinder 0, sector 0 in the other 7) and
writes  the  catalogue's  9  sectors;  autoKeep does so at every
write  of  the catalogue if the disk has the mark. Show compares
the  copy's  9 sectors with the catalogue in the memory; rEstore
checks  the  byte  #10  at offset #E7 of the copy's info sector,
formats track 0 and writes the 9 sectors to its sectors 0-8.


    :: File formats

    Texts.  QC shows any file of up to 255 sectors as a text (up
to 64K: the file is loaded into the pages 0-3); a packed file is
shown  unpacked. The text viewer doesn't work on 48K. A text has
5460  lines  at  most,  the rest isn't shown. After the text the
viewer puts the end mark #FF (a byte UTF-8 never has).

    The coding is cp866 or UTF-8. If the text has no byte of #80
or more, it is cp866 (DOS in the info line). Otherwise QC checks
the  text from the first such byte: up to 16 multibyte sequences
within  1024  characters.  A  sequence  starts  with #C2..#DF (1
continuation  byte  after  it),  #E0..#EF  (2),  #F0..#F4 (3); a
continuation  is  #80..#BF.  The  text  isn't  UTF-8  if  a byte
#80..#C1  or  #F5..#FF  starting  a character, or a sequence cut
short,  comes  first. Overlong forms, surrogates and codes above
U+10FFFF  aren't  checked.  C  loads the file again in the other
coding.

    QC  turns  UTF-8  into cp866 in place: А..я, Ё, ё into their
cp866  codes; the pseudographics U+25xx (░▒▓, the frames, █▄▌▐▀)
into #B0..#DF; the quotes U+00AB, U+00BB, U+201C, U+201D, U+201E
into ", U+2018, U+2019 into '; the dashes U+2013 and U+2014 into
-;  the  ellipsis  into three dots; Є, є into Е, е; Ї, ї and the
Ukrainian  I,  i (U+0406, U+0456) into the Latin I, i; Ў, ў into
У,  у;  the  Ukrainian G, g (U+0490, U+0491) into Г, г; a BOM, a
soft  hyphen  and the stress mark are dropped; the viewer font's
signs (U+2265, U+2264, U+2320, U+2321, U+00F7, U+2248, °, U+2022
and ∙, ·, √, №, U+00B2, ■ and the no-break space) into its codes
#F2..#FF,  and ¤ into #FD (the font's square, U+00B2); the other
characters,  all  of  4 bytes too, into ?. A byte that starts no
sequence stays as it is; but cp866 inside UTF-8 survives only by
chance  (cp866's  "ра",  #E0 #A0, say, looks like the start of a
3-byte sequence and becomes ?).

    The  viewer's  font is 256 signs 4 dots wide: 64 columns, 23
lines  of  text.  #00  blank, #01-#1F and #7F cp437's signs (the
faces,  the suits, the arrows, the house), #80-#AF А..п, #B0-#DF
the  pseudographics,  #E0-#EF  р..я,  #F0  Ё, #F1 ё, #F2-#FF the
signs U+2265, U+2264, U+2320, U+2321, U+00F7, U+2248 (greater or
equal,  less  or  equal,  the  integral's halves, divide, almost
equal),  °,  ∙,  ·,  √,  №, U+00B2 (the square), ■ and blank. At
#F2-#F7  and  #FD the font differs from cp866 (Є є Ї ї Ў ў and ¤
there).

    A  line  ends with CR (#0D), LF (#0A), CR LF or a byte 0; LF
CR  gives  an extra empty line, and there is no empty line after
the last line end. The tab (9) goes to the next column that is a
multiple  of  8.  The codes 11, 12, 21-31 and #7F are printed as
the font's signs.

    The  colours  of  the ACEdit standard: the codes 1-7 the ink
1-7  on  black,  8  the  text's normal colour (of the settings),
14-20  the bright ink 1-7 on black (the code less 13). A code is
printed  as a space and works from where it stands; there is one
attribute  for two characters, so a code in a cell's second half
works  from  the  next  cell. A code right before the line's end
(CR,  LF  or  0)  sets the colour the whole line starts with; it
doesn't  with  CR  LF ends (a CR stands before the LF), and in a
line  wrapped  by the width only the last part gets that colour.
The  code  0  sets  no  colour: it ends the line. M switches the
modes:  the colours (at the start), the codes seen as the font's
signs  with  the  text  in one colour, the codes hidden (spaces)
with the text in one colour.

    The wrapping (W): without it the lines are cut at column 64;
the  simple  wrapping is at column 64; the "smart" one after the
last  separator within the 64 columns (space . , ! ? - / \ : ;),
and  without  a separator at column 64 too. A line of exactly 64
characters  followed  by  a  line end (or a code) gives no extra
empty line.

    Pictures.  The  length must be exact, and its low byte 0 but
for  .bsc:  6144 (#1800) pixels alone, the attributes #07 (white
on  black);  6912  (#1B00) a screen; 11136 (#2B80) a screen with
its  border,  .bsc;  49152  (#C000) an @-file, whose start (6912
bytes)  is  shown  as  a screen. The length must fit the sectors
(see "A file's length" above): an @-file has 192 sectors, and on
48K  no  @-file  is shown. Space, A and the left button step the
colours  round:  its  own,  black on white (#38), white on black
(#07);  for  6144  white  on  black and black on white. A packed
picture is known by its unpacked data's length. The formats .img
and .mlt aren't supported.

    .bsc:  6912  bytes of the screen and 4224 of the border; the
picture is 384x304 (64 pixels left and right, 64 lines above and
48  below),  a  colour  every  8 pixels of a line, two colours a
byte,  in bits 0-2 and 3-5 (bits 6-7 don't matter). QC shows the
border in one colour, the most frequent in its picture (on a tie
the higher number), and sets it back to black on leaving.

    Fonts:  768  bytes  are  96  characters of 8 bytes, top down
(usually the codes #20-#7F), shown 32 a row on the screen's rows
10-12.  2048 bytes are 256 characters: the file itself is copied
into  the  screen's  upper third (#4000), and the characters are
drawn  on  the  rows 16-23. White on black; Enter gives the next
file, the other keys leave.

    Sprites  (Symbol  shift  + V): any file as a black and white
picture.  A  line  of  pixels is the sprite's width in bytes one
after  another  (the  high bit the left pixel), the lines follow
one  another,  with  no  character  cells and no attributes; the
screen  shows 184 lines. The width is 1..32 bytes (32 at first).
The  info  line  shows  the offset in the file of the upper left
byte,  in decimal. A file shorter than 5888 bytes is followed by
zeros.

    Music: Pro Tracker 3 and Vortex Tracker II modules (PT3) and
Pro  Tracker  2  modules  (PT2),  Sergey  Bulba's player PTxPlay
(release 1). QC looks for a PT3 module's text header anywhere in
the  file  (so it finds compiled modules with a player too): a T
followed by an r, a P 4 bytes before the r ("ProTracker") or a V
8 bytes before it ("Vortex Tracker"), and a b #3F bytes from the
P  or  V  (" by "). A file up to 16K is searched whole, a bigger
one  by  its  16K  parts;  the header's 64 bytes must lie in one
part, and in files shorter than 256 bytes it isn't looked for (a
module is looked for by its structure only, below). The header:

        +#00  "ProTracker 3.x compilation of " (the version
              at +#0D) or "Vortex Tracker II 1.0 module: "
        +#1E  the title, 32 bytes (line 22, "PT3.5 : ")
        +#3E  " by "
        +#42  the author, 32 bytes (line 23, "Author: ")
        +#63  the note table (bits 0-1)
        +#64  the tempo
        +#65  the positions (for the position bar)
        +#66  the loop position
        +#67  the patterns' pointer
        +#69  32 samples' pointers
        +#A9  16 ornaments' pointers
        +#C9  the positions' list, ended by #FF

    The  version  is  the  digit  at  +#0D;  a non-digit (Vortex
Tracker's  r)  counts as 6. Below 4 the old note tables, below 5
the  old volume table, below 6 the old portamento, from 7 on the
rule  of Pro Tracker 3.7 for the commands 1xx and 2xx with delay
0. The title and the author are printed in QC's font: #20-#AF as
they  are  (#7F  the copyright sign), #E0-#EF р..я, #F0-#FF QC's
signs, #00-#1F and #B0-#DF the chequered sign ▒.

    When  the file has no text header, a module is looked for by
the structure of its header in the file's first 3K (the author's
UniSearch, 2005): the tempo 1..#3F, the positions 1 or more with
the  loop  position among them, the positions' list ended by #FF
right  before  the patterns, the empty ornament 0 (PT3: 0, 1, 0;
PT2:  1,  0,  0).  So PT2 modules are found (without a player or
after Pro Tracker 2's player), and PT3 modules without the text.
The format on line 22: PT3.x (the version from the text), VT II,
PT3  (no  text)  or PT2 (PT2: the title alone, its header has no
author).

    A  module  plays  if  none  of  its  48  sample and ornament
pointers,  from  the  module's  start, goes past #FFFF, i.e. the
module lies in its 16K part of the file. The exception: a module
starting  in  a part's last 6912 bytes (from #E500 on) in a file
of  #4100  bytes or more is moved to the window's start with the
next  part's  6912  bytes  (not  on  48K: the next part isn't in
memory  there).  The  tune  ends at the #FF after the positions'
list:  with  looping  the  play  goes on from the loop position,
without  it  the  AY goes silent and QC goes to the next file. F
plays 3 times faster. Not in the release build: TurboSound pairs
(PTSPlay, the build key PLAYER=4).

    Hrust  2  (hr2):  the  block  must start at the file's first
byte:

        +0  "hr2"
        +3  the flags: bit 7 = 1 the data not packed
        +4  the unpacked data's length (a word)
        +6  the packed block's length, counted from +8
        +8  the packed block

    One  block;  what follows it isn't read. The unpacked data L
must  fit with room to spare: L + L/8 + 272 at most 64K, i.e. up
to  58012  bytes; on 48K up to 14321 bytes. A file starting with
"hr2"  that  fails  the  check isn't tried as ZX0. Hrust 1.x and
Hrip archives aren't unpacked (Hrip ones are only coloured).

    ZX0:   the   format   ZX0   v2,   forward  (the  stream  for
dzx0_standard;  for  dzx0_turbo  and  dzx0_mega  it  is the same
format); the backward one (-b) and the old v1 (-c) don't do. ZX0
has no header, and QC knows a stream by itself: it unpacks it on
trial,  writing  nothing,  and  checks that each copy is of data
already  unpacked,  the  end marker stands exactly at the file's
last byte, the data never overtake the stream's unread part, and
the  data stay within 64K. So the file's length in the catalogue
must  be the stream's exact length, not rounded to a sector. The
data up to 64K; on 48K the file up to 16K and the data in page 0
with 256 bytes to spare.

    What  U  writes:  the  name  typed  (the  packed  file's  is
offered), the type X of p_X or z_X, otherwise C, the start field
two  spaces  (a  code  file's load address and a BASIC program's
length,  which  TR-DOS keeps in the start, aren't restored), the
length  the  data's,  the  sectors by it; the file goes from the
first free sector, its entry to the catalogue's end.


    :: The conventions of Real Commander

    QC   keeps  a  few  conventions  of  Real  Commander  (Pawel
Kislyak):  the  CMOS  cell  #10 is the current drive (QC's input
drive); bit 5 of the settings byte (in the CMOS cell #15 and the
resident)  =  1 means QC's settings, 0 RC's; the way back to the
commander  is  by  the signature LD SP,#??FF (the word #FF31) at
#C000  of the resident's page. Real Commander keeps its resident
in page #17 and leaves to TR-DOS through JP 15649 (#3D21), QC in
page #D7 (see "The resident and the return to QC").


    :: The ZX0 licence

    The  ZX0  depacker  in QC (the loader unpacks QC's code with
it,  U  and  the  viewers  the files of ZX0, and it checks a ZX0
stream  too) is the "standard" one of ZX0 v2 by Einar Saukas and
Urusergi. Its licence:

    BSD 3-Clause License

    Copyright (c) 2021, Einar Saukas
    All rights reserved.

    Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:

    1. Redistributions of source code must retain the above
       copyright notice, this list of conditions and the
       following disclaimer.

    2. Redistributions in binary form must reproduce the above
       copyright notice, this list of conditions and the
       following disclaimer in the documentation and/or other
       materials provided with the distribution.

    3. Neither the name of the copyright holder nor the names of
       its contributors may be used to endorse or promote
       products derived from this software without specific
       prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.


                 ░            ░▓▄▄▄▄▄
▄             ▓  ▓▀ ▀▀▀▓▄▄▄▄▄  ▀▓█▄ ▀▀▀████▓▄▄▄▄              ▓
██▓██▄▄▄     ▓░        ░    ▀▀▀▀▒▀█▓▄       ▀▀▀▀██▓██▄▄▄     ▓░
  ░▀▀▀▓███▓▄█▒                  ░  ▒   ▀░         ░▀▀▀▓███▓▄█▒
      ░  ▀▀█ ░                     ░                  ░  ▀▀█ ░