Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:18 14 Nov 2025 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 : Text Mode Character Attributes

Author Message
Pilot352
Newbie

Joined: 12/08/2020
Location: United States
Posts: 34
Posted: 01:12pm 21 Aug 2020
Copy link to clipboard 
Print this post

Hello,

Is there a method to read and/or change the text colors (foreground and background) without reprinting the string? I'm not referring to using the color(x) command. For example; I put some text in the middle of the screen that says "Hello World" and it's printed green background and black text. I want to change the color to red background with white text.

The reason for asking is if I want to create a menu list of random items and use color as the cursor to select the item it would be helpful to be able to just change the color of the text and not have to reprint it. This is similar to the files command where you select the item highlighted in blue.
Edited 2020-08-21 23:13 by Pilot352
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3308
Posted: 01:43pm 21 Aug 2020
Copy link to clipboard 
Print this post

No.  Your question implies that text on the screen has attributes, which it does not - see the answer to your previous question re text.

There is nothing wrong with rewriting the entry with new colours.

Geoff
Geoff Graham - http://geoffg.net
 
Pilot352
Newbie

Joined: 12/08/2020
Location: United States
Posts: 34
Posted: 02:01pm 21 Aug 2020
Copy link to clipboard 
Print this post

I understand that there are no attributes. I was just wondering if there were other methods that people use other that rewriting the string. No need to get mad.
 
capsikin
Guru

Joined: 30/06/2020
Location: Australia
Posts: 342
Posted: 02:31pm 21 Aug 2020
Copy link to clipboard 
Print this post

  Pilot352 said  I understand that there are no attributes. I was just wondering if there were other methods that people use other that rewriting the string. No need to get mad.


I haven't used any, just thinking of options.

I guess you could use the colour remapping with MAP. You'd need to use different colour numbers for each string, then remap the colours for the string you want to change.

Or you could save all the white pixels of text in one page, draw a background colour with a box command, then bit all the white pixels back again using blit (only allows changing background colour, not the foreground).
 
Pilot352
Newbie

Joined: 12/08/2020
Location: United States
Posts: 34
Posted: 02:42pm 21 Aug 2020
Copy link to clipboard 
Print this post

I like the box idea. I will try that. Thanks!
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2466
Posted: 04:50pm 21 Aug 2020
Copy link to clipboard 
Print this post

assuming your text is placed on a grid (column, line), why not just keep track of the colours yourself? for instance, for a 100x50 screen, use something like:


DIM FGcolour%(100,50)
DIM BGcolour%(100,50)
DIM charcode%(100,50)


then as you place characters on the screen, fill in the appropriate element in each of the three arrays one character cell at a time.

as Geoff has pointed out elsewhere, the 'screen' on the CMM2 is bitmapped, and once you have printed something to the screen it only then exists as a series of coloured dots - there is no sensible way of reversing this process. this is exactly how just about every modern computer works - CMM, CMM2, windows/linux/macOS PCs.

you would be hard pushed to find anything that still uses a character generator ROM and character/attribute mappings on-the-fly in hardware, as there is simply no need for it these days. way back, RAM was expensive and CPU cycles in short supply, so we used (incredibly) complicated hardware to generate video images. these days, both RAM and CPU cycles are cheap, hence everything is purely bitmapped.


cheers,
rob   :-)
 
Pilot352
Newbie

Joined: 12/08/2020
Location: United States
Posts: 34
Posted: 06:34pm 21 Aug 2020
Copy link to clipboard 
Print this post

  robert.rozee said  
you would be hard pushed to find anything that still uses a character generator ROM and character/attribute mappings on-the-fly in hardware, as there is simply no need for it these days. way back, RAM was expensive and CPU cycles in short supply, so we used (incredibly) complicated hardware to generate video images. these days, both RAM and CPU cycles are cheap, hence everything is purely bitmapped.


You do bring up an interesting point. Most computers now boot into a GUI. However, what about the BIOS? And in most GUI's the attribute bytes and text memory behavior is emulated. Which Brings me to my original question of, maybe not now, but in the future, can a mode be made to emulate the attributes?

Again, as to not ruffle any feathers, I'm just wondering if it was possible.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4139
Posted: 12:49pm 22 Aug 2020
Copy link to clipboard 
Print this post

As Rob has explained, you can do it yourself.

To load the overhead onto every MMBasic user would be unreasonable, since it's likely almost no-one wants it.

John
 
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 2025