ZX Format #04
14 июня 1996

Programmers - Guide to shadow service monitor Scorpion ZS 256.

<b>Programmers</b> - Guide to shadow service monitor Scorpion ZS 256.
(C) 1996 A. Larchenko
_________________________________________


  Offer readers ZX Format article
is part of the directory
Programmer firmware
providing computer Scorpion ZS 256.
A complete guide to accompany a new version of the Shadow 
Service Monitor with a nominal number of 4.0. 


       Library User

          routines (functions)

Use the routines of the Shadow
You can monitor from the assembler code indicating
function immediately after the command code
software interrupt RST 8. The data in
subroutine are passed in registers or
through memory (approx. also calls the routines that worked 
with the Microdrive, from the Interface I). 

                  ____


              RST 8 code 80h

            Printer output

Subfunctions not.
Rin.: Akk code displayed on the printer character;
curves.: CY = 1 if at the time of withdrawal was pressed BREAK.
Action: The character code that appears on the
printer is placed in the register of the battery. If during the 
operation There was an error (by pressing BREAK),

then return control to the caller
program will be the flag CY, in
Otherwise, the flag is reset.

                  ____


              RST 8 code 81h

           Calling disk BIOS

Number of subfunctions is passed via register
C. The name specified subfunctions is arbitrary. Disk BIOS is 
not using standard TR-DOS and runs completely autonomously. 

Low level
This group includes sub-functions provide "low" level of work 
with devices.


RESETC equ 0; reset the controller of flexible
CDs
Rin.: C = 0
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: reset the floppy controller
(And set of magnetic heads selected
drive to the starting position). Work
with the drive to start with
this subfunction. It is also necessary to use when an error 
occurs an exchange. 

CHDRV equ 1; drive select
Rin: C = 1;
 ACC = 0 ... 3 ■ code drive.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: Select the current drive for
subsequent operations. Physically, the drive is chosen when the 
sub-functions, generating real data (2,

5 ... 8, 10 ... 14). Codes drives 0 and 1
correspond to physical devices A and
In the codes 2 and 3 can be set only
After connecting to any emulated disk on your hard drive (see 
subfunction hddmount 35). When you first turn

computer, both physical drives receive a fixed specification, 
corresponds to 80-track two sides of the drive. If the code 
specifications of the disc (see RST 8, code 82h subfunction 4, 
BC = 0ch) to assign a value 0ffh, then the functions

2, 5 ... 8, in addition, may determine
specification of the drive at first to him
circulation. Speed ​​of moving the head
drive is not defined and set the maximum (03h).

MPOSIT equ 2; "logical" positioning
Rin: C = 2;
 D = 0 ... x number of logical tracks.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: positioning at a given
logical track. In fulfilling this
functions to read and verify the track number on which the 
magnetic head. 

IGNORE equ 3; skipping bad sector
Rin: C = 3.
curves.: CY if there were any mistakes, see the value
RST 8, Code 82, DE = 04, BC = +1 eh.
Action: ignoring error and continuing execution subfunction 
READGR (5) (Or WRITGR (6)).


RETRY equ 4; repeat Reader / Writer
Rin: C = 4.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: to repeat, in case of error,
subfunction READGR (5) (or WRITGR (6)).

READGR equ 5; reading sectors
Rin: C = 5;

    D = 0 ... x ■ number of logical tracks (the first 
manufacturing sector); 

    E = 0 ... x ■ number of the first manufacturing sector;

    HL ■ buffer address;

    B ■ number of sectors in the operation.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: Reading of sectors, located in a row starting at the 
specified registers D and E, into the buffer specified by the 
register HL. The number of sectors is given in case B. This is 
analogous to subfunction the same system in the interpreter

functions of TR-DOS. In the case of
read errors, you can use the application-3 or 4. Subfunction 4 
Repeat read bad sectors, but the implementation

5 subfunction ignores the error, with
in the buffer will be skipped as many bytes
what is bad sector.

WRITGR equ 6; recording sectors
Rin: C = 6
 ■ else like subfunction 5.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: The entry of sectors, located in a row starting at the 
specified registers D and E, from the buffer specified by the 
register HL. The number of sectors is given in case B.


IDENT equ 7; identification disc
Rin: C = 7
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: identification of the disc. For this
team produced a comprehensive test
floppy disk in the process of which is verified
record type (frequency modulation / modified frequency 
modulation), the number of used by parties to a floppy (only 
when unformatted top side for a one-sided disc), the number of 
workers Track (40/80) (only if there is no old

markup of 80), sector size
(128/256/512/1024 bytes). These parameters
used in the sequel all functions
operating with the logical values ​​(2,
3 ... 6). View and / or modify the code
specification drive can also use the
subfunction 16.

