Why does the tv_terminal take so much memory?
CJ
Posts: 470
while the graphics demo takes so little
graphics demo 1500 longs of code and 226 longs of variables vs. terminal 1200 of code and 3500 for variables
just wondering why.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who says you have to have knowledge to use it?
I've killed a fly with my bare mind.
graphics demo 1500 longs of code and 226 longs of variables vs. terminal 1200 of code and 3500 for variables
just wondering why.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Who says you have to have knowledge to use it?
I've killed a fly with my bare mind.
Comments
CON
· _stack = ($3000 + $3000 + 100) >> 2·· 'accomodate display memory and stack
The $3000's are for the display buffers (in bytes). One of the $3000's is for the working bitmap, and the other $3000 is for the display bitmap, so the image is double-buffered, making it flicker-free. The $100 is for the initial COG's stack space. These all get shifted right by 2 (>>2) to get the equivalent long count.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
1)Chip replied; "double-buffered, making it flicker-free." Has eeprom memory been reserved here? Why does 'buffering' make something 'flicker-free'?
2)What is a compiler's bar graph?
1) With double buffering, the TV screen can display one buffer that does not change while the program is changing the other buffer (the source of changes can be EEPROM or any other memory). Once the other buffer is ready, the TV screen can be "switched" to display it. The result is a smoothly updated display for animations, etc....
2) In the Propeller Tool, you can find out how much free HUB memory is available in the Propeller by compiling the program with the F8 key. F8 causes a window to display that shows a color coded bar graph of HUB memory usage. The buffer may not be shown in the graph as Chip explains unless "stack" space is reserved.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Short answers? Not available at this time since I think you deserve more information than you requested.
EEPROM memory was not reserved. What did get reserved is two pages of HUB memory for use by the graphics functions.
When a bitmap screen is displayed, there needs to exist a buffer of memory to hold the state of the bitmap. This is like "graphics memory", or known as a graphics page, or just "bitmap". $3000 bytes of RAM were reserved for this purpose in the graphics demo, $3000 per page actually, which is most of the 32K ($7fff) HUB memory available.
This was done, in this case, so that the Propeller has a place to draw an image to be displayed on the screen. One COG is doing the screen display, another COG is executing fast graphics library functions, and another COG is running the demo program that makes use of both to do the demo.
Buffering makes something flicker free due to how graphics are drawn. On an ordinary TV or computer monitor, the image is rasterized, and that means a structured scanning of the image occurs, from top to bottom. This happens quickly enough that our eye sees one picture, due to persistence of vision. When a graphical image changes, while this raster scanning is occuring, the image will tear, or flicker, depending on the degree of change present at the time.
A buffer is used to draw the image off screen, so that the entire image can be built with out worrying about the state of the raster beam, then when it's time to show that image, the Propeller is instructed to display the contents of that buffer. The other buffer is then used to draw in the same fashion, with the display state of the two toggling rapidly to display moving images.
This is a common computer graphics technique used to present viewers with stable, no flicker images that feature motion and animation.
There are other means to display flicker free images, that do not require such a large quantity of RAM to be present, but they are more complex. The idea behind this demo program was to introduce the Propeller user to graphics technology in an easy to use and consume fashion. Once a user has understood how graphics can be generated with a Propeller, they then can move on to other means and methods that may better fit their project requirements.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
Have fun!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
Double buffering provides a safe working space for each of the two processors where, when both are finished with their respective tasks, the two can exchange places and continue on the other's buffer without messing with a half finished massage.
This can be extended to multiple buffers allowing one processor to run far ahead of the other.
Dual-ported RAM was developed for this very purpose.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
8x8 color 80 Column NTSC Text Object
Safety Tip: Life is as good as YOU think it is!
From there, one can build a chain of such links between many threads - Building a production line like setup that can handle really tough streams of data.
There is limits on effectiveness though (Off the top of my head):
- Each added stage in the line adds lag into the system. If lag is a concern then that bounds the complexity of processing.
- Shared RAM bandwidth can also define a performance limit.
I also worked on a project where I ran out of RAM, resulting in my graphics getting messed up. It turned out I was overwriting the memory set aside in the _stack directive. If you set aside memory for your graphics buffers in VAR or DAT sections, you can better keep track of how much memory you have and avoid such bugs. You must remember, however, that the graphics and TV drivers expect the buffers to be aligned on a 64-byte (16-long) boundary, so you need to allow a little extra space and create a pointer to the buffer that you round off to the nearest boundary.
For example:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"A government big enough to give you everything you want, is big enough to take away everything you have. "
- Thomas Jefferson
The discussion will inevitably lead on to PropII suggestions. [noparse]:)[/noparse]