Buzz #17
10 апреля 1999

Hard Life - On creating a new DOS for the Speccy.

<b>Hard Life</b> - On creating a new DOS for the Speccy.
(C) Alex Kerman / Global Corp.


                      Hard Life Project


       Lately I've been increasingly faced with the problem, 
which surely familiar to all sinkleristam: to rewrite the new 
program? You can certainly erase any old toys or sistemki from 
the disk, then to rewrite there nove, You can also buy another 
box of discs and a month to forget such problems. But it is 
much better than it was, would be if the good old SPECCY could 
put the hard drive. The advantages of the hard drive before 
floppy disks are obvious: a lot less cost per megabyte (and 
with increasing capacity HDD, this difference increases), 
faster access to information, and in the end all files can be 
sorted by subject and keep them in different directories. 
Besides, having a hard drive, no longer have to rummage in the 
floppy drive to find the desired file. If you receive nove, 
then simply copy it to a hard drive, without hesitation, where 
to get the wheels or on which disk is still free sector.


       But as it turned out, a desire to have a small hard 
drive. Need more good disk operating system, which could

to work with the hard disk. There are two solutions to this 
problem. The first solution is to emulate the TR-DOS disks on 
hard drive, then about half (and perhaps more) programs will 
run from the HDD. In principle, it was made on SCORPION'e, but 
I do not like this solution for several reasons: firstly, a 
very silly emulating TR-DOS, which in fact, is itself an 
emulation ribbon, and secondly, we can immediately forget about 
the subdirectories, and third, a big restriction on file size, 
disk size, number of files on the disk, and fourthly, to switch 
the drives need to go into the shadow monitor, which I find 
very uncomfortable. Can be called many more disadvantages of 
such a decision, but I think that is enough for these, to 
understand that to run programs from the hard drive without any 
alterations do not worth the sacrifice.


       So, option two: once we decided that the program
