home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- title HCLEAN - Seek track 0 to last track & back on diskette
-
- ; ********************************************************************
- ; * Title: HCLEAN - Seek track 0 to last track & back on diskette
- ; * Author: Thomas A. Callahan
- ; * Revision: Original 07-Nov-89
- ; * Purpose: This program will seek the first track then seeks the
- ; * last track and back on the floppy drive specified. It
- ; * is used for drive cleaning purposes as to make the
- ; * drive head go somewhere else besides track 0 and to
- ; * give it motion across the cleaning diskette 90 degrees
- ; * from the direction of diskette rotation.
- ; *
- ; * Available from:
- ; * Infinity Information Exchange, Queens, NYC
- ; * (718) 343-5997
- ; ********************************************************************
- ;
- ; Equates
- ;
- reset equ 0 ; reset controller
- status equ 1 ; read controller status
- read equ 2 ; read sectors
- write equ 3 ; write sectors
- verify equ 4 ; verify sectors
- format equ 5 ; format track
- conin equ 1 ; console input function
- cine equ 8 ; console input no echo
- print equ 9 ; print string function
- ;
- ; Program Data Segment
- ;
- stack segment para stack 'stack'
- dw 90 dup(0) ; program stack
- stack ends
-
- data segment para public 'data'
-
- drive db 0 ; drive number
- head db 0 ; head number
- track db 0 ; track number
- sector db 1 ; sector number
- count db 1 ; number of sectors
- no_tracks db '4' ; number of tracks
- loop_cnt db 10 ; loop count default
- maxtrk db 39 ; 40 track default
- cmdlen dw 0 ; length of cmdline
- cksum db 0 ; temp storage for cksum
- ;
- ;
- ;
- buffer db 1024 dup(0) ; test data buffer
- db '$'
- cmdline db 129 dup(0) ; command line
- ;
- msg1 db 13,10,10
- db '[HCLEAN Version 1.0] - '
- db 'T. Callahan 07-Nov-89',13,10
- db 'Infinity Information Exchange - (718) 343-6093'
- db 13,10,10,'$'
- msg2 db 13,10,10,'*** Job Done! ***',13,10,10,'$'
- msg40t db 13,10,'Cleaning 40 track drive. . .',13,10,'$'
- msg80t db 13,10,'Cleaning 80 track drive. . .',13,10,'$'
- emsg1 db 10,13,'USAGE: HCLEAN abc',07,13,10,10
- db ' Where a=drive (0,1,2,3 floppy only!)',10,13
- db ' b=# tracks/10 (4=40 tracks, 8=80 tracks)',10,13
- db ' c=# passes to make x 16 (1=16,2=32)',13,10,10
- db ' Ex: HCLEAN 042 cleans drive A @ 40 trks with 2 x 16 '
- db '(32) passes',10,13,'$'
- pmt1 db 13,10,'Put cleaning solution on cleaning diskette '
- db 'and put it in disk drive',13,10,'$'
- pmt2 db 13,10,10,'Remove cleaning diskette from the drive '
- db 13,10,'$'
- rtnmsg db 13,10,10,'Press <RETURN> to continue ',07,'$'
- data ends
- ;
- ; Program Code Segment
- ;
-
- code segment para public 'code'
- disk proc far
- assume cs:code,ds:data,ss:stack,es:data
-
- start: push ds ; save DOS data segment
- xor ax,ax ; clear ax
- push ax ; save zero return address
- mov ax,data ; ax=data segment address
- mov ds,ax ; make data addressable
- xor ax,ax ; clear ax
- ;
- ; Print Opening Message/Header
- ;
- mov ah,print ; print string
- lea dx,msg1 ; address of message
- int 21h ; DOS call
- ;
- ; Process Command Line
- ;
- xor ax,ax ; clear ax
- mov al,es:[0080h] ; al=length of command line
- inc ax ; ax=ax+1 (point to cr @eol)
- mov bx,ax ; bx=ax
- add bx,0080h ; cmdline offset to bx
- mov byte ptr es:[bx],0 ; make ASCIIZ string
- mov si,0082h ; si=start of cmdline
- lea di,cmdline ; di=offset of cmdline
- dec ax ; adjust ax for space at start
- mov cmdlen,ax ; save length of command line
- mov cx,ax ; cx=loop count
- push es ; save es
- mov ax,data ; ax=address of data segment
- mov es,ax ; es=ax
- pop ds ; ds=psp in es
- rep movsb ; move command line to bfr
- push ds ; push ds to restore es
- pop es ; restore es
- mov ds,ax ; ds=our data segment
- mov es,ax ; es= "
- mov ax,cmdlen ; ax=cmdline length
- cmp ax,4 ; right number of parms?
- jz itsok ; cmdline ok...
- lea dx,emsg1 ; dx=address of err msg
- mov ah,print ; ah=print function
- int 21h ; doscall
- jmp err_exit ; exit program if bad parms
- itsok: lea si,cmdline ; bx=address of cmdline
- mov al,byte ptr [si] ; al=drive
- sub al,30h ; subtract ascii bias
- mov drive,al ; set drive
- inc si ; next parm
- mov al,byte ptr [si] ; al=#tracks
- cmp al,'8' ; is 80 tracks?
- jnz next1 ; skip if not...
- mov no_tracks,'8' ; set 80 tracks
- next1: inc si ; next parm
- mov al,byte ptr [si] ; al=loop count index
- sub al,30h ; subtract ASCII bias
- mov cl,4
- rol al,cl ; al=al*16
- mov loop_cnt,al ; set loop count
- ;
- ; Tell whether we were told to do a 40 or 80 track drive
- ;
- mov ah,print ; print string
- lea dx,msg40t ; setup for 40trk msg
- mov maxtrk,39 ; set max trks
- cmp no_tracks,'8' ; 80 tracks?
- jnz skip1 ; no, use 40 tracks
- lea dx,msg80t ; setup for 80trk msg
- mov maxtrk,79 ; set max trks
- skip1: mov ah,print ; print function
- int 21h ; DOS call
- ;
- ; Now prompt the user to put the cleaning diskette in
- ;
- lea dx,pmt1 ; get prompt message
- int 21h ; and go print it
- ;
- ; Wait for RETURN
- ;
- call getrtn
- ;
- ; Otay Buttweet, we're assuming the user has followed the
- ; instructions (is that possible??) so we're off
- ;
- loop1: call Seeker ; perform 1 seek pass
- dec loop_cnt ; EOJ?
- jnz loop1 ; no, do it again
- ;
- ; We're done now so tell the user to remove the cleaning diskette
- ; from the disk drive and then quit and go home...
- ;
- mov ah,print ; get desired function
- lea dx,pmt2 ; get desired string
- int 21h ; and go print it
- ;
- ; Wait for RETURN II
- ;
- call getrtn
- ;
- ; Point Of Exit
- ;
- exit: mov ah,print ; Get print function in AH
- lea dx,msg2 ; Get print data address in DX
- int 21h ; and go print it
- err_exit: ret ; return to DOS
- ;
- ; This procedure will seek the first track then the last track
- ; which will be either 40 or 80. Seeking the first track then
- ; the last track is considered one pass
- ;
- Seeker proc near
- mov track,0
- call setup ; load drive, head, track
- mov ah,read ; read command
- mov cl,1 ; cl=sector number
- mov al,1 ; al=number of sectors to read
- mov bx,offset buffer ; where to put sector
- int 13h ; read the sector
- mov al,maxtrk ; al=max tracks
- mov track,al ; set tracks
- call setup ; load drive, head, track
- mov ah,read ; read command
- mov cl,1 ; cl=sector number
- mov al,1 ; al=number of sectors to read
- mov bx,offset buffer ; where to put sector
- int 13h ; read the sector
- ret ; return to caller
- Seeker endp
- ;
- ; SETUP - Get drive parms in proper registers
- ;
- setup proc near
- mov dl,drive ; dl=drive number (0-3)
- mov dh,head ; dh=head number (0-1)
- mov ch,track ; ch=track number (0-79)
- ret
- setup endp
- ;
- ; GETRTN - Get Return. This procedure will prompt the users to
- ; hit RETURN and when they do it will return to calling program else
- ; it will just sit there until ?????
- ;
- getrtn proc near
- lea dx,rtnmsg ; Get prompt
- int 21h ; Go prompt!
- rtnlp: mov ah,cine ; Console read funstion W/O echo
- int 21h ; Go read!
- cmp al,13 ; A carriage return??
- jnz rtnlp ; Folks can't read! Do it again.
- ret
- getrtn endp
- disk endp
- code ends
- end start
- ;
- ; *** EOF HCLEAN.ASM
- ;