Shop OBEX P1 Docs P2 Docs Learn Events
[FYI] VGA, 50xH, single cog, per cell colour ("Despair and Hope" release) — Parallax Forums

[FYI] VGA, 50xH, single cog, per cell colour ("Despair and Hope" release)

kuronekokuroneko Posts: 3,623
edited 2012-05-06 21:48 in Propeller 1
This took some head scratching but you know how it is with impossible things here. The new driver features:
  • per cell colour (foreground and background)
  • monochrome mode (when you're short on hub memory)
The colour buffer (x * y words) replaces the palette from the [thread=136617]previous driver[/thread]. Addressing scheme is normal (add x and y). Colour values for the next row are fetched during horizontal sync. Vertical sync (optionally) updates the pointer values. If the colour buffer has bit 31 set it's interpreted as a colour value and applied to the whole screen (monochrome mode).
'' mailbox layout
''
'' long[par][0]:  screen:       [!Z]:addr =     16:16 -> zero (accepted), required during startup
'' long[par][1]:    font:  size:[!Z]:addr =    8:8:16 -> zero (accepted), required during startup
'' long[par][2]: palette: c/a:Z:[!Z]:addr = 1:1:14:16 -> zero (accepted), optional colour [buffer]
'' long[par][3]: frame indicator
''
'' The colour buffer is either an address (%00-//-00) or a colour value (%10-//---).
Apologies for the rather fat cog image. Note, the demo won't run when compiled with bst[c]. PropTool and spin (rev 33+) are fine.

Despair and Hope

Have fun!

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2011-12-14 22:37
    kuroneko wrote: »
    This took some head scratching but you know how it is with impossible things here.
    Yes... they just take a little longer ;)

    Great work BTW!
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2011-12-15 00:15
    I've got to check this out!

    I can feel a new display driver coming on for CP/M, wordstar, Catalina C etc etc. You could add the ANSI escape sequences for color.

    Great work, well done.
  • Heater.Heater. Posts: 21,230
    edited 2011-12-15 02:44
    Yes. I have to get back to CP/M on the Prop some time.
    Do we have a config for WordStar that works in 50 columns?
  • AntoineDoinelAntoineDoinel Posts: 312
    edited 2011-12-15 08:06
    FTL travel, and no neutrinos harmed in the process (unless you had some on your head while scratching) :cool:

    Great work Marko!

    @all
    FYI, I have some work done mating code from PocketTerm by Vince Briel and PullMoll's 80x30 vga-0.3 driver.
    But it's aimed at a stand-alone ANSI terminal, more or less what Smalldog was asking in the other thread (dual serial port, and 7 cogs total).
    Also adapted to Potatohead's text driver, so there's TV version too. Will post asap, little busy now.
    This new driver from Kuroneko is best for stand alone emulators: free resources to play "Despair and Hope" theme :lol:
  • RaymanRayman Posts: 14,833
    edited 2011-12-16 08:00
    Just had a chance to try it out.... Works great. I can see this driver being very useful. Nice work.
  • wb7076wb7076 Posts: 29
    edited 2012-02-22 14:00
    what are the pins for vga connection? it didn't work with my demo board rev g
  • kuronekokuroneko Posts: 3,623
    edited 2012-02-22 16:09
    Pin group 2, i.e. 16..23 (the driver was written for the demo board). Do you see any output at all on the LED bar? I just re-tested my two rev G demoboards and a Propeller ASC, works out of the box.

    Edit: Also, what crystal are you using?
  • wb7076wb7076 Posts: 29
    edited 2012-02-22 19:20
    worked like a charm re-downloaded and used my windows machine....
  • kuronekokuroneko Posts: 3,623
    edited 2012-02-22 19:39
    PM: wb7076 wrote:
    Tell me how would i go about seting color for a single characters?
    At the UI level the driver is started in single colour mode (no colour buffer provided). If you want per character colour you have to register a colour buffer (columns x rows words). Each word holds a background colour in the LSB and foreground colour in the MSB. Make sure you stay away from the sync bits. This is the relevant part in the demo where per character colour is used (fragment is from a later version but the idea is the same). Location is y*50+x. ATM the UI doesn't have methods related to colour setting but that's easy enough to add.
    ' Switch to colour per position mode.
    
      [COLOR="orange"]vga.setn(2, @palette{0})[/COLOR]
      waitcnt(clkfreq + cnt)
    
      repeat c from 0 to constant(vga#bcnt - 1)
        palette.word[c] := constant($C000 [COLOR="blue"]& mask | idle[/COLOR])         ' red on black
        waitcnt(clkfreq/200 + cnt)
    
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-22 13:33
    One of the earlier demos of this driver had a plot command worked in. Is it possible to implement this on this version of the driver?

    OBC
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-23 19:01
    Added a few simple commands to make the driver a little simpler for beginner use.
    Added a very basic "plot" command, could use some refinement as it uses an entire character at the moment.
    Todo: Figure out how to redefine a character on the fly.

    OBC
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-23 19:59
    Added a very basic "plot" command, could use some refinement as it uses an entire character at the moment.
    Todo: Figure out how to redefine a character on the fly.
    Note that character redefinition depends on the font height. The AiGeneric driver hardwires this to 8 bytes per character. Any thoughts about this?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-23 20:03
    Looks like the font is set to 12 at present.. Might be worth fixing at that height even though it puts some limits on the driver.

    OBC
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-23 20:08
    Looks like the font is set to 12 at present.. Might be worth fixing at that height even though it puts some limits on the driver.
    What about being able to query the font height and passing a buffer address instead (along with the character code)?
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-23 22:14
    Minimum setup plot/redefine implementation. Currently uses 8x8 (8x12 font included as well).
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-24 06:12
    That's slick! Combining this into my current UI.

    Question, (See attached)

    Is there a way to get color fonts and plot working at the same time? If I remark the vga.setn(2, @palette{0}) line, the plot command works well. If I leave it in, the plot command is influence by the text colors which were on the screen.

    jeffs_demo2.zip

    OBC
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-24 06:33
    Is there a way to get color fonts and plot working at the same time? If I remark the vga.setn(2, @palette{0}) line, the plot command works well. If I leave it in, the plot command is influence by the text colors which were on the screen.
    You don't need the setn() call anymore. The original UI used to start in monochrome mode (less memory). The demo object itself provided the colour buffer. Now the colour buffer is included in the UI (link[2] in init) which means the moment you provide a new one the internal one gets disconnected. This also means cext should be set to @plte{0} (or the code adjusted accordingly).

    So as a quick fix add cext := @plte{0} before the driver.init() call e.g.
    PUB init
    
      longfill(@plte{0}, dcolour, constant(bcnt_raw / 2))   ' default colour
      wordfill(@scrn{0},   $2020, constant(bcnt_raw / 2))   ' clear screen
    
      link{0} := @scrn.byte[bcnt_raw - columns]             ' initial screen buffer and
      link[1] := font#height << 24 | font.addr              ' font definition
      link[2] := @plte{0}                                   ' colour buffer
    
      [COLOR="orange"]cext := @plte{0}[/COLOR]
      return driver.init(-1, @link{0})                      ' video driver and pixel generator
    
    and don't call setn from the top level object.

    Note that the plot command only affects the foreground colour so the top of the screen will retain the background from the previous text output.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-24 08:13
    Works like a champ! Thanks

    /me goes back to working on an easy UI....

    OBC
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-24 16:16
    Attached is a completed UI for this driver, designed to mimic AIGeneric in many ways.

    OBC
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-24 17:31
    @OBC: In object 50xH_ui method out can you please change it back to
    PUB OUT(c) [COLOR="red"]:[/COLOR] succ
    
    succ being zero on entry is a requirement. Otherwise is messes up your ESC sequences and I/O handling.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-04-24 17:59
    Good catch! Thanks

    Got carried away cleaning up the "Document" version of the code which displays that.

    Fixed in original link.

    OBC

    kuroneko wrote: »
    @OBC: In object 50xH_ui method out can you please change it back to
    PUB OUT(c) [COLOR="red"]:[/COLOR] succ
    
    succ being zero on entry is a requirement. Otherwise is messes up your ESC sequences and I/O handling.
  • pik33pik33 Posts: 2,398
    edited 2012-05-05 11:51
    This doesn't work in my environment. Demo board and LG W2452TX monitor. Monitor can't see any signal. Maybe sync polarisation is not accepted by this monitor... p16 led is black.
  • kuronekokuroneko Posts: 3,623
    edited 2012-05-05 15:49
    @pik33: How did you compile the demo? There is a known incompatibility with bst[c].
  • pik33pik33 Posts: 2,398
    edited 2012-05-05 22:20
    Yes, it was BST

    Edit: it works when compiled by Propeller Tool under Windows... What is wrong with bst??
  • kuronekokuroneko Posts: 3,623
    edited 2012-05-06 20:11
    pik33 wrote: »
    What is wrong with bst??
    Stuff like long +42 is emitted as 0.
  • pik33pik33 Posts: 2,398
    edited 2012-05-06 21:15
    So , I replaced this
    scrn_           long    +0                      ' |
    font_           long    +4                      ' |
    plte_           long    +8                      ' |
    fcnt_           long    12                      ' mailbox addresses (local copy)
    
    

    with this:
    scrn_           long    0                      ' |
    font_           long    4                      ' |
    plte_           long    8                      ' |
    fcnt_           long    12                      ' mailbox addresses (local copy)
    

    ... and it now works with bst (and no need to boot Windows)
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-05-06 21:43
    I'm curious what that does to the program under Propeller Tool..

    OBC
  • kuronekokuroneko Posts: 3,623
    edited 2012-05-06 21:48
    I'm curious what that does to the program under Propeller Tool..
    No change, works as is. The plus sign is more of a visual cue as to what the location of this entry is (relative to par).
Sign In or Register to comment.