(C) Ivan Roshchin, Moscow
Music BREEZE (C) MR.Z / HWC
Error in STS 6.2 and its correction
When referring to drive STS 6.2 (as well as more
older) believes that in register tracks SH
recorded the actual number of tracks on which
A magnetic head drive. But for a number
reasons in case the track may contain an incorrect value, and
in this case, any operation with a disk will fail.
Suppose we loaded the STS with the drive 'A', and after
loading the magnetic head is, For example, a 10-second track
(track and register contents, respectively, equal to 10).
Establish Drive = 'B'. What if this happens? STS will not
initialize the drive to install a magnetic head in the initial
state (at zero track). STS will not execute the command and
read the first got the title sector to find out what the track
is magnetic head (like the TR-DOS). STS believes that and drive
'B' magnetic head located on the 10 th track and move it to 10
steps back to position on the 0-th track
(To read the directory). If the magnetic head is truly at the
10 th track or on the track with a smaller number, all will end
well. Well, in Otherwise, you know - after a lengthy wait a
border color changes to red, signaling a disk error. Moreover,
we can not go back to the drive 'A' - STS
believes that he has already established a magnetic head on
0-th track, and it remained at 10-th ...
Such troubles arise not only when
working with two drives, but, for example, when debugging their
own programs to the disk, which alter the contents of the
register lanes. Assembliruem such a program, run - and after
This STS refuses to work with the disk. And the old version of
STS generally stuck with disk errors ...
Fortunately, there is a simple way to overcome
this problem: just go to the TR-DOS, see the directory of the
drive and return to the STS. In this case, the register tracks
come into compliance the real situation of the magnetic head
drive.
And if you go to the TR-DOS does not want (or not)? In
this case it is necessary to introduce certain changes to the
STS. How do you do it?
You can determine where the STS routine is called reading
a directory (it is called and when change the drive), and
before each call to execute its code that initializes the drive
- and the problem is solved! But after some thought, I found a
simpler way: Instead of initializing the drive to write to the
register tracks some sufficiently large number (at least more
than 160), for example, 255. In this case the STS at
positioning of the 0-th track moves the magnetic head on the
255 steps back, and wherever it was, it must be the 0-th track
(which and required).
Thus, changes made to the STS: subroutine
reading a directory is located at # E7F8, and called it the
following command: # E495: JP # E7F8. At # E495 put the team go
to the code that writes the register 255 in track. Here's the
snippet:
LD A, 255, it puts the number in the register
; Track
LD DE, # 1E3A; in ROM TR-DOS:
; # 1E3A - OUT (# 3F), A: RET
CALL # E4D3; appeal to the TR-DOS ROM
JR # E7F8; proceed to read the directory
Where can you find for him a free place? By
at # E7CF find part of the program, reset the attributes of the
screen. STS is sometimes used for their needs lower third of
the screen (# D000-# D7FF), and it to be unnoticed, for it
establishes a Null attributes.
# E7CF: EXX
LD HL, # D800
LD DE, # D801
LD BC, # 02FF
LD (HL), L
LDIR
EXX
Here and place our fragment:
# E7CF: JR # E7DD; to bypass the fragment
# E7D1: LD A, 255
LD DE, # 1E3A
CALL # E4D3
JR # E7F8
At # E495, respectively, put the team JP # E7D1. Well, it
remains only to write the modified STS on disk - and can work
with.