Systems - history of the CP/M operating system for Spectrum: limitations (part 2).

Info Guide #12
32 MB is enough for everyone
Maxagor/NedoPC group

   Only when you use it for a long time
or another OS, you can thoroughly study everything 
its features, advantages and disadvantages, 
down to glitches and errors. It's banal 
true, but that’s what made it possible to find such 
lack of ATM implementation of OS CP/M v2.2, 
which was so easy to assume 
it is impossible. 

                  * * *

   To make the essence of the shortcoming clear,
Let me briefly go over the structure of the organization
disk devices in this OS version.

   In total, the system can have up to8 drives─
ditch with numbers from0 to 7. In this case:
 - driver numbers0.6and7were reserved─
modified for future expansions and not used─ 
used; 
  -5(NETdisk - network drive)was declared
in the documentation, but currently unknown─ 
We know the ROM firmware where it would be implemented─ 
van; 
  -1(ROM disk)was only met by me
once in a special "enlarged" ROM 
volume of256KBfor ATM-turbo 2+; 
  -4(HDD)available only in ROM
ATM-turbo 2(+); 
  - and only drivers numbered2(RAM-
disk) and 3(FDD)are available in firmware for
all types of ATM. 

   By connecting to these drivers
block device descriptors we can semi─
Read different disks or disk partitions.
Total number of DIFFERENT channel descriptors
in the system core can be created10 (de─
seven).
   In turn, these 10 channels can be
connect to16 (SIXTEEN) letters log─
cical disk devices (A: B: C: D:... N:
O:P:). At the same time, taking into account that the channels are 
there are fewer satels than logical disks, then─
only a maximum10 disks will be independent
from each other, and additional disks can be
use if, for example, for the purpose of pain─
There is no need to assign any convenience in copying─
which channels on several disks at once.
For example, bindfloppy drive0 immediately
to the letters A: and C:, and floppy1 - to the letters
B:, D: and K:, etc. 
   With such a set you have to have
It's a matter of CP/M on ATM machines. And if
when working on ATM-turbo 1, where it really
existing disks only have FDD and
RAM disk and, in fact, really used by me─
only the letters A: B: C: were called (actually
RAM disk and two flops), then change everything─
elk when I switched to ATM-turbo 2+, where
His Majesty Winchester is present.
   There are no full-fledged catalogs in CP/M, so─
mu huge number of files quickly prev─
degenerate into an incoherent mess in which labor─
but find something. Plus, the more files
in the catalog, the more the system slows down
when trying to process it. In the end, why─
stuyu, the speed of the program with the screw
maybe if there are a large number of files in the directory
drop almost to the speed of the flop in
the same TR-DOS.
   Therefore, in the manuals for working with Vinches─
It was not for nothing that special attention was paid to the term in CP/M on ATM─
careful attention to the non-recommendability of the creation─
create too large sections on the screw and
directory areas are too large. On the contrary,
it was recommended to do the initial, system
many screw section with the most basic and
frequently encountered files and files on─
construction sites no more1-2 MB and a catalog of 128
files, and the rest, as it turns out, is not
more512, maximum 1024 files in the directory.
 At the same time, through the “trial and error method” I
came to the conclusion that the maximum time─
measures of the section that makes sense to work with
-8 MB and 512 files in the directory.

   In general, after listening to the advice in the manuals, I
I created a disk map as written there.

   First I did the same as in ATM 1
(except that there is a smaller RAM disk by512 KB):
 - A: -RAM disk in944 KB(it's on this bu─
que initially after startup.Reassign 
possible, but for reasons beyond this 
articles, this is irrational); 
  - B: -FDD 0(640 KB);
 - C: -FDD 1(640 KB).

   And then I planned the following sections
screws (their volume is indicated in rounded figures):
  - D: -HDD-partition 1(1 MB, 128 files
in the directory) - the same system partition;
 - E: -HDD-partition2(4 MB, 256 files
in the catalog) - also system, a little larger;
 - F: -HDD-partition 3(8 MB, 512 files
in the directory);
 - G: -HDD-partition 4(8 MB, 512 files
in the directory);
 - H: -HDD-partition 5(8 MB, 512 files
in the directory);
 - I: -HDD-partition 6(8 MB, 512 files
in the directory);
 - J: -HDD-partition 7(8 MB, 512 files
in the catalog).

   And this is where I encountered a glitch.
Sections D-H were created and holes opened─
little, but attempts to open created
sections I-J (at least read in the shell─
directory, even just on the command line─
ko go to their letter) ended with vi─
any system tightly.She just froze─
shaft and stopped responding to everything ─
other than reset. In short, a complete "bird"
Oblomingo."
    It wasn't even clear where to start
figure it out. We only managed to find out that
if, for example, you do not prescribe any of the
early letters (for example, G:), then ud─
it was necessary to assign a disk from the previously “unavailable─
nyh" letters. We also managed to call without any problems
start these letters on existing kana─
ly - when the new letter simply meant that
the same drive as one of the previous letters.
   This is what research was once about.
discontinued. And this was more than 10 years ago.

   Today, with ATM emulators available,
