Shop OBEX P1 Docs P2 Docs Learn Events
Friendly VGA text driver? — Parallax Forums

Friendly VGA text driver?

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2008-12-27 19:22 in Propeller 1
Before I grab "vgahirestext" and start adding functions, I'm curious if
anyone has done a nice color 80x25 (or higher) VGA text driver yet?
Something along the lines of AiGeneric with tvtext commands?

Just need to know before I spend a couple days re-creating the wheel.

Thanks
OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
Got an SD card connected? - PropDOS

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-26 06:39
    Look at the VGA text driver in my Propeller OS. It borrows from the windowed text driver by Phil Pilgrim.
  • AribaAriba Posts: 2,687
    edited 2008-12-26 17:50
    Hello OBC

    Attached is a VGA Text driver with 100 x 50 characters, mostly compatibel to TV_Text, VGA_Text, PC_Text ...
    It uses the HiRes_Text driver, so you can only set one color per line.

    Also in the ZIP is a Demo, with a very simple Font-Editor for the 8x12 pixel font. It needs the VGA_HiRes_Font object, which is a slightly modified VGA_HiRes_Text object (the Start method return some pointers to the font). This object uses still an alternative font, but this font needs some polishing.


    Andy

    Post Edited (Ariba) : 12/26/2008 9:25:04 PM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-26 18:01
    Nice! I'm really enjoying the project, plus I've got some ideas for extending it a bit so I'll probably press on.. [noparse]:)[/noparse]

    Thanks for the VGA driver, that will save me some real time.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS

    Post Edited (Oldbitcollector) : 12/26/2008 6:26:27 PM GMT
  • mynet43mynet43 Posts: 644
    edited 2008-12-26 18:51
    Hi!

    Attached is Yet Another VGA text driver. This one outputs 128 x 64 chars.

    Mostly compatible calls but also includes cursor location which is missing in some of the routines (cursloc(x,y).

    Enjoy your quest.

    Jim
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-27 06:31
    @Jim:

    Yup, that's the driver I'm using currently. Thanks..

    I haven't found a way to support font color changes on the fly.
    Is it even possible with the current driver? Be nice to be able
    to support the ANSI color changes for linux terminals.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 15:30
    Good morning,

    You raised a very interesting question about changing color on the fly.

    I played around with it a little and added a routine called "color" to the VGA_1024 driver.

    It actually works, the calling sequence is:

    vga.color($2840) ' where the upper byte is the background color (RRGGBB00) and the lower byte is the foreground RGB color.

    Examples are $08F0 gold on blue and $2840 cyan on blue.

    I attached the modified version called VGA_1024_test. Give it a try and let me know what you think.

    If you like it, I can send it to the Obj Exch.

    Jim
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 16:18
    I can add another routine to allow different color combos on each row of the screen if that's what you want.

    To change it more than that would be a little tricky.

    Let me know what works best.

    Jim
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-27 16:47
    Actually what I'm shooting for is the ability to change text color on the fly.
    Background color could be set to one color to make things a little easier. (black maybe)
    Multiple colors on a line would be ideal.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 17:02
    You can change only the text color on the fly with this routine, just leave the background color the same and change only the foreground.

    I'm attaching a newer version that allows changing it by row.

    The calling sequence for this is:

    vga.rowcolor(ColorVal, row) ' ColorVal is the same as described above, a word with two RGB values. Row = {0,1,...63}

    Again, you can change just the text color here by leaving the background color unchanged.

    Jim
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-27 17:40
    If we do something like this instead, we can keep a consistent background color,
    (like black, which is perfect for the terminal I'm working on)

    PUB color(ColorVal) | i
    ''reset screen colors
      repeat i from 0 to rows - 1
        colors[i] := $FF & ColorVal         '$2804 (if you want cyan on blue)
    
    PUB rowcolor(ColorVal, row)
    '' reset row color to colorval
      if row > rows-1
        row := rows-1
    
       colors[noparse][[/noparse]row] := $FF & ColorVal 
    [/i]
    



    Then we can define friendly color names like we did with AiGeneric in the main program.
    (Don't use this reference, the colors are wrong.. {example only})

      BLACK             = $02
      GREY              = $03
      LWHITE            = $06
      BWHITE            = $07
      LMAGENTA          = $A3
      WHITE             = $AF
      RED               = $A2
      LRED              = $1A
      LPURPLE           = $1B
      PURPLE            = $03
      LGREEN            = $1C
      SKYBLUE           = $1D
      YELLOW            = $1E
      BYELLOW           = $A6
      LGREY             = $1F
      DGREY             = $08
      GREEN             = $A4
      ORANGE            = $06
      BLUE              = $A1
      CYAN              = $1C
      MAGENTA           = $FC
      LYELLOW           = $1E  
    
    



    Now if we could just do multiple colors on a line, it would be perfect,
    but I think this is a limitation of the driver..

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS

    Post Edited (Oldbitcollector) : 12/27/2008 5:45:51 PM GMT
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 18:05
    I think there's a better approach.

    Rather than changing the driver routines, it could be done in the calling program. That would leave the original routines available for general use.

    Here's an example:

    OrigColor := $08F0              ' set up original text and background colors
    
    TextColor := $04                ' new foreground color for text
    
    TextOnly := (OrigColor & $FF00) + TextColor ' mask out background,  then add text color (foreground)
    
    avg.color(TextOnly)
    
    ' OR
    
    avg.rowcolor(TextOnly, row)
    
    



    Alternatively, I can add another routine(s) to input the text color and change only that. Would that help?


    The only difficulty with changing it in the line is reading Chip's original code[noparse]:)[/noparse]

    It's like wheels within wheels. I can do it, but it's very labor intensive...

    Jim
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-27 18:17
    Why not just do this? (I think I broke the rowcolor somehow.. still hacking away at it)

    PUB color(ColorVal) | i
    ''reset screen colors
      repeat i from 0 to rows - 1
        colors[i] := $0000 + ColorVal
    
    PUB rowcolor(ColorVal, row)
    '' reset row color to colorval
      if row > rows-1
        row := rows-1
    
       colors[noparse][[/noparse]row] := $0000 + ColorVal 
    [/i]
    



    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 18:23
    You forgot to index color, or the editor removed it when posting?[noparse]:([/noparse] I think there's a bug in the forum code.

    I don't understand what the $0000 is for... I don't think it does anything.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-27 18:32
    Good point, I was thinking ahead a little to possibly adding an option for changing the
    background on the fly. Might be handy for inverse later.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 18:41
    I'm going to take a break for a while.

    Let me know if you want the text-only routines and I'll add them.

    Jim
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-27 18:44
    mynet43 said...
    I'm going to take a break for a while.

    Let me know if you want the text-only routines and I'll add them.

    Jim

    Yes, they would be welcome. Thanks

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • mynet43mynet43 Posts: 644
    edited 2008-12-27 19:22
    OK, here you go.

    The new routines are:

    vga.screentextcolor(TextColor) ' uses last byte for text color

    ' AND

    vga.rowtextcolor(TextColor, row) ' row = {0,1,...,63}

    The other routines: color( ) and rowcolor( ) are still there.

    Let me know what you think.

    Jim
Sign In or Register to comment.