Shop OBEX P1 Docs P2 Docs Learn Events
I need a VGA 512x384 / 4 color tile driver compatible with graphics.spin — Parallax Forums

I need a VGA 512x384 / 4 color tile driver compatible with graphics.spin

Marc GebauerMarc Gebauer Posts: 60
edited 2007-01-15 05:11 in Propeller 1
I completed a project using the tv.spin and graphics.spin.·But now I have to convert it to VGA. Has anyone developed or is developing a VGA 512x384 / 4 color·tile driver compatible with graphics.spin.
Along the lines of·Chip's VGA_1024x768_4-Color_Tile_Driver.

If there is'nt any driver available or in the works, I would appreciate·any information on how to modify·an exsisting driver in order to·make one. Thanks.

On a side note and as a suggestion for people who need more memory for their video graphics application, I· sacrificed 4 columns of tiles,·the left and right edges of the screen, by·using only a 12x12 tile array. This gives me·a centered square image and·has dropped my memory usage for the display/bitmap base from $3000/$3000 to $2400/$2400.
·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Post Edited (Marc Gebauer) : 1/12/2007 5:17:46 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-13 01:53
    Chip's 1024 x 768 tiled driver doesn't have to use the whole screen. You do need a word for each tile, but you can point the ones around the edges all to the same blank tile to save memory. You can also use some of the tiles for text using the ROM font tables. 64 x 48 tiles = 3072 bytes minimum.
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-13 02:37
    Thanks Mike. My project is a software·midi controller, which is used·for·managing the Mix·Masters on a software mixer.·My current version has the top half of the screen·filled with·24·buttons/indicators and a text display while the bottom half is filled with 12, vertically sliding, faders. Can you tell me, if I·use box and print functions·from the VGA_Tile_driver_Demo for my buttons and text display and just·use the bottom 1/3 of my screen for the graphics, for my faders,·where will·my· bitmap_base end up. Currently I am at $3200 and I am about to run out of memory. Do you think I can fit it all in?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-13 02:48
    You don't really need to use bitmapped graphics for sliders. Just define a set of tiles that represent partial fader bars (you only need 16 of them for 16x16 tiles and change the tile that's displayed. If you want more than 16 levels, just use 2 or more tiles vertically and change which of the 16 fixed tiles are used for each of them. Similarly, if you're careful about layout vs the tile locations, you can used tiles for parts of the buttons that might be reused and ROM font text for the center of each button. Similarly for indicators. You might end up with 20-40 fixed tiles used to construct the whole display. The nice thing about the tiled display is that you can use bitmapped graphics for a small window if you want to (like to show a graph). Look at Chip's demo program for the tiled driver.
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-13 02:56
    What concerns me is that my faders have 64 increments along their throw.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-13 03:33
    Marc,
    The display is 64 tiles by 48 tiles (all 16 x 16 pixels) and 64 increments takes only 4 vertical tiles to do if you crowd it. If you want to spread it out, use 16 tiles by 2 wide and still have room. Since you're doing a bar, you can use the same tile for both columns (the tile word is a pointer!) Since you'd be using only 4 different tiles for the bars, that would save even more memory.
    Mike
  • rokickirokicki Posts: 1,000
    edited 2007-01-13 03:41
    Note that you can actually share bitmaps too; just draw your bar "knob" thingie (assuming it has a top and bottom) and then
    just use pointers to different scan lines to point to the bitmaps.
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-13 15:59
    It's a bit to wrap my head around. Can you demonstrate how to point to scan lines and how the bits are mapped. Are there any code examples I can look at? I assume I will have to save the previous states of the bits, so they can be restoredthem, when I move the fader knob.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-14 21:04
    I have figured out how to assign memory for the tiles that I'm going to use for my faders and I have written bits to those memory locations and seen it working as expected. I will try and see if I can use the syncptr to sync my screen refresh when I move my fader knobs.

    My question is...
    Can someone explain how I assign which of the 4 possible palette colors available are active when I set or clear my display memory bits. The VGA drivers explaination does'nt seem to cover this. So far I find that %%RGBx(3) is active for the set bits and %%RGBx(0) for the cleared bits.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-14 21:14
    There's a 6 bit color palette number in each word of the array of tile pointers. 10 bits of the word point to the actual tile (pixels), the other 6 bits are an index into the color table (pointed to by "color_ptr" ... see the comments in the tile driver source). Each color table entry (long) contains the 4 sets of color information for the pixels. Again, look at the comments for the exact format. Essentially each tile can have one of 64 sets of pixel colors.

    By the way, you may not need to sync your changes to the sync flag. The sliders probably move slowly enough so the changes from frame to frame are small and may not be noticed.

    Post Edited (Mike Green) : 1/14/2007 9:18:59 PM GMT
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-14 21:43
    I must be missing something. Beacause everything you say makes sense, I've assigned the 6bit pointer to my palette, what I don't understand is how to active each of the 4 colors in the palette.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-14 22:09
    When you start up the driver, one of the parameters to the "start" method is called "color_ptr". This needs to be the address of your color palette table. This table can be up to 64 longs in size (depending on the highest color palette number you use) and you need to initialize it to the colors you want to use (see the driver source comment for the format). The demo program for the driver does show a sample table ("vgacolors"). When you create a tile, the tile pointer has the tile's address and the color palette entry number. Each pixel in the tile has one of 4 colors and these are taken from the long in the color palette table entry.
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-15 00:29
    I understand that each pixel in the tile has 4 colors and these are taken from the long in the color palette table entry but how do you activate which color gets used by the pixel? So far When I set the pixel I get the 4th color (>>RGBx<<_RGBx_RGBx_RGBx). How would I change that to one of the other colors? For instance, When I use graphics.spin I can select the color in the palette for my graphic display item·for where it·resides over·a particular tile. It's not clear to me how graphic.spin·is doing·it. I've read through the explaination in VGA_1024x768_tile_driver·a half dozen times, I understand the tile pointer in the upper 10 bits points to·the base address in memory where 16 longs reside that contain 2 interleaved bitmaps. either a character at $8000 or a bitmap character that I create, and have created, and I can see it on the screen. I understand the lower 6 bits hold a pointer to up to 64 longs that contain my palette information,·made up of 4 RGB bytes,·%%RGBx_RGBx_RGBx_RGBx, and that the R is a 3 bit value, G and B are·3 bit values. I'm not sure if the bottom 3 bits (x) of an RGB byte·has any purpose. This is where I seem to be missing something. I would have expected a 2bit assignment someplace that allows me to assign the active color from·the 4 color·palette.· In the explaination in VGA_1024x768_tile_driver·under the colorptr is this example %%3330_0110_0020_3300: %11=white, %10=dark cyan, %01=blue, %00=gold <--- which hints that there are 2 bits that can be set to activate which color the pixel uses.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 1/15/2007 2:00:15 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-15 03:14
    The color is picked by the pixel itself. Each pixel is stored in 2 bits, thus encodes one of 4 colors chosen from the 4 bytes of the long in the color palette. The RGBx for each color gives the intensity of each color R/G/B (x is not used). Look at the demo program for Chip's driver for examples.
  • Marc GebauerMarc Gebauer Posts: 60
    edited 2007-01-15 05:11
    Got it. It's all fallen together. Thanks Mike, for your understanding. You were of great service.Thank You!

    P.S. - FYI, I can move my faders without any display problems just by updating the display memory and it looks like I'll be using almost half the memory than the Graphics/TV.spin version of my project. And get 1024x768 resolution to boot! What a deal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Marc Gebauer) : 1/15/2007 5:16:24 AM GMT
Sign In or Register to comment.