Saturday, May 7, 2016

Rebuilding Boot Sector Zero with the Diablo 31 Driver (DEV.33)

This page is a part of the "Understanding IRIS" collection.  Many thanks to David Takle, for figuring this out, and sharing this with us:

------------------------------------------------------------------

A lot has been happening.

1.  I managed to rebuild boot sector zero with the Diablo 31 driver (dev.33). Took about 3 hours to get it right, and that was after I tracked down all the relevant info and figured out what I needed to do.

2. I overwrote the REX driver with the good Diablo 31 driver. Only about an hour for that one.

That brought me to the point of testing the Boot.

3. When I boot this modified LU0, it actually prints "Please Wait ..." and then provides a TRAP #5 and dies.

That's great progress !!

After about 8 hours of reverse engineering, I figured out what was causing the TRAP.
A little known fact is that the DMAP file has to reside on Track #1 of the LU (given Track #0 contains INDEX hdr and other stuff).
The DMAP header is in Sector zero of that track, followed by the map blocks.

More info ....
DMAP is the disk map of the entire drive, where each word of the DMAP file represents a TRACK on the LU, and each bit of each word represents a block in the track.
If the block is in use, the bit is set to one. If it is available, the bit is zero. 
If there are fewer than 16 decimal (or 20 octal) blocks in a track, the unused bits are set to one.

Heres the problem.
The LU0 that you extracted from the QIC was from a drive that had 20 octal blocks per track. The Diablo 31 only has 14.
That means I have to move DMAP to disk blocks 14-15-16 (octal). But those blocks are currently occupied by INDEX blocks.
So I'm going to attempt to swap them, and update the header blocks accordingly to point to the right places.

Then we will try another boot.

You can begin to see why it was always difficult to migrate IRIS from one drive type to another. A simple backup and restore did not work.

-------------------------------------------------------------------

Here's my dis-assembled source for the Diablo 31 driver.
I pulled this driver from CONFIG, so I never had to write one.

We don't have to do anything with nova_dkp.c.
There are probably other drivers that will work with it which would run larger disc drives. But it would take a while to locate them.
Even if we find an IRIS driver to match, we might have to alter the device address in the IRIS drivers to match the simh device 33.

I don't think there is any way to add a different device address to simh, unless you want to try using the DKP drives.


~David


; f:\www\nova\LU0\diablo31.bin  words=256/ octal=400
000000:    313  .K  JMP 313
000001:      0  ..  JMP 0
000002:      0  ..  JMP 0
000003:      0  ..  JMP 0
000004:   1750  .h  JMP -30,3
000005:     40  .^  JMP 40
000006:      0  ..  JMP 0
000007:   1750  .h  JMP -30,3
000010:      0  ..  JMP 0
000011:      0  ..  JMP 0
000012:      0  ..  JMP 0

000013:      0      ; -24 DINT
000014:      0      ; -23 DMSK 
000015:  77037      ; -22 == DSIZ -- driver size --- conv to LUFIX
000016:  13300      ; -21 == PFRD -- power fail restart delay
000017:    677      ; -20 == any error
000020:      0      ; -17 == write protected
000021:      0      ; -16 == no such disk
000022:      2      ; -15 == Data channel late
000023:     50      ; -14 == Address Check
000024:     20      ; -13 == Illegal Disc address
000025:    542  .b  JMP .+142    ; -12 == IDRV == 167
000026:    543  .c  JMP .+143    ; -11 == SLUR == 171
000027:    551  .i  JMP .+151    ; -10 == SKNB == 200
000030:    553  .k  JMP .+153    ; -7 == REDS == 203
000031:    557  .o  JMP .+157    ; -6 == SEEK == 210
000032:     14    ; -5 == NSCT -- # sectors

000033:      2    ; -4 == NTRK -- # tracks

000034:     14   ; -3 == LRTC -- Logical to read track conversion factor

