Author Topic: 8X+ > questions about archive structure  (Read 9477 times)

0 Members and 2 Guests are viewing this topic.

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
8X+ > questions about archive structure
« on: April 18, 2014, 08:36:45 am »
Hey there.
I have 2 questions, actually :

1) the swap sector
According to TI offcial documentation (pdf), it can only be either the first ($08>$0B) or the second ($0C>$0F).
According to wikiti, it can be any of the sectors.
I made some quick tests, and it seems that the OS uses only the first & second, but i'd like to be sure...

2) the sector status byte
We're assuming the sector i'm talking about doesn't include any app data at all.
From what i've tested, $FF specifies an empty sector, $F0 a sector used for variable data, $FE a sector used for swap.
What is $FC supposed to specify ? (according to wikiti, it can start with that byte).

Thx in advance =]

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #1 on: April 18, 2014, 10:32:51 am »
Hey there.
I have 2 answers, actually:
  • TI will only ever put the swap sector starting at page $08 or $0C, but technically third-party code could put it somewhere else and the OS should theoretically still function fine. If you need to locate it, I'd recommend using B_CALL(_FindSwapSector). Despite what that documentation says, I wouldn't worry about the swap sector not existing, and the call is not pointless.
  • Sounds like you got a little mixed up about the variable data flag: "The flag byte will be 0FCh (valid) or 0F0h (deleted, ignore it)." To clarify, $FC marks the start of an archived variable and $F0 marks the start of a deleted archived variable to be removed at the next garbage collection. These flags exist at the start of every archived user variable, not just at the start of user archive sectors, but of course if a user archive sector is non-empty, it will start with a user variable, and that will start with $FC or $F0. So if a sector starts with either of those two flags, it's a user variable storage sector.
« Last Edit: April 18, 2014, 10:34:43 am by Runer112 »

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #2 on: April 18, 2014, 10:58:10 am »
Hey there.
I have 2 answers, actually:
  • TI will only ever put the swap sector starting at page $08 or $0C, but technically third-party code could put it somewhere else and the OS should theoretically still function fine. If you need to locate it, I'd recommend using B_CALL(_FindSwapSector). Despite what that documentation says, I wouldn't worry about the swap sector not existing, and the call is not pointless.
  • Sounds like you got a little mixed up about the variable data flag: "The flag byte will be 0FCh (valid) or 0F0h (deleted, ignore it)." To clarify, $FC marks the start of an archived variable and $F0 marks the start of a deleted archived variable to be removed at the next garbage collection. These flags exist at the start of every archived user variable, not just at the start of user archive sectors, but of course if a user archive sector is non-empty, it will start with a user variable, and that will start with $FC or $F0. So if a sector starts with either of those two flags, it's a user variable storage sector.
Thx for the answers =]
About question 2 :
Actually, the sector status byte and the variable status byte are two different things.
I am talking about the sector status byte, not the other one.
For example, if you have a random variable stored at the very begining of the archive, and that variable is valid (not to be deleted), the first byte will be $F0 (meaning the sector is used for variable data storage), followed by $FC (the variable status byte).
In other words, when a variable starts at the begining of a sector, its status byte is the second byte, not the first.
What i want to know is, under which circumstances can the sector status byte be $FC, as mentioned in wikiti.
« Last Edit: April 18, 2014, 11:01:54 am by the_mad_joob »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #3 on: April 18, 2014, 11:01:21 am »
Hey there.
I have 2 answers, actually:
  • TI will only ever put the swap sector starting at page $08 or $0C, but technically third-party code could put it somewhere else and the OS should theoretically still function fine. If you need to locate it, I'd recommend using B_CALL(_FindSwapSector). Despite what that documentation says, I wouldn't worry about the swap sector not existing, and the call is not pointless.
  • Sounds like you got a little mixed up about the variable data flag: "The flag byte will be 0FCh (valid) or 0F0h (deleted, ignore it)." To clarify, $FC marks the start of an archived variable and $F0 marks the start of a deleted archived variable to be removed at the next garbage collection. These flags exist at the start of every archived user variable, not just at the start of user archive sectors, but of course if a user archive sector is non-empty, it will start with a user variable, and that will start with $FC or $F0. So if a sector starts with either of those two flags, it's a user variable storage sector.
