Help with bitmaps, VGA, LCD
T Chap
Posts: 4,223
PRI DrawBitmap(pBitmap, pInfo)|c,i,j,BmpAddress,xPos, yPos, xSize, ySize,bpp,clr bpp:=byte[pInfo++] xSize:=byte[pInfo++] ySize:=byte[pInfo++] xPos:=byte[pInfo++] yPos:=byte[pInfo++] clr:=byte[pInfo++] row:=yPos col:=xPos c:=0 BmpAddress:=pBitmap repeat j from 0 to (ySize-1) step 2 repeat i from 0 to (xSize-1) screen[row * cols + col] := (clr<<1+1) << 10 + BmpAddress>>6 +c screen[(row+1) * cols + col] := (clr<<1) << 10 + BmpAddress>>6 +c c++ col++ row+=2 col:=xPos
Using Rays NH4 LCD driver, I need to find out if it is possible to position graphics at any position without using fixed areas using tiles. My project uses the LCD flipped 90 degrees, and I can't use PRINT. I need custom graphics and fonts to create buttons, icons. numbers, phrases. Currently, I have 26 phrases that are stored as bmp>dat files and loaded into DAT. Each of the phrases are flipped to work with the LCD. Each phrase is 160 longs. and the memory is getting maxed, with more work to be done.
So the new idea is to try to just convert 26 letters(cap) and 26 letters (non cap) to bmp, rotate, load into DAT. This way the phrases can be created in spin. But, as it is now each font bmp has to be loaded into a tile, so the letters must be spaced out too wide to be usable. I need a method to display the fonts close together, and be able to manage the spacing on a pixel basis, not tile basis. Can this be done? How about making the tiles much smaller, allowing tighter placement? The 4.3 Newhaven screen is using cols = 30 rows = 17.
My last resort is to build a board that uses 2 Props, one for graphics and one for the main program. This will at least let me add the remaining phrases to complete the required user interface, but leaves no room for expansion.
Any suggestions appreciated.
Comments
You can have several small "graphics" areas around the screen that you can draw text onto...
Another option is to use external flash or SD card or the extra space in your EEPROM to store bitmap data and cycle it in when needed...
Create 16 x 16 bmp, save to file. Open in Prop1bitmap. Adjust x and y to 1,1, by default it says it is 1x and 2y tiles.
Copy the binary (16 longs) and paste to very bottom of DAT.
Write 64 bytes of data from the .dat file location in DAT to eeprom starting at 0.
Read the 64 bytes back from eeprom, store back to a location in the UserCharStart section of DAT.
Attempt to print the bitmap.
I get echos of the bitmap using x1 and y1 sizes.
Above, aa.dat is the exported bmp>dat file from Prop 1 bit as a 1x1tile. I used 16x16 pixles to create the font.
You can see that this is an A with a few pixels on the corners just to see what the borders are doing.
I assumed that if I read in the aa.dat file, then it would park the data in DAT identical to where the eeprom would write back over it.
Is this close to correct? I am seeing what looks like the right 1/4 of A several times overlapped, like echos, but never the full version.
I really just want to get anything to work for a test so I can gauge how slow of a response time the eeprom reads would add to each time a phrase needs to pop up.
My guess is that you are not righting to the correct starting address...
The tile data starting address has to be aligned to a 16-long address so that the lower 20 bits of it's address are all zeros.
My code does this with the longmove instruction at the beginning of the code...
So, the address you want to copy to is: ( @graphic00_data & $FFC0 )
Also, I would use the upper 32kB of your probably 64kB eeprom for this data so that you can still boot...
That helps out, but strangely for some reason the image is showing up as a double. AA.dat is just a character that is 16x16, so I assumed I was replacing it's data with the new data from grr.
You'll have to change the "step 2" to "step 1" and then comment out the second "screen[" line to allow odd heights...
When I examine the content of memory starting at PADDING long 7[16] using this:
I can see the padding information as it should appear. But, when trying this to see the content of the .dat file:
It does not show the content of the dat file, the dat file is only going to contain 00, ff, 0C, 03, 0F, F0, but I am seeing a lot of other stuff. So in short, I can copy content to the eeprom if I know where exactly something is in DAT, but the externally loaded .dat files are not behaving the same. This means I need a way to either locate them in memory after they are loaded, or I need to just copy and paste from Prop1 bit. But, in looking at the output of the Prop1 bit dat file in the binary view, it seems to be missing a lot of info for larger phrases, but for a single font it looks right, even though the preview is correct. That means I cannot just copy and past the data from Prop1bit into DAT and upload to eeprom, So the options are, either find a way to access already loaded(.dat file) info and copy from there to eeprom, or find a way to copy and paste out of Prop1bit.
Try commenting out the longmove line and repeat what you describe above.
Or, try this: hex(long[@graphic1_data & $FFC0][mmm], 8)
which should give you the right address after the longmove into padding...
I know the .dat file is correct, but I vaguely remember there being a problem with the text output of one of these apps and hoping nobody would notice...
It appears that you have one tile with a sideways "1" and then a blank tile underneath. Because of the way the ROM font-style 1-bit bitmaps are encoded,
I would expect to see a lot of "AA" (binary 10101010) in the real data where the 1's make up your sideways "1" and are interleaved with the 0's for the blank tile.
That text output with all ones probably is just wrong...
I'll try to take a look at that later, but can you try just using the .dat files and not the text?
If you want, you could try this version and see if it gives the right answer:
Prop1BitBitmap.zip
The question is now, if I just want to copy and paste the binary view into DAT to view the bitmap directly versus loading the .dat file, do I just discard the char y=0, x =0 type info and put all the longs in a row as copied?
So now, that text and the .dat file should do the exact same thing... You should be able to use either one interchangeably