|
Post by C128Man on Jun 6, 2015 15:34:18 GMT
Hi,
I programming with VICE (version 2.4.9). I'm trying to make relatives files in basic. I'm using a C128 (80col) emulation with a 1571 drive and a D71 disk image. I've got a little problem with the length of a file.
I'm trying a file with records of 60 bytes length. I can have only 3048 records, with a file of 102 record length, it's only 1792 records.
60*3048=182880 bytes 102*1792=182784 bytes
Is this a VICE problem? Or is it impossible to have a file bigger then 180K?
In the 1571 manual, Commodore says that the limits are: - 65535 record per file. - 254 byte for a record. - 1 relative file and 1 sequential file open in the same time. - The disk limit.
Here is the code to create the relative file:
10 fast 20 dopen #1,"fichier",l60 30 record #1,3000 40 print#1,chr$(255) 50 dclose #1 60 end Ben
|
|
|
Post by hydrophilic on Jun 6, 2015 22:47:05 GMT
On 1540/1541/1571 (presumably 1551), 180K is the approximate maximum limit. This is because in these disk formats, REL files can have a max of 6 index blocks (so-called "side-sectors"). Each side-sector can store 120 track/sector links. So maximum links = 6 * 120 = 720. If each link refers to maximum-sized (254 byte) record, this means 182,880 max data bytes (178.6K)
Max data size is not the same as max file size! The maximum REL file blocks is 6 (side sectors) + 720 (data) = 726 blocks. The file size in that case would be 726 blocks / 4 blocks_per_K = 181.5K
On the 1581, and I think also the CMD-FD and -HD, a slightly modified REL format is used... it includes "super side sector(s)". This allows more than 720 blocks to be indexed. I don't think there is a limit to this format (except for maximum blocks on the disk)... the biggest limit in this case is the "select record" command uses a 2-byte value, so max 65535 records (record 0 does not exist).
[Edit] OK, I'm bored so here is quick basic program to calculate maximum records (and data size) based on record size. Download it: record limit (136 B) 10 input"record size";rs 20 if rs<2 then stop 30 rb=254/rs 40 mr=int(rb*720+1/256) 50 print mr "maximum records" 60 print mr*rs/1024 "k data size"
In line 40, you may notice the curious value +1/256 ... this is just a fudge factor to compensate for floating-point rounding errors exposed by the INT function.
|
|
|
Post by C128Man on Jun 7, 2015 14:52:49 GMT
A 180k file isn't much at all, even in 1985 . The C128 is not really a management machine EDIT: I tried with a PET 8032 with 8050 disk drive. It's exactly the same limitation. However, Pet is really a professional machine!
|
|
|
Post by hydrophilic on Jun 8, 2015 2:35:26 GMT
The 720 index block limit was not an issue with 1541 (only 664 free blocks, max). It became an issue with 1571.
I never tried 8050 / 8250 drives... considering you can have a disk over 1MB, I am really surprised they have the same limit. Thanks for schooling me!
For serious work, use 1581 or CMD device... only limit is free disk space... and those drives have enough RAM that you can have multiple SEQ files open in addition to REL. Heck, you might be able to open 2 or more REL files at once (I never tried).
[Edit] Just tried 1581 with VICE and you can open 2 REL files at the same time and read from them. I did not test writing with 2 REL files open, but it should work.
Below is updated BASIC program which will tell you # blocks needed on 1581 / CMD disk, given record size and # records. Download here: rel1581 size (314 B)
10 input"record size";rs 20 if rs<2 or rs>254 then stop 30 input"#records";nr 40 if nr<1 or nr>65535 then stop 50 db=int((nr*rs+253)/254) :rem #data blocks 60 sb=int((db+119)/120): rem #side-sector blocks 70 tb=1+db+sb: rem +1 for super side sector 80 print tb "blocks (" db "data," sb "index )" 90 if tb>4095 then print tb/4096"mb": else print tb/4"kb"
[/Edit]
|
|
|
Post by C128Man on Jun 8, 2015 7:05:18 GMT
Yes, it's a issue with 1571. And the documentation is not clear about that limitation.
Just like you, I was surprised that the limit exist with PET/8050. I was a real handicap for serious work.
Ok, I'll try with 1581 in VICE
Thanks for your code! :-)
|
|