Think #40
05 ноября 1999
  Софт  

NEOS - Description of a new operating system for the Spectrum.

<b>NEOS</b> - Description of a new operating system for the Spectrum.
        NeOS - the new operating

          system for the Spectrum


(C) 1999 Megus / Brainwave ^ X-Project.


  The idea of ​​creating a completely new system
for the Spectrum in the air is already very
long. Perhaps many were taken for the establishment, but not 
many have the strength, patience, and and knowledge can bring 
such serious work until the end. In 1997, work on

new OS launched Pavel Fedin, but he later, by
Unfortunately, disillusioned with the idea. However, he has 
left a large number of specific theoretical developments, which 
later became the basis NeOS. Therefore, NeOS author of the 
concept of law is Pavel Fedin, and development of ideas and the 
implementation of all zadumok been engaged I Roman Petrov 
(Megus / Brainwave ^ X-Project). 


  The decision to create a new OS for the Spectrum
appeared not to scratch it as
me and Pavel Fedin (hereinafter
just developers) prompted the following reasons:

1. There are alternatives to TR-DOS (iS
   DOS) is obsolete, because was originally

   designed for machines with memory

   48Kb. Also in the iS-DOS, there are some
   torye restrictions that do not give this

   freedom of the programmer.

2. Currently, there are many

   Spectrum models with memory than 128

   KB, but the management of memory in each

   machine made by his own standards
   one that causes some difficulties

   a programmer.

3. Also there are many more

   periphery, but in this area

   there is no firmly established

   standards, as each developer

   strives to make all their own way.

4. TR-DOS, in fact, is not polnotsen
   Noah operating system. Actually

   it's just a tape emulator

   Operations on the diskette.

5. Absence of an integrated file system

   (As in TR-DOS, and in iS-DOS) hindered
   preserves the use of external media

   high-capacity data (HDD, CD-ROM ..).


  There are other reasons, but those
that have just been listed, are the most important. All 
described problems are solved in NeOS.


  Here is a brief list of features that provides a programmer 
and NeOS user:


 - Supports up to 4MB of RAM (the theoretical
    cally - up to 1GB);
 - Implemented a system of block allocation

    memory, which will facilitate further

    implementation of the (pseudo) multi-tasking;
 - Implemented a system driver that Snee
    maet problem of incompatibility of different
    Noah periphery;
 - Implemented the system library functions;
 - Ability to work with any external storage ring
    Telem data;
 - Full support of the Director
    thorium;
 - Ability to work with files of arbitrary

    length (up to 4GB);
 - Supports long file names
    Noah and 16 characters with three-character

    extension;
 - Implemented the "transparent" support of times
   personal file systems.

  Now, all this in more detail.

  NeOS supports up to 4MB of RAM,
while the programmer does not have any problems if operating 
under with this memory, as Work carried out by

system functions NeOS, and the programmer has
should not worry about the support of all the possible ways to 
implement the extended memory. For subsequent implementation of 
multitasking in NeOS system was implemented memory management: 
scaling in the selection paged memory. The size of allocated / 
freed block is a multiple of 1K. 

  To work with external devices (not
only with them) was implemented system
drivers. Driver held in memory
in the form of "chains": the beginning of each driver is a 
pointer to the next. Thus, the total number of drivers 
installed in the system is limited only by available memory. 
Each driver has its own name, by which the

be searched. Drivers are divided into
2 types: resident and nonresident. K
resident drivers are caused by
each interrupt, a non-resident - the driver, specifically 
calling program. Each type has its own chain.

From the driver program can be called
follows: first, to find (open) the driver on his behalf, after
then on the received address and the page
contact number of the function in register A.
Since in the future we plan to implement multi-tasking system 
has been implemented library functions. At the moment This 
system is not particularly important. Organization of libraries 
in memory is similar Organization drivers ("chain"), how to 
work with libraries are also similar. 

  Working with external data storage
carried out through two levels of
Drivers: disk drives and
drivers, file systems (FS). When working
files the programmer must use
Driver FS, and he has, in turn, uses the disk device driver. 
Thus providing support for any FS on any type of storage 
device. In NeOS implemented "transparent" support

