home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / kaypro / advent2.ark / TURBOSAF.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-09-20  |  4.4 KB  |  181 lines

  1.     title    'Program to PARK heads of hard disks'
  2.  
  3.  
  4. ;**********************************************************
  5. ;    Before using this program you must customize
  6. ;    it for the Winchester Drive(s) that you are using.
  7. ;    Failure to do this could cause damage to your hard disk.
  8. ;    Not all hard drives have a dedicated shipping zone
  9. ;    for parking the heads.  If your drive does not then
  10. ;    simply wait till the select light goes out and turn your
  11. ;    machine off,  there is no benefit in running this program.
  12. ;    Of the three drives that are available from Plu*Perfect
  13. ;    Systems for use with the Advent TurboROM, two do have such
  14. ;    shipping zones but this is atypical.
  15. ;        Shugart 604    has shipping zone at cylinder 180
  16. ;        Rodime    252    has no landing zone and it is
  17. ;                imposible to seek beyond cyl 305
  18. ;        Seagate    225    has shipping zone from cyl 615-670
  19. ;
  20. ;
  21. ;    Use your text editor (WordStar in non-doc mode or Perfect Writer)
  22. ;    to edit the equates below to match your situation.
  23. ;
  24. ;    Then assemble it using ASM which is supplied with
  25. ;    your CP/M system.
  26. ;
  27. ;    "ASM TURBOSAF<CR>"
  28. ;
  29. ;(this takes the file TURBOSAF.ASM and generates a file TURBOSAF.HEX)
  30. ;
  31. ;    Generate a COM file with LOAD which was also supplied with
  32. ;    your CP/M system.
  33. ;
  34. ;    "LOAD TURBOSAF<CR>"
  35. ;
  36. ;(this takes the file TURBOSAF.HEX and generates a file TURBOSAF.COM)
  37. ;
  38. ;    You can now run TURBOSAF before shutting down your machine.
  39. ;********************************************************************
  40. ;appropriate zones are
  41. ; ST225        =    650
  42. ; RO252        =    305        ;doesn't do anything
  43. ; SA604        =    180
  44. ;**********************************************************************
  45.  
  46. CLRSCR        equ    01AH        ;clear Kaypro screen
  47. CR        equ    00DH        ;carriage return
  48. LF        equ    00AH        ;line feed
  49.  
  50. PRINT$STR    equ    9        ;CP/M string printer
  51. BDOS        equ    0005        ;standard BDOS entry point
  52.  
  53. SHIP$ZONE$1    equ    650        ;set for Seagate ST225
  54. SHIP$ZONE$2    equ    0        ;no second drive
  55.  
  56. STEP$RATE$1    equ    0        ;almost all moderen drives can do
  57.                     ;buffered seek.
  58. STEP$RATE$2    equ    0
  59.  
  60.  
  61. ;controller ports
  62. HBASE        equ    080H        ;base address
  63.  
  64. HSDH        equ    HBASE+6        ;head, drive register
  65. HSTATUS        equ    HBASE+7        ;status register
  66. HCOMMAND    equ    HBASE+7        ;command register
  67. HCYLLO        equ    HBASE+4        ;low byte cylinder
  68. HCYLHI        equ    HBASE+5        ;high byte cylinder
  69.  
  70. ;**************************************************************
  71.     ORG    100H        ;standard runtime address
  72.  
  73.     jmp    start        ;jump around parameters
  74.  
  75. maxcyl1:
  76.     dw    SHIP$ZONE$1    ;patchable location for drive 1
  77.     db    step$rate$1    ;step rate for drive
  78.                 ;0 is buffered seek
  79.  
  80.     db    CR,LF,LF
  81.     db    'The heads of Physical Drive 1'
  82.     db    ' are positioned over the Safety Zone$'
  83.  
  84. maxcyl2:
  85.     dw    SHIP$ZONE$2    ;patchable location for drive 2
  86.     db    step$rate$2    ;step rate for drive
  87.                 ;0 is buffered seek
  88.  
  89.     db    CR,LF,LF
  90.     db    'The heads of Physical Drive 2'
  91.     db    ' are positioned over the Safety Zone$'
  92.  
  93.  
  94. sign$on:
  95.     db    CLRSCR
  96.     db    'TURBOSAF  Copyright (c) 1986 Plu*Perfect Systems'
  97.     db    CR,LF,'$'
  98.  
  99.  
  100. desel$msg:
  101.  db CR,LF,LF
  102.  db 'All Hard Drives are now deselected and it is safe',CR,LF
  103.  db 'to turn the power off and move your computer$',CR,LF
  104.  
  105. start:    lxi    sp,stack    ;set up our own stack
  106.     lxi    d,sign$on
  107.     mvi    c,PRINT$STR
  108.     call    BDOS
  109.  
  110.  
  111.     mvi    a,00001000B        ;drive one head zero
  112.     out    HSDH
  113.     lxi    h,maxcyl1            ;see if drive 1 to be secured
  114.     mov    e,m
  115.     inx    h
  116.     mov    a,m
  117.     ora    e
  118.     cnz    do$safe
  119.  
  120.     mvi    a,00010000B        ;drive two head zero
  121.     out    HSDH
  122.     lxi    h,maxcyl2
  123.     mov    e,m
  124.     inx    h
  125.     mov    a,m
  126.     ora    e
  127.     cnz    do$safe
  128.  
  129. ;*******************************************************************
  130. ;now select controller drive 0 so that all drives are deselected
  131.  
  132. deselect:
  133.     in    HSTATUS            ;wait till controller not busy
  134.     rlc
  135.     jc    deselect
  136.  
  137.     xra    a
  138.     out    HSDH            ;select drive zero
  139.     lxi    d,desel$msg
  140.     mvi    c,PRINT$STR
  141.     call    BDOS            ;tell people we are finished
  142.     di                ;make sure we stay hung
  143. self:    jmp    self            ;hang the machine
  144.  
  145.  
  146.  
  147. ;*******************************************************
  148. ;actual safety routine
  149. do$safe:
  150.     push    psw
  151. busy:    in    HSTATUS            ;wait till controller
  152.     rlc
  153.     jc    busy
  154.     pop    psw
  155. ;now select drive one and seek safety zone
  156.     out    HCYLHI            ;high order cylinder
  157.     mov    a,e
  158.     out    HCYLLO            ;low order cylinder
  159.     inx    h
  160.     mov    a,m
  161.     ori    01110000B        ;compute seek command
  162.     out    HCOMMAND        ;issue seek but don't wait
  163.     inx    h
  164.     xchg
  165.     mvi    c,PRINT$STR
  166.     call    BDOS
  167.     ret
  168.  
  169.  
  170.     ds    64
  171. stack    equ    $
  172.     end
  173.     cnz    do$safe
  174.  
  175.     mvi    a,00010000B        ;drive two head zero
  176.     out    HSDH
  177.     lxi    h,maxcyl2
  178.     mov    e,m
  179.     inx    h
  180.     mov    a,m
  181.     ora