Monday, December 31, 2012

DZREAD

    The complementary program to DZWRITE, is DZREAD. It reads an RX50 floppy on a PRO and writes it to a file.

  Here it is...

dzread.mac

  Assemble Link and run like DZWRITE. Or, if you're  tight on memory and disk space, you can link it to FCSRES and save a few bytes. DZWRITE can be linked this way as well.

$ MAC DZREAD
$ LINK DZREAD/OPTION
Option? LIBR=FCSRES:RO
Option?

Put floppy in...
$ DISMOUNT DZ2:
$ MOUNT/FOR DZ2:
$ RUN DZREAD
DZR>SOMEFILE.DSK=DZ2:
$

While writing this program, I ran into a crazy P/OS bug. Originally, I wrote it to read the floppy, block by block, and when I got a return status of IE.BLK (logical block too large) , I would know I was at the end and could close the DSK file and exit. When I did that, I got DSK files that were 801 blocks long....not right since the RX50 floppy is only 800 blocks big. A look at the 801st block in the output file revealed that it was a copy of the first block from the floppy. Evidently the DZ driver has an off by  one error in its range checking, and when the DZ controller and floppy drive gets a request for a block too large, it returns the block modulo 800. Even worse, the same thing occurs for writes - if you request the 801st block be written, it writes it to the first block...not good. DZWRITE didn't see that problem since DSK input files are only 800 blocks or less long, so it never tried to write an 801st block. 

  You can see this problem with DUMP. If you mount an RX50 foreign, and

$ DUMP/BL:800

  Which requests the 801st block, since they start at block 0, you'll see the first block dumped out. requesting block 0 and block 799 returns, correctly, the first and last blocks.

  I modded DZREAD to count blocks and stop at 800. Now the output files are the right size, and have all the right blocks in 'em.

No comments:

Post a Comment

Comments?