*
* Device parameters control block
*
DP_TABLE  equ *
DP_width  fcb 0 Step Pulse Width
DP_period fcb 0 Time between pulses
DP_mode   fcb 0 Stepping mode (0->buffered)
DP_heads  fcb 0 Number of heads (-1)
DP_cyls   fdb 0 Number of cylinders (-1)
DP_wsi    fcb 0 Write Precomp cylinder
DP_type   fcb 0 Drive type
DP_sectrk fcb 0 Sectors/Track
          fcb 0 ** Filler **
*
* Seek table - Used to translate Xebec seeks to OMTI
*
seek_tbl equ *
 fcb $09,$3C 0
 fcb $09,$3C 1
 fcb $09,$3C 2
 fcb $09,$3C 3
 fcb $02,$04 4
 fcb $02,$00 5
 fcb $02,$00 6
 fcb $02,$00 7
*
*  Set up controller
*
omtiidc pshs d,x,y save registers
 cmpx windrv same drive as last operation?
 lbeq omtiid9 yes - exit
 tfr x,d -- compute table index
 leay d,x 2*X
 ldy windtyp,y
 pshs y save it
 ldx winotyp compare with last table sent
 ldb #11
10 lda ,x+
 cmpa ,y+
 bne 15f jump if not the same
 decb
 bne 10b continue
 puls y clean up stack
 lbra omtiid9 exit - no need to reconfigure
15 ldy 0,s no match - copy table
 ldx winotyp
 ldb #11
17 lda ,y+
 sta ,x+
 decb
 bne 17b
*-- Reformat info for OMTI Assign Disk Parameters command
 puls y restore table address
 ldd ,y++ get # cylinders
 subd #1
 std DP_cyls
 lda ,y+ get # heads
 deca
 sta DP_heads
 ldd ,y++ Reduced write
 ldd ,y++ Write precomp
 anda #$03
 stb DP_wsi
 sta DP_type
 tst ,y+ skip burst length
 lda ,y+ get seek rate
 anda #$07
 lsla
 ldx #seek_tbl
 leax a,x
 lda ,x+
 sta DP_width
 lda ,x+
 sta DP_period
 lda ,y+ get imbedded servo indicator
 beq 18f
 lda #%00110000
 ora DP_type
 sta DP_type
18
 if PRT_DCT
 bsr prt_dct
 endif
 lda #OMTIIDC Initialize Drive Characteristics
 sta OMTIcmd
 lda #1 no DMA/IRQ
 lbsr omticn send command
omtiid2 lbsr omtiwt wait for READY
 bitb #$14 wait for REQ=1, I/O=0, C/D=0
 bne omtiid2
 lda #10
 ldx #DP_TABLE
omtiid3 lbsr omtiwt wait for READY
 ldb ,x+
 stb OMTI_DAT
 deca done?
 bne omtiid3
 lbsr omtist wait for end of command and check status
 beq omtiid9
 pshs d,x
 ldx #00f
 jsr Pdata
 lda winsbf get error code
 jsr Phex
 bra 99f
00 fcc $d,'OMTI Error on IDC: ',0
99 puls d,x
omtiid9
 ldx 2,s restore drive index
 stx windrv no - remember drive #
 puls d,x,y,pc
 if PRT_DCT
*
prt_dct pshs d,x,y,u
 ldx #00f
 jsr Pdata
 lda 2+1,s
 jsr Phex
 ldx #01f
 jsr Pdata
 ldb #10
 ldy #DP_TABLE
0 lda ,y+
 jsr Phex
 jsr Pspace
 decb
 bne 0b
 puls d,x,y,u,pc
00 fcc $d,'OMTI DCT - Unit: ',0
01 fcc ', Table: ',0
 endif
