As a bit of a mini side project I patched/ported the TI-81 1.8K ROM to run on the CE in z80 mode.

Yes that's right, the OS from a 30 year old calc running on the most recent variety Smile.

There isn't really much to it as the only differences to the ROM are port read/writes have been patched since they can't be used on the CE and even if they could be, the connected hardware isn't the same anyway. The whole ROM is only 32KB so no need to mess with paging etc, so the whole thing was reasonably straight-forward. One thing to note is that instead of patching a call to a routine (which would be 1 byte larger and thus require recalculating of all relevant ROM addresses, not to mention make the ROM larger) I patched with RST $00 and took over that address since it's used rarely. A boot condition is simply detected on power on, otherwise the port read/write is handled.

The LCD is scaled 3x which seems ok size wise and left room for a small 81 style border theme. The actual LCD rendering is kind of hacked in and requires interrupts to be running ... which should normally be the case. Also since this is not emulation, the speed is not consistent with the real thing. Not sure whether to try and restrict it, but I don't see the harm for now.

I hacked in RAM saving to an appvar on exit which seems to mostly work though I need to test it properly.

Note: You cannot install Unity on it the traditional way (since IM 2 interrupts aren't possible on the CE) ... but perhaps I should build similar ASM support into it. The best bit is that I'd store it outside of usable RAM so you'd get ~400+ bytes of precious RAM back. That being said with ASM you wouldn't be able to access ports since this is not emulation, it's a patch/port. No sending files though it would be entirely possible to modify the RAM/register state stored inside the appvar instead of typing it all in.

No other reason than just because, and perhaps a good way to preserve the 81 experience since they are becoming rarer now.

Anyway, some screenshots:

Now the question is, would it be acceptable to release this since it contains a ROM? I suppose I can just release the patch and such and people would have to dump/source their own 81 ROM? (Note that is ONLY works with 1.8K, which is the most suitable imo anyway).
This is the most impressive project I've seen this year!
The screen bezel in the last screenshot is a nice touch.

tr1p1ea wrote:
Now the question is, would it be acceptable to release this since it contains a ROM? I suppose I can just release the patch and such and people would have to dump/source their own 81 ROM? (Note that is ONLY works with 1.8K, which is the most suitable imo anyway).

Pretty sure you can't release it as-is. It would need to be a patch like wabbitemu.
I wonder if the rom falls into the public domain after enough time. If its like video game roms, then they would expire 95 years after publication...
For IM 2 support, you could check at the start of your IM 1 routine if I≠0 & then jump to entry 0 of the IM 2 table (or use the last byte from LCD lines 17 & 49 (alternating) as the offset for excessive realism), which is not perfect (something could set IM 1 without zeroing I), but should work with the OS & known programs.

If you want the LCD updates to keep working with interrupts disabled for some reason (or to allow an emergency escape key combination to work with interrupts disabled), there is always the watchdog timer's NMI mode.

If you want to support fetches from the RAM mirror (which would suffice for at least some of the exploits), you could fill C000-DFFF with an RST, check if its return address is in that range, & then add 2000 before returning if it is. Read support seems infeasible, & write support would depend on other things (if it works at all). If you did bother to attempt write support, supporting port output (but not input) via the usual opcode would be equally possible or impossible. Of course, just baking in Unity program support is probably better if you want to support ASM at all.

The current copyright expiration in the United States for works for hire (which is what applies to the TI-81 ROMs) is the earlier of 95 years from first publication or 120 years from creation, which would be 2085 for version 1.0 & later for 1.8K. Of course, Congress could change things again in either direction before that.
OK thanks for the input guys, I ended up making it so the relevant addresses are patched at runtime, so you only need to include your own raw ROM binary and build. That being said I might just split up the code binary and have a simple batch file to concatenate the files together to remove the need to assemble anything.

I probably won't look at IM 2 support for now, but I might insert a callback or something that's called inline with the TIOS IM 1 interrupt if required. Not that I expect anyone to actually use this for ASM, as that would be kind of silly - that being said I doubt anyone would actually use this outside of novelty anyway Smile.

One of the risks with this is that the program is the code is actually run natively in z80 mode (not emulation), meaning that any crashes will potentially affect the host CE OS, which is the risk of trying to run an asm exploit etc.
I've been checking your screenies folders for a few days and later some of the discussion about this and this is pretty impressive. I'm glad you figured out the ROM issue. Smile
A video showing the speed benefits of the CE:

There could still be a saving/loading bug since that's all hacked in for now ... some more testing is required. Will chuck it up on github soon.

At the minute I am compressing the ROM but I'm not sure if I should keep it with a release, given that people are going to have to build it themselves? I can have the binaries pre assembled and then just have the ROM appended to save the need to assemble though ...
tr1p1ea wrote:
A video showing the speed benefits of the CE

and that's a pre-M Shock
Well I created my first github repo lol and hopefully have everything right ...

Anyway you can find the code and the release package here:

(Any github experts please let me know if it's totally borked)

The release is actually the binary blobs sans the 1.8K ROM which you will need to supply. The included batch file will join it all together.

Code is included but it's a quick and dirty hack job ... so be warned Razz.
I finally got a chance to use this and it's really impressive! I'm stunned how much faster it is! I love you even save the last state of the calculator so the mem isn't cleared every time the program is quit.

Dumping the ROM was by far the hardest part. Did you get your dump by recording it with a camera and using OCR? I had an issue where the conversion batch file wasn't working with relative paths, but I just made the paths absolute and it worked just fine.

The only instability I've encountered with the program itself is that one time after exiting, none of the CE's buttons worked but I haven't been able to reproduce it Laughing

Well done!

Thanks TLM! Yes it was a camera + OCR and it took a long time lol.

Thanks for letting me know about the key issue, I'll look into it Smile.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum