| 
                            ZX Format #06
            
                         29 июля 1997          | 
        
             | 
    
IS-DOS - the programmer: a short course - programming in IS-DOS.

 Category "IS-DOS - programmers" No 6.
music by Ironman
(C) Leont'ev, AG
_______________________________
 SHORT COURSE
PROGRAMMING ENVIRONMENT IS-DOS.
  (Under the general editorship Eliseev VA)
 Continued from the No 5.
 From the Editor.
Hello, dear readers!
Today, under the heading "IS-DOS - the programmers," we 
continue to publish a new book by A. Leontiev, begun in the 
last issue of the magazine. For those who still do not know 
announce that Alexey Leontiev is a leading systems programmer 
Division IS-DOS, a recognized authority in the field of our 
system, one of the Fathers "IS-DOS.
     We hope that this book will help you
in the development of programming vsrede
IS-DOS and joins the ranks of programmers,
able to write under the IS-DOS, new talents, and our range of 
programs - new developments, including, among Incidentally, 
there may be yours. 
- So:
 Leontiev
   WHAT TO DO?
                   or
   How to Stop Worrying and Start
        Program in ISDOSE
6. WAS IST DOS?
 or lowest level
 (0th level, he is "DOS.SYS")
The lower level of the system in the iS-DOS
(Restarts from # 00 to # 1F) works with the cache,
block and character devices, channels and interrupts. This 
level is not know any of the files or the command line, or 
about the windowing technology. All these engaged in higher 
levels. 
So, more on the restart:
The first 7 (from # 00 to # 06) Restarts
the level of "DOS" working the so-called
"Cache", so first a few
words about what it actually is.
     So the cache block devices - it
system buffer is used exclusively for blocks (256 bytes) of 
which all block devices. 
     A cache is created restart $ creat (# 00).
The system automatically creates it for
loading, as well as the output of the system to
restart $ shel0 (# 80) or RET'u with values # F6 # F7 or in 
the register and the processor. 
     His re-creates some batch files, such as copiers. They do 
so mainly to reduce cache size, and thus win
a few kilobytes of memory for the buffers, and
also to return after the cache
former state.
     As mentioned at the outset
books, the system iS-DOS occupies memory ZX
top to bottom, and the cache that is created in the last turn 
is under the system. Top it limited to the channels. Top 
address of the cache can get out of vector system configuration 
g_cnf, using the restart $ g_cnf (# 10) offset 32: 
LD C, # 10; $ g_cnf, returns
       RST # 10; HL 'address vector
       EXX; address - in the HL
LD DE, 32; add an offset
ADD HL, DE
LD E, (HL); get in DE
       INC HL; desired upper
       LD D, (HL); address cache
Low address cache, of course, depends on the upper address. If 
you have a catastrophic shortage of memory, you can remove 
unnecessary residents (this will help you with the key set.com 
/ e). You can also podsokratit range of channels that can
do channel.com. This will cause the displacement of the entire 
cache area up and, consequently, raise and lower its boundary, 
freeing up memory for your purposes. However, of your program 
the easiest way to reduce cache.
     Cache size, which is installed by
default, lies in the vector g_cnf offset +7. Address the lower 
boundary of the cache is in the same vector with the 
displacement +5 And +6. If necessary, it can be calculated 
using the formula (1): 
CACHE = DGCHN - CSIZE * 260 (1)
where CACHE - the desired address is the lower boundary
cache, DGCHN - the start address of channels, and CSIZE - cache 
size in blocks. 
At this location is the cache directory as an array descriptor 
blocks (4 bytes for each block of cache) after which the blocks 
are located. 
  The structure of the cache:
Bias Size Description
of
  0 EDSIZ * 4 cache directory is
                 4-byte description
                 carriers of blocks:
  0 4 Descriptor Unit 1
  April 4 handle 2-Unit
  April 8 descriptor third block
 . . . . . . . .
  EDSIZ * 4256 1 st block
        256 2 nd block
        256 3rd Block
 . . . . . this is actually a body
                 cache, the address of storage
                 nitsya Vector g_cnf
                 offset -5.
where EDSIZ - cache size.
Descriptor block imeetsleduyuschuyu
structure:
Mixed-Time-Description
alkaline-measures
of
0 1 status register block
  combined with the number of devices
  properties. Bits:
   7 - modified unit (1)
     6 - block protected (1)
   5 - block exists (1)
   4 - not used
   3 .. 0 - number of the device
  who owns the block.
January 1 the reference count to the block
February 2 block number on the device.
ММММММММММММММММММММММММММММММММинимальный cache size is 6 
blocks. Optimal in the iS-DOS Classic - 20 to 30, in CHIC - 40.
     Cache is required for file
service. Through it, the system accesses
devices, ie reads and writes file descriptors directory, a map 
of occupied blocks of devices, device headers, etc. If there is 
insufficient space in the cache is sacrificed oldest schitanye 
block. 
     Record also carried out through
cache, and the system and has no other buffers, so the unit 
just modified, I mean is modified directly in the cache, and in 
the descriptor cache is set to one seventh bit. 
     With the accumulation of modified
blocks their record on the device, and bit
modification reset. This action
called "automatic flush" or "auto-flush" (flush in English 
"sink", not be confused with the flash - flash - the "flash", 
and also flesh - flesh - "flesh". Please
say from a purely Oxford prononsom!)
 And finally, restarts:
   # 00 - $ creat
Creates and recreates the cache. The required size of the 
blocks must be submitted in register A. The contents of other 
registers for work do not affect the restart. 
     At the exit check flag C. In the case of an error it will 
be set to "1" The only possible error - Error 130
- Lack of memory, ie, input value
register A is so large that the cache does not fit above the 
address Utop (User Top). 
     Get address Utop you can apply restart $ g_cnf (# 10) 
(offset +3 vector g_cnf). Utop serves mainly
fuse from lowering the cache so
low that the program is in the process set.com
work would kill them myself. Therefore,
usually Utop = 26676.
     Restarting $ creat (# 00) clears the blocks
size of 256 bytes for the lower boundary
of channels ($ g_cnf (# 10), offset
+32) In the amount indicated in the register
A, and creates a cache directory (by 4 bytes
each block).
     Work with a cache size of at least 4
blocks unsafe (the program at this
simply not designed). Recommended sizes from 6 .. 10 blocks at 
least (if you want to win more memory for buffers for programs 
or data) to 30 or even may 70 (in iS-DOS Chic, of course).
     Although increasing the cache after 20 blocks almost never 
gives a significant gain in speed of the program. To restore 
the size of the cache by default suggest primerchik this here:
LD C, # 10; $ g_cnf
       RST 1916
       EXX; in HL - address of the vector
       LD BC, -6; offset -6, here
       ADD HL, BC; stored cache size
                    By default
LD A, (HL); put the size of A
       LD C, # 10; $ creat
       RST 16; recreates the cache
       RET C
When calculating the amount produced
cache, if you know the upper and lower bounds of it, you can 
use the formula (2) logically follows from the formula (1):
             DGCHN - CACHE
 CSIZE = -------------- (2)
                  260
where CSIZE - the desired cache size, DGCHN -
the lower boundary of the channel, it -
upper limit of the cache, and CACHE - lower
boundary of the cache.
Example:
LD C, # 10; $ g_cnf
       RST 1916
       EXX; in HL - address of the vector
       LD BC, 32, offset 32
       ADD HL, BC
       LD E, (HL); in DE - address the top
       INC HL; border Cache
       LD D, (HL)
       LD HL, CACHE; it - the required lower
                    ; Lower boundary cache
                    , Below which all parameters
                    ; Crease can be used
                    ; Use your
                    ; Program
EX DE, HL; subtract CACHE
       SBC HL, DE; of DGCHN
XOR A
       LD DE, 260; divide the result
A $ SBC HL, DE; 260
       INC A
       JR NC, $ 1
DEC A; check, did not
       CP 6; whether CSIZE less
       JR NC, $ 2, 6 blocks
LD A, 130; No room! Output from
       RET; error 130
                    , The error code in reg. A
2 $ LD C, # 00; $ creat
       RST 16; recreates the cache
       RET C
...
   # 01 - $ clear
Clearing the cache on blocks of the current device. This 
operation is necessary for changes in the floppy drive or 
abandonment unloading the disk blocks modified restarts $ modwr 
(# 03), $ modo (# 2E), $ Wpart (# 2A), when the auto-flush has 
not occurred, as well as in writing to the disk by cache 
blocks, read through a cache, so that disk cache and match.
When rakbote restart all the information
available in the cache is lost.
     If the cache contains modified
blocks, and you want to save them, then restart ne 
redochistkoyvyzovite $ Flush (# 02). Errors after a call to be
be. No input parameters.
Example using $ clear restart
taken from the program format.com:
This - the beginning of the procedure format. Perhaps, before 
formatting was changed disc. Therefore, the cache must be 
cleared restart $ clear (# 01). This example also
will be useful for better understanding of restarts $ g_blk (# 
13), $ g_drv (# 14) $ Binit (# 0F), which will be considered
us further.
     First, using $ g_blk (# 13), we find the current block 
device and obtain the address of the body corresponding driver.
     Next, check whether this is
drayverdrayveromfloppi drive
sys_driv.blk, ie whether it is possible to format the device 
via TRDOS. 
     Then we try to open the device as a block device IS-DOS
restarts $ binit (# 0F) and $ open (# 20) so that
prevent accidental reformatting existing disk:
       LD C, # 13; $ g_blk
       RST 16; get in a room
                    , The current block
                    ; Device
       INC C; $ g_drv
       RST 16; know the address of its
       RET C; driver
       EXX; in HL - address of the body
                    ; Driver current
                      ; Block device
And here we check whether this is
; Driver drive
LD BC, 9
ADD HL, BC
       LD (DRCSR +1), HL
       RES 7, (HL)
; Not call $ erdrv (1F) for errors in the
; Drive
LD C, # 01; $ clear
       RST 16; clear the cache
LD C, # 0F; $ binit
       RST 16; initialize
                    ; Device
       JR C, FOR_1; transition at about
                    ; Cedure Format
                    ; Tion, if the device
                    , The set does not exist
LD C, # 20; $ open
       RST 16; try to open
                    ; Device
       JR C, FOR_1; dropping down to the
                    ; Screening, if not
                    , Opens
...
FOR_1; located here
                    ; File formats
                    ; Derivations drive
       ...
   # 02 - $ flush
Restarting $ flush (# 02) is required for
fixation on any block device
(Disks or electronic disk)
changes made in the cache after recording restarts with $ modwr 
(# 03) $ Modo (# 2E), $ wpart (# 2A), $ crfil (# 23)
$ Erfil (# 24), etc.
     All of the above restarts modifitsirut blocks in the 
cache, it is natural that these changes must eventually be on 
the disk. 
     The fact that the cache block device has been created 
firstly to accelerate the work of lower levels of the system, 
so twice and three times not to read from the device
the same blocks. In addition, the system was
need a buffer for his work with directories and files.
     In this regard, the record on a device, in most cases it 
carries out directly and not climbing with each new block on 
the disk, and marks the block in the cache as "modified" that 
is, set to 1 one of the bits of the descriptor blocks in the 
cache. 
     When a certain number of modified blocks (usually
it is equal to the size of the cache divided by 2
or cache size minus 3) an automatic flush. In this case, 1 is 
set first bit 1 of the first byte of the vector block device.
Input parameters of this restart
no. Various error at the output,
For example:
Cache errors:
 61 - the specified block is not found
 62 - the actual number of modified
      blocks does not correspond to the values
      Niya system variable ($ QNMOD)
 63 - the sector is protected
 64 - Cache protected
 65 - There is no place in the cache
 66 - reading prohibited
 67 - entry prohibited
Mistakes block driver sys_driv.blk:
  6 - no disk
  7 - read / write error
 20 - disk accesses aborted
If the modified blocks in the cache
the current (!) device is not, then restart does nothing.
     Suggest cause $ flush (# 02) at the end of your program 
before exiting to the shell, as well as before starting from 
your programs in some sistemnyhutilit
(Copy25.com, for example) and before peresosdaniem cache memory 
when released. 
     If your program is written through the cache
several different block device
(Example: current T:, the system S:, quick Q:), then do not 
forget to flush on Each of these devices, switching to
them with the restart of $ swblk (# 1C) or
$ G_sta (# 37).
an example of output from the program, modifying the blocks on 
multiple devices at once, say, Q, S and T: 
LD A, "Q"; device "Q"
       CALL FLUSH; subroutine call
       RET C
LD A, "S"; device "S"
       CALL FLUSH; subroutine call
       RET C
LD A, "T"; device "T"
       CALL FLUSH; subroutine call
       RET C
And here is the restoration of the environment,
, Which was at the time of launch
LD C, # 41; $ fmrst
       RST # 10; call restart
       RET C
, Output in the shell with a reprint of the screen
, The standard method
XOR A
       LD A, # F4
       RET
; Routine FLUSH
, First transform the logical name
; Device ("S", "Q", "T") in physical
F; number (0 .. 7)
FLUSH LD C, # 4A; $ dvtrn
RST # 10
       LD B, A; device number
                    ; Put in the reg. B
, Switch to the appropriate
F; device
LD C, # 1C; $ swblk
RST # 10
       RET C
Behold now, actually, flush
LD C, # 02; $ flush
RST # 10
       RET; return from
                    ; Routines
   # 03 - $ modwr
Write one block (256 bytes) to the address filed with the HL to 
the current block device and block number filed in
DE. Entry occurs through a cache, ie
First released in the cache location - Kicks oldest schitanye 
block - and in its place are transferred set 256
bytes.
     New unit gets its own number and unit number (0 to 7) and 
immediately flagged as modified. If you overfill the modified 
blocks in this did not happen, then it all and ends
otherwise, there is an automatic flush,
ie physical record of modified
blocks on the current device (by means
  property driver access).
     When working a restart may fail,
so that after his call, we recommend checking flag C. Error 
codes are the same as in $ Flush (# 02).
     Restarting $ modwr (# 03) is convenient when working 
directly with the device (bypassing file). Do not forget 
tolkovyzvat $ Flush (# 02) at the end of the program!
      Primerizzhizni: program
arzt +. com, to be exact - to a portion in which the recording 
device is altered table occupied units: 
$ MODWR LD HL, $ BUFF; address worker
                         ; Put buffer
  , In ref. HL
       LD DE, 1; Room 1
                         ; Block - in DE
       LD A, ($ MLTRD +2); the number of blocks
       LD B, A; put in B,
                         ; It - the counter
                         ; Later
                         ; Cycle
       LD C, # 03; $ modwr
3 $ RST # 10
       RET C
       INC DE; call in the loop
       INC H; for all blocks
       DJNZ $ 3, in turn,
RET
   # 04 - $ unird
Doubles the previous restart - reading a single block device 
cache. In HL put the address in DE - block number on the device.
     If the unit is not in the cache, the procedure
reads it from the driver. Flag C on
output reports unsuccessfully held
operation. Error codes, as in the previous two cases, the 
essence of the error codes cache driver (their description, see 
$ flush (# 02)). 
     In real life, this restart is not widely applied, so as an 
example, read the 0-th block of the device to the buffer BUFF, 
clearing the front of this on Just in case (if you change the 
disk) cache 
LD C, # 01; $ clear
       RST # 10, clearing the cache
LD DE, 0, block number = 0
       LD HL, BUFF; buffer address
       LD C, # 04; $ unird
       RST # 10
       RET C
...
   # 05 - $ mltrd
Almost the same, but read just
several blocks. The number of blocks is given in
register B. First, these blocks are searched in the cache and 
copied to the designated address, then just go where ordered 
read through the driver, missing blocks, already then copied 
into the cache. 
     If the number of read blocks exceeds the cache size in 
half, then going on by reading the cache, so as not to knock 
him out of such units is often required as a directory block 
and the header device, and thus do not slow down 
  system work with directories.
     Directly read the blocks are
also in the presence of a cache of modified
blocks. You can always get to work
This restart directly with the driver, dropping the seventh bit 
of the 0-th byte of the vector block devices.
     This uses the restart restart
Reading the file $ rpart (# 29), c through which in turn runs 
all com-files system. 
     Just in case, analyze the flag C
output. Error codes are the same as that of the
$ Flush (# 02).
Example is, again, from arzt +. Com:
Card reading device occupied blocks in the buffer $ BUFF. Byte 
$ MLTRD +2 wages it is filled with the size of card: 
LD C, # 35; $ bkfcb
       RST # 10; read the descriptor
       EXX; drive and find a
       LD BC, -6; its size card
       ADD HL, BC
, Round up to whole units:
, And put at $ MLTRD +2
LD A, (HL)
       INC HL
       OR A
       LD A, (HL)
       JR Z, $ +3
       INC A
       LD ($ MLTRD +2), A
       ...
       CALL $ MLTRD; subroutine call
       ....
; Routine using $ mltrd (# 05)
$ MLTRD LD BC, # 05; $ mltrd
       LD HL, $ BUFF; buffer address - the HL
LD DE, 1
       RST # 10
       RET
$ BUFF; it - the buffer
   # 06 - $ quard
Almost the same thing as $ unird (# 04), but
block is read only in the cache (or is it). Therefore, the HL 
register input is not used, but the output
in HL 'return address block in the cache,
DE '- the address block header in the directory
cache (required for later use $ modo (# 2E)).
     At the entrance to the block number is filed DE
device.
     There are various errors (the same as
that of the restart $ flush (# 02)), therefore
Check the flag C. Convenient for residents or programs that 
wish buffers block. 
     This example is taken from the program date.com:
, Consider the 0th block device. It was there
; Stored date of loading of the system:
LD DE, 0, block number = 0
       LD C, # 06; $ quard
RST # 10
       RET C
       EXX
And to save the address read by the block (HL) and
,; Address descriptor of the block in the cache (DE):
LD (TMPHL +1), HL
       LD (TMPDE +1), DE
...
; ... Print, and change the date ...
, (These procedures are omitted here
; As unnecessary)
       ...
, Output from the program:
; In DE submits a new date value.
And compare it with stored in the 0th block
; Device and, if they differ,
, We set a new date in the 0th block and conservation; them on 
your device restarts 
  ; $ Modo (# 2E) and $ flush (# 02):
TMPHL LD HL, 0, in this empty bytes
                    ; Placed vysheupo
                    ; Myanuty address assumed
                    ; Spontaneous unit
       LD BC, 30
       ADD HL, BC
LD C, (HL)
       INC HL
       LD B, (HL)
; In BC now - the old date, few
F; from the device
EX DE, HL
       XOR A
         PUSH HL; new date
       SBC HL, BC; comparison
       POP HL
       EX DE, HL
       JR Z, SVSTYL; dates are equal. Bypass
; If the date is not equal to - put a new
; Over the old one right into the cache:
LD (HL), D
       DEC HL
       LD (HL), E
; Promodifitsiruem block in the cache:
TMPDE LD DE, 0
; In the empty bytes after DE, as you remember
, And we previously put the address of a descriptor block
; In the cache, resulting from the restart $ quard (6)
; A few lines above.
; This email address is required for $ modo.
LD C, # 2E; $ modo
RST # 10
       RET C
LD C, # 02; $ flush
RST # 10
       RET C
SVSTYL
       ...
The following 3 restart $ key (# 07)
$ Kwait (# 08) and $ ktest (# 09) with the keyboard:
    # 07 - $ key
Entered via the keyboard. Drawn
right in the first entry point keyboard driver. URL of this 
entry point lies in the driver with offset 2). If the buffer
driver is empty, then the driver turns to
ports for keyboard and waits until the key is not
is pressed.
     The output value is returned in register A. It is Avis of 
keystrokes and on the mode in which the device
input.
     The regime is determined by a null byte
vector character ustroystvavvoda
g_key, which can be obtained by contacting the
restart $ g_key (# 11).
0th byte vector.
Bits (0 / 1):
     0 - lowercase / UPPERCASE
     1 - latin / Russian
     2 - text / pseudographics
     3 - do not wait for release the keys when
           $ Kwait (8), applied to
         macros in the editor,
         reset itself when emptied
         buffer driver.
With the flag is not important. As
an example, the routine of a text editor edit.com, ignited and
An anti-cursor to the current coordinates and
pull-based keyboard with the expectation or
without (controlled by the fifth bit in edcsr):
; Switch the keyboard into the regime of small
,; Latin to get the code management
; Keys, which does not depend on the current state; yaniya. 
Third bit (macro) is masked by the eight; yardstick in order to 
preserve it, bits 0,1,2 , Reset:
$ KEY LD C, # 11; $ g_key
RST # 10
       EXX
       LD A, (HL)
       AND 8
       LD (HL), A; lat
, Switching to the current output driver
; On the screen (t42/t64):
CALL $ TYCUR
       RET C
; Positioning. Recalculate the coordinates
; In the text of xc in position on the screen and poloF; bench 
YX in HL: 
LD H, (IX + ys)
       LD A, (IX + ys-1)
       ADD A, (IX + xc)
       SUB (IX + X_skip)
       LD L, A
L_FLD C, # 0C; $ typos
RST # 10
; Light a flashing cursor in the text. position:
LD C, # 76; $ y___
RST # 10
       LD C, # 08; $ kwait
; Bypassing standby key is released:
BIT 5, (IX + edcsr)
       JR Z, $ +3
RST # 10
DEC C; 7 = $ key - input
       RST # 10; keys
PUSH AF; keep the code
       LD C, # 77; $ n___
       RST # 10; repay the cursor
POP AF; restore code
       RET
   # 08 - $ kwait
Waiting for release of keys. Restart
necessary in some cases, when
the risk of accidental double-pressed (hold) the key, for 
example at the beginning programs, called key, and also
polling the keyboard, using the previous restart.
     This - the second entry point into the driver
(Address it is in the driver offset 4). Used vrestartah
$ Smbgt (# 6E), $ edstr (# 7F), $ menu (# 91). On
Output can be anything. Example
- See the previous restart.
     This procedure is called, say,
block overlay ed0 +. ovr with the expectation of releasing the 
key before restarting $ analy (7E) after printing the bottom 
line overlay function and the function call , requires 
confirmation. 
     This call is reliable.
However, at around the block the same procedure
call without waiting for release, that
lets celebrate the big blocks by holding down and using the 
auto-repeat. 
     This restart when you call empties
buffer keyboard drivers, thus driver
"Forget" all the keys before calling the restart button. If 
this function driver does not turn off to the third bit register
state of the keyboard macros would work
only to the first $ kwait.
   # 09 - $ ktest
This restart - the third entry point into the
keyboard driver. It defines, at least one key is pressed on the 
keyboard or no. Exit at the flag Z:
- Is not pressed,
NZ - pressed.
As well as $ key (# 07), primarily
interrogates the buffer drivers where they can accumulate 
rapidly keystrokes, and which used for macros or emulation
pressed.
     This restart is useful for polling the keyboard without 
waiting for, for example interrupting the cycle. When you press 
flag on the output - NZ, and the key code will be in register 
A, as well as in the buffer driver where it is necessary to 
extract restart $ Key (# 07), otherwise it encounters another
anyone.
Example:
; This routine will return with the flag Z,
And if the key pressed was not
  , And with the flag of NZ and key code
And in case A, otherwise.
KTEST LD C, # 09; $ ktest
RST # 10
       RET Z
LD C, # 07; $ key
       RST # 10; extract "extra"
                      ; The code from the buffer drei
                    ; Faith keyboard
       OR A
       RET
The following three restarts are
for a character to display or printer, it is $ type (# 0A), $ 
tycpl (# 0B) and $ Typos (# 0C):
    # 0A - $ type
Print a character from the register A of the current symbolic O 
device (screen or printer). 
     Selecting the device (screen or printer)
can be achieved by restarting
$ Svtyp (# 1B).
     Flag of the output for printing on the screen
plays no role. Turning to the printer we can shlopotat the 
following errors: 
150 - error or printer is not ready
   151 - Printing aborted.
The latest version print.com
do not use the restart.
Print on the screen is the current position, which is stored in 
bytes 1 .. 4 of the vector character of the output device. 
Vector can take it with a restart $ g_typ (# 12). 
Bytes:
- The position of the press in line
     2 - The line number on the screen
These 2 bytes are fed into the input HL
Restart $ typos (# 0C), which transmits them
in register BC's third entry point into the driver (shift 6).
   3,4 - Address printing on the screen
It's - the upper-left byte characters. For example # 4000 for 
0-th position in the 0th row). 
Here these bytes kladutrestarty
$ Typos (# 0C) and $ wtpos (# 6B), It takes
them for printing the next character restart
$ Type (# 0A). Here he has them, and returns
after printing.
     Restart refers to the first entry point of the driver 
(offset 2 from the beginning of the driver), and the address 
printed on the screen is fed into the register DE '. This 
restart Restarts enjoy higher levels, such as $ str (# 6C), $ 
smbgt (# 6E) and etc.
   # 0B - $ tycpl
Sets the inverse / normal
print modes on the screen in accordance with
contents of register A:
<> 0 - Inverse Printing
     A = 0 - Normal mode
Do not use the printer drivers. Flag C at the outlet does not 
matter. 
     Restart using the new version
text editor for block-mark
as well as program demon.com. Drawn
in the second entry point into the driver (address of
shift 4).
   # 0C - $ typos
Specifying print position on the screen for
subsequent restarts print $ type (# 0A),
$ Str (# 6C), $ lnstr (# 6D), $ smbgt (# 6E),
$ Edstr (# 7F).
     Coordinates print specified in the register HL:
- Line number
     L - position in string.
For positioning relative to
window can also be used restart
$ Wtpos (# 6B). Flag of the C output value is not
has. This restart is using the third point
entrance to the driver (shift 6).
     The old printer drivers, this point has not been used in 
new, it is responsible for printing a symbol from the register 
A without conversion.
Here's how to use restarts $ typos and
$ Type program exebat.com Print command prompt from the system 
clipboard: 
; Check for 8-th channel (channel
; Driver symbol O), because prog; Ramm should work even when
; Print nothing:
PRINT LD A, 8; ty42
       LD C, # 16; $ stchn
       RST # 10
       RET C
; Positioning:
SBC HL, HL; HL = 0: upper row
       LD C, # 0C; $ typos
       RST # 10
LD C, # 45; $ g_com
       RST 1916
       EXX
; HL = address of the system buffer
LD BC, # 2A0A; $ type
; B = # 2A = 42, so the letters placed in a
; Line on the screen, # 0A - $ type
; Print the string to the character # D:
1 $ LD A, (HL)
       CP # D
       JR Z, $ 2
RST # 10
       INC HL
       DJNZ $ 1
       RET
; Overprinting gaps:
F2 $ LD A, ""
       RST 16; C = $ type (see above)
       DJNZ $ 2
       RET
Three restart, to the driver
block device:
    # 0D - $ read
Reading blocks directly to the driver
the current block device.
HL - address
DE - number of the block device
 B - number of blocks.
Flag C at the outlet - a sign of failure.
Errors, only those that gives the driver. So
RAM disk driver usually does not give errors, though nothing 
prevents integrate into the test, say, the numbers
unit at too great a number or the number of
read blocks to 0, or insert checksum block.
In the driver sys_driv.blk possible
errors are as follows:
  6 - no disk
    7 - Sector not read
 20 - reading is interrupted.
Typically, the driver floppy disk work out these situations 
referring to restart $ Erdrv (# 1F) (see below). Restart refers 
to the first entry point to the driver. 
This example is taken from the life of copiers:
beginning of the working cycle of the program abc.com.
In bytes INDSK +2 and OUTDSK +2 placed numbers of input and 
output devices. 
; B = number of blocks to read / write
COPY PUSH BC
INDSK LD BC, # 1C; $ swblk
       RST # 10
       POP BC
       RET C
LD HL, BUFF; buffer copying
       LD C, # 0D; $ read
       RST # 10
       RET C
PUSH BC
OUTDSK LD BC, # 021C; $ swblk - to C
       RST # 10
       POP BC
       RET C
LD C, # 0E; $ write
       RST # 10
       RET C
...
   # 0E - $ write
Recording B address block to the current HL block device 
(floppy disk, RAM disk or hard drive) from
Loka number DE.
     In IS-DOS any block device
consists of a logical block size 256
(# 100 hex) bytes, which is very convenient for
calculations in the assembly.
     Recalculation of the unit number to track the direction 
and the sector is engaged in the driver. Driver floppy disk is 
configured to format IS-DOS floppy disk itself restart $ binit 
(# 0F). This - the second entry point into the driver.
     Since this is a direct appeal to the device without going 
through the cache, it is recommended immediately after calling 
this restartavyzvat $ Clear (# 01) or $ creat (# 00) in order 
to avoid confusion in the cache blocks and blocks on the device!
     The situation with the possible errors is the same as that 
of the $ read (# 0D). Example also see above.
   # 0F - $ binit
AutoConfig driver floppy disk
the format of the IS-DOS disk. Reads the 0-th
unit disk, check for signs
"DSK" at offset 10. If there is no sign,
then exits with an error 9. Otherwise - is configured on the 
parameters of the disc lying on Displacement:
22 Number of cylinders
23 disc type (number of sides)
24 Sector size (1/2/4: 256/512/1024)
   bytes
25 Number of sectors per track
64 rooms sectors (up to 16 pieces)
It is also possible error 10 - an attempt to
work with two-sided disc on a single drive or from the 80-track 
on 40-track. This third entry in the driver.
Is not commonly used in electronic driver disk and hard drive 
(there put "caps" for compatibility). 
     This restart is useful to call for
first address to the new block device driver to configure the 
disk and to make sure that this is
IS-DOS device. In addition to errors 9 and 10
may issue an error reading: 6, 7 and 20.
The driver can be configured to work
formats with TR-DOS and MS-DOS, but restart
here is not much help.
     In such cases it is better to find a driver
by restarting the $ g_drv (# 14), make sure that this is the 
driver floppy disk, and the displacement of 34 (dec) Change 
sector size, number of sectors and Table Sectors.
     As an example, we recommend passage of format.com given 
after the description of the restart $ clear (# 01). 
  Structure descriptor
           device (disk)
  0th BLOCK: (0th sector 0th track)
mixing-length comments
G slit on
of
 0 2 Not Used
 August 2 Device Name
March 10 Symptom iS-DOS: "DSK"
May 13 Not used
Feb. 18 Unit size
  (In blocks of 256 bytes)
February 20 number of 0-th block of the main
  Catalog
January 22 Tracks on the Device.
January 23 disc type. Bits (0 / 1):
       0 - 40/80 tracks
    1 - 1 / 2 sides
January 24 Sector Size:
  1/2/4: 256/512/1024 bytes
January 25 sectors in the dor.
January 26 Not used
January 27 Rear. $ 32 byte
    Descriptor ????_ dos.sys
Feb. 28 Not used
February 30 Date
32 32 descriptor ????_ dos.sys
64 16 Table number of sectors
  on track
1st Block: Bit-map of the device.
           1 bit / block: 0-svoboden/1-zanyat
Descriptor ????_ dos.sys offset
32 placed in the 0th blokprogrammoy
con.com ischityvaetsyazagruzchikom
boot.sys.
Well, that's all for today. In the next issue we will continue 
to publish books Leont'eva. Next will be considered by the 
remaining restarts Level DOS.SYS numbered from # 10 to # 1F.
     We will be glad to hear your feedback
and suggestions, as well as you noticed errors, ambiguities and 
errors are inevitable in the writing and preparation of such 
texts. 
     Write, call us or to the Editor
magazine, remember that it is due
your interest in our system, it is up to
still exists and develops.
_______________________________
 
Other articles:
        Similar articles:
                
            
            
            
            
    
    В этот день...   4 November