Shop OBEX P1 Docs P2 Docs Learn Events
[FYI] VGA, 100xH/P, dual cog, per cell colour (full/indexed) — Parallax Forums

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

kuronekokuroneko Posts: 3,623
edited 2012-03-18 19:28 in Propeller 1
This driver has the same features as its [thread=136666]little brother[/thread]:
  • 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
'' [COLOR="orange"]long[par][4]: palette:  colour:[!Z]*4 = (6:2)*4 -> zero (accepted), optional background palette[/COLOR]
''
'' colour [buffer] format
''
''  - (%0--//--0) address (full colour, [COLOR="blue"]word array[/COLOR])
''  - (%1--//---) colour value (waitvid 2 colour VGA format)
''
'' [COLOR="orange"]background palette format[/COLOR]
''
''  [COLOR="orange"]- %%RGB-RGB-RGB-RGB-, MSB holds index 0 (waitvid 4 colour VGA format)[/COLOR]
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.

Comments

  • RaymanRayman Posts: 14,844
    edited 2012-03-15 09:08
    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?
  • kuronekokuroneko Posts: 3,623
    edited 2012-03-15 16:52
    Rayman wrote: »
    ... 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.
    Rayman wrote: »
    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 :)
  • TubularTubular Posts: 4,706
    edited 2012-03-15 22:20
    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...
  • kuronekokuroneko Posts: 3,623
    edited 2012-03-17 02:03
    Uploaded full source release. Now capable of 100x50 and 100x75.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-03-17 06:56
    This is really cool. Should be a great addition to the Z80 emulation. Wordstar with highlighted text as it was meant to be!
  • Bill HenningBill Henning Posts: 6,445
    edited 2012-03-17 17:23
    Nice!
    kuroneko wrote: »
    Uploaded full source release. Now capable of 100x50 and 100x75.
  • kuronekokuroneko Posts: 3,623
    edited 2012-03-17 17:30
    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_AculaDr_Acula Posts: 5,484
    edited 2012-03-17 18:19
    Yes a byte value would be useful - particularly when hub ram is running low. As long as it is not too hard to code :)
  • TubularTubular Posts: 4,706
    edited 2012-03-17 18:41
    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
  • RaymanRayman Posts: 14,844
    edited 2012-03-18 08:05
    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...
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-03-18 12:11
    nice work kuroneko :) Yes byte sounds great for Z80 emulations.
  • kuronekokuroneko Posts: 3,623
    edited 2012-03-18 19:28
    The latest driver versions for full and indexed colour are now available.
Sign In or Register to comment.