For developers wanting to explore FCM (full-colour mode), it can be quite a daunting journey initially, so here’s some pointers along with a ‘experimentation’ walkthrough that will let you peek and poke your way to a better understanding of FCM
The gist of FCM/NCM modes
For FCM, each character on the screen is represented by 4 bytes (32-bits worth of information)
Two of those bytes are in screen memory (where we'd traditionally put our characters. e.g. at
$0800
)Two of those bytes are in colour memory (e.g. at
$ff80000
)
For NCM (nibble colour mode), each two screen characters are defined by these 32-bits)
From here-on in, I’ll refer to the concept of “two of those bytes” as “byte-pairs”.
Where to read about it in the docs?
The section of interest is in "Appendix M >> New Modes >> Displaying more than 256 unique characters via "Super-Extended Attribute Mode"
Of particular interest is these two tables. They describe how the bit-fields within the screen byte-pair and the colour byte-pair are defined.
The major gotchya that trips up newcomers is that the definition of these bit-fields varies depending on whether a certain bit within the colour byte-pair is set or cleared, the GOTOX bit.
That’s why there are two tables:
one table for when this GOTOX bit is cleared
the other table for when this GOTOX bit is set
FCM Experimentation via the UART monitor
In this section, I share my experimentation notes, all of my past attempts to peek and poke various registers in order to learn how these byte-pairs (and the bit-fields within them worked).
My notes feature a lot of screenshots, and follow this approach:
Try this, observe that…
Try this, observe that…
rinse/repeat
…so I feel it will be relatively easy for someone to simply repeat the steps I tried and gain similar understanding and insights.
How to access the UART monitor on a real MEGA65
If you’re working on real hardware, you have two options:
“OK OPTION”
- You can press MEGA+TAB keys to reveal the matrix debugger and type monitor commands within therePROS: in-built option all owners have available to them from the get-go
CONS: The monitor is shown as an overlay over the original screen, so you will be jumping in-and-out after each command you type, and this may limit your ability to view the impact of the change in real-time.
“BETTER OPTION”
- If you have a JTAG/serial adapter connected to your MEGA65, you then debug via USB-serial on your PC using either a serial terminal program like putty, or you could use a fully-fledged debugging tool like m65dbg.
How to access the UART monitor in XEMU
In xemu:
right click for context menu
Go to "Debug/Advanced >> Start umon on :4510"
Then in a console (or in a tool like putty), telnet to localhost on port 4510. E.g.:
telnet localhost 4510
You can then type monitor commands within this telnet session
How to use the UART monitor
For ‘peek’ing, you can use the 'm' command:
m<addr>
For ‘poke’ing, you can use the 's' command (it can take multiple values if you want to write several bytes to successive addresses):
s<addr> <val1> [<val2> <val3> ...]
So, where can I find your FCM experimentation notes then?
My notes are available as a google doc here: