• Please review our updated Terms and Rules here

Accessing two 1541 drives

One-liner, you could save as a BASIC program by giving it a line number...

OPEN 15,8,15:pRINT#15,"M-W";CHR$(119);CHR$(0);CHR$(2);CHR$(41)+CHR$(73):CLOSE 15
 
It could be much shorter by eliminating the PRINT# and all the CHR$s. Also, semicolons and plusses are never needed like that.
 
KC9UDX,

is this your version? => OPEN 15,8,15:"M-W"CHR$(119)CHR$(0)CHR$(2)CHR$(41)CHR$(73):CLOSE15

Thanks

oP1,8,15,"M-W:w<Ctrl-@><Ctrl-B>)I":clO1

Shortening lines in Commodore BASIC is an art form. So is saving keystrokes.

M-W: is the CBM DOS command for Memory Write. The rest specifies the address of the device number flag and data to change it. Frankly my memory is bad else I could explain each character.
 
Ok so ultimately you're explaining programmer short hand; I'm ok with it. I'm a SQL guy, but I always leave application programming to the qualified - ;-). I'll try it soon.
 
Abbreviating reserved words saves keystrokes. PRINT can be abbreviated ? as most people know, and PRINT# can be abbreviated pR.

But using quoted characters rather than CHR$(), and eliminating unnecessary characters saves memory and makes execution faster. It's very good practise. It is certainly appropriate to use CHR$() for readability, or especially posting in a forum here, where understanding is more important than speed or memory.
 
I'm a bit out of practise. Using Ctrl-@ in quotes may not work. In fact, it shouldn't; because it should at least terminate the string, or more likely terminate the entire line.

In that case, in a program, if you're going to use it more than once, assign it to a variable at the beginning of the program.

C0$=CHR$(0)
"My string with"C0$" CHR$(0) "C0$"in it, twice"
 
Last edited:
Also, I must say, unless you get an updated ROM in your 1541, it's imperative that you always specify the drive number in your commands.

To format a disk, don't use N: but rather use N0: specifying drive zero.

A 1541 only has drive zero, it has no drive one. But there's a bug in the ROM, which was originally written for dual-drive units, that will corrupt your disks. It's called the SAVE @ REPLACE BUG. As far as anyone knows it only occurs when you use @ to save with replace. So if you never do that, it shouldn't matter. But, it's best to be safe, and make a habit of it.
 
Ok got another C64 ?. I started this thread to figure out how to archive some of my C64 diskettes before they bite the bullet. Now I found Fast Hack'em (three versions FREE). One is in *.prg format and two others are in zip format. So hence my ?. Once I unzip these two pgms. how do I port them to the Commodore since its format can't be read by MS-DOS format vice versa? For grins I thought I'd try it and nope, the general failure error on MS-DOS.

Thanks
 
In my experience, the simplest, most reliable way, is to connect a 1541 to your PC.

Since I do this with an Amiga, I won't even speculate how it's done on a PC, but I'm sure it can be.

One of these days I want to write something that does what ADT does (only better; and I want to do that for the Apple, too).
 
I'll check it out (again). Wittwage mentioned this but I got side tracked and forgot to get back to it, so I'll look RIGHT now. That'll be great if I can archive my C64 disks. Granted I don't have many since I'm a C64 newbie, but we all know how 30+ year old floppies can go any time!!! ;-)
 
Back
Top