home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / dskutl / ddd1.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  46.9 KB  |  2,175 lines

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