.Page ClcScDly .Equ * Cmp #13 Bcs $43 ; If 'a' >= 13 then only wait for head settling Tay ; Save the number of steps Lda #0 ; ccC already = '0' $31 Adc #2 ; Use 10 msec/Step instead of 12 msec Dey Bne $31 Sta Temp1 Lda ScDly Sec Sbc Temp1 Bcs $65 ; If ccC=1 then result is positive $43 Lda HeaDelay ; Assume only wait for head settling Rts $65 Cmp HeaDelay ; See if head settling time is also included Bcc $43 Rts ;++ ; Recalbrt ;-- RecalMtr .Equ * Lda MtrOn Bne Recall ; If motor is not on then turn it on & wait 400ms Jsr TMOn Recalbrt .Equ * ; Entry point for Recalbrt Recall .Equ * Ldy #0 Sty CurTrack Jsr SetSpdy ; Set CurClass to '0' also Dey Sty HostSeek ; Tell 68K that I am seeking Ldx #Inward Jsr SetDrctX Ldx #RclStep Stx Temp3 ; 3 steps awau from track 00 for bad power supply $06 Jsr DoStep ; step away from track 0 Dec Temp3 Bne $06 ; Loop 2 times for 3 total steps Lda #TurnRnd ; Must wait for stepper to come to it's senses Jsr Wait Ldx #TmOutRcl Stx Temp3 ; Timeout if unable to leave track 0 being true $17 Jsr ReadIndx ; Read track 0 line Bcs $21 ; If ccC = 1 then /Trk00 is false Jsr DoStep ; Step away from track 00 ( direction is already set ) Dec Temp3 ; Maximum of 80 steps Bne $17 ; Loop while less than 80 steps Beq $72 ; Abort upon underflow $21 Ldx #Outward Jsr SetDrctX ; Seek away from spindle toward Track 00 Stx Temp2 $43 Dec Temp2 ; For each step save a counter Beq $78 ; Abort upon underflow Jsr DoStep Jsr ReadIndx Bcs $43 Lda #TmOutRcl Sbc Temp2 ; Result will be positive & = number of steps Jsr ClcScDly ; Calc speed change delay time, return in 'A' Jsr Wait ; Now wait for about 150 ms Jsr SpdChk ; Check/Adjust the speed at track 0 & return error $68 Ldx #0 Stx HostSeek ; Done seeking Rts $72 Lda #DErrTk0 ; Unable to leave track 0 behind Bne $82 $78 Lda #DErrCal ; Timeout during recal constant $82 Sta Iob+DrvError Sec Bcs $68 .Page ClpEnty .Equ * ; Entry point used by clamp command Clamp .Equ * ; Entry point for clamp Rts .Page ;++ ; ; uSWait ; ; **** ; * The followig codes assume ; * a cycle time of 0.5 uSec ; **** ; ; Delays a specified number of 100 uSec intervals for timing purposes ; a call to uSWait takes E X A C T L Y (A-reg * 100 uSec) to complete, ; including the Jsr-Rts, therefore the following code takes 301 uSec to ; execute: ; Lda #3 1 uSec ( 2 Cycles) ; Jsr uSWait 300 uSec (600 Cycles) ; ;-- ; ; REGISTERS ; IN ; A = Number of 100 uSec intervals to delay ; X = Any value ; Y = Any value ; OUT ; A = Destroyed ; X = Destroyed ; Y = Unchanged ;-- WaitAlt .Equ * ; Alternate entry point fo DoStep Lda StpDly ; Load delay time uSWait .Equ * ; Entry point for uSWait Ldx #023 ; (2) uSWait1 Dex ; (2) Bne uSWait1 ; (3,2) Ldx #026 ; (2) Nop ; (2) Sec ; (2) Sbc #001 ; (2) Bne uSWait1 ; (3,2) Nop ; (2) Rts ; (6) .Page ;++ ; ; Wait ; ; Wait A-reg times 5 miliseconds ; ;-- ; ; REGISTERS ; IN : A = Number of 5 msec intervals to wait ; X = Any value ; Y = Any value ; OUT ; A = Destroyed ; X = Destroyed ; Y = '0' ; ; CALLS ; uSWait Wait A-reg number of 100 uSec intervals ;-- Wait .Equ * ; Entry point for wait Tay Wait1 Lda #50. ; Call uSWait for 50*100 = 5000 uSec Jsr uSWait Dey Bne Wait1 Rts