Programmers - Tr-Dos for programmers. Max Petrov concludes his story about nontraditional methods of work with the disk.

ZX Format #06
   TR-DOS programmers.

           -= II =
music by DNK
(C) Max Petrov (hpm)
_______________________________


  Prodolzhaem razgovor of Tr-Dose.

  Za paru mesyatsev with pervoy chasti
moego opisaniya (ZF-5) You nadeyus, nauchilis famously 
obschatsya with the drive and uzhe napisali neskolko copiers 
(napomnyu, I opisal chtenie / zapis sektora, pozitsionirovanie 
and opredelenie znacheniya registra # 1f). I want to add an koe 
that of zapisi: I showed opredelennuyu smelost, skazav that 
zapisi sektorov nA drive srazu posle pozitsionirovaniya head 
pauzu nA ee uspokoenie delat DO NOT need. Odnako, experience 
pokazyvaet that nA nekotoryh diskovodah (takih malo, but they 
Apartment belongs) may fail. Therefore, If you hotite to Vasha 
programma rabotala nadezhno nA any diskovodah, unto you sleduet 
podobrat zaderzhku posle pozitsionirovaniya but tak to, DO NOT 
zapis tormozila.  Ha my opinion, samy good variant takoy:


 If the motor DO NOT spinning, then either
, A) raskruchivaem the plug programmkoy for op
  redeleniya nalichiya diska or

  b) delaem pozitsionirovanie.
Zatem pauza nA 0.3-0.7 sek. (Chem bolshe,
tem nadezhnee).
 Teper budem pisat sektora tak, HOW
skazano nizhe. Predpolozhim, nado zapisat
71 sektor nachinaya Track 2n sektora D:

n - fizichesky nomer track (sootvetstvenno, 2n [+1] - 
logichesky nomer) 

 Nad and under znakami '-' are the numbers pokazyvayuschie 
posledovatelnost zapisi sektorov nA dannuyu track (for track 
naprimer 2n +1: snachala zapisyvaem sektor D, then E, F, 0, 1, 
etc. (DO NOT zabyvayte only izmenyat znachenie registra HL,

that he vsegda ukazyval nA desired sektor
in the memory is).

 sektora nA dorozhke:

         0123456789ABCDEF

2n 002
n --------------- 2n +1 0123456789ABCDEF

2 (n +1) F0123456789ABCDE
n +1 --------------- 2 (n +1) +1 F0123456789ABCDE

2 (n +2) EF0123456789ABCD
n +2 --------------- 2 (n +2) +1 0123

 The idea is that we kazhduyu fizicheskuyu
track krome posledney, nachinaem zapisyvat nA 1 sektor pozzhe, 
chem predyduschuyu, obespechivaya neobhodimuyu pauzu nA 
uspokoenie head (as the SH vynuzhdena zhdat 1 sektor poka under 
head appears sektor with the necessary nomerom). DO NOT 
zabyvayte only that formate Tr-Dos numeratsiya sektorov

nA dorozhke dates from 1, a DO NOT to 0.


  Ostanovka motora.


  You zamechaete that posle chteniya / zapisi
Motor diskovoda esche nekotoroe TIME prodolzhaet cool? (This 
sdelano order to kompyuter uspeval sformirovat dannye for 
sleduyuschey komandy SH, while DO NOT would have to snova 
raskruchivat motor). Apparently, you have the plug hoteli 
ostanavlivat srazu, HOW fashionable uzhe dolgoe TIME. Togda

sleduet remember sootvetstvuyuschem bite
porta # ff. Yes podozhdite kodit! Delo in
that ostanovit If the motor komanoy
out (# ff), 0, then there are bolshie
problemy with the plug raskrutkoy because deteriorate
Vse registry SH (kstati, nA this osnovana
PROTECTION from magica: out (# ff), 0, Vse ...)

  Therefore programma ostanovki motora
dolzhna vyglyadet sleduyuschim obrazom:


  out (# ff), 0; estestvenno using ROM TrDos, pauza neobhodima

  xor a
q inc a

  jr nz, q
4 out (# ff), # 3c; or # 2c, HOW unto you bolshe nravitsya
: Out (# 3f), x; nomer track nA which stoyala golovka
; Pered ostanovkoy motora.



Programma raskrutki motora.

 Zachem esche it? - You ask, Lo kogda
SH daesh komandu pozitsionirovaniya, ona
sama turns the motor! AN DO NOT vsegda ... Ha
particularly inhibitory diskovodah, a thereto
kstati refers Teac, inogda motor DO NOT
raskruchivaetsya in itoge posleduyushie komandychteniya / 
zapisi DO NOT executed (In moemu this happens, kogda golovka

uzhe is that dorozhke nA, nA to you
hotite pozitsionirovatsya). Exit - podozhdat poka raskrutitsya 
motor vospolzovavshis indeksnym momentum. Ie neobhodimo 
nekotoroe TIME zhdat of climate indeksnogo impulsa, kotoroe 
oznachalo would that the drive povernulsya and dyrka nA nem

or poyavilas under svetodiodom or vyshla from under nego. If 
the period of climate za nekotory DO NOT happen, then either 
the motor on kakim any prichinam DO NOT spinning, or

diskovode diska net voobsche. (Motor mozhet
DO NOT spinning in sluchae, If the plug posle ostanovki DO NOT 
been vosstanovlen registr SH # Ff).


 Indeksny pulse - signal, soedinenny
with fotoelementom that nahoditsya bottom
from malenkogo otverstiya in kozhuhe diskety.
Sverhu this otverstiya nahoditsya svetodiod. In itoge at 
vraschenii diska, kogda otverstie nA nem sovpadaet with 
otverstiem in kozhuhe, signal prinimaet znachenie logicheskoy 
Unit of (he nuzhen to SH znala, vde nahoditsya nachalo track

at formatirovanii). If the net diska voobsche, he tozhe = 1. 
When komande pozitsionirovaniya znachenie bita B1 registra # 1f 
povtoryaet znachenie indeksnogo impulsa (Znachenie ostalnyh 
bits at pozitsionirovanii can nayti, naprimer in knige 
Larchenko and Rodionova). 

di
ld d, nomer track
6call pos; pozitsionirovanie, but DO NOT menyayte D
: Ld bc, pause; pauza zavisit from konkretnogo diskovoda,

                  ; Nadezhno something about # 1000.
call rd1f
ld e, a
l01 call rd1f
cp e
jr nz, ok
dec bc
ld a, b
or c
jr nz, l01
; If the come syuda, znachit net diska

rd1f ld (# 5cd8), not 0
 push de, bc
 ld ix, # 2740
 call dos
 ld a, (# 5ccd)
> And 1; zdes can esche opredelit zaschitu zapisi (bit 6)
 pop bc, de
 ret
<Ok, the disk spins, teper, If budet zapis, zhelatelno
; Sdelat pauzu nA 0.2 .. 0.7 sek.

 Programma DO NOT proverena, glavnoe - ideya.
DO NOT zabudte that # 2740 snachala chitaet of
# 1f znachenie, a zatem delaet pozitsionirovanie, so nachale 
programmy worth 

  kazalos would once call pos.



  Formatirovanie.


  Metodov large screen:
- 1) Sformirovat in bufere track pozitsionirovatsya, dat 
komandu 'zapis track' (# f0), vyzvat podprogrammu ROM 'zapis of 
(hl) to kontsa' proverit, zhelatelno, nalichie mistakes 
'PROTECTION zapisi' and 'Poterya dannyh' (although veroyatnost 
takoy Error chrezvychayno mala, If you konechno, DO NOT get 
staraetes ee spetsialno, naprimer include preryvaniya). Izmenit 
in bufere track nomer track nA new and

repeat as nado. HOW sformirovat
You can track posmotret, naprimer in
knige Larchenko and Rodionova of Spektrum and
TR-DOS nA stranitse 208 tablitse 17. Velichinu probelov mozhete 
podbirat sami from kakih some of their soobrazheny.



  di
? call pos; pozitsionirovanie and rasrtavlenie in bufere nomerov
; Dorozhek

  ld hl, format_buffer

  ld a, # f0

  call out1; a conclusion in the registr # 1f

  ld c, # 7f

  ld ix, # 3fca

  jp # 3d2f

 2) Ispolzovat podprogrammu ROM formatiruyuschuyu track on 
tablitse, zadannoy Vami or zhe on svoey tablitse from ROM. 
Predlagayu unto you nayti ee samomu. 

 DO NOT sleduet pytatsya sformatirovat track in formate FM, 
because If the dazhe Vash kontroller and podderzhivaet the 
plug, mnogie  shemy this DO NOT predusmatrivayut.




Vosstanovlenie polozheniya head.

 HOW I uzhe said VH DO NOT kontroliruet
diskovoda mount to head, so, If they move the arm, Vse budet 
ravno dumat that they cost HOW nado, a now dorozhka chitaetsya 
a mistake, because it ee nomer with soderzhimym registra # 3f 
DO NOT sovpadaet. Kakoy out? Tr-Dos, to primeru at oshibke daet 
komandu # 08 (vosstanovlenie) kotoraya obnulyaet soderzhimoe # 
3f (?) and otgonyaet head nA track 0 (edinstvenmoe mount to, 
kontroliruemoe apparatno), a zatem pozitsioniruetsya kuda nado 
(kstati, edinstvenny way vosstanovit mount to head nA 
neotformatirovannom diske or absence of the plug). Bolee 
ratsionalny metod takoy: at oshibke, naprimer, zapisi sektora, 
daem komandu reading adresa (# c0) - June bayt, which dana 
informatsiya nomere tekuschey on track and that chitaetsya bez 
check sovpadeniya nomera walkway # 3f - and chitaem the plug 
(naprimer, podprogrammoy 'chtenie in (hl)', or that zhe

programmoy that chtenie sektora). Zatem
berem ottuda pervy bayt - nomer track
- And naprimer, cravnivaem the plug with nomerom
tekuschey track, which we Where are some zapominali. If the 
they DO NOT sovpadayut then zapihivaem schitanny bayt in # 3f 
and daem komandu pozitsionirovaniya. Inache proveryaem nA nA 
lichie kakih any other errors. 

 Tekstov nA Assemblere DO NOT dayu because
kodit something you should umet, a eksperimentirovat, If chego 
something DO NOT clear unto you DO NOT meshaet nothing.


About predotvraschenii poyavleniya nadpisi

            Retry Abort Ignore ...

 Conclusion nA ekran, the poll you press the break and
drugie protsedury podprogrammy ROM Tr-Dos
vyzyvayut from ROM Basic48 using codes
 rst # 20
 defw address
Where are address - adres programmy in ROM Basic48. Because ROM 
Basic48 vklyuchaetsya only at any moment ispolneniya komandy on 
adresu> 16383, then ispolzuet perehod snachala on adresu # 
5cc2, Where are dolzhna stand komanda ret, kotoraya uzhe 
osuschestvlyaet call podprogrammy adresu to address ROM 
Basic48, zatem in steke worth adres # 3d2f for vklyucheniya ROM 
Tr-Dos and adres vozvrata in programmu, vyzvavshiyu rst # 20. 
For perehvata attempts vyhoda on adresu # 5cc2 You can 
postavit, naprimer, komamdu jp, a tam uzhe razbiratsya that 
Tr-Dos hotela vyzvat and whether ey allow sdelat

it. For opredeleniya can ispolzovat
adres protsedury ROM Basic48 of steka. For
simple zatykaniya attempts vyvoda nA ekran can postavit in # 
5cc2 komandy  pop af

 ret
pravda, I DO NOT remember that togda proizoydet
sluchae in error. In moemu, Tr-Dos simply
vstanet and budet zhdat poyavleniya in a code
letters r, a or i, that dannom sluchae beznadezhno.


   About vremennyh tsiklah.

 Znaya speed vrascheniya diska - 5 rev / s and
length of track in baytah with vsemi probelami
- Primerno 6250 bayt can poschitat
TIME, za kotoroe drive povorachivaetsya nA
A bayt or TIME chteniya / zapisi obnogo
bayta - primerno 32 ms and the speed obmena
c disk - about 30.5 Kbps. Otsyuda sleduet that nA chtenie / 
zapis one bayta y protsessora z80 3.5MHz Apartment belongs 
vsego 112 taktov. DO NOT putayte, speed chteniya vsey track and 
speed chteniya 16 sektorov the track. They raznye, Lo formate 
in Tr-Dos nA one dorozhke nahoditsya 4096 bayt, so TIME obmena 
with the drive for chteniya / zapisi sektorov can schitat 
ravnym 20Kb / s.


Well, that znal - rasskazal.

Ced 3.5. Max Petrov (hpm) 1996-97.
_______________________________