Page 1 of 1

AltairPC clone?! runs BASIC

PostPosted: Mar Wed 18, 2009 2:34 am
by xprt
I couldn't stop thinking about the 8085 running Altair basic, so I built one. I tried to do the simplest thing I could think of (meaning simplest hardware, minimum amount of programming). So I took the 8085, a RAM chip and the 6850 and used a PIC microcontroller as the bootloader to pre-load the RAM, then switch control to the 8085. Many many hours of wire wrapping later, here is the result:

Image

and yes, it runs 4k BASIC:

Image

One more of the rat's nest:
Image

That's 50 feet of wire.

When it turns on, the PIC loads the bootloader into RAM, and reads it back and outputs it with the 6850. It's using the 8085 HOLD input to do the DMA. This PIC has a "Parallel Slave Port" which is a microprocessor interface port, with it's own RD, WR and CS so it can communicate asynchronously with the microprocessor. I use this for the switch register. The PIC loads the value for the sense switches, then releases the HOLD and RESET for the 8085 and the 8085 takes over the RAM and the 6850 and starts running.

Of course it's not really an Altair without real lights and switches and the ability to single step, set the program counter, etc.

But at least we know for sure that the 8085 can run BASIC.

The photos are at http://www.flickr.com/photos/36481716@N06/

PostPosted: Mar Wed 18, 2009 8:02 am
by vbriel
Sweet, that answers a big question. I know the datasheet says compatible but you never know until you try.

This is the way I do a lot of my experiments, I wrap it up. You have a 7 chip 8080 Altair with no front panel. The hard part comes controlling the CPU to jump to other locations.

Nice work.

Vince

PostPosted: Mar Wed 18, 2009 1:52 pm
by mfortuna
That's a cool project. I was curious about the bootloader. Does it get the image from the pic and then load it in SRAM?

PostPosted: Mar Wed 18, 2009 5:45 pm
by xprt
Yes. The bootloader image is essentially stored in the PIC's program ROM (actually flash RAM). The PIC just copies it to the external RAM.

As you probably know, to load BASIC into the Altair without a ROM card, you had to enter a tiny program into RAM with the front panel switches. This bootloader program then would run and load BASIC from paper tape or cassette tape.

Here, the PIC is automatically loading the bootloader into RAM instead of using front panel switches.

Geoff Harrison has a fantastic description of the process here:

http://www.solivant.com/altair_bootloaders/index.php?album=altair_bootloaders&pagen=0

PostPosted: Mar Mon 23, 2009 3:06 am
by xprt
I confirmed that 8K BASIC and Extended BASIC also run. This confirms that the sense switch register is working since these require different switch settings than 4K basic. I've tried several BASIC programs like startrek for example. Here's the schematic:
Image

PostPosted: Mar Mon 23, 2009 5:45 pm
by vbriel
To do a switch panel and to single-step and assert a JMP command I will have to be able to read the status lines when HOLD is asserted. Is that possible? S1 and S0 help tell where the machine is at. Otherwise I can just count T states but it is like driving blind.

Vince

PostPosted: Mar Tue 24, 2009 1:10 am
by xprt
The datasheet says S1 and S0 are unspecified when HOLD is active. You probably have to use the READY line instead of the HOLD line. When you go from RUN to STOP you can lower READY at the beginning of each cycle and then you have as much time as you want to check the S1 and S0 line for an opcode fetch cycle. Keep stepping through the cycles with the READY line, stop at the opcode fetch, then jam your JMP instruction followed by the address bytes. Here is where you need to disable the RAM from responding to RD.

It would be nice to use one clock for both processors. With two clocks there will be a random shift of at most 1 cycle of the AVR relative to the cycle of the 8085. If you divide down the AVR clock and use that to drive the 8085 clock, they will always be exactly in sync.

PostPosted: Mar Tue 24, 2009 7:36 am
by vbriel
I would rather use the READY signal to control the CPU. I understand what you are saying now that the RAM has to be disabled, so I will have to change my circuit to not just share the CS input but the AVR must be able to control it over the CPU.

Vince

PostPosted: Aug Sat 08, 2009 12:48 pm
by xprt
I did some re-wiring to use the READY line using this circuit:
Image
When I raise the RUN line, this circuit will drop the READY line on the first CLK edge after ALE goes low. This stops the 8085 at the right time: when the address is latched, and the 8085 is trying to read from memory. When I raise the STEP line, the 8085 will run for one machine cycle and then stop again. When I lower the RUN line, the 8085 will run continuously.

I wrote these routines for the PIC to control the 8085: STOP at instruction fetch cycle; RUN; Jump to an address; write to RAM; step to next address (do a NOP). With these I can do all the functions of the front panel.

I tested this by taking the 8080 program to echo characters and re-located it to start at location 010000 (octal). Then I wrote a program for the PIC to STOP the 8085, Jump to 010000, write a byte to RAM, step to the next address with a NOP, write the next byte to RAM, etc., then jump back to 010000 and RUN the 8085. ...and it works!

At this point I could easily add the lights and switches and have a working computer with a front panel that can run Altair BASIC. But adding the front panel is a big arts and crafts project involving making a panel that looks good, lots of wiring and lots of potentially expensive switches. I'm not sure I'm into that right now.

I can post the complete schematic and/or source code if anyone is interested.

PostPosted: Aug Sat 08, 2009 3:03 pm
by AndyC
Nice work:) I'd love to see the source and schematic.

Andy.
http://vectrex.playntradeonline.com - Home of the 72 in 1 Vectrex Multicart

PostPosted: Aug Sat 08, 2009 11:49 pm
by xprt
OK:
Source Code (c code)
Schematic (pdf)
To add LEDs involves adding buffers to the address, data, and status lines.
Adding switches could be done in various ways. One way would be a switch array, with the PIC reading the switches. I left the 8 address lines connected to the PIC, but they are not used and could be used to connect to a switch array, which would require about 10 I/O pins.

PostPosted: Oct Wed 28, 2009 9:49 am
by marktuson
Can the machine be directly connected to a terminal of some sort?

It would be really cool to make one of those into a 'laptop' or 'palmtop' sort of thing.

EDIT: I just remembered the PockeTerm. Cool. I need to get one.

PostPosted: Nov Thu 05, 2009 8:16 pm
by xprt
I created a webpage on this project:

http://mini-altair.tripod.com/index.html#top

Sorry about the ads. Free sites aren't free.