CBM 610 (B128) IEC adapter

Started by carlsson, April 13, 2009, 08:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

carlsson

Last week, I came across Ullrich von Bassewitz' adapter for the CBM-II series computer, which lets one attach a 1541 floppy drive to the otheriwse unused cassette port. It requires installing a custom Kernel though.

http://zimmers.net/anonftp/pub/cbm/b/kernal610-new.zip

The interface is very simple; just the two connectors, a few wires and two small (68 and 82 ohm) resistors. I wired up one last Friday and tried. It works very well:


The actual adapter:


Then I soldered on the +5V lead to Jim Brain's uIEC interface and plugged in the cable. Suddenly I have one more Commodore computer working with the uIEC.

Steve Gray and me have discussed the possibility to extract Uz' driver code to a cartridge image, as I have access to a small surplus of B128 cartridges fitted with two socketed 2764 each, for a total of 16K. If we advance with this, I think at least a DOS wedge would be required. To implement JiffyDOS for the B128 however may be a bit too advanced...

As a side note, it was speculated whether this kind of adapter would work with PETs, and of course VIC-20 and C64/128 if you want an additional IEC port. It is just a matter of writing/adapting the driver code. I would suppose someone in time has already done this for the PET? In particular as most PETs have room for utility ROM expansion, it would be very handy to have a driver to let you connect 1541 like drives.

megabit

QuoteThe interface is very simple; just the two connectors, a few wires and two small (68 and 82 ohm) resistors. I wired up one last Friday and tried. It works very well:

Very interesting. Do you have a wiring diagram with the connector pin numbers?

By the way, I like that first picture. It's a good feeling to know I'm not alone in the world. :)

Dan...

Steve Gray

Anders,

I haven't had the chance to build the interface yet, but in the mean time... I assume the new kernal allows IEC only and replaces the IEEE. If we get the code working in a cartridge perhaps we can select which interface to use somehow. I'm thinking we could check for a key (like the C= key) on startup and allow selection of IEC or IEEE.

Are there any commented disassemblies of Jiffy DOS? It shouldn't be too hard to merge JiffyDOS into the B kernal.

On the BASIC 4 machines I've never needed a DOS wedge. Plus the B-series machines already have programmable function keys, so what wedge functions would be useful ?

Steve

megabit

#3
QuoteVery interesting. Do you have a wiring diagram with the connector pin numbers?

Never mind. I should have looked at the kernal610-new.zip file first. The wiring diagram is in the file.

Dan...

carlsson

While I actually didn't try to plug in an IEEE drive into the computer, I believe you're correct. Since Commodore left out tape routines in the first place due to being short of ROM space, it would be a miracle if Uz' could squeeze IEC routines into the same 8K while keeping the IEEE routines in place.

I agree that a cartridge would allow one to enable/disable the adapter support, given that the B-series machines use low 1K pointers much like other Commodore computers to steer various kernel calls to different locations.

Quote from: Steve Gray on April 13, 2009, 10:53 PMwhat wedge functions would be useful ?

When used with a memory card device like the uIEC, the @CD command and others are quite frequently used to switch to a new directory. Without a wedge, you have to OPEN1,8,15,"CD:nnn" all the time. $ to read directory contents can also be useful instead of LOAD"$",8. I'm sure there already exists e.g. a 8250 wedge for the 610/710 machines, just that I haven't looked around. Besides, if the actual IEC routines only are 1-2K and we have at least 8K cartridge space to work with (16K if we feel adventurous), the other space could just as well be used for some goodies like a wedge, possibly SJLOAD compatibility unless a full JiffyDOS implementation can be had.

But yes, it is much easier to chat on a forum than get down to the actual coding... ;-)

Dan: Good luck building the adapter. It was rather straightforward. Right now you'll need an EPROM programmer and replace the Kernel chip to use it. My CBM 610 was already modified for Swedish keyboard so it has adapters from 24-pin ROMs to 28-pin 2764 EPROMs. It made the change of Kernel very simple. If your B128 machine is original, you may find actual ROMs inside that would require an EPROM adapter. If you're really unlucky, the chips may even be soldered so the cartridge solution (not yet realized) would be the only feasible way to complete the task.

megabit

QuoteDan: Good luck building the adapter. It was rather straightforward. Right now you'll need an EPROM programmer and replace the Kernel chip to use it. My CBM 610 was already modified for Swedish keyboard so it has adapters from 24-pin ROMs to 28-pin 2764 EPROMs. It made the change of Kernel very simple. If your B128 machine is original, you may find actual ROMs inside that would require an EPROM adapter. If you're really unlucky, the chips may even be soldered so the cartridge solution (not yet realized) would be the only feasible way to complete the task.