various FS. This means that the system
can be installed multiple drivers
FS and NeOS will work with any of them.
When you select a disk device is
appeal to each driver for the FS
determining whether the disc FS. As
only a driver recognized the disc as
"Own" this driver is active
for the device, and further
operations with files on the disk will be
produced by it. Therefore,
NeOS eliminates the need for a Copy
such as MS-DOS <-> TR-DOS, because system itself
can perform similar operations.

  As in any full-fledged DOS, in NeOS
capacity to work with subdirectories
which is so lacking in TR-DOS. Also in
NeOS no restriction on the length of a file specific to TR-DOS 
and iS-DOS, the maximum length of the file can be NeOS is equal 
to 4GB, which can not be considered restrictive. 

  To implement the elementary contact
with the user in NeOS integrated team
interpreter allows you to perform basic commands and system 
management simple disk operations. There is a possibility 
combine a sequence of shell commands in a so-called batch files 
(batch files), which represent from a common text files. So

as the built-in interpreter
very modest, the possibility of
install an external interpreter

  The developers had originally agreed
that the system will be placed in ROM in the region occupied by 
128 BASIC. This allowed maintain compatibility with virtually

all existing software for the Spectrum (this
Page ROMs used by a single program, the developers still have 
not found any one that would not work in the presence of ROM 
NeOS). In the ROM is the core system (Brainwave BIOS), the 
shell, as well as the most necessary driver, without which the 
operation of the system is impossible. Because cater for all 
users for selecting a standard set of

Driver is not possible, it was decided to write
installer NeOS. With installer
each user can customize NeOS
system the way he wants. It can
choose the standard drivers, the type of computer (for use with 
expanded memory) color, language, system messages, layout

keyboard, etc. The result of
the installer is finished image ROM
which is already possible to "stitch up" in Rom. It should be 
noted that NeOS does not work with ROM TR-DOS 5.03, for normal 
work with NeOS ROM drive to TR-DOS, which