000035:     30    ; -2 == LRCC -- logical to real cyl conv factor

000036: 100533    ; -1 == DFLG

000037: 101100  .@  MOVL 0,0   ; READ/WRITE entry
000040:  40513  AK  STA 0,.+113    ; 153
000041: 102400  ..  SUB 0,0
000042:  40523  AS  STA 0,.+123    ; 165
000043:  72233  t.  DOBC 2,33  ; set memory address
000044:  31400  3.  LDA 2,0,3 ; passed parameter 0 == 1
000045:  50507  QG  STA 2,.+107    ; 154
000046:  54507  YG  STA 3,.+107    ; 155
000047:  20746  !f  LDA 0,.-32    ; 15 == DSIZ
000050:   4404  ..  JSR .+4    ; 54
000051:      0  ; cylinder
000052:      0  ; track
000053:      0  ; sector
000054: 171000  r.  MOV 3,2      ; a(table)
000055:   6511  .I  JSR @.+111    ; 166 -- break up cyl, track, sector
000056:  30757  1o  LDA 2,.-21    ; 35 -- LRCC
000057: 175014  z.  MOV# 3,3,SZR  ; track zero ? (only tracks 0 and 1 exist)
000060: 151220  R.  MOVZR 2,2     ; LRCC / 2
000061: 132400  5.  SUB 1,2  ; subtract sector from conversion factor
000062:  20474  !<  LDA 0,.+74    ; 156 == c20
000063: 142433  E.  SUBZ# 2,0,SNC  ; skip if ac2 <= ac0
000064: 111000  ..  MOV 0,2
000065:  20467  !7  LDA 0,.+67    ; 154
000066: 112433  ..  SUBZ# 0,2,SNC
000067: 141000  B.  MOV 2,0
000070:  40464  A4  STA 0,.+64    ; 154
000071: 127120  .P  ADDZL 1,1
000072: 127120  .P  ADDZL 1,1
000073: 175300  z@  MOVS 3,3
000074: 167000  n.  ADD 3,1
000075: 114400  ..  NEG 0,3
000076:  20461  !1  LDA 0,.+61    ; 157
000077: 117400  ..  AND 0,3
000100: 167000  n.  ADD 3,1
000101:  34452  9*  LDA 3,.+52    ; 153
000102: 175200  z.  MOVR 3,3
000103:  31401  3.  LDA 2,1,3
000104: 147000  N.  ADD 2,1
000105:  67033  n.  DOC 1,33
000106:  31402  3.  LDA 2,2,3
000107:  34742  9b  LDA 3,.-36    ; 51
000110: 157000  ^.  ADD 2,3
000111:  30447  1'  LDA 2,.+47    ; 160
000112: 145400  K.  INC 2,1
000113:  20446  !&  LDA 0,.+46    ; 161
000114: 173400  w.  AND 3,2
000115: 137414  ?.  AND# 1,3,SZR
000116: 113000  ..  ADD 0,2
000117:  50433  Q.  STA 2,.+33    ; 152
000120:  20442  !"  LDA 0,.+42    ; 162
000121: 143000  F.  ADD 2,0
000122:  61333  b[  DOAP 0,33
000123: 102400  ..  SUB 0,0
000124:  24437  ).  LDA 1,.+37    ; 163
000125:  34430  9.  LDA 3,.+30    ; 155
000126:  70433  q.  DIA 2,33
000127: 133415  7.  AND# 1,2,SNR
000130:    776  .~  JMP .-2    ; 126
000131:  20422  !.  LDA 0,.+22    ; 153
000132: 101200  ..  MOVR 0,0
000133: 102560  .p  SUBCL 0,0
000134: 101300  .@  MOVS 0,0
000135:  24427  ).  LDA 1,.+27    ; 164
000136: 107000  ..  ADD 0,1
000137:  34416  9.  LDA 3,.+16    ; 155
000140:  60277  `?  NIOC 0,77
000141:  21401  #.  LDA 0,1,3
000142: 100513  .K  NEGL# 0,0,SNC
000143:   1402  ..  JMP 2,3
000144:  30406  1.  LDA 2,.+6    ; 152
000145: 147000  N.  ADD 2,1
000146:  65133  j[  DOAS 1,33
000147:  24405  ).  LDA 1,.+5    ; 154
000150:   1402  ..  JMP 2,3

000151:      0  
000152:      0  
000153:      0  ; r/w flag
000154:      0  ; param 0 from caller
000155:      0  ; return address from caller (incl 3 params)
000156:     20  
000157:     17  
000160:    377  
000161:   2000  
000162: 175000  
000163:  74000  
000164: 174000  
000165:      0  ; bogus status flag

; IDRV routine
000166:      0  ;   a ( break up cyl, sector, track )
000167:  40777  A.  STA 0,.-1    ; 166
000170:   1400  ..  JMP 0,3

000171:  21001  ".  LDA 0,1,2
000172:  63033  f.  DOC 0,33
000173:  60433  a.  DIA 0,33
000174: 101300  .@  MOVS 0,0
000175: 103113  .K  ADDL# 0,0,SNC
000176:   1400  ..  JMP 0,3
000177:   1401  ..  JMP 1,3
000200:  63533  g[  SKPBZ 0,33
000201:   1400  ..  JMP 0,3
000202:   1401  ..  JMP 1,3

; REDS -- read status
000203:  20762  !r  LDA 0,.-16    ; 165
000204: 101015  ..  MOV# 0,0,SNR  ; prior status?
000205:  60633  a.  DIAC 0,33 ; read status --- e.g. 100121
000206:   1400  ..  JMP 0,3


000207: 175400  {.  INC 3,3
000210: 125414  +.  INC# 1,1,SZR
000211:  63077  f?  DOC 0,77
000212:  21001  ".  LDA 0,1,2
000213:  63033  f.  DOC 0,33
000214:  20773  !{  LDA 0,.-5    ; 207
000215:  61333  b[  DOAP 0,33
000216:  24745  )e  LDA 1,.-33    ; 163
000217:  60433  a.  DIA 0,33
000220: 107415  ..  AND# 0,1,SNR
000221:    776  .~  JMP .-2    ; 217
000222:   1400  ..  JMP 0,3
000223:  77377  ~.  DOCP 3,77
000224:  77377  ~.  DOCP 3,77
000225:  77377  ~.  DOCP 3,77
000226:  77377  ~.  DOCP 3,77
000227:  77377  ~.  DOCP 3,77
000230:  77377  ~.  DOCP 3,77
000231:  77377  ~.  DOCP 3,77
000232:  77377  ~.  DOCP 3,77
000233:  77377  ~.  DOCP 3,77
000234:  77377  ~.  DOCP 3,77
000235:  77377  ~.  DOCP 3,77
000236:  77377  ~.  DOCP 3,77
000237:  77377  ~.  DOCP 3,77
000240:  77377  ~.  DOCP 3,77
000241:  77377  ~.  DOCP 3,77
000242:  77377  ~.  DOCP 3,77
000243:  77377  ~.  DOCP 3,77
000244:  77377  ~.  DOCP 3,77
000245:  77377  ~.  DOCP 3,77
000246:  77377  ~.  DOCP 3,77
000247:  77377  ~.  DOCP 3,77
000250:  77377  ~.  DOCP 3,77
000251:  77377  ~.  DOCP 3,77
000252:  77377  ~.  DOCP 3,77
000253:      0  ..  JMP 0
000254:      0  ..  JMP 0
000255:     52  .*  JMP 52
000256:   5000  ..  JSR 0,2
000257:      1  ..  JMP 1
000260:     20  ..  JMP 20
000261:      0  ..  JMP 0
000262:     10  ..  JMP 10
000263:      0  ..  JMP 0
000264:      0  ..  JMP 0
000265:   1400  ..  JMP 0,3
000266:   1400  ..  JMP 0,3
000267:    433  ..  JMP .+33    ; 322
000270:    435  ..  JMP .+35    ; 325
000271:   1400  ..  JMP 0,3
000272:     10  ..  JMP 10
000273:    100  .@  JMP 100
000274:     10  ..  JMP 10
000275:   1000  ..  JMP 0,2
000276:  42020  D.  STA 0,@20
000277:  72220  t.  DOBC 2,20
000300: 111000  ..  MOV 0,2
000301: 101100  .@  MOVL 0,0
000302:  40417  A.  STA 0,.+17    ; 321
000303:  60277  `?  NIOC 0,77
000304:  21401  #.  LDA 0,1,3
000305: 100513  .K  NEGL# 0,0,SNC
000306:   1402  ..  JMP 2,3
000307:  21001  ".  LDA 0,1,2
000310: 107000  ..  ADD 0,1
000311:  20410  !.  LDA 0,.+10    ; 321
000312: 101202  ..  MOVR 0,0,SZC
000313:    403  ..  JMP .+3    ; 316
000314:  65120  jP  DOAS 1,20
000315: 102257  ./  ADCOR# 0,0,SBN
000316:  65320  jP  DOAP 1,20
000317: 126520  -P  SUBZL 1,1
000320:   1402  ..  JMP 2,3
000321:      0  ..  JMP 0
000322:  63520  gP  SKPBZ 0,20
000323:   1400  ..  JMP 0,3
000324:   1401  ..  JMP 1,3
000325:  60620  a.  DIAC 0,20
000326:   1400  ..  JMP 0,3
000327:  77377  ~.  DOCP 3,77
000330:  77377  ~.  DOCP 3,77
000331:  77377  ~.  DOCP 3,77
000332:  77377  ~.  DOCP 3,77
000333:  77377  ~.  DOCP 3,77
000334:  77377  ~.  DOCP 3,77
000335:  77377  ~.  DOCP 3,77
000336:  77377  ~.  DOCP 3,77
000337:  77377  ~.  DOCP 3,77
000340:  77377  ~.  DOCP 3,77
000341:  77377  ~.  DOCP 3,77
000342:  77377  ~.  DOCP 3,77
000343:      0  ..  JMP 0
000344:      0  ..  JMP 0
000345:  61120  bP  DOAS 0,20
000346:  20777  !.  LDA 0,.-1    ; 345
000347:    403  ..  JMP .+3    ; 352
000350:  61320  bP  DOAP 0,20
000351:  20777  !.  LDA 0,.-1    ; 350
000352:  40404  A.  STA 0,.+4    ; 356
000353:  72220  t.  DOBC 2,20
000354:  20767  !w  LDA 0,.-11    ; 343
000355: 123000  &.  ADD 1,0
000356:  61020  b.  DOA 0,20
000357: 102400  ..  SUB 0,0
000360: 101405  ..  INC 0,0,SNR
000361:   1400  ..  JMP 0,3
000362:  63520  gP  SKPBZ 0,20
000363:    775  .}  JMP .-3    ; 360
000364:  60620  a.  DIAC 0,20
000365: 101212  ..  MOVR# 0,0,SZC
000366:   1400  ..  JMP 0,3
000367:   1401  ..  JMP 1,3
000370:  77377  ~.  DOCP 3,77
000371:  77377  ~.  DOCP 3,77
000372:  77377  ~.  DOCP 3,77
000373:  77377  ~.  DOCP 3,77
000374:  77377  ~.  DOCP 3,77
000375:  77377  ~.  DOCP 3,77
000376:  77377  ~.  DOCP 3,77
000377:  77377  ~.  DOCP 3,77


This page is a part of the "Understanding IRIS" collection.  

No comments:

Post a Comment