Shop OBEX P1 Docs P2 Docs Learn Events
P2Prep, and other Prop2 Display Drivers ( title change from Prop2 test card image ) — Parallax Forums

P2Prep, and other Prop2 Display Drivers ( title change from Prop2 test card image )

BaggersBaggers Posts: 3,019
edited 2013-04-23 17:02 in Propeller 2
Hi All,
Wrote a converter to change a 24bit BMP into 16bit RGB data for a prop2, and also change binary file into a .txt file, that can be then copied and pasted into a serial program to upload it to monitor, with the address included at every $1000 to save a little on upload time :D

Here is my first "real" bitmap on a prop2.

If anyone is interested in this app ( windows, should work in wine also ) then let me know.

P2 1024x768 16 bit colour bitmap SDRAM driver
HiResBitmaps.zip

Here is P2Prep to prepare data for loading to Prop2 over Monitor.
P2Prep.zip
P2Prep source here.
P2Prep.c

Here is a P2 8bit paletted BITMAP from a modified version of Tubular's greyscale driver :)
P2_NTSC_252x96_8bit_Palettised_DE0_and_DE2.zip

Here is a P2 8bit paletted BITMAP 128x96 threaded, for use with DE0 ( and DE2 ) and also P2Prep, updated to grab/convert 8bit 332 bitmaps.
DE0.zip

Here is the P2 8bit 128x96 threaded bitmap driver with 8 8x16 sprites, and some code running in the threads you can use to make your own stuff.
JB_Sprites_DE0.zip

testcard.jpg


Here is the P2 16bit 512x384 ( 512x192 at the moment, until I sort interlace mode next ) bitmap using Chip's SDRAM driver.
SDRAM_TV.zip

parallax.jpg


Here is a binary to SDRAM sender :) check out the runme.bat to see how to send stuff. -a0 is to address $0 ( ie don't add the $ )
TO_SDRAM.zip
«13

Comments

  • ColeyColey Posts: 1,108
    edited 2013-03-29 04:17
    Well done Jim, looks great, what resolution is that?
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-29 04:18
    Hi Baggers.

    I'm are first one that are interested.

    Baggers wrote: »
    Hi All,
    Wrote a converter to change a 24bit BMP into 16bit RGB data for a prop2, and also change binary file into a .txt file, that can be then copied and pasted into a serial program to upload it to monitor, with the address included at every $1000 to save a little on upload time :D

    Here is my first "real" bitmap on a prop2.

    If anyone is interested in this app ( windows, should work in wine also ) then let me know.

    testcard.jpg
  • BaggersBaggers Posts: 3,019
    edited 2013-03-29 04:45
    Hi Coley, thanks :D it's 256x192 16bit RGB-565 ( mode $e )

    Hi Sapieha,
    Here it is, I've included the testcard.bmp also, and a batch file g.bat

    to convert the image, just type

    g testcard

    It will then do two passes on the converter.
    First pass to convert the bitmap to a binary, which will invert it ( as BMPs are stored upside down ) and it will skip the first $36 bytes the BMP header, and remove the last 2 bytes, to make it just the bitmap, then it will convert each RGB888 into RGB565 then save out the binary.

    Second pass to convert the raw binary into a .txt file that is compatible with the Monitor, with the load address of $8000 ( in the bat file if you want to see how it works, note don't use $ when stating any addresses or skip lenths, when using p2download directly )

    Then load the txt file, and copy the while file, then go into PUTTY ( thanks potatohead for the heads up on that app ) or your serial app that you can copy and paste into and press space, activate the monitor, then paste ( or right click when using PUTTY, assuming you have it set in the settings Window Selection right pastes )

    Oh and I have baud set to 512000 which seems fine, anything faster can get messed up.

    It takes a while to upload the image, then run your program to display the 16bit bitmap ( you can use the one in my cog renderer, but remember to remove the render coginit :D )

    If you have any questions, let me know!.

    P2Download.zip
  • ColeyColey Posts: 1,108
    edited 2013-03-29 12:39
    Here's a couple using Tubular's 256 Geyscale driver in 256x96 resolution.

    Using a couple of utilities of Baggers (bmp8tolite and prop2download) I converted the images into a text file that is downloaded to the DE0 using the Monitor.
    Then I ran Tubulars driver on PNut (I comented out the bitmap generation routine) and downloaded to the DE0 and voilla!

    I've got to say I am very impressed with the quality, if the final chip is as good as this Parallax will surely have a winner.

    Regards,

    Coley

    mario.jpg
    cat.jpg
    1024 x 768 - 142K
    1024 x 768 - 81K
  • BaggersBaggers Posts: 3,019
    edited 2013-03-29 12:53
    Nice one Coley :D Cheers

    I'm going to update the first post with P2Prep, ( P2Download is now called P2Prep. )
    I've changed it a tad, to make it more friendly, and allowed 32bit bmps also, ( untested so I'm hoping I got the right byte to remove the alpha, will test this and fix, if not. )
    I've also added the greyscale driver that Coley had modified, and a 8bit bmp convert also in P2Prep, so you can convert greyscale 8bit bitmaps that are 256x96.

    Enjoy.
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-29 13:01
    Hi Baggers

    Link don't function


    Baggers wrote: »
    Nice one Coley :D Cheers

    I'm going to update the first post with P2Prep, ( P2Download is now called P2Prep. )
    I've changed it a tad, to make it more friendly, and allowed 32bit bmps also, ( untested so I'm hoping I got the right byte to remove the alpha, will test this and fix, if not. )
    I've also added the greyscale driver that Coley had modified, and a 8bit bmp convert also in P2Prep, so you can convert greyscale 8bit bitmaps that are 256x96.

    Enjoy.
  • ColeyColey Posts: 1,108
    edited 2013-03-29 13:23
    worked for me :-)
    Sapieha wrote: »
    Hi Baggers

    Link don't function
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-03-29 13:26
    Nice job baggers.

    I P2Prep now a combined conversion and monitor download program? If so, would be nice to just have a monitor download program (that could then be posted in the Tools thread). IIRC Sapieha was looking for this.
  • BaggersBaggers Posts: 3,019
    edited 2013-03-29 15:30
    Cluso99, it doesn't download, I suppose I could make one that opens the serial port, and outputs the data :)

    Maybe for the next version! but I didn't want to divert people from David's P2load.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-03-29 16:51
    Baggers wrote: »
    Cluso99, it doesn't download, I suppose I could make one that opens the serial port, and outputs the data :)

    Maybe for the next version! but I didn't want to divert people from David's P2load.

    David's is not going to do downloads using the monitor and his rationale for this is fine. I thought you had this when you mentioned PropDownload after converting the bmp to the monitor style. I know Sapieha is looking for this type of downloader for debugging with the monitor, and it makes sense for some.

    I think Andy's Prop2Terminal may use the monitor to download.
  • BaggersBaggers Posts: 3,019
    edited 2013-03-30 02:50
    In that case then I think I may do that, if it's what people want. :D
  • SapiehaSapieha Posts: 2,964
    edited 2013-03-30 02:54
    Hi Baggers.

    If You made loader trough Monitor --- Write in in that way it can convert any type of file to Monitor HEX compatible file and save on PC's HD
    With any Address specified on command line
    Baggers wrote: »
    In that case then I think I may do that, if it's what people want. :D


    Ps. That can help even people that will load trough WiFi
  • BaggersBaggers Posts: 3,019
    edited 2013-03-30 04:43
    Sapieha, it can already convert any binary file to monitor Hex compatible format, to load at any address

    P2Prep filename.bin filename.txt -a8000

    Will convert filename.bin into a Monitor Hex text file which will load at $8000
  • BaggersBaggers Posts: 3,019
    edited 2013-03-30 04:47
    Also added an 8bit Palettised display driver in top post, for DE0 and DE2
    need to set USING_A_DE0 to 0 for DE2


    Edit: In the zip file in top post, I've put a 256x192 but that was from the 16bit one, so will look strange, but the driver does show 8bit file at $8000 for DE2.

    I'll also have to make chances to P2Prep, to go by what the BMP size is, I'll also make it go through the header to skip and crop the headers automatically.

    Nipping out now though, so back on it later.
  • ColeyColey Posts: 1,108
    edited 2013-03-30 05:46
    Here is an image in 8bpp NTSC on a DE0

    mario8bit.jpg
    1024 x 768 - 105K
  • BaggersBaggers Posts: 3,019
    edited 2013-04-01 05:06
    wolf1.jpg


    Hi All, just thought I'd give you a teaser preview of what's to come.

    I'm in the midst of getting to grips completely with the PIX engine :D

    Chip it's ace!
    640 x 480 - 92K
  • cgraceycgracey Posts: 14,133
    edited 2013-04-03 13:17
    Coley wrote: »
    Here is an image in 8bpp NTSC on a DE0

    mario8bit.jpg

    That's really nice to see!
  • cgraceycgracey Posts: 14,133
    edited 2013-04-03 13:21
    Baggers wrote: »
    wolf1.jpg


    Hi All, just thought I'd give you a teaser preview of what's to come.

    I'm in the midst of getting to grips completely with the PIX engine :D

    Chip it's ace!

    That looks great. Have you had any success with PIX's Z-perspective correction yet? You'll probably need to use the divider to calculate setup. Are you needing that info now?
  • cgraceycgracey Posts: 14,133
    edited 2013-04-03 13:55
    Here is some quick documentation about the big multiplier, divider, and square root circuits:

    As an aside, the MUL instruction returns immediately with the result. There is also a SCL instruction which scales by a max value of 2, with many fractional bits.

    There are separate large divider and multiplier circuits which take ~16 clocks each.

    To do a 32x32 multiply (A*B):

    SETMULA D/#n 'provide 1st term for signed multiply (use SETMULU for unsigned multiply)
    SETMULB D/#n 'provide 2nd term and start multiply
    (~16 clocks, if you want to do anything here)
    GETMULL D 'get lower-long result, waits if not ready yet
    GETMULH D 'get upper-long result, waits if not ready yet

    You can also poll GETMULL/GETMULH D WC, where C=1 and D=result if done. This is useful for multi-threading, where you don't want to stall the pipeline.

    To do a 32/32 divide (A/B):

    SETDIVA D/#n 'provide dividend term for signed divide (use SETDIVU for unsigned divide)
    SETDIVB D/#n 'provide divisor term and start divide
    (~16 clocks, if you want to do anything here)
    GETDIVQ D 'get quotient long result, waits if not ready yet
    GETDIVR D 'get remainder long result, waits if not ready yet

    You can also poll GETDIVQ/GETDIVR D WC, where C=1 and D=result if done.

    To do a 64/32 divide, do an extra SETDIVA/SETDIVU to provide the upper long of the dividend.

    To compute a 16-bit root of a 32-bit unsigned input:

    SETSQRL D/#n 'set 32-bit unsigned input and start computation
    (~16 clocks, if you want to do anything here)
    GETSQRT D 'get square root, waits if not ready yet

    You can also poll GETSQRT D WC, where C=1 and D=result if done.

    To compute a 32-bit root of a 64-bit unsigned input:

    SETSQRH D/#n 'set upper long of a 64-bit unsigned input
    SETSQRL D/#n 'set lower long of a 64-bit unsigned input and start computation
    (~32 clocks, if you want to do anything here)
    GETSQRT D 'get square root, waits if not ready yey
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-04-03 15:10
    cgracey wrote: »
    Here is some quick documentation about the big multiplier, divider, and square root circuits:

    As an aside, the MUL instruction returns immediately with the result. There is also a SCL instruction which scales by a max value of 2, with many fractional bits.

    There are separate large divider and multiplier circuits which take ~16 clocks each.

    To do a 32x32 multiply (A*B):

    SETMULA D/#n 'provide 1st term for signed multiply (use SETMULU for unsigned multiply)
    SETMULB D/#n 'provide 2nd term and start multiply
    (~16 clocks, if you want to do anything here)
    GETMULL D 'get lower-long result, waits if not ready yet
    GETMULH D 'get upper-long result, waits if not ready yet

    You can also poll GETMULL/GETMULH D WC, where C=1 and D=result if done. This is useful for multi-threading, where you don't want to stall the pipeline.

    To do a 32/32 divide (A/B):

    SETDIVA D/#n 'provide dividend term for signed divide (use SETDIVU for unsigned divide)
    SETDIVB D/#n 'provide divisor term and start divide
    (~16 clocks, if you want to do anything here)
    GETDIVQ D 'get quotient long result, waits if not ready yet
    GETDIVR D 'get remainder long result, waits if not ready yet

    You can also poll GETDIVQ/GETDIVR D WC, where C=1 and D=result if done.

    To do a 64/32 divide, do an extra SETDIVA/SETDIVU to provide the upper long of the dividend.

    To compute a 16-bit root of a 32-bit unsigned input:

    SETSQRL D/#n 'set 32-bit unsigned input and start computation
    (~16 clocks, if you want to do anything here)
    GETSQRT D 'get square root, waits if not ready yet

    You can also poll GETSQRT D WC, where C=1 and D=result if done.

    To compute a 32-bit root of a 64-bit unsigned input:

    SETSQRH D/#n 'set upper long of a 64-bit unsigned input
    SETSQRL D/#n 'set lower long of a 64-bit unsigned input and start computation
    (~32 clocks, if you want to do anything here)
    GETSQRT D 'get square root, waits if not ready yey

    Wow! That's impressive and fast. Way to go Chip ;)
  • BaggersBaggers Posts: 3,019
    edited 2013-04-03 15:34
    Glad you like it Chip :D thanks!

    I've had a play with the Z-Perspective correction also, but just working on getting the texture sorted first,
    I've got the tri rendering down both sides of the try, with UVs and setting up the pixu, and pixv registers etc, that's all working, next is to read a tri, and sort the verts etc, ready to feed this engine, then I'll get the Z once I've got the 3D rotations etc sorted.

    Thanks for the Mult and Divide info, as I had resorted to using the old Multiply and Divide from Prop1, the hardware should help speed it up again too!

    Cheers,
    Jim.

    Will post more pics tomorrow.

    I didn't get chance tonight, as it's race night! :D
  • BaggersBaggers Posts: 3,019
    edited 2013-04-03 15:36
    PS, Chip, that pic was from a 64x64 texture from wolfenstein, it's 8bit also, which as you know is too big for the texture engine :)
  • BaggersBaggers Posts: 3,019
    edited 2013-04-05 12:34
    Hi All,

    Here's a DE2 test for people to have a look at.

    It's not finished yet, but here's a preview, so no source at the moment, just a batch file to send a few binaries to the DE2.

    JBTest.zip
  • pedwardpedward Posts: 1,642
    edited 2013-04-05 12:59
    Pictures for those of us who don't have a DE2?
  • ColeyColey Posts: 1,108
    edited 2013-04-05 13:06
    or a Video ? :tongue:
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-05 13:11
    Hi Baggers..

    Nice work.

    Only some sync problems on my LCD. Give me some green blinking lines on top

    Baggers wrote: »
    Hi All,

    Here's a DE2 test for people to have a look at.

    It's not finished yet, but here's a preview, so no source at the moment, just a batch file to send a few binaries to the DE2.

    JBTest.zip
  • BaggersBaggers Posts: 3,019
    edited 2013-04-05 13:17
    Here's a vid.

    Sapieha, the green at the top, is the raster, how long it's taking the poly engine to draw them, it's not a sync issue.

    http://www.youtube.com/watch?v=QRWTaQD5t_M&feature=youtu.be
  • SapiehaSapieha Posts: 2,964
    edited 2013-04-05 13:20
    Hi Baggers.

    That raster are about 3 lines -- Then rest of picture are correct
    Baggers wrote: »
    Here's a vid.

    Sapieha, the green at the top, is the raster, how long it's taking the poly engine to draw them, it's not a sync issue.

    http://www.youtube.com/watch?v=QRWTaQD5t_M&feature=youtu.be
  • ColeyColey Posts: 1,108
    edited 2013-04-05 13:26

    Cool! :cool:
  • BaggersBaggers Posts: 3,019
    edited 2013-04-05 13:28
    Thanks Coley :)
Sign In or Register to comment.