|
Forum Index : Microcontroller and PC projects : Text Mode Character Attributes
| Author | Message | ||||
| Pilot352 Newbie Joined: 12/08/2020 Location: United StatesPosts: 34 |
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: AustraliaPosts: 3308 |
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 StatesPosts: 34 |
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: AustraliaPosts: 342 |
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 StatesPosts: 34 |
I like the box idea. I will try that. Thanks! |
||||
| robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2466 |
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 StatesPosts: 34 |
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 KingdomPosts: 4142 |
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 |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |