Skip to main content

Hello community!

Hello everyone. C=64 guy here.

I was looking for ways to integrate digital joystick to PC for using with VICE. While copying PPjoy URLs to my C64 folder on PC, I found and old link pointing to retrogamecoders. And here has a community forum. So why not join...

A quick question, I can ask it seperately though.

For C=64 BASIC V2 and DOS 2.6 on VICE. I have a simple BASIC code to read error info of diskette device. Open a handle (15) to command channel (15) of device (8-11). Read 4 parameters (INPUT#15), display them. If the device, (8-11) in question is attached and powered up, works like a charm. But when the device is not attached and not powered up (in means of the emulator: None), BASIC hangs, not responding to anything but reset. It is obvious that's because "read from device" (INPUT#) instruction but I couldn't understand why it just does not throw "DEVICE NOT PRESENT" just like when using "write to -a not attached- device" (PRINT#) ?
So, is there a non-destructive command (that won't alter current error status) to send either check if the device is attached, or let BASIC to throw "DEVICE NOT PRESENT" error?

Hello community!

Matt Armstrong

Sorry can't help you there. I was on the other side of the fence, I owned a ZX Spectrum..

C64Whiz

So I tested this under Vice 3.3. I setup a drive 8 and 9, and testing both came back with valid data. When I attempted device 10, it "hung", but I was able to RUN/STOP-RESTORE to get the cursor back...I didn't have to reset the emulator. I performed this test on a Ultimate 64 as well with same results...valid output for connected drives, RUN/STOP-RESTORE to get back from "hung" on non-existent drives.

However, the "hanging" should be preventable by investigating the ST variable after opening the channel. In the "Complete Guide to the 1541 Disk Drive" (https://archive.org/details/1541_Users_Guide_1984_Datamost), page 232-233, it shows a 6510 assembly language checking the ST variable after attempting to open the channel in order to see if the device is not present (ST=-128). However, when I modify the BASICv2 program:

35 IF ST <>0 THEN PRINT "NOPE":END

it still "hangs" with ST=0. (Same results on the Ultimate.) I'm not sure why...

However, there IS a work-around: CLOSE the channel immediately after opening it:

OPEN15,8,15
CLOSE 15
IF ST = -128 THEN PRINT "DEVICE NOT PRESENT":END

This worked for me both in VICE and on the Ultimate 64. Just remember you'll need to re-open prior to your INPUT#.

HTH

--C64Whiz

P.S. Here is a link to a demo program in the RGC emulator. (I'm new here too...had to check this out! 😆 )

Chris Garrett

C64Whiz Nice! I am working on a .D64 editor for the IDE too :) I found some python modules that seem to work so it will be a wrapper around those, failing that I will use the vice tools on the server