CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: Dream of Omnimaga on February 20, 2017, 05:26:23 PM

Title: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 20, 2017, 05:26:23 PM
There are many Axe Parser projects that have died because the programmer have hit the executable code limit and thought there was no way around it:
8 KB by default for 8xp executables
16 KB for apps
24 KB with Fullrene (can be problematic if your code uses the same RAM space as Fullrene)
40 KB with that one trick that DrDnar posted once, but I forgot the post ID on Omnimaga
even more with RunPrgm or Pageswap axiom (but most likely has problems similar to Fullrene regarding safe RAM usage conflicts)

However, TI-BASIC has no executable code limit. With the help of simple ASM utilities to copy archived 8xp files to the RAM and delete the RAM copies, you can theoretically "increase Axe Parser executable code limit" to the following, sort-of:
164 KB on TI-83+
480 KB on TI-84+
1540 KB on TI-84+SE

Which isn't increasing the limit per-SE, but simply getting around it by splitting your Axe executable into multiple ones (eg one program for the menu, one program for Cutscenes 1 and 2, one program for Cutscenes 3 and 4, one program for the game ending sequence, one for enemy battles, one for the title screen and one for the overworld). You also need to use an appvar for data that needs to be shared across each executable. Then finally, you make a TI-BASIC launcher which, with the help of your favorite archive/unarchive ASM utility (XCOPY is the smallest and can be downloaded at https://www.omnimaga.org/files/Old-Calculator-RPGs-Headquarter-Archive/TI-Programming-Tools/XCPY7.zip ), temporarily copies needed archived Axe executables to RAM, then you launch the resulting XTEMP00x.8xp file and delete it afterwards.

The only downside is that this requires splitting your game into several sub-programs, cluttering the PRGM menu, so you might want to prefix the sub-program names with the theta symbol. Also, grayscale games will look crappy during the switching between programs, so you might need to add a "LOADING" text somewhere so that the user won't think his calculator froze.


Of course, I doubt people will need this much code and I recommend using as much data as possible as code replacement to avoid having to do this, but I think this trick could extend the life of several projects further.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Snektron on February 20, 2017, 05:29:17 PM
You dont even need ti-basic. You just need a few appvars with relocatable code. If that is not possible, you can just launch one program from another which results in tios copying the program to the code area and running it from there. Or you could make an app like everybody else but who does that anyway.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 20, 2017, 05:30:04 PM
My 83+ couldn't compile apps :P
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: E37 on February 20, 2017, 05:37:49 PM
If you have an SE, you can have more than 65536b of RAM without using a single byte of user RAM. (so you could have all 65536+b of ram even if the user has ram completely full of other programs and stuff)

On the 84+, it is the same as above but only 16000b
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 20, 2017, 05:49:30 PM
Actually both the 84+ and SE have 48 KB of RAM total, meaning an extra 16000 bytes on both calcs, not just the 84+. However, the 2004-07 hardware revisions of the TI-84+ and SE have 128 KB of RAM total. The hardware was changed in May 2007.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: E37 on February 20, 2017, 05:51:11 PM
If we are talking about apps, just use pageswap. That will give you as much runable code as archive.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 20, 2017, 05:54:40 PM
Ah I didn't know that pageswap existed for Axe. The DrDnar utility (I think) basically used both a 8xp and an app
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: E37 on February 20, 2017, 05:58:05 PM
Quote from: DJ Omnimaga on February 20, 2017, 05:54:40 PM
Ah I didn't know that pageswap existed for Axe. The DrDnar utility (I think) basically used both a 8xp and an app
That is RunPrgm.
https://www.omnimaga.org/the-axe-parser-project/(axiom)-run-(unarchived)-external-assembly-programs/
It has its own special uses besides running programs. The other things it can do are REALLY awesome in some special cases.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 20, 2017, 06:09:57 PM
After looking further, it was in the PageSwap Axiom topic that I found the thing mentioning 40 KB of code. Thanks for the link to RunPrgm.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: c4ooo on February 20, 2017, 06:39:15 PM
Quote from: Snektron on February 20, 2017, 05:29:17 PM
You dont even need ti-basic. You just need a few appvars with relocatable code. If that is not possible, you can just launch one program from another which results in tios copying the program to the code area and running it from there. Or you could make an app like everybody else but who does that anyway.
Too bad its hard to make relocatable code for Axe. I have asked runer112 for .org statements but he said no. I don't remember now, but he had a good reason for it I think.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: E37 on February 20, 2017, 06:53:41 PM
Quote from: c4ooo on February 20, 2017, 06:39:15 PM
Quote from: Snektron on February 20, 2017, 05:29:17 PM
You dont even need ti-basic. You just need a few appvars with relocatable code. If that is not possible, you can just launch one program from another which results in tios copying the program to the code area and running it from there. Or you could make an app like everybody else but who does that anyway.
Too bad its hard to make relocatable code for Axe. I have asked runer112 for .org statements but he said no. I don't remember now, but he had a good reason for it I think.
I asked him recently, and he said because he doesn't know how that part of Axe is structured and that not enough people would know how to use something that low level.  :'(
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 20, 2017, 08:54:55 PM
Now if only Axe would have been open-source like ICE Compiler, many other people could have helped not only porting it to the CSE/CE, but also been able to help others understand how it works based on the source code.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Snektron on February 20, 2017, 09:36:02 PM
Quote from: E37 on February 20, 2017, 05:58:05 PM
Quote from: DJ Omnimaga on February 20, 2017, 05:54:40 PM
Ah I didn't know that pageswap existed for Axe. The DrDnar utility (I think) basically used both a 8xp and an app
That is RunPrgm.
https://www.omnimaga.org/the-axe-parser-project/(axiom)-run-(unarchived)-external-assembly-programs/
It has its own special uses besides running programs. The other things it can do are REALLY awesome in some special cases.

You didn't even link my runprgm axiom :(
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: alexgt on February 21, 2017, 05:28:06 AM
Hmmmmm, this makes me think back to good old JarvAXE, anyone remember him? Or the even the older J.A.R.V.I.S. in Ti-BASIC xD
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Sorunome on February 21, 2017, 04:26:13 PM
Page swapping should be way more efficiant, though......by editing the app header a bit and re-signing you should be able to make that a single app.
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 21, 2017, 06:44:03 PM
Does editing it require some ASM knowledge or other tech-savy stuff?
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Sorunome on February 21, 2017, 06:46:05 PM
it should require modifying the app header, the branch table and re-signing with rabbitsign. So i guess knowing how to use a hex editor and what to look for would help.

This is OFC just theoretical, i haven't done so myself yet ;)
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: Dream of Omnimaga on February 21, 2017, 08:09:28 PM
Ah ok. I guess the easiest solution, assuming you have an easy time dealing with external appvars, would be the hybrid TI-BASIC approach. There's also a way to turn programs into appvars with Tokens IIRC as well as Doors CS 7, to avoid having to clutter the PRGM menu, but both ways either requires Celtic III or Doors CS 7 to be installed on your calculator.


At least hybrid TI-BASIC is good for one thing :trollface:
Title: Re: Making Axe games that uses up to 1.5 MB executable code theoretically possible
Post by: E37 on February 22, 2017, 02:38:41 AM
@Sorunome if you could try that and give me a little tutorial on how to do it, I would be really grateful.
Even a pointer on how the header is structured and how to find what page it is on would be really nice.
Also, do the pages have to be in sequential order in memory?