* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Axe question: How to read archived appvar?  (Read 1259 times)

0 Members and 1 Guest are viewing this topic.

Online JWinslow23

  • Pi is the coolest number in the history of math. :\
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 712
  • Post Rating Ratio: +10/-1
  • Use pi! Pi is the absolute greatest! :(
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Axe question: How to read archived appvar?
« on: October 25, 2015, 08:21:38 pm »
I'm starting work on an old project that is LONG overdue for some work (don't expect it finished ANYTIME soon, however), and I've run into a bit of a problem.

I plan for this one (pretty huge, and it's gonna be huger) appvar to reside in the archive. It contains all the graphical information of the game inside of it. I need to know what code to do to initialize and refer to this appvar throughout the game. I've tried GetCalc("appvAPPVName",Y0) with {Y0+N} and GetCalc("appvAPPVName",Y0)->M with {M+N} , and neither work. The first gives me an error upon compiling, and the other simply gives me glitchy graphics.

So, what do I need to do? Thanks in advance!


  • Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3151
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #1 on: October 25, 2015, 08:34:28 pm »
What does GetCalc("appvAPPVName",Y0)  return? if its 0, you're doing something wrong.

Also WikiTI has a section on flash storage. Maybe you can do something with it :P
http://wikiti.brandonw.net/index.php?title=83Plus:OS:Variable_Storage_in_the_User_Archive
« Last Edit: October 25, 2015, 08:47:44 pm by Cumred_Snektron »
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Online c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 877
  • Post Rating Ratio: +7/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #2 on: October 25, 2015, 09:13:23 pm »
None of the axe graphics routines can read from archive, so either way you will have to copy the graphics data to ram (as i do in lazer II). Further more, reading from a file is, IIRC, about 200 times slower then from ram. Lastly you should not use unarchive/archive, since there is no need to write back.

Getcalc("name",Y0) with {Y0+foo} should work. Remeber, you can only do {Y0+foo}->foo2 and never foo2->{Y0+foo}.

If the appvar has graphics data, your code should look like this:
Code: [Select]
!if Getcalc("appvGRAPHDATA",Y0)?Getcalc("appvTEMP",S)->P .this should be correct
.error graphics data appvar not found or not enough ram
Return
End
Copy(Y0,P,S)
'S' should contain the size of the graphics data. If you dont know it you should mod your program that creates the graphics data to output the size. After this code, 'P' contains the graphics data.

 ;)

PS: if you want, i could send over some of the code for lazer I that deals with this.
« Last Edit: October 25, 2015, 09:15:49 pm by c4ooo »
??? ??? ???
C'est une signature

Online JWinslow23

  • Pi is the coolest number in the history of math. :\
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 712
  • Post Rating Ratio: +10/-1
  • Use pi! Pi is the absolute greatest! :(
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #3 on: October 25, 2015, 09:38:20 pm »
What does GetCalc("appvAPPVName",Y0)  return? if its 0, you're doing something wrong.

Also WikiTI has a section on flash storage. Maybe you can do something with it :P
http://wikiti.brandonw.net/index.php?title=83Plus:OS:Variable_Storage_in_the_User_Archive
37170.

None of the axe graphics routines can read from archive, so either way you will have to copy the graphics data to ram (as i do in lazer II). Further more, reading from a file is, IIRC, about 200 times slower then from ram. Lastly you should not use unarchive/archive, since there is no need to write back.

Getcalc("name",Y0) with {Y0+foo} should work. Remeber, you can only do {Y0+foo}->foo2 and never foo2->{Y0+foo}.

If the appvar has graphics data, your code should look like this:
Code: [Select]
!if Getcalc("appvGRAPHDATA",Y0)?Getcalc("appvTEMP",S)->P .this should be correct
.error graphics data appvar not found or not enough ram
Return
End
Copy(Y0,P,S)
'S' should contain the size of the graphics data. If you dont know it you should mod your program that creates the graphics data to output the size. After this code, 'P' contains the graphics data.

 ;)

PS: if you want, i could send over some of the code for lazer I that deals with this.
I really wonder, then, how FNAF got away with three >39KB appvars and doing this for each of them :P
That code IS working, though, granted I'm not so sure I'd want the entire appvar to be copied to another appvar that's exactly the same when I could unarchive the appvar and read from it directly to cut out the middle man. Nice to know my options, though.

Online c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 877
  • Post Rating Ratio: +7/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #4 on: October 25, 2015, 09:49:10 pm »
If you where to unarchive, then you would have to re-archive the appvar. This would mean extra time when exiting, plus the possibility of having to garbage collect. With my method, you have the data safe in the archive (runer112 confirmed that the archived data is never copied to rome), while you also have a copy in ram. About, FNAF, you should ask Hoabo (IIRC his name), as he was the one who made it.
??? ??? ???
C'est une signature

Online JWinslow23

  • Pi is the coolest number in the history of math. :\
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 712
  • Post Rating Ratio: +10/-1
  • Use pi! Pi is the absolute greatest! :(
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #5 on: October 25, 2015, 10:09:52 pm »
If you where to unarchive, then you would have to re-archive the appvar. This would mean extra time when exiting, plus the possibility of having to garbage collect. With my method, you have the data safe in the archive (runer112 confirmed that the archived data is never copied to rome), while you also have a copy in ram. About, FNAF, you should ask Hoabo (IIRC his name), as he was the one who made it.
Noted. This looks similar to what he used in his FNAF game, looking at the source. However, it appears he doesn't save the pointer to a variable. I'm too lazy to look into it further :P , but thanks for the info. ;)

Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 323
  • Post Rating Ratio: +12/-0
    • View Profile
Re: Axe question: How to read archived appvar?
« Reply #6 on: October 25, 2015, 11:19:49 pm »
You don't have to copy the data from your archives appvar to an unarchived appvar by the way. You can also copy it to any safe RAM area ;)
This would have some little advantages here and there, like
  • No need to have free RAM, just use RAM that is always free, and no need for code that detects errors in case of not enough RAM
  • Save a variable (the one you store the pointer to your appvar in) and save variable loading so be a tiny bit faster
  • No risk of appvar name conflict

Online JWinslow23

  • Pi is the coolest number in the history of math. :\
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 712
  • Post Rating Ratio: +10/-1
  • Use pi! Pi is the absolute greatest! :(
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #7 on: October 25, 2015, 11:35:19 pm »
You don't have to copy the data from your archives appvar to an unarchived appvar by the way. You can also copy it to any safe RAM area ;)
This would have some little advantages here and there, like
  • No need to have free RAM, just use RAM that is always free, and no need for code that detects errors in case of not enough RAM
  • Save a variable (the one you store the pointer to your appvar in) and save variable loading so be a tiny bit faster
  • No risk of appvar name conflict
Not enough. Already, the graphics data is approaching 5KB. :P

Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 323
  • Post Rating Ratio: +12/-0
    • View Profile
Re: Axe question: How to read archived appvar?
« Reply #8 on: October 26, 2015, 07:12:08 am »
Well, maybe you don't need to copy all that data at once.
In Pokemon for example, while in the overworld, you need tilemap sprites but you don't need battle sprites. Conversely, in battle you need battle sprites but you don't need tilemap sprites. And in both cases, you don't need to have the titlescreen background in RAM, etc. So you can partially "unarchive" your data when "changing mode" (actually, Topaze works in a stupider way, it only copies one sprite to RAM at once and everytime it needs it :P). So maybe you can do something like that ?

Online JWinslow23

  • Pi is the coolest number in the history of math. :\
  • Super User
  • CW 4x3 challenge - 2nd place
  • *
  • Join Date: May 2015
  • Location: Somewhere between 13 and Graham's Number
  • Posts: 712
  • Post Rating Ratio: +10/-1
  • Use pi! Pi is the absolute greatest! :(
    • @UCu_9qD95nADzc-W6RN-3Z8A
    • 113/11328
    • View Profile
  • Gender: Male
Re: Axe question: How to read archived appvar?
« Reply #9 on: October 26, 2015, 10:55:52 pm »
Well, maybe you don't need to copy all that data at once.
In Pokemon for example, while in the overworld, you need tilemap sprites but you don't need battle sprites. Conversely, in battle you need battle sprites but you don't need tilemap sprites. And in both cases, you don't need to have the titlescreen background in RAM, etc. So you can partially "unarchive" your data when "changing mode" (actually, Topaze works in a stupider way, it only copies one sprite to RAM at once and everytime it needs it :P). So maybe you can do something like that ?
Does not make sense for my program, and it would be impractical anyways. All of the graphics in the appvar will go to the board and your character. Besides, the cursor sprite is in there somewhere! :P

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games