Author Topic: Quick question about archived programs' VAT entries  (Read 8639 times)

0 Members and 1 Guest are viewing this topic.

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Quick question about archived programs' VAT entries
« on: April 04, 2011, 12:04:25 pm »
OK, if anyone's been following Cubes, I'm making an editor. By necessity, that also includes a level browser, and I'm using the VAT routines in the Routines thread to make one: however, while that approach works fine with unarchived programs (I believe the start of the var is at {P-4}rr? I've got it written down somewhere.), with archived programs I don't see an easy way of accessing the data. The best I can come up with is on-the-fly assembling a name string to pass to GetCalc(), which seems like a huge kludge to me. Is there any easier way?

Thanks.
« Last Edit: April 04, 2011, 12:04:46 pm by JustCause »
See you, space cowboy...

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #1 on: April 04, 2011, 12:11:43 pm »
So do you need a way to read the archived data and obtain information about it?

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #2 on: April 04, 2011, 12:13:12 pm »
Obtaining information, not so much (that's all in the entry, right?). But I would like a way to read from it.
See you, space cowboy...

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #3 on: April 04, 2011, 12:19:47 pm »
Okay, well if the program is going to be an app, then it will be a little more complicated (not too complicated, though). How do you want to read it? Is there a specific number of bytes you plan to read? Or will it be variable?

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #4 on: April 04, 2011, 12:25:30 pm »
The program isn't an app, and I'll need to read the entire thing (which will be of variable length).
See you, space cowboy...

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #5 on: April 04, 2011, 12:27:04 pm »
Okay! Also, I just realised that it won't actually be any more difficult for an App XD. So that helps... where do you want to copy the data to?

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #6 on: April 04, 2011, 12:28:34 pm »
Free RAM. L1 ideally, though it can be any free location.
See you, space cowboy...

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #7 on: April 04, 2011, 12:30:06 pm »
Okay, so will the var be guaranteed to be small enough to fit there? And do you by any chance know the address of L1? (I can find it if you don't). I almost have the code ready :D

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #8 on: April 04, 2011, 12:33:29 pm »
I think it's just saveSscreen, and...damn, you're right, it'll need to be copied in bits...these levelsets, even with RLE, are liable to be effing huge...graar. Okay, maybe it'd be simpler to just assemble the name string. It'll need to copy from a variable point within the data until a sentinel value...yea, this might be more trouble than it's worth. :) Am I wrong?
« Last Edit: April 04, 2011, 12:36:47 pm by JustCause »
See you, space cowboy...

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #9 on: April 04, 2011, 12:41:25 pm »
I understood almost none of that XD Is there a maximum size that it will need to be? If so, you could create an appvar as a temporary memory buffer.

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #10 on: April 04, 2011, 01:50:22 pm »
Err...okay, I'll put a better explanation up soon. Basically, the levelset data is stored in one location as raw data separated by 254s, and each level needs to be loaded separately into a writable location.
See you, space cowboy...

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #11 on: April 04, 2011, 03:19:00 pm »
This shouldn't be that difficult. A link to The Psyche is in my sig: I made a levelpack editor as well and I have a very nice routine that assembles the name string and everything. XXEdit's search function also does something similar. Anyway, basically the name string is pretty easy to build, just prefix your data with a 5 for reg. program, 6 for prot. prog, and 21 for appvar. So the name string data for an appvar called LOL is [15]"LOL"[00]... and if that data is stored in L1 you can just use L1 as your GetCalc argument with no issues.

Also you may want to only allow reading levels from archive, since I don't think many people would actually prefer having them in RAM anyway.
« Last Edit: April 04, 2011, 03:19:07 pm by squidgetx »

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #12 on: April 08, 2011, 02:21:53 pm »
Also you may want to only allow reading levels from archive, since I don't think many people would actually prefer having them in RAM anyway.
True, true...Thanks. I totally forgot about The Psyche. Strange, considering it's been on my calc for about two months now. Thanks a lot.
See you, space cowboy...

Offline DrDnar

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 546
  • Rating: +97/-1
    • View Profile
Re: Quick question about archived programs' VAT entries
« Reply #13 on: April 08, 2011, 02:37:24 pm »
If you need to read data from the archive and don't care about speed, the OS provides several helpful routines for reading data from the archive: FlashToRam, copies an arbitrary block of data from the archive to RAM; PagedGet, used with SetupPagedPtr, lets you read and process data a byte at a time; LoadCIndPaged, reads a byte from any ROM page; and LoadDEIndPaged, reads a word from any ROM page. All of these automatically deal with wrapping, too.
« Last Edit: April 08, 2011, 02:37:56 pm by DrDnar »
"No tools will make a man a skilled workman, or master of defense, nor be of any use to him who has not learned how to handle them, and has never bestowed any attention upon them. . . . Yes, [] the tools which would teach men their own use would be beyond price."—Plato's The Republic, circa 380 BC

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Quick question about archived programs' VAT entries
« Reply #14 on: April 08, 2011, 02:39:14 pm »
If you need to read data from the archive and don't care about speed, the OS provides several helpful routines for reading data from the archive: FlashToRam, copies an arbitrary block of data from the archive to RAM; PagedGet, used with SetupPagedPtr, lets you read and process data a byte at a time; LoadCIndPaged, reads a byte from any ROM page; and LoadDEIndPaged, reads a word from any ROM page. All of these automatically deal with wrapping, too.
DrDnar: you maybe didnt see that this was in the Axe Language section. Nice explaination, though ;)
I'm not a nerd but I pretend: