CBM 610 (B128) IEC adapter

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

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

carlsson

I have a local store selling assorted electronics surplus. Most of the time the bags contain odd value components but sometimes I can get a few usable resistors, connectors and so on out of it. There is another store with a bigger selection (also more expensive) but they only are open a few hours a day so I never get the chance to go there.

I suppose you have the connectors for cassette and IEC DIN available though? Whenever I find some spare time to look into this again, I'll let you know.

Steve Gray

Quote from: carlsson on June 08, 2009, 06:29 PM
I have a local store selling assorted electronics surplus. Most of the time the bags contain odd value components but sometimes I can get a few usable resistors, connectors and so on out of it. There is another store with a bigger selection (also more expensive) but they only are open a few hours a day so I never get the chance to go there.

I suppose you have the connectors for cassette and IEC DIN available though? Whenever I find some spare time to look into this again, I'll let you know.

I have a bulk pack of resisters on order. 2500 from Hong kong for $10 plus a couple bucks shipping. figure that should hold me for a while. Yes, I have the connectors. I borrowed a nice cassette connector from an old c2n unit, and I'm going the male IEC route so it will be a single cable solution totally enclosed for a nice finished look...

BTW, I had an old 8k x 8 static ram chip that is 2764 compatible which I tried wiring up. I cut the ground-link at pin 27 and wired it up to the R/W line but no luck. I'm wondering if it needs the S02 and SR/W lines 'AND'ed to get it to work?... That's how the bank15 ram is connected.

My Dalas 1225 chips arrived but I haven't tried them yet.. last few days have been busy.

Steve

Steve Gray

Update... I have built the cable and tested the moni610 cart and it is working. I was able to get a directory of a disk in my MSD-SD2 drive (using the IEC cable of course). Weird though, I used UNIT 09 and tried DIR and got an error 5 as expected but when  I entered UNIT 08 to go back it wouldn't get a directory again, giving me error 2. Reseting and entering the monitor again worked fine. Not sure why the UNIT command would cause problems.

Anyway, next step is to try to get the 8K NVRAM working so I can do some development, otherwise i'll probably end up wasting many eproms....

Anyone know where I can find source code for a good DOS wedge?

Steve

Steve Gray

I'm starting to look at the code. With the original moni610 rom I found you can activate the serial routines in basic by typing: sys 19174
I did notice that a directory listing takes longer from basic than from inside the monitor...
Still, my goal is to make something a little friendlier and with some extra features. I downloaded something called "util 700" and it resides at $6000. Its a bunch of utilities for basic but it's in german. Anyway, I have both installed in one cartridge to play with for now.

Steve

carlsson

Keep up the good work! I don't have anything new to add, other than I picked up yet another bunch of cartridge boards of which I believe some could come to good use if more owners of the B-series computers want to enhance them with IEC support.

carlsson

As a side note, yesterday I found another BOX full of CBM-II series cartridge boards. Some populated with 2764's, some bare. I don't know if they'll all work or which memory address they will map into, but I can go through them later.

That is saying, if anyone needs a few boards for experiments or perhaps making their own IEC cartridge, just let me know. It isn't like they're rare or anything, just that I doubt anyone produces new cartridge boards today.

Steve Gray

Anders, I could use a few boards to play with.

Steve

carlsson

Did we make any progress in putting the IEC routines into a cartridge, ideally keeping the IEEE interface/devices enabled? A few weeks ago I noticed my VIC-20 Dams IEEE-488 interface actually only grabs #8 for IEEE and allows IEC access to devices #9 and so on. Or perhaps it even listens to the IEEE drive connected, so if my 8250LP was set up to be #9, it would allow access to a 1541 as #8. If those routines for the CBM-II can work in a similar way, it would be great. Of course I could try to dump the 2532 EPROM inside my VIC interface if one needs inspiration.

On a side note, I'm considering putting the C2N232 loader for the CBM-II onto a cartridge. As you know the C2N232 connects to the same cassette port as Ullrich's IEC adapter does, and will need a loader/patch to be useable. Instead of loading the 444 bytes long file from disk, I imagine one could put it on a cartridge and SYS to start unless it can be made auto booting. It sounds like a waste of cartridge but I still have enough boards and EPROMs to make it worthwhile. Perhaps in the future even those routines (C2N232 and IEC) could be hosted on the same cartridge and one chooses which type of device to enable.

