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

Date view Thread view Subject view

From: cbmnut_at_hushmail.com
Date: 2002-07-12 19:46:13


Hi all,
block access is quite easy, you could do it yourself in some 30 minutes.
Go to http://project64.c64.org/index.htm and get the 1541 users manual.
Look at the chapter on disk access.
--------
6.9 USER1 and USER2

The USER commands are generally designed to work with machine language
(see chapter 8 for more on this).  The USER1 and USER2 commands are
special versions of the BLOCK-READ and BLOCK-WRITE commands, but...
with an important difference: the way USER1 and USER2 work with the
buffer-pointer.

The BLOCK-READ command reads up to 256 characters, but stops reading
when the buffer-pointer stored with the block says that block is
finished.  The USER1 command performs the BLOCK-READ operation, but
first forces the pointer to 255 in order to read the entire block of
data from the disk.

FORMAT FOR USER1 COMMAND

   PRINT#file#, "U1:" channel; drive; track; block

or

   PRINT#file#, "UA:" channel; drive; track; block

There is no difference between the U1 and UA designations for this
command.

The BLOCK-WRITE command writes the contents of the buffer to the block
on the disk along with the value of the buffer-pointer.  The USER2
command writes the buffer without disturbing the buffer-pointer value
already stored on that block of the diskette.  This is useful when a
block is to be read in with BLOCK-READ, updated through the BUFFER-
POINTER and PRINT# statements, and then written back to the diskette
with USER2.

FORMAT FOR USER2 COMMAND:

   PRINT#file#, "U2:" channel; drive; track; block

or

   PRINT#file#, "UB:" channel; drive; track; block

For a more complex sample program, see Appendix C.


-----------------------
Only one problem, how to access the disk drive from C?  There are the assembly
functions already present.  Try cbm_open(2, 8, CBM_READ, "data,s");
Look at include/cbm.h.

Communicate in total privacy.
Get your free encrypted email at https://www.hushmail.com/?l=2

Looking for a good deal on a domain name? http://www.hush.com/partners/offers.cgi?id=domainpeople

----------------------------------------------------------------------
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-12 19:46:26 CEST