Author Topic: How to make a 2 pages app with only data on the second page ?  (Read 3927 times)

0 Members and 1 Guest are viewing this topic.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
How to make a 2 pages app with only data on the second page ?
« 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 ?
« Last Edit: September 25, 2012, 01:01:47 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: How to make a 2 pages app with only data on the second page ?
« Reply #1 on: September 27, 2012, 07:29:23 am »
You can't create a 2 page app with axe, due to RAM restrictions.
I'm not a nerd but I pretend:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: How to make a 2 pages app with only data on the second page ?
« Reply #2 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 ;)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: How to make a 2 pages app with only data on the second page ?
« Reply #3 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:

  • Bank 0, 0000-3FFF: ROM 0 (OS core)
  • Bank 1, 4000-7FFF: swappable ROM (applications run here)
  • Bank 2, 8000-BFFF: RAM 1 (all of static RAM, some user RAM)
  • Bank 3, C000-FFFF: RAM 0 (some user RAM, VAT, stack, and other things)

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. :)

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: How to make a 2 pages app with only data on the second page ?
« Reply #4 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...

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: How to make a 2 pages app with only data on the second page ?
« Reply #5 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.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: How to make a 2 pages app with only data on the second page ?
« Reply #6 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.

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.
« Last Edit: September 27, 2012, 05:05:10 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: How to make a 2 pages app with only data on the second page ?
« Reply #7 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.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman