Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Raylin on June 14, 2010, 10:37:35 am

Title: External level support?
Post by: Raylin on June 14, 2010, 10:37:35 am
Okay.

This has been alluded to before in another topic, but I need to understand.
How exactly would one get external data from another program?
Title: Re: External level support?
Post by: ztrumpet on June 14, 2010, 10:40:57 am
I'm pretty sure you need to use the GetCalc( function. :)
Title: Re: External level support?
Post by: Raylin on June 14, 2010, 10:44:49 am
Then, use the {PTR+OFFSET} to get the data?
How do you type that data out in the level file?
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 10:55:06 am
Well, the way I do it is to make the level data that is stored in your source code stored in a separate AppVar, then load the pointer into your program and display that one instead of the level stored in the source code.
Title: Re: External level support?
Post by: Raylin on June 14, 2010, 11:20:25 am
Wait. Wait. Wait.

Are you implying that Axe can use SMC? :D :D

Explain.
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 11:23:54 am
A) Axe can use SMC
B) No, that is not what I'm talking about.
Normally for levels, you would have the data embedded in the source code, like a tilemap, right?  Well, just embed a tilemap in an appvar and open the appvar in your program.  Point your tilemapper to the appvar instead of the original tilemap.  For instance, if a tilemap is stored internally in GDB1, and you open an appvar containing a tilemap and point to it with {P}, then tell your tilemapper to draw {P} instead of {GDB1}.
Title: Re: External level support?
Post by: Raylin on June 14, 2010, 11:25:27 am
WOW! I didn't know you can do that! Thanks!
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 11:26:22 am
Sure.
Title: Re: External level support?
Post by: Raylin on June 14, 2010, 11:30:31 am
I still have one more question though...

How does the data in the appvar look? How is it accessed? Could I store things like text and such inside?
I ask because I was thinking of making a large RPG and I need to store chapters of the game on one calc. They all won't fit in RAM.
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 11:33:17 am
Well, it is accessed with GetCalc(.  Read up some documentation about that.  You can write textual data using the program editor in TIOS, and convert it to an AppVar with CalcSys or one of many other utilities.  You can write hex data or maps using CalcSys or Axe.
Title: Re: External level support?
Post by: ztrumpet on June 14, 2010, 11:55:08 am
An AppVar looks just like a program only it's meant for data storage rather than to be executed.  In Axe you're mainly looking at numbers, so it's easiest to put numbers in the AppVar.  (imho) :)
Good luck. :D
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 12:16:07 pm
This is actually a pretty good topic for the guide, I should include this.
Title: Re: External level support?
Post by: DJ Omnimaga on June 14, 2010, 01:20:38 pm
I assume the appvar will most likely look like garbage if you convert it to program (for example with Cooliojazz shell or using Celtic III) then unlock it, so you won't be able to edit it like BASIC. You will need to make some sort of map editor (something I failed at, prbly due to all the scrolling and stuff) to update your levels.
Title: Re: External level support?
Post by: Deep Toaster on June 14, 2010, 04:40:23 pm
If the AppVar used data in the form of BASIC tokens, editing using the BASIC program editor could be possible...

But then, it'd be somewhat awkward editing maps using a program editor.
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 06:44:58 pm
Quote from: DJ Omnimaga
I assume the appvar will most likely look like garbage if you convert it to program (for example with Cooliojazz shell or using Celtic III) then unlock it, so you won't be able to edit it like BASIC. You will need to make some sort of map editor (something I failed at, prbly due to all the scrolling and stuff) to update your levels.
Well, textual AppVars could be opened with the TIOS program editor just fine.  Maps, on the other hand, wouldn't open too well.
Title: Re: External level support?
Post by: DJ Omnimaga on June 14, 2010, 11:42:12 pm
By textual do you mean text data shows the actual ASCII characters?
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 11:42:46 pm
Yes.  I mean, an appvar that contains the ASCII representation of a string.
Title: Re: External level support?
Post by: DJ Omnimaga on June 14, 2010, 11:49:31 pm
aaah good.
Title: Re: External level support?
Post by: Raylin on June 14, 2010, 11:52:15 pm
How do you change a program into an appvar through CalcSys?
Title: Re: External level support?
Post by: SirCmpwn on June 14, 2010, 11:53:36 pm
Go to the VAT entry and change the ID.
I think it's documented in the zip file.
Title: Re: External level support?
Post by: DJ Omnimaga on June 14, 2010, 11:54:19 pm
I don't remember. I just used that shell thing Cooliojazz posted in "Projects: Post and critique" a few days ago. Be careful, though, it's a bit buggy if you do something wrong, but it lets you change programs into appvars and unlock them. I think they need to be at least 5 char names, though

Otherwise there is Celtic III' by Iambian, but I do not know how.
Title: Re: External level support?
Post by: Raylin on June 15, 2010, 09:38:55 am
If I use GetCalc(Str1), does that make an appvar of unknown length? Can I just keep dumping stuff into it or do I need to declare the size? Also, when I do that, do I need to specify the size IN BYTES?
Title: Re: External level support?
Post by: Ikkerens on June 15, 2010, 09:59:20 am
I believe getcalc without size only tries to find the appvar. Returning a 0 if it doesn't exist.
Could be wrong tho.
Title: Re: External level support?
Post by: Raylin on June 15, 2010, 10:06:38 am
Go to the VAT entry and change the ID.
I think it's documented in the zip file.

I looked in there. No documentation exists of this feature. Explain please?
Title: Re: External level support?
Post by: Deep Toaster on June 15, 2010, 04:25:57 pm
I believe getcalc without size only tries to find the appvar. Returning a 0 if it doesn't exist.
Could be wrong tho.

Yeah, that's it.

Go to the VAT entry and change the ID.
I think it's documented in the zip file.

I looked in there. No documentation exists of this feature. Explain please?

Don't know exactly how to do it with CalcSys, but I believe there's one byte for each VAT entry (I think it's the first one counting backwards, called T) that designates what type of variable it is. Changing just that one byte will change whether the data is a program or an AppVar.
Title: Re: External level support?
Post by: Raylin on June 15, 2010, 04:47:44 pm
Do you know the address of that byte? And the numbers that you're allowed to change it to?
Title: Re: External level support?
Post by: Deep Toaster on June 15, 2010, 05:04:38 pm
Tried it out on WabbitEmu. I changed the AppVar AxeData into a prgm just for the fun of it :D.

1. Go into CalcSys (duh).
2. Select 6. More.
3. Select 1. VAT.
4. Select 1. Prog/List VAT (which lists all the data for programs, AppVars, and lists).
5. Find AxeData. If it's not there, select 6. Next until you do find it.
6. Select it (by pressing the corresponding number key).
7. CalcSys will show you a screen full of information about the AppVar. Press ALPHA+[V] to edit its VAT entry.
8. Conveniently, the byte at T for AxeData is already pointed to for you. Just press ENTER to edit the byte and change it to 05 (ProgObj).
9. Press CLEAR twice to exit the app. AxeData should now be visible in the program menu (don't edit it).
10. Remember to undo all of it when you're done, or just delete the program AxeData.

Changing a program into an AppVar is the same, except you want to change the byte from 05 (ProgObj) to 15 (AppVarObj).
Title: Re: External level support?
Post by: calc84maniac on June 15, 2010, 05:06:50 pm
Do you know the address of that byte? And the numbers that you're allowed to change it to?

If you search through the Program/List VAT in Calcsys and select your program, you can press Alpha+V to view the VAT data in the hex editor. The byte you see then should either be a 5 or a 6 (for unlocked or locked). Change that value to 15h to change it to an appvar.
Title: Re: External level support?
Post by: Deep Toaster on June 15, 2010, 05:12:11 pm
Do you know the address of that byte? And the numbers that you're allowed to change it to?


To quote from the ti83plus.inc (http://education.ti.com/downloads/files/computer_software/sdk_83p/ti83plus.inc) include file:

;======================================================================
;           Data Type Equates                                                    
;======================================================================
;
RealObj         EQU       0
ListObj         EQU       1
MatObj          EQU       2
EquObj          EQU       3
StrngObj        EQU       4
ProgObj         EQU       5
ProtProgObj     EQU       6
PictObj         EQU       7
GDBObj          EQU       8
UnknownObj      EQU       9
UnknownEquObj   EQU       0Ah
NewEquObj       EQU       0Bh
CplxObj         EQU       0Ch
CListObj        EQU       0Dh
UndefObj        EQU       0Eh
WindowObj       EQU       0Fh
ZStoObj         EQU       10h
TblRngObj       EQU       11h
LCDObj          EQU       12h
BackupObj       EQU       13h
AppObj          EQU      14h      ;application, only used in menus/link
AppVarObj       EQU      15h      ;application variable
TempProgObj     EQU       16h           ;program, home deletes when finished
GroupObj        EQU       17h           ;group.


You can change the value to any of these hex numbers, except that most of them will probably mess up your calculator since the data takes different formats. Programs and AppVars can be exchanged fine since they have such similar data formats.