VGA_TEXT.SPIN clear screen
Richard S.
Posts: 70
There is a command ($00) in the VGA_TEXT.SPIN file called 'clear screen', see below:
·case flag
··· $00: case c·· ' clear screen
·········· $00: wordfill(@screen, $220, screensize)
··············· col := row := 0
·········· $01: col := row := 0
Why is the value $220 used to·fill ('clear')·the screen memory block?· I do not understand it's purpose.· I would have thought filling screen memory with spaces or blanks would have be adequate.
I would like to clear the screen and set the background/foreground colors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
·case flag
··· $00: case c·· ' clear screen
·········· $00: wordfill(@screen, $220, screensize)
··············· col := row := 0
·········· $01: col := row := 0
Why is the value $220 used to·fill ('clear')·the screen memory block?· I do not understand it's purpose.· I would have thought filling screen memory with spaces or blanks would have be adequate.
I would like to clear the screen and set the background/foreground colors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
Comments
I now understand what is going on in 'wordfill(@screen, $220, screensize)' with $220 representing 'blank' in the ROM font table.
I do understand how to set colors. I was hoping the the 'clear screen' function might integrate color palette selection but I can see this is not so. It would be a nice way to paint the screen a specific color.
Your time and comments are much appreciated!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
This shifts the last 3 bits into the color position of the screen's data. So to clear screen to a different palette you would out(cindex + $100)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 3/21/2007 2:21:08 PM GMT
The info on "painting a screen" worked well.·Thank-you very much!!
What I would like is to paint a screen yellow, and then display a menu list without having to pad with spaces to have the entire screen appear a uniform yellow background.· This would save memory space·(not having to store all of those $20-spaces)·when using multiple text menu screens.
When I "paint screen" yellow, then write to the screen with red foreground / yellow background color pallete selection....the text lines·do not have·yellow in all columns·unless padded to the end with "spaces".· Apparently the screen buffer is overwritten with the default colors (red/black) just prior to a string write?
Below is an example of text padded to end with spaces...therefore the whole line is yellow with red text
· vga_text.str(string($A,1,$08,$C,2,"·········· MAIN MENU··········· "))
Below is an example of text not padded to the end...therefore the yello line stops at the end of the text and the rest is black
· vga_text.str(string($A,1,$08,$C,2,"·········· MAIN MENU"))
The $C,2 is my red/yellow color pallete selection.
I·also noticed·that in order to start at X-zero position, since in a string I cannot use $A,0 because of zero terminated string problem...I had to select X-one position then backspace with $08 command.· It would have been convenient had the numbering of the columns and lines started with 1 rather than zero, if·I understand this correctly.
Any comments would be greatly appreciated!· Thanx!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
It would have been easier,for me at least, if the·top·left corner·was x=1 y=1·and the lower right corner was·x=32 y=15.· Then there would be no problem using string commands to load·the top row.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard in Michigan
You could always go in and edit the lower level object to make that its behaviour, or ( better to retain compatibility with other code which may use the object ) add a parsing routine which takes the string you want to write ( origin=1,1 ) and converts it to calls which achieve what you want.
You can tune it to your own wishes as you like, as hippy pointed out!
I again see that it is high time to post my Video Tutorial - but I am still not satisfied with it. I see there is - week after week - ALWAYS the same misconception of a "screen buffer"; I think mainly because the tile vector is called "screen" in some demos
Instead of using the 'str' function to position the text, just set the global variables 'row' and 'col' to the desired position and then print your string...
You can also just use the 'color' variable to select your color before calling 'str' to print the string.
·