Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Hayleia on September 24, 2012, 03:01:59 pm

Title: How to make a 2 pages app with only data on the second page ?
Post by: Hayleia on September 24, 2012, 03:01:59 pm
Well TinyCraft now takes 16292 bytes. This means that the solutions are:
-optimizing (but I am not good at this and I guess no one would like to optimize my mess :P)
-get some more data out in archived appvars (there are already like 3000 bytes of data already in this case but I'd lose track of my pointers)
-get another page so I can put all my data on the second page and have more space for the code

And among the three solutions, I prefer the last one (so I can have everything in one place instead of having separate appvars).
But how ?

Couldn't an Axiom be made about this or isn't there a method with uncompiling the app then recompiling again ?
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: aeTIos on September 27, 2012, 07:29:23 am
You can't create a 2 page app with axe, due to RAM restrictions.
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: Hayleia on September 27, 2012, 12:28:45 pm
You can't create a 2 page app with axe, due to RAM restrictions.
Yes, but I said "or isn't there a method with uncompiling the app then recompiling again" ;)
Also, it could first compile the first page then start over with fresh ram to compile the second one, so still no ram restriction ;)
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: Runer112 on September 27, 2012, 02:37:43 pm
RAM usage while compiling isn't a huge issue, since I'm sure with some changes to Axe, applications could be written straight to flash. The issue is how the app will actually run in the calculator's memory layout, which is split into four 16KB banks as follows:


For all intents and purposes, bank 1 is the only memory bank applications can occupy, which gives the 16KB limit. Multi-page apps allow you to have more than one 16KB page, but the issue is then that only a part of the application can be mapped into memory at one time. You then have to have special handling for calls, jumps, or memory reads that gap pages of your application. Assembly developers who make multi-page apps can intelligently decide where to put routines and data such that the amount of page swapping needed is minimal, and they can create custom routines to operate on off-page data. However, performing this analysis on arbitrary Axe code and knowing when page swaps are necessary is a much tougher challenge.

But I assure you that methods of tackling this tough challenge are on the back burner, so it might come to fruition some day. :)
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: squidgetx on September 27, 2012, 02:38:04 pm
As far as I know, no way to do it in pure Axe, you'll have to wait for someone really familiar with the OS/asm to show up

It's probably going to end up easier to optimize and move out data than figuring it out though...
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: calc84maniac on September 27, 2012, 02:53:19 pm
I remember throwing around some ideas for this before, like static pointers to data stored on another app page could be specially treated by the compiler much like file variables, but it would call routines to translate any resulting 16-bit pointers to paged reads based on the base app page rather than the page stored in a file variable. This would allow for up to 64KB of data to be stored on other app pages, for 80KB (5-page) apps at the most, which seems like more than enough.
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: thepenguin77 on September 27, 2012, 05:02:13 pm
Without modifying Axe, here's what the solution would look like:

First, you would have to make the information that's going to go on the data page. I'm not exactly sure how you would go about doing this in a nice manner, but I guess your choices would be an all data axe program, making an all data asm program (easier than you think), or hex editing a file (scary).

At this point, you would have to know the locations of all of the data structures in this file. So data1 at 0000, data2 at 0010, data3 at 001A, etc. This would be a rather mess to do by hand, which is why I suggested the asm program. (You could simply .echo all of the labels for the data).

An axiom would have to be created to access this data. What you would do is pass the axiom the pointer to the data, the size of the data, and where you want to put it in ram. The main problem here is that these would have to be static addresses, you could make them all variables, but every time you mess with the data page, you're going to have to resynchronize.

The last step, which is also the sketchiest step, would be to compile you program with axe, and then use another program to slap the data onto the back of the app and fix all the header information. This can be done, it's just a little messy.


So, without modifying axe, that's what the solution would be. I could do it, but I feel like the manual data location thing would get annoying really fast. Imaging having 100 different data segments and you add a byte to the first one, that's a lot of number changing. (Though, xeda could do it)

And of course, since it's me, I'll offer the alternative of fullrene (http://ourl.ca/13513/293560).

Edit:
    I suppose an Axe include file could fix the label issue, I'm just not sure how to generate one from the input data.
Title: Re: How to make a 2 pages app with only data on the second page ?
Post by: calc84maniac on September 27, 2012, 05:15:45 pm
Yeah, I think an Axe include file would be possible, where the data-generating program would generate a bunch of definitions of constant Axe variables.