Thx for the answers =]
About question 2 :
Actually, the sector status byte and the variable status byte are two different things.
I am talking about the sector status byte, not the other one.
For example, if you have a random variable stored at the very begining of the archive, and that variable is valid (not to be deleted), the first byte will be $F0 (meaning the sector is used for variable data storage), followed by $FC (the variable status byte).
What i want to know is, under which circumstances can the sector status byte be $FC.

Oh, you are indeed correct, I didn't know that. In that case, I have no idea what a status byte of $FC would mean. Are we even sure it exists?

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #4 on: April 18, 2014, 11:05:29 am »
Oh, you are indeed correct, I didn't know that. In that case, I have no idea what a status byte of $FC would mean. Are we even sure it exists?
I absolutely don't know, but i guess if it's mentioned in wikiti, there is a significant chance it does.
I'm sure someone will clarify that =]

I'm thinking of something else about the swap sector.
What happens if the archive is totally full (with no swap sector), then you unarchive a small variable, then perform a garbage collect ?
I mean, can the OS handle garbage collecting without enough space to create a swap sector ?
« Last Edit: April 18, 2014, 11:07:59 am by the_mad_joob »

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #5 on: April 18, 2014, 11:07:29 am »
The swap sector should always exist, so that shouldn't be a problem.

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #6 on: April 18, 2014, 11:09:49 am »
The swap sector should always exist, so that shouldn't be a problem.
Hmm, actually, it seems it is created during the very first garbage collect (according to wabbit, for what it's worth).

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #7 on: April 18, 2014, 11:12:21 am »
The swap sector should always exist, so that shouldn't be a problem.
Hmm, actually, it seems it is created during the very first garbage collect (according to wabbit, for what it's worth).

Anyone have any mint condition calculators to check this with? ... Probably not. :P

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #8 on: April 18, 2014, 11:16:58 am »
I'll try to test that when possible =]

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #9 on: April 18, 2014, 11:30:46 am »
The swap sector should always exist, so that shouldn't be a problem.
Hmm, actually, it seems it is created during the very first garbage collect (according to wabbit, for what it's worth).

Anyone have any mint condition calculators to check this with? ... Probably not. :P
You can just reformat the flash with the key combo (it's indicated on WikiTI).

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #10 on: April 18, 2014, 01:10:39 pm »
Did some more tests with wabbit before trying on physical hardware.
What i tried (no swap sector at the begining of the test) :
1) fill all sectors with apps, except the first one
2) create empty prgmA, then archive it
3) create empty prgmB, then archive it
4) unarchive prgmA
5) garbage collect
Result : OS creates a swap on the 1st sector, erases 2nd sector, and moves prgmB at its begining.
The problem ? 4 app pages destroyed XD
Of course, that shouldn't be too much of a problem on models with lots of flash, but on a basic 83+, that could easily happen if you manage to transfer the maximum number of app pages (10) right after having transfered the OS.
Once again, thx TI !
« Last Edit: April 18, 2014, 01:13:58 pm by the_mad_joob »

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #11 on: April 18, 2014, 01:20:32 pm »
Yay TI made a bad mistake again ! :w00t:

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #12 on: April 19, 2014, 03:05:09 am »
Tested on real hardware, and the swap sector is there after reinstalling a fresh OS (was just a wabbit thing).
About that $FC byte, the OS doesn't really digest it, so i'll assume no variable-dedicated sector can start with it (feel free to tell me if it can).

Since i'm preparing a small app, i have a new question about the swap sector.
For what i've tested, it seems to be only used when garbage collecting and defragmenting.
Anybody knows if it's used in some other context ?
Thx in advance =]
« Last Edit: April 19, 2014, 03:07:52 am by the_mad_joob »

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #13 on: April 19, 2014, 03:57:49 am »
Installing a fresh OS doesn't wipe flash. See the secret key combos page to find something that does. ;)

Offline the_mad_joob

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 346
  • Rating: +47/-0
    • View Profile
Re: 8X+ > questions about archive structure
« Reply #14 on: April 19, 2014, 11:38:29 am »
Installing a fresh OS doesn't wipe flash. See the secret key combos page to find something that does. ;)
True.
I guess under normal circumstances, the swap is always present, if not deleted by some off-OS code.
I just remember having read somewhere that sending stuff with ticonnect erases the swap sector.
Anyway, i'm gonna create a new topic, cause i'll probably need some little help for my mini project.