Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Park source code and COM file.

1 view
Skip to first unread message

Timothy Lange

unread,
Jan 22, 1986, 4:48:26 PM1/22/86
to
Here is the assembly source and uuencode of the .COM file for the
program PARK. This will 'park' the heads on a hard disk IBM PC/XT system.
I don't know how well it will function on other systems. I got this
from a article in PC Tech Journal, December, 1985.
----------
page 60, 132
title Park, park the hard disk heads for relocation.
;
; Taken out of PC Tech Journal, December, 1985 issue.
;
; Equates.
;
cr equ 00dh
lf equ 00ah
;
; Macros.
;
doscall macro func
mov ah, func
int 21h
endm
;
code segment para public 'code'
assume cs:code, ds:code
org 100h
park proc near
jmp start
;
; Messages.
;
mess_1 db cr, lf, 'No fixed disks installed', cr, lf, '$'
mess_2 db cr, lf, 'Fixed disk in parked position', cr, lf, '$'
mess_3 db cr, lf, 'Both fixed disk in parked position', cr, lf, '$'
mess_4 db cr, lf, 'TURN OFF COMPUTER', '$'
;
; Local storage.
;
oldint dd ? ; original INT 41 vector
parms db 64 dup (?) ; substitue parameter table
;
start: mov al, 41h ; get and store original vector
doscall 35
mov word ptr oldint, bx
mov word ptr oldint + 2, es
lds si, oldint ; source starting address
mov ax, cs ; destination starting address
mov es, ax
mov di, offset parms
mov cx, 64 ; number of bytes to move
cld ; move increasing direction
rep movsb ; move them
mov ax, cs ; restore DS addressability
mov ds, ax
;
; Increase maximum number of cylinders in new table by 16.
;
mov ax, 16
lea bx, parms
add [bx], ax
add 10h[bx], ax
add 20h[bx], ax
add 30h[bx], ax
;
; Check for existence of hard drive.
;
mov ah, 11h ; attempt to recalibrate
mov dx, 80h ; first hard disk
push dx
int 13h
or ah, ah ; was command performed ok?
lea dx, mess_1 ; set up no-drive message and
jnz stop ; exit if no fixed drives
pop dx
call mover
;
; Check for existence of second hard drive.
;
mov ah, 11h ; attempt to recalibrate
mov dx, 81h ; second hard drive
push dx
int 13h
or ah, ah ; did it do it ok?
lea dx, mess_2 ; one-drive message
jnz stop ; exit if no second drive
pop dx
call mover
lea dx, mess_3 ; two-drive message
stop: doscall 09h ; display "drive" message
lea dx, mess_4 ; display final message
doscall 09h
cli ; disable interrupts and quit
hlt
;
; Move to highest track on disk.
; Get original drive parameters.
;
mover: mov ah, 08
push dx
int 13h
;
; Install new vector for INT 41.
;
mov al, 41h
lea dx, parms
doscall 25h
;
; Initialize drive parameters with new table.
;
mov ah, 09
pop dx
push dx
int 13h
;
; Move head past highest pre-formatted cylinder.
;
moveit: clc ; clear carry flag
add ch, 1 ; next cylinder
jnc m2 ; if register overflowed
add cl, 40h ; increase high bits
m2: mov ax, 0401h ; move and verify sector
int 13h
or ah, ah ; past end?
jz moveit ; if not, try one more
;
; Return to shipping cylinder.
;
clc
sub ch, 1
jnc m3 ; in case of underflow
sub cl, 40h ; decrease high bits
m3: mov ax, 0401h
int 13h
;
; Restore original INT 41 vector.
;
lds dx, oldint
mov al, 41h
doscall 25h
;
; Restore DS addressability.
;
mov ax, cs
mov ds, ax
;
; Initialize to original drive parameters.
;
mov ah, 09
pop dx
int 13h
ret
park endp
code ends
end park
----------

Run this though uudecode
----------
--
Tim Lange Engineering Business Offices
317-494-5338 Rm 120 Engineering Administration Bldg.
Purdue University West Lafayette, IN 47907
{decvax|harpo|ihnp4|inuxc|seismo|ucbvax}!pur-ee!langet

0 new messages