Jump to content
  • 0
Lodovik

Screen $80 mode

Question

Hello,

In BASIC, how can I initialize screen $80 mode with colors other than blue on white background? I'd like to draw color shapes on a black background.

 

Thanks

Edited by Lodovik

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

How about: 

10 SCREEN $80
20 REM BORROW COLOR 1 FOR BLACK AS 0 IS TRANSPARENT
30 VPOKE 1, $FA02, 0
40 VPOKE 1, $FA03,0
50 COLOR  6,1
60 CLS

 

 

Edited by Alfa
Forgot about the transparent color in mode $80

Share this post


Link to post
Share on other sites
  • 0

Strangely, if I do that, the screen is cleared to the correct color but anything drawn with pset is invisible... and there's no black color, only dark gray (11).

Edit: with the above vpokes, I now get a black background screen but still cannot see anything drawn with PSET x,y,color.

Edited by Lodovik

Share this post


Link to post
Share on other sites
  • 0

Just do a COLOR and whatever index you want to use from the 16-color palette (0-15). You can pass two arguments, and specify the background color. So COLOR 1,6 will get back the familiar white-on-dark-blue look. COLOR 15,11 will get you a trendy light-gray-on-dark-gray "dark mode" look. The only color you can't really use in mode $80 is black, unless you poke it into an index other than zero.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

OK, I found the problem: I removed the color statement before the CLS and it's now working correctly with a black background, using the VPOKEs. Thanks!

 

Share this post


Link to post
Share on other sites
  • 0

Yeah, SCREEN $80 changed the fg and bg colors. The bg color has to be 0 (transparent, so the graphics below shines through), and the fg color has to be something other than 1 (white, otherwise it's white-on-white), so SCREEN $80 sets the colors to light blue on transparent, ignoring what was set before.

Share this post


Link to post
Share on other sites
  • 0

He asked about graphics, not text.

Lodovik, simply paint a black rectangle on the entire screen:

RECT0,0,319,199,0

Share this post


Link to post
Share on other sites
  • 0

Working from Alfa's post this will draw rectangles with a frame and a diagonal line in different colours.

10 SCREEN $80
20 VPOKE 1,$FA02,0
30 VPOKE 1,$FA03,0
40 FOR I=0 TO 20
50 X=RND(1)*320: Y=RND(1)*200: X2=RND(1)*320: Y2=RND(1)*200
60 RECT X,Y,X2,Y2,RND(1)*256
70 FRAME X,Y,X2,Y2,RND(1)*256
80 LINE X,Y,X2,Y2,RDN(1)*256
90 NEXT

Share this post


Link to post
Share on other sites
  • 0

10 SCREEN $80
20 RECT 0,0,319,199,0
40 FOR I=1 TO 20
50 X=RND(1)*320: Y=RND(1)*200: X2=RND(1)*320: Y2=RND(1)*200
60 RECT X,Y,X2,Y2,RND(1)*256
70 FRAME X,Y,X2,Y2,RND(1)*256
80 LINE X,Y,X2,Y2,RND(1)*256
90 NEXT
100 LIST

Edited by Greg King

Share this post


Link to post
Share on other sites
  • 0
On 7/12/2020 at 4:17 PM, Michael Steil said:

Yeah, SCREEN $80 changed the fg and bg colors. The bg color has to be 0 (transparent, so the graphics below shines through), and the fg color has to be something other than 1 (white, otherwise it's white-on-white), so SCREEN $80 sets the colors to light blue on transparent, ignoring what was set before.

This took me a while to figure out properly! Is my understanding below correct?

1. The TEXT layer is on TOP of the GRAPHICS layer.

2. So that TEXT "bg" color has to be set to "0" (transparent) so that the GRAPHICS layer is shown through.

3. SCREEN $80 is permanently defining color 1 (WHITE) as the background color for the GRAPHICS layer. (THIS IS KEY)

4. So in order to change the background color of the GRAPHICS layer, we need to manually alter the color 1 inside VERA's palette memory.

5. Changing the "bg" color of the TEXT layer (using COLOR command) other than "0" will hide the GRAPHICS layer.

On 7/12/2020 at 12:31 AM, Alfa said:

10 SCREEN $80
20 REM BORROW COLOR 1 FOR BLACK AS 0 IS TRANSPARENT
30 VPOKE 1, $FA02, 0
40 VPOKE 1, $FA03,0
50 COLOR  6,1
60 CLS

Thus LINE 50 in the original code is a mistake... it sets TEXT layer "bg" to the newly created "BLACK" color thus hiding the GRAPHICS layer. The line should read COLOR 6,0 and all is well. It seems a little inflexible to hardcode the GRAPHICS layer background color to "1". Perhaps allowing the user to set the color would be nice... it would avoid those ugly POKEs...

Share this post


Link to post
Share on other sites
  • 0
42 minutes ago, geek504 said:

This took me a while to figure out properly! Is my understanding below correct?

1. The TEXT layer is on TOP of the GRAPHICS layer.

2. So that TEXT "bg" color has to be set to "0" (transparent) so that the GRAPHICS layer is shown through.

3. SCREEN $80 is permanently defining color 1 (WHITE) as the background color for the GRAPHICS layer. (THIS IS KEY)

4. So in order to change the background color of the GRAPHICS layer, we need to manually alter the color 1 inside VERA's palette memory.

5. Changing the "bg" color of the TEXT layer (using COLOR command) other than "0" will hide the GRAPHICS layer.

Thus LINE 50 in the original code is a mistake... it sets TEXT layer "bg" to the newly created "BLACK" color thus hiding the GRAPHICS layer. The line should read COLOR 6,0 and all is well. It seems a little inflexible to hardcode the GRAPHICS layer background color to "1". Perhaps allowing the user to set the color would be nice... it would avoid those ugly POKEs...

Yes, pretty much. Another thing you could do is fill $10000-$1F9FF with something other than 1 in a for loop or something, but that would be really slow.

Edit: Actually Greg King already suggested it, but making a rect that fills the screen is the fastest and easiest way.   Also.... is there a way to remove a quote once you've hit the quote button? I can't seem to get rid of it.

Quote

 

Edited by Ender

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Ender said:

Yes, pretty much. Another thing you could do is fill $10000-$1F9FF with something other than 1 in a for loop or something, but that would be really slow.

That is something I am wondering too... which way is fastest to reset the GRAPHICS layer to black:

1. SCREEN $80 after setting palette color #1 to black;

2. RECT 0,0,319,199,16 <== can't use color #0 (transparent) so use the next available black;

3. Machine code to fill the screen memory with color #16.

Share this post


Link to post
Share on other sites
  • 0
5 minutes ago, geek504 said:

That is something I am wondering too... which way is fastest to reset the GRAPHICS layer to black:

1. SCREEN $80 after setting palette color #1 to black;

2. RECT 0,0,319,199,16 <== can't use color #0 (transparent) so use the next available black;

3. Machine code to fill the screen memory with color #16.

I think technically 1 would be the fastest since it's just changing one value in memory and the VERA should pick it up for the next frame. However, 2 and 3 are also very fast. They're probably nearly the same speed, since RECT essentially does 3, but it has the added overhead of parsing the BASIC command (which probably equates to just a few milliseconds).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use