I have been interested in calculators for long time. When I was young I wished to have programmable calculator like TI58/59 was. (More on examination of old TI-58 calculator see here.) Unfortunately it wasn't easily affordable in our country. As I grew up I used some Casio programmable calculators, but I always was interested in TI calculators. Lately, I was looking for calculator suitable for my job. One of main functions is hexadecimal support. I was also testing some of discontinued TI models. And TI-86 was the very last model which supported hexadecimal calculations without any problem. Every real number can be easily converted to hexadecimal format. This is unfortunately not common on latest TI-84, even TI-89, calculator.
One day I received STM32F4xx evaluation board. Because caculator needs 128KB RAM, this chip was sufficient to cover all calculator RAM without external memory. I was happy to learn how to use this new MCU and I wanted to make useful device for everyday use. The last component - 128x64 LCD - is quite common in my devices.
The first thing done was simple PC simulator. It was the base for my start - to make sure that I am able to do such thing ;-) Z80 simulation core was taken from some of my previous projects. Subsequent thing to do was HW simulation. I started with HW description and also studying existing emulator sources. After preparing enough knowledge and checking it in PC simulator I was ready to start building real calculator replica.
I started with planning how to place LCD and buttons. This brought the final dimensions of replica. The most annoying thing was to connect all switches. Most of them are connected regularly but the top of keyboard is not. Moreover, there are lot of connections so it took lot of time to do this. Another thing to think of was planning which MCU pins will be connected to which HW. LCD is connected to SPI interface to allow DMA transfer. Keyboard pins are connected the same way as in real calculator to allow easy keyboard access without need of remapping. The same is with link interface.
The first working calculator was not as difficult as I had expected. After it was running there appeared many partial problems and also bugs which needed to be solved. One of them was not nice RAM retention supply current. After thinking of various solutions, RAM is now saved to Flash and MCU goes to deep sleep with no RAM retention. This happens after calculator if off for some time (about 1 hour). Another challenge was idea to implement USB-CDC with gray link support. Black link was working almost immediately but it took quite some time to prepare lightweight CDC implementation (I don't like CMSIS and it's multi-level calls which end finally in the same source file but after some another 5 levels of calls). During this work I also studied TI-86 ROM. I had to write special disassembler which was able to understand specific ROM paging used in this calculator. It was quite useful to understand some basics - this helped me to debug calculator simulation. Also I have found yet undocumented feature: battery monitoring in TI-86. I know, PC simulators don't have to deal with such thing but I wanted to have as accurate as possible simulation to real calculator.
During development, I fought with ARM tools a bit. Normally I would prepare ROM image as C source code but after I have learned that objcopy utility can convert binary file to object file, I made so. But there is a bug 1147 in ARM version of objcopy.
You can see the result on the photo above and here are source files for STM32 version.
I often cooperate with TI in my job. One day I showed off with this replica calculator running on competitory MCU.
Some time later I received kit with Tiva TM4C1294 MCU - ARM Cortex M4 with enough RAM. It took some time to learn
how to use and program this MCU but finally I have working prototype of TI-86 running on TI's MCU - now is the result perfect :-)
Source files are ready to download here.