Ralp W Mathisen Dept. of History Univ. of S. Carolina Columbia, S.C.29208 INSIDE THE CP/M DIRECTORY I th October/Novembe 198 issu o MOR discusse metho o modifyin th dDas I director i orde t retriev dat whic otherwis woul b lost simila metho als ca b use fo th CP/ directory whic i foun o ever dis whic ha CP/ file o an kin o it Althoug CP/ user ar usuall unawar o th functionin o th directory it importanc canno b overemphasized Onl b mean o th informatio i thi director ca CP/ acces th res o th dat o th disk I anythin wer t happe t th directory o i i wer t hav incorrec informatio i i som o al o th files o thei data o th dis coul becom inaccessible Ther ar severa way i whic thi kin o disaste coul happen Sometime th director ca b accidental overwritten perhap b dis driv malfunctio o b accidentall writin o th dis wit non-Morro compute (I'v ha bot happen) Or a abnorma terminatio i th mids o dis writ operatio ca preven th director fro bein properl updated an th dat ma no b eas t recreate especiall i i ha jus bee rea i ove modem o just entered at the keyboard. I i possibl t recove fro thi kind o error however b writin directl t th directory Bu i an change ar goin t b mad i th CP/ dis directory i i firs necessar t kno ho i i organized Unfortunately th CP/ 2. Operatin Syste Use Referenc Manual whic come bundle wit th Morro syste i n hel here I discusse th function o th director (pp.89-12 i m version) bu i doe no discus ho th informatio i th director i actuall organized littl bi o investigation however answers this question. I no migh b stresse tha an alteration i th director requir th us o utilit (suc a DU- 77 whic wil allo th use t acces specifi groups tracks an sector o th disk an bot t rea fro an writ upo them Becaus th use ha complet contro ove exactl wha byt value ar written an exactl wher the ar written thi kin o utilit i no a dangerou a i ma sound! Th 1/ inc single-side doubl densit flopp disk contai 200 byte o 4 track (numbere throug 39) o 5 byte pe track Th physica track ar divide int 1024-byt physica "sof sectors. O m computer Morro M (RO revisio 2.3A) th firs tw track (0-1 ar reserve fo th CP/ system CP/ wil no normall writ dat there Th CP/ system however accesse th dis b logica "sectors an "groups, rathe tha b physica track an sectors I divide th dis int logica "sectors o 12 byte eac (th lengt o th standar CP/ "record") an logica "groups o 1 logica record (therefor eac "group contain 12 1 204 o 2 bytes) Th 3 user-accessibl physica tracks therefore ar divide u int 9 logica group (188 bytes) whic begi wit grou 00 whic itsel begin a th beginnin o trac (tha is a trac 2 secto 1) Thi explain wh th use canno us CP/ t acces track 0-1 fo the ar "hidden belo grou 00 Whic bring u t th directory i i locate a th beginnin o grou 00 tha i a th beginnin o trac (bea i min tha th numberin o th track an group begin wit "0, wherea tha o th sector begin wit "1") Group 0 an 0 ar reserve fo th directory th dat begin wit grou 0 (physica trac 2 logica secto 33) Becaus ther i n obviou correlatio betwee th logica group an th physica track (group an track overlap tha is som group li o tw contiguou tracks) an becaus CP/ work wit th groups th followin discussio wil b writte fro th poin o vie o th "groups, an th 128-byt logica sector containe withi them. Not too tha al reference t "sectors refe t th 128-byte logical sectors no t th 1024-byt physica soft sectors. Th bes wa t lear t wor wit th CP/ director i t b abl t loo righ a it bu failin that thi i ho th individua entrie i th P/ director ar se u (thi i ho th firs entr migh appea whe printe b DU-77): 00 NN NN NN NN NN NN NN NN EE EE EE LL LL LL LL GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG Th firs byt i th entr (byt 00 valu 00 ha th valu 00 i th fil i active th valu E5 i th fil ha bee deleted Thi explain ho fil ca b "undeleted (presumin i ha no ye bee writte over) jus chang th E bac t 00 Th byte liste a "NN (byte 0 throug 08 includ th he value o th nam o th fil (8-characte maximum) an th "TT byte (3-characte maximum contai th he value o th fil extension Blank ar represente b he blank (20H) an ther i n perio betwee th nam an th extension Knowin thi als ca b useful Fo CP/ wil allo som kind o softwar t creat fil wit lower-cas letter i th name bu i wil no allo suc fil t b accesse b CP/ routine suc a PI o eve REN I ca b ver frustratin t discove tha on ha inadvertentl create valuabl fil wit lower- cas letter i th name an the no b abl t acces it T correc th error al on nee d i t writ th nam i uppe cas directl t th CP/ directory. Th "LL value giv th numbe o CP/ record (tha is th numbe o 128-byt logica sectors i th file an ar calculate a follows Th firs "LL (presumabl i hex bu I'v neve ha fil larg enoug t fin out i multiplie b 128 an i adde t th numbe (give i hex i th fourt "LL. Presumably th secon an thir "LL" ar use fo ver larg files bu unde ordinar circumstance thei valu remain 00H Th tota numbe o byte o dis storag use fo th fil ca therefor b calculate by multiplying the sum of the "LL" values by 128. Th "GG value ar th mos important fo the tel CP/ whic group th dat i an fil ar store in Now fo newly-writte fil o freshly- formatte disk th "GG value shoul rea 0 0 0 0 0 an s o (unuse "GG" rea 00) Not tha ever grou tha contain dat fo thi fil mus b cite i th directory an thes group mus b liste i th orde i whic thei dat appear Th group nee not however b allocate b CP/ i sequential o eve ascending order Thi explain ho CP/ ca "find al th part o file eve whe i i scattere al ove th disk I als explain ho CP/ know whic group ar availabl fo dat storage al o thos group not liste a containin dat fo a activ file Not tha eac director entr contain 3 bytes wit 1 o the use fo th grou numbers i fil require mor tha 1 groups CP/ merel write anothe entr i th director fo thi file thi explain th "EXT entr whe on doe "DIR" fo th numbe her i th numbe o entrie i th director (no tha on eve ha muc us fo it!) Not als tha whe CP/ write a additiona entr fo file onl th value o "LL i th final entr ar valid thos i earlie entrie merel reflec th numbe o CP/M record i thos entries Thi explanatio als indicate wh numbe o smal file ca ea u lot o dis space fo th smalles uni tha CP/ ca allocat i on grou (2K) s fil o eve on lin wil us u 2 o storag (d DI o dis wit severa file o varyin length eve th smalles wil hav 2K an al th number wil b even fo CP/ arrive a th amoun simpl b multiplyin th numbe o group use fo storag b two). Arme wit thi knowledge th adventurou use no ca attac mangle directory Th fil nam an extensio ca b writte i easil enough an calculation wil yiel th nunbe o CP/ records whic als ca b entere (thoug hav no foun nee fo grea accurac here) Th toug par ca b i insertin th "GG values Fo CO files thi ca onl b don i on ca reasonabl assum tha th fil wa store i sequential ascendin groups Fo ASCI dat file th tas i relativel easier Simpl us th DU-7 (o whatever searc comman ("= i DU-77 t fin th locatio o th beginnin o th file not dow th grou numbe (i wil b xx.0--her th secto number begi wit "00"!-- fo al file star a th beginnin o group) an ente i int th firs byt i th second lin o th director (a above) The hop tha th nex grou contain th nex sectio o you dat file i so ente th grou numbe i th sam way I not i wil b necessar t pag bac t th las secto o th previou grou t se wher th fil leave off an the us th searc comman t fin th nex part Continu i thi manne unti al th group containin dat fo thi fil hav bee entere int th directory An d not forge t writ you complete director ont th disk yo wil b ver frustrate i yo do Thi procedur nee no b don fo ever fil o th disk onl fo th mos importan ones. Thi metho als ca b use fo thos rar occasion whe CP/ record dat o th wron group/track t correc this on nee onl ente th valu o th correc grou i th appropriat locatio i th directory Thi ca b especiall usefu fo larg file whe th erro occur nea th beginnin o th file. Ther i als anothe us fo thi metho whic th mor adventuresom reader migh wis t try rewritin director o CP/ disk writte b non- Morro computer (includin CP/ 86) bu whic canno b rea usin IBM.COM OSB.COM o XER.COM Firs o all tr th DI comman usin thes variou formats I yo ge rea error forge it Bu i i come bac simpl "NO FOUND whe yo kno there' somethin ou there you'r i business No tr th STA *. command Thi migh a leas lis th name o th file ou there Th nex thin t d i t experiment wit th dis i questio i th B drive execut DU-7 (o whatever i th A driv an loo aroun you disk Yo ma fin (a have tha th director wa jus writte i th wron place o tha th wron number wer inserte fo th "GG values Tr movin th director around an ever s ofte tr th DI comman again Wh knows yo migh ge lucky An i pinch yo ca alway cop th entir disk o a leas relevan parts secto b secto t Morro formatte disk fo whic yo als wil hav t creat you ow director entry But again yo migh no wan t tr thi unles yo hav n othe wa o eve bein abl t rea th foreig dis unde it prope format.