And yes, I know I could wire up a serial cable to the 610 but I still need the loader. Actually a 8K cartridge should have enough space to host support for all possible interfaces that can be connected to a CBM-II, but it is currently of mostly academic interest.

Steve Gray

Hi Anders,

No progress yet. Now that xmas season has passed I hope to get back to the project. There seems to be renewed interest in IEEE interface stuff (1541 IEEE conversion, XS-1541, uIEC IEEE)...  I picked up a uIEC at the World of Commodore show (thanks Jim!) and this will give me incentive to get the IEC going on the CBM-II's.  Of course, any help is appreciated.

Steve

carlsson

Yep, I will begin with trying to execute some code from a cartridge.

Diddl

#35
I Have made an alternative firmware for the XS-1541: IEEE2IEC


You can attach any IEC drive from your commodore computer. It works as a bridge and transforms all command at low level (TALK, LISTEN, UNTALK, UNLISTEN, IECIN, IEOUT). Source code for Atmel AVR644 is inluded.

carlsson

#36
Quote from: carlsson on January 05, 2010, 07:51 AMYep, I will begin with trying to execute some code from a cartridge.
Aha! In VICE, cartridges are attached in the ROM settings dialog, not from a menu option.  8)

In the mean time, I learned the syntax for the BLOAD command. I found that my copy of the User's Guide contains typos which don't exist in the B Series User's Guide uploaded to Bombjack.

To load a file to bank 15, $6000 type BLOAD"file",D0 ON U8,B15,P24576

In any case, no matter what I attach in the ROM/cartridge dialogue, it seems nothing shows up neither in the internal CBM-II monitor nor in VICE's external one. Very strange and frustrating.

Actually my real question is I read this German document which near the end describes how to set up the cartridge header. I'm not sure I understand how it should look like, but this is what I tried:

org $6000
.byte $80,$60,$0f,$80,$60,$0f ; rem both cold and warm start at $F6080
.byte "c",$c2,$cd,"6"
org $6080
... program happens


I realize $F6006 can contain $80 + "c" if the computer should use the regular Kernal initialization. Perhaps it should be $0C though, and thus the last byte should in this case be $06?

Furthermore, do I get the first two address pointers correct? I figure we still deal with little endians but the address seems to be a 20 bit one which makes me think the bank number is the last in sequence.

Steve Gray

#37
The code should be "CBMx", where x is the high-nibble of the address. with $30 added (to make it numeric).

On the B-series, cartridges could be at $2000, $4000, or $6000 so,  $32, $34 and $36 or:
CBM2
CBM4
CBM6

In reality, the kernal routine looks at every $x000 page in Bank 15 (where x is 1 to F) for the autostart signature, so you could have an internal expansion ROM somewhere and autostart it as well, or have the signature in the middle of your rom somewhere. If no signature is found then $E000 is used (which will jump to $EE09 which is the ML monitor). Cartridges are cold started at $x000.

I looked at code in the kernal at address $F997. The autostart code is at $F9AA. The Autostart signature is at $F995/6= "BM", and the "C" is only checked for it's SIGN (bit 7) as a flag to initialize kernal, as you indicated.
The autostart routine only checks bank F and only jumps into code in bank F.

So...  assuming cartridge at $6000, start of code at $6080:

$6000= $80 (Start of program LO)
$6001= $60 (Start of program HI)
$6002= ?
$6003= ?
$6004= ?
$6005= ?
$6006= $C3  "C"  (or clear bit 7 to bypass kernal initialization)
$6007= $C2  "B"
$6008= $CD  "M"
$6009= $36   "6"
...
$6080= Start of Program

I think $6002-6005 are reserved to be compatible with BASIC ROM. The kernal will set the restart vector at $03F8 to point to the start of the rom at $x000. It is the cartridge's responsibility to set the restart vector and/or initialize basic as needed. The code was disassembled on my own B128-80 machine.

Steve

Edit: I re-read the kernal source and got it all wrong... hopefully the description above is now correct

carlsson

