CodeWalrus

Development => Calculators => Calculator News, Coding, Help & Talk => Topic started by: kotu on November 14, 2016, 09:59:20 AM

Title: Storing code/functions in a .8xv file as a library
Post by: kotu on November 14, 2016, 09:59:20 AM
Is it trivial to do this? @MateoConLechuga ? lol. or anyone

my game is coming close to the upper size limit, not sure if it will make it at the moment. there's not much space for code lol

thanks!
Title: Re: Storing code/functions in a .8xv file as a library
Post by: Snektron on November 14, 2016, 10:03:21 AM
It is possible, but note that it can only contain relocatable code since it isnt guaranteed where in ram the 8xv lies. That means only jumps smaller than 128 bytes and for larger ones a bigger piece of code which adds the base address.
Title: Re: Storing code/functions in a .8xv file as a library
Post by: kotu on November 14, 2016, 10:05:31 AM
Quote from: Snektron on November 14, 2016, 10:03:21 AM
It is possible, but note that it can only contain relocatable code since it isnt guaranteed where in ram the 8xv lies. That means only jumps smaller than 128 bytes and for larger ones a bigger piece of code which adds the base address.

what does that mean if the functions are in c? i have no idea how big the jumps are lol

sounds like it would probably be easier to store the graphics in their own file

thanks
Title: Re: Storing code/functions in a .8xv file as a library
Post by: Dream of Omnimaga on November 14, 2016, 08:37:47 PM
Ideally, you need to make sure that all text/graphics in the game is displayed using the same piece of code and stored into a data application variable, to keep the code size down. Hardcoding everything (eg one piece of code per animation) is going to make the code size skyrocket.

Another alternative that is not the ideal solution but could work as last resort is to make the game an hybrid TI-BASIC and C game, where the BASIC program acts solely as a launcher, combined with XCOPY or something else that can copy archived files to RAM, and then you have one C program per game part (eg one for the intro/menus and another for the game part). In such case you would need to return several values into an appvar so that once one of the C programs is quit, those values can be retrieved by the next C program. Such hybrid TI-BASIC/C game would give you unlimited code space.
Title: Re: Storing code/functions in a .8xv file as a library
Post by: Snektron on November 14, 2016, 10:05:03 PM
Quote from: kotu on November 14, 2016, 10:05:31 AM
Quote from: Snektron on November 14, 2016, 10:03:21 AM
It is possible, but note that it can only contain relocatable code since it isnt guaranteed where in ram the 8xv lies. That means only jumps smaller than 128 bytes and for larger ones a bigger piece of code which adds the base address.

what does that mean if the functions are in c? i have no idea how big the jumps are lol

sounds like it would probably be easier to store the graphics in their own file

thanks

Yeah, it would probably be easier to do that :P

What you can do too is store the code in an appvar, but copy it to some free ram area.
Title: Re: Storing code/functions in a .8xv file as a library
Post by: Sorunome on November 14, 2016, 10:08:09 PM
Which platform (calculator) is this for?
Title: Re: Storing code/functions in a .8xv file as a library
Post by: Dream of Omnimaga on November 14, 2016, 10:08:47 PM
TI-83 Premium CE, TI-84 Plus CE and TI-84 Plus CE-T (I think he mainly uses C)