The _textcolor() macro doesn't just turn on the macro optimization. It defines the return value of textcolor() - and that is supposed to be a COLOR_... value.
It can be used to undo what "cbm_screen_charmap.h" does. Together, those headers let you mix screen-code and PetSCII string and character literals in a C source file's Assembly output.
Changed the number literals from Assembly format to C format. Swapped the (upper-/lower-case) mappings of letters because the header converts from ASCII, not PetSCII.
Most documentation say that most of the bits are normally set to 1 or 0,
so just mentioning that in the comments.
A.N.A.L.O.G. issue 59 (April 1988) "Bits & Pieces" column, "Atari Zucchini"
(https://www.atarimagazines.com/analog/issue59/bits_pieces.php) implies
that they are used for specific things, but it's not clear enough to be
useful (or specifically states "Too complex and not pertinent").
This is probably sufficient for most purposes; if any PIA / PACTL/PBCTL
experts pop up, they can tell us exactly how those 4 bits can be utilized.
Use a C "union" to give both read (NMIST) and write (NMIRES) labels
to their shared register in ANTIC. (h/t @groessler).
Consolodate duplicated color definitions (HUE_..., COLOR_... and TGI_COLOR_...;
and the "_gtia_mkcolor()" macro), found in both "atari.h" and "atari5200.h",
moving it to "_gtia.h", which they both share (and which makes the most sense).
Cleaned up comments in Atari 8-bit headers.
Internal keycodes (POKEY's KBCODE) were already #defined in atari.h,
so didn't need a whole new set in _pokey.h.
Relocated register #define'd values outside of the structs,
improved comment format, expanded & corrected some things.
h/t Trevin Beattie (https://user.xmission.com/~trevin/) for the PIA
register descriptions.
Some register #defines for PIA.
(Some may be too Atari-centric -- I know PIA chip was used by PET &
perhaps other platforms supported by cc65. If so, perhaps we can
define them elsewhere. Not sure whether they'd be the same for 5200;
I admit I know zilch about that system except that it's _more or less_
an Atari 400)
Add #defines for certain registers' values.
Also add #defines for internal keyboard codes (unrelated to ATASCII;
e.g. [Q] = 47, [W] = 46, [Shift] adds 64, etc), as seen in KBCODE.
There aren't really standard color names (e.g., Compute!'s Mapping the Atari and First Book of Atari Graphics have different names), and exact colors shown depend on the system & device, anyway. Added a note.
* DMACTL - playfield size, DMA access, PMG resolution
* CHACTL - inverted text, inverse effects
* NMIEN
Also, added #define equivalents for Display List mode line instructions
based on Atari 8-bit OS (aka Atari BASIC "GRAPHICS" command) values
(e.g., "DL_GRAPHICS0" == "DL_CHR40x8x1").
Added some more documentation in the comments.
Added macros with assembly language for the start/end of Display List
Interrupt (DLI) functions.