I just tried this program, and at least it seems to execute on startup:

    org $6000
    .byte #<lo, #>lo, #<lo, #>lo, #<lo, #>lo
    .byte $c3,$c3,$cd,$36

lo: ldx #0
l1: lda l2,x
    sta $0400,x
    lda l2+256,x
    sta $0500,x
    inx
    bpl l1
    jmp $0400

l2:
    rorg $0400
[ C2N232 code follows ]


That is, the code is copied to $0400 but when it is executed the machine crashes into the monitor. Hm, perhaps it has something with initializing vectors as you mention. For this matter I could skip the autostarting section and SYS it from Basic. As you see I set $6002 to $6005 with the same address all over. At least the second entry should be a vector to warm start address, but I dunno about the third one unless there really isn't 24 bit addressing as I first thought.

Oh well, now I have wasted two 2764 EPROMs. I have six more to go before I need to break out the EPROM eraser. I also know the number of erase and write cycles likely is limited on old chips, but unfortunately it doesn't seem like I can use VICE to do rough testing of this?

carlsson

Ok, I just found out bank 15 corresponds to bank "romio" in VICE's monitor. I assumed it would be "ramF" but apparently that is used on some other Commodore computer.

Anyway, I just found out JMP $0400 from within the machine code makes the computer lock up. However if I transfer it to $0400 and from Basic run SYS1024, it starts up as it should. Unfortunately it seems the precompiled Windows binary for cbmlink is faulty. I will probably install MinGW and recompile it myself.

Steve Gray

#40
Quote from: carlsson on January 10, 2010, 09:28 AM
Ok, I just found out bank 15 corresponds to bank "romio" in VICE's monitor. I assumed it would be "ramF" but apparently that is used on some other Commodore computer.

Anyway, I just found out JMP $0400 from within the machine code makes the computer lock up. However if I transfer it to $0400 and from Basic run SYS1024, it starts up as it should. Unfortunately it seems the precompiled Windows binary for cbmlink is faulty. I will probably install MinGW and recompile it myself.

I wrote some ML programs that reside at $0400 but none of them seem to run in vice at all. I'm not sure if my settings are wrong.  My copy of cbmlink works fine... it's what I used to develop my CBMXfer.

I finally got my hands on a 24K Ram cartridge for the B128. Ernie Chorny lent it to me at the TPUG meeting last night and I plan on reverse engineering it, plus documenting it for my web page. It has three 6264 RAM chips, a 74S00 NAND, some resistors, caps and two jumpers.

Anyway, this will make development a little easier.

Steve

Steve Gray

Quote from: Diddl on January 05, 2010, 10:52 PM
I Have made an alternative firmware for the XS-1541: IEEE2IEC


You can attach any IEC drive from your commodore computer. It works as a bridge and transforms all command at low level (TALK, LISTEN, UNTALK, UNLISTEN, IECIN, IEOUT). Source code for Atmel AVR644 is inluded.

I've been busy and didn't give this much thought, but now I'm interested in trying this. Does the "bridge" work in both directions, or just IEEE --> IEC ? If the latter, would it be possible to adapt so that it could be bi-directional? What I'm thinking is a small board that has IEEE female edge connector on one side for direct connection to PET/CBM without the need for a cable, and IEC female on the other end. On sides would be an SD card slot and USB. On the board would be IEEE pin connector to attach to centronix-type IEEE cable or internal IEEE like on 8296 computer.

With appropriate firmware this could be:

- SD card for PET/CBM
- SD card for C64/128/VIC etc
- Adapter to connect 1541 to PET/CBM
- Adapter to connect 4040/8050 to C64
- Connect 1541/4040 to PC via USB

Any thoughts?

Steve

polishedball

I believe Nils is working on a new revision that will include some of this and more,  eth and LCD.  However if my understanding is correct his efforts are currently on David65.  Perhaps he will chime in here.


Steve Gray

That would be fantastic. I know a simple plug-n-play solution for the PET would be great and would help all those that can't find the old drives, or like me don't want to have to mess with big bulky boxes.

Steve

Michau

#44
Quote from: carlsson on April 14, 2009, 02:59 AM
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.

That is actually not true. The kernal contains several instances of unused space filled with $AA, perhaps to pad different sections to specific addresses. There are also some routines which would rarely be used (or never at all), like the coprocessor functions.

