User Machine Code Execution on the TI-81 Becomes a Reality
Posted by Travis on 27 August 2009, 00:20 GMT
Randy Compton has recently published a very interesting document that demonstrates how to take advantage of a bug in TI-81 ROM version 1.8K to execute user-specified machine code. This is especially notable considering that the TI-81 has no link port, thus it is impossible to run custom ASM code by transmitting a hacked memory backup to the calculator as was done with the TI-82 and TI-85. Instead, this is accomplished entirely through what is entered on the keyboard.
The method appears to work by triggering a bug that causes the hardware stack to overflow into a region of RAM holding the calculator variables. The stack can then be altered by using the standard variable editors in a way that causes the ROM to transfer control to the desired location of RAM upon returning from a subroutine.
A few years ago, Randy had released some technical documentation pertaining to TI-81 ROM 1.8K, such as RAM and ROM maps. This may be useful for anybody wanting to experiment.
|
|
Reply to this article
|
The comments below are written by ticalc.org visitors. Their views are not necessarily those of ticalc.org, and ticalc.org takes no responsibility for their content.
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
Travis Evans
(Web Page)
|
According to this forum thread (see web page link), the bug affects ROM V2.0V too. Without a shell, though, programs will have to be modified to run on different ROM versions.
|
Reply to this comment
|
27 August 2009, 00:20 GMT
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
Kevin Ouellet
(Web Page)
|
Darn this is awesome. I am curious if ROM 1.1K (the TI-81s with no lithium battery cases) could also run ASM programs.
|
Reply to this comment
|
27 August 2009, 03:19 GMT
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
Lewk
(Web Page)
|
This is absolute madness. My mind is blown at how amazingly genius this is. How does one ever go about figuring this out in the first place?
|
Reply to this comment
|
28 August 2009, 17:08 GMT
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
calcdude84se
|
Now a TI-81 Assembly (machine code) directory will have to be added. Today is the day that I wished I owned one...
|
Reply to this comment
|
29 August 2009, 19:22 GMT
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
JuPIDeR
|
I would comment, but I seem to keep going over some 40 character limit.
|
Reply to this comment
|
6 September 2009, 23:10 GMT
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
Kevin Ouellet
(Web Page)
|
Now I wish something like that was done with the Casio CFX-9850G series, even if they are discontinued. Most Casio calcs are weaker and more limited than TIs, but the CFX series had 3-color LCDs and each color could be changed in the contrast menu. Possible games could be tilemap-based RPGs where the 3 colors could be changed according to your needs for each tilemap or dungeons. However, I wonder if using the same method as with the TI-73, 82, 85 and 92 would work on them, plus, it would most likely be a different processor and since there are several variations of the CFX-9850, 9950 and 9970, maybe the hardware or ROM is different in each of them.
|
Reply to this comment
|
8 September 2009, 01:17 GMT
|
|
Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
Kevin Ouellet
(Web Page)
|
Ok, I think this is definitively possible on ROM 1.1K too. I have tested on my TI-81 which have this ROM version (and no backup battery slot) and after doing the "execute Prgm3" step, I went to Y3 and there were full of junk there including stuff like I/O, MATRIX, DATA, etc, after the 3.141592654+-2.14592654X stuff. However, I couldn't do the steps right after the one where I ran Prgm3, as there was no All-OffBcol in Y3.
There were a lot of Y2T-OffBcol stuff, though, so I tried the rest of the instructions anyway and eventually ended with 467 bytes instead of 442. Unfortunately, from there, I accidentally chose the Reset option x.x. I might try to redo it later when I get more free time, though. But just reporting in to say weird stuff happened on 1.1K as well. Could this means ASM is possible on this older ROM too?
|
Reply to this comment
|
12 September 2009, 00:17 GMT
|
|
|
|
|
Re: Re: User Machine Code Execution on the TI-81 Becomes a Reality
|
Travis Evans
|
Cool! Yeah, that definitely sounds like the bug exists in 1.1K as well. The whole trick has to do with the BASIC program that calls itself a bunch of times and then inputs a number. When you enter something that causes an error, the ROM then forgets to restore the stack. The LinReg and RegEq stuff is only there to make it faster to fill up Y3, if I understand correctly—you could fill it up by typing anything, but it would take longer.
I also got stuck at the same point when I tried the instructions—I couldn't find the part in Y3 that the instructions mentioned. But I think this is because these instructions were written only for 1.8K. The random garbage you see in Y3 is actually the part of the ASM stack that overflowed into this part of RAM. It represents ROM addresses that the OS is supposed to return to, but these will vary on each ROM version, so the part you need to change would likely be different.
Even if you knew what to change, though, I don't think the program would work since the docs say it uses 1.8K's ROM calls only, unless those calls happened to be exactly the same on 1.1K. ROM versions will probably be a bit of a problem for 81 ASM—you'd either have to type in an ASM shell to translate things (like the 82 and 85 shells did) (I don't know how much space this would take up), or there would have to be a separate version of each program to type in for each ROM version.
Sadly, since you have to type everything in and since there isn't much interest in the 81 anymore (and barely anybody probably has one nowadays), I have a feeling that TI-81 ASM won't advance very far, though. :-( And to be honest, it really isn't all that practical, either—but I definitely think it's still fun and fascinating because it's something most of us never dreamed was possible. :-)
|
Reply to this comment
|
12 September 2009, 02:17 GMT
|
|
|