home *** CD-ROM | disk | FTP | other *** search
/ Best Objectech Shareware Selections / UNTITLED.iso / boss / util / disk / 001 / hclean10.asm next >
Assembly Source File  |  1989-11-12  |  11KB  |  240 lines

  1.     page    60,132
  2.     title    HCLEAN - Seek track 0 to last track & back on diskette
  3.  
  4. ; ********************************************************************
  5. ; * Title:    HCLEAN - Seek track 0 to last track & back on diskette
  6. ; * Author:    Thomas A. Callahan
  7. ; * Revision:    Original  07-Nov-89
  8. ; * Purpose:    This program will seek the first track then  seeks the
  9. ; *        last track and back on the floppy drive specified.  It
  10. ; *        is  used for drive  cleaning  purposes  as to make the
  11. ; *        drive  head  go  somewhere else besides track 0 and to
  12. ; *        give it motion across the cleaning diskette 90 degrees
  13. ; *        from the direction of diskette rotation.
  14. ; *
  15. ; *             Available from:
  16. ; *             Infinity Information Exchange, Queens, NYC
  17. ; *             (718) 343-5997
  18. ; ********************************************************************
  19. ;
  20. ; Equates
  21. ;
  22. reset      equ     0                        ; reset controller
  23. status     equ     1                        ; read controller status
  24. read       equ     2                        ; read sectors
  25. write      equ     3                        ; write sectors
  26. verify     equ     4                        ; verify sectors
  27. format     equ     5                        ; format track
  28. conin      equ     1                        ; console input function
  29. cine       equ     8                        ; console input no echo
  30. print      equ     9                        ; print string function
  31. ;
  32. ; Program Data Segment
  33. ;
  34. stack      segment para stack 'stack'
  35.            dw      90 dup(0)                ; program stack
  36. stack      ends
  37.  
  38. data       segment para public 'data'
  39.  
  40. drive      db      0                        ; drive number
  41. head       db      0                        ; head number
  42. track      db      0                        ; track number
  43. sector     db      1                        ; sector number
  44. count      db      1                        ; number of sectors
  45. no_tracks  db      '4'                      ; number of tracks
  46. loop_cnt   db      10                       ; loop count default
  47. maxtrk     db      39                       ; 40 track default
  48. cmdlen     dw      0                        ; length of cmdline
  49. cksum      db      0                        ; temp storage for cksum
  50. ;
  51. ;
  52. ;
  53. buffer     db      1024 dup(0)              ; test data buffer
  54.            db      '$'
  55. cmdline    db      129 dup(0)               ; command line
  56. ;
  57. msg1       db      13,10,10
  58.            db      '[HCLEAN Version 1.0]  -  '
  59.            db      'T. Callahan  07-Nov-89',13,10
  60.            db      'Infinity Information Exchange - (718) 343-6093'
  61.            db      13,10,10,'$'
  62. msg2       db      13,10,10,'*** Job Done! ***',13,10,10,'$'
  63. msg40t     db      13,10,'Cleaning 40 track drive. . .',13,10,'$'
  64. msg80t     db      13,10,'Cleaning 80 track drive. . .',13,10,'$'
  65. emsg1      db      10,13,'USAGE: HCLEAN abc',07,13,10,10
  66.            db      '  Where a=drive (0,1,2,3 floppy only!)',10,13
  67.            db      '        b=# tracks/10 (4=40 tracks, 8=80 tracks)',10,13
  68.            db      '        c=# passes to make x 16 (1=16,2=32)',13,10,10
  69.            db      '  Ex: HCLEAN 042 cleans drive A @ 40 trks with 2 x 16 '
  70.            db      '(32) passes',10,13,'$'
  71. pmt1       db      13,10,'Put cleaning solution on cleaning diskette '
  72.            db      'and put it in disk drive',13,10,'$'
  73. pmt2       db      13,10,10,'Remove cleaning diskette from the drive '
  74.            db      13,10,'$'
  75. rtnmsg     db      13,10,10,'Press <RETURN> to continue ',07,'$'
  76. data      ends
  77. ;
  78. ; Program Code Segment
  79. ;
  80.  
  81. code       segment para public 'code'
  82. disk       proc far
  83.            assume cs:code,ds:data,ss:stack,es:data
  84.  
  85. start:     push    ds                       ; save DOS data segment
  86.            xor     ax,ax                    ; clear ax
  87.            push    ax                       ; save zero return address
  88.            mov     ax,data                  ; ax=data segment address
  89.            mov     ds,ax                    ; make data addressable
  90.            xor     ax,ax                    ; clear ax
  91. ;
  92. ;       Print Opening Message/Header
  93. ;
  94.            mov     ah,print                 ; print string
  95.            lea     dx,msg1                  ; address of message
  96.            int     21h                      ; DOS call
  97. ;
  98. ;       Process Command Line
  99. ;
  100.            xor     ax,ax                    ; clear ax
  101.            mov     al,es:[0080h]            ; al=length of command line
  102.            inc     ax                       ; ax=ax+1 (point to cr @eol)
  103.            mov     bx,ax                    ; bx=ax
  104.            add     bx,0080h                 ; cmdline offset to bx
  105.            mov     byte ptr es:[bx],0       ; make ASCIIZ string
  106.            mov     si,0082h                 ; si=start of cmdline
  107.            lea     di,cmdline               ; di=offset of cmdline
  108.            dec     ax                       ; adjust ax for space at start
  109.            mov     cmdlen,ax                ; save length of command line
  110.            mov     cx,ax                    ; cx=loop count
  111.            push    es                       ; save es
  112.            mov     ax,data                  ; ax=address of data segment
  113.            mov     es,ax                    ; es=ax
  114.            pop     ds                       ; ds=psp in es
  115.            rep movsb                        ; move command line to bfr
  116.            push    ds                       ; push ds to restore es
  117.            pop     es                       ; restore es
  118.            mov     ds,ax                    ; ds=our data segment
  119.            mov     es,ax                    ; es=        "
  120.            mov     ax,cmdlen                ; ax=cmdline length
  121.            cmp     ax,4                     ; right number of parms?
  122.            jz      itsok                    ; cmdline ok...
  123.            lea     dx,emsg1                 ; dx=address of err msg
  124.            mov     ah,print                 ; ah=print function
  125.            int     21h                      ; doscall
  126.            jmp     err_exit                 ; exit program if bad parms
  127. itsok:     lea     si,cmdline               ; bx=address of cmdline
  128.            mov     al,byte ptr [si]         ; al=drive
  129.            sub     al,30h                   ; subtract ascii bias
  130.            mov     drive,al                 ; set drive
  131.            inc     si                       ; next parm
  132.            mov     al,byte ptr [si]         ; al=#tracks
  133.            cmp     al,'8'                   ; is 80 tracks?
  134.            jnz     next1                    ; skip if not...
  135.            mov     no_tracks,'8'            ; set 80 tracks
  136. next1:     inc     si                       ; next parm
  137.            mov     al,byte ptr [si]         ; al=loop count index
  138.            sub     al,30h                   ; subtract ASCII bias
  139.            mov     cl,4
  140.            rol     al,cl                    ; al=al*16
  141.            mov     loop_cnt,al              ; set loop count
  142. ;
  143. ;       Tell whether we were told to do a 40 or 80 track drive
  144. ;
  145.            mov     ah,print                 ; print string
  146.            lea     dx,msg40t                ; setup for 40trk msg
  147.            mov     maxtrk,39                ; set max trks
  148.            cmp     no_tracks,'8'            ; 80 tracks?
  149.            jnz     skip1                    ; no, use 40 tracks
  150.            lea     dx,msg80t                ; setup for 80trk msg
  151.            mov     maxtrk,79                ; set max trks
  152. skip1:     mov     ah,print                 ; print function
  153.            int     21h                      ; DOS call
  154. ;          
  155. ;       Now prompt the user to put the cleaning diskette in
  156. ;
  157.            lea     dx,pmt1                  ; get prompt message
  158.            int     21h                      ; and go print it
  159. ;
  160. ;       Wait for RETURN
  161. ;
  162.            call    getrtn
  163. ;
  164. ;       Otay Buttweet, we're assuming the user has followed the
  165. ;       instructions (is that possible??) so we're off
  166. ;
  167. loop1:     call    Seeker                   ; perform 1 seek pass
  168.            dec     loop_cnt                 ; EOJ?
  169.            jnz     loop1