Screen 8 colors

Page 1/2
| 2

By Oscar

Guardian (564)

Oscar's picture

30-11-2011, 00:03

Hello,

Can anybody help me putting a pixel in screen 8 writting to the red, green and blue bits? I am reading MSX Technnical Handbook and I am not sure how to write/access VDP.

Thank you!

Login or register to post comments

By Oscar

Guardian (564)

Oscar's picture

30-11-2011, 00:04

I forgot, I am using Basic

By RetroTechie

Paragon (1462)

RetroTechie's picture

30-11-2011, 00:20

If you haven't already done so, grab this book from HansO's MSX Info pages. Around page 109 you find what you need...

MSX2 Basic has nice & powerful functions for doing things with the screen (since that was the big difference between MSX1 and MSX2), MSX2 Technical Handbook or V9938 programmer's guide is more suitable for assembly programmers.

By pitpan

Prophet (3131)

pitpan's picture

30-11-2011, 00:25

PSET?

The RGB values using the given colour depth provided by the V9938 are coded using palette entry numbers. If I remember correctly, the MSX2 in screen 8 uses 3 bits for red, 3 bits for blue and only 2 bits for green, making a total of 256 different combinations that are mapped as regular colors from 0 to 255. Or so.

Let the MSX2 gurus speak. Wink

By PlainSpooky

Resident (46)

PlainSpooky's picture

30-11-2011, 01:16

A Quick SCR8 Guide :-)

Layout: VRAM Address = Y*256+X

Address/Coordinates:
00000 = (0,0)
00255 = (255,0)
00256 = (0,1)
54271 = (255,211)

Color:
GGGRRRBB ; G=Green 0..7 (3 bit), R=Red 0..7 (3 bit), B=Blue 0..3 (2 bit)

PSET (0,0),&b11100000 ' Green
PSET (0,0),&b00011100 ' Red
PSET (0,0),&b00000011 ' Blue
PSET (0,0),&hFF ' White
PSET (0,0),&b11011101 ' A kind of Yellow :-D

Sample code:
10 'ALL 256 COLORS
20 COLOR 15,0,0:SCREEN 8
30 FOR Y%=0 TO 15:FOR X%=0 TO 15
40 LINE (8*X%,8*Y%)-STEP(7,7),Y%*16+X%,BF
50 NEXT X%,Y%:K$=INPUT$(1)

---
Giovanni

By retrocanada76

Champion (456)

retrocanada76's picture

30-11-2011, 06:28

3 bits for Red, 3 for Green and 2 for Blue.

The choice of 2 bits for blue is intentional as the human eye perceives more green than red and more red than blue.

By Metalion

Paladin (969)

Metalion's picture

30-11-2011, 09:30

The choice of 2 bits for blue is intentional as the human eye perceives more green than red and more red than blue.
Cool.
Never knew that.

By wolf_

Ambassador_ (9712)

wolf_'s picture

30-11-2011, 12:52

I would rather call it a good compromise, because it's never the intention to have less colors (or my videocard wouldn't have 16,7M colors but 8,3). The only reason was to be able to store one pixel in one byte, and since a byte has 8 bits, you can't have 3 bits for each color component. Naturally, the best solution would've been 256*9=2304 bits memory in which you could store a palette, and full RRRGGGBBB for each of the 256 screen 8 colors. Or: "RB xG", for two bytes palette information per color, would cost 512 bytes.. I'd gladly have traded two lines for that (you'd have a 256x210 resolution).

By wolf_

Ambassador_ (9712)

wolf_'s picture

30-11-2011, 13:06

Or heck, why not just RRRRBBBB xxxxGGGG for 256 colors out of 4096 (Amiga), or even RRRR RGGG GGBB BBBx for 256 colors out of a palette of 32768 (G9k).. But alas.. fixed screen 8 it is.. ._.

By Metalion

Paladin (969)

Metalion's picture

30-11-2011, 13:56

Well of course, Wolf, I knew it was a compromise so that the color information fit in one byte !
What I did not know was the fact that the compromise was based on the perception of the human eye.

By PingPong

Prophet (3147)

PingPong's picture

30-11-2011, 14:29

I would rather call it a good compromise, because it's never the intention to have less colors (or my videocard wouldn't have 16,7M colors but 8,3). The only reason was to be able to store one pixel in one byte, and since a byte has 8 bits, you can't have 3 bits for each color component. Naturally, the best solution would've been 256*9=2304 bits memory in which you could store a palette, and full RRRGGGBBB for each of the 256 screen 8 colors. Or: "RB xG", for two bytes palette information per color, would cost 512 bytes.. I'd gladly have traded two lines for that (you'd have a 256x210 resolution).
ah, yes, and the chip space needed to store 9 bit x 256 values? do you think to buy this at supermarket?

(Having some onchip memory space would be used better to improve sprite management, like more objects per scan line due to reduced read memory cycles from vram)

Page 1/2
| 2
My MSX profile