working with images of the hard drive, which poses─
free to see what's going on at any time
comes from memory, I returned to this old
half-forgotten unresolved problem and, having created
image and breaking it into sections, reproduced
exactly this error, after which I went into
emulator debugger. I got to the bottom of it
pretty quickly.
   And the mistake turned out to be not entirely a mistake, but
quite banal. That's the point.

   The CP/M core(CCP+BDOS+BIOS) is located in ATM
is located at the following addresses:
  - #D400-#DCO5:CCP (command interpreter─
bottom line, independent of the hardware on which
starts);
  - #DCOb-#E9FF:BDOS (function manager
DOS, independent of the hardware on which it is launched─
repents);
  - #EAOO-#F7FF:BIOS (standard kernel
low-level "hardware-dependent" functions).
   Immediately behind these parts of the core lies more
area:
  - #F800-#FFFF:System Monitor - monitor
most low-level system functions,
where do hardware-dependent functions go?
BIOS. Represents a function kernel
by direct access to low-level drivers─
beliefs of physical input/output devices,
screen console driver.

   However, the BIOS section is only partially
"clogged" with code. At the end of it are located
areas of various variables - first of all─
th descriptors of the structure of connected dis─
kov, and the area is2048 bytes in size, not─
moderately adjacent to the areaSystem
Monitor (#F000-#F7FF) is reserved for the so-called.
"block placement vector" connected
disks.
   In other words, cards are placed here
filling disks that are not stored on
floppy disks themselves (likeFAT in MS-DOS), and you─
are calculated by the system through analysis of ka─
directory of the newly selected disk - in this case
each logical block is allocated1
bit. If the block is free -bit=0, if for─
yat - equal to1. One logical block can,
theoretically, change programmatically when co─
building disk descriptors, but by default
is always set equal to2048 by the system
byte or2 KB.
 At the same time, existing utilities,
struggling to connect new disks and devices─
connections to disk channels (@.COM, AS.COM,
ASS.COM,ASSIGN.COM,FDISK.COM) can be changed 
only parameters such as the number of heads,
sectors, tracks and size of physical seconds─
tors, yes the number of files in the directory, but
not the logical block size.
   Thus, at the moment it is possible
consider the size of such a block to be2048 bytes
as a given. In the disk map there is such a block for─
takes1 bit. So, for 8 blocks (16 KB per
sum) will require1 byte of the bitmap.

   As more and more channels are connected─
catching discs as part of the generalareas #F000-
#F7FF is allocated to one channel after another 
space proportional to the size of the disks. So,
floppy disk bitmap size
640 KB will take40 bytes. Start of bit volume─ 
the areas of each of the connected disks are stored
flashes and the program can be obtained─
function volumeBDOS27.
 It is easy to calculate that this entire area
in2048 bytes in total will allow you to address
16384 blocks or32768 kilobytes (32 megabytes─ 
ita) for all connected disk channels─
fishing IN TOTAL.
   What happens if you try to exceed
this volume?
   In my case, when I connected (see that─
plate above) disksA(RAM),B, C(FDD),D,
E, F,G, H(HDD) total volume was30896 
KB, i.e. almost close to the coveted gra─
nitse.Connecting another partition vince─
stera, volume 8 MB (8192 KB)definitely
exceeded the remaining unoccupied volume of the slot─
lennoy under the vector of placement of blocks of the area─
stity - ending, as already mentioned,
on byte #F7FF. As it turned out, in the system
there is no control over the overcrowding of this area─
sti.
   As a result, when such additional
the device was connected, when trying to
choose a system, conscientiously resetting your
part of the area before reading the directory
to analyze disk occupancy, just overwrite─
la starting with #F800 system monitor
low-level functions, tightly hanging the system─
topic. That's it.

   The only question that remains is why was it
such a small area has been allocated, learn─
Knowing that block numbering is based on 16-
bit addressing, i.e. the maximum number
blocks on a logical device can dos─
click65536, which is only for the block size
v2 KB gives the maximum size of one usable─
triples in128 MB. And this is if you don’t increase it─
Change the size of the logical blocks themselves!
   I have an assumption that in my
time, when the system was created, no one could and
imagine such volumes of disks, and calculate─
they said that32 megabytes for all connected
disks will be through the roof.
   Thus, before usnext time
embodiment of the classic “Bill Gate mistake─
sa", which, talking about the amount of RAM, 
allegedly stated that"640 KB is enough for everyone." A
there wasn’t enough - no RAM, no reserved─
bathroom capacity of32 MB for disks.

                  * * *

   I still plan to play in the future -
the same size of logical blocks, why 
you will have to write a customizer utility. 
   In the meantime, dear readers - enjoy─
Strong recommendation for CP/M users on ATM─ 
tion to carefully calculate the total volume created─ 
disks, and at the same time decide for yourself what 
better - fewer screw sections, but in volume─ 
her, or more, but smaller - personally 
I prefer the second now. Smaller times─ 
things work faster. 
   And if there are not enough of them, then no one bothers
create any number of them on the screw─ 
oh, just connect them to specific beech─ 
disks to you one by one, as needed─ 
sti. 
   Good luck to everyone!

Share your thoughts about the article