Anders,

I don't have a CBM 610, I use a C128.

I'm curious about how it's connected and I thought I could go through to Kernal code to see how the data is transferred.

I have been looking for a way to connect the two printers I use on my system setup.

I have three drives connected to the serial bus (1541, 1571 and 1581). To operate the printer(s), I have to remove two of the drives because of excessive load on the serial bus.

If I can find a way to use the adapter as an extra serial bus, I can use it for the printers.

Dan...

carlsson

Ah, I see. If I understand correctly, the regular IEC port is handled by CIA 6526 #2, data port A while the cassette port is controlled by the CPU itself with an IRQ flag on CIA #1? That probably would be the difference, to add one or more devices without putting more strain to the CIA chip.

megabit


QuoteThat probably would be the difference, to add one or more devices without putting more strain to the CIA chip.

Yes, that is the idea. But, it will have to wait until winter. It's fishing season now.

Dan...

airship

Quote from: megabit on April 14, 2009, 04:07 AM
I have been looking for a way to connect the two printers I use on my system setup.

I have three drives connected to the serial bus (1541, 1571 and 1581). To operate the printer(s), I have to remove two of the drives because of excessive load on the serial bus.
Interesting. On my C128 setup, I have two 1571s, a 64HDD, a uIEC, and a serial printer. All work just fine, though I admit I seldom (maybe never?) have them all running at the same time. I've got the two 1571s in series, but everything is plugged into a Quadport, including the origin of the 1571 chain. I don't know if that makes a difference; I've always kind of assumed that internally the Quadport is wired in series, though I suppose it could be parallel.
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

airship

Quote from: megabit on May 05, 2009, 09:43 PM
But, it will have to wait until winter. It's fishing season now.
If we could just get Dan to give up fishing, we'd get a lot more work out of him. :)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

megabit

QuoteIf we could just get Dan to give up fishing, we'd get a lot more work out of him.

Now you sound like my wife. :laugh:

Dan...

Steve Gray

Quote from: carlsson on April 13, 2009, 08:44 PM
Last week, I came across Ullrich von Bassewitz' adapter for the CBM-II series computer, which lets one attach a 1541 floppy drive to the otheriwse unused cassette port. It requires installing a custom Kernel though.

http://zimmers.net/anonftp/pub/cbm/b/kernal610-new.zip

The interface is very simple; just the two connectors, a few wires and two small (68 and 82 ohm) resistors. I wired up one last Friday and tried.
Steve Gray and me have discussed the possibility to extract Uz' driver code to a cartridge image, as I have access to a small surplus of B128 cartridges fitted with two socketed 2764 each, for a total of 16K. If we advance with this, I think at least a DOS wedge would be required. To implement JiffyDOS for the B128 however may be a bit too advanced...

As a side note, it was speculated whether this kind of adapter would work with PETs, and of course VIC-20 and C64/128 if you want an additional IEC port. It is just a matter of writing/adapting the driver code. I would suppose someone in time has already done this for the PET? In particular as most PETs have room for utility ROM expansion, it would be very handy to have a driver to let you connect 1541 like drives.

Well, I finally got my new eprom programmer and have burned my first eprom; the new IEC kernal. I guess it's time to build the cassette interface and give it a try. Then, we'll see about working on a cartridge version that can toggle between IEC and IEEE. I think I'll put aside jiffydos until I get at least that working.

Steve

carlsson

Yay! I had forgotten about that, although admittingly it isn't on the top of my priority list. On the mailing list, Uz mentioned the IEC routines came from the Protext cartridge, whether that was a CBM-II product or some other Commodore computer. There is a cartridge called ProfiText mapping in at $2000. It might be worth disassembling to see if the same routines exist in that binary, and perhaps even easier to extract from.

http://zimmers.net/anonftp/pub/cbm/firmware/computers/b/index.html

Steve Gray

Quote from: carlsson on May 22, 2009, 09:35 PM
Yay! I had forgotten about that, although admittingly it isn't on the top of my priority list. On the mailing list, Uz mentioned the IEC routines came from the Protext cartridge, whether that was a CBM-II product or some other Commodore computer. There is a cartridge called ProfiText mapping in at $2000. It might be worth disassembling to see if the same routines exist in that binary, and perhaps even easier to extract from.

http://zimmers.net/anonftp/pub/cbm/firmware/computers/b/index.html

Well, I plugged the ROM in and it boots, so that's a start. However, my monitor is not displaying the screen properly. I think the new kernal ROM is for PAL... I need NTSC. Anyway, not a big problem. Cable is still not built but I decided to take a look at the source, and I'm a little lost as it's all in German ;-) . So I got looking around UZ's site and I see a monitor ROM called "moni610" which resides at $2000 and ALSO includes the IEC routines! Great! So off to burn it and try it out.... oh oh, no more blank eproms... this could be what we're looking for but unfortunately I can't try it until I get a new supply of chips...  care to take a look Anders?