it is possible to directly consider
floppy drive controller status register
(Port # 1F VG93). It is recommended to use NeOS with TR-DOS 
5.13, which will be attached to the system.


  To date, the core of the system is completely ready, and 
passes through the stage of active beta; parallel is

writing software, without which the system can not exist, as 
well as to build library of drivers. Because one group

able in the short term to ensure the system
most necessary software developers invite all interested to the 
system cooperation. NeOS - it's free

Distributable (freeware) product, but for a certain sum of 
money (it is still not defined), anyone can become a

Registered User NeOS.
Each registered user will receive from us a complete set of 
NeOS (installer, a library of drivers, the base soft), full 
documentation Programmer a small book, and we undertake to 
inform such users of the output of the most interesting 
software for NeOS and help in acquiring them.



  In developing NeOS attended:
 - Roman Petrov (Megus / BW ^ XPJ) - razrabot
   SC system, writing the kernel and more

   part of the driver;
 - Pavel Fedin - development of the system;
 - Andrei Mikheev (MAV / BW ^ XPJ) - writing

   drivers, constructive criticism;
 - Andrei Isayev - writing drivers FDD,

   constructive criticism;


  Neposredstvnnogo participation in development is not
accepted, but tips help, criticism
and morally supported by:
 - Roman Miliukov - author of the idea Installs
   torus;
 - Denis Dmitriev (Dismaster / XPJ) -

   constructive criticism;
 - Denis Sotchenko - constructive critical
   ka, tips for organizing memory and

   multitasking;
 - Jarek Adamski - constructive criticism,

   useful advice;
 - Evgeny Malkov (Tim Kelly / KGS), Alec
   Sandre Kormishin, Yuri Voynalovich, all

   Brainwave, the whole X-Project, Mihal

   Bukowski (YERZMYEY / H-Prog), ehokon
   ence REAL.SPECCY - a moral
   support.

Contact the author:

  424019, Russia, rep. Mari El, Yoshkar-Ola, ul. The festival, 
d. 77, kv. 13, Petrov Roman Sergeyevich.


  Phone: (8362) 22-66-09, 14:00 to 22:00 (mosk. time).

  FidoNet: 2:5052 / 7.37

  ZXNet: 500:8362 / 1

  E-mail: megus_bw@mail.ru



    Description of the shell

                NeOS v1.0



   Shell NeOS
designed for elementary control
system and files. It allows you to perform
commands that can be divided into 2
main groups:

  - Team management system;

  - Team work with disk

    devices;

   When you first start NeOS made
attempt to run the file "neosboot.bat" with
disc set in the CMOS boot.
In the absence of this file is
access to the command line editor.

   In version 1.0 of the interpreter is
limited, but this will be fixed in
future versions.


          Command interpreter



       Team management system


1. VER


   Command displays information about
Version NeOS.

2. MEM


   Command displays information about
available upper memory.

3. CLS


   Command clears the screen and fills
its current attributes.

4. CLW


   Command clears the current text box
and fills its current attributes.

5. COLOR attr


   Command sets the current attributes
attr.

6. BORDER color


   Command sets the border color
color.

7. RAM page


   The team consists of # C000-# FFFF
page number of the page.

8. CALL addr


   Team invokes,
at the address addr.

9. STACK addr


   Command sets the stack pointer
the address addr.

10. HEX


   Command sets the output of all the numbers
in hexadecimal.

11. DEC


   Command sets the output of all the numbers
in decimal form.

12. SILENCE


   Command turns off the sound AY.

13. POKE addr byte


   The team enters the 8-bit number in byte
cell addr.

14. PEEK addr


   Command displays the 8-bit number of
cell addr.

15. DPOKE addr word


   The team enters the 16-bit number in work
cell addr and addr +1.

16. DPEEK addr


   Command displays the contents of cells and addr
addr +1 as a 16-bit number.

17. TEXTWIN x y width height


   Command sets the current window
koordintami upper left corner x and y,
wide width, tall height. Coordinates
and window sizes are set in the familiarity 8x8
pixels.

18. MEMMAP


   Command displays pokilobaytnuyu map
Employment memory.

19. EXIT


   The command produces output in the StartUp
Menu.



  Teams work with disk device


1. LOAD file [addr [length]]


   The team loads the first length bytes
file into the address addr. Options addr and
length optional.

2. SAVE file addr length


   This command writes the file file length
length from the address addr.

3. RUN file [param]


   Command starts to execute code
file file. Characters found after
file name may be perceived as
parameters of the program.

4. RUNS file


   Command starts the execution
a batch file named file. Batch
file - a text file containing
sequence of commands NeOS. In addition to
standard commands there are additional:

   "+" - The device to display the executable
commands on the screen;

   "-" - Off the map
executable commands;

   "" - A symbol of comment - all current
Line is considered for the comment and
ignored.

   The last line must necessarily
end with a newline (# 0D,
or # 0D, # 0A), otherwise it will not
implemented.

5. CD [path]


   Command sets the current path
and / or device. In the absence of
parameter, the command displays the current
way.

6. DIR


   Command displays the file names
contained in the current directory.

7. REN file1 file2


   Command renames file1 to
file file2.

8. DEL file


   Command removes the file file. Read-Only
files are removed from the preliminary
confirmation.

9. MKDIR name


   The command creates a new directory name.

10. RMDIR name


   Command deletes an empty directory name.



   In NeOS set the standard for
file extension:


   *. Cnp - executable;

   *. Bat - batch file;

   *. Drv - driver library;

   *. Lib - library of functions;

   *. Scr - screen file (6912 bytes).


   The upper memory NeOS organizes itself
small area (1Kb) for their
domestic needs. Memory allocation in
this area is as follows:

256b - buffer command line;
512b - time domain for different

       functions;
114b - the current path


   In kernale there is a region reserved
to call some useful functions
shell. Here are their
Description:

# 00FC. Input string


   Function represents the editor
character string. It provides
the following facilities for editing:

   - The ability to move along a row
arrow keys;

   - Ability to insert symbols in
mid-line;

   - The ability to switch
Russian / Latin registers, as well as
Caps Lock.

   At the end of the set to end of line
appended code # 0D.

 Input: HL - address of the edit buffer;

       B - the length of the input string.
Exit: -

# 00FF. Command interpreter


   The function performs the action specified in
command line. If interp +2 and interp +3
equal to zero, use the built-
Larry, otherwise -
appearance, which indicates this
variable.

 Log in: -
Exit: -

# 0102. Read number


   The function reads from a string 16-bit
number. The number can be in
hexadecimal and decimal
form.

 Input: HL - address of string.
Output: HL - a limited number;

       DE - the address in the following numbers;

       C = 0 - number of considered successful;

       C = 1 - error while reading.

# 0105. Shut AY


   The function is similar to the SILENCE
shell.

 Log in: -
Exit: -

# 0108. Change directory


   Function is similar to the CD
shell.

 Input: HL - address of string.
Exit: -



; *** Labels from 0 to 16383.

DRV_BEG equ 23831; # 5D17
ERR_SP equ 23827; # 5D13
ERR_JP equ 23829; # 5D15
F_DRV equ 23844; # 5D24
F_LIB equ 23851; # 5D2B
F_RES equ 23858; # 5D32
HK_INT1 equ 23810; # 5D02
HK_INT2 equ 23812; # 5D04
HK_INT3 equ 23814; # 5D06
HK_INT4 equ 23816; # 5D08
HK_INT5 equ 23818; # 5D0A
HK_NMI equ 23820; # 5D0C
HK_ERR equ 23808; # 5D00
LIB_BEG equ 23835; # 5D1B
NEOSFD equ 23865; # 5D39
PROGRET equ 23825; # 5D11
RES_BEG equ 23839; # 5D1F
STACK_P equ 23823; # 5D0F
TEMPFA equ 23296; # 5B00
TOTR equ 23913; # 5D69
VARLEN equ 23843; # 5D23
abhl equ 234; # EA
adddrv equ 90; # 5A
addlib equ 96; # 60
agetcel equ 240; # F0
agetatr equ 243; # F3
alloch equ 117; # 75
allocl equ 120; # 78
atrf equ 1; # 1
border equ 5; # 5
brd_l equ 46; # 2E
brd_r equ 48; # 30
brd_u equ 50; # 32
brd_d equ 52; # 34
buttons equ 54; # 36
cd equ 264; # 108
chpag equ 114; # 72
chpagl equ 144; # 90
chdrv equ 204; # CC
cinterp equ 255; # FF
click equ 84; # 54
cls equ 147; # 93
clw equ 150; # 96
countrs equ 68; # 44
csymdrv equ 156; # 9C
curpage equ 27; # 1B
curdbl equ 39; # 27
dabhl equ 237; # ED
dbhl equ 228; # E4
drbox equ 189; # BD
drive equ 33; # 21
drvnum equ 34; # 22
drivdsc equ 35; # 23
drivtab equ 37; # 25
dskerr equ 41; # 29
exprog equ 87; # 57
fdrvcal equ 210; # D2
filatr equ 153; # 99
flags1 equ 57; # 39
flags2 equ 58; # 3A
fontadr equ 4; # 4
freeh equ 123; # 7B
freel equ 126; # 7E
getmax equ 129; # 81
hpagchg equ 141; # 8D
interp equ 70; # 46
keywait equ 78; # 4E
keywclk equ 81; # 51
lastkey equ 16; # 10
lastki1 equ 20; # 14
linput equ 252; # FC
limcrd equ 12; # C
mesger equ 165; # A5
mprealc equ 132; # 84
neos_r equ 59; # 3B
neostmp equ 63; # 3F
nmi_hnd equ 102; # 66
opendrv equ 105; # 69
openlib equ 108; # 6C
openfil equ 207; # CF
paginf equ 135; # 87
pagset equ 138; # 8A
pagemp equ 21; # 15
pnum8 equ 168; # A8
pnum16 equ 171; # AB
pnum32 equ 174; # AE
pnt_x equ 42; # 2A
pnt_y equ 44; # 2C
ports equ 29; # 1D
putch equ 159; # 9F
puts equ 162; # A2
putspr equ 198; # C6
raminfo equ 111; # 6F
ramtop equ 25; # 19
rbytes equ 213; # D5
rblock equ 219; # DB
rbhl equ 225; # E1
remdrv equ 93; # 5D
remlib equ 99; # 63
recdisk equ 201; # C9
readnum equ 258; # 102
repwait equ 17; # 11
reprate equ 18; # 12
repcnt equ 19; # 13
scrlup equ 177; # B1
scrldw equ 180; # B4
screup equ 183; # B7
scredw equ 186; # BA
scrtatr equ 246; # F6
scratr equ 0 # 0
scrcrd equ 2; # 2
scrbeg equ 67; # 43
sens_x equ 55; # 37
sens_y equ 56; # 38
silence equ 261; # 105
strcmp equ 249; # F9
styles equ 6; # 6
sysinfo equ 75; # 4B
symdrv equ 14; # E
textwin equ 8; # 8
vmenu equ 195; # C3
wbytes equ 216; # D8
wblock equ 222; # DE
window equ 192; # C0
zbhl equ 231; # E7



   The general concept of Brainwave BIOS v1.0



   Brainwave BIOS is the core
OS NeOS. BIOS
gives the programmer a set of
certain management functions
system. All functions can be divided into
several types:

   - System-wide functions;

   - Functions to work with drivers and

     libraries;

   - Memory management functions;

   - Functions of the disk;

   - Functions to the screen;

   - Other features


   Appeal to the system functions is
by kernalya located in
a specific point of ROM. As
improvement of the system will grow and
kernal, but all the old features will be
remain in their seats.

   Many of the BIOS functions do not check
the correctness of input data. This
done to improve the speed of their work.

   To control external devices
system provides an opportunity
install the appropriate drivers.
Each driver can have its
their own internal functions. For
each type of device installed
certain standard functions
driver. Thus, replacing
devices in a similar but
implemented differently, it suffices to replace
driver.

   Since the BIOS provides only a minimum
necessary functions, the programmer can
plug in their own libraries
functions. Certain types of libraries (in
according to their purpose) and
set the standard. Thus, when
create a new library of any type
painlessly as possible replacement of the old
library to the new without losing
compatibility.



         Restarts the system BIOS


RST # 0: Reboot system


   Complete system reboot. Intercept
This restart is impossible.

RST # 8: Error manager


   Error handler. Follow the instructions
RST # 8 indicates the error code. When
value HK_ERR equal to 0 is called
standard error handler, otherwise
If the transition goes to the specified address.

RST # 1910-RST # 30: Interrupt handlers


   Restarts are designed to handle
interrupts from external prihodyashih
interrupt controller.

RST # 38: Interrupt handler


   Handler traps (IM 1).


   B # 000E is the address internal
Error Handler, and # 0016 - Address
built-in shell.



 Standards for drivers of different types

               Devices



   For resident drivers available
The following restriction: These drivers do not
to spoil the area TEMPFA. If
driver uses this field, then all
changing cells need to remember and
output to recover. If the driver of
do not use, but uses calls
functions of BIOS, then make sure to save those
Bytes TEMPFA, which uses the function
BIOS.


        Driver File Systems



   These drivers provide job
NeOS with any file system
(TR-DOS, MS-DOS, iS-DOS, etc.). After
install this driver will also be
polled to determine
membership drive.

Standard driver features:

# 00. Identify disk


   Function determines whether the disk belongs to
this device on a given file
system. Upon successful identification
sets the root directory of the current.

 Log in: -
Output: Z - disk belongs to the system;

       NZ - disk does not belong to the system.

# 01. Set system variables


   The function sets the system
variables to work with the system.

 Log in: -
Exit: -

# 02. Catalogue info


   Function gives basic information about
current directory.

 Login: IX - a pointer to the descriptor

            directory.
Exit: -

# 03. Close file


   The function closes the file. If the current
Sector file is not recorded, it
written, if I am heading
file is recorded and the title.

 Login: IX - file descriptor.
Output: Z - file closed;

       NZ - error closing.

# 04. Create file


   The function creates a file of unit length. In
file descriptor to be filled
the first 26 bytes.

 Login: IX - file descriptor.
Output: Z - file is created;

       NZ - the file is not created.

# 05. Read bytes


   The function reads a sequence
bytes from the file.

 Login: IX - the file descriptor;

       BC - the length of the sequence;

       HL - address of the boot.
Output: HL - address after boot;

       Z - reading success;

       NZ - move abroad file.

# 06. Write bytes


   The function writes a sequence
bytes in the file.

 Login: IX - the file descriptor;

       BC - the length of the sequence;

       HL - address of record.
Output: HL - address after recording;

       Z - the CD has been successful;

       NZ - can not write.

# 07. Set file position


   The function sets the file position.

 Login: IX - the file descriptor;

       BC - position (lower 2 bytes);

       HL - position (highest 2 bytes).
Output: Z - position is set;

       NZ - there is no such position.

# 08. Delete file


   The function deletes the file. Do not remove the Read
only files.

 Input: HL - the file name.
Output: A = 0 - file is deleted;

       A = 1 - no such file;

       A = 2 - Read only.

# 09. Set file attributes


   The function sets the file attributes.

 Input: HL - the file name;

       C - attribute.
Output: A = 0 - attributes set;

       A = 1 - no such file;

       A = 2 - can not install.

# 0A. Create directory


   The function creates a directory.

 Login: IX - the name of the directory.
Output: A = 0 - directory is created;

       A = 1 - there is no place for creation;

       A = 2 - can not create.

# 0B. Delete directory


   The function removes an empty subdirectory.

 Input: HL - the name of the directory.
Output: A = 0 - all OK;

       A = 1 - there is no directory;

       A = 2 - impossible to remove.

# 0C. Set path


   The function sets the directory for
one level deeper than the current (or
return to a higher level or to the root
directory). If the string is
are two characters point '.', then there
transition to a higher level. If the point is one,
then go to the root directory.

 Input: HL - address of the directory name (19b.).
Output: A = 0 - the path is established;

       A = 1 - there is no path;

       A = 2 - can not install.

# 0D. Get file number


   Function on the file name gives the number of his
descriptor in the directory.

 Input: HL - filename (16 +3).
Output: A = # FF - no such file;

       other values ​​of A - number of

       descriptor file (0-253).


# 0E. Get catalogue cell



   Function gives a file descriptor
starting at a particular location.

 Input: C - number of the initial file;

       B - number of items to

           reading;

       HL - address of where to put opsateli.
Exit: -

# 0F. Reread FAT buffer


   The function updates the buffer FAT.

 Input: C - sector number FAT.
Exit: -

# 10. Disk Info


   Function gives basic information about
disk.

 Login: IX - pointer to handle the disk.
Exit: -



        Drivers character output



   These drivers provide output
single characters on the screen and other
possible character display device.

Standard driver features:

# 00. Print character


   Function displays a single character on
screen. Code # 0D - linefeed (CR + LF)

 Input: C - character code (# 0D - CR + LF).
Exit: -

# 01. Set coordinates


   The function sets the coordinates of the print
characters on the screen. Positioning
is the current text box.

 Log in: BC - coordinates;
Exit: -

# 02. Init driver


   Initialize the driver and setting up on
current text box.

 Input: C = 0 - initialize the driver

       C = 1 - restore the original

             video mode.
Yield: BC - the character size in pixels

            Basic Mode Spectrum

            (256x192). Size equal to # FF

            means that this

            coordinate size of the unstable

            (B - y, C - x).

       DE - limiting the coordinates X and

            by Y, are available when a text

            window specified on the screen.

# 03. Put string


   The function outputs the string of characters.
Marker for the end of the line is the code # FF. In
line can meet the following
control codes:

  db # 10, N - Set the color of ink N;

  db # 11, N - Set the color of paper N;

  db # 12, N - Installation bright N;

  db # 13, N - install flash N;

  db # 14, N - setting current attributes;

  db # 16, X, Y - coordinate the installation print.

 Input: HL - address of string.
Exit: -

 Driver-volatile memory (CMOS)



   These drivers are provided for
access to CMOS, get the current time
etc. The CMOS stores some settings
NeOS.

Standard driver features:

# 00. Read byte from CMOS


   The function reads a byte from CMOS.

 Input: L - number of bytes in the CMOS.
Output: A - bytes read from the CMOS.

# 01. Write byte to CMOS


   The function writes the byte in the CMOS.

 Input: L - number of bytes in the CMOS;

       E - value to write.
Output: Z - write was successful;

       NZ - can not write byte.

# 02. Read time from CMOS


   The function reads the time from the CMOS.

 Log in: -
Output: L - seconds;

       H - minutes;

       E - watch.

# 03. Read date from CMOS


   The function reads a date from the CMOS.

 Log in: -
Output: L - number;

       H - per month;

       E - day of the week;

       D - per year.

# 04. Write time to CMOS


   The function writes the time in CMOS.

 Input: L - seconds;

       H - minutes;

       E - watch.
Output: Z - has been established;

       NZ - can not set the time.

# 05. Write date to CMOS


   The function writes the date in CMOS.

 Input: L - number;

       H - per month;

       E - day of the week;

       D - per year.
Output: Z - date set;

       NZ - can not set a date.



        Disk device driver



   These drivers provide job
NeOS with disk devices. Drivers
file systems do not work yourself to the disk
and use the features of this type
drivers.

Standard driver features:

# 00. Get info about drive


   Function gives basic information about
device.

 Input: C - Sector size (256/512 = 1 / 2)

       DE - address where to put the table

            describing the device.
Exit: -

# 01. Read sectors


   The function reads a sequence
sectors from the device.

 Input: HL - address of the boot;

       B - number of sectors;

       DE - number of the initial block;

       C - number of sectors in the block.
Output: A = 0 - the sector is read;

       A = 1 - a nonexistent block;

       A = 2 - invalid number of sectors;

       DE - unit number after the reading;

       HL - address after reading;

       C - number of sectors in the block.

# 02. Write sectors


   The function writes a sequence
sectors on the device.

 Input: HL - address of the boot;

       B - number of sectors;

       DE - number of the initial block;

       C - number of sectors in the block.
Output: A = 0 - the sector is read;

       A = 1 - a nonexistent block;

       A = 2 - invalid number of sectors;

       DE - unit number after the recording;

       HL - address after recording;

       C - number of sectors in the block.



        Format accommodate drivers

           and libraries in memory



   Drivers and libraries in
memory as a "chain". That is the beginning
Each driver / library is
link to the next unit of the chain. So
way to search for a specific
driver / library, you must go on
chain. On the one hand, this structure
slows down access to the drivers
but on the other hand this method
removes the limitation on the number of
simultaneously installed
drivers / libraries and their number is limited
Only free memory.


   Header format drivers / libraries



Offset Length Description


  0 2 next page number

               Driver

  February 2 address of the next driver

               (# FFFF-end of the chain)

  April 1 a flag byte driver

  May 1 Length of the driver's name

  6 ... Driver Name
 ... ... The body of the driver



   The first 4 bytes - a reference to the following
driver / library and the rest are
information about the driver / library.
The length of the name of the driver / library should not
exceed 16 characters.


   The layout of the flag byte (0 / 1):
bit 0: Controls whether the file system

       (No / yes);
bit 1: reserve;
bit 2: resident / resident driver;
bit 3: is a character device

       O (no / yes);
bit 4: activity / inactivity of driver

       (For resident driver);
bit 5: reserve (should be 0);
bit 6: same bat 5;
bit 7: same bat 5.


   For a library, a flag byte can not be held
no information.


   To refer to a specific
the driver must do the following
Operations:

  - Open the driver (a function of BIOS);

  - On the received address / page

    apply to the driver.

   Number of driver functions specified in
register A.


   The system must
attend the following drivers:

  - Keyboard driver (kbd.drv);

  - Driver CMOS (cmos.drv);

  - Print driver is a character (symXX.drv);

  - Driver (s) disk drives

    (Fdd.drv / hdd.drv / cd.drv / ram.drv etc);

  - Driver (s) file systems (trdos.drv,

    msdos.drv, isdos.drv etc).


   Reserved a number of standard
Names of drivers for certain types of
Device:

  - Mouse.drv - mouse;

  - Joystick.drv - joystick;



        Format driver library



   The library serves as a driver for
shared storage of the same type of drivers.
Drivers are stored in a movable form,
ie You can download the driver at any
memory area and configure it to work
in its special function (source for
work with the driver library
attached to a set of delivery NeOS).


       Header Format Library



Offset Length Description


  0 4 Id "DLIB"

  April 1 Number of drivers in the Bible.

  May 3 Reserve

Total 8 bytes.


   Next come the headlines drivers.


        Header format driver



Offset Length Description


  0 16 Name of Driver

  Feb. 16 start position driver

               (Relative to the

               drivers, and not from the beginning
               la files)

  February 18 The body length driver

  February 20 number of elements

               matching pattern

  January 22 a flag byte driver

  January 23 Reserve

Total 24 bytes.


        Format storage driver



   First comes the body of the driver
compiled at address 0. Then comes
matching pattern. Matching pattern
consists of a two-byte pointers
asbolyutnye address in the body of the driver
relative to its beginning. 6 and 7 bits
High Byte pointer - a reserve for
further improvements in the format.
Thus length of the driver may not exceed
16K.

   Due to the characteristics when setting
there is some restriction on the code
Driver: absolute addresses within the body
driver must be listed 2
sequence of bytes. That is, for example,
appeal to the table can not be done
as follows:

     ...

     ld a, offset

     add a, TAB \ 256 ml. b. address table

     ld l, a

     adc a, TAB/256; Art. b. address table

     sub l

     ld h, a

     ...
 TAB db 0,1,2,3,4,5

     ...



     Function "Driver / library manager"



   This set of functions responsible for the
drivers and libraries. Number
simultaneously installed libraries
drivers is limited only by memory
computer as a driver's memory and
libraries are located in a "chain"
that is in front of each driver / library
is a reference to the next. Drivers
divided into two types:

   - Resident, that is working on
interrupt;

   - Non-resident, that is caused by
program specifically, but not automatically.

   Prerequisite is
find the first driver and libraries
low memory (# 0000 - # BFFF). Since the ROM
must present at least one driver
and a library, then this condition is satisfied
always.

Options:

# 005A. Add driver


   Function sets a new driver
(Any type).

 Input: HL - address of the driver;

       BC - his page.
Exit: -

# 005D. Remove driver


   Function removes the driver.

 Input: HL - pointer to name (in the lower

            memory).
Output: Z - Driver deleted successfully;

       NZ - the driver is not found.
# 0060. Add library


   Function sets a new library.

 Input: HL - address of the library;

       BC - Home of the library.
Exit: -


# 0063. Remove library


   Function removes the library.

 Input: HL - pointer to name (in the lower

            memory).
Output: Z - Library removed successfully;

       NZ - Library not found.

# 0069. Open driver


   Function searches for the driver and returns
information about it.

 Input: HL - pointer to name (in the lower

            memory).
Output: HL - address of the driver (# FFFF -

            driver not found);

       BC - page driver;

       DE - Driver header length;

       A - flags of the driver.

# 006C. Open library


   Function searches the library and returns
information about it.

 Input: HL - a pointer to the name of the library

            (At the bottom of memory).
Output: HL - address of the library (# FFFF -

            library was not found);

       BC - Home of the library;

       DE - header length of the library.



          Function "Disk manager"



   This set of functions responsible for the
with disk devices. Options
provide access to both files
directories, as well as directly to
disk sector. Almost all of the functions
executed through the appropriate
Driver, this block is
Managing and removes some of the problems with
programmer.

   In NeOS v1.0 can connect up to 19
disk devices (hereinafter will be
perhaps 26 disk drives).

Options:

# 00C9. Recognize disk


   Function determines the membership
current storage device to any
installed file system. When
successful identification is also establishes
root directory of the current.

 Log in: -
Output: Z - system is defined;

       NZ - the system is not defined.

# 00CC. Change disk drive


   Function changes the current disk
device. Determining whether
drive system is not made.

 Input: A - number of the device.
Output: Z - the choice is made;

       NZ - no such device.

# 00CF. Open file


   The function opens the file for
random access (read / write).
Before opening a file descriptor should
be set to the file name and address of the buffer
reading.

 Login: IX - file descriptor.
Output: Z - the file is opened;

       NZ - file could not be opened.

# 00D2. File driver caller


   Function makes an appeal to driver
file system. Number of driver functions
given in the register A.

# 00D5. Read bytes from file


   The function reads a sequence
bytes from the file (forwarded to the driver
file system).

# 00D8. Write bytes to file


   The function writes a sequence
bytes in the file (forwarded to the driver
file system).

# 00DB. Read sectors


   The function reads a sequence
sectors with the current device
(Forwarded to the driver disk
devices).

# 00DE. Write sectors


   The function writes a sequence
sectors on the current device
(Forwarded to the driver disk
devices).



   Function read / write bytes from / to file
made in the kernal, not only for the convenience
call. Since different devices can
be active in different file system, then
can go hand in hand to work with two
files on different
devices and, accordingly,
belonging to different systems. Function
refer to the file system driver
to the driver of this device,
a function of the read / write byte address to
device where you open the file.



     Continued in the next issue.







Other articles:

From the Author - Long time no newspapers ...

NEOS - Description of a new operating system for the Spectrum.

WANTED - Searching software ...

Advertising - Advertisements and announcements ...


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

Similar articles:
Gameland - the passage of Lords of Time on Level 9.
WANTED - Searching software ...
Championship VIRUS-2 - Create and edit viruses - where to start? .. Championship the week of 32 viruses.

В этот день...   3 December