[comp.sys.ibm.pc] Switching AT floppy from 1.2M to 360K and back

lane@dalcs.UUCP (John Wright/Dr. Pat Lane) (07/21/88)

Hi.  I was looking for a way to tell an AT with an HD (1.2Meg) drive to
use 360K disk format by default.  This would make "/4" on FORMAT auto-
matic and make it possible to DISKCOPY 360K disks to unformatted target
disks (currently, on an AT, it gives something like "drive parms incompatible"
when it discovers it has to format the disk;  you have to format with /4 
first).  It would solve problems with a few other programs, too.

I eventually discovered that using DRIVPARM=/D:0/F:0 (undocumented I think)
in CONFIG.SYS would do the trick but I wanted a small program to switch
back and forth.  I imagined it would alter stored disk parameters somewhere 
in DOS.  By comparing core images I developed the following two extremely
primitive programs.  

I can't recommend these programs as I have only a partial understanding
of what they do. For one I'm working with PC-DOS 3.20 and I doubt they
would work with anything else.  I am in fact seeking advise and feedback.
(Like, "does anyone already have a decent program for this"?)

	NAME	SDRV360
	ORG	100H
CODE	SEGMENT
	ASSUME	CS:CODE,DS:CODE,ES:NOTHING
	MOV	AX,CS
	MOV	DS,AX
	MOV	SI,OFFSET LIST
	XOR	AX,AX
	MOV	ES,AX
	MOV	DI,1A92H
	MOV	CX,22
	REP	MOVSB
	INT	20H
	.RADIX	16
LIST	DB	00,0F0,01,28,00,00,02,02,01,00,02,70,00,0D0,02,0FDH
	DB	02,00,09,00,02,00
CODE	ENDS
	END

	NAME	SDRV12M
	ORG	100H
CODE	SEGMENT
	ASSUME	CS:CODE,DS:CODE,ES:NOTHING
	MOV	AX,CS
	MOV	DS,AX
	MOV	SI,OFFSET LIST
	XOR	AX,AX
	MOV	ES,AX
	MOV	DI,1A92H
	MOV	CX,22
	REP	MOVSB
	INT	20H
	.RADIX	16
LIST	DB	01,32,00,50,00,00,02,01,01,00,02,0F0,00,60,09,0F9
	DB	07,00,0F,00,02,00
CODE	ENDS
	END


Two things about assembling these.  After assembling, linking, and
EXD2BIN'ing, the OFFSET LIST does not get biased by 100h.  I have to
use DEBUG and fix it.  Am I doing something wrong here?

Also, in the first program, in the LIST statement, if I take the "H" off 
the "0FD" constant, I get a "Syntax Error", even though .RADIX is 16 and
all the other numbers are OK. 

In the lists, I don't know what the first three bytes are.  The next two
bytes are the number of tracks.  The rest matchs the "BIOS Parameter
Block" which is written into the boot sector of every disk when it is 
formatted (but are not found in the ROM BIOS).

A few other interesting (to me) points.  There is a complicated mechanism 
unique to the AT for tracking the type of drive and disk it is dealing
with.  I've read that this includes knowing when the disk drive door is
opened and setting the drive type to unknown.  There are some disk status
bytes at 40:90 & 91 (drive A & B) and an INT 13 function (17h) that set
those bytes.  Status can be 360K in a 360K drive, 360K in a 1.2M drive,
1.2M in a 1.2M drive, or unknown.  There are also "Operation Status"
bytes at 40:92 & 93 whose function is a mystery to me.

None of this makes any difference to FORMAT (at least in DOS 3.2).  In
fact this program never does an INT 13.  Everything seems to be done with
DOS (INT 21) function 44h (IOCTL).  In particular undocumented (even in Ralf
Brown's comprehensive list of interupts - are you listening Ralf?) sub-
functions 13 and 15 (decimal). 13 is particularly interesting; it seems
to use a sub-subfunction code in CX.  An 0860h returns in a buffer a 
list of drive paarmeters (ie. fixed or floppy, no. of tracks, etc.) and
this is what FORMAT goes by.  With CX set to 0842h it formats a track.
Strange, eh?

If anybody has insights to this, I'd be curious. Thanks.

-- 
John Wright      //////////////////      Phone:  902-424-3805  or  902-424-6527
Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Halifax N.S., CANADA  B3H-4H8 
Cdn/Bitnet: lane@cs.dal.cdn    Arpa: lane%dalcs.uucp@uunet.uu.net
Uucp: lane@dalcs.uucp or {uunet,watmath,utai,garfield}!dalcs!lane