Can a serial device control the Vic-20?

Modding and Technical Issues

Moderator: Moderators

Post Reply
dano
Vic 20 Dabbler
Posts: 72
Joined: Wed Dec 17, 2008 9:56 pm

Can a serial device control the Vic-20?

Post by dano »

I suppose the question isn't 100% clear from the subject. I'm wondering if a device on the Vic's serial bus can somehow force the Vic to load data into it's memory and execute that code. Something along the lines of the way a ROM cartridge is detected and run. Is there such a thing as an IEC command or an IRQ signal that a device can send to tell the VIC "hey, load data from me". Of course I'm assuming no Kernal hacks or programs loaded by the user.
ravenxau
Vic 20 Devotee
Posts: 296
Joined: Fri May 28, 2004 10:03 pm

Post by ravenxau »

I don't think this would be possible without some form of custom software... your question seems to imply that commodore produced a specific piece of hardware for this task......although the concept is an intriguing one :)
Android Tablet running Frodo 64 emulator running VIC 20 emulator....
brain
Vic 20 Nerd
Posts: 539
Joined: Sun Jul 04, 2004 10:12 pm

Post by brain »

Sadly, the IEC bus cannot force the machine to load something.
User avatar
Mike
Herr VC
Posts: 4871
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Can a serial device control the Vic-20?

Post by Mike »

dano wrote:I'm wondering if a device on the Vic's serial bus can somehow force the Vic to load data into it's memory and execute that code.
First of all, the units connected over the serial bus are not equal. One of them is bus master, telling the other devices whether they should send or receive data. These commands are sent with the ATN line asserted. In the normal cause of actions, the computer is the bus master, and the only one to actively change the ATN signal. If a peripheral doesn't react to commands sent to it with ATN asserted within a short time, this triggers a '?DEVICE NOT PRESENT' error.

The computer being bus master does not necessarily imply it is always at one end of a data transmission. I know of programs which can instruct two floppy drives to copy data between them, without using the computer as buffer, copying a whole disk this way.
Something along the lines of the way a ROM cartridge is detected and run.
The cartridge does not play an active part here. It presents a small signature at a certain address, which is checked for during the reset sequence of the VIC-20. If that signature is found, four other bytes contain pointers to alternative routines contained in the cartridge ROM, which are to execute upon reset, or pressing the RESTORE key.
Is there such a thing as an IEC command or an IRQ signal that a device can send to tell the VIC "hey, load data from me". Of course I'm assuming no Kernal hacks or programs loaded by the user.
That is however the only way you can realise such an autobooting procedure. The C128 for example, always loads the first block from the first floppy drive with the lowest device number it can find to $0B00 and checks for a signature string. If that string is found, the reset sequence jumps to $0B00, executing the code there.

A similar procedure could be retrofitted to a cartridge, making the start-up sequence more flexible. Later revisions of Mega-Cart implement something along those lines.

Greetings,

Michael
dano
Vic 20 Dabbler
Posts: 72
Joined: Wed Dec 17, 2008 9:56 pm

Post by dano »

Sounds like there is no way for a device to get the attention of the Vic without special code on the Vic looking for such a signal. BTW, yes, I am implying that Commodore made a specific piece of hardware for this, specifically the 1540 which will load and run a USR file at power-on. I'm thinking of trying to make a special USR file to take advantage of this feature but I don't quite know how Commodore would have thought this feature useful at the time... other than to maybe look for a DOS upgrade to replace the drive's ROM code with code from a floppy. As far as I can tell the code that loads and runs on the 1540 can only change how the 1540 operates and can't affect any other devices on the bus, right? I realise that a ROM cartridge detection is totally unrelated but I was hoping maybe the Vic did something similar, for example see if the ATN is asserted at power up and if so let another device become bus master. So Mike, what are the later versions of the Mega-cart doing at start-up? Mine are too old I'm afraid :(

PS I believe the 8k ram cart causes the Vic's serial data and clock to be held low at power-on. Does having a ram expansion affect the startup sequence in any other way?
User avatar
Mike
Herr VC
Posts: 4871
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

[...] look for a DOS upgrade to replace the drive's ROM code with code from a floppy.
Or, rather, patch some DOS routines. The 1540 has only 2K RAM built-in. Not enough to replace the entire DOS, which is 16K in size.
As far as I can tell the code that loads and runs on the 1540 can only change how the 1540 operates and can't affect any other devices on the bus, right?
At least not in the sense to make them execute code 'injected' from the drive. However, the autobooting USR file might contain the drive code for a speeder.
dano wrote:what are the later versions of the Mega-cart doing at start-up?
The service menu allows to switch between 'internal boot' (default) and 'external boot':
www.mega-cart.com wrote:... by using the External boot, the Mega-Cart will search a program called "MC-BOOT" from drive #8 to drive #15 and if detected, loads and run it otherwise it uses the integrated Menu navigation.

The external boot program "MC-BOOT" must be a program for VIC+8K or plus that starts with RUN, it will be loaded by activating SJLOAD on RAM0 area (3K RAM expansion) that could be used by the program itself too.
dano
Vic 20 Dabbler
Posts: 72
Joined: Wed Dec 17, 2008 9:56 pm

Post by dano »

Thanks for all the info, that's interesting about the mega cart. One last question, what does the /SRQ line do on the Vic? Looks like it enables fast serial on the 128, but I assume the hardware was connected to something in the VIC-20's day.
Post Reply