Z80 ASM program: calculator "OS"

A project log for CalcHack

CalcHack is a project to add missing features to graphic calculators. It adds many exciting functions students wanted for a long time.

Sean Dylan Goff 08/18/2014 at 19:590 Comments

The client program running on the builtin Z80 which receives frame data and transmits keystrokes is written in Z80 Assembler.

Even though it only consists of just about 150 commands ant compiles to < 500 bytes it was a really big part of the project for me out of a few reasons:

- I always programmed in C and treated ASM as something I won`t ever do. This changed when I saw that ASM was the only way to solve this problem, because I only have a 6mHz Z80 CPU and wanted greyscale --> very fast update rate (I managed to get as high as 38 FPS but in the demos it`s about half because of using one instead of two processors working together to feed frame data into the Z80.)

- The TI-82 STATS doesn`t have native ASM support which makes development very painful, and I didn`t even have a link cable which means one crash - rewrite (because I can`t backup the code). Quite a bit was done in HEX ASM (ouch!), but then I decided to take time to search for a compiler (most don`t run on modern computers - is the perfect solution, if you know about it which I didn`t) and also build my own data cable (STM32F4 discovery + cut in half calc to calc cable = hacky, unstable but working method to transfer files to the calculator) which made development much easier.

- To be stealthy the program must delete all evidence (lastentry, commands typed on screen) but also itself on closing, preferably very fast (panic/teacher button...). This is still work in progress, as deleting the lastentry doesn`t work if not isolated from the rest of the OS - unusable, but I`ll find a way.

The code is located @