|
Forum Index : Microcontroller and PC projects : A way to determine the
| Author | Message | ||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1764 |
Just a quick question: Is there a way to determine the tile colors (FG/BG) in Mode 1 on the Picomite HDMI? Regards MIchael causality ≠ correlation ≠ coincidence |
||||
| mozzie Guru Joined: 15/06/2020 Location: AustraliaPosts: 390 |
G'day, This is possible but not directly with a command AFAIK. At some point I had a need to read from the framebuffer to drive a display not supported by the firmware, you can read the colours of the FG/BG (Mode 1) out of the framebuffer in HDMI: Using 1024 x 600 resolution: ? Hex$(mm.info(writebuffer)) 2003BA00 ' Framebuffer Base Address &h2003BA00 + 76800 = &h2004E600 ' 1024 x 600 @ 1bpp = 76800Bytes &h2004E600 is start of Foreground Colour Buffer, 1 Byte per Tile. &h2004E600 + 9600 = &h20050B80 ' 1024/8 * 600/8 = 9600 Max Tiles @ 8*8 &h20050B80 is start of Background Colour Buffer, 1 Byte per Tile. Using PEEK and these base addresses you can find the colour of any tile. This will all change depending on mode, resolution and if framebuffers l/f exist. Hope this helps. Regards, Lyle. Edited 2026-06-26 00:30 by mozzie |
||||
| twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1764 |
Hi Lyle, Thanks for your reply. That’s exactly what I was looking for and hoping to find. I remembered seeing something like that before but couldn't find it in the manual. I’ve already experimented a bit, though unfortunately without success so far. At least it’s a good starting point, and the rest will fall into place. Thanks again for your effort and the detailed explanation! Kind regards Michael PS: I’m just wondering who changed the thread title ("A way to determine the tile colors in Mode 1?")... Russian hackers? ![]() causality ≠ correlation ≠ coincidence |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 5947 |
twofingers, Depending on what you need the info for,, there may be a better way. If you are running an MMBasic program, and need to know tile color, the best way is to remember, since your MMBasic program did set the tile color itself. If you have a shared memory application: the PEEK above is your best solution. But...if you want to work on this tile data from a PC there is another way. - in the program that set the colors: SAVE IMAGE (or SAVE COMPRESSED IMAGE) - transfer to the PC - open the image in PAINT, PHOTOSHOP or your favorite picture editor The SAVE IMAGE contains all color information. See below, a picture from 640x480 logic analyzer screen that works with tiles. As opened on the PC. ![]() But you have to save from the running program. When you stop the program, tile information is not saved. Volhout P.S. thanks to Peter, who added this functionality in 6.01, Tested on VGA. Edited 2026-06-26 06:20 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3295 |
Not tested with Tiles but perhaps reading from the screen buffer will work. Blue = pixel(x,y) And 255 : Green = (pixel(x,y) >> 8) And 255 : Red = (pixel(x,y) >> 16) Edit. Tested in Mode 1. The foreground and background colours of the tiles are read correctly. > pixel 4,4,255 : tile 0,0, RGB(0,0,255), RGB(255,64,0) > x = 4 : y = 4 : ? pixel(x,y) >> 16; pixel(x,y) >> 8 And 255; pixel(x,y) And 255 0 0 255 > x = 0 : y = 0 : ? pixel(x,y) >> 16; pixel(x,y) >> 8 And 255; pixel(x,y) And 255 255 64 0 > A little shorter. > pixel 1,1,255 : tile 0,0, RGB(255,0,0), RGB(0,128,255) > z = pixel(1,1) : ? z >> 16; z >> 8 And 255; z And 255 255 0 0 > z = pixel(0,1) : ? z >> 16; z >> 8 And 255; z And 255 0 128 255 > Edited 2026-06-26 11:52 by phil99 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |