Jump to content
IGNORED

BASIC Color Bar Programs


Recommended Posts

Hi,

 

Does anyone know how to write properly the commands in BASIC necessary to allow all sixteen or so colors to show up on the screen at once? This is in regards to:

*Commodore VIC-20

*Commodore 64

*Texas Instruments TI-99/4(A)

*Tomy Tutor

 

NTSC preferred.

 

Thank you,

 

 

 

Ben Edge

 

 

As far as I remember, the VIC-20 could only display 8 colors. Maybe there's some assembler trickery to make it happen, but not in BASIC.

Link to comment
Share on other sites

This is for the C64:

100 PRINT CHR$(147):REM CLEAR SCREEN
110 FOR I=0TO15:POKE646,I:B$=CHR$(18)
120 FOR J=1TO40:B$=B$+" ":NEXT J
130 PRINT B$; :NEXT I

There are 16 possible colors, numbered from 0 to 15. 646 is the memory adress which stores the current color for characters, this is why we POKE to it in line 110. CHR$(18) is the control character for "reverse mode" - because we want to create color bars, we will need to print reverse Spaces. We will print 40 spaces of each color, as that's the width of the screen line.

post-23067-126496124523_thumb.png

 

If you want to change the screen background color first, add a line

90 POKE 53280,0: POKE 53281,0

53280 is for the border color, 53281 the actual background. In the above example, both are set to 0 (black).

If you want the first bar to appear on the top line of the screen, instead of the second, add a ";" after CHR$(147) in line 100.

 

The color table goes like this:

0 - black          1 - white           2 - red           3 - cyan          
4 - purple         5 - green           6 - blue          7 - yellow
8 - orange         9 - brown          10 - light red    11 - dark grey
12 - medium grey   13 - light green    14 - light blue   15 - light grey

Edited by Herbarius
Link to comment
Share on other sites

This is for the C64:

100 PRINT CHR$(147):REM CLEAR SCREEN
110 FOR I=0TO15:POKE646,I:B$=CHR$(18)
120 FOR J=1TO40:B$=B$+" ":NEXT J
130 PRINT B$; :NEXT I

There are 16 possible colors, numbered from 0 to 15. 646 is the memory adress which stores the current color for characters, this is why we POKE to it in line 110. CHR$(18) is the control character for "reverse mode" - because we want to create color bars, we will need to print reverse Spaces. We will print 40 spaces of each color, as that's the width of the screen line.

post-23067-126496124523_thumb.png

 

If you want to change the screen background color first, add a line

90 POKE 53280,0: POKE 53281,0

53280 is for the border color, 53281 the actual background. In the above example, both are set to 0 (black).

If you want the first bar to appear on the top line of the screen, instead of the second, add a ";" after CHR$(147) in line 100.

 

The color table goes like this:

0 - black          1 - white           2 - red           3 - cyan          
4 - purple         5 - green           6 - blue          7 - yellow
8 - orange         9 - brown          10 - light red    11 - dark grey
12 - medium grey   13 - light green    14 - light blue   15 - light grey

 

I couldn't sleep, so I made your program look more like the TI-99/4A. Yes, I'm that A-type. LOL

 

100 PRINT CHR$(147):REM CLEAR SCREEN
110 POKE 53280,13:POKE 53281,13
120 FOR C=0 TO 20
130 FOR I=0 TO 15
140 POKE 646,I
150 PRINT CHR$(18)+" ";
160 POKE 646,13
170 PRINT CHR$(18)+" ";
180 NEXT I
190 PRINT
200 NEXT C
210 GET K$
220 IF K$<>" " THEN GOTO 210
230 POKE 53280,14
240 POKE 53281,6
250 POKE 646,14
260 PRINT CHR$(18)+" ";

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...