hard drive not run, then we can move away from all restrictions 
TR-DOS and make a brand new DOS, "sharpened" by SPECTRUM. Of 
course, it can be DOS compatible with MS-DOS, koekakie benefits 
it gives, but MS-DOS is very slow, so that For example, create 
a file that will prosharit entire FAT in search free cluster, 
and 16-bit FAT takes up no more nor less - 128 KB. In addition, 
when you download a file, too, need to constantly refer to the 
FAT, to download the file in pieces, scattered across the disk 
(incidentally, this also dramatically reduces the rate of work, 
the experiments revealed that the continuous space of my 
126-megabyte Maxtor reads at a rate of 104 kb / s, and randomly 
selected sector at a rate of 26.8 kbps. The experiment was 
conducted on the Profi 5.03 with enabled turbo. 

       I am currently working on the creation of DOS, which is 
oriented at a maximum speed of working with files and the best 
convenience work. I will try to tell more in detail about his 
idea, can be it will interest you.


       I decided to make the files contiguous, to accelerate 
their loading and unloading as well as to simplify the file 
system disk. The main osobeneostyu DOS is a table of free

space, which contains data about which sector of the disk
occupied, and which are free. What are the advantages of table 
space (TSP) in front of, for example, bitmap of free sectors? 
First of all sizes. TSP - an array of descriptors available 
space, ie contains descriptors that indicate where start a free 
space, and what is the size. If half of the disk full of back 
to back, with no gaps, files, the then the TSP is only one 
mark, which indicates space starting after the last file, and

having a length equal to the volume of the disk minus the total 
amount of all files and directories on disk. The length of the 
descriptor of the free space is equal to seven bytes long, then 
in one sector of 512 bytes placed 73 of the descriptor, which I 
think is quite enough (for me at the IS-DOS disk is never more 
than six continuous areas of free space). Assume that

I have a 120-MB hard drive has accumulated two thousand files
so that between every two adjacent files is free
space, then we need the size of the TSC 2000/73 = 28 sectors, 
ie 14 kilobytes. It remains only to think of how to cram thus 
two thousand files on the screw. However there is a solution: 
need to be rewritten to the hard drive four thousand files and 
delete every other file ...


       There are other benefits of TSP to other file
systems as napshimer, no need for partitioning
into clusters and the opportunity to work with the physical 
coordinates. Size is tabgitsy in DOS is the formula one sector 
to four megabytes of space, but not less than 16 sectors. For a 
floppy disk 800 KB (10 sectors per track, 512 bytes), the table 
is always equal to four sectors. In fact, the table size for 
performance has no value, because work is only those sectors of 
the TSP, which is free descriptors space, ie if the disk fifty 
continuous free sites, the DOS works only with one sector of 
the TSC is not dependent on the size of the table. If the size 
of the table in the end strongly grew up, then you can drive 
seal. In this case, the TSC will include only one handle 
arbitrarily long time until you remove any file on the disk. 
TSP also allows you to bypass the bad sector on the disk. 

       When working DOS uses only natural coordinates on
disk (cylinder, head, sector), which also increases the speed
work with files due to the lack routines remitting
logical coordinates to physical ones. Physical coordinates (FC)
everywhere represented as four bytes (first two bytes - the 
number of track, first the low byte, then a senior, the third 
byte - number of heads, the fourth - the number of sectors). 
Inside the DOS for the job FC used registers DE: BC, where DE - 
Track, C - Head, B - Sector.


       Descriptor space consists of four bytes
FC and trehbaytnoy length of free space, then the free
space, as well as the amount of hard drive can be equal to a 
maximum of 16777216 sectors or eight gigabytes. 

       Of course DOS will have a system of sub-directories, as I
I think that can not be considered complete file system has no 
subdirectories. It was decided to limit the number of files in 
a directory to 512. This restriction is for programs that work 
with the directory, so you can take a directory buffer of a 
certain size. Limit the number of files, more file descriptors 
and directory is not associated with constraints file system 
with the same success could be limited to their number in 1024 
or 65536. 

       The file descriptor is composed of twenty-four bytes, 
where includes an eight-and three-letter name extension data

the length of the file in the sectors and separately, in bytes, 
FC file and data required for archiving TR-DOS programs on your 
hard drive. Descriptor directory also has a length of 24 bytes 
and starts with ID # FF, so it was easier to distinguish from 
the descriptor file. After the identifier is the name of the 
directory, consisting of 12 characters. Why twelve? Because the 
derivation of the screen directory file name also has 12 
characters (8 character name dot and three extension 
characters). 

       In the name / extension of file / directory is 
prohibited characters with code less than 32 or equal to 255, 
as well as space, and symbols "*","?"," \ ","/",".". The 
remaining characters are allowed, including the Russian letters 
on the standard alternative ASCII. 

       File size is limited shestnadtsatibitnoy length in 
sectors, which means that the maximum length of the file is 32 
megabytes. 

       If the file descriptor / subdirectory occupies 24 bytes, 
then one sector of the directory is located 21 descriptor, and 
to accommodate the 512 descriptors needed catalog of 25 
sectors, ie 12.5 KB! In my opinion, is too wasteful to allocate 
to 12 kilobytes for each directory, especially on a floppy 
disk. To loss were not so big, I introduced a system of 
folders: for creating a directory under it assigned four 
sectors (84 descriptors), and the overflow of the directory are 
added four more sector to continue, and the continuation of the 
directory can be anywhere, regardless of the location of the 
directory. Thus, if indeed limit of 512 descriptors a directory 
may consist of seven parts. It turns out that the directories 
have a segmented structure, but in practice the number of 
descriptors are very rarely more, 84 so the vast most catalogs 
still continuous. It should be noted that coordinates continue 
the directory located in the previous section directory, so any 
additional table arrangement parts directory does not exist.


       When allocating disk space (create a file / directory, 
the continuation of the directory), the TSP looks for the first 
suitable descriptor space, if the descriptor is found, the DOS

still looks to the end of this sector of the TSC in order to 
find a smaller required space. If found free space equal to the 
length required volume, the handle is removed, the sector 
shifts, and then shifted and the rest of the TSP, where there 
are descriptors. Shift table accounts and free disk space 
(deleting a file / directory) to preserve the order of 
descriptors that should not have to be sorted in the order 
increase their FC. 

       DOS will be located in ROM instead of BASIC 128. When 
starting the computer screen will display the menu containing 
the following items: TR-DOS, COMMAND LINE, BASIC in 1948, BASIC 
48 +128 K. It may be possible to insert a 16 kb apart from DOS 
and still test computer, then to add another menu item. At the 
same time with the appearance of the menu is a survey on the 
readiness of the hard drive, if not press any key. If the hard 
drive is ready, then read the first sector zero zero head 
tracks from which are copied to the system variables required 
data (TSP FC, FC root directory, the number of lanes, heads, 
and sectors of the hard drive, the length of the TSP in 
sectors). If the this sector is not the ID DOS or byte 
resolution auto-zero, then the autostart is not happening. The 
process itself Autostart has not been fully thought through - 
perhaps to be loaded and processed in autoexec.bat, and can be 
run start.exe or gc.com.


       Of course, the important point is the alteration of 
existing programs under DOS. With ordinary case loaders The 
situation is simple: in DOS for that purpose provided for all 
sectors reading a file, install file offset, opening a new file.

If you do not feel like writing. Exe loader in assembler, you 
can write a text bat-file that can be compiled together with 
all of these in bat'nike files into one exe-file. 

       If the program works with files on the disk, then the 
alteration can be quite significant. To work with the catalog 
provides sector reading the directory and search descriptor on 
the mask. For example, the assembler sets the mask "*. asm", 
then calls function DOS "search for a file from the beginning 
of the directory, copy a file / directory, then calls the 
function" Search for a file " again, copies itself into the 
buffer name, and so on until the error "file not found "(# 0F). 
When you create a file when it encounters a file with the same 
name, DOS deletes an existing file and creates a new one. If 
creates a file and have essentially the same length in sectors, 
simply open an existing file and corrected length in bytes.


       When you create a boot and programs under DOS to
bear in mind that memory at # 5B00 are system variables DOS. 
Now the variables occupy about 70 bytes, but when DOS is ready, 
they will occupy about 100 bytes. After variable is usually 
located a buffer for disk operations length of 512 bytes, which 
when needed can be arranged to any address in the RAM, and has 
not even necessarily a multiple 256. However for the 
sector-load the buffer is not required. 

       DOS functions will be called by a team of RST, and the 
battery (or in any other case - not yet entirely clear) must be 
called subfunction number. In operations with the name of a 
file / directory the caller must specify the address name in 
HL, where the name can be even in the buffer for disk 
operations. All DOS functions return the battery code error (if 
A = 0 then no error). Maybe then I provided simultaneous work 
with two files, but you can do without that if we have two 
copies of the variables. When referring to the first file to 
copy and paste into place the first block of variables, and 
handling to the second - the second. Thus it is possible open 
an unlimited number of files and work with them. 

       In the ROM address # 3800 will be sewn in screen font 4x8
format as standard - alternative ASCII. This font will be
use when working with DOS command line and the derivation of 
the start menu. Also, the ROM will be a set of routines print 
lines, letters and numbers. 

       That seems to me, and ended a brief description of the 
DOS. If you interested in this project and you are ready to 
support him or you something is not liked, or if you want 
something to complement you can napasat me an email to the 
address below or by phone. If no one interested in this 
project, continue to work for me does not make sense, so write 
- the fate of project in your hands.



       309530 Stary Oskol m-on "Youth"

       d.5 kv.12 Andrei Kosarev

       T. (0725) 25-54-43






Other articles:

AGA - Graphic editor 3 color'nyh screenshots AGA v1.0.

ASCII graphics - How do I view ASCII? How to learn to ASCII. Are there helper programs for ASCII.

BLOB the COP - Text of the inner game firms Players to Hacker.

C. Expirience - Cheat for the game Space Crusade.

DOS PRO - The fastest procedure, the disk: read / write sectors without monitoring and controlling errors reading sectors monitoring of the serviceability of reading, reading / writing sectors with the control interrupts the ignition / quenching lamp drive spinning and braking disc, reset VG13, positioned at 0 track, protection from Magic Button, blanking lamp drive, check what the current, control the availability of the disk in the drive.

Eternal News - News from the Kovrov spektrumistov (Ash, Proxima, EI)

GOURAUD - Likbez in 3D-shading (shading algorithm faces by GOURAUD).

Hard Life - On creating a new DOS for the Speccy.

HDD Autodetect - FDD & HDD loader.

Heroes of M & M II - The presentation of the game: Heroes of might & magic II.

MMA in Kovrov - great and terrible in the city where never made carpets.

Modern Word - The description text editor Modern Word v1.3

Parties?! - FunTop'99 vs Chaos Construction'99: Point of view.

Program BOX - New unusual boot - Program BOX v2.0.

Rants & Raves - How to get on the train with forged tickets.

Switch 3.5 ' - As juzat 3.5 drive after it is connected.

various shots - Extracts from the book of Guinness World Records.

various shots - Ultrosovremennaya tale about near the end of the world.

Zhiztyanka - Life issues SPY.

Contacts - contact details.

crisis - tales in the style of the game world from him.

Toy Review - Overview of Game Software: Figus, Mirror, Iron Man, Gyron Atrium, Homer Simpson in Russia, Golovobol, Monster Land, Devil's course, Astro Ball, Net Walk, Nexus.

Review sistemok - Overview of system software: Text Maker v0.12c, Excess Sample Editor v1.4, Best View v2.6, DOS2DOS COPYv2.0, Excess Deluxe Paint v1.0 demo, Laser Compact v5.0, Consul Commander v3.33, DCM Protection KIT v4.1b, Modern Word v1.3, E-Mage Work Statio, PKZIP.

From the authors - On changes in the shell of the newspaper.

About Cruise - Novella to the game "Escape to Harhan.

Advertising - Advertisements and announcements ...

Viewpoint - On writing Softa for the Spectrum.

Authors newspapers


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
sober view - arguments about the Millennium.
laugh for no reason ... - Proceedings of the humor magazine SpectrofUn.
Feedback - contact the publisher.

В этот день...   6 May