PDA

View Full Version : [FYI] VGA, 100xH/P, dual cog, per cell colour (full/indexed)



kuroneko
03-15-2012, 03:26 PM
This driver has the same features as its little brother:

per cell colour (foreground and background)
monochrome mode (when you're short on hub memory)


'' mailbox layout (100xH, full colour)
''
'' long[par][0]: screen: [!Z]:addr = 16:16 -> zero (accepted)
'' long[par][1]: font: size:[!Z]:addr = 8:8:16 -> zero (accepted)
'' long[par][2]: colours: c/a:[!Z]:addr = 1:15:16 -> zero (accepted), optional colour [buffer]
'' long[par][3]: frame indicator/sync lock
''
'' colour [buffer] format
''
'' - (%0--//--0) address (full colour, word array)
'' - (%1--//---) colour value (waitvid 2 colour VGA format)
To save hub RAM an indexed version has been introduced. It reduces the colour attribute size to a byte rather than a word. The foreground colour can still be specified in full 6bit resolution, the remaining 2 bits select one out of four background colours (default: black(0), dark blue(1), dark gray(2), white(3)). The UI is the same. The only difference is that when setting the colour the blue component of the background colour is treated as colour index.

Note that while the colour attribute format is now a byte the colour buffer still needs to be word aligned (just half the size).

'' mailbox layout (100xP, full/indexed colour)
''
'' long[par][0]: screen: [!Z]:addr = 16:16 -> zero (accepted)
'' long[par][1]: font: size:[!Z]:addr = 8:8:16 -> zero (accepted)
'' long[par][2]: colours: c/a:[!Z]:addr = 1:15:16 -> zero (accepted), optional colour [buffer]
'' long[par][3]: frame indicator/sync lock
'' long[par][4]: palette: colour:[!Z]*4 = (6:2)*4 -> zero (accepted), optional background palette
''
'' colour [buffer] format
''
'' - (%0--//--0) address (full colour, word array)
'' - (%1--//---) colour value (waitvid 2 colour VGA format)
''
'' background palette format
''
'' - %%RGB-RGB-RGB-RGB-, MSB holds index 0 (waitvid 4 colour VGA format)

If either screen or font buffer are not set when the drivers are initialised the default colour will change to black-on-black. After that you're on your own. The archives contain fonts for 100x50 (8x12) and 100x75 (8x8) changeable in the UI object(s). Both drivers now make sure that user colour values (full colour mode, direct access) don't affect the sync bits. So there is no need for masking & Co (this doesn't apply to the 50xH version though, we don't have the time).

Important: You can't use bst & Co for compiling the demo. Also, you'll need at least rev 33 of the open source SPIN compiler. PropTool 1.3 will do just fine.

Rayman
03-15-2012, 04:08 PM
Excellent! If I'm reading this right, it's VGA (800x600 resolution) using an 8x12 pixel font to give 100 columns, by 50 rows of text.
Each character has individual foreground and background colors. Uses the regular, 5 MHz crystal without overclocking.

How many cogs does it use? I think two, right?

BTW: Any thoughts on making either one MIT and/or adding to OBEX?

kuroneko
03-15-2012, 11:52 PM
... How many cogs does it use? I think two, right?
Correct. Admittedly the 100xH is slightly mislabeled in that the font can't have arbitrary height values (I was considering an 8x8 version as well which gives you 100x75). Also, in case anyone wondered about the binary-only release, I use bstc for cog binary translation but it turned out to choke on things like long +8.


BTW: Any thoughts on making either one MIT and/or adding to OBEX?
Not particularly. But if me giving it away is not enough I may consider adding a/the license :)

Tubular
03-16-2012, 05:20 AM
This is really interesting. I am using Kye's 160*120 byte-per-pixel driver in greyscale mode, and need to overlay white text. At the moment I'm thinking of having a second cog producing the Hires monochrome text "overlaid" on the lores greyscale VGA, by driving all vga pins high in sync with the vga lores driver.

However I think your approach might get me there without a whole lot of syncing, because in effect I could use a "half block" character (lines 0-5 of the cell = solid background, lines 6-11 of the cell =foreground solid) , set the foreground for the lower half of the block/character cell, set the background for the upper half of the block/character cell, effectively achieving 100*100 "pixels" which is getting close to Kye's driver, but could do text easily.

Of if you did an 8x8 version we'd be looking at 100H x150 V pixels

Thanks for the hard work. I better go and try it...

kuroneko
03-17-2012, 09:03 AM
Uploaded full source release. Now capable of 100x50 and 100x75.

Dr_Acula
03-17-2012, 01:56 PM
This is really cool. Should be a great addition to the Z80 emulation. Wordstar with highlighted text as it was meant to be!

Bill Henning
03-18-2012, 12:23 AM
Nice!


Uploaded full source release. Now capable of 100x50 and 100x75.

kuroneko
03-18-2012, 12:30 AM
Just thinking aloud here, ATM a word is used for colour attributes. Would it be useful to have an option using only a byte which specifies the foreground colour in full 6bit resolution and lets you pick 1 out of 4 background colours?

Dr_Acula
03-18-2012, 01:19 AM
Yes a byte value would be useful - particularly when hub ram is running low. As long as it is not too hard to code :)

Tubular
03-18-2012, 01:41 AM
I need the "word" version for my current application, but I have to agree for most applications packing it into a byte would be the way to go

Rayman
03-18-2012, 03:05 PM
Just for fun, I tried this driver with my old eMagin Z800 800x600 OLED display... It works!
It didn't work with any of the Parallax 800x600 driver settings, so I think you figured out something they didn't with the timing...

It might be fun one day to set up 2 screen buffers and page flip them... Could get 3D depth with text that way, I think...
Or, maybe modify the driver so that every other update has certian lines shifted some # of pixels left or right...

Cluso99
03-18-2012, 07:11 PM
nice work kuroneko :) Yes byte sounds great for Z80 emulations.

kuroneko
03-19-2012, 02:28 AM
The latest driver versions for full and indexed colour are now available.