Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:52 26 Jun 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : A way to determine the

Author Message
twofingers

Guru

Joined: 02/06/2014
Location: Germany
Posts: 1764
Posted: 03:10pm 24 Jun 2026
Copy link to clipboard 
Print this post

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: Australia
Posts: 390
Posted: 11:36am 25 Jun 2026
Copy link to clipboard 
Print this post

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: Germany
Posts: 1764
Posted: 02:36pm 25 Jun 2026
Copy link to clipboard 
Print this post

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: Netherlands
Posts: 5947
Posted: 07:48pm 25 Jun 2026
Copy link to clipboard 
Print this post

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: Australia
Posts: 3295
Posted: 09:54pm 25 Jun 2026
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026