ftp://ftp.musoftware.de/pub/uz/cbm610/moni610.zip

Steve


carlsson

Nice find! The Moni610 package exists on Zimmers too, I just didn't register it would run as a cartridge. I'll have a look later, whether it will be today or in a week.

carlsson

I dumped the EPROMs on two demo cartridges. From a brief look, they look quite the same. If anyone wants to have a look, grab 'em here: http://www.cbm.sfks.se/files/cbm610-carts.zip

I read in the CBM 500/600/700 User's Guide (which I've planned to scan, unless anyone has done that before) that the cartridge port pinout is the following:

Pin Type | Pin Type
1   A0  |  A  BD0
2   A1  |  B  BD1
3   A2  |  C  BD2
4   A3  |  D  BD3
5   A4  |  E  BD4
6   A5  |  F  BD5
7   A6  |  H  BD6
8   A7  |  J  BD7
9   A8  |  K  GND
10   A9  |  L  GND
11   A10 |  M  SR/W
12   A11 |  N  S02
13   A12 |  P  NOT CSBANK1
14   +5V |  R  NOT CSBANK2
15   +5V |  S  NOT CSBANK3


This pinout is by the way pretty identical to the CBM 500, only that pins P-S are not marked with NOT signs.

Anyway I burned an EPROM of the Moni610. Through trial and error I have managed to map it to $4000 just like the source code suggests and at least start the monitor. However it seems the IEC routines need to be stored into another 8K EPROM mapped to $6000. The source code includes those routines, so it is just a matter of re-assembling it to generate a 16K binary split onto two 2764 chips. I'll try that some other day. Once that works, we can consider whether to leave it as it is or perhaps put something even better than an advanced machine code monitor into the first 8K.

However I don't yet know how to enable the IEC routines, if those are included in that 8K binary that is.

Steve Gray

Anders,

I looked at the code again. In the "moni.src" file there is an include for the serial routines ("serbus.inc") at the end of the file. In the "InitMon" routine is a call to "SerBusInit" and in that a call to "SerBusVecInit". I assume that once you get into the monitor the serial routines will work. Did you try?

Some simple changes will be to autostart the cartridge and put a small jump table at the beginning to switch from IEC to IEEE by changing the vectors.

I ordered some more EPROMs this morning so when they arrive I will give it a try. I guess i should get to work building the interface cable! ;-)

Steve

carlsson

Actually I was wrong last night. The IEC routines already are included in the 8K binary. The reference to $6000 says where the ROM image should end, i.e. fill up to 8192 bytes.

The reason why I didn't get much action was because I tried with my uIEC which is set to device 9. There is a command UNIT in the machine code monitor. It takes a two digit decimal number, i.e. "UNIT 09" to switch the device number.

I can now read directories and hopefully load files from the IEC unit inside the monitor. However upon exit, the routines are disabled. I'll try later to put together a subset of the routines which at least allows one to SYS the IEC routines into place and back. Autostart might be nice, but so far I haven't seen any B-series cartridge implementing autostart. I read yesterday briefly what it takes to get it to work, so I suppose it is technically possible...

Steve Gray

#18
Quote from: carlsson on May 26, 2009, 05:25 AM
Actually I was wrong last night. The IEC routines already are included in the 8K binary. The reference to $6000 says where the ROM image should end, i.e. fill up to 8192 bytes.

The reason why I didn't get much action was because I tried with my uIEC which is set to device 9. There is a command UNIT in the machine code monitor. It takes a two digit decimal number, i.e. "UNIT 09" to switch the device number.

I can now read directories and hopefully load files from the IEC unit inside the monitor. However upon exit, the routines are disabled. I'll try later to put together a subset of the routines which at least allows one to SYS the IEC routines into place and back. Autostart might be nice, but so far I haven't seen any B-series cartridge implementing autostart. I read yesterday briefly what it takes to get it to work, so I suppose it is technically possible...

It appears that the monitor "exit" command does a call to the 'warm-start' vector, which reset the vectors back to normal. You could remove the call easily, or just put an easy jmp to "SerBusVecInit", or add "IEEE" and "IEC" commands to the monitor to select which to use. To autostart a cartridge you need the "CBMx" string at the start of the cartridge, where 'x' is the first digit of the cartridge start address (in this case '4').

[EDIT:] If you remove the '.RES' command in the source you'll see that the monitor and the IEC routines only take about 4K so there's lots of room for additions before filling up an 8k rom.