Therefore the Uz's kernal contains both routines (IEC and IEEE). The kernal checks upon each reboot whether a serial device is connected. If so, it switches the routines to IEC. Otherwise they remain unchanged.

My goal is to change Uz's kernal so that it automatically checks every device and selects the appropriate routine. The idea is to call an IEEE routine first, then check the bit 7 in status variable which indicates that the device is not present. If it is not present on the IEEE bus, then call the IEC routine and mark the device in memory so that next time the kernal will know to call only the IEC routine.

I have been playing with the kernal source code, and came up with a first revision. The kernal does boot, but I am unable to test it further because the 6526A CIA in my Commodore 610 is broken, and I don't have any IEC devices to check. But perhaps someone could try this kernal and check whether it works, so that I would know it is a good approach.

Steve Gray

Quote from: Michau on July 04, 2010, 03:18 AM
Quote from: carlsson on April 14, 2009, 02:59 AM
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.

That is actually not true. The kernal contains several instances of unused space filled with $AA, perhaps to pad different sections to specific addresses. There are also some routines which would rarely be used (or never at all), like the coprocessor functions.

Therefore the Uz's kernal contains both routines (IEC and IEEE). The kernal checks upon each reboot whether a serial device is connected. If so, it switches the routines to IEC. Otherwise they remain unchanged.

My goal is to change Uz's kernal so that it automatically checks every device and selects the appropriate routine. The idea is to call an IEEE routine first, then check the bit 7 in status variable which indicates that the device is not present. If it is not present on the IEEE bus, then call the IEC routine and mark the device in memory so that next time the kernal will know to call only the IEC routine.

I have been playing with the kernal source code, and came up with a first revision. The kernal does boot, but I am unable to test it further because the 6526A CIA in my Commodore 610 is broken, and I don't have any IEC devices to check. But perhaps someone could try this kernal and check whether it works, so that I would know it is a good approach.

I will attempt to test this, probably in a few days. My understanding is UZ had to remove the NTSC/PAL test to make everything fit and that his kernal is PAL. I'm in Canada and using NTSC... have you looked into this? If you're modifying the kernal it would be nice to reduce the startup time on 256K machines by loosening the memory test routines, perhaps by checking only the first byte of each page rather than all 256 bytes. Perhaps a check can be done at startup for some key to re-enable a full mem test. Also, perhaps a small change to the startup message so we can tell that it's a modified kernal. If there is additional room available perhaps some additional features can be added.

I just haven't had the time to work on my cartridge solution so thanks for jumping in!

Steve

Michau

#46
I looked and Uz's kernal does check for PAL/NTSC jumper. Sorry, looked at a wrong file. Uz's kernal is PAL only indeed. Mine is PAL/NTSC as original. In fact, this is only 17 bytes for CRTC data and 3 machine instructions, so it doesn't take up much space.

Currently there are about 140 free bytes in the kernal. I will play with it more when I'm back. Right now I am told that my 8250LP arrived via courier, hopefully the CIA chips too so I will have something to test.

airship

Quote from: Steve Gray on March 20, 2010, 11:10 PM
- Adapter to connect 4040/8050 or SFD-1001 to C64/128
Fixed that for you. :)
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

Steve Gray

Quote from: airship on July 12, 2010, 06:32 AM
Quote from: Steve Gray on March 20, 2010, 11:10 PM
- Adapter to connect 4040/8050 or SFD-1001 to C64/128
Fixed that for you. :)

Thanks, but it still could use some fixing...

- Adapter to connect 2031/2040/4040/8050/SFD-1001/8250/8250LP/9060/9090 to VIC-20/C64/SX-64/Educator64/C128/C128D/C128DCR/C16/C116/+4/C65

(I couldn't remember the model numbers of the 8 inch IEEE drives ;-) )

Steve

RobertB

Quote from: Steve Gray on July 13, 2010, 11:44 AM(I couldn't remember the model numbers of the 8 inch IEEE drives ;-) )
Would that be the CBM 8280?

            Still in Aberdeen, Scotland,
            Robert Bernardo
            Fresno Commodore User Group
            http://videocam.net.au/fcug
            July 24-25 Commodore Vegas Expo 2010 - http://www.portcommodore.com/commvex