Sunday, August 30, 2009

8085 SDK-85 Homebrew-Style

My retrocomputing took a turn for the even more retro this past week. After bringing up an old Ampro Little Board and programming it with nothing more than a simple line editor and non-relocating, non-macro 8080-only assembler I caught myself wishing for a similar experience in something more portable.

Ampro little board plus pcb
Ampro Little Board Plus SBC, before placement in fat box.
I've had several different micro trainers, the COSMAC Elf among my favorites. I enjoy them a lot. The best are small enough to use without a table top, and battery powered. Since I'm presently doing 8080 assembly on the Ampro (it's a Z-80, so it runs 8080 code) I thought it would be nice to have a small 8080-compatible trainer board.

The classic 8080 compatible SBC is the Intel SDK-85. It's a great small system that has started countless numbers of engineers on their path to digital electronics greatness. It comes with a nice keyboard, a decent display, a nice monitor program, and an 8085 core system that's ready to go for plenty of I/O. They're still very popular, which means they are pretty expensive--at least for someone who just wants a small system to use for fun. The PCB is a bit large for portability, as well. But there is excellent support for it, plenty of software and a number of books.

Since I couldn't see paying for an SDK-85 when I've got parts drawers with 8085s and Z-80s in them, I decided to build my own system. Even though I like the advancements the Z-80 added to the 8080, I decided to go with an 8085 as the heart of my home-made system. To some degree, it was the retro thing striking. The Z-80 feels a bit "new" (actually it and the 8085 came out about the same time, but I didn't get a chance to use a Z-80 myself in my own designs until a few years after putting together a couple 8085s.) If I had had an 8080A, I would not have used it. I'm not that retro-foolish. It is much more of a pain to build a system around than either an 8085 or a Z-80. I'd rather build an 8088 or 8086 system, to tell the truth, or, rather, a V-20!

So I pulled my newest datecode 8085 out of the drawer and got going.

8085 free run circuit on solderless breadboard
The simplest possible 8085 microprocessor circuit-a free run circuit.
The picture shows what I accomplished on the first evening. I decided to take things in little baby steps, since I haven't worked with this microprocessor except in established designs in many years.

Since I'm doing the initial build on a logic lab with power built in, I didn't have to worry about a power supply for now. Next was to get the clock circuit sorted out. A crystal oscillator makes that easy. I put its signal through a 7400 to get a push-pull design since I intend to run it up to 6MHz, and the 8080-85 Family manual recommends this for 6MHz and above.

The next step was to drop in the CPU. If I'd had to build a complete core system right off the bat it would have taken longer than one short evening to get something going. And it would have introduced countless opportunities for error, which I am very adept at inadvertently locating. So I built what's called a "free run" circuit. You hardwire in an opcode that doesn't stop or redirect the processor, then it runs through its entire address space when you fire it up. It allows you to make sure you have the clock and CPU control wiring working, at least in a nascent form.

The resistors above are the hardwired instruction. They allow the CPU to put a value on those lines without forming a short to a power rail, then pull the lines to the instruction value when the 8085 is reading it. The instruction is 00, a NOP or no-op in 8080-85 terms. The CPU does nothing and moves on to the next address.

The yellow wires at the top wire some of the address lines to LEDs so I can watch the 8085 step through its address space.

After one fix of an improperly placed wire (/RESET), it worked fine.

Evening 2 had me adding an address latch. Again, moving by baby steps. Evening 3 added an EEPROM with a four byte program:

0000 3E C0 MVI A, 0C0H ; enable SOD, set it high
0002 30 SIM
0003 76 HLT ; stop

Hand assembled and typed into my Xeltek Superpro/L's buffer directly for programming the EEPROM (as are all the programs for my 8085 to date.)

I got that working to demonstrate the successful interface between the 8085 and a memory. I turned up another wiring error while I was at it (address lines A1 and A3 were swapped coming off the latch.)

Next, I was going to add a RAM but decided to replace the EEPROM with a NOVRAM instead. I've got some Dallas DS1225Ys that I pulled off some scrapped SCSI controllers years ago. They're ten years past their expiration date, but most of them are fine. Using a NOVRAM lets me reduce system memory to a single chip. It also sets me up for all sorts of amusing misadventures (like all memory going *poof* if the /RESET circuit isn't rock solid.) Trade-offs are part of the design process. If I get too annoyed with cleaning out system code in interesting ways, I'll add an EPROM once I've got a simple monitor program written.

Next was testing the RAM with a simple program (presented here un-assembled):

MVI L, 0F0H ; set up memory pointer
MVI H, 1FH
MVI M, 5DH ; write out some easily recognizable bytes
INX H
MVI M,41H
INX H
MVI M, 52H
INX H
MVI M, 5BH
MVI A, 0C0H ; show we did something, turn on LED on SOD
SIM
HLT ; stop

Then i pulled the NOVRAM and read it on my programmer. It showed that the program ran fine, verifying that I'd rewired for the DS1225Y properly. I even got the circuit to stop futzing the RAM up at power-on when I put a pull-up on the RAM's /WE line. ;)

Now I've got switches connected to the interrupt lines on the 8085 to provide me with "interactive input." I wrote a program that blinks the SOD LED a different number of times depending on which interrupt it's servicing.

Next is adding I/O for a keyboard and multidigit LED display. I did consider the idea of using just the interrupt lines for user input. An old telephone rotary dial switch and a little code would do the trick. But then I decided it'd be too noisy, compared to a keypad. And maybe just a wee bit too retro for daily use.

Edit: I've done a complete write-up of thise project at saundby.com. This includes assembly instructions, design notes, project code, and so on.
8085 SBC prototype

Tuesday, August 18, 2009

Retrocomputing with CP/M--and Only CP/M

Ampro Little Board CP/M Computer System

I recently put together an Ampro Little Board Plus computer system from the 1980s. This system was especially slick for its day because of its small size and the fact that it had a built-in hard disk interface. It had the whole computer on one printed circuit board roughly six inches by eight inches. And it had a SCSI interface.

Originally I had the system set up as pictured above, loose components on a table top. There was the computer system board, two floppy disk drives, and a serial terminal. Since then I've moved the computer into an ugly beige PC box to hold things safely while I complete the hardware work on the system. In time, I plan to move it all into an interesting enclosure. I bought a large candy jar, for example, but it turned out to be just a bit too small.

The system now has three floppies and a 1.1GB hard disk. It's only capable of using 88MB of that hard disk because of operating system limitations, but the rest of the disk is accessible if I want to write software to take advantage of it.

Right now, the system has nothing on it but the software that came with the system board. That means the CP/M operating system with some enhancements from ZCPR, a really neat set of programs from Richard Conn that make CP/M almost as good as Unix. Better, if you consider the size. I've intended to load that huge 88MB hard disk space with software, but all my CP/M software on 5-1/4" disk is hiding from me somewhere in my cupboards. Probably behind boxes of MS-DOS software.

So I've decided to go ahead and start using the system with what I've got. I've got:
  • An Editor (ED.COM)

  • An Assembler (ASM.COM)

  • A Linker (LOAD.COM)

  • A Debugger (DDT.COM)

  • Various system utilities.

What more could I possibly need, right?

ED is a line editor, not a full-screen editor. If you're on a big noisy teletypewriter for your system console it's just the thing. If you're on a CRT console, like I am, it feels a bit dated, even for a retrocomputing enthusiast like me. Normally I like to rush straight into loading up WordStar or WordMaster or one of their clones. With this system, I've been stymied in either finding the software or being able to get it off one system (a Kaypro) and onto the Ampro in the time I've been willing to dedicate to it (granted, I haven't really tried hard. Let's just say it hasn't happened with unexpected ease. A null modem cable and some patience is really all I need.)

It seemed like an interesting challenge to jump in on this system with nothing more than what it comes with. In the old days, I would have done this as a matter of course since there would have been a delay between getting the system and the time when the bank account would allow me to go back to the computer shop for software. Well, except I probably would already have had WordMaster on hand.

One of the things I wanted to do was go through some of the assembly language programming exercises in a book on 8080 and Z-80 programming by Alan R. Miller. So I jumped in this weekend and started entering assembly language programs with ED. Jumped in? Stumbled, stubbed, and tripped in would be more like it. I didn't remember ED, or its pitfalls, nearly as well as I thought I did. I have been coddled by the luxury of the full screen editor for too long, and too clearly remember the fine line editor of the HP3000 compared to how well I remember the idiosyncrasies of ED.

Fifteen minutes in, I was ready to give up the whole experiment and go looking for my WordStar disks again. But I persevered. I re-read the section on using ED in the CP/M manual, and managed to sort out how to do what I wanted to do through a combination of assembling information from various places in the manual, accessing long unused memories in my head, and a form of logical deduction not unlike mental Ouija.

Now I've managed to enter, edit, and successfully assemble the first exercise in writing a monitor program from the book. ED's not such a problem, once understood, so the experiment will continue. It feels pretty good, now that I'm on top of things. It's almost enough to make me think about going even further retrograde, to programming PROM chips by hand.

Naah. Not quite.
There was an error in this gadget