I hope my EPROMS arrive soon!...

Steve

carlsson

I wonder if there is any way to use the emulator for development purposes. While it won't have the hardware support for an IEC unit, we know that code already works so it is more a matter that the computer won't crash in the middle of operation. Otherwise it will be quite cumbersome to program and erase EPROMs all the time, even if one has a cache of 5-10 chips to recyle.

Steve Gray

Quote from: carlsson on May 26, 2009, 08:56 AM
I wonder if there is any way to use the emulator for development purposes. While it won't have the hardware support for an IEC unit, we know that code already works so it is more a matter that the computer won't crash in the middle of operation. Otherwise it will be quite cumbersome to program and erase EPROMs all the time, even if one has a cache of 5-10 chips to recyle.

Perhaps one of the cartridges can be modified to have RAM installed?.... battery backed would be even better ;-)

Steve

carlsson

Even with a battery-backed RAM expansion, wouldn't it be kind of a chicken and egg problem? I have the following accessories:

* 2031 drive which is read compatible with a 1541 + XM1541 cable to write such floppy disks

* C2N232I which currently won't work with the B-series due to their lack of tape routines

* uIEC/SD which of course I'll connect to the IEC port once the drivers are installed

I haven't considered cbmlink/prlink, which might be the best solution in a development process given that it works on the B-series?

Anyway I read somewhere that machine code programs are best run in bank 15, due to the Kernel is accessible only in that bank. However I think the amount of system RAM in bank 15 is very low so therefore your suggestion about a memory expansion might come handy.

Alternatively the routines might be possible to rewrite to execute in another bank and then switch before every possible Kernel call. It would allow anyone to load the IEC program from e.g. an IEEE floppy drive.

Brian Lyons has made a couple of custom VIC-20 cartridges which contain a static/non-volatile 8K RAM chip. According to the manufacturer those chips should hold their content for 100 years or so. The good part is of course they're writable. My original idea of use would be to store highscore data from a game on the cartridge, but I realize the same kind of chip could have development purposes too, e.g. the kind of RAM chip you just described. The chicken and egg would still be there, just that once programmed the egg stays in place.

Steve Gray

#22
I was thinking of the RAM cartridge for development. It would make testing code much easier without needing to burn an EPROM all the time. I know there existed an internal 24K ram expansion board for the B-series that goes in BANK 15, but I haven't been able to find one. I know one guy with a 1MB expansion board but I think that expands the OTHER banks. If we could get RAM in bank 15 where the cartridge normally resides we could develop easily then when it's finished we burn an eprom.

I use CBMLink and a B128 to make D80/D81 images of my B-series and SuperPET disks in conjunction with my CBMXfer program.

Yes, there is minimal RAM in BANK 15 and coding is easier in BANK 15. There are special 'transfer routines' that can be used to access the kernal from any bank. They are located in ROM at $FE9D. Jim Butterfield wrote a nice article in transactor (July'83, Page 60) on how it works. Theoretically this should work for the IEC routines. However, I think one of the reasons for having IEC routines is for those who don't have an IEEE drive, since they are harder to get these days. Therefore, a ROM solution is best.

Enough typing... I'm off to build a cable ;-)

EDIT: I just looked and there is an 8K x 8 static NV RAM that is pin compatible with the 2764 and would drop right into a cartridge! It also has a real-time clock. Dallas Semiconductor DS1225. I think all we would need is to hook up the R/W line, perhaps with a switch to write-protect it. I've ordered 4 to play with. They could come in handy for other projects too.



Steve

Steve Gray

Well, nothing seem to go my way... i can't seem to find the proper resistors in my electronics junkbox.. guess I'll have to buy some, unless other values will work.

Some more thoughts while I'm waiting for parts to arrive.

If you are familar with the "Batteries Included" BUSCARD (for the C64) it has dip switches to select which device is IEEE and which is IEC. So, perhaps a virtual dipswitch would be cool... we allow the user to do the same thing lets say by typing ">IEC 10" or ">IEEE 9"  (fictional wedge commands) and then direct the routines to the proper vectors. This way we can have both interfaces active at the same time. The ">UNIT xx" command can set the "default" unit number. Not sure if this will all be doable for "outside" the monitor.

Steve

Steve Gray

My EPROMS arrived (30 of them!-2764's) and so did my DS1225's. I looked at the demo cartridge PCB and I may need to cut some traces for the DS1225 to work, plus wire up the R/W line. It's 11pm here so it'll have to wait for tomorrow.

I did burn one EPROM with the MON610 bin, which seems to work ok. Haven't got my resisters yet so still no cable... tune in again for the next update ;-)

Steve