Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: macweirdo on November 20, 2011, 04:39:34 pm

Title: Free RAM and drawing stuff
Post by: macweirdo on November 20, 2011, 04:39:34 pm
So let's say I wanted to have a way to store two bits per pixel on the screen (768 bytes of data, * 2.) into RAM so I could manipulate it. How would I go about doing this, and which safeRam areas should I use (if I use L6, I'll just end up drawing directly to the screen, but I want 4scale as well, and I know it's possible.)

The first one, I'm guessing might be L3, and everytime I want to access data, I'll just do
for bit one:
Code: [Select]
{L3}+(number of pixel)
and bit two:
Code: [Select]
{other safeRam}+(number of pixel)
so to draw the screen, I just have to do a
Code: [Select]
DispGraph(L3,other safeRam)^r
So tl;dr, which safeRam besides L3 should I use for holding the entire screen?
Thanks in advance!
Title: Re: Free RAM and drawing stuff
Post by: ztrumpet on November 20, 2011, 04:58:04 pm
You could wither use L6, which is the main buffer, or use L1 after Reallocating the variables elsewhere. To reallocate the variables, use something like #Realloc(L4).
Good luck. :)
Title: Re: Free RAM and drawing stuff
Post by: macweirdo on November 20, 2011, 05:01:41 pm
use L6, which is the main buffer

You're serious? Waht? Doesn't that corrupt buffer drawing or something? (btw, I don't understand that statement)

Good luck. :)

Looks like I'll need it. Thanks :D
Title: Re: Free RAM and drawing stuff
Post by: ztrumpet on November 20, 2011, 05:07:58 pm
use L6, which is the main buffer

You're serious? Waht? Doesn't that corrupt buffer drawing or something? (btw, I don't understand that statement)
The main buffer is what gets displayed with a DispGraph.  If there's something else there, that will be drawn instead.
For instance, try this code and see if you can figure out what is happening:
Code: [Select]
:ClrDraw
:255->{L6}
:rand->{L6+766}r // This is the superscript r
:DispGraph
:Repeat getKey(15)
:End
Title: Re: Free RAM and drawing stuff
Post by: macweirdo on November 20, 2011, 05:12:20 pm
use L6, which is the main buffer

You're serious? Waht? Doesn't that corrupt buffer drawing or something? (btw, I don't understand that statement)
The main buffer is what gets displayed with a DispGraph.  If there's something else there, that will be drawn instead.
For instance, try this code and see if you can figure out what is happening:
Code: [Select]
:ClrDraw
:255->{L6}
:rand->{L6+766}r // This is the superscript r
:DispGraph
:Repeat getKey(15)
:End

So storing data there is just like doing a Pxl-On( to that buffer?
Title: Re: Free RAM and drawing stuff
Post by: AngelFish on November 20, 2011, 05:58:59 pm
Kind of, yes. Pxl-On( places the sprite data in a specific arrangement on the buffer.
Title: Re: Free RAM and drawing stuff
Post by: ztrumpet on November 20, 2011, 05:59:27 pm
use L6, which is the main buffer

You're serious? Waht? Doesn't that corrupt buffer drawing or something? (btw, I don't understand that statement)
The main buffer is what gets displayed with a DispGraph.  If there's something else there, that will be drawn instead.
For instance, try this code and see if you can figure out what is happening:
Code: [Select]
:ClrDraw
:255->{L6}
:rand->{L6+766}r // This is the superscript r
:DispGraph
:Repeat getKey(15)
:End

So storing data there is just like doing a Pxl-On( to that buffer?
Kind of.  It's just another way of drawing stuff.
Remember that the data on the buffer is stored in binary, and because of this 255 = FFh = 11111111b makes 8 pixels in a row black.
Title: Re: Free RAM and drawing stuff
Post by: macweirdo on November 20, 2011, 07:48:36 pm
use L6, which is the main buffer

You're serious? Waht? Doesn't that corrupt buffer drawing or something? (btw, I don't understand that statement)
The main buffer is what gets displayed with a DispGraph.  If there's something else there, that will be drawn instead.
For instance, try this code and see if you can figure out what is happening:
Code: [Select]
:ClrDraw
:255->{L6}
:rand->{L6+766}r // This is the superscript r
:DispGraph
:Repeat getKey(15)
:End

So storing data there is just like doing a Pxl-On( to that buffer?
Kind of.  It's just another way of drawing stuff.
Remember that the data on the buffer is stored in binary, and because of this 255 = FFh = 11111111b makes 8 pixels in a row black.
Yeah, don't worry, I have prior programming experience.

EDIT: why do I have -3 karma?
Title: Re: Free RAM and drawing stuff
Post by: Yeong on November 20, 2011, 08:06:09 pm
track your posts. You'll see which posts got derated.
Title: Re: Free RAM and drawing stuff
Post by: Michael_Lee on November 21, 2011, 12:11:30 am
Just an FYI, if you absolutely needed more free ram and all the buffers are taken, you could create an appvar and use that:

Code: [Select]
getCalc("appvMYAPPV", 766)->A
3->{A+766}
DispGraph(L3,A)^^r

You could also do something like
Code: [Select]
Buff(766,0)->A
3->{A+766}
DispGraph(L3,A)^^r
...although you'd be adding the buffer directly to the program itself (inflating its size by 766 bytes) + I don't think you can modify buffers you have inside the program if you turn your program into an app.
Title: Re: Free RAM and drawing stuff
Post by: calc84maniac on November 21, 2011, 09:25:34 am
Two things I must mention. First, buffers are 768 bytes. Second, creating a variable of size 766 in A and storing a value to A+766 will corrupt whatever is next in memory. Why is 3 being stored there, anyway?
Title: Re: Free RAM and drawing stuff
Post by: AngelFish on November 21, 2011, 10:23:39 am

EDIT: why do I have -3 karma?


Because three people disliked this post (http://ourl.ca/7063/187581) and downvoted it.
Title: Re: Free RAM and drawing stuff
Post by: macweirdo on November 21, 2011, 07:56:29 pm

EDIT: why do I have -3 karma?


Because three people disliked this post (http://ourl.ca/7063/187581) and downvoted it.

Deleted it because I recently lost respect even though that post is ancient. Thanks for taking the time to find that post :D

EDIT To prevent a double post:

Just an FYI, if you absolutely needed more free ram and all the buffers are taken, you could create an appvar and use that:

Code: [Select]
getCalc("appvMYAPPV", 766)->A
3->{A+766}
DispGraph(L3,A)^^r

You could also do something like
Code: [Select]
Buff(766,0)->A
3->{A+766}
DispGraph(L3,A)^^r
...although you'd be adding the buffer directly to the program itself (inflating its size by 766 bytes) + I don't think you can modify buffers you have inside the program if you turn your program into an app.

I'm trying to keep it as fast as I can, but I'm never making it an App, this program might be less than 1500 bytes.
Can't wait to release my first Axe game :D
Title: Re: Free RAM and drawing stuff
Post by: Michael_Lee on November 22, 2011, 01:44:11 am
Two things I must mention. First, buffers are 768 bytes. Second, creating a variable of size 766 in A and storing a value to A+766 will corrupt whatever is next in memory.
Ah, you're right.  I was just copying down the numbers/examples that were used before.  Whoops.

Why is 3 being stored there, anyway?
No reason.  Prime numbers are cool, I guess.