Resurrecting An XT

The best laid plans of mice and men oft go awry. At least that’s what we’d tell ourselves if we couldn’t find a 30-year-old computer monitor. [Andrew] picked up an old IBM XT on eBay recently and tried to get the video working. He hasn’t seen any success yet, but the way he goes about solving this problem is very clever.

[Andrew] was stuck with a cool old computer with no way to output anything onto a screen. The XT had an MDA port but neither his TV nor his VGA monitor would accept MDA frequencies. As a workaround, [Andrew] connected an Arduino to the XT keyboard port. On the factory floor, IBM workers used the XT keyboard to load code onto the machines while POSTing. He was able to change the frequency of the MDA CRT controller to CGA frequencies, and with the help of some small components got some video working.

The Hsync and Vsync are still off, and [Andrew] hasn’t been able to get the machine to finish POSTing, but he figures he can use the XT keyboard port for bidirectional communication. He’s written a very small kernel to test out a few things, but unfortunately the XT’s power supply died recently. Once [Andrew] replaces that, we’re sure he’ll get his box up and running.

28 thoughts on “Resurrecting An XT

  1. I’ve fixed the power supply now, replaced the video card with a CGA and written a “Hello World” program in ROM BASIC. Unfortunately there’s a bad RAM chip somewhere so I’m currently limited to 192Kb until I write some code to track it down. Also, the BIOS is doing something odd with the keyboard port – it’s lowering the clock line briefly at some point which is confusing the Arduino.

    1. Back in those days, I used a program called Checkit to help determine where a memory problem might be.

      But that said, it usually wasn’t bad RAM so much as it was bad connections. Re-seating everything, with a bit of Deoxit DN5 for good measure, might just bring it fully back to life.

  2. Damn that’s hardcore. I mess about with old bits of hardware loads but I still have no idea where these guys pick up such low-level stuff. ‘Track down bad memory sectors you say? I’ll need a logic probe, Jaffa cakes, some techno beats and twenty minutes’.

    Let’s have an update when you’ve got it rocking :-)

  3. Neither was I aware of the low level code via the keyboard code. Andrew can you provide some links how you found that out? Any more details?

    One option is to either get a ISA VGA board or translate the MDA to VGA by using an FPGA with some RAM memory. ISA VGA’s are getting more and more scarce and I am holding on to the two I already got.

    Problem with installing an ISA VGA board in a XT is usually the 16 bit part being blocked by some chips on the mainboard.

  4. I’m not sure if it’ll be of interest to you, but if you wanted to test your 8088 code on a modern machine, I’ve made a fairly accurate 8086 processor library. It’s made in C++, slow as hell, but it’s easy to add virtual interfaces to and it’s as accurate as I can tell without having a physical 8086 in front of me.

    The name of it is x86Lib. It’s quite old now, and you’ll want to check out the latest version from source control. It’s at sourceforge: http://sourceforge.net/projects/x86Lib

    Just figured it might be kind of useful for this niche project. I’ve failed to find any 8086 CPU emulator that doesn’t follow the behavior of the 386/486 in real-mode

    1. @Earlz, cool project – thanks! The link seems to be broken though. I believe the 8088/8086 emulator used in MAME and MESS has proper pre-386 behavior, though it isn’t cycle exact. One of the reasons I’m messing about with this old hardware is to try to make a cycle-exact emulator.

  5. @SquantMuts, the only documentation of the manufacturing test mode in the BIOS is in the BIOS ROM assembly listing itself in the technical reference manual:

    ;————————————————————————
    ; LOAD A BLOCK OF TEST CODE THROUGH THE KEYBOARD PORT :
    ; FOR MANUFACTURING TEST. :
    ; THIS ROUTINE WILL LOAD A TEST (MAX LENGTH=FAFFH) THROUGH :
    ; THE KEYBOARD PORT. CODE WILL BE LOADED AT LOCATION :
    ; 0000:0500. AFTER LOADING, CONTROL WILL BE TRANSFERRED :
    ; TO LOCATION 0000:0500. STACK WILL BE LOCATED JUST BELOW :
    ; THE TEST CODE. THIS ROUTINE ASSUMES THAT THE FIRST 2 :
    ; BYTES TRANSFERRED CONTAIN THE COUNT OF BYTES TO BE LOADED :
    ; (BYTE 1=COUNT LOW, BYTE 2=COUNT HI.) :
    ;————————————————————————

    Looking elsewhere in the listing, you can see that this routine is accessed when a device on the keyboard port returns 65H instead of the normal AAH in response to a reset. Apart from that it works just like a keyboard from the point of view of the software (though the bytes coming in are length bytes and code bytes instead of scancodes).

    I now have an ISA CGA card which works fine with the TV (no additional code or external circuitry required). I also have a scan doubler card which I hope will allow me to view the TTL output on a VGA monitor (with no additional code but a little bit of external circuitry to convert the voltage levels).

    1. Out of curiosity, what TV is it? I have a CGA card in one of my XTs but I can’t find a monitor for it (in Italy, at least).

      I already have an 8-bit ISA VGA (most 16-bit VGA cards will work anyway, just try them) but I need the CGA to boot Xenix 8086.

      1. Some (not all!) CGA cards have a NTSC composite output on an RCA jack.

        Also, EGA monitors are pin-compatible and perfectly capable of displaying the output of a CGA video card. It might be easier to find an old EGA display than an older CGA one . . .

  6. They’re not that rare, just very expensive. A quick flick through eBay showed around 20 cards at least 2 of which are 8-bit. But you’d have to love your pc 30-130GBP seems to be the going rate.

  7. True 8-bit VGA cards are hard to come by, however, 8-bit *compatible* VGA cards are neither rare nor expensive. Remember the Trident 8900-series cards? They’re 16-bit, but can be set to 8-bit mode just by changing a jumper. Same with most of the Oak and Paradise cards, and quite a few others too.

    And the current crop of eBay listing aren’t representative of the going rate for the things, either… I don’t know of anybody actually buying them for those kind of prices. Put up a want ad on one of the vintage computer message boards, and you’ll find some for cheap.

  8. Andrew, as another commenter said on your blog post directly, I have some older equipment that I could spare for your project. I believe I have an 8-bit VGA board you could have. I had no idea they were so expensive! Perhaps I could sell off a few of mine to retire, lol. As for the HD sound, it shouldn’t sound like metal grinding. That could be either a catastrophic head crash, or just bad bearings. Leave the HD powered up for a few minutes (or hours) to let them warm up and loosen the oil and the noise may go away. Also if I remember correctly, you should be able to remove all boot ROM equipped ISA cards (or just all of them but the video) and it should drop down into BASIC. That will let you know, at least at a low level, if everything is working correctly with the motherboard/ROMS. And of course, with the XT power supply, be careful with the voltages required. I don’t remember, but I thought it used something odd in there. Certainly an AT power supply could not be directly used. Contact me at my email address if you’re interested in the card.

  9. @leadacid, I’d definitely be interested in an 8-bit VGA card. I don’t see an email address for you here but mine is andrew@reenigne.org.

    Others have told me that these hard drives are expected to make these sounds, so it might be the case that the hard drive is working perfectly and is just empty.

    As I mentioned above I have got into ROM BASIC (the tricky part there is pressing F1!) So I know the motherboard is working (except for one of the RAM chips – it only finds 192Kb).

    The ATX power supply board is working fine now – I unsoldered the ATX power connectors and soldered in the original XT ones. The only strange voltage supplied by the XT PSU but not an ATX one is -5V, but that’s only used by old 16Kbit RAM chips, and this machine uses 64Kbit chips which don’t need it.

  10. Actually there were interrupts you could use to write to the keyboard. The A20 gatehandler was in the keyboard and they had enough memorry in them to store the registers so that when you reset the cpu and went in to protected mode the first thing it would do is poll the keyboard and see if twhich mode it was supose to be in. then it would get the registers reload them and go.

    1. @Glen, you’re thinking of the AT which had a microcontroller on the motherboard to talk to the keyboard (and control the A20 gate). PC/XT had no microcontroller, no A20 line and no protected mode – just a PPI and a shift register for talking to the keyboard.

  11. @Andrew Ah, SF became case sensitive sometime since I made the original website. Look here instead: http://sourceforge.net/projects/x86lib

    Mine isn’t cycle exact either though. I believe it could be modified without major restructuring though to become cycle exact though. If it helps, the documentation I used building the emulator is from here: http://www.ousob.com/ng/iapx86/ it is extremely handy as a reference and lists opcode sizes, arguments, and cycles.

    1. @Earlz, there are a couple of emulators which use those cycle timings, but they aren’t quite accurate. I think Michael Abrash had some more accurate timings in “The Zen of Assembler” because he did some experiments on real hardware rather than relying on Intel documentation.

      Even then, these emulators still aren’t cycle exact because they don’t take into account the time it takes to transfer data (including instruction bytes) over the bus or the CPU’s prefetch queue, or effects like DRAM refresh cycles and device wait states.

  12. MS-DOS had a TTY command to use a serial port in place of a monitor. But you probably had to write an autoexec.bat file first, requiring that pesky monitor…. but I’m also tapping a 20+ year memory of playing with XT’s.

Leave a Reply to Andrew JennerCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.