Shop OBEX P1 Docs P2 Docs Learn Events
8bc Graphics Driver — Parallax Forums

8bc Graphics Driver

JetfireJetfire Posts: 34
edited 2009-05-28 10:31 in Propeller 1
This driver makes it easy to work with color. The driver is built on Chip Gracey's graphics.spin and tv.spin. Cardboardguru's and potatohead's work was also vital to showing how to work with with many colors.

The basic architecture change is that the frame buffer now holds the 8 bit color that the video generator uses. Instead of configuring a tile's color palette, you just draw with the color you want. The usage is basically the same if you're already familiar with graphics.

Check out the demo for some examples of what can be done.

The included files are set for NTSC, 5 Mhz x 16, and pins 12, 13, 14. Configuring them is the same as using graphics.spin.

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-18 04:19
    That's pretty cool! Nicely Done!

    Good base driver for some more games.

    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
  • potatoheadpotatohead Posts: 10,261
    edited 2008-12-18 04:41
    Agreed.

    This will make basic Propeller graphics a lot easier for people. It's probably a good idea to go back through the Parallax reference graphics library and TV driver and add set color commands to it. The tile limitations would be in place, of course, but it would be easier than going through and editing the colors array. I like how you implemented these!

    I'll second OBC. Nicely done!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
    Safety Tip: Life is as good as YOU think it is!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-12-18 05:01
    @Jetfire,

    I take it the rectangular center (Randomlogo) was used because of memory limitations or can that be done in full screen as well?

    OBC

    Edit: This happy medium looks better on my display... (Thought I'd share..)
    [b]PUB[/b] RandomLogo | i, x, y, color, cyc, speed
    
      BlankBuffers
      tv_hx := 12
      tv_vx := 1
      tv_ht := 8
      tv_vt := 12
      tv_screen := bitmap_base
      gr.setup(8, 12, 64, 16, bitmap_base, @line_base)
      edgecolor := $02
    
      r.start
    
      speed := 5
    
      cyc := 0
    
      [b]repeat[/b] [b]until[/b] cyc > 2000
    
        x := r.random//64 '- 135
        y := r.random//200 '- 55
    
    
        color := ||(r.random//8) + 8
        color += ||((r.random//16)*16)
    
        gr.pixcolor($00,color,color,color)
    
    
        [b]if[/b] cyc =< 1200
          gr.pix(x,y,0,@propicon3)
    
        [b]else[/b]
          gr.pixcolor($00,$DD,$DF,$5D)
          gr.pix(x,y,0,@propicon3)
    
          gr.pixcolor($00,$6E,$00,$00)
          gr.pix(x,y,1,@propyellow)
    
        [b]waitcnt[/b](clkfreq/speed + [b]cnt[/b])
    
        cyc++
    
        [b]if[/b] speed < 499
          ++speed
    
      gr.clear
      gr.pixcolor($00,$DD,$DF,$5D)
      gr.pix(0,0,0,@propicon3)
    
      gr.pixcolor($00,$6E,$00,$00)
      gr.pix(0,0,1,@propyellow)
    
      [b]waitcnt[/b](clkfreq*5 + [b]cnt[/b])
    
      BlankBuffers
      tv_hx := 20
      tv_vx := 2
      tv_ht := 8
      tv_vt := 6
      tv_screen := display_base
      gr.setup(8, 6, 64, 48, bitmap_base, @line_base) 
    
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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/18/2008 5:17:10 AM GMT
  • schwiegjcschwiegjc Posts: 41
    edited 2008-12-19 15:04
    Can this be used to color lines? In the previous graphics code, if your graphed a line on the screen, the color of the line would change as the line went down the screen.
  • JetfireJetfire Posts: 34
    edited 2008-12-19 18:38
    Yes, this driver can do that, you just set the color before the draw command, no messing with the color table.

    Graphics can do this too, but the color table has to be set up correctly.
  • geokonstgeokonst Posts: 48
    edited 2009-05-27 23:40
    Hello everybody.

    Can somebody please show me how to setup the color table in graphics right?

    I want to be able to choose colors like in 8bc (I would use 8bc but textmode doesn't work in 8bc-at least not for me)

    Thank you

    Post Edited (geokonst) : 5/28/2009 12:20:37 AM GMT
  • geokonstgeokonst Posts: 48
    edited 2009-05-28 10:31
    any ideas?
Sign In or Register to comment.