Question about TRDOS and FDC

ZXNet echo conference «zx.spectrum»

From Sergey Erokhin To All 29 November 1997


Hello All!

Does anyone know why trdos pushes the command
#FC (Write Track?) into the controller at the start stage?

this is 9 OUT into port 1F from the start,
after that it waits for INTRQ (i.e. it doesn’t push a single byte into
the controller -> receives Data Lost)

the next command into port 1F -> #C0 (Read addres)

Question, the result of analyzing the log of VG commands in the emulator
Shalaev.


P.S. maybe I'll make an FDI module......

Good luck
Sergey.


From Vladimir Yudin To All 30 November 1997


Hi Sergey!

29 Nov 97 02:52, Sergey Erokhin wrote to All:

SE> Does anyone know why the trdos command at the start stage
SE> #FC (Write Track?) is pushed into the controller?

SE> this is 9 OUT into port 1F from the start,
SE> after that it waits for INTRQ (that is, it does not push not a single byte in
SE> controller -> receives Data Lost)

SE> next command to port 1F -> #C0 (Read addres)

This is a standard jamb in TR-DOS with going to the desired
track, while the track search command code is lost
and the controller is sent the number of the required track mixed with something.
So when going to a given track a variety of codes are sent to the controller, but all of them do not complete
normally.

PS: I found this when I was emulating VG93


Sincerely
┬ ┬┌┐┬┐ ┐┬┬
╨╜╨╙╜╨╙ ╨ ╨


From Pavel Fedin To All 3 December 1997

This is a bug in the TR-DOS program. The positioning team had to push. Here is a cut from my disassembler:

---cut---

Address 16050. Checking the track index area. Install 23761 and place in
B drive head movement time. The upper side is selected and in case of an error
255 is placed in 23831. The current track number is placed in register H.
Also used from address
16103 (NO DISC error processing).

16050 CALL 8171 ;selecting the upper side of the disk
IN A,(31) ;take the controller state
AND 128 ;saving flag readiness
LD (23757),A
IN A,(63) ;take the number of the current track
LD H,A ;in case of return
CALL 15940 ;convert and execute command from reg. B

Attention!!! Before CALL 15940, the time
of moving the drive head must be placed in register B, otherwise the command that will be executed
before checking depends on the contents of register B at the input to the subroutine and the consequences can be very disastrous.

LD C,127 ;data register address
LD D,1 ;number defining the number of attempts
DI ;disable interrupts
LD A,192 ;read index area
OUT (31),A
PUSH BC ;save data register address
LD B,3 ;determine the number of attempts 16078 IN A,(255) ;take
signal stateDRQ and INTRQ
AND 192
JR NZ,16144 ;if any signal is received, then start reading
INC DE ;next attempt
LD A,E
OR D
JR NZ,16078
DJNZ 16078 ;repeat until the end of attempts
POP BC ;restoring the data register address
EI ;resolution interrupts
LD A,208;controller stop
OUT (31),A
LD A,(23761);ignore error ?

Error!!! ado LD A,(23831).

CP 255
RET Z ;if yes, then return
16103 CALL 10027 ;setting TAPE LOADING ERROR
LD A,255 ;ignore the error next time
LD (23831),A
JP 10011 ;error processing NO DISC 16114 POP BC ;restore
data register address
IN H,(C) ;read first byte
16117 IN A,(255) ;wait for some signal
AND 192
JR Z,16117
EI ;in case of return

Error!!! This way you can lose a byte while reading.

RET M ;if INTRQ is received, then return
DI ;disable interrupts
IN A, (127) ;read byte
JR 16117 ;repeat

---cut---

And the #FC command is obtained purely by chance, since what happens depends
on the contents of register B when entering this subroutine.

For now, with a pack of vicious, PavelFedin.