Shop OBEX P1 Docs P2 Docs Learn Events
Graphics Demo and VGA — Parallax Forums

Graphics Demo and VGA

Sam SchweighartSam Schweighart Posts: 5
edited 2010-02-28 03:24 in Propeller 1
In the comments section, it states that the graphics_demo code can be used on a VGA monitor (instead of TV). Which code should I use? I've tried vga.spin with limited success.

Thanks
Sam

Comments

  • Sam SchweighartSam Schweighart Posts: 5
    edited 2010-02-23 01:45
    Nevermind. Got it working... Has anyone made a 24-bit color VGA bitmap driver?

    Post Edited (Sam Schweighart) : 2/23/2010 1:51:32 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-23 02:08
    Regarding a 24-bit color VGA bitmap driver ... It can't be done for several reasons.

    1) There's not enough memory for the bitmap.· You're talking about 3 bytes per pixel and a 640 x 320 bitmap already is over 200K bytes.· You could use external SRAM for a video buffer, but there's not enough I/O pins to run this through the Propeller.· You could make an external video generator that the Propeller just accesses occasionally to write into the buffer, but you'd probably be better off buying an old VGA video card and interfacing a Propeller to its bus.

    2) The video hardware can produce 4 8-bit colors per 16-pixel line of a tile and each pixel within the 16-pixel area can be one of the four colors.· If you want more than that, you'd have to generate the video without the use of the specialized hardware and the Propeller isn't really fast enough to do that.
  • RossHRossH Posts: 5,519
    edited 2010-02-23 02:13
    Sam,

    Think what you're asking - 24 bit color bitmapped VGA driver means 24 bits (3 bytes) per pixel. Even for a small VGA display (640x480) that means you need 640*480*3 bytes - about 900kb for a complete display.

    The Propeller has 32kb available. That's why Prop drivers tend to be "tile drivers" instead of "bitmap drivers".

    Ok, you can save some bytes by fiddling about a bit and "pretending" to support 24 bt colour but actually mapping through a colour palette instead (who ever uses all possible colour combinations on the screen at one time anyway?). But even if you support only 256 different simultaneous colours, that's still 640*480 bytes required - or 300kb.

    I wrote a "virtual" bitmnapped driver that allowed you to pretend you had a bitmapped VGA displays up to 1152*864 - but you couldn't simultaneously use all the bits - if you kept writing to more bits without erasing others, eventually you ran out of bits and it just wouldn't draw any more. I use it to simulate vector graphics display - works a treat for some of the old Cinematronics type games.

    Ross.

    Edit: I see Mike beat me to it!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • wjsteelewjsteele Posts: 697
    edited 2010-02-28 00:40
    Now that I look at the PSM, it appears that Ray's actually using an 18bit color screen. (Odd bit count, I know.) But the screen hardware is doing all the work. For high color bitmaps, he's simply loading the image into the screens memory, so the actual propeller doesn't have to do any of that work.

    So, what is the best we will get out of the Prop without resorting to external video hardware? Also, what optional external video hardware has anybody used to really give us a high color style display? (I know the 4D systems can do it with their higher level language support, but are there any others?)

    (EDIT: I should clarify, we're only looking at 320x240, like on the PSM and PSB LCDs.)

    Bill
  • potatoheadpotatohead Posts: 10,261
    edited 2010-02-28 01:18
    With just the Prop, it's 64 color, using the VGA circuit.

    If your LCD takes NTSC 120 colors are possible at over 160 pixels. If you use artifacting, 400+ in-spec colors are possible, with double that being possible, if you use the over-saturated colors. Look at the wiki for a screen shot of that I did at 160x96 effective resolution. http://propeller.wikispaces.com/Colors

    Some people have used modified video circuits to get more grey shades and or used PWM to do the same, and Eric Ball used all 4 pins in the reference video circuit to get 130 colors, with considerable improvement over the default sets.

    Baggers has used external video encoders to get 16 and 24 bit color displays, at a rather high pin cost. Look for PropGFX related threads for info on that.

    If your intent is to use a prop for graphics, the lower resolutions, 160 pixels or below horizontally, and either 100 or 200 pixels vertically, offer some nice color options, but will consume the entire Propeller HUB memory space, though not the compute power at all. At higher resolutions, an extra chip will deliver higher color spaces, but the Propeller itself really won't, due to the built in limitations. My NTSC trick relies on that signal format having some limits on color that can be exploited, but only at 160 pixels or lower horizontal.

    A Prop dedicated to graphics can still do some compute and I/O, but not in a memory intensive way.

    For anything over 160 pixels, with color, it's highly likely to require dynamic display techniques where a bitmap for the whole screen is not maintained. This makes good use of the many cogs to assemble a display right before the display draws it, keeping RAM to a minimum. For GUI / status / indicator / game type displays this actually can work very well. Baggers has a WOLF3D renderer, complete with textures running on the thing, but that's all it will do, besides take a little I/O to allow one to interact with it.

    High speed serial memory devices might allow a hybrid display as well. We've not seen a completed project yet, but it's totally possible to contain higher color display elements in one of those serial memory devices, and spool it out as the beam is drawn for all static display elements, using the HUB memory for dynamic ones. If external circuits are used, getting a useful 320 pixel display is probable, given some planning on what gets spooled from the serial device, and what gets drawn from the HUB memory buffer.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Safety Tip: Life is as good as YOU think it is!
  • RaymanRayman Posts: 14,877
    edited 2010-02-28 01:19
    Well, I think a 24-bit bitmap driver is possible... As long as your bitmap color table only has 4 color entries... But, I don't know how valueable that is...

    But, I think Bill Henning may have a 24-bit driver with a 256 color table...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    My Prop Products:· http://www.rayslogic.com/Propeller/Products/Products.htm
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-02-28 02:18
    Nothing close to 24bpp... at least not at this time [noparse]:)[/noparse]

    What I do have available right now on Morpheus is:

    1024x768 with 4 colors out of 256 per pixel, separate palette for each scan line
    800x600 with 4 colors out of 256 per pixel, separate palette for each scan line
    640x480 with 4 colors out of 256 per pixel, separate palette for each scan line
    256x192 with 256 colors per pixel (using 1024x768 XGA timing)

    I am planning to release the following drivers for Morpheus later this year:

    320x240 with 256 colors per pixel (using 640x480 VGA timing)
    400x300 with 256 colors per pixel (using 800x600 SVGA timing)
    Rayman said...
    Well, I think a 24-bit bitmap driver is possible... As long as your bitmap color table only has 4 color entries... But, I don't know how valueable that is...

    But, I think Bill Henning may have a 24-bit driver with a 256 color table...
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com 5.0" VGA LCD in stock!
    Morpheus dual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory/IO kit $89.95, both kits $189.95 SerPlug $9.95
    Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
    Las - Large model assembler Largos - upcoming nano operating system
  • VIRANDVIRAND Posts: 656
    edited 2010-02-28 03:24
    If this is relevant, a short while ago, not knowing whether this had been done before,
    I rewrote the GRAPHICS demo to output to TV and VGA simultaneously, just to see if I could,
    with the idea that there are enough analog TVs and VGA monitors in the rubbish to be useful
    with the Propeller at any time.

    The limitations of my mod demo is that I did not go so far as to define similar colors for
    both screens, so I had to choose the closest color values for similar results which is not
    an easy task since the color codes work very differently for both kinds of display.

    This is what I have done.
    http://forums.parallax.com/showthread.php?p=872107
Sign In or Register to comment.