[Coco] Re: Disk Basic and 512 byte block floppies.

Theodore Evans (Alex) alxevans at concentric.net
Sun Jan 18 20:59:55 EST 2004


On Jan 18, 2004, at 2:58 PM, John E. Malmberg wrote:

> Robert Gault wrote:
>> tim lindner wrote:
>>> John E. Malmberg <wb8tyw at qsl.net> wrote:
>>>> I formatted a 720K 3.5 inch floppy with 512 byte sectors
>>>
>>> Interesting experiement.
>>>
>>> The size of each sector is written to the disk. Disk BASIC expects 
>>> all
>>> the sectors to be 256 bytes, it doesn't check. It create 256 byte 
>>> blocks
>>> of RAM to read to and from these sectors.
>>>
>>> If the sector is larger, then the RAM buffer will overflow. On a read
>>> sector command you will overwrite whatever is past the sector buffer 
>>> in
>>> RAM. The could be dangerous.
>>>
>>> On a write sector command you will write whatever data is after the
>>> buffer to the larger sector.
>> With Disk Basic, the buffer overflow will go into a second disk I/O 
>> buffer; buffer0 $600-$6FF, buffer1 $700-$7FF. You would corrupt data 
>> stored in the second buffer but in most cases you won't see any ill 
>> effects.
>
> According to the Disk-Basic-Unraveled series, the buffer at $700-$7ff 
> is used for the verify function, and for the DSKINI function.
>
> So with verify off, there should be no danger of data corruption by 
> using the DSKI$ and DSKO$ functions.

I wouldn't use DSKI$ and DSKO$, I would use a call to DSKCON.  
Something like:

10 DC=PEEK(&HC004)*256+PEEK(&HC005) 'DSKCON
20 DO=PEEK(&HC006)*256+PEEK(&HC007) 'DCOPC
30 CLEAR &H6800
40 INPUT "SOURCE DISK",SD
43 INPUT "SECTOR SIZE",SS
47 IF SS=256 THEN SS=1 ELSE IF SS=512 THEN SS=2 ELSE GOTO 43
50 INPUT "DESTINATION DISK",DD
53 INPUT "SECTOR SIZE",DS
57 IF SS=256 THEN DS=1 ELSE IF DS=512 THEN DS=2 ELSE GOTO 45
60 POKE DO+5,0 'LSB OF BUFFER POINTER
60 FOR T=0 TO 34
70 POKE DO,2 'OPERATION CODE READ
80 POKE DO+1,SD 'DRIVE NUMBER SD
90 POKE DO+2,T 'TRACK NUMBER T
90 FOR S=1 TO 18 STEP SS
100 POKE DO+3,S 'SECTOR NUMBER S
110 POKE DO+4,S+103 'MSB OF BUFFER POINTER
120 EXEC DC 'CALL DSKCON
130 NEXT S
140 POKE DO,3 'OPERATION CODE WRITE
150 POKE DO+1,DD 'DRIVE NUMBER DD
160 FOR S=1 TO 18 STEP DS
170 POKE DO+3,S 'SECTOR S
180 POKE DO+4,S+103 'MSB OF SECTOR BUFFER
190 EXEC DC 'CALL DSKCON
200 NEXT S
210 NEXT T
220 END




More information about the Coco mailing list