C64 BASIC line to determine SD2IEC device number

  • Thread starter Thread starter SimonLCFC
  • Start date Start date
  • Replies Replies 30
  • Views Views 6484

SimonLCFC

New member
Joined
Jul 8, 2012
Posts
530
Country
England
Region
Raunds, Northants (not Leicester)
I've written a small menu program for the SD2IEC that can access a series of programs on the root. It works perfectly so far, but one of the functions i've included is to switch the device ID at a keypress - this works fine, and can switch between 8 and 9, but it gives an error message if you try to switch to a device that it's already set as.

I need some basic that can pretty much do the following:

IF (device is 8 ) THEN GOTO (line xxx)
IF (device is 9 ) THEN GOTO (switch device to 8 subroutine)

Anything that can detect the Device ID and give off a variable?

X=DeviceID

So, IF X=8, blah blah, IF X=9, goto blah blah.

Does this make sense?
Can't find anything of use anywhere, and until the last two days, I haven't tried programming ANYTHING in years!

Si
 
I don't know C64 Basic but I would assume that you could set a variable to remember which device was last set and when a key is pressed compare the two.

If they are the same then don't do anything. If they are different then call your subroutine.

Dave G :cool:
 
I don't know C64 Basic but I would assume that you could set a variable to remember which device was last set and when a key is pressed compare the two.

If they are the same then don't do anything. If they are different then call your subroutine.

Dave G :cool:

This is the issue, cos the device number needs to be identified and stored in a variable. I know how to alter/set the device, but the trouble is actually retrieving the info and sticking it into "LET D=xxx"

Trouble is setting a variable to remember the device is invariably lost when a reset is performed (the basic routine ito switch Device and write to Eeprom requires a reset is performed - made sense that way.)

Of course i've discovered this throws up another issue:

If you load, say, "DraCopy" from the menu, then it loads as: LOAD"DC64",8 and autoruns

It won't if the device is set to 9, so that increases the need for a variable to contain the device number. Removing the ,8 from the end, well, that just attempt to load from tape :p
 
So what you're looking for is an address in memory where the deviceid is stored. Peek(that) and then compare the deviceid and keypress.

Alas I can't help you there.

Dave G :cool:
 
So what you're looking for is an address in memory where the deviceid is stored. Peek(that) and then compare the deviceid and keypress.

Alas I can't help you there.

Dave G :cool:

Cheers, that's exactly what i'm looking for.

Unfortutely, I have no idea what the address is lol, but thanks :)
 
I've had a quick google and now understand a bit better what you're talking about.

It's an INPUT# command you need to read the current status which would hopefully give you the current DeviceID. Unfortunately, I haven't found the one that will tell you that.

Dave G :cool:
 
I've had a quick google and now understand a bit better what you're talking about.

It's an INPUT# command you need to read the current status which would hopefully give you the current DeviceID. Unfortunately, I haven't found the one that will tell you that.

Dave G :cool:

It's a pain, yeah. I'm still searching myself - i'm sure the answer is somewhere (perhaps emailing the creator of the device would be a plan.)

Ideally I wanted it finished, was planning on uploading it with the relevant programs at some point - obviously, if it was useful to anybody other than myself :)
 
If you type in "sd2iec read device number" to google this thread is on the first page.

The power of AmiBay and Google together :D

Dave G :cool:
 
If you type in "sd2iec read device number" to google this thread is on the first page.

The power of AmiBay and Google together :D

Dave G :cool:

I noticed that :lol:

Am I the only person to EVER have asked this?

---------- Post added at 21:10 ---------- Previous post was at 19:36 ----------

Cracked it. Scanned through the 64 memory map of the 64, and found that 186 was the address that held the device number.

LET X=PEEK(186)

Gives off either 8 or 9 (8 is normal) so on that premise, I added some bits to my menu program, and it's practically done!

:D

EDIT: 64 doesn't need resetting either. Change is instant, so i'll rewrite to get back to the menu instead of powering off...
 
Hi Simon

would you be willing to share this program when finished

cheers john
 
Hi Simon

would you be willing to share this program when finished

cheers john

Absolutely. I've just wrapped it up, and i'm going to give it a test on a my 64. It's very basic though. Any ideas where I should upload it when i've finished checking it?
 
hi use

http://style64.org/dirmaster

to make a disk image
or prg

and save as a zip and upload it

Ah, I use that too, along with D64 Editor (i'm waiting on a ZoomFloppy, insanely useful programs.)

I've attached a ZIP file with the following contents:

cbmcmd, d64it, dc64, fibr (file manager/browsers and d64 transfer programs)

menu (the main menu program)

*all these programs have had the unneccessary .prg extensions removed.

MENU.P00 (contains the BASIC menu.prg written on VICE.)
Put this in the ZIP in case somebody wants to mess around with the program, add/change anything.

copy the contents (except MENU.P00) to your SD Card.
Once it's on the 64, switch on, type:

LOAD"MENU",8
RUN


The rest is pretty self explanatory - when you chose a one of the four programs, it'll give a short description, and a choice to load, or return to the menu.

You can only switch the SD2IEC device IDE if the device isn't already set (option will be dark blue if it's unselectable.)

That's about it... any questions, ask away - I doubt there will be though, it's pretty basic - a first attempt at programming in years!
 

Attachments

Good to see you got there in the end :thumbsup:

Dave G :cool:
 
Good to see you got there in the end :thumbsup:

Dave G :cool:

Cheers for the pointers too. Was driving me up the wall at one point :lol:

Still, all done, hopefully somebody else will find it useful eh...

Well at least if someone Googles it now they should see this thread :)

Dave G :cool:
 
Very true lol. May have inadvertently drawn more folk to Amibay on a quest to ask really stupid questions :lol:

There's no such thing as a stupid question :D

We learn by asking and listening to the answer :lol:

Dave G :cool:
 
Very true lol. May have inadvertently drawn more folk to Amibay on a quest to ask really stupid questions :lol:

There's no such thing as a stupid question :D

We learn by asking and listening to the answer :lol:

Dave G :cool:

Give it two or three more threads by me in the programming section, you'll change your tune :lol:

(I couldn't even remember how to print at a specific place on screen! Had to google it!)
 
Thankyou I will try tomorrow

Nice work

Sent from my GT-I9100 using Tapatalk 2
 
Back
Top Bottom