4

The USR filetype on the Commodore VC 1541 disk drive is a less common sequential file that according to some book sources can be executed as a program directly on the drive. The drive has its own 6502 processor and 2K of RAM. While there exist a high number of program examples and demos for the C64, I could not find a single listing of a USR program. Would it theoretically be possible to provide a number of disk-executed commands as USR files, that for example to reverse a file on disk, compress a file, etc.?

The 2K RAM with even less available is meagre, but could a program theoretically use disk space as external memory? Running locally at the drive a program could benefit from the native floppy speed, avoiding the serial protocol bottleneck.

I know of C64 programs using a VC 1541 as a co-processor for fractal or 3D computations. I'm also aware of the programs that play music using the stepper motor, but as far as I remember those programs copied the code from the C64 over the serial program into the floppy memory.

I would be interested, however, in the USR programs. Does there exist a list of meaningful USR programs or a tutorial on how to program them?

2

It seams as if the question mixes up the user-commands (Un) provided by DOS for loadable routines with the USR file type.

The USR file type has operations of it's own that can be performed thereon. For all purpose it's simply a sequential file. The only use of USR is to mark files that are not of any of the standard types.

The user-commands are blank (*1) entry points that can be used to hook and call programms loaded into the DOS RAM - for example by Memory-Write (M-W).

| improve this answer | |
  • 1
    What caught my attention was this line in VC 1541 Wiki article: "A user-specified file has an internal structure that is identical to that of a sequential file. Commodore's original purpose for this file type was the facilitation of DOS development, as the file content could be copied into a drive buffer for execution by the drive's microprocessor. Very few programs ever made use of this file type.", especially the part on "copied into a drive buffer for execution by the drive's microprocessor". But I'm getting more and more the impression that this feature was never implemented or used. – Peter B. Oct 3 at 20:25
  • Or, as so often with various wikis, just the imagination of its writer. People often find connections where there are none. – Raffzahn Oct 4 at 11:02
3

I'm not sure about USR programs; but I think you can issue a Block-Execute (B-E) command to the 1541 with a Track/Sector to load and execute a program directly from disk.

I have a copy of Inside Commodore DOS on my shelf, and it dedicates chapters 5 and 6 to direct access programming of the 1541, although the example are done from BASIC - they might prove insightful.

It also vaguely mentions USR files with this cryptic text:

A user file may have the structure of either a sequential file or a program file if it was created by the DOS. It may be structured entirely differently if it was created using direct-access techniques described in Chapter 5.

But I didn't see anything jump out at me about creating a USR file and loading/executing it directly on the 1541. I also trolled through a few other books (PDF's) I have on programming for DOS and they have even less to say on the matter.

To engage in wild speculation: Maybe you can author your ML to disk as a USR file, then use the Block-Execute to load/execute the file - and from there let the code running on the 1541 continue to use Block-Read/Memory-Execute to chain further logic that didn't initially fit into memory?

| improve this answer | |
1

The only use I've see for USR commands is an anti-piracy system. The program downloaded sets a delay when writing a particular track. If that track is read normally, the red light starts flashing because it is corrupted. If this USR command is used, it reads normally. So if someone pirated a disk, on startup, after the program downloads the USR command, it can't read the disk.

It is quite easy to break the security to see what it is trying to do. The only problem is you need to get a memory map of the 1541 ROM. It can be dumped out - takes a while to work out what it is doing.

There is some code and memory map in the 1570/71 manual if you're looking for things to do with it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.