Re: [cc65] raw disk access (was: cr/lf translation?)

Date view Thread view Subject view

From: Greg King (gngking_at_erols.com)
Date: 2002-07-25 14:00:42


-----Original Message-----
From: MagerValp <MagerValp_at_cling.gu.se>
Date: Saturday, July 13, 2002 09:47 AM
>
> OK, the problem appears to be that the data written gets shifted by one byte.
> 18,00 starts with 00 21 01 41.  A "B-P 2 0" fixxed that problem.  I though
> that B-P wasn't necessary for U1/U2?  At least, that's what the 1541 and 1581
> user-guides claim.

There are two separate operations:
(1) data-transfer between the drive's buffer and your computer;
(2) data-transfer between the drive's buffer and a disk.

Neither operation knows much about the other one.  The first one doesn't know
which DOS-command you plan to use for the second operation.  It always assumes
that you are using "random-files" (RELative-files and User-commands were added
to the DOS at a later time).  Therefore, the first byte (in the buffer) is a
length-byte; the computer-transfer starts at the second position.  That is why
you must have "B-P 2 0" when you are going to employ the DOS's User-commands.

(Earlier, MagerValp asked a question about the closing of files.)

If you use the Block-Allocate/-Free commands, then you MUST open a buffer-file
some time before, and close it some time after, you use those "Block-" commands.
Ignore what the books say; none of the authors understood those commands!  The
commands don't have bugs -- as long as you remember to open and close that file.

The wisest policy is to close what you open (even though the other block/sector
commands don't require it).  (But, you don't need to do it, repeatedly, in the
middle of a loop.  Open a file before the loop, and close it after the loop.)

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-07-25 21:11:39 CEST