|
ZX Review #3-4
22 июля 1997 |
|
TR-DOS for beginners - Part 1.

TR-DOS FOR BEGINNERS
V. Sirotkin.
Continued. Start see the ZX
REVIEW 1996 NN 1-2, 4-5, 6, 7-8,
ZX REVIEW 1997 NN 1-2.
Programming the controller.
From the preceding material, we
learned that the computer communicates with
controller, drive through
specially designated ports. So
both of these ports and we will continue to work
again here is a brief sign-purpose port
I / O / management controller TRDOS.
PORT # 1F - status register - READING
PORT # 1F - Register Teams - ENTRY
PORT # 3F - Register Trails - RECORDING / READING
PORT # 5F - Register Sector - RECORDING / READING
PORT # 7F - Data Register - write / read
PORT # FF - Register Office record
- 0,1 bits - the number of drives ('A' = 0,0)
- 2 bits - Reset VG93 (at = 0)
- 3 bits - prepare (with = 1)
- 4 bits - side of the disc (at the top = 1)
- 5 -//--------------------//--------
- 6 bits - the density (at = 0, double)
- 7 -//--------------------//--------
PORT # FF - Register Office - Reading
- 6 bits - strobe byte of data (for = 1 is
data)
- 7 bits - willingness (if ready = 1)
As we already know, a direct
by write or read information on this port with an OUT or IN we
do not succeed, since these ports are connected to
computer only when
Included in ROM TRDOS and, accordingly, denied all the ports
computing system.
The question arises: "What do you do?". The point
that in the address space ROM TRDOS, which coincides with the
addresses involved in the interception and the inclusion of
TRDOS controller (and as we remember from
the first chapter - is the amount of
addresses # 3D00 by # 3DFF), is
entry point, just designed for such cases. (Thanks to the
programmers - although it have provided!)
*
THIS POINT WITH ADDRESS
# 3D2F or # 3D30.
*
And look, this point in the ROM TRDOS
like this: 140.
# 3D2F NOP
# 3D30 RET2
"So what?" How can she us
help? As for on-time ROM TRDOS we give the command
ports? "- exclaim you! Very
Easy! Before calling this point a team of 'JP' we brought in
stack return address first, then the address routines ROM DOS
where we have the desired subroutine. At the command of 'RET' at
# 3D30 processor will take from the stack
address and perform routine
ROM TRDOS because at this point
It will be connected.
The only condition: this
subroutine in the ROM shall terminate the command 'RET' to all
returned to the return address, which we entered on the stack
first.
In short, if we need to
to perform some routine in ROM TRDOS, then our actions:
1) Add to the stack address where the
returns the program after
from ROM DOS.
2) Add to the stack address of the desired sub-program ROM
DOS.
3) give the team JP # 3D2F (or
# 3D30).
Such a method call is called "Indirect addressing through
stack.
If we require that
ROM filled with two - three routines, then the stack is loaded
(after the return address), two - three addresses routines. The
latest in the stack must be placed address of routine that will
be carried out first!
Like anything complex, but
Here is where the trouble starts ...
The fact is that if the content point of call for all # 3D30
DOS version of TR is the same, ADDRESSES subroutine UTILITIES
TRDOS Different versions are different!
For version 5.01 this is one address,
and for 3.5 is different addresses.
So, if you have made your
program, based on the addresses of the version that protection
in ROM Your controller, it is not
means that the program will work with the controller friend
which has a different version of TP DOS.
It may be that 50% of your program just hangs, or worse -
zaportit your friend's data disk.
Case study: author
This book has got adapted to the CD program 'WORD'tekstovy
editor, which was calculated on the version TRDOS-5.03.
(Download the editor too
performed by subroutine
TRDOS ROM).
Launched with the controller
5.01, this program is already in
boot process "successfully" formatted zero and the first tracks
on a disc.
After that, just as well hung. Imagine this: You take the
drive with a software package, run the editor, and then ...
have to format the drive again.
And most importantly, that no
inscriptions, which version TRDOS
This editor works ... Good adaptation - there is nothing to say!
Upon closer examination
it turned out that the address in ROM
5.3 subroutine "read sector" in version 5.01 are at other
locations, and at these locations in 5.01 is routine
"formatting".
So rule number one:
If you program on self IOM low, ie with vyho home routines
TRDOS, then Your program should determine lyat (or request)
version TRDOS and then adjust
addresses of subroutine calls ROM.
In the worst case, your program must be small to display
Version Number TRDOS, on what
program adapted.
This rule is a good form!
The example will present the address and version of TP
DOS 5.01, and version 5.03.
Taken as a basis for these addresses ver 1.5! A version of the
address 5.3 will be given next in
angle brackets: .
Thus, the entry point we have
there were only addresses of routines that have worked with the
right port.
These routines in the ROM set. But they are so closely
linked with each other, that if you select only those that are
after teams 'IN' or 'OUT' at once
have the command 'RET', then such
routines will be quite a bit ... 140.
1. Entry to the port # 1F (instruction register).
Addresses in the ROM Mnemonic
# 2F79 <# 2FC3> OUT (# 1F), A; issue the command
RET; return
2. Entry to the port # 1F (instruction register).
# 3ED5 <# 3EDF> OUT (# 1F), A; issue the command
LD A, (# 5CD1); interview RAM
CP # FF; return if
RET Z; there B # FF
3. Entry to the port # 3F (register tracks).
# 1DFE <# 1E3A> OUT (# 3F), A
RET
4. Entry to the port # 3F (register tracks).
# 3E8B <# 3E95> OUT (# 3F), A; track number
LD A, (# 5CCD); interview RAM
OR A; Venuto, if
RET Z; there 00 bytes
5. Entry to the port # FF (control).
# 1FB7 <# 1FF3> OUT (# FF), A
RET
6. Entry to the port # FF (control).
# 2EC2 <# 2F0C> OUT (# FF), A
RET
7. Entry to any port on the register 'C'.
# 2A09 <# 2A53> OUT (C), A; port number in the 'C'
RET2
You may have noticed that
Many of the ports in these routines is not enough, and read
from the ports is not at all! To make controller to do
something, you must perform a series of actions in aggregate.
One team, most cases, can not do.
The whole process of exchange of the <->
Processors are composed of 2,3,4 sub-ROMs, which operates
a number of interrelated activities
with several ports. But
even with those routines that we already have, you can perform
certain actions.
For example: work on
management port (# FF) and give the command of the first type
(the address in examples - for version 5.01) .147.
1. Reset IC VG93 and the transition to 0 track.
START LD IX, ENDE; return address -> stack
PUSH IX
LD IX, # 1FB7; e n / n DOS
; (Write to port # FF)
PUSH IX; to put on the stack
LD A, 0; control command RESET
JP # 3D2F; perform n / p in the ROM
ENDE RET; withdraw altogether
2
! By the way, if you give a command, then when you click on
'Magik' button instead of 'Magik'
file, you get spoiled
disk, because chip will be continually NOT READY on port # FF,
and to bring her out of this state should not only apply to the
port # FF 'readiness', but and issue the command INTERRUPTION,
which completely absent in the routine treatment of 'Magik'
buttons! 147.
2. Selecting disc number, density, feeding readiness
and the choice of the upper side of the disc ...
START LD IX, ENDE; return address - in a stack
PUSH IX
LD IX, # 1FB7; address semiconductor DOS (record
; Port # FF)
PUSH IX; stack
LD A,% 00111100; management team:
; Drive 'A', etc.
JP # 3D2F; perform n / p in the ROM
ENDE RET; withdraw altogether
3. Search for a cylinder on the disk.
START LD C, # FF; port # FF in register 'C'
LD A, # 3C; readiness, drive A, and so on.
CALL TRDOS; write to the port # FF
LD C, # 7F; data register
LD A, 5; team - find a 5-th cylinder
CALL TRDOS; write data register
LD C, # 1F; command register
LD A, # 1C; team SEARCH Cylinder
; Drooping heads, with verification
, Coy, and with minimal delay
CALL TRDOS; give the command to search for
ENDE RET; exit from the program
- - - - - Subroutine write data to the port - - -
TRDOS LD IX, # 2A09; address semiconductors in Rom 'record
; Port on the register 'C' bytes
; From the register of 'A'
PUSH IX
JP # 3D2F; execute and return later,
; As of podprogrammy2
With this method you can write data to the control port
# FF, registers, TRACK, SECTOR, and give commands to VG93,
but to organize a dialogue (ie, data exchange and verification)
processor <-> controller very difficult.
In general, the exchange of data between
controller and the processor has to go to the following
algorithm:
1. Give the control byte in the
Port # FF. Since this port is connected to trigger the latch,
then This information will be stored until
arrival of the next byte in this
port (choose the drive, giving
preparatory readiness,
side of the disc and the density).
2. Give into the instruction register,
Port # 1F, B TEAM and always the very first team before the
read command - ENTRY must be team first
Type, with the modifier 'drop
head on the drive (this is due to the
circuit design features
all controller TRDOS).
3. Getting poll the port
# FF at the 7 th bit (bit ready
Products VG93) as long as there is no established UNITS
ie our team has accomplished.
4. If a team has been associated with reading or writing,
ie, command of type 2 and type 3, together with the poll bit 7
port # FF should be in front of each byte of data going to
drive or on disk, query the 6 th bit port # FF (data strobe).
And if Bit 6 Set in a unit, then
send or receive bytes into the port
# 7F (data register).
5. Once bit 7 port
# FF established in a unit, you can
to start recording the next
team (before applying the next
commands can be given a short delay empty cycle).
6. Query the status register VG93 (port # 1F) and to
determine command executed correctly. If the command is
executed without errors, and everything is normal, then the
status register is byte # 80.
7. If the status register
bits are set, depending on what bit established, appropriate
action.
For example: when the command 'write':
- If the bit 6, then
have to interrupt the operation command input 'INTERRUPT' and
bring the inscription on the screen: "DISK Protected. "
- If you set bit 2 (data loss), it will either have to repeat
the operation again, or go with the words on the screen "error
record. " - If bit 0 is set to unity, it means that the drive
is busy and will have to wait he is released.
Initially, this sequence seems long and
very difficult, but as the ROM
TRDOS these routines are already there
in the aggregate, the whole process
will result in a challenge with 2 or 3
respective sub through a stack of ROM.
Need to remember one rule: the rule filing sequence of
commands.
Rule number two:
Because of the schematic features of the controller TRDOS
include motor drives and the pressing head to the drive is only
team first Type, with a modifier MAGNETIC
HEAD IN THE WORK (ie, when the head is pressed against the disk
and disk promoted).
The third bit command code must be equal to 1. Since the
drive is a slow- device, then after running the first type
leaves little time for filing following commands to read or
write.
Let's look at a few
examples disk procedures of
Rom.
Example 1.
Sub-Reading from a port.
Port number in the register of 'C'.
Before calling this procedure, you must: if reading
produced from the data register
(Ie, reading from disk), then
instruction register (port # 1F) to
write command, and the port # FF -
written commitment.
Naturally, the disk head
must be installed on the desired track and pressed to disc.
(Addresses in the examples for TRDOS
5.01). The register 'HL' place
RAM address, where we read
information. In case 'C' - number porta.140.
# 3FDB <# 3FE5> IN A, (# FF); survey implementation and
; Data strobe
AND # C0
JR Z, # 3FDB; if not satisfied and no
; Gate, then read again
; Port # FF
RET M; done - exit
INI; reading bytes from port
; To the M (HL)
JR # 3FDB; repeat, if the group
; Operation
2
In fact, this procedure is designed to read array
data from the disk (from the Sector or
Track), but it can also be used to read from the registers
PATHS, CONTROL AND SECTOR
if in case 'C' Record the appropriate port. In this case,
routine work ONCE,
and you have the address M (HL) will be
bytes read.
WARNING! REGISTER OF
(Port # 1F) Examine This procedure can not. Because its
poll bit PREPAREDNESS Port # FF
reset to 0 and all the infinite loop!
Example 2.
Sub-ENTRY INTO PORT. Port number in the register of 'C'.
This procedure is a reverse copy of the previous procedure.
Before calling this procedure
REQUIRED:
If an entry is made in
data register (ie, recording
disk), the instruction register (port
# 1F) need to write command, and
Port # FF - written commitment.
Naturally, the disk head must be installed on the right
track, and pressed to disc. The register 'HL' put the address
of RAM WHERE will record the information. The register 'C'-room
porta.140.
# 3FC0 <# 3FCA> IN A, (# FF); survey implementation and
; Data strobe
AND # C0
JR Z, # 3FC0; if not satisfied and
, No gate, then again
; Read port # FF
RET M; done - exit
OUTI; write bytes to the port
; Of addresses M (HL)
JR # 3FDB; repeat, if the group
; Group operation
2
This procedure, of course,
You can write bytes at any
port, but others do,
however long the procedure (see
above).
Immediately there is a legitimate
question: "And all the same survey
Port # 1F, ie Status register?
The fact that programmers
who wrote TRDOS, no provision for interference-free
interrogate the register of the user programs. All polls
Port # 1F in ROM is closely linked to
other subprogrammes chteniyazapisi.
There are, however, the point at
# 3F28 <# 3F32>, calling you,
You can question the status register. But there immediately
occurs and check bits with the transition to
address printing error messages, and disk crash.
This entry point can be used in programs in which
not compromised system area
BASIC and TRDOS, since
there are any errors
system will cause the program
print messages on the screen.
And if the domain of system variables has been compromised??
There are two way out of this situation.
First - if the program is read from disk, then after
read sector (s)
make reference counting
the amount of sourced unit and compare it with the correct
amount, which is known (in advance been calculated).
If the recording is on
disk, then there will either have to record 2 times the same
sector (for sure), or here also assume that sector back to
some free space in
RAM, and compare the read block
those who tried to enroll.
And if they are not identical, then try to write again. How do
you understand, this is not the best way
of the situation!
The second way - quite exotic, but very effective
and allows you to interrogate Register
State at any time of the user program. This method
based on the method of the second interrupts! ("That's so-so" -
the attentive reader will cry and start to look for the pages
of the book, where it is written that does not like TRDOS
TWO interrupts. That's right, not
looking for and do not rush to conclusions
and abuse against the author. The point
that, indeed, most routines TRDOS "afraid"
second interrupt. These are the routines that are responsible
for read / write information on
disc.
We will not refer to
disk, but a survey only port
VG93 state). So ... In ROM
TRDOS at # 2D3D <# 2D87>
has the following sequence komand.140.
- Subroutine 'poll port # 1F' # 2D3D <# 2D87>
# 2D3D <# 2D87> IN A, (# 1F); read port # 1F
AND # 7F; select all mouth
; Certain established bits
RET Z; back, if not
; Error
DEC D; reduce the register D
PUSH HL; HL stack
PUSH DE; DE stack
JR NZ, # 2D31; if the register
; 'D' <> 0 then
; Go higher
, But we do not need any
HALT; wait for the arrival interrupt
; Colliding pulse INT
... ; Next
, We are not interested ..
2
Using the fact that in this
procedure is the command HALT.
If you recall, it met this
command processor, as it were suspended and awaiting the
arrival of interrupt signal to the input of INT,
and then goes away for execution
program interruption. In Spectrum pulses followed by a break
frequency of 50 Hertz, and 50 times a second keyboard is polled
by Interrupt 1. We have the same setting
INTERRUPT 2, we capture the output
of this procedure on his program.
The only thing not forget to call the procedure from the ROM
recorded in the register of 'D' units, and Output, in
interrupting the procedure to promote the stack pointer up the
RAM to 3 words (eg, three times to give the command 'POP AF ').
140.
; Program Procedure Call poll port # 1F ...
START LD A, # FD; zanesem interrupt vector,
; Equal,
LD I, A; for example, # FD (full address
; Is # FDFF)
LD HL, VARIABLE; address interrupt this procedure
LD (# FDFF), HL; listed in the address vector
; Interrupt address of the program
LD D, 1; register must = 1 for
; To the program in ROM reflection
; Develop the highest ONCE
LD IX, # 2D3D; address sub TRDOS
; (For version 5.1 TRDOS!)
EI; interrupt enable
HALT; halt the processor and
IM 2; enable interrupt TWO
CALL TRDOS; invoke the program from TRDOS with
, Followed by working off prog
; FRAMEWORK interrupt
DI; ban interrupt
IM 1; interrupt ONE
EI; enable interrupts
RET; exit
- - - - - - - Interrupting the program - - - - -
VARIABLE DI; disable the interrupt
POP HL; extract from the stack address
; Return to the
POP HL; program in ROM after the HALT,
POP HL; as well as two more words
IM 1; interrupt 1
RET; return
- - - - - - - - - - - -
TRDOS PUSH IX; call the program from ROM TRDOS
JP # 3D2F;
- - - - - - - - - - - -
2
After starting the program with
START label it will fulfill, and we
obtain the output in register 'A'
ZERO - if everything is ok (interrupting the procedure does not
include).
If the status register contains bits set, then
This case turns on our program to interrupt, and in case 'A' we
get a byte which can be further analyzed in any way.
The only drawback of this method is redundant memory cells
for vector - where contains the address of interrupting
program (in this case
RAM cell with address # FDFF and
# FE00), and the requirement to keep 'old' register 'I', if you
altered the program worked with the interruption 2.
Since the low byte of the vector
interruption is always equal to # FF, then
these addresses in the address space of the computer, there are
only 255. If we exclude the addresses that fall on the ROM (and
there are 63), then we will be 255 minus 63,
of 192 random addresses. A
it's quite a lot.
In Rom TRDOS there are several sub-survey the port # 1F,
which can cause the same
way. One of them is
at # 3DAB <# 3DB5> .140.
# 3DAB <# 3DB5> IN A, (# 1F); read a port
AND 02; bit select the 'Request
; DATA '
; For reading
; Records
, Or a bit of 'Index'
, With the rest of the opera
; Tsiyah
LD B, A; hide obtained
; Value
LOOP1 IN A, (# 1F); reread
; Port
AND 02; isolate bits
CP B; comparable with previous
RET NZ; if the bit is set
- Go out
INC DE; increase the value of
LD A, E; if attempts are not
; Ended,
OR A;
JR NZ, LOOP1; then repeat reading
; Port
2
This routine is convenient to call in case of:
- When you need zasinhronizirovat
program execution for the passage of the Index hole, ie
to drive a new turn, or to find out whether the disk is
inserted and is ready Does he?
- For reading / writing -
waiting for the signal data request.
As we can see, this routine is missing a command HALT,
in which the second interruption
exactly caught on the management of the user program.
But in any case when a
interrupting the momentum INT processor will work cycle
LOOP1, and the interception still takes place, and in case 'B'
or 'A' will we need a byte allocation of the second bit.
As in the previous case,
you first need to install Vector
interruption, and in interrupting the program to move the
pointer Stack up to two bytes (to
not return to the ROM and the user program). Before calling
ROM routines in the registers 'DE'
must be noticed 00 to a maximum polling cycle. Well, of course,
give commands and EI IM2.
140.
; Program Procedure Call # 3DAB <# 3DB5>
start LD A, VECTOR; set vector
; Interrupt
LD I, A
LD HL, VARIABLE; zanesem at
; Vector
LD (VECTOR * 256 +255), HL; address interrupting
; Program
EI
HALT
LD DE, 00; number of attempts
LD IX, # 3DAB; program in ROM (for v.5.01)
IM 2, the second interrupt
CALL TRDOS; execute the program in ROM and
; Interrupt subroutine
IM 1;
RET; back in register 'A' and
; 'B' is the value of
; Port # 1F
- - - - - - - - - -
TRDOS PUSH IX
JP # 3D2F
- - - - - - - - - -
VARIABLE DI
POP HL
RET
- - - - - - - - - -
2
For completeness, we can
still result in the address routines
Poll port # 1F, emitting
FOURTH bit "LOSS OF DATA,
if the operation was a read / write. For the remaining
operations - bit "crown to its normal state."
Call this subroutine
The usual way, without any
tweaks. Only in case 'C' before the call has to enter number 1
- for testing routines only once.
140.
; ... procedure read-port # 1F with allocation bit 4
; ... before the call to give the command LD C, 1
# 3E30 <# 3E3A> IN A, (# 1F); interrogate port
AND 04; select bit 4
RET NZ; if it is installed
- Exit
INC B; increase the 'B'
DEC C; reduce the 'C'
RET Z; if the 'C' = 0 then exit
...
2
Now that we have learned
poll the port status, we
need to decide what should be done in user program
If you are installing a bit in this port, ie, error operations.
With read / write:
- Installed
2-nd bit - 'LOSS OF DATA'
and / or
3rd bit - 'Checksum error
CODE '
and / or
4-th bit - 'ARRAY NOT FOUND'
and / or
5-th bit - 'ERROR WRITING'
In this case you need
repeat the operation a certain
number of times, and if all the bits
will also be installed, then it
means that you have a failed drive.
Terminates the operation command
'FORCED INTERRUPT', and
further do as you see fit.
- Installed the 6-th bit - 'PROTECTION
Record '(ie the disc is protected).
In this case, also interrupts the operation command input
'INTERRUPT' and kindly ask
remove protection from a disk or not
ask ...
- Cleared the 7 th bit - 'READY
DRIVE '
And in this case, your program should just wait for drive
readiness empty cycle. And now let's continue and see what else
is useful in ROM TRDOS.
The procedure for determining the numbers
Cylinder under the head.
~~~~~~~~~~~~~~~~~~~~~~~
Address # 1DFA <# 1E36>.
After calling this subroutine in register 'A' returned
Cylinder number, the same number
immediately recorded in the register of the controller tracks.
Also, if your work routine queries
key 'BREAK' = C / SH + SPACE and
prints a message if the key
pressed.
This routine is finished, ie does not need
preparatory actions. K
Unfortunately, when her work deals with a number of addresses
in the RAM of system variables.
Terms call:
- In case the value of IY Record
# 5C3A;
- In case 'B' must be
ZERO;
- The address of RAM # 5C3A should be
value # FF.
Cropped, ie vary
during work routines
address RAM # 5D16 and # 5CCD.
Procedure 'Search of track'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 3E59 <# 3E63>.
When you work routine finds the desired track on the disc
(out to the right and presses CYLINDER Upper or Lower crown
based on the preset number Track). Also interrogates key
'BREAK' = C / SH + SPACE. Subroutine is finished and It works
even on an unformatted disk.
Terms call:
- In case the value of IY Record
# 5C3A;
- In case 'A' should be
NUMBER desired track. (If
number of 0 or even, then track
top, if odd - lower
The average);
- The address of RAM # 5C3A should be
B # FF;
- To address # 5CF6 # 5CF7 And should
be zero;
- The address should # 5CC8
value # 83;
- The address of # 5CFA Record 08 or
00.
Docked, ie, destroyed
contents of memory cells to hell
resam # 5D16 and # 5CCD.
Procedure 'SEARCH desired track'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address Call # 2EF0 <# 2F3A>
This is the second search procedure.
It is more acceptable in programs with a deficit of memory
space. During its operation, the procedure
corrupts only a single cell
memory at # 5C00. When working on the routine finds
drive the desired track (goes to
CYLINDER desired and presses the Upper or Lower the head,
according to from the specified track number).
Subroutine is finished and even works on unformatted disk.
Terms call:
- The address of RAM # 5C00 should be
ZERO;
- In case 'C' is entered number
WALK.
In this program you can enter more
at:
# 2EFB <# 2F45>
In this case, the cell RAM # 5C00
not affected, but before calling routines must be in
Port # FF file byte 'READY, TOP of the disc,
etc. ', and in case' C 'before the call to Record a track
number.
If someone is not satisfied
these methods to track search
drive, you can write a procedure 'track search' based on the
team chip 'STEP'.
True, it will take
more space in RAM for speed and it will be much slower in all
routines SEARCH ROM TRDOS.
And it looks about
as follows:
- Issue the command 'RECOVERY'
- Submit to the port # FF bits READY
Intensity and upper surface
(And others);
- Recorded in the register (for example,
'C') Track number;
- Adjust the number of tracks
in cylinder number and a rotated
hnost drive and give the command
controller 'Step Forward' (with
defined modifiers
'Head of press, modify, re
Giustra track ') obtained
number of times ...
140.
; Sub-track search team 'STEP'.
ld c, # 20, track number
ld a, 0; RECOVERY TEAM
call trdos; Add to PORT # 1F
ld a, # 3C; readiness, UP
call trdos; recorded in the register # FF
ld a, c; Duplicate track number
or a; register reset flag
rra; divided Track Number 2
, In 'A' is now number CYLINDER
ld b, a; put in the loop counter
jr nc, STEP; number 'Track Number' was
, Even? If yes - go.
ld a, # 2C; not - mean surface NIH
call trdos; recorded in the port # FF
STEP ld a, # 5b; command 'Step Forward'
call trdos; execute the command
djnz STEP; to repeat the 'B' Chilo times.
..........
; Tag "trdos" in this case is a sub
; RPC TRDOS who work directly with
And the ports through the point # 3D2F.
2
As we see from the example, this method is inconvenient and
dovolmo cumbersome ...
Protsedura'ZAPIS one sector '
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 3F00 <# 3F0A>
Procedure writes one sector on the current track (which are
drive heads) and selected surface.
Terms call:
- Head of the drive must be
displayed on the right track, and
pressed to a disk;
- To address # 5D00 / # 5D01 must
be placed the address of RAM, of which
torogo will be written 256
bytes per sector;
- The address of # 5CFF should be
substituted LUN SECTS
RA (ie, the numbering of the sectors
starts from 0, the subroutine
then adjust this number
to physical).
- Save the data from address
# 5CFE, as this address when
work docked, ie, IP
uses at work.
! Thus, perhaps, difficult to
subject to the procedure call is a condition Pressing HEADS TO
DISC. Is solved by simple methods. Since record-sector
is a continuation of
Users of the program
in the chain, then this
procedure must be followed by
searching for the desired track.
And as the 'search' is
a team that presses the
head to the disk, causing the program 'WRITE' immediately after
the end of the 'search', we have no Labor fulfill the required
condition.
If a user program calls the procedure 'search' is separated
from the call to 'record' away over time, and the program does
not have time to file the command 'write' on pressed against
the head, then calling re routine 'Search' with
the same parameters, we load
(Push) of the head. You can also
give the command drive 'STEP BACK' and follow the 'Step
Forward' package with the modifiers 'Pressing HEAD'.
Protsedura'ChTENIE one sector '
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 2ED1 <# 2F1B>
Terms call:
- In register HL to be hell
interest of RAM, which will be readout
vatsya sector;
- In case 'E' should be but
measures SECTOR (the logical,
ie numbered from zero).
Routine is called after the withdrawal of the cylinder heads
to the right and then pressing the heads of the desired surface.
Subprogram in its work
interrogates the port CONDITION (# 1F)
and repeats his actions, if
was a failure in reading.
Protsedura'ChTENIE one sector '
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 3F04 <# 3F0E>
This is the second sub-program reading the sector.
Terms call:
- Head of the drive must be
displayed on the right track, and
pressed to a disk;
- To address # 5D00 / # 5D01 must
be placed the address of RAM, in which
tory will be read 256
bytes from the sector;
- The address of # 5CFF should be
substituted LOGICAL SECTOR NUMBER
(Ie, the numbering of the sectors starting
begins with 0, the routine of
that will correct this issue
to the physical);
- Save data from the address
# 5CFE, as this address when
work docked, ie, IP
uses at work.
Procedure 'Send the command FIRST
type, with the expectation of their performance. "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 2F0D <# 2F57>
This routine is convenient to call when you need to perform
team 'RECOVERY', 'STEP'
'Search'.
Sub-program with their work team writes code to port
# 1F, and then querying the port # FF,
waiting for this command is executed.
Terms call:
- In case 'A' should be the code
team.
Procedure 'CYCLIC RECORDING
IN PORT. "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 2075 <# 20B1>
Typically, this routine is used during formatting PATHS. But
it can be used for custom data recording on the track (such as
creating alignment tracks, or for the complete destruction of
information on the track). A if tricky, you can record
information and the sector.
Terms call:
- Head to be withdrawn
to the desired cylinder and pressed to
the desired surface of the disk;
- Submit the command 'write' (to
horns or sector). If written
described by sector, the register
SECTOR put the number of sectors
pa;
- In case 'D' must be
bytes for writing "
- In case 'B' must be
number: how many times to write
bytes from the register of 'D';
- In case 'C' should be # 7F
(Data port).
Procedure "FORMATTING ONE
WALK. "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address # 1FC1 <# 1FFD>
Sub-one format
track the standard way.
Queries port status (# 1F)
and gives the inscription on the screen, if
disk is write protected.
Terms call:
- Head to be withdrawn
to the desired cylinder and pressed to
the desired direction;
- The RAM location at address # 5CD8
must be a value other than
from zero;
- In case 'E' need for
revenge of the cylinder number (from 0
to 79), which are of
nimble. If you can
drive, then, moving head
on the cylinder, more than 79, you
can mark the 80 and 81, and 82
etc. cylinders until
until you head is not uprutsya
a limiter.
If you want to format non-standard - please. You can, for
example, 1-st track format with system number 255, but to work
with such a disk in TRDOS standard commands will be rather
difficult!
To format a track
unusual way, you can use the entry point of the subroutine:
# 1FC9 <# 2005>
In this case, in addition to all
preceding conditions, you should:
- In register 'HL' must be
put address data dump,
which has consistently placed
number of a disk sector (for
normal output of the last
NUMBER in the dump should be
Room # 10!). TRDOS uses
address data dump the ROM on
at # 1F7D <# 1FB9>;
- The port TEAM (# 1F) should
be entered Format
Vct (for example, byte # F4).
More information about formatting process will be explained
a little later.
Procedures 'delay loop'.
~~~~~~~~~~~~~~~~~~~~~~~~~~
Address 1. # 3DF3 <# 3DFE>
Address 2. # 3E96 <# 3EA0>
This routine delays for
waiting for execution teams drive. Sometimes it is useful to
call, to be sure that follow the team
drive will go to him when he is free.
The first subroutine: a delay of approximately
0.3 seconds, and the second delay -
approximately 1.2 seconds.
Procedure 'SHIPMENT Dump.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address 1. # 17DD <# 180D>
Address 2. # 28A5 <# 2FEB>
At this address in ROM TRDOS
commands are:
LDIR
RET
Calling this subroutine is useful when the need
zamorochit head or Hacker
for the transfer of information from ROM
TRDOS in memory: for example, of any procedure.
Terms of call are the same as
and common commands 'LDIR'.
One could cite
many useful routines
from ROM.
But all of the above is enough to write
any sort of work program
disk, and we limit ourselves to these
routines that are fundamental.
In the process of writing their
programs or other parsing
similar programs can
discover that not necessarily
call subroutine to TRDOS
the address above. At the end of
this chapter, the application will
Listings are the most important sub-ROMs TRDOS with the
addresses, and you get to decide what address to call one or
another procedure.
(To be continued ...)
Other articles:
Similar articles:
В этот день... 15 November