Classic Computer Magazine Archive COMPUTE! ISSUE 79 / DECEMBER 1986 / PAGE 10

Readers’ Feedback

If you have any questions, comments, or suggestions you would like to see addressed in this column, write to "Readers' Feedback," COMPUTE!, P.O. Box 5406, Greensboro, NC 27403. Due to the volume of mail we receive, we regret that we cannot provide personal answers to technical questions.

Quiet 1541 Formatting

This is in response to Tom Smith's question about formatting a 1541 disk without knocking the drive head (see "Readers' Feedback," September 1986). I have written a short program that prevents the head from rattling when you format a disk. As suggested in your response, the program asks you to insert a commercially formatted disk /or calibration and uses that disk to locate the read/write head at the correct spot for formatting. Then it prompts you to insert the disk to be formatted.

10.PRINT"INSERT REFERENCE DISK"

20 GOSUB270

30 OPEN 1,8,15,"I0"

40 OPEN 2,8,2,"#"

50 PRINT#1, "U1";2;0;1;0

60 INPUT#1,N,MS,T,S:PRINT N,M$,T,S

70 IF N=0 THEN130

80 PRINT N, MS; T; S

90 PRINT "TRY AGAIN (Y/N)?"

100 GOSUB280

110 GET FS: IF F$="Y" THEN 50

120 CLOSE 2: CLOSE 1:END

130 PRINT"REMOVE REFERENCE (SPACE) DISK"

140 PRINT"INSERT BLANK DISK”I

150 GOSUB270

160 FOR I=1 TO 25

170 READ D:D$=D$+CHR$(D)

180 NEXT

190 PRINT#1,"M-W";CHR$(0);C HR$(5);CHR$ (25);D$

200 PRINT#1,"M-W";CHR$(32); CHRS(6);CHR$ (3);CHR$ (10);CHR$ (64);CHR$ (15)

210 POKE 198,0

220 INPUT"ENTER DISK NAME"; DNAM$

230 INPUT"{13 SPACES}ID";DID$

240 PRINT"FORMATTING ..."

250 PRINT#l,"U3:";DNAM$","DID$

260 GOTO120

270 PRINT"PRESS ANY KEY TO {SPACE} CONTINUE"

280 PRINT

290 POKE 198,0

300 WAIT 198,1

310 RETURN

320 DATA 169,78,141,0,2,169,48,141,1,2,169,11,141, 42,2 330 DATA 32,238,193,169,1,133,81,76,13,238

The program downloads a very short machine language program to the drive. Here is a brief explanation of the machine language source code. The first four instructions put the characters N0 in place of U3 in the drive's command buffer area at $0200:

LDA #"N"

STA $0200

LDA #"0"

STA $0201

These instructions store the command number 11 (for NEW) in $022A, then execute the ROM command parsing routine at $C1EE.

LDA #11

STA $022A

JSR $C1EE

Finally, the program sets the formatting track number at $51 to 1 and jumps into the ROM format code at $EE0D.

LDA #1

STA $51

JMP $EE0D

- Martin Filteau

Thanks for this elegant solution. As mentioned in the previous answer, this method takes advantage of the fact that commercially produced disks are usually formatted very accurately. It also assumes that your drive is correctly aligned in the first place. If your drive has alignment problems (often signaled by an inability to load commercial software or read disks formatted on other drives), you should not try to use this program. It's also important to use a commercial disk that is not copy-protected. Many copy-protection schemes deliberately create bad disk sectors or rely on a non-standard disk format. Using such a disk for calibration may produce unreliable results. A good choke for the calibration disk is the 1541 Test/Demo disk that comes with the drive. It's a good idea to tape over the write-protect notch on the calibration disk, just in case you become distracted and forget to swap disks before the format begins. This program works on a 1541 drive or 1571 drive being used in 1541 mode. It does not format double sided or CP/M-format disks on a 1571 drive.