Hi everyone,
I learned recently that the old TI-83 Plus and TI-84 Plus calculators are programmable in Z80 assembly language. I created this project to learn how to program them.

RPN83P is an RPN (Reverse Polish Notation) calculator app for the TI-83 Plus and the TI-84 Plus. The app is inspired mostly by the HP-42S calculator, with some sprinkles of older HP calculators like the HP-12C and the HP-15C. The RPN83P is a flash application that consumes one page (16 kB) of flash memory. It consumes a small amount of TI-OS RAM: 2 list variables named REGS and STK which are 240 bytes and 59 bytes respectively.

Here is a quick summary of its features:

• traditional 4-level RPN stack (X, Y, Z, T registers)
• support for lastX register
• 25 storage registers (STO 00, RCL 00, ..., STO 24, RCL 24)
• hierarchical menu system, inspired by the HP-42S
• support for all math functions with dedicated buttons on the TI-83 Plus and TI-84 Plus

• arithmetic: /, *, -, +
• trigonometric: SIN, COS, TAN, etc.
• 1/X, X^2, 2ND SQRT
• ^ (i.e. Y^X),
• LOG, 10^X, LN, e^X
• constants: pi and e

• %, %CH, GCD, LCM, PRIM (is prime)
• IP (integer part), FP (fractional part), FLR (floor), CEIL (ceiling), NEAR (nearest integer)
• ABS, SIGN, MOD, MIN, MAX
• probability: PERM, COMB, N!, RAND, SEED
• hyperbolic: SINH, COSH, TANH, etc.
• angle conversions: >DEG, >RAD, >HR, >HMS, P>R, R>P
• unit conversions: >C, >F, >km, >mi, etc
• base conversions: DEC, HEX, OCT, BIN
• bitwise operations: AND, OR, XOR, NOT, NEG, SL, SR, RL, RR, B+, B-, B*, B/, BDIV

• various display modes

• FIX (fixed point 0-9 digits)
• SCI (scientific 0-9 digits)
• ENG (engineering 0-9 digits)

Here are some missing features which may be added in the future:

• statistics functions (sum, mean, variance, standard deviation)
• complex numbers
• vectors and matrices
• keystroke programming

The Project Home is here: https://github.com/bxparks/rpn83p

* GitHub releases page: https://github.com/bxparks/rpn83p/releases

If you try it, I'd appreciate any feedback.
Thanks,
Brian
That's a pretty neat app. I have a suspicion you've written quite a lot of code before.

Storing the RPN stack and registers in lists is an interesting choice. Appvars would have been the normal choice, but using BASIC-accessible list variables opens some interesting possibilities for integration with TI-BASIC programs.

Using ON for going up a menu level is weird because it violates the UI conventions used everywhere else on the calculator. Aside from that, the menu system is quite intuitive.
Congrats, seems great, and it's not every day there's an actual new app for the 83+/84+!
The readme is also well detailed
DrDnar wrote:
That's a pretty neat app. I have a suspicion you've written quite a lot of code before.

Storing the RPN stack and registers in lists is an interesting choice. Appvars would have been the normal choice, but using BASIC-accessible list variables opens some interesting possibilities for integration with TI-BASIC programs.

Using ON for going up a menu level is weird because it violates the UI conventions used everywhere else on the calculator. Aside from that, the menu system is quite intuitive.

Yeah, I've done a fair bit of programming, much of it in C++, Java, Python, in the "cloud" as they say. Recently I've done a fair bit of embedded C++ with Arduino-compatible hardware. With this project, I wanted to go even lower-level. I had not done Z80 programming in... decades?

Yes, AppVars would be the natural choice. Except that the TI-83 Plus SDK documentation of those things seemed so poor, that I could not understand what they were until I had completed most of the app. The RPN stack registers and storage registers (R00-R24) just store floating point numbers, so they seemed to fit nicely into user-defined List variables. There are a number of internal application variables that I don't currently persist across reboot/power-cycle. Those would definitely go into custom AppVars.

With regards to using the ON button as the EXIT/ESC menu function, I agree it's unusual. I struggled with this for the entire duration of the project, trying different options, but the other options seemed even less optimal. It should be the ESC key, but the TI-83+/TI-84+ calculators don't have an ESC key. The HP-42S calculator uses the ON key for this purpose. That button is labeled "ON/EXIT" on the HP-42S. So people who are familiar with the HP-42S will hopefully find it somewhat familiar.
Congrats, seems great, and it's not every day there's an actual new app for the 83+/84+!
The readme is also well detailed

Thanks! I stopped doing calculator programming before the TI-83+ and TI-84+ were created, so I missed the entire party for 20-25 years. When I found out that these things used the Z80, and there seemed to be a good ecosystem of development tools, I thought I'd give it a shot to create something that would be useful to me.

The ramp up was a little more difficult than I had expected. The developer information is scattered in all over the place. Texas Instruments seems to be actively hiding information to make this hard. Googling has become very difficult. Any search for "TI 84 Plus" has become completely commingled with the "TI 84 Plus CE" family, so I found it difficult to locate technical information about these older calculators.
WikiTI has a lot of information, including everything there is to know about the hardware. There really aren't any mysteries left. The old official TI SDK documentation is probably still the best reference for the OS functions. You can still download a copy of the old TI SDK from TI Planet.

The TI-84 Plus CE uses an eZ80 CPU, which runs a very similar ISA to the Z80, just with some 24-bit (yes, really) registers. The community SDK's standard libraries are written in assembly, if you'd like to contribute! While nearly everyone uses C/C++ for the TI-84 Plus CE, you can still use pure assembly if you like.
The problem I had with WikiTI was that I could not understand most of the info there... until I had learned the material from somewhere else. In other words, it's a great reference, but not so great for someone who's starting from zero.

With regards to the TI-84 Plus CE, I thought that Texas Instruments locked down the flash app signing key. I understand that a hack is available to bypass it, but is the friction low enough that 3rd party development is still active and vibrant?
Flash application development is experimental at best, and we don't really recommend trying to bypass the signing key. However, programs can do nearly everything apps can do. There's 150 K of user RAM available (and sixty-some K of scrap RAM), plus the 150 K of VRAM (which you don't have to use all of), so you can do quite a lot without needing to be an app. The only friction (so to speak) for running programs is that recent OS versions require the jailbreak. Originally, you could just run assembly programs like any BASIC program.

You don't have to use flash apps to run custom code on the TI-83 Plus either. You can run many programs with the Asm( token (found under the catalog) and the rest generally run on MirageOS (which is not an OS) or Doors CS (which the forum TOS require me to advertise).
Thanks for the additional info about the TI-84 Plus CE. I don't own it, I didn't realize that ASM programs for the CE could be so large. I have 2-3 additional projects in mind for the 83+/84+, perhaps I will make my way to the CE.

I do appreciate the simplicity of flash apps on the 83+/84+. They are easy to create (using spasm-ng). The app is persistent across crashes and power failures. And flash apps are far easier to execute than assembly programs, needing far fewer keystrokes. Something like (APPS, down, down, RPN83P, ENTER), instead of (2ND CATALOG, down, down,... down, down, ASM(, PRGM, down, ..., down,..., down,..., RPN83P, ENTER).

I understand that shells like the Doors CS can make ASM programs easier to use. But... without intending any offense towards the creator of Doors CS, I just cannot use Doors CS. I cannot read anything in that font. And navigating a mouse pointer on a calculator with arrow keys feels like torture to me. (I would love to see a fast Text UI version of Doors CS.)

Anyway, thanks for all the info and your feedback.
bxparks wrote:
But... without intending any offense towards the creator of Doors CS, I just cannot use Doors CS. I cannot read anything in that font. And navigating a mouse pointer on a calculator with arrow keys feels like torture to me. (I would love to see a fast Text UI version of Doors CS.)

A lot of shells (including Doors CS) include a feature that allow you to run assembly programs from the homescreen without the Asm( token after running the shell once. You only need to press prgm, then select the program you want, and then press enter. So, you don't need to open the shell every time that you want to run the program, just once per time that you reset the calculator.
commandblockguy wrote:
A lot of shells (including Doors CS) include a feature that allow you to run assembly programs from the homescreen without the Asm( token after running the shell once. You only need to press prgm, then select the program you want, and then press enter. So, you don't need to open the shell every time that you want to run the program, just once per time that you reset the calculator.

That's true, I forgot about that useful feature of Doors CS. The problem for me was that during the development process, I would crash the calculator a lot, probably hundreds of times. It was too much work to restart Doors CS every time that I crashed. Even when I did not crash, I would not remember whether I had already executed Doors CS. I found it easier to just assume that I had not, and always use the vanilla TI-OS mechanism (CATALOG, ASM(, PRGM, etc.). Once I learned how to create a flash app, the iteration cycle became simpler. No dependency to anything else, just drag and drop into the emulator, and hit APPS, down, down,..., MYAPP, ENTER.
bxparks wrote:
The problem for me was that during the development process, I would crash the calculator a lot, probably hundreds of times. It was too much work to restart Doors CS every time that I crashed. Even when I did not crash, I would not remember whether I had already executed Doors CS.

What I generally do is create an emulator save state after installing everything, and then just reload that every time I needed to re-run the program. That's even faster than waiting for the calculator to reset (assuming you're using the keyboard shortcut for it), and also makes sure that the archive is in a known state (in the event that your code is really broken).
I pushed a new version (v0.5.0) last night, available for download at:

* GitHub releases page: https://github.com/bxparks/rpn83p/releases

You can read the https://github.com/bxparks/rpn83p/blob/develop/CHANGELOG.md, but here are the major highlights:

* Add STAT (statistics) functions for 1 and 2-parameter statistics. Includes mean, standard deviation (sample and population), and covariance (sample and population).
* Add CFIT (curve fit) functions, supporting the 4 curve fit models of the HP-42S: linear, logarithmic, exponential, and power.
* Add menu selection dots. The HP-42S menus act as both action buttons and status buttons. For example, selecting 'RAD' mode places a small dot after the 'RAD' label on the menu. I figured out how to implement this on the RPN83P without adding too much complexity in the code.
It's been a while since I posted an update. I pushed the latest v0.7.0 today. I hope to stabilize this to v1.0 in 1-2 months, and then take a short break from Z80 programming. It's been enjoyable for the most part, but I feel about 1/3 as productive in Z80 assembly compared to the C language.

The first time I spent a day tracking down a missing "inc hl" was a learning experience. But the novelty wears off after a few more times. As the application gets bigger, refactoring and testing gets progressively slower, and more tedious. I wish I could implement automated unit testing for Z80 programs.

Anyway, major features since v0.5.0:

* now consumes 2 flash pages (32 kiB)
* implement the rest of HP-16C logical and bitwise operators (ASL, RLC, RRC, SLn, SRn, RLn, RRn, RLCn, RRCn, REVB, CNTB)
* support different word sizes: 8, 16, 24, 32 bits
* add Carry flag for logical operators and integer arithmetics, and SCF, CCF, CF?
* save and restore application state on QUIT or OFF
* add storage register arithmetics (e.g. STO+, RCL-)
* implement Time Value of Money (TVM) functions from HP-12C and HP-30b

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.

»
» 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