home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol152 / ddd11.asm < prev    next >
Encoding:
Assembly Source File  |  1984-04-29  |  44.6 KB  |  2,179 lines

  1.  
  2.  
  3. ;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
  4. ;<>******************************************************<>
  5. ;<>*                              *<>
  6. ;<>*                     D D D                      *<>
  7. ;<>*                            *<>
  8. ;<>*                Dysan Corporation               *<>
  9. ;<>*          Customer Engineering Division        *<>
  10. ;<>*              1244  Reamwood  Avenue        *<>
  11. ;<>*         Sunnyvale, Cal.    94086        *<>
  12. ;<>*                            *<>
  13. ;<>******************************************************<>
  14. ;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 
  15.  
  16.  
  17.  
  18. ;    This document contains information developed by
  19. ;    Dysan Corporation (Dysan) and is furnished for 
  20. ;    information only.
  21.  
  22. ;    Dysan makes no warranty or representation (expressed
  23. ;    or implied) with respect to the accuracy, completeness
  24. ;    or usefulness of the information contained herein.
  25. ;    Further Dysan assumes no responsibility for liability
  26. ;    or damage of any kind which may result from the use 
  27. ;    of the information contained herein.
  28.  
  29. ;    THIS PROGRAM IS IN THE PUBLIC DOMAIN, AND MAY BE
  30. ;            FREELY COPIED AND DISTRIBUTED
  31. ;
  32. ;
  33.  
  34.  
  35.  
  36. ;    ****************************************************************
  37. ;
  38. ;    USAGE:
  39. ;
  40. ;    To use this program, a digital alignment disk is required.
  41. ;    You may purchase the required "Digital Diagnostic Diskette" (tm)
  42. ;    directly from Dysan Corporation.  Available DDD(tm) models are:
  43. ;
  44. ;    SIDES:............SINGLE SIDED.............DOUBLE SIDED
  45. ;    DENSITY:......SINGLE(FM) DOUBLE(MFM)...SINGLE(FM) DOUBLE(MFM)
  46. ;    SIZE & TPI:
  47. ;    8"     48 TPI   808-100   808-200        808-300   808-400
  48. ;    5.25"  48 TPI   508-100   508-200        508-300   508-400
  49. ;    5.25"  96 TPI   506-100   506-200        506-300   506-400
  50. ;    5.25" 100 TPI   CALL FOR AVAILABILITY    CALL FOR AVAILABILITY
  51. ;
  52. ;
  53. ;    PRICES:     Single Sided - $30.00     Double Sided - $40.00
  54. ;         Plus appropriate sales taxes and shipping costs
  55. ;         Prices and models subject to change without notice
  56. ;
  57. ;
  58. ;    ORDERING:  Contact your local Dysan sales Rep. or call
  59. ;           Inside Northern California:  (408) 988-3472
  60. ;           Outside Northern California: (800) 551-9000
  61. ;
  62. ;
  63. ;    TECHNICAL INFORMATION:  For information regarding DDD(tm)
  64. ;                applications contact Dysan's
  65. ;                CE Division TECH-LINE: (408)734-1624
  66. ;
  67. ;
  68.  
  69.  
  70.  
  71. ;    ****************************************************************
  72. ;
  73. ;    HISTORY:
  74. ;
  75. ;    VERSION 1.0: Developed by Dysan for their Single Card Computer
  76. ;                    and Hazeltine 1500 terminal
  77. ;
  78. ;    VERSION 1.1: Modified by Loren Amelang, Box 24, Philo, Ca.
  79. ;                          95466 0024
  80. ;        Added drive selection; commented out code which required
  81. ;        a macro assembler (you can now use ASM); substituted 
  82. ;        CP/M BDOS calls for version 1.0 BIOS calls; modified cline
  83. ;        & its usage for terminals without clear-to-end-of-line;
  84. ;        added display of last sectors read; modified disc
  85. ;        read routines for CCS 2422 controller and
  86. ;        programmed I/O transfer; 
  87. ;
  88. ;
  89.  
  90.  
  91.  
  92. ;    ****************************************************************
  93. ;
  94. ;    ENVIRONMENT:
  95. ;    
  96. ;    Digital Research's  MAC  macro assembler has
  97. ;    been  used to compile this program.
  98. ;
  99. ;            Digitial Research
  100. ;                  P.O. Box 579
  101. ;          801 Lighthouse Avenue
  102. ;          Pacific Grove, Ca 93950
  103. ;             (408) 649-3896
  104. ;
  105. ;    This example skeleton program may be used to read
  106. ;    the Digital Diagnostic Diskette. Many features can
  107. ;    be added to make a more substantial program. The
  108. ;    read routines are directed at the 8 inch "DDD",but
  109. ;    can be altered for 5 1/4 inch "DDD"
  110. ;        
  111. ;    The Western Digital 1793 floppy controller has been
  112. ;    chosen because of its wide use in micro computers.
  113. ;    This program dosn't depend upon this controller, but
  114. ;    the controller used must be able to read FM or MFM
  115. ;    formats.
  116. ;        
  117. ;           Western Digital Corp
  118. ;              P.O. Box 2180
  119. ;               3128 Redhill Avenue
  120. ;          Newport Beach, Cal 92663
  121. ;              (714) 557-3550
  122. ;
  123. ;    The following features of { DDD } are utilized: 
  124. ;        
  125. ;            Radial alignment check
  126. ;            Azimuth alignment check
  127. ;            Centering 
  128. ;            Stepper Hysteresis
  129. ;            Index Timing
  130. ;
  131. ;    The RPM check is not a function of the { DDD }.
  132. ;
  133. ;    Original configuration (Version 1.0):
  134. ;
  135. ;    A. Hazeltine 1500 Terminal   
  136. ;    B. 8080 Assembly language
  137. ;    C. Timing based on 4mhz Z80 processor
  138. ;    D. Direct Console I/O to CP/M 80
  139. ;    E. Disk operations written for Dysan's
  140. ;       Single Card Computer.
  141. ;    F. Diagnostic Disk (808-100)
  142. ;
  143. ;
  144.  
  145.  
  146.  
  147. ;    ****************************************************************
  148. ;
  149. ;    PROGRAM SOURCE CODE:
  150. ;
  151. ;    title    'Drive Diagnostic Program for CP/M 80 1/15/83'
  152. ;
  153. ;    File ddd.asm
  154. ;
  155.  
  156. wboot    equ    0        ; warm boot address
  157.  
  158. bdos    equ    5        ; jump address for bdos calls
  159.  
  160.  
  161. **********************
  162. *** "CONDITIONALS" ***
  163. **********************
  164. ;
  165. ;    Choose the appropriate assemble time options for your system,
  166. ;    or use this space to add new system options.
  167. ;
  168. true    equ    0ffffh
  169. false    equ    not true
  170. ;
  171. Dysan    equ    false    ;set this true for Dysan controller
  172. CCS    equ    true    ;set this true for CCS 2422 controller 
  173.             ;    programmed i/o transfer, etc.
  174. lineclr    equ    false    ;set this true if your console has
  175.             ;    a clear-to-end-of-line command
  176. Hazel    equ    false    ;set this true for Hazeltine 1500 terminal
  177.             ;    (requiring "lead-in" to commands)
  178. Loren    equ    true    ;set this true for Loren's homebrew terminal...
  179. ;
  180. ;ADD CONDITIONAL OPTIONS FOR YOUR ENVIRONMENT HERE...
  181. ;
  182. ;
  183.  
  184.     
  185. ********************************
  186. *** "MACRO CALL BIOS DIRECT" *** 
  187. ********************************
  188. ;
  189. ;    This macro was used in version 1.0 to Link console I/O
  190. ;    only, the disk i/o routines also may be linked
  191. ;    to CP/M 2.2 with this macro.
  192. ;
  193. ;    e.g.  gobios 24        ; select drive
  194. ;
  195. ;
  196. ;    Function:
  197. ;    Loads Warm boot address to bios
  198. ;    and computes offset to routine.
  199. ;
  200. ;
  201. ;gobios    macro    @func        
  202. ;    lhld    wboot+1        ; Warm boot address
  203. ;    lxi    d,@func        ; Offset
  204. ;    dad    d        ; Add offset
  205. ;    pchl            ; Go to bios routine
  206. ;    endm
  207.  
  208.  
  209. ***************************
  210. *** "CONSOLE FUNCTIONS" ***
  211. ***************************
  212.  
  213. ;    The following are direct console commands
  214. ;    which can be altered for most consoles.
  215.  
  216. ;    note:
  217. ;         The text print routine must be altered
  218. ;         if "Row" is sent before "Column" or 
  219. ;            bias is needed.
  220.  
  221.     if    Hazel        ;version 1.0
  222. add$cur equ    17        ; address cursor command
  223. clr$co    equ    28        ; clear to foreground spaces
  224. lead$in    equ    126        ; console lead-in 
  225. end$ln    equ    15        ; clear to end of line
  226.     endif
  227.  
  228.     if    Loren        ;version 1.1
  229. add$cur equ    01        ; address cursor command
  230. clr$co    equ    05        ; clear to foreground spaces
  231.     endif
  232.  
  233. cr    equ    0dh        ; carriage return
  234. lf    equ    0ah        ; line feed
  235. esc    equ    1Bh        ; escape
  236. bs     equ    8        ; back space
  237. bell    equ    7        ; audio alert
  238.  
  239.  
  240. ****************************************
  241. *** "FLOPPY CONTROLLER PORT EQUATES" ***
  242. ****************************************
  243.  
  244. ;    Change the following Port assignments for
  245. ;    Your system.
  246. ;
  247. ;    "FDC"  Acronym  Floppy Disk Controller
  248. ;
  249. ;    FDC port assignments:
  250. ;
  251.     if    Dysan        ;version 1.0
  252. fdc     equ    0f8H        ; Base port address FDC
  253. ;
  254. cmd    equ    fdc        ; command reg.
  255. stat      equ    fdc        ; status reg.
  256. trk    equ    fdc+1        ; track reg.
  257. sec    equ    fdc+2        ; sector reg.
  258. data    equ    fdc+3        ; data reg.
  259. dma     equ    fdc+4        ; Dma controller
  260. dsel    equ    fdc+5        ; drive select
  261.     endif
  262.  
  263.     if     CCS        ;version 1.1
  264. fdc     equ    30H        ; Base port address FDC
  265. ;
  266. cmd    equ    fdc        ; command reg.
  267. stat      equ    fdc        ; status reg.
  268. trk    equ    fdc+1        ; track reg.
  269. sec    equ    fdc+2        ; sector reg.
  270. data    equ    fdc+3        ; data reg.
  271. dma     equ    004CH        ;memory address of pointer to 
  272. ;                                          sector buffer
  273. dsel    equ    fdc+4        ; drive select port:
  274.                 ;output BX for single density
  275.                 ;       FX for double density
  276.                 ;   where X = 1 for drive A
  277.                 ;             2 for drive B
  278.                 ;             4 for drive C
  279.                 ;             8 for drive D
  280.     endif
  281.     
  282. ************************************
  283. *** "FLOPPY CONTROLLER COMMANDS" ***
  284. ************************************
  285.  
  286. ;    These are common to most systems using the 1793.
  287. ;    sdma is a Dysan controller command, ignored in V. 1.1.
  288.  
  289. clear    equ    0d0h        ; clear FDC
  290. sdma    equ    87h        ; Start Dma Transfer
  291. rsec    equ    80h        ; read sector
  292. raddr    equ    0c0h        ; read address
  293. seek    equ    18h        ; seek track
  294. restore    equ    8        ; home Head(s)
  295. sdelay    equ    4        ; seek delay flag
  296.  
  297. *************************************
  298. *** "FLOPPY CONTROLLER VARIABLES" ***
  299. *************************************
  300.  
  301. rate    equ    1        ; step rate 
  302. retry    equ    1        ; read retries
  303. fdelay    equ    11    ; FDC delay
  304.             ; see "delay" routine - this value is for
  305.             ; 4 Mhz. Z-80;  adjust here or in "delay"
  306.             ; to suit your clock and processor...
  307. indxbyt    equ    2    ; byte in status reg. when index hole
  308.             ; is passing sensor
  309. busybyt    equ    1    ; byte in status reg. when controller
  310.             ; is busy
  311. drqbyt    equ    2    ; byte in status reg. when data is 
  312.             ; waiting to be read by the computer
  313.  
  314. ******************************
  315. *** "DDD DISKETTE EQUATES" *** 
  316. ******************************
  317.  
  318. ;    Adjust to match your diskette size and format.
  319.  
  320. ttrk     equ    76        ; total number of tracks
  321. sectors    equ    26        ; sectors per track
  322.                 ; 26 for 8" DDD, 16 for 5.25" DDD
  323. lneg    equ    sectors+2        ; last neg. sector +2
  324. lpos    equ    sectors+1        ; last pos. sector +2
  325. tsec    equ    (sectors/2)-1    ; centering test
  326.  
  327.     if     Dysan
  328. ref    equ    798        ; reference time (single Den)
  329.                 ; (used in "index 7")
  330.     endif
  331.  
  332.     if    CCS
  333. ref    equ    24eh        ; experimentally determined...
  334.     endif
  335.  
  336.  
  337.  
  338. ***************************
  339. *** "MAIN PROGRAM LOOP" *** 
  340. ***************************
  341.  
  342.     org    100h
  343. ;    ====    ====
  344.     lxi    sp,stack    ; init stack
  345.     call    select        ; select drive
  346. ;
  347. main:
  348.     lxi    sp,stack    ; reset stack 
  349.     call    cls        ; clear display
  350.     lxi    h,me1        ; display Menu..
  351.     call    text
  352.     call    ci        ; selection?
  353.     cpi    'R'        ; "Radial"
  354.     jz    radial            
  355.     cpi    'A'        ; "Azimuth"
  356.     jz    azimuth
  357.     cpi    'C'        ; "Centering"
  358.     jz    center
  359.     cpi    'H'        ; "Hysteresis"
  360.     jz    hyster 
  361.     cpi    'S'        ; "RPM"
  362.     jz    rpm
  363.     cpi    'I'        ; "Index"
  364.     jz    index
  365.     cpi    'D'        ;"Drive Select"
  366.     jnz    ex
  367.     call    select
  368.     jmp    main        ;new drive selected - get option
  369.  
  370. ex:    cpi    'E'        ; "Exit to DOS"
  371.     jz    exit         
  372.     mvi    a,bell        ; Not valid
  373.     call    co
  374.     jmp    main        ; try again...
  375.  
  376.  
  377. **********************
  378. *** " EXIT TO DOS" ***
  379. **********************
  380.  
  381. exit:
  382.     call    cls        ; clear display
  383.     jmp    wboot
  384.  
  385. *************************
  386. *** "CONSOLE  STATUS" ***   
  387. *************************
  388.  
  389. ;    returns with zero status flag set.
  390.  
  391. cstat:
  392.     push    h        ; save all registers
  393.     push    d
  394.     push    b
  395. ;    call    cstat1        ; Data ready?
  396.     mvi    c,11        ; BDOS console status
  397.     call    bdos        ; function call added for V1.1
  398.     pop    b
  399.     pop    d
  400.     pop    h
  401.     ora    a
  402.     ret
  403. ;cstat1:
  404. ;    gobios    3        ; macro
  405.  
  406. ***********************
  407. *** "CONSOLE INPUT" *** 
  408. ***********************
  409. ;
  410. ;    Returns character in "A" reg.
  411. ci:
  412.     push    h        ; Save all registers
  413.     push    d
  414.     push    b
  415. ;    call    ci1        ; take  character 
  416.     mvi    c,1        ; BDOS console input
  417.     call    bdos        ; function call added for V1.1
  418.     pop    b
  419.     pop    d
  420.     pop    h
  421.     cpi    esc        ; Exit?
  422.     jz    main         ; YES!
  423.     cpi    'a'        ; convert to upper case
  424.     rc            ; only...
  425.     cpi    '{'
  426.     rnc
  427.     ani    '^'+1        
  428.     ret
  429.  
  430. ;ci1:
  431. ;    gobios    6        ; macro
  432.  
  433.  
  434.  
  435. ************************
  436. *** "CONSOLE OUTPUT" *** 
  437. ************************
  438. ;
  439. ;    Enter with character in "A" reg.
  440.  
  441. co:
  442.     push    psw
  443.     push    h        ; save all registers
  444.     push    d
  445.     push    b
  446. ;    mov    c,a        ; Pass char in "C" reg
  447.     mov    e,a        ; Pass char in "E" reg for V1.1
  448.     mvi    c,6        ; BDOS direct console i/o
  449.     call    bdos        ; function call added for V1.1
  450. ;    call    co1        
  451.     pop    b
  452.     pop    d
  453.     pop    h
  454.     pop    psw
  455.     ret
  456.  
  457. ;co1:
  458. ;    gobios    9        ; macro
  459.  
  460.  
  461. ********************
  462. *** "LINE INPUT" ***
  463. ********************
  464.  
  465. ;    used to input data greater then one
  466. ;    character which is terminated by "CR".
  467. ;    (used only by "offset:" directly below here...)
  468.  
  469. getln:
  470. ;    lxi    d,buffer    ; input buffer
  471.  
  472. ; Following code added to V1.1 to use standard BDOS call for Line Input:
  473.     lxi    d,inbuf        ; input buffer in BDOS 10 format
  474.     mvi    c,0Ah        ; Console Input Line function
  475.     call    bdos        ; added for V 1.1
  476.     lhld    incnt        ; get # of characterrs read
  477.     mvi    h,0        ; incnt is only one byte...
  478.     xchg            ; move to de reg
  479.     lxi    h,buffer    ; get text buffer address
  480.     dad    d        ; increment buffer pointer by # chars
  481.     mvi    m,0dh        ; place "cr" after valid chars
  482.                 ;     as V1.0 expects...
  483.     ret
  484. ;
  485. ;gl1:    
  486. ;    call    ci        ; Wait for Input
  487. ;    cpi    lf        ; Line feeds Not allowed
  488. ;    jz     gl1
  489. ;    cpi    '_'        ; treat as back space
  490. ;    jz     back
  491. ;    cpi    bs        ; check for back space
  492. ;    jz     back
  493. ;    cpi    7fh        ; Delete char?
  494. ;    jz     back
  495. ;    cpi    cr        
  496. ;    jz     gl2
  497. ;    cpi    ' '
  498. ;    jc     gl1        ; control Characters Not allowed
  499. ;;
  500. ;gl2:
  501. ;    stax    d        ; store char
  502. ;    inx    d        ; next address
  503. ;    call    co        ; echo char
  504. ;    cpi    cr        ; end of Line?
  505. ;    rz            ; Yes!
  506. ;    lxi    h,buffer+4    ; end of Buffer
  507. ;    call    dehl        ; check 
  508. ;    jnz     gl1        ; No!
  509. ;    jnz     gl1        ; No!
  510. ;    jnz     gl1        ; No!
  511. ;;
  512. ;back:
  513. ;    lxi    h,buffer    ; can backup ?
  514. ;    call    dehl
  515. ;    jz     gl1        ; NO!
  516. ;    dcx    d        ; Backup text pointer
  517. ;    mvi    a,bs        ; backup cursor
  518. ;    call    co
  519. ;    mvi    a,' '        ; store Space
  520. ;    call    co
  521. ;    mvi    a,bs        ; adjust cursor
  522. ;    call    co
  523. ;    jmp    gl1        ; New char
  524.  
  525. **********************************
  526. *** "BIAS FROM SELECTED TRACK" ***
  527. **********************************
  528. ;
  529. ;    Sets the required offset for Hysteresis
  530. ;    test.
  531.  
  532. offset:
  533.     call    cls        ; clear display
  534.     lxi    h,me6        ; OFFSET?
  535.     call    text
  536.     call    getln        ; Input offset
  537.     call    getnum        ; convert to hex
  538.     cpi    cr        ; at end of line?
  539.     jnz    offset1        ; error...
  540.     mov    a,h        ; check Limits 
  541.     ora     a
  542.     jnz    offset1
  543.     mov    a,l
  544.     cpi    ttrk+1        ; Greater then last track?
  545.     jnc    offset1
  546.     sta    bais        ; save offset 
  547.     ret
  548. ;
  549. offset1:
  550.     mvi    a,bell        ; alert operator
  551.     call    co
  552.     jmp    offset
  553.  
  554.  
  555. *******************************
  556. *** "INPUT TRACK LOCATIONS" *** 
  557. *******************************
  558.  
  559. ;    Input track locations for Radial
  560. ;    Hysteresis,Centering and Index tests.
  561. ;    "B" contents Upper Limit upon entry.
  562.  
  563. inp$trk:
  564.     call    cls        ; clear display...
  565.     call    text
  566. ;
  567. inp$trk1:
  568.     call    ci        ; waiting...
  569.     cmp    b          ; within limits?
  570.     jnc    inp$trk2    ; no... 
  571.     sui    'A'        
  572.     jc    inp$trk2    ; try again  
  573.     lhld    temp         ; table pointer
  574.     mvi    d,0
  575.     mov    e,a
  576.     dad    d        ; add offset
  577.     mov    a,m        ; load track
  578.     jmp     track        ; seek to track
  579. ;
  580. inp$trk2:
  581.     mvi    a,bell        ; alert
  582.     call    co
  583.     jmp    inp$trk1    ; try again...
  584.  
  585. ***********************************************
  586. *** "RADIAL AND HYSTERESIS TRACK LOCATIONS" ***
  587. ***********************************************
  588.  
  589. rh$tbl
  590.     db    0        
  591.     db    3
  592. ;    Note:  some Dysan spec sheets list track 5 rather 
  593. ;    than 3 as an index track - my Revision A DDD definitely
  594. ;    uses track 3...  LA.
  595.     db    38
  596.     db    41
  597.     db    70
  598.     db    73
  599.  
  600. ***************************   
  601. *** "INDEX TRACK TABLE" *** 
  602. ***************************   
  603.  
  604. ix$tbl:
  605.     db    0
  606.     db    76
  607.  
  608. *************************
  609. ** "CENTERING TRACKS" ***
  610. *************************
  611.  
  612. cen$tbl:
  613.     db    35
  614.     db    44
  615.     db    47
  616.  
  617.  
  618. *******************************
  619. *** "PRINT DECIMAL NUMBERS" *** 
  620. *******************************
  621. ;
  622. ;    Enter with number to be printed in
  623. ;    'DE' reg.
  624.  
  625. pnum:
  626.     push    h        ; Setup Stack
  627.     lxi    h,10        ; Terminator...
  628.     push    h
  629.     push    h
  630. ;
  631. pn1:    
  632.     call    div16        ; Divide Number By (10)
  633.     mov    a,d        ; Check result
  634.     ora    e        ; = 0
  635.     jz     pn2
  636.     xthl
  637.     dcr    l
  638.     push    h
  639.     lxi    h,10
  640.     jmp    pn1        ; Divide Again
  641. ;
  642. pn2:
  643.     pop    d        ; Display Values
  644.     mov    e,l
  645. ;
  646. pn3:
  647.     mov    a,e        ; Check for Terminator (10)
  648.     cpi    10
  649.     pop    d        ; Next digit 
  650.     rz
  651.     adi    '0'        ; Add ascii Bias
  652.     call    co
  653.     jmp    pn3        
  654.  
  655.  
  656. ****************************
  657. *** "16 BIT SUBTRACTION" *** 
  658. ****************************
  659. ;
  660. ;    Subtract "DE" from "HL"
  661. subde:    
  662.     mov    a,l        
  663.     sub    e
  664.     mov    l,a        
  665.     mov    a,h        
  666.     sbb    d
  667.     mov    h,a        
  668.     ret
  669.  
  670.  
  671. ************************************************
  672. *** "CONVERT ASCII DECIMAL NUMBER TO BINARY" ***    
  673. ************************************************
  674. ;
  675. ;    Returns 16 bit hex value in "HL" regs.
  676.  
  677. get$num:
  678.     call    sksp        ; Skip Spaces and Return Char
  679.     lxi    h,0        ; Clear counter
  680.     mov    b,h        ; Clear "B"
  681. ;
  682. get$num1:
  683.     cpi    cr        ; end of line?
  684.     cpi    '0'        ; less than
  685.     rc            ; yes Error!
  686.     cpi    ':'        ; Upper Limit
  687.     rnc            ; Returns "CR"
  688.     mvi    a,0f0h        ; mask Upper Nibble
  689.     ana    h
  690.     rnz            
  691.     inr    b        ; +1
  692.     push    b        ; Save count..
  693.     mov    b,h
  694.     mov    c,l        ; Swap "HL" with "BC"
  695.     dad    h
  696.     dad    h
  697.     dad    b
  698.     dad    h
  699.     ldax    d        ; Load Same Char..
  700.     inx    d        ; next Char 
  701.     ani    0fh        ; Mask Lower Nibble
  702.     add     l
  703.     mov    l,a        ; save result
  704.     mvi    a,0        ; Clear "A"
  705.     adc    h        ; Add carry
  706.     mov    h,a
  707.     pop    b        ; restore counter..
  708.     ldax    d        ; Load next Char..
  709.     jmp    getnum1 
  710.     
  711. *****************************************
  712. *** "SKIP OVER SPACES IN TEXT BUFFER" *** 
  713. *****************************************
  714.  
  715. sksp:
  716.     lxi    d,buffer    ; point to text buffer
  717. ;
  718. sksp1:
  719.     ldax    d          ; check for Space
  720.     cpi    ' '        ; First Non Space return
  721.     rnz
  722.     inx    d
  723.     jmp    sksp1
  724.  
  725. *****************************
  726. *** "COMPARE "DE" TO "HL" ***   
  727. *****************************
  728.  
  729. dehl:
  730.     mov    a,l        ; compare "E" to "L"
  731.     cmp    e        ; If not zero return
  732.     rnz
  733.     mov    a,h
  734.     cmp    d 
  735.     ret
  736.  
  737.  
  738.  
  739. **********************************
  740. *** "16/24 BIT DIVIDE ROUTINE" ***
  741. **********************************
  742.  
  743. ;    Divide "HL" by "DE"
  744. ;
  745.  
  746. div16:    
  747.     xra    a        ; optional 16 bit divide
  748. ;
  749. div24:    
  750.     sta    msb        ; Normal 24 bit divide
  751.     shld    msb1
  752.     lxi    h,msb2
  753.     mvi    m,24+1
  754.     lxi    b,0
  755.     push    b
  756. div25:    
  757.     mov    a,e
  758.     ral
  759.     mov    e,a
  760.     mov    a,d
  761.     ral
  762.     mov    d,a
  763.     lda    msb
  764.     ral
  765.     sta    msb
  766.     dcr    m
  767.     pop    h
  768.     rz
  769.     mvi    a,0
  770.     aci    0
  771.     dad    h
  772.     mov    b,h
  773.     add    l
  774.     lhld    msb1
  775.     sub    l
  776.     mov    c,a
  777.     mov    a,b
  778.     sbb    h
  779.     mov    b,a
  780.     push    b
  781.     jnc    div26
  782.     dad    b
  783.     xthl
  784. ;
  785. div26:    
  786.     lxi    h,msb2
  787.     cmc
  788.     jmp    div25
  789.  
  790.  
  791.  
  792. ******************************
  793. *** "CLEAR CONSOLE DISLAY" *** 
  794. ******************************
  795.  
  796. ;    Clear console to foreground spaces.
  797.  
  798. cls:
  799.     if     Hazel
  800.     mvi    a,lead$in    ; lead in 
  801.     call    co
  802.     endif
  803.  
  804.     mvi    a,clr$co    ; clear to foreground spaces
  805.     jmp     co
  806.  
  807. ****************************
  808. *** "CLEAR DISPLAY LINE" ***
  809. ****************************
  810.  
  811. cline:
  812.     if     lineclr
  813.     mvi    a,0        ; starting column
  814.     sta    column
  815.     lxi    h,set$cur    ; set cursor
  816.     call    text
  817.     endif
  818.     
  819.     if     Hazel AND lineclr
  820.     mvi    a,lead$in    ; lead in byte
  821.     call    co
  822.     endif
  823.  
  824.     if    lineclr
  825.     mvi    a,end$ln    ; clear to end of line
  826.     call    co
  827.     endif
  828.  
  829.     if    NOT lineclr
  830.     mvi    a,11        ; starting column
  831.     sta    column
  832.     lxi    h,set$cur    ; set cursor
  833.     call    text
  834.     lxi    h,blanks    ;address of a string of 56 blanks...
  835.     call    text
  836.     endif
  837.  
  838.     ret
  839.  
  840. *************************
  841. *** "FATAL ERROR MSG" ***
  842. *************************
  843.  
  844. fatal:
  845.     if     lineclr
  846.     call    cline        ; clear line
  847.     endif
  848.  
  849.     mvi    a,30        ; column position
  850.     sta    column
  851.     lxi    h,set$cur
  852.     call    text
  853.     lxi    h,me2        ; Fatal error msg
  854.     call    text
  855.     ret
  856.  
  857.  
  858. ******************************
  859. *** "PRINT STRING OF TEXT" *** 
  860. ******************************
  861.  
  862. ;    Enter with "HL" pointing to text string,
  863. ;    terminate string with Null.
  864. ;
  865. ;    Direction cursor position is used for displays.
  866. ;    The value (-1) at the start of string indicates 
  867. ;    to this routine
  868. ;    that column and row position will follow.
  869. ;    This format does not necessarily go out to 
  870. ;    your terminal.   If your terminal needs row sent before column, 
  871. ;    or a constant bias added (0,0 is not the upper left
  872. ;    corner of the screen), you'll have to invent code
  873. ;    within this routine to accomplish that.
  874. ;
  875. ;    This is the internal representation format:
  876. ;         db -1,50,10,'NOW IS THE TIME'
  877. ;         ^  ^  ^
  878. ;         |  |  |_Row position (add bias if needed)
  879. ;         |  |_Column position (add bias if needed)
  880. ;         |_Flag (send console lead-in sequence.
  881.  
  882. text:
  883.     mov    a,m        ; load char.
  884.     ora    a        ; end of string?
  885.     rz            ; yes
  886.     cpi    (-1) AND 0FFH    ; position cursor?
  887.                 ; "and offh" added for ASM compatibility
  888.     jz    text1        ; yes
  889.     inx    h        ; next char.
  890.     call    co        ; output
  891.     jmp    text
  892. ;
  893. text1:
  894.     inx    h        ; move passed command
  895.  
  896.     if     Hazel
  897.     mvi    a,lead$in    ; leading for console
  898.     call    co        ; issue.
  899.     endif
  900.  
  901.     mvi    a,add$cur    ; address cursor
  902.     call    co
  903.     mov    a,m        ; column position...
  904.     inx    h
  905.     call    co
  906.     mov    a,m        ; row position
  907.     call    co
  908.     inx    h        
  909.     jmp    text         
  910.  
  911. *************************
  912. *** "CENTERING CHECK" *** 
  913. *************************
  914.  
  915. ;
  916. ;    Centering test requires the FDC to read
  917. ;    all the sectors before diskette centering
  918. ;    is consider OK.
  919.  
  920. center:
  921.     lxi    h,cen$tbl    ; track table
  922.     shld    temp
  923.     lxi    h,me9        ; tracks with 
  924.     mvi    b,'D'        ; limit
  925.     call    inp$trk        ; seek track  
  926.     call    cls        ; clear display
  927.     lxi    h,me10        ; centering msg.
  928.     call    text
  929.     lxi    h,me15        ; frame
  930.     call    text
  931.     lxi    h,me11        ; New track msg
  932.     call    text
  933. ;
  934. center1:
  935.     call    rd$trk        ; read centering track
  936.     mvi    a,10        ; set row position
  937.     sta    row        
  938.     jc    center3        ; fatal error..
  939.  
  940.     if     lineclr
  941.     call    cline        ; clear line
  942.     endif
  943.  
  944.     mvi    a,30        ; set cursor...
  945.     sta    column        ; column position
  946.     lxi    h,set$cur
  947.     call    text
  948.     lda    diff         ; must = 0
  949.     ora    a
  950.     lxi    h,me3        ; "RE-CLAMP DISKETTE"
  951.     jnz    center2
  952.     mov    a,c
  953.     cpi    tsec          ; all sec read? 
  954.     jnz    center2
  955.     lxi    h,me4        ; "CENTERING OK"
  956. ;
  957. center2:
  958.     call    text
  959.     call    cstat        ; abort?
  960.     jz    center1
  961.     call    ci
  962.     cpi    ' '        ; new track?
  963.     jnz    center1        ; no...
  964.     jmp    center        ; yes..
  965. ;
  966. center3:
  967.     call    fatal        ; fatal error
  968.     jmp    center2
  969.  
  970.  
  971. *********************************
  972. *** "AZIMUTH ALIGNMENT CHECK" *** 
  973. *********************************
  974.  
  975. azimuth:
  976.     call    cls        ; clear display...
  977.     mvi    a,76        ; seek to azimuth track
  978.     call    track        ; move...
  979.     lxi    h,me12        ; type of test msg
  980.     call    text
  981.     lxi    h,me15        ; frame
  982.     call    text
  983. ;
  984. azimuth1:
  985.     lxi    h,azi$tab    ; set translation table 
  986.     shld    xpoint        ; pointers
  987.     shld    ypoint
  988.     call    rd$trk        ; read azimuth track
  989.     mvi    a,10        ; set row position
  990.     sta    row        
  991.     jc    azimuth3    ; fatal error...
  992.  
  993.     if    lineclr
  994.     call    cline        ; clear line
  995.     endif
  996.  
  997.     mvi    a,20        ; Display negative angle
  998.     sta    column
  999.     lxi    h,set$cur    ; set cursor
  1000.     call    text
  1001.     mvi    a,'-'        ; direction of angle
  1002.     call    co        ; output...
  1003.     mvi    a,' '        ; space
  1004.     call    co
  1005.     lhld    ypoint        ; translation
  1006.     mov    e,m        ; data negative...
  1007.     mvi    d,0
  1008.     call    pnum        ; display
  1009.     lxi    h,me5        ; print minutes
  1010.     call    text
  1011.     mvi    a,45        ; Display Positive angle
  1012.     sta    column
  1013.     lxi    h,set$cur
  1014.     call    text
  1015.     mvi    a,'+'        ; direction of angle
  1016.     call    co        ; output...
  1017.     mvi    a,' '        ; space
  1018.     call    co
  1019.     lhld    xpoint        ; translation
  1020.     mov    e,m        ; data positive..
  1021.     mvi    d,0
  1022.     call    pnum        ; display
  1023.     lxi    h,me5        ; print minutes
  1024.     call    text
  1025. ;
  1026. azimuth2:
  1027.     call    cstat        ; abort?
  1028.     jz    azimuth1
  1029.     call    ci        ; test...
  1030.     jmp    azimuth1    ; no..
  1031. ;
  1032. ;    Fatal error Has occurred
  1033. ;
  1034. azimuth3:
  1035.     call    fatal        ; fatal read error
  1036.     jmp    azimuth2
  1037.  
  1038.  
  1039. ********************************
  1040. *** "RADIAL ALIGNMENT CHECK" *** 
  1041. ********************************
  1042.  
  1043.  
  1044. radial:
  1045.     lxi    h,rh$tbl    ; table pointer
  1046.     shld    temp
  1047.     lxi    h,me7        ; track display..
  1048.     mvi    b,'G'        ; limit  
  1049.     call    inp$trk        ; select track and seek
  1050.     call    cls
  1051.     lxi    h,me8        ; print scale...
  1052.     call    text
  1053.     lxi    h,me11        ; Space bar msg
  1054.     call    text
  1055. ;
  1056. radial1:
  1057. ;
  1058.     lxi    h,rad$pos    ; radial positive 
  1059.     shld    xpoint        ; cursor table
  1060. ;
  1061.     lxi    h,rad$neg    ; radial negative
  1062.     shld    ypoint        ; cursor table
  1063. ;
  1064.     call    rd$trk        ; read radial track
  1065.     mvi    a,11        ; set row position
  1066.     sta    row
  1067.     jc    radial4        ; Fatal error has occurred
  1068.     call    cline        ; clear line (1)
  1069.     lda    row        
  1070.     push    psw          
  1071.     inr    a        ; clear line (2)
  1072.     sta    row        
  1073.     call    cline
  1074.     pop    psw        ; reset line position
  1075.     sta    row
  1076.     lhld    ypoint         ; negative 
  1077.     mov    a,m
  1078.     sta    column        ; position cursor
  1079.     mov    b,a 
  1080.     lxi    h,set$cur    
  1081.     call    text
  1082.     mvi    a,'^'        ; set pointer
  1083.     call    co
  1084.     lhld    xpoint
  1085.     mov    a,m        ; positive position
  1086.     sta    column         
  1087.     mov    c,a        ; save cursor position 
  1088.     lxi    h,set$cur    ; set cursor
  1089.     call    text
  1090.     mvi    a,'^'
  1091.     call    co
  1092.     mov    a,b         
  1093.     sta    column        ; reset column position
  1094.     lda    row        ; down one line
  1095.     inr    a
  1096.     sta    row
  1097.  
  1098.  
  1099. ************************************
  1100. *** "SET POINTERS AND DRAW LINE" ***
  1101. ************************************
  1102.  
  1103. ;    used to draw the graphic display of the
  1104. ;    radial error.
  1105.  
  1106.     lxi    h,set$cur    ; position cursor
  1107.     call    text
  1108.     mov    a,c
  1109.     sub    b        ; line length
  1110.     dcr    a        ; less (1)
  1111.     mov    b,a
  1112.     mvi    a,'|'        ; pointer...
  1113.     call    co
  1114. ;
  1115. radial2:
  1116.     mvi    a,'_'        ; jointing line
  1117.     call    co
  1118.     dcr    b        ; line length -1
  1119.     jnz    radial2
  1120.     mvi    a,'|'
  1121.     call    co
  1122. ;
  1123. radial3:
  1124.     call    cstat        ; check for abort
  1125.     jz    radial1        ; read again
  1126.     call    ci        ; new track?
  1127.     cpi    ' '        
  1128.     jnz    radial1        ; no...
  1129.     jmp    radial        ; new track...
  1130.  
  1131. ****************************
  1132. *** "FATAL RADIAL ERROR" ***
  1133. ****************************
  1134.  
  1135. radial4:
  1136.  
  1137.     if    lineclr
  1138.     call    cline        ; clear display
  1139.     lda    row        ; next line
  1140.     inr    a        
  1141.     sta    row
  1142.     call    cline
  1143.     endif
  1144.  
  1145.     call    fatal        ; fatal read error
  1146.     jmp    radial3        ; abort?
  1147.  
  1148.  
  1149. **********************************
  1150. *** "STEPPER HYSTERESIS CHECK" ***
  1151. **********************************
  1152.  
  1153. ;
  1154. ;    This routine uses one of the progressive offset
  1155. ;    tracks to determine the stepper motor hysteresis.
  1156.  
  1157. hyster:
  1158.     lxi    h,rh$tbl    ; table pointer
  1159.     shld    temp
  1160.     lxi    h,me7        ; track msg
  1161.     mvi    b,'G'        ; limit
  1162.     call    inp$trk        ; seek track
  1163.     call    offset        ; offset from
  1164.     call    cls        ; selected track.
  1165.     lxi    h,me14        ; display test
  1166.     call    text
  1167.     lxi    h,me15        ; frame
  1168.     call    text
  1169.     lxi    h,me11        ; new track Msg.
  1170.     call    text
  1171. ;
  1172. hyster1:
  1173.     lda    bais        ; offset from track
  1174.     mov    b,a
  1175.     lda    ctrk        ; save current track
  1176.     sta    savtrk
  1177.     add    b        ; add bais to current track
  1178.     cpi    ttrk          ; within limits?
  1179.     jc     hyster2        ; OK!
  1180.     mvi    a,ttrk      ; set last track
  1181. ;
  1182. ;    Move to (ID) inside diameter
  1183.  
  1184. hyster2:
  1185.     call    track        ; seek to track
  1186.     lda    savtrk        ; back to test track
  1187.     call    track        ; seek...
  1188.     call    rd$trk        ; read track...
  1189.     mvi    a,10        ; set row 
  1190.     sta    row
  1191.     jc    hyster8        ; fatal error!!!
  1192.     lda    diff         ; difference
  1193.     sta    hyerr        ; save the difference
  1194.  
  1195. ;    Move to (OD) outside Diameter
  1196.  
  1197.     lda    bais        ; tracks to move
  1198.     mov    b,a
  1199.     lda    ctrk        ; current track
  1200.     sub    b
  1201.     jnc    hyster4        ; Ok to move
  1202.     xra    a        ; set to track (0)
  1203.  
  1204. ;
  1205. hyster4:
  1206.     call    track        ; seek to track
  1207.     lda    savtrk        ; back to test track
  1208.     call    track         
  1209.     call    rd$trk        ; read track 
  1210.     mvi    a,10        ; set row 
  1211.     sta    row
  1212.     jc    hyster8        ; fatal Error!!
  1213.     lda    hyerr        ; load error First 
  1214.     mov    c,a        ; read operation
  1215.     lda    diff         ; last reading
  1216.     sub    c
  1217.     jp    hyster6
  1218.     cma    
  1219.     inr    a
  1220. ;
  1221. hyster6:
  1222.     call    hyster9
  1223. ;
  1224. hyster7:
  1225.      call    cstat        ; abort?
  1226.     jz    hyster1        ; re-test
  1227.     call    ci          
  1228.     cpi    ' '        ; new parameters
  1229.     jz    hyster 
  1230.     jmp    hyster1        ; new track and offset
  1231. ;
  1232. hyster8:
  1233.     call    fatal        ; fatal read error
  1234.     call    home        ; recal.drive
  1235.     jmp    hyster7
  1236.  
  1237.  
  1238. **********************************
  1239. *** "DISPLAY HYSTERESIS ERROR" ***
  1240. **********************************
  1241. ;
  1242. ;    Presently setup for 48 tpi drives
  1243. ;    with increments in .5 millinches.
  1244.  
  1245. hyster9:
  1246.     push    psw        ; save error
  1247.  
  1248.     if     lineclr
  1249.     call    cline        ; clear display
  1250.     endif
  1251.  
  1252.     mvi    a,25         ; set column
  1253.     sta    column
  1254.     lxi    h,set$cur
  1255.     call    text
  1256.     lxi    h,me16        ; Hysteresis error msg
  1257.     call    text
  1258.     pop    psw
  1259.     ora    a
  1260.     jz     hyster11
  1261.     mov    c,a        ; count
  1262.     mvi    b,5        ; increments
  1263.     xra    a        ; clear acc.
  1264. ;
  1265. hyster10:
  1266.     add    b
  1267.     daa            ; decimal adjust
  1268.     dcr    c
  1269.     jnz    hyster10
  1270. ;
  1271. hyster11:
  1272.     push    psw
  1273.     ani    0f0h        ; mask upper nibble
  1274.     rar!rar!rar!rar
  1275.     adi    '0'        ; add ascii bais
  1276.     call    co
  1277.     mvi    a,'.'        ; decimal point
  1278.     call    co
  1279.     pop    psw
  1280.     ani    0fh
  1281.     adi    '0'
  1282.     call    co
  1283.      ret
  1284.  
  1285.  
  1286.  
  1287. **********************
  1288. *** "INDEX TIMING" *** 
  1289. **********************
  1290.  
  1291. ;
  1292. ;    This function computes the time from leading
  1293. ;    edge of index to first sector ID mark
  1294. ;    and displays it in 10.0 Us. increments
  1295. ;    note:
  1296. ;         (Dysan AAD disk) is used for reference.
  1297. index: 
  1298.     mvi    a,10        ; set row
  1299.     sta    row
  1300.     lxi    h,ix$tbl    ; track table
  1301.     shld    temp
  1302.     lxi    h,me13        ; track locations
  1303.     mvi    b,'C'
  1304.     call    inp$trk        ; move to Index track
  1305.     call    cls        ; clear display..
  1306.     lxi    h,me17        ; display scale
  1307.     call    text
  1308.     lxi    h,me15
  1309.     call    text
  1310.     lxi    h,me11        
  1311.     call    text
  1312. ;
  1313. index1:
  1314.     lxi    h,0        ; clear counter
  1315.     shld    temp        
  1316.     mvi    c,5        ; average (5) readings
  1317. ;
  1318. index2:
  1319.     call    clpend        ; clear FDC
  1320.     call    prg$dma        ; program controller
  1321.     lxi    d,0        ; clear counter
  1322. ;
  1323. index3:
  1324.     in    stat        ; wait for next Index
  1325.     ani    indxbyt        
  1326.     jnz     index3
  1327.  
  1328. ;    Compute time from index to ID 
  1329.  
  1330. index4:
  1331.     in    stat        ; loop until next
  1332.     ani    indxbyt        ; index...
  1333.     jz     index4        
  1334. ;
  1335. ;    Read address..
  1336. ;
  1337.     nop            ; 1.00
  1338.     mvi    a,raddr        ; 1.75
  1339.     out    cmd        ; 2.75
  1340.     call    delay        ; [ 50 usec ]
  1341.  
  1342.     if    Dysan
  1343.     mvi    a,sdma        ; 1.75
  1344.     out    dma        ; 2.75
  1345.     endif
  1346.  
  1347.     if    CCS
  1348. ;
  1349. ;    10 Usec Test cnt. loop
  1350. index5:
  1351.     inx    d        ; 1.50 [ counter ]
  1352.     inx    h        ; 1.50
  1353.     in    stat        ; 2.75 
  1354.     ani    drqbyt        ; 1.75 - loop until drq set...
  1355.     jz    index5        ; 2.50
  1356.     LHLD    DMA
  1357.     IN    DATA
  1358.     MOV    M,A
  1359.     INX    H
  1360.     IN    DATA
  1361.     MOV    M,A
  1362.     INX    H
  1363.     IN    DATA
  1364.     MOV    M,A    
  1365.     INX    H
  1366.     IN    DATA
  1367.     MOV    M,A
  1368.     INX    H
  1369.     IN    DATA
  1370.     MOV    M,A
  1371.     INX    H
  1372.     IN    DATA
  1373.     MOV    M,A
  1374.     endif
  1375.  
  1376.  
  1377.     if     Dysan
  1378. ;
  1379. ;    10 Usec Test cnt. loop
  1380. index5:
  1381.     inx    d        ; 1.50 [ counter ]
  1382.     inx    h        ; 1.50
  1383.     in    stat        ; 2.75 
  1384.     ani    busybyt        ; 1.75 - loop until not busy
  1385.     jnz    index5        ; 2.50
  1386.     endif
  1387. ;
  1388. index6:
  1389.     lxi    h,6        ; adj. over head
  1390.     dad    d        ; error (60usec)
  1391.     xchg
  1392.     lhld    temp
  1393.     dad    d        ; add cnt
  1394.     shld    temp
  1395.     dcr    c        ; next reading
  1396.     jnz    index2
  1397.     xchg
  1398.     lxi    h,5        ; divide by 5
  1399.     call    div16 
  1400.     dad    d        ; add remainder
  1401.     xchg
  1402.     lxi    h,0        ; counter...
  1403.     lda    secbuf+2    ; must contain sec (1) ID
  1404.     cpi    1
  1405.     jnz    index9        ; out of range
  1406.     mvi    a,10        ; loop time * cnt
  1407. index7:
  1408.     dad    d
  1409.     dcr    a
  1410.     jnz    index7
  1411.     lxi    d,ref       ; Timing ref  
  1412.                 ; Value of ref is in DDD variable
  1413.                 ;equates... it is subtracted from
  1414.                 ;the measured # of microsec. here
  1415.                 ;to adjust timing to a standard
  1416.                 ;Analog Alignment Diskette...
  1417.     ; If you have a 4 Mhz. Z-80 and single density DDD
  1418.     ; and are using the Dysan environment, 798 is the 
  1419.     ; magic number.  Otherwise you'll have to "cut and try"
  1420.     ; and without the AAD you'll have to guess...
  1421.     ; (A relative measure is better than no measure...)
  1422.     call    subde        
  1423.     xchg            
  1424.     jnc    index8
  1425.     mov    a,e
  1426.     cma
  1427.     mov    e,a
  1428.     mov    a,d        ; negate "DE"
  1429.     cma
  1430.     mov    d,a
  1431.     inx    d
  1432.     lxi    h,200        ; 200 - error
  1433.     call    subde
  1434.     jnc    index9
  1435.     lxi    h,0        ; out of range
  1436.     jmp    index9
  1437. ;
  1438. index8:
  1439.     lxi    h,200        ; 200  + error
  1440.     dad    d
  1441. ;
  1442. index9:
  1443.     xchg
  1444.     push    d
  1445.  
  1446.     if    lineclr
  1447.     call    cline        ; clear line
  1448.     endif
  1449.  
  1450.     mvi    a,25
  1451.     sta    column
  1452.     lxi    h,set$cur    ; position cursor
  1453.     call    text
  1454.     lxi    h,me18        ; time in MS.
  1455.     call    text
  1456.     pop    d
  1457.     call    pnum        ; display time...
  1458.     call    cstat        ; abort?
  1459.     jz    index1        ; re-test
  1460.     call    ci        ; esc?
  1461.     cpi    ' '        ; new track?
  1462.     jz    index         ; yes..
  1463.     jmp    index1        ; new track...
  1464.  
  1465.  
  1466. *****************************
  1467. *** "CHECK SPINDLE SPEED" *** 
  1468. *****************************
  1469. ;
  1470. ;    All timing is based on 4mhz Z80 Cpu
  1471. ;
  1472. rpm:
  1473.     call    cls        ; clear display
  1474.     lxi    h,me19        ; test performed
  1475.     call    text
  1476.     lxi    h,me15        ; frame...
  1477.     call    text
  1478.     mvi    a,10        ; set row
  1479.     sta    row
  1480. ;
  1481. rpm1:
  1482.     call    rpm2        ; compute time in 100us increments
  1483.     shld    temp         ; store count
  1484.  
  1485.     if    lineclr
  1486.     call    cline        ; clear line
  1487.     endif
  1488.  
  1489.     mvi    a,19        ; set cursor  
  1490.     sta    column
  1491.     lxi    h,set$cur
  1492.     call    text
  1493.     lhld    temp
  1494.     xchg            ; convert to milliseconds
  1495.     lxi    h,10
  1496.     call    div16              
  1497.     push    h        ; Save remainder
  1498.     call    pnum
  1499.     mvi    a,'.'        ; decimal point
  1500.     call    co     
  1501.     pop    h
  1502.     xchg
  1503.     call    pnum        ; fraction
  1504.     lxi    h,me20        ; milliseconds msg
  1505.     call    text
  1506.     mvi    a,50
  1507.     sta    column
  1508.     lxi    h,set$cur
  1509.     call    text
  1510.     lhld    temp         ; convert to RPM 
  1511.     mvi    a,9        ; divide By 600,000
  1512.     lxi    d,27c0h
  1513.     call    div24
  1514.     push    h        ; remainder
  1515.     call    pnum
  1516.     mvi    a,'.'        ; fraction
  1517.     call    co
  1518.     pop    h
  1519.     xchg
  1520.     call    pnum
  1521.     lxi    h,me21        ; rpm msg
  1522.     call    text
  1523.     call    cstat        ; abort?
  1524.     jz    rpm1        ; No..
  1525.     call    ci        ; Esc key?
  1526.     jmp    rpm1        ; No..
  1527.  
  1528.  
  1529. *******************************
  1530. *** "INDEX TO INDEX TIMING" ***
  1531. *******************************
  1532.  
  1533. ;
  1534. ;    With 4 Mhz. Z-80,
  1535. ;    returns time in 100 Us increments to caller
  1536. ;    in "HL" regs.
  1537.  
  1538. rpm2:
  1539.     call    clpend      ; Clear pending commands
  1540.     lxi    h,0        ; Clear Counter
  1541. rpm3: 
  1542.     in     stat           ; Loop Until Index
  1543.     ani    2        ; Mask All But Index Bit
  1544.     jnz     rpm3         ; No Index
  1545. rpm4:
  1546.     in     stat           ; if Index...
  1547.     ani    2        ; Wait for No Index
  1548.     jz      rpm4        ; In Index Hole
  1549.  
  1550. ;    Add index hole to count
  1551. rpm5: 
  1552.     call    rpm7         ; 4.25
  1553.     in     stat           ; 2.75
  1554.     ani    2        ; 1.75
  1555.     jnz    rpm5         ; 2.50
  1556.                 ; Total = 11.25
  1557. ;    Count until  next Index
  1558.  
  1559. rpm6:     
  1560.     call    rpm7         ; 4.25
  1561.     in     stat        ; 2.75
  1562.     ani    2        ; 1.75
  1563.     jz    rpm6         ; 2.50
  1564.     ret            ; total = 11.25
  1565.  
  1566. *************************
  1567. *** "RPM TIMING LOOP" *** 
  1568. *************************
  1569. ;
  1570. ;    The loop time must be adjusted for 100us  
  1571. ;    increments at your clock speed with your processor.
  1572. ;    
  1573. ;    note:    "RPM5 or RPM6" loop time must be counted.
  1574. ;
  1575.  
  1576. rpm7:                
  1577.     inx    h        ; 1.50 
  1578.     mvi    a,22        ; 1.75 
  1579. ;
  1580. rpm8: 
  1581.     dcr    a        ; 1.00  (22 * 1.00) = 22 Usec
  1582.     jnz    rpm8         ; 2.50  (22 * 2.50) = 55 Usec
  1583.     inx    d        ; 1.50
  1584.     inx    d        ; 1.50
  1585.     inx    d        ; 1.50
  1586.     inx    d        ; 1.50
  1587.     ret            ; 2.50
  1588.                 ; total = 88.75  
  1589.  
  1590.  
  1591. ************************
  1592. *** "READ DDD TRACK" *** 
  1593. ************************
  1594. ;
  1595. ;    Att: Main read routine for program.
  1596. ;         ==============================
  1597. ;
  1598. ;    Reads the Positive and Negative offset
  1599. ;    sectors and returns pointers to the   
  1600. ;    translation tables set by caller.
  1601. ;
  1602.  
  1603. rd$trk:
  1604.     MVI    A,7    ;Upper case code adds a simple display of
  1605.             ;    last sector read (+ & -), giving
  1606.             ;    ? and @ if first sectors fail
  1607.             ;    and A thru Z representing the 26
  1608.             ;    possible sectors on an 8" disk
  1609.             ;    or A thru P for a 5.25" disk
  1610.     STA    ROW
  1611.     MVI    A,39
  1612.     STA    COLUMN
  1613.     LXI    H,SET$CUR
  1614.     CALL    TEXT
  1615.     mvi    c,lpos        ; last sector
  1616.     mvi    a,1        ; beginning sector positive
  1617.     call    rd$sec         ; read positive offsets
  1618.     ADI    3eH    ; translate sector # to alpha code */
  1619.     CALL    CO    ; display on console  */
  1620.     SUI    3eH    ; return to sector # */
  1621.     cpi    1        ; unable to read
  1622.     jz     rd$trk2        ; first sec?
  1623.     sta    diff         ; store last sector tested
  1624.     mvi    c,lneg
  1625.     mvi    a,2        ; beginning sector negative
  1626.     call    rd$sec         ; read negative offsets 
  1627.     ADI    3eH
  1628.     CALL    CO
  1629.     SUI    3eH
  1630.     cpi    2        ; fatal error?
  1631.     jz    rd$trk2        ; set error flag
  1632. ;
  1633. ;    Positive sector Translation
  1634. ;
  1635.     lda    diff  
  1636.     inr    a        ; adj. sector Num.
  1637.     sui    4        
  1638.     rar            ; divide by two
  1639.     lhld    xpoint        ; translate Table pointer
  1640.     mvi    d,0        ; setup for Offset
  1641.     mov    e,a 
  1642.     dad    d        ; add offset
  1643.     shld    xpoint        ; set pointer
  1644. ;
  1645. ;    Negative Sector Translation
  1646.  
  1647.     in    sec        ; last sector
  1648.     sui    4        
  1649.     rar             ; divide by two
  1650.     mov    c,a
  1651.     sub    e        ; diff. for Hysteresis
  1652.     sta    diff     
  1653.     mov    e,c        ; offset
  1654.     lhld    ypoint        ; translation table pointer
  1655.     dad    d        ; offset in table
  1656.     shld    ypoint        ; set pointer
  1657.     ora    a        ; clear carry
  1658.     ret
  1659.  
  1660. ;    Set fatal error Flag, caller processes
  1661. ;    the error.
  1662.  
  1663. rd$trk2:
  1664.     stc            ; carry = Fatal error
  1665.     ret
  1666.     
  1667.  
  1668.  
  1669. *******************************************
  1670. *** "READ SECTORS BY INCREMENTS OF TWO"    ***
  1671. *******************************************
  1672.  
  1673. ;
  1674. ;    Enter with first sector to be read in 'A' reg.
  1675. ;    Returns to caller on Error or Last sector.
  1676. ;    note:
  1677. ;        Z flag set if good read else Nz
  1678. rd$sec: 
  1679.     call    read        ; read sector
  1680.     in    sec          ; current sector
  1681.     rnz
  1682.     adi    2
  1683.     out    sec
  1684.     cmp    c        ; last sec?
  1685.     rz            ; yes...
  1686.     jmp    rd$sec
  1687.  
  1688. ********************************************************
  1689. ***  "THE FOLLOWING ARE HARDWARE DEPENDENT ROUTINES" ***
  1690. ********************************************************
  1691. ;
  1692. ;
  1693. **********************
  1694. *** "DRIVE SELECT" *** 
  1695. **********************
  1696. ;
  1697. ;    The drive select routine must be expanded  
  1698. ;    for selected systems. 
  1699.  
  1700. select:
  1701.  
  1702.     if    Dysan
  1703.     mvi    a,21h        ; select bits
  1704.     out    dsel        ; select drive...
  1705.     endif
  1706.  
  1707.  
  1708.     if    CCS    ;The upper case code performs drive 
  1709.             ; selection on the CCS 2422 controller
  1710.             ; for single side double density...
  1711.     CALL    CLS    ; clear console */
  1712.     LXI    H,SELMSG
  1713.     CALL    TEXT    ; print drive selection request */
  1714.     CALL    CI    ; get response */
  1715.     CPI    'A'    ; accept A,B,C,D, as responses */
  1716.     JZ    SELECT1
  1717.     JC    SELECT
  1718.     CPI    'B'
  1719.     JZ    SELECT1
  1720.     CPI    'C'
  1721.     JZ    SELECT3
  1722.     CPI    'D'
  1723.     JZ    SELECT4
  1724.     JMP    SELECT    ; repeat if invalid choice */
  1725.  
  1726.     
  1727. SELECT4:ADI    3    ; make low nybble an 8 */
  1728. SELECT3:INR    A    ; make a 4 */
  1729. SELECT1:SUI    '@'    ; make B into 2 or A into 1 */
  1730.     ORI    0F0H    ; add high nybble: */
  1731.             ; F for double density, B for single
  1732.     STA    SELPT    ; store select bits for future use... */
  1733.     OUT    DSEL
  1734.     MVI    A,40H    ; select side 0...  00 selects side 1... */
  1735.     OUT    04    ; secondary control port */
  1736.     endif
  1737.     
  1738.     jmp    home        ; home drive
  1739.  
  1740. *******************************
  1741. *** "SEEK HEAD(S) TO TRACK" *** 
  1742. *******************************
  1743. ;
  1744. ;    Enter with new track location in
  1745. ;    'A' register.
  1746.  
  1747. track:
  1748.     out    data        ; new track
  1749.     call    clpend        ; clear FDC
  1750.      mvi    a,seek+rate    ; seek command + step rate
  1751. ;
  1752. track1:
  1753.     out    cmd        ; issue...
  1754.  
  1755.     if     Dysan
  1756.     call    delay        ; delay for FDC    
  1757.     endif
  1758.  
  1759.     if    CCS    ;This controller seems to need more 
  1760.             ; delay - I can't explain why... LA.
  1761.     call    delayB        ; delay for FDC    
  1762.     endif
  1763.  
  1764. ;
  1765. track2:
  1766.     in    stat        ; busy ?
  1767.     rrc            ; test
  1768.     jc    track2        ; still busy...
  1769.     mvi    a,sdelay    ; set seek delay bit
  1770.     sta    dflag
  1771.     in     trk        ; set current track
  1772.     sta    ctrk
  1773.     ret
  1774.  
  1775.     if    CCS
  1776. DELAYB:    PUSH    B    ; extra delay for CCS controller... */
  1777.     LXI    B,2000H
  1778.     
  1779. DELAYC:    DCX    B
  1780.     MOV    A,C
  1781.     ORA    B
  1782.     JNZ    DELAYC
  1783.     POP    B
  1784.     RET
  1785.     endif
  1786.  
  1787.  
  1788. ***************************************
  1789. *** "RESTORE HEAD(S) TO TRACK ZERO" ***
  1790. ***************************************
  1791.  
  1792. home:
  1793.     call    clpend        ; clear FDC
  1794.     mvi    a,restore+rate    ; restore command + step rate
  1795.     jmp    track1        ; issue command...
  1796.  
  1797. *****************************
  1798. *** "READ SECTOR ROUTINE" *** 
  1799. *****************************
  1800.  
  1801. ;    Enter this routine with the sector to
  1802. ;    be read in the 'A' register.
  1803. ;
  1804. ;    This routine will keep trying to read
  1805. ;    the sector until retry count equals zero.
  1806. ;
  1807. ;    The 1793 controller has a built-in automatic
  1808. ;    four retries to read ID, so the value set in
  1809. ;    the equate (RETRY) is equal to [ 4 * retry + 1].
  1810.  
  1811. read:
  1812.     out    sec        ; set sector  
  1813.     mvi    e,retry        ; to read
  1814. ;
  1815. read1:
  1816.     call    clpend        ; clear FDC
  1817.     call    prg$dma        ; program "DMA" controller
  1818.  
  1819.     if     CCS
  1820.     LHLD    DMA    ; get pointer to memory buffer */
  1821.     MVI    B,40H    ; initialize loop counter for I/O */
  1822.             ;transfers: 40 for 8" DD, 20 for 8" SD
  1823.     endif
  1824.  
  1825.     lda    dflag        ; seek delay flag
  1826.     ori    rsec        ; read sector command
  1827.     out    cmd        ; issue..
  1828.  
  1829.     if     Dysan
  1830.     mvi    a,sdma        ; start transfer
  1831.     out    dma
  1832.     endif
  1833.  
  1834.     if    CCS
  1835. BREAD:    IN    DATA    ; code to perform I/O transfer of  */
  1836.     MOV    M,A    ;     data to memory */
  1837.     INX    H
  1838.     IN    DATA
  1839.     MOV    M,A
  1840.     INX    H
  1841.     IN    DATA
  1842.     MOV    M,A
  1843.     INX    H
  1844.     IN    DATA
  1845.     MOV    M,A
  1846.     INX    H
  1847.     DCR    B    ; decrement loop counter... */
  1848.     JNZ    BREAD
  1849.     endif
  1850.  
  1851.     call    comp        ; transfer completed?
  1852. ;
  1853. read2:
  1854.     xra    a        ; clear seek delay
  1855.     sta    dflag
  1856.     in    stat        ; good read?
  1857.     ora    a
  1858.     rz            ; yes...
  1859.     dcr    e        ; count off retries
  1860.     jnz    read1        ; try again
  1861.     in    stat        ; return status
  1862.     ora    a
  1863.     ret
  1864.  
  1865.  
  1866. **************************************
  1867. *** "WAIT FOR END OF DMA TRANSFER" ***
  1868. **************************************
  1869.  
  1870. comp:    
  1871.     call    delay        ; before each check
  1872.     in    stat         ; Completed Transfer?
  1873.     rrc            
  1874.     rnc            ; YES!
  1875.     jmp    comp        
  1876.  
  1877.  
  1878. ********************************
  1879. *** "PROGRAM DISK CONTROLLER" ***
  1880. ********************************
  1881.  
  1882. prg$dma:
  1883.  
  1884.     if    Dysan
  1885.     mvi    b,15        ; Bytes Count 
  1886.     lxi    h,cmd$tbl    ; Command Table
  1887. ;
  1888. prg$dma1:
  1889.     mov    a,m        ; load
  1890.     out    dma        ; write to controller
  1891.     inx    h
  1892.     dcr    b        ; -1
  1893.     jnz    prg$dma1
  1894.     endif
  1895.  
  1896.     if    CCS
  1897.     LXI    H,SECBUF    ; store address of memory buffer */
  1898.     SHLD    DMA    ; in pointer for disk controller */
  1899.     LDA    SELPT    ; get drive select bits */
  1900.     OUT    DSEL    ; sets autowait for 2422 controller... */
  1901.             ; to ensure synchronization of I/O transfer
  1902.     endif
  1903.  
  1904.     ret
  1905.  
  1906. **************************************
  1907. *** "COMMAND TABLE DMA CONTROLLER" ***
  1908. **************************************
  1909.  
  1910. ;    This data is used to program Zilog's
  1911. ;    z80 DMA controller.
  1912.  
  1913. cmd$tbl:
  1914.  
  1915.     if    Dysan
  1916.      db    0c3h        ; Re-Set DMA Controller
  1917.     db    8bh        ; Clear Block Counter
  1918.     db    79h        ; Recieve Block 
  1919.     dw    secbuf        ; Address To Store Block 
  1920.     dw    256         ; Block Size 
  1921.     db    14h        ; Define Port (B) Address
  1922.     db    28h         ; Define Port (A) Address
  1923.     db    85h        
  1924.     db    data           ; Data Reg FDC
  1925.     db    8ah        ; Set DMA Controller Active HIGH
  1926.     db    0cfh
  1927.     db    3        ; Data  ----> Memory
  1928.     db    0cfh
  1929.     endif
  1930.  
  1931.  
  1932. ************************************
  1933. *** "CLEAR PENDING COMMANDS FDC" ***
  1934. ************************************
  1935. ;
  1936. ;    Clears the floppy controller of any
  1937. ;    pending commands.
  1938.  
  1939. clpend:
  1940.     mvi    a,clear        ; clear FDC command
  1941.     out    cmd        ; issue...
  1942.  
  1943. ***************************************
  1944. *** "FDC DELAY TO PROCESS COMMANDS" ***
  1945. ***************************************
  1946. ;
  1947. ;    This delay must be adjusted for different
  1948. ;    clock speeds. 50 usec delay loop. 
  1949. ;
  1950. ;    Note:
  1951. ;         If altered, Ajust Index Timing Routine.
  1952.  
  1953. delay:                ;  4.25
  1954.     mvi    a,fdelay    ;  1.75
  1955. delay1:
  1956.     dcr    a        ; 11.00
  1957.     jnz    delay1        ; 27.50
  1958.     nop            ;  1.00
  1959.     nop            ;  1.00
  1960.     nop            ;  1.00
  1961.     ret            ;  2.50
  1962.  
  1963. ********************************
  1964. *** "RADIAL TRANSLATE TABLE" *** 
  1965. ********************************
  1966.  
  1967. ;    Cursor Positioning table for radial
  1968. ;    alignment test.
  1969.  
  1970. rad$neg:
  1971.     db    38              ; 1  millinch
  1972.     db    36        ; 2  "      "
  1973.     db    34        ; 3  "      "
  1974.     db    32        ; 4  "      "
  1975.     db    30        ; 5  "      "
  1976.     db    28        ; 6  "    "
  1977.     db    26        ; 7  "      "
  1978.     db    24        ; 8  "    "
  1979.     db    22        ; 9  "    "
  1980.     db    20        ; 10 "    "
  1981.     db    17        ; 11 "    "
  1982.     db    14        ; 12 "    "
  1983.     db    11        ; 13 "    "
  1984.  
  1985. rad$pos:
  1986.     db    40        ; 1  millinch
  1987.     db    42        ; 2  "     "
  1988.     db    44        ; 3  "     "
  1989.     db    46        ; 4  "     "
  1990.     db    48        ; 5  "     "
  1991.     db    50        ; 6  "     "
  1992.     db    52        ; 7  "     "
  1993.     db    54        ; 8  "     "
  1994.     db    56        ; 9  "     "
  1995.     db    58        ; 10 "     "
  1996.     db    61         ; 11 "     "
  1997.     db    64        ; 12 "     "
  1998.     db      67        ; 13 "     "
  1999.  
  2000. *********************************
  2001. *** "AZIMUTH TRANSLATE TABLE" *** 
  2002. *********************************
  2003.  
  2004. azi$tab:
  2005.     db    18        ; head azmuith angle
  2006.     db    20        ; +/- minutes
  2007.     db    22
  2008.     db    24
  2009.     db    26
  2010.     db    28
  2011.     db    30
  2012.     db    32
  2013.     db    34
  2014.     db    36
  2015.     db    38
  2016.     db    40
  2017.     db    42
  2018.  
  2019. **************************
  2020. *** "PROGRAM MESSAGES" *** 
  2021. **************************
  2022.  
  2023. me1:    
  2024.  
  2025.     if    Dysan
  2026.     db     (-1) AND 0FFH,27,1,'Drive Diagnostic Program'
  2027.     db      (-1) AND 0FFH,31,2,'CP/M 80  Ver 1.0'
  2028.     db      (-1) AND 0FFH,23,4,'( Dysan Corp.   Santa Clara, Ca. )'
  2029.     endif
  2030.  
  2031.     db     (-1) AND 0FFH,18,5,'<*>======================================<*>'
  2032.     db       (-1) AND 0FFH,18,6,'<*>        DIAGNOSTIC COMMAND MENU       <*>'
  2033.     db      (-1) AND 0FFH,18,7,'<*>======================================<*>'
  2034.     db      (-1) AND 0FFH,18,8,'<*>                                      <*>'
  2035.     db      (-1) AND 0FFH,18,9,'<*>   R = Radial      H = Hysteresis     <*>'
  2036.     db     (-1) AND 0FFH,18,10,'<*>                                      <*>'
  2037.     db     (-1) AND 0FFH,18,11,'<*>   A = Azimuth     I = Index Timing   <*>'
  2038.     db     (-1) AND 0FFH,18,12,'<*>                                      <*>'
  2039.     db     (-1) AND 0FFH,18,13,'<*>   C = Centering   S = Spindle Speed  <*>'
  2040.     db     (-1) AND 0FFH,18,14,'<*>                                      <*>'
  2041.     db     (-1) AND 0FFH,18,15,'<*>   D = Drive Sel   E = Exit Program   <*>'
  2042.     db     (-1) AND 0FFH,18,16,'<*>                                      <*>'
  2043.     db     (-1) AND 0FFH,18,17,'<*><*><*<*><*><*><*><*><*><*><*><*><*><*><*>' 
  2044.     db     (-1) AND 0FFH,18,19,'SELECTION? ....',bs,0
  2045.  
  2046. me2:    db    'FATAL READ ERROR      ',0
  2047. me3:    db    'RE-CLAMP DISKETTE ....',bs,0
  2048. me4:    db    'CENTERING OK ....     ',bs,0
  2049. me5:    db    '  Minutes            ',0
  2050. me6:    db    (-1) AND 0FFH,25,2,'<>==========================<>'
  2051.     db    (-1) AND 0FFH,25,3,'<>       TRACK OFFSET       <>'
  2052.     db    (-1) AND 0FFH,25,4,'<>==========================<>'
  2053.     db      (-1) AND 0FFH,25,5,'<>                          <>'
  2054.     db    (-1) AND 0FFH,25,6,'<>       0   ---> 76        <>'
  2055.     db    (-1) AND 0FFH,25,7,'<>                          <>'
  2056.     db      (-1) AND 0FFH,25,8,'<>==========================<>'
  2057.     db      (-1) AND 0FFH,25,9,'<>   <ESC>  Cancels Test    <>'
  2058.     db     (-1) AND 0FFH,25,10,'<>==========================<>'
  2059.     db     (-1) AND 0FFH,25,12,'OFFSET? ...',bs,0
  2060.  
  2061.  
  2062. me7:    db    (-1) AND 0FFH,25,2,'<>==========================<>'
  2063.     db    (-1) AND 0FFH,25,3,'<>     TRACK SELECTION      <>'
  2064.     db    (-1) AND 0FFH,25,4,'<>==========================<>'
  2065.     db    (-1) AND 0FFH,25,5,'<>                          <>'
  2066.     db    (-1) AND 0FFH,25,6,'<>   A = (0)      D = (41)  <>'
  2067.     db    (-1) AND 0FFH,25,7,'<>                          <>'
  2068.     db     (-1) AND 0FFH,25, 8,'<>   B = (3)      E = (70)  <>'
  2069.     db     (-1) AND 0FFH,25, 9,'<>                          <>'
  2070.     db     (-1) AND 0FFH,25,10,'<>   C = (38)     F = (73)  <>'
  2071.     db     (-1) AND 0FFH,25,11,'<>                          <>'
  2072.     db     (-1) AND 0FFH,25,12,'<>==========================<>'
  2073.     db     (-1) AND 0FFH,25,13,'<>    <ESC> Cancels Test    <>'
  2074.     db     (-1) AND 0FFH,25,14,'<>==========================<>'
  2075.     db     (-1) AND 0FFH,25,16,'TRACK? ...',bs,0
  2076.  
  2077. me8:    db    (-1) AND 0FFH,24,5,'---  RADIAL ALIGNMENT CHECK ---'
  2078.     db    (-1) AND 0FFH,10,9,'Away',(-1) AND 0FFH,36,9,'Spindle',(-1) AND 0FFH,63,9,'Toward'
  2079.     db    (-1) AND 0FFH,10,10,'13 12 11 10 9 8 7 6 5 4 3 2 1'
  2080.     db            '-1 2 3 4 5 6 7 8 9 10 11 12 13',0
  2081.  
  2082. me9:    db    (-1) AND 0FFH,25,2,'<>==========================<>'
  2083.     db    (-1) AND 0FFH,25,3,'<>      TRACK SELECTION     <>'
  2084.     db    (-1) AND 0FFH,25,4,'<>==========================<>'
  2085.     db      (-1) AND 0FFH,25,5,'<>                          <>'
  2086.     db      (-1) AND 0FFH,25,6,'<>    A = (35)   B = (44)   <>'
  2087.     db      (-1) AND 0FFH,25,7,'<>                          <>'
  2088.     db      (-1) AND 0FFH,25,8,'<>          C = (47)        <>'
  2089.     db      (-1) AND 0FFH,25,9,'<>                          <>'
  2090.     db     (-1) AND 0FFH,25,10,'<>==========================<>'
  2091.     db     (-1) AND 0FFH,25,11,'<>   <ESC>  Cancels Test    <>'
  2092.     db     (-1) AND 0FFH,25,12,'<>==========================<>'
  2093.     db     (-1) AND 0FFH,25,14,'TRACK? ...',bs,0
  2094.  
  2095. me10:    db    (-1) AND 0FFH,23,5,'---  DISKETTE CENTERING CHECK ---',0
  2096.  
  2097. me11:    db    (-1) AND 0FFH,23,14,'Press <SPACE BAR> For New Track',0
  2098.  
  2099. me12:    db    (-1) AND 0FFH,24,5,'--- AZIMUTH ALIGNMENT CHECK ---'  
  2100.     db    (-1) AND 0FFH,25,14,'<ESC> Will Cancel AZIMUTH Check',0
  2101.  
  2102. me13:    db    (-1) AND 0FFH,25,2,'<>==========================<>'
  2103.     db      (-1) AND 0FFH,25,3,'<>      TRACK SELECTION     <>'
  2104.     db      (-1) AND 0FFH,25,4,'<>==========================<>'
  2105.     db    (-1) AND 0FFH,25,5,'<>                          <>'
  2106.     db      (-1) AND 0FFH,25,6,'<>    A = (0)    B = (76)   <>'
  2107.     db      (-1) AND 0FFH,25,7,'<>                          <>'
  2108.     db      (-1) AND 0FFH,25,8,'<>==========================<>'
  2109.     db      (-1) AND 0FFH,25,9,'<>    <ESC> Cancels Test    <>'
  2110.     db     (-1) AND 0FFH,25,10,'<>==========================<>'
  2111.     db     (-1) AND 0FFH,25,12,'TRACK? ...',bs,0 
  2112.  
  2113. me14:    db    (-1) AND 0FFH,28,5,'--- HYSTERESIS CHECK ---',0
  2114.  
  2115. me15:     db    (-1) AND 0FFH,15,8,'##################################################'
  2116.     db     (-1) AND 0FFH,15,12,'##################################################',0
  2117.  
  2118. me16:    db    'Positioner Hysteresis = ',0
  2119. me17:    db    (-1) AND 0FFH,25,5,'--- INDEX TO DATA TIME ---',0
  2120. me18:    db    'Index To ID In Usecs = ',0
  2121. me19:    db    (-1) AND 0FFH,27,5,'--- SPINDLE SPEED CHECK ---'  
  2122.     db    (-1) AND 0FFH,25,14,'<ESC>  Will Cancel RPM Check',0
  2123.  
  2124. me20:    db    '  Milliseconds',0
  2125. me21:    db    '  RPM',0
  2126.  
  2127. BLANKS:    DB    '                                        '
  2128.     DB    '                ',0
  2129.                                                            
  2130. SELMSG:    DB    (-1) AND 0FFH,15,12,'WHICH DRIVE HAS THE DDD - A,B,C,D ?'
  2131.     DB    (-1) AND 0FFH,25,14,'SELECTION ? ....',0
  2132.                                                  
  2133.  
  2134. *************************
  2135. *** "POSITION CURSOR" ***
  2136. *************************
  2137.  
  2138. set$cur    db    0ffh
  2139. column    ds    1        ; set column
  2140. row    ds    1        ; set row
  2141.     db    0        ; terminator
  2142.  
  2143. ***********************************
  2144. *** "PROGRAM VARIABLE STORAGE" ***
  2145. ***********************************
  2146.  
  2147. temp    ds    2        ; temp storage 
  2148. diff     ds    1        ;  1st - 2nd read
  2149. ctrk    ds    1        ; current track
  2150. savtrk    ds    1        ; temp storage Hysteresis test
  2151. dflag    ds    1        ; seek delay flag
  2152. point    ds    2        ; table pointer
  2153. xpoint    ds    2        ; table pointer positive
  2154. ypoint    ds    2        ; table pointer negative
  2155. xoff    ds    1        ; positive offset
  2156. yoff    ds    1        ; negative offset
  2157. bais    ds    1        ; bais from test track (Hysteresis)
  2158. hyerr    ds    1        ; hysteresis error on first reading
  2159. SELPT    DS    1    ;STORES BYTE FOR DISC CONTROL PORT
  2160.  
  2161. ;
  2162. ;    Storage area for 16/24 bit divide routine
  2163. ;
  2164. msb    ds    1
  2165. msb1    ds    2
  2166. msb2    ds    2
  2167.  
  2168. inbuf:    db    3        ;"max" byte for BDOS 10
  2169. incnt    ds    1        ;"cnt" buffer for BDOS 10
  2170. buffer    ds    4        ; console input buffer
  2171. secbuf    ds    256        ; sector buffer
  2172.  
  2173.     ds    100        ; stack space
  2174. stack    equ    $        ; top down...
  2175.  
  2176.  
  2177.  
  2178.  
  2179.