16 Colors at Once -- Possible?

Basic and Machine Language

Moderator: Moderators

Post Reply
saehn
Vic 20 Devotee
Posts: 235
Joined: Wed Apr 01, 2009 12:22 pm

16 Colors at Once -- Possible?

Post by saehn »

Is it possible to display 16 colors at once on the VIC-20 screen? Preferably, this would be via a type of text mode... 22x23. I like the challenge of such a low resolution.

Further, would it be possible to have a background/foreground 16-color mode? All cells could have the same background color, that would be fine. I'd just want them to have different foreground colors.

I know I'm probably asking a lot. It might not be possible at all, even with memory expansion. Just an idea! Thanks...
User avatar
Victragic
Frogger '07
Posts: 605
Joined: Tue Nov 14, 2006 5:56 pm
Location: South Australia

Post by Victragic »

Hi,

16 colours at once is just not possible in the way you want it, unfortunately..

The limitation is

1 screen background colour from the full 16-colour palette
1 border colour from the standard 8-colour palette
each character cell in the 22x23 screen grid's colour selected from the 8-colour palette

If you use multi-colour characters, then an 'auxiliary' colour is chosen from the 16-colour palette - this is one shared colour for the entire screen... not generally suitable for text either.

The only way around these limitations is by a kind of trickery - changing the colours as they are being written to the screen, timing them to change at exactly the right point using the raster pointer (raster = current line being drawn on screen). This is generally done through use of interrupts in assembly/machine language.

But.. you can't change the colours quickly enough to have each cell in the 22x23 screen an individual screen colour, and the effect is generally restricted to allowing the choice of 'shared' colours (border, screen, auxiliary) on a line-by-line basis.
3^4 is 81.0000001
User avatar
Mike
Herr VC
Posts: 4843
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

The first 8 colours can be placed everywhere. If one wants to display the upper 8 colours, only background, and auxiliary colours are available as colour sources. Unfortunately, they're located in two different registers, so cannot be changed both at once. Also both colours are located in the upper nibbles of these registers, so they can't share a CPU register. At least up to 3 colour changes can be prepared in the A, X, and Y registers.

The fastest way to change the registers would be:

LDA #aa:LDX #xx:STA $900F:STX $900E

Each of the store operations executes in four cycles, or two chars. Then we can interleave the display of different colour sources as follows: assuming the 1st background, and 1st aux. colour have been prepared in advance,

Code: Select all

cycle|colour|colour source

 1     0..7  foreground
 2     0..7  foreground
 3     8..15 1st background
 4     8..15 1st background
 5     8..15 2nd background <- STA $900F
 6     8..15 2nd background
 7     8..15 1st aux. colour
 8     8..15 1st aux. colour
 9     8..15 2nd aux. colour <- STX $900E
10     8..15 2nd aux. colour
11     0..7  foreground
12     0..7  foreground
... so up to four character blocks with different colours in the 8..15 range can be displayed. This pattern would then be repeated for 8 rasters.

In any case, the whole thing depends on specialised, cycle-exact code.

Greetings,

Michael
Vic20-Ian
Vic 20 Scientist
Posts: 1214
Joined: Sun Aug 24, 2008 1:58 pm

Post by Vic20-Ian »

With all the recent sound developments on the Vic I had a crazy notion someone might start doing some kind of weird filter implementations on the colour output and develop a way for lots more colours on the Vic to be displayed ;-)

e.g. what Robotic Liberation and Poptastic have done for sound done to the graphics.
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready
rhurst
Omega Star Commander
Posts: 1371
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Post by rhurst »

Just an idea!
Try your idea on VIC-II (C64 or C128) or even better, TED (C16 or Plus/4). Those 8-bits have more advanced video capabilities than VIC. And they're just as easy to program and they come with more memory by default. :P
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
saehn
Vic 20 Devotee
Posts: 235
Joined: Wed Apr 01, 2009 12:22 pm

Post by saehn »

Thanks, all...

@Mike, I'm not sure what you're talking about and you've out-tech'ed me, but I will show your notes to my coder friends. :-)

@rhurst, you're right of course, but the VIC is appealing to me too. The C16 and +4 are neat, but aren't as interesting to me. The VIC has colors that the C64 doesn't and I like the idea of this working within the VIC limitations

Plus: yes, I'm kinda involved in something similar for the C64. Would be a fun "new" gfx format.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Changing the background, border and auxillary colour for each raster line has been done ever since the picture viewer in VIMM back in 2000. What Mike suggests though seems an even finer resolution, where you can change the background and auxillary colours several times per raster line. As he mentions, the code needs to be cycle exact.

What Ian suggests sounds similar to the experiments Isaac was doing a few weeks ago, using artifact patterns from the image generation to make it look like subpixels. If I understood correctly that technique would depend on a slightly blurry display, i.e. the S-Video mod for a sharper picture would completely destroy the concept. It is possible one can use an interlace effect or likewise to display two different colours to appear like a new one. The additional colours sometimes seen in C64 prods are a result of using two different colours next to eachother or even interlaced, fooling the eye to see a new one. Unfortunately the VIC-20 pixels are so wide I think the effect is harder to obtain?
Anders Carlsson

Image Image Image Image Image
User avatar
Mike
Herr VC
Posts: 4843
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

carlsson wrote:The additional colours sometimes seen in C64 prods are a result of using two different colours next to eachother or even interlaced, fooling the eye to see a new one. Unfortunately the VIC-20 pixels are so wide I think the effect is harder to obtain?
One doesn't need a high horizontal resolution to mix two colours that way. The effect can also be achieved by using the two colours on alternate lines.

On the C64 there exist pairs - and in one case even a quadrupel - of colours, which share the same intensity, like yellow/light green, green/light red or blue/brown: the first of which results in a distinct neon-green, the other two in a light brown, and a blueish grey.

Except the pair green/light blue, most colours on the VIC-20 do have different intensities, so the mixing effect is not that pronounced. But it's still there (and one of the reasons for me to provide the original size view alongside the zoomed view in MINIPAINT - the other one being the user always can judge the distortions of the composite signal while placing the pixels).
4mat/atebit
Vic 20 Newbie
Posts: 10
Joined: Fri Sep 25, 2009 6:40 am

Post by 4mat/atebit »

A while back I got the Vic to do different char colours on every 2nd vertical line in this demo:

http://www.pouet.net/prod.php?which=24332

The fx in the screenshot shows it, each bar has it's own char colours. Unfortunately doing it this way only 4 lines of a character are displayable and it's repeating the same horizontal charline down the screen. (The screen is only 1 charline in height.)
a1bert
Vic 20 Dabbler
Posts: 96
Joined: Mon Jan 23, 2006 12:49 am

Post by a1bert »

4mat/atebit wrote:A while back I got the Vic to do different char colours on every 2nd vertical line
You can also check the copper part of VIMM which creates a scroller by changing the background color. The first ever copper scroller was created for C64 during the last century (the AmigaEmulation demo).
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

a1bert wrote:You can also check the copper part of VIMM which creates a scroller by changing the background color. The first ever copper scroller was created for C64 during the last century (the AmigaEmulation demo).
There's a background color split scroller in Xakk's No Sleep II too.
Nothing else on screen though.
Post Reply