TR_DOS equ 8; identification of TR-DOS disk
Rin: C = 8
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: identification of the disk for the OS
TR-DOS, the same function 18h interpreter system functions 
TR-DOS. Before calling, you must install a working buffer size 
not less than 256 bytes, Using subfunction 9.


SETWRK equ 9; installation work buffer
Rin: C = 9
 HL ■ address the working buffer.
curves.: D ■ code version of the Shadow Monitor;
C, B, E ■ Date of compilation ROM (day, month and year).
Action: Set the working buffer
function 8.
Date of compilation ROM versions back
older than 3.0a (code 68 from 04.29.1995) in previous versions 
of the registers B, C, D and E remain unchanged.


SCANSEC equ 10; analysis of track
Rin: C = 10
 HL ■ address table sectors;
O: CY = 1 if there were any mistakes, see the value
RST 8, Code 82, DE = 04, BC = +1 eh; information
Table of being on the track sectors.
Action: The scan paths. Operation
holds for one track on which
installed drive heads (or after
function 2, or after the function 14). As a result of built in 
memory Table arrangement of sectors per track

from the index marker. This table (or equivalent) is the input
functions FORMAT (1911), F_READ (12)
F_WRITE (13). For each sector in table
have 5 bytes.
0 bytes ID:

       00h ■ information about the sector is deemed reliable;

       FFh ■ bad sector (about
sector is not reliable);

       FEh ■ end of the table sectors; possible values ​​FDh 
and FCh (see below); A track number (physical [0 ... x]);

2 Number of [0 / 1];
3 sector number [1 ... x];
4, the length of the sector, bytes:
 00 ■ 128;
 01 ■ 256;
 02 ■ 512;
 03 ■ 1024.
Bytes 1 ... 4 are extracted directly
targeted sectors of the markers.

FORMAT equ 11; formatting track
Rin: C = 11
 HL ■ address table sectors;
 DE ■ address pointer;
 B = 20h.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: The formatting of track on which the magnetic head 
drive. Formatting is made according to Table Sectors. Data from 
a table directly transferred to a floppy disk, no checks on 
their validity is not made, completes the identification table 
more than 128 bytes. Sector Size chosen according to the byte 
4, the sector is filled with the constant 0. After recording 
the next sector in the byte at the address contained in 
register DE is written the number of 2ch, and the value of DE 
is incremented. 

F_READ equ 12; reading sectors from the track
Rin: C = 12
 HL ■ address table sectors;
 DE ■ buffer address track.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: Read the track.
The order is determined by reading the contents of the table 
arrangement of sectors. Few sectors are placed in the track 
buffer, no dividers between them posed. Sector with the value 
of the ID byte 0FFh or 0FCh not be read, but in a buffer for 
these factors corresponding to the length (byte 4) place.

If the sector can not be read, the corresponding identifier in 
the table is replaced by FDh. The identifier is successfully 
readout sector is replaced by the FCh, and after the operation, 
all identifiers FCh automatically converted to 00h.


F_WRITE equ 13; record of sectors per track
Rin: C = 13
 HL ■ address table sectors;
 DE ■ buffer address track.
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: The sequential writes. The order is determined by the 
contents of the table arrangement of sectors. Sector where the 
value of the ID byte 0FFh or 0FCh not recorded, and in buffer

factors corresponding to the length of the
sector (4 bytes) place. If the sector does not
can be written, then the corresponding
identifier in the table is replaced by
0FDh. After recording all the identifiers are automatically 
converted into 0FCh 00h.


M_POSF equ 14; physical positioning
Rin: C = 14

       D = 0 ... x ■ number of physical paths;

       A ■ number of [0 ■ lower, 1 ■
top].
curves.: CY = 1 if there were errors, the value
See RST 8, Code 82, DE = 04, BC = +1 eh.
Action: individual positioning
track the number of which is set in register D.
Not checked for a path is indeed magnetic head drive.

ERRES equ 15; replacement sectors in table
Rin: C = 15
 HL ■ address table sectors;
 E ■ replaceable identifier;
 D ■ establishes the identity.
Action: Changing the location identifier table sectors. All 
identification bytes, coinciding with a given Register E are 
replaced by specified in the register D. 

DISEXT equ 16; receipt / change type
Floppy
Rin: C = 16
 A ■ drive specification;

       B ■ Mode: 0FFh ■ Installation, the other ■ reading.
, Action: read / installation specifications
floppy disk (for each drive provides its specification). The 
specification also sets the function 7 (and 8). Appointment of 
bits in a byte drive specifications: 0.1 Sector size 
(corresponds to byte 4 in the allocation table sectors);

2 business bit (drive 40 operates on the drive 80, is not 
preserved, but is used to change not recommended); 3 and 4 are 
not used; 5 number of tracks (0 ■ 40 1 ■ 80);

6 record type (0 ■ FM, a ■ MFM);
7 Number of Parties (0 ■ a 1 ■ two).

DRVEXT equ 17; getting type drive
O: C = 17
 Akk - code specifications drive.
Action: Reading package specification drive.
Specification of the drive is defined and stored in a special 
cell inside the driver when performing the test, which takes 
place at the first reference to the drive functions 2, 5 ... 8 
(or when you first turn on your computer). Functions 10 .. 14 
test is not perform.

Appointment of bits in a byte disk drive specifications:
0, 1, the velocity of the magnetic head drive;
2 ... 5 are not used;
6 Number of tracks (0 ■ 40 1 ■ 80);
7 Number of magnetic heads (0 ■ a,
1 ■ two).

Unused equ 18
In all versions of the Shadow Service Monitor
This subfunction has been left blank.

TIMSUB equ 19; set the time out
Rin: C = 19
 B - B installation time-out;
Output: HL - address of the procedure time-out.
Action: set the time-out (time
out) to counter the inclusion of motor
drive.
Format byte setting time-out:
0 ... 3 bits determine the number of drives (0
for A, 1 B, 2 C and 3 D).
4 ... 7 Status of time out for a drive.
Bit thrown off matches
functions as well mounted ■ included.
4-th bit corresponds to drive A, 5 th ■
drive B, etc.).
Options 2 ... 8, 10 ... 14 at the beginning of
include motor drives, while
worked through the delay at the time of promotion engine. If 
for any drive mode time-out, the driver for subsequent 
operations in the state to determine the time during which the 
delay can not do is significantly reduces operating time. To 
ensure mode time out to every 1 / 50

sec, ie, once a termination call
function 19 with the zeroed register B.

                ________


            File level


  Existing features of disk interpreter (BIOS) routines are 
added, working with the file system TR ■ DOS. After calling 
them installed CY flag usually indicates an error in the

This in Akk passed an error code (mind you, just for file 
functions!). In If the value is equal to Akk 80h, it

a physical mistake, its code,
turn, is available using RST
8, Code 82, DE = 04, BC = +1 eh. For each
file in the memory should be assigned to a special 28-byte 
region ■ descriptor file management (fcb) and buffer as at 
least one sector (256 bytes). All keeping records

descriptor controls provide
subroutine of the monitor.


  "Open" file and creates a control
structure subfunction f_open (20). Input parameters are: row 
address spec file (HL), buffer address

Management (IX) and the clipboard (DE).
The file can be opened in two different
modes (the contents of register B) ■
byte and block (in sector) exchange.
You can specify the type of permissible operations
file: read / modify / write. Depending on the mode of opening a 
file for data can be used

following routines.

  Subfunction f_read (22) and f_save (23)
intended for reading or writing
one byte, while the file is regarded as a sequential access 
file. Positioning within a file by using subfunctions putpos 
(32) getpos (33), respectively, allowing

define and consider the current position in the file.
Routines monitor, the reliability of the data in the clipboard, 
which appears here as a cache for a

sector (256 bytes). For a block
exchange are subfunctions r_sec
(28) and w_sec (29), which respectively
read and write a regular whole sector or sub-functions r_ms (30)
w_ms (31) ■ for multiple consecutive sectors for
one operation. Byte and block subfunction data exchange, in 
principle, be combine. To read and write operations

sector, if you have previously been processed bytes (ie, 
counter current position is not located on the border of a 
sector) will be recalculated the current sector.



  Closes the file and remove the clipboard (to append the file 
if necessary) subfunction f_close (21). Subfunction provides 
for maintaining file system TR-DOS. fcbint (27) allows build a 
control structure of the file without open it. This structure 
can be used to subfunctions fndname (25) ■ Search for a file, 
and fndnext (26) ■ Search the next matching file. In the name of

file is placed in fcb, the characters'? "
considered as "substitutes" that
allow a subfunction "find next"
search for files on a pattern.
Finally, to delete a file from the disk can
be applied subfunction delfil (24).

The following features are available with version 2.70
(Code 8 from 09/02/1994)

f_open equ 20; open file
x.: C = 20;

ix ■ buffer address for fcb;

       hl ■ address string containing the name
and file type in asciz;

       de ■ buffer address dma;
 b ■ way of opening:
Google 
	
Язык оригинала:Язык перевода:	
 
