[net.micro.apple] Mods to use 40 track drives under Apple CPM.

dimond@aussie.DEC (Phil Dimond, ms:SNA/CSS Engineering,Sydney,Aust.) (02/05/86)

Hi:
	From the responses I have gratefully received from the net, I have
the essential data for modifying Apple CP/M to drive 40 tracks on Apple
drives. I will summarise here. If anyone desires further information, please
do not hesitate to contact me by mail.
	
	Firstly, it is very important to use late model drives. Apple has
advised me that any drives sold since the IIe was released should be capable
of 40 track operation. Any Far-East Apple compatible drives should also
be fine. The problem with old drives is that they cannot step to 40 tracks.
	This procedure is somewhat of a Kludge, but it worked, and the small
amount of work involved is well worth the extra 20k of disk storage that
is gained. Several steps must be followed, these being:

	1. Boot and modify Apple DOS 3.3
	2. INIT all required disks to format them for forty tracks.
	3. Boot CP/M and copy the system tracks to the disks.
	4. Put the BIOS modifying program on the disk and set it up for
	   autobooting.

1. 	Under DOS 3.3, only one location needs to be changed to allow the
INIT command to format 40 tracks. To format your disks, boot DOS 3.3. Now
type PRINT (PEEK(48894)). The result should be 35. Now type POKE 48894,40
to set INIT up for 40 track formatting.

2.	Now put a blank disk in the drive and format it with INIT HELLO.
Listen carefully, and you should hear the stepper motor move the head over
40 tracks. Repeat this operation for all the disks you want formatted.

3.	Boot the CP/M operating system, and create a system disk with no
data on it. Set it up to autoboot a program, say "BIOSMOD", and then use
the Apple copy command COPY A:=A:, using the blank system disk as the source
and your formatted disks as destinations. Repeat this operation for all
the disks you have formatted.

4.	Assemble the following program, and copy the executable version
to each of the disks as the autobooting program. When the disks are booted
they will set drive a: to 40 track operation, and you will have 145k bytes
of storage space, instead of 126k. Much better!

================================================================================

	The only modification to CP/M that is required is to alter the drive
characteristics contained in the BDOS. These characteristics are held in
the Disk Parameter Block, whose initial address can be found by BDOS function
31, which, if executed, returns the DPB address in the HL registers.In my 60K 
Softcard II CP/M the address is FA73 hex for drive A: .
	Offset five bytes from this are two bytes called the DSM parameter.
These bytes, stored with the low order byte first, give the block number
of the highest block on the disk. In the case of Apple CP/M, there are four
blocks per track, thus for a 35 track drive the highest block number will
be 139 (as the blocks are numbered from zero). We actually have 40 tracks,
so we wish to store 9F hex in this parameter.
	The easy way to do this is to execute the following program. It
will find the DPB for the current default drive, and automatically alter
it's value. The easy way to ensure the disk change is to autorun this 
program on disk boot.


;Modify the DPB to set the current default drive to 40 tracks.
;Written in 8080 assembler for the DR assm assembler.
;
	ORG	0100H 	;Start of Transient Program Area.
;
START:	MVI	C,01FH	;Prepare to call BDOS function 31.
	CALL	5	;Execute the function.
	LXI	D,05H	;Load the parameter offset.
	DAD	D	;Add the offset to the DPB address.
	MVI	B,09FH	;Load the new parameter value.
	MOV	M,B	;Update the DPB.
	RET		;Return to CP/M.
;

================================================================================
	                                      
	If you have more than one drive, modify the program to repeat itself
via offsets to modify the DPBs for each drive.
	
	Please note that I am currently working on some better bits to cover
the kludge. These will include a good sector editor, formatter and copy
program ,in that order. I also have here a SYSGEN program that will allow
you to modify the system tracks, thus avoiding the autobooting program step.
If you want to be on a distribution list for these sources, or get a copy
of the SYSGEN, or offer any comments, please send mail to me.
	This information was compiled with the help of some reference texts
and several net persons (they know who they are - let me thank them ). A
good reference text is:

		"Mastering CP/M", by Alan R Miller, pub: SYBEX Inc, 1983


	
                                                                 

						Phil Dimond,
			
		...decvax!decwrl!dec-rhea!dec-aussie!dimond

"When all else fails take the engineering approach: Hit it with a hammer."