CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: CVSoft on December 15, 2015, 02:10:53 AM

Title: Making a Modern TI-82 Include
Post by: CVSoft on December 15, 2015, 02:10:53 AM
In pursuit of bettering what is already TI's greatest invention since the integrated circuit, I'm writing a new ti82.inc based on TI's ti83asm.inc and BrandonW's ti83.inc, targeting the SNG shell. SNG only has 30 ROM calls documented in its standard include file sng10.inc, and was the most complete one until now. So far, I have identified 138 ROM calls, using a Python script that follows call tables to compare the code of the routines mentioned in ti83.inc to the call table at the end of the TI-82's ROM page 0. It does not find calls that are on page 0; I need to do this manually, so those will take longer to identify.

RAM equates were fairly straightforward, except for the StatVars saferam area. Because the statistics implementation for the TI-82 is not nearly as advanced as the TI-83's, there will be significantly less saferam available there (279 bytes at most, compared to 531). Finding IY flag equivalents should not be terribly hard if I can find ROM calls common to both models that use a particular flag.

The latest version of the include file can be found here (http://www.bosaik.net/notipa/ti82.inc). Addresses here are for ROMs 15.0 and 16.0.

There are some necessary changes to ROM_CALL() that need to be made to support all of these calls. With the TI-83, TI introduced indirect calling (http://wikiti.brandonw.net/index.php?title=83:OS:ROMPage0C#Indirect_ROM_Calls.2C_4F0C_to_51F2), allowing the user to access some lesser-used functions outside of page 0. However, as user assembly wasn't implemented in the TI-82, there is no directly way to access these calls from page 0. Instead, you have to ROM_CALL(___bank_call) \ .dw addr \ .db page. You'll notice that this requires looking ahead three bytes, and ___bank_call (in ROM 16.0, at $2E46) does this by looking at the stack. This isn't compatible with the existing ROM_CALL() routines. For reasons of efficiency I will probably use a separate BANK_CALL() macro for this. Furthermore, to achieve compatibility with ROMs before 15.0, the ROM_CALL() routine needs to be updated with the new values for each of those ROM versions and take account for the missing values in the call table. Since all of this will happen within the shell, this is less important.

PROGRESS:
*RAM equates may be of different size

I'm not responsible for any RAM clears or property damage (probably through user rage) that results from using this experimental include file.
Title: Re: Making a Modern TI-82 Include
Post by: alexgt on December 15, 2015, 03:43:33 AM
Most of that when over my head but from what I understood it sounds pretty cool :)
Title: Re: Making a Modern TI-82 Include
Post by: Dream of Omnimaga on December 22, 2015, 05:13:21 PM
That is cool @CVSoft. I wonder if that could be handy for making new games for multiple platforms that imclude the TI-82? I wish that calc was documented like this earlier.
Title: Re: Making a Modern TI-82 Include
Post by: Max Leiter on December 23, 2015, 04:24:26 AM
Very cool you're doing this, like DJ said. Is the script opensource/available online somewhere? I'm curious as to how it works
Title: Re: Making a Modern TI-82 Include
Post by: CVSoft on December 26, 2015, 07:13:30 AM
@DJ Omnimaga yeah, it'll make porting things over significantly easier. It will make it possible to port over a lot of things to the TI-82 from the TI-83, but not everything can because of different saferam and missing calls.

@Max Leiter I'll release it when it's done -- I don't think it's ready for exposure as I still need to finish the methods it uses to map out calls. The tools will probably be GPLv2 licensed but the include file produced will only require attribution within the include itself.
Title: Re: Making a Modern TI-82 Include
Post by: utz on January 09, 2016, 03:58:17 PM
@CVSoft Thanks a lot for this excellent work! I'm sure this will come in handy for my projects at some point.
Do you have any plans to add addresses for ROM versions 17.0-19.0?
Title: Re: Making a Modern TI-82 Include
Post by: CVSoft on January 09, 2016, 07:57:32 PM
For the sake of compatibility, ROM_CALL() and BANK_CALL() will take care of adjusting addresses to the correct values.