Показать:ПереводОригинал
specified by "handle" ■ unit, consisting of 13 bytes. 
Appointment bytes handle to the window below.


0, +1
Coordinates of the cursor in the window (Y, X) <197>
initially set to zero
cleaning program window can then be modified by the user.

+2, +3
The coordinates of the beginning of the window (Y, X). These 
coordinates are measured in standard familiarity size 8 * 8 
pixels. 

4, 5 window size in standard characters
(8 * 8 pixels), the first number of vertical dimension, the 
second <197> horizontally. 

6 Byte stores color attributes window.

+7
System Attributes window, given by individual bits:
5 ■ O ban, all displayed characters
ignored;
, 4 ■ arbitrary format to achieve
right edge of the box will be automatically executed commands 
carriage return and line carriage (see RST 8, code 84h);

3 ■ perform an automatic carriage return at the parish newline;
2 ■ perform automatic transition
line in the parish of a carriage return;
1 ■ change the attributes in the derivation of each
character (otherwise, the attributes are set only during 
cleaning windows); 0 ■ Do not remove the symbol of the cursor.


8, 9
Utilities bytes.

+10
Character size in pixels. Monitor supports two character sizes 
at 6 and 8 points.


+11
Window size in characters. For the symbols in the 8
points of this size coincides with the width of the window. If 
the symbol size 6 points, before initialization (clearing) 
should be calculate the size of the window and put this

bytes.

+12
Ticker symbol cursor. Code with this symbol
will be displayed at the site noting the position
cursor, if cleared by a 0 bit in the system
Attributes window.

Usage: first window should be described by specifying a 
descriptor initial window coordinates and size. All coordinates 
are measured from the top left corner of the window or screen. 
The window need to clear the function 83h, which

initializes some variables in
descriptor.

                  ____


              RST 8 code 85h

    Conclusion character in the user box

Subfunctions not.
Rin.: Akk code displayed on the printer character;

       IX ■ descriptor used by the window.
Action: The output of the symbol in the window that you specify 
a handle. Symbols from the set ASSCI (Codes in the range 32 ... 
127) directly printed in a box screen (see modes in the 
descriptor, described in the RST 8, code 84h). Along with the 
usual "Printable" characters, you can use control codes. Symbol 
* marked control codes that have appeared and

acting in versions older than 3.0b (code 64
on 11/05/1994).

1 Setting the attributes for subsequent
Character
Directly for Managed Code
should be withdrawn two bytes: the first
B ■ mask sets the attributes,
■ second mask disposed of attributes.
Significant bits must be set
byte mask.

2 Recovering stored attributes

4 * Conclusion aligned Subsequently, the
managed code to be transferred
a string of printable characters, which will be
center-aligned or right
window. The string length should not exceed
width of the window, the control characters in a string
not allowed, except for the following two, trailing a string of 
codes. 

5 * The output line in the center of the window

6 * The output string is right-aligned
edge of the window

7 Conclusion sound
The program fulfills a short sound
signal. Border gets in this color
mounted in a special cell monitor (see the variable modes, 
color). 

10 Newline
If the cursor is in the last row,
then there is a "roll".

12 * Clear the window, the cursor is placed
in the upper left corner

13 carriage return
Move the cursor to the leftmost line position in the window. If 
the corresponding bit in the handle to the window, then 
together with a carriage return calls and maintenance program 
character translation line.


27 Position the cursor inside the box
Directly for Managed Code
should be withdrawn two bytes. The first
determines the position of the cursor in a row, the second line 
number. The countdown is on the upper left corner starting from 
scratch. 

30 * Reverse roll
Cursor position is not changed, the entire
text in the box is shifted by one row
up, the first line of text disappears,
last row is filled with blanks.

                  ____


              RST 8 code 86h

  copy of the graphic screen on the printer

Subfunctions not.
curves.: CY = 1 if at the time of withdrawal was pressed BREAK.
This feature is available starting with version 2.4a
(Code 3).
Action: The printer output copies of a graphic display, similar 
to that obtained from the Service Monitor. Used for printing 
the current display settings. 

                  ____


              RST 8 code 87h

       installation of double speed

Subfunctions not.
curves.: CY = 1 if the computer's motherboard is not capable of 
switching speed. This feature is available since version 2.4d

(Code 3 from 11/12/1993)

                  ____


              RST 8 code 88h

       setting the normal speed

Subfunctions not.
curves.: CY = 1 if the computer's motherboard is not capable of 
switching speed. This feature is available since version 2.4d

(Code 3 from 11/12/1993)

                  ____


              RST 8 code 89h

        Work with a chip CMOS

Subfunctions not.
Rin.: D ■ opcode:

         7 ■ record (1) / Read (0)
