Multi Cog Tile Driver Tutorial...

BamseBamse Posts: 561
edited 2008-08-27 - 19:42:02 in Propeller 1
Howdy...

Been working on this for a while and learned a lot about making video drivers and tile drivers...
This driver supports 8x8 tiles with smooth scrolling and overlaying sprites at a resolution of 376x240 pixels in NTSC.
The code was written to be easy to understand and the tutorial explain things a little bit more in details.
Even though the driver can be used as is, feel free to use it as a template for your own projects.

By the way, it's a good idea to first go through my NTSC tutorial,
http://forums.parallax.com/forums/default.aspx?f=33&m=277812
Just to get a background on the NTSC driver since it's not explained in this tutorial.

Thanks to everybody who helped out and special thanks to J.T. Cook and Baggers...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Living on the planet Earth might be expensive but it includes a free trip around the sun every year...

Experience level:
[noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
[noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
[noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
[noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
[noparse][[/noparse] ] I dream in SX28 assembler...

/Bamse

Post Edited (Bamse) : 8/27/2008 3:49:43 PM GMT

Comments

  • JT CookJT Cook Posts: 476
    edited 2008-08-27 - 17:56:54
    Looks pretty nice. How many cogs are required for the driver and also how many sprites can you have on a single scanline with it?
  • BamseBamse Posts: 561
    edited 2008-08-27 - 18:18:41
    Performance sucks... wink.gif

    I had to use 5 render cogs to be able to have the three sprites in the "demo" work on the same line...
    That made the total of cogs 7 just to run the demo...

    However it was written as a tutorial and there are a lot of things you can do to improve performance...
    Lower the resolution for example, a lot of pixels are drawn outside of the visible area...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Living on the planet Earth might be expensive but it includes a free trip around the sun every year...

    Experience level:
    [noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
    [noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
    [noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
    [noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
    [noparse][[/noparse] ] I dream in SX28 assembler...

    /Bamse
  • JT CookJT Cook Posts: 476
    edited 2008-08-27 - 19:01:56
    Well there is always a trade-off for making code easy to understand vs optimized performance code.

    I was working on tile/sprite driver that had 8 16x16 sprites per line(no screen cropping, no scrolling yet), 256 verticle pixels and I used 4 COGs. My goal was to release that, with a simple windows app to draw sprites and tiles. When I get some time, I need to finish that up sometime and release it. The goal was to make an easy to use graphics system.
  • Spork FrogSpork Frog Posts: 212
    edited 2008-08-27 - 19:24:35
    Bamse,

    I've finally had the time to take a look at your tutorials. A lot of this sort of work was a grey area for me before; I understood the concepts behind it but not really any of the specifics. Reading your tutorials, within a few minutes of reading things really start to make sense and I can understand about how to translate those conecpts into real working code. It's a good feeling to have.
  • BamseBamse Posts: 561
    edited 2008-08-27 - 19:42:02
    @ J.T.,
    I think I want to re-write a lot of the code to work on a smaller resolution and optimize the code to make it more useful.
    It's probably a good idea to use a more generic Raster driver to make it work on PAL as well.
    One thing that should speed things up is to have a few tiles in the cog itself since you don't have to access the shared memory for these...

    @Spork Frog,
    That's pretty much why I wrote this tutorial as well, to learn ho to do this...
    I have learned a lot by writing it and I'm glad others have use for it as well...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Living on the planet Earth might be expensive but it includes a free trip around the sun every year...

    Experience level:
    [noparse][[/noparse] ] Let's connect the motor to pin 1, it's a 6V motor so it should be fine.
    [noparse][[/noparse] ] OK, I got my resistors hooked up with the LEDs.
    [noparse][[/noparse]X] I got the Motor hooked up with the H-bridge and the 555 is supplying the PWM.
    [noparse][[/noparse] ] Now, if I can only program the BOE-BOT to interface with he Flux Capacitor.
    [noparse][[/noparse] ] I dream in SX28 assembler...

    /Bamse
Sign In or Register to comment.