Saturday, 11 April 2015

Building an Intel 8085 trainer


I'd like to build an Intel 8085 trainer for a final year project. The trainer will be used by students and will basically accept machine code entered by students, load these into RAM and run the code. Students will also be able to single-step through the code, examine memory and registers, all basic functions of a trainer. There will also be GPIO (for LEDs and such) on-board as well as some other components (LCDs, seven-segs) you might find on a dev board. A touchscreen would be a nice touch, for input and display. There should also be the option of power using cheap batteries, since electricity isnt at all reliable here. All on a PCB with packaging etc.


I've done a bit of research and thinking and concluded that there are 3 main ways I could do this:



  • Get a PIC18 (or some other MCU) and program it to understand and execute all machine code input. Basically the PIC18 will emulate an 8085.

  • Get a PIC18 and an 8085. Let the PIC18 serve as a monitor and control everything except running the user code.

  • Get an 8085 and let it do everything from running user code to blinking LEDs on-board. Use EPROM to store the monitor code.


I have other school work that will occupy a lot of my time and it takes a month at least for ordered components to get to me (when they do), so I wont have as much time as I'd like. So I'm inclined to go with the 2nd option since it saves me the work of having to delve too deeply into the 8085 instruction set and all the associated assembly programming, which is something I barely know. Plus I think its also efficient, since it lets the 8085 do what it does best and lets the PIC handle the rest. My main aim is straight-forward (i.e. least effort :)) and effective. I'll be using 6116 for RAM and the usual 74373 for address latching. Not sure what chip to use for I/O yet (I/O-mapped I/O).



What I'd like to know is:



  • Is this option really as straight-forward as it seems? Any pitfalls I should be aware of?

  • Is there a better way? Maybe one not among my listed options?

  • How feasible is battery power with 9 V batteries? Any better cheap alternative?

  • Any advice on input? I'd like to use a resistive touchscreen and not buttons to give a modern feel (like this 7-inch TFT) but i'm worried about all the extra pin usage and if it will even be big enough? Maybe just use pushbuttons for input and use a far smaller screen for display alone?

  • Any general advice on the whole thing?


Thanks in advance.



Answer




A microprocessor trainer is a big (and worthwhile) project, try to subdivide it into several smaller milestones. Trying to debug one massive project where nothing has ever yet worked, during the final week, is to be avoided... Consider the interfaces between the various parts and plan how to approach integration testing / debug. Since you have a fixed amount of time available to work on the project, it's important to prioritize what to do. If everything goes well then you can reach for a larger scope, but if there are problems then the scope of the project can be reduced to be still useful and deliver on-time.


I'd suggest dividing the project into steps something like this:



  • System power supply

  • 8085 clock, reset; verify instruction fetch is incrementing address pointer (no firmware yet)

  • Compile 8085 object code from PC

  • 8085 running simple firmware test toggle I/O (blink LED)

  • memory test -- check for address lines short or open

  • I/O input from buttons

  • I/O drive HD44780 LCD


  • (optional) 8085 interface with PIC18 hosted I/O

  • (optional) 8085 interface to RS232 (FT232 USB cable?)

  • (optional) 8085 running self-hosted monitor firmware

  • (optional) PIC18 better I/O panel interface, touchscreen?

  • (optional) load and save 8085 memory to host PC


It is possible to build the entire 8085 trainer running with just the 8085 itself, without any other micro -- this is how the original 8085 trainers were designed. The I/O can be as simple as a small keypad matrix and some 7-segment LED displays or HD44780 alphanumeric LCD display. (The HD44780 will give longer battery life than 7-segment LEDs, and more versatile.)


Given that you have PIC18 available and are more comfortable coding PIC18 than 8085, there could be an advantage to your proposed hybrid trainer. Use the PIC18 to manage the I/O, and use the 8085 to run the user code. This is an attractive option because you're more likely to find device driver support for the PIC18 than the 8085. However it does require that you set up an 8085 toolchain (at least an assembler) as well as your PIC18 toolchain. The good news is 8085 is old enough that whatever compilers or code you find is most likely free, but the bad news is it's also most likely no longer well supported.


I do have to ask -- what if instead of an 8085 trainer, you instead build a PIC18 trainer? If the goal is to help the student learn assembly language, PIC is probably more relevant. And unlike the 8080/8085/Z80 architecture, PIC is scaleable. However 8085 is still a good introduction to the more modern PC CPUs, since a lot of the 80x86 weirdness (like segmented addressing) comes from stretching the 8080 beyond its original architectural limits.


The intel 8255 is the standard I/O chip that was used with 8080/8085 systems, but emulating 8255-style I/O is straightforward.



The intel 8253/8254 is the standard programmable timer that was used with 8080/8085 systems. Again, this could be emulated on the PIC.


A feature you didn't mention, would be an RS232 (serial port) interface to a terminal. That would be useful for running an 8085 self-hosted monitor, so the user can read and write 8085 registers on the 8085, and single-step through their code. I'm not sure if this is essential, it's kind of a different direction that you were planning to go, but something to consider. You would need to provide routines for character input and character output. That could use either an RS232 port or use on-board HD44780 and buttons.


For 8085 self-hosted monitor, you might look into glitchworks 8080 monitor for firmware to run on your trainer board. 8080 code will run on 8085.


The ancient BDS C compiler has been released as open-source as of 2002. I think that includes an assembler as well as the so-called "brain dead" C compiler... this was before the K&R C was standardized, but could still be a useful resource.


The more modern SDCC Small Devices C Compiler supports Zilog Z80, which is a superset of 8080. It's unclear to me whether SDCC really supports 8080 / 8085 however. The main focus of SDCC is on the 8051 microcontroller family, though it does support a few others.


About powering the system from 9V battery - 8085 only requires a single 5V supply (unlike the 8080), so this could work. A switch-mode power supply would give longer runtime than a 7805 linear regulator, since the 7805 has to discard 4V x load current, efficiency will be 55%. The thing about SMPS is they are very sensitive to layout and component selection, so start with an evaluation module like the TI.com simple switcher Say VinMin 7V, VinMax 14V, Vout 5V, Iout 1A for examle; TI.com website supports several designs.


This is a pretty big project for a college senior design project for a team of one person, but I think it's achievable.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...