time value and / or date;

         6 ■ consider the buffer (only if bit 7 = 0, see also 
bit 5); 

         5 ■ format reader ■ (1) direct reading; (0) reading in 
a format ASCIZ;


         0 ■ working with date (1), or with
time (0);
, HL ■ buffer address (if bit 6 =
1);

       C ■ seconds / number;
 B - minutes / month;

       E - hours / year | format read into the
buffer.

curves.: CY = 1 if the CMOS chip is not present or
given incorrectly formatted request;

       (HL) ■ line of text ASCIZ (if
Bit 6 = 1);

       C ■ seconds / number;
 B - minutes / month;
 E - hours / year;
 L - day of the week.

This feature is available since version 3.1f
(Code 70 by 21/05/1995)
Action: Install or reading the testimony
the current time from the chip nonvolatile memory and clock 
(CMOS). Usage: one function call provides access to either the 
current date (bit 0 Register D is installed), or to the current

Time (bit 0 of register D is cleared). 7-m
bit D register indicates the type of operation to function: 
recording ■ 1, ■ Reading 0. 

Reading values ​​from a chip is possible in two variants ■ 
transfer to the buffer whose address is specified in the 
registers HL (Register bit 6 set D), or transfer into the 
registers C, B, E and L (D register bit 6 is cleared). 

Interpretation of the read through the buffer
values ​​determined by the 5 th bit of register
D. If it is set, then the buffer is placed 6 bytes of data on 
the current time and date (one byte per ■ second, minute, hour, 
day, month, year). If the 5-th bit D register is cleared, then 
by transfer time or date in a string of characters ASCII, null 
terminated. In this case, the contents of register E is used as 
the output format: lower 5 bits ■ ■ separator character to them 
will be added to 20h; bits 7, 6 and 5, respectively, allow the 
withdrawal of the hours, minutes and seconds for withdrawal 
date: 7 show day of the week

6 represent the character "0" before the number,
5 displays a word and a month before the year to add "19."

If you change the current date set new
values ​​is possible only through registers
C, B and E; change the day of the week is impossible, he
calculated program for the current date.

The remaining cells CMOS-memory used
monitor for their needs, so
routines to work with them until you provide.

              ____________

Comments and suggestions on the work of the embedded software 
can express by writing a letter to the electronic

mail at 2:5030 / 25.1 (FidoNet) or
moa@ddeeds.spb.su (InterNet).
_________________________________________






Other articles:

Toys - 48 irons (3 levels).

Toys - the passage of La abadia del crimen.

Toys - short story of the game "Adventures of Winnie the Pooh" (Level 1)

Programmers - learn BASIC (Part 4).

Programmers - Adapting programs for TR-DOS # 2.

Programmers - IMMORTAL # 2 (immortality in the games).

Programmers - music editors, which we choose.

Programmers - Guide to shadow service monitor Scorpion ZS 256.

Programmers - "IN SEARCH OF ETERNAL LIFE."

IS-DOS - Category "IS-DOS - for beginners" No 4.

IS-DOS - users "No4:" Working with electronic drive among the IS-DOS ".

IS-DOS - information about the company ISKRASOFT.

Iron - Nemo responds to users' questions.

Iron - Message from the firm Nemo (about microprocessors Z84C0010PEC).

Premiere - Assembler, which we choose (a description of XAS).

Premiere - Program Description 'CONVER-Commander V 4.50 pro'.

Premiere - UFO-2. Devils pit.

Presentation - Novgorod Group Digital Reality about yourself.

Interview - Interview with Captain Nemo with comments Iskrasoft firm.

Interview - Nikolay Rodionov and ZX-Sectrum.

Interview - an interview with the developer of computer HOBBIT Dmitry Mikhailov.

a rest - HAL 9000

a rest - Nemo tells the story of VirtualETnoy reality in Russia.

Mailbox - letters from readers.

Mailbox - Translator.

Mailbox - "Empire Spectrum".

Miscellaneous - The introductory story to the game Paradise Lost (Lost Paradise).

Miscellaneous - Perspectives P / O: WARCRAFT

Miscellaneous - Amiga Club: Questions and Answers # 2.

Miscellaneous - Amiga Rulez or propoganda healthy lifestyle.

From Writers - a new issue and plans for the future.

Authors Journal - ZX-Format No.4

Lottery - the first results of the first lottery.


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

Similar articles:
Advertising - Ads are published free of charge (at least until slyuchae).
Prohodilka - Crime Santa Clause 2 (demo).
Advertising - advertising and announcements from spektrumistov.
Inferno - Managing obolchka magazine.

В этот день...   27 April