Re: A89: the VAT


[Prev][Next][Index][Thread]

Re: A89: the VAT




>I guess I'm confused.  I have also read about this 'garbage collection'
>but...
>
>1) Create a variable  (located in RAM, right)
>2) Archive this variable (located in Flash, right)
>3) Unarchive a variable (moved to RAM, right)
>4) Change the variable (still in RAM, right)
>5) Archive that variable (isn't this moved to Flash, if it is it must
>be rewritten, since it was changed). Or is it still in RAM?  If so then
>archiving does not archive.  How does one to know if something is in RAM
>or Flash, if it not putinto Flash when one archives?

Try
1) Create a small variable  (located in RAM, right)
2) Archive this variable (located in Flash, right)
3 ) Create a larger variable  (located in RAM, right)
4) Archive this variable (located in Flash, right)
5) Unarchive the first variable
6) Repeat while making the small variable slightly bigger each time

When the calc stores something in the archive, it uses the first empty spot
it can fit it in.  It performs a garbage collection when the ROM is not yet
full, but there are holes too small to fit a variable in for archiving.
Here's an example with a 16-b ROM, all data is 1, empty is 0.  The variable
is not really erased from the ROM when it is unarchived, but to make this
easy to read I'm going to.

Archive the small variable
1000 0000 0000 0000

Archive a larger variable
1111 1000 0000 0000

Unarchive the smaller one
0111 1000 0000 0000

Repeat

Archive the small variable
0111 1110 0000 0000

Archive a larger variable
0111 1111 1110 0000

Unarchive the smaller one
0111 1001 1110 0000

Archive the small variable
0111 1001 1111 1100

When it comes time to archive the 4-b variable there is no room at the end,
but there is still enough room in the ROM.  A garbage collection is
performed and everything is compacted over to the left, getting rid of the
empty space.
1111 1111 1110 0000


And that's how it works

	--Nate


References: