Ruud's Commodore Site: CBM-HD Home Email

CBM-HD




What is it

CBM-HD is a project where a PC simulates one or more IEEE devices. If you are familiar with 64HDD, a PC simulating a 1541 drive, then you can consider CBM-HD as its IEEE equivalent.


Features
  • Multi drive.
    CBM-HD can simulate up to 30 devices if you want to.
  • Multi disk format.
    CBM-HD supports several disk formats including a kind of 8250-compatible 16 MB hard disk drive and MS-DOS.
  • Hardware.
    The minimum you need: - a bidirectional LPT port
    - a COM port - access to a 5V power supply - two ICs, a 1489/75189 and a 7406, and some connectors.

Disadvantages
CBM-HD is a simulator, not an emulator! It simulates the 4040 and the other supported drives only to the point of file handling. The commands Memory-Read and Memory-Write are supported but the memory area itself is not used by CBM-HD. So you will only read what has been written there by Memory-Write or Block-Write.
Memory-Execute and Block-Execute are not supported at all for the simple reason that CBM-HD cannot emulate, and thus cannot run, 6502 code (and never will).


Theory

If you forgot how IEEE-488 looked like, take a peek at my IEEE document .
IEEE has 16 active lines in total. All 16 can be either input, output or tristate. Eight of them are used for transferring data, the other eight for control. The state of each of the control lines depends on the fact what role the device is performing at the moment: a listener, a talker or a controller.
I copied one part of this document to make the next part more understandable:
Line         NRFD   NDAC   DAV    ATN    EOI    IFC    REN    SQR
             I  O | I  O | I  O | I  O | I  O | I  O | I  O | I  O | 
-----------|------|------|------|------|------|------|------|------| 
Listener   |    X |    X | X    | X    | X    | X    |      |      | 
Talker     | X    | X    |    X | X    |    X | X    |      |      | 
Controller | X  X | X  X | X  X | X  X | X  X |    X |    G | X    | 
X marks line used as "I = Input" or "O = Output"
The block Controller/REN is marked G because a CBM doesn't use this line. In this case it is connected to GROUND.

As you can see a device like a disk drive needs 4 input/output and 2 input lines. So the original idea was to use an LPT port as IEEE port. But when testing my first interface, I ran into troubles and at the end I had to add a piece of hardware called 'ATN trap'. It isn't something that I did invent but it is used by the drives as well! But to be able to use it an extra output was needed and that's where the COM port came in. This port supplies the output to control the ATN trap.


The needed PC

What kind of PC do you need? You need a PC that has (at least) one bidirectional LPT port, one COM port and, preferably, a free USB port. On forehand: the USB port is only needed to supply the power for the interface.
As said: the LPT port must be capable of bidirectional operation. If your BIOS doesn't mention "bidirectional", choose EPP.
The PC should to be able to run plain Windows 98 DOS in the first place. MS-DOS could do as well (not advised however), but the DOSbox under XP, Vista or newer won't do at all! (I never used ME)
The reason we need MS-DOS or W98-DOS is that we need a real time Operating System. The DOSboxes of W98, XP etc. aren't; they still operate under 'multi-operating' circumstances. And unfortunately for some of you, that is the same with Linux. And not to be left unmentioned: most modern OSes prohibit direct manipulation of I/O ports.

There are various solutions to exchange files with other PCs. At least use a PC capable of running Windows 98SE. But, AFAIK, Windows 98 is NOT capable of sharing disks/directories with Windows 7 or better (never used Vista) and also has troubles with recognizing USB sticks. Therefore I personally prefer PCs capable of running at least Windows XP. In that case I install W98 and XP: W98 to run CBM-HD and XP exchange the data.
Be aware that for some unknown reasons it sometimes it is not possible to install or run the Windows 98 GUI on some newer PCs (video ?). In this case just install the W98 DOS and add XP.
If using XP, be also aware of the fact that W98 cannot handle NTFS. So create a big enough FAT32 partition to store CBM-HD and your (future) images. In my case I mainly create 3 partitions:
- one primary bootable FAT32 for W98SE
- one logical NTFS for Windows XP
- one logical FAT32 for all the data and nonsystem programs for both W98 and XP.

Notice I didn't mention Windows 7. When installing W7, a previous XP installation is recognised and the PC will show a multi-boot screen after powering up. For one or another reason W7 ignores W98.
A possible solution is installing W7 is the first OS and creating a FAT32 partition. To run W98, boot from a floppy. Not elegant, but it works.

My own version of CBM-HD runs on a thin-client built inside the case of a broken CBM 9060 (see more down for more info). Looks very authentic but has one disadvantage: I have no access to keyboard, mouse and video connector. So if I want to exchange images, I have to open the case and to attach a keyboard, mouse, screen and network cable before being able to start up Windows XP. Not quite user friendly.
But I received a CBM 8032-SK that died during a thunderstorm. I replaced its inners by a PC and the CRT by a LCD screen. Please have a look at CBM-PC.


The hardware

A schematic says sometimes more then thousand words:

The LPT ports takes care of the mian part of the IEEE interface:
     LPT
 D-connector             IEEE  
D0          2           1    D1
D1          3           2    D2
D2          4           3    D3
D3          5           4    D4
D4          6          13    D5
D5          7          14    D6
D6          8          15    D7
D7          9          16    D8

STROBE      1           5    EOI         
AUTO FEED  14           6    DAV        
INIT       16           7    NRFD       
SELECT IN  17           8    NDAC       
PAPER END  12           9    IFC (RESET)
ACKNWLDG   10          11    ATN
GND      18/25        18/24  GND
                       12    Shield

I already mentioned the ATN trap. This circuit does nothing else but pulling NRFD and NDAC low the moment ATN becomes low. This on its turn puts the controller into a wait state. The moment the PC is able to handle the ATN, it must be able to disable this ATN trap so it can take control of the NRFD and NDAC lines itself. As you can see only four 'Open Collector' inverters and a pull-up resistor are needed.

Assume PC, the control input for the PC, is (L). The moment ATN becomes (L), point(1) becomes (H), thus negating NDAC and NRFD.
Making PC (H) means that point (1) becomes (L) regardless of the state of ATN. in that case NDAC and NRFD can only be negated by the original outputs.
But what output is to be used for 'PC'? The list above reveals that there is no free output left at the LPT port to perform this function. So that's where the COM port comes in view: RTS will control the ATN trap.

As already said, we have the hardware that enables us to control ATN and Reset:
- output DTR, a 1489 gate and a 7406 gate will handle ATN
- output TxD, a 1489 gate and a 7406 gate will handle RESET


Signal conversion and power supply

A COM port output cannot be connected directly to a TTL input. That is why we need the 1489/75189 as a bridge between the COM port and the 7406 gate.

Both the 1489 and the 7406 IC need a +5V power supply. My own idea was tapping it directly from the power supply in one or another way. But an USB output can take care of that as well. Using an USB output is not my idea but comes from Giovi (Brasil). Advantage: now the hardware can be used by most, not too new, PCs and laptops. The newest PCs and laptop don't have a LPT port anymore :(
For very old PCs and laptops without USB ports: tap the power from the keyboard, mouse or game connector.


The drive's flashing LED

If there is something wrong, the Commodore drive tells this the user by flashing a LED. CBM-HD does this by displaying an error message on the screen. But that got me into trouble after building a PC motherboard in the empty case of a CBM 8050. That went fine until I ran into an error. The problem was that I didn't know there was an error because I had no screen attached. So I needed something to replace the screen, preferably something in the style of the flashing LED.
My first problem: using the PC in controller mode, I had no more free outputs left. So I used sound but that wasn't a success either; believe me, much too irritating. Then I had the bright idea to replace the loudspeaker with a LED and resistor: worked like a charm :)

In time I got two other ideas but they haven't been realised in software (yet):
- If CBM-HD is going to be used in 'drive only' mode, DTR and TxD will never be used. Using one of them (plus the buffers) is an option.
- Like a lot of other PCs, my thin client has two COM ports. One output of the second port plus the left over buffer can take care of the LED.


Other hardware versions

Those who have read an older version of this page before will notice that is has completely changed. The older version mentioned more then five different versions. But I found out that that they only confused people and that is not what I wanted.
If interested, the previous page can still be found here.


The software

As said before, CBM-HD is written in Turbo Pascal. You can get the sources, the executables for MS-DOS/W98-DOS, and a D64 containing the Basic programs I used to test things just by asking me. I'm working on version 4.0 and when that is finished, you can download it as a ZIP again.

Important remark: the software has only been tested and will only be tested in the real DOS mode of Windows 98 SE. And just to make sure: I am not interested in making it run in the GUI mode of Windows 98, ME or higher.


How to use the software?

You start CBM-HD under DOS by: "CBM-HD30". It will look for a normal text file with the name "CBM-HD30.INI". That file tells CBM-HD what type of drives it should simulate, using which device numbers and what image files to use. An example:

Cable XIEEE 0 1 1 Drive 4040 0 8 test.d64
;Drive 4040 0 8 cbm-hd.d64
Drive 8050 0 9 disk1.d80
Drive 8250 0 10 disk2.d82
;
Drive 4040 0 11 test2.d64
Drive 4040 1 11 test4.d64
;
Drive D16 0 12 disk.d16

The word "Cable" tells the program that this line handles what type of interface is used. Because we are dealing with IEEE devices, the cable should be of the XIEEE type. The zero tells the program what type of IEEE interface we are using for the PC. Version G mentioned above is type zero. The next two numbers give the number of both the LPT and COM port. In this case we will use LPT1 and COM1.

The word "Drive" tells the program that this line handles emulating a drive. The next part of the line tells CBM-HD what type of drive has to be emulated (see next part). IEEE drives normally have two physical drives on board. The number 0 or 1 tells the program what drive is meant. The next number tells CBM-HD what device number this simulated drive should have. A check is done if a number already has been used. If both drives are used, a check is done if both drives are of the same type.
The last part is the name of the image to be used. If the image doesn't exist, CBM-HD assumes it has to create this image for you.


What drives does CBM-HD simulate?

First CBM-HD simulates the four most known IEEE floppy drives:
- CBM 3040 with images using the D30 extension
- CBM 4040 with images using the D64 extension
- CBM 8050 with images using the D80 extension
- CBM 8250 with images using the D82 extension
The CBM 4040 is an ancestor of the well known 1541 and both use the same disk format. Therefore 1541 floppy disks can be used in CBM 4040 drives and vica versa. That is also the reason the images share the same extension: 'D64'.

There also exist a double 8 inch drive, the CBM 8060. But this one is not only very rare, but I have no idea of its format so I don't know how to create images.

There exist also two hard drives, the CBM 9060 and CBM 9090, with 5 and 7.5 MB of free space on board. They are rare as well, one reason not to simulate them. The second reason: these drives don't have subdirectories meaning all saved files will be placed in the root. THE ideal way to make a mess of it :)
But because being intrigued by them and the well known CMD hard drive for the C64 and C128, I created my own 'hard drive': a 16 MB Commodore compatible hard drive, just called D16. Its extension: D16. The advantage of the D16 is that it can handle subdirectories, not the way the 1581 or CMD do, but like MS-DOS does. An example: 'OPEN 15,8,15,"CD:GAMES":CLOSE 15'. With 'MD' and 'RD' you can create and delete directories.


Help, it doesnt work !!!

This is a guide to tell you what to do once you have build the hardware, started up CBM-HD and the PC and the CBM don't see each other. I expect you to be able to solder, to understand digital electronics, to read and understand schematics and to work with the program DEBUG under MS-DOS. This last should include that you can handle hexadecimal numbers.

I'm very experienced and yet I managed to swap two wires when soldering version G. My test program said that everything was alright but my CBM 8032 refused to recognise the PC as a drive. So I attached my LED tester to the IEEE bus and ran the program in step mode. Then I noticed that at two stages the wrong LED was dimmed.
This LED tester is nothing more then 16 LEDs, 16 resistors of 390 Ohm, two resistor arrays of 10K and two 74LS540 ICs soldered on a PCB. The inputs of the 540s and the single pins of the resistor arrays are connected to various signals of the IEEE bus. The common pins of the resistor arrays are connected to +5V. The LEDs are connected to the outputs of the 540s and to +5V via the 390 Ohm resistors. So the LED reflects the state of a signal: 'on' means the signal is (H), 'off' means it is (L). Last but not least: tap the needed power from a source that suits you the best.
Instead of this LED tester you can use a volt/multimeter to test every line one by one but this is a sure way to become stressed, I speak out of experience!

If you start up CBM-HD, it will mention what ports it is using. Not the numbers, but the I/O addresses. When using LPT1, you most probably will see 378. Other possibilities: 278 and 3BC. For the COM port this most probably will be 3F8 but 2F8, 3E8 and 2E8 are possible as well. You need to note these numbers.

To be continued....


My own CBM-HD project

I received an old rusty CBM D9060 for free. The transformer and hard disk were rusted as well. I was able to check the SASI-MFM convertor in a working D9060: broken as well. The only part that worked at least a bit was the CPU board: it signaled that the RAM was bad.
I also received an Athena thin-client which happened to fit exactly inside the case. I installed a small PC power supply, a 40 GB hard disk and two PC fans as well. This was all done in a nondestructive way, thus no drilling, filing or whatever. Just using glue and holes that already existed. The result:









Having questions or comment? You want more information?
You can email me here.