Relocate register values outside structs, + more

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.
This commit is contained in:
Bill Kendrick
2019-01-15 01:24:12 -08:00
parent d52af69d69
commit 4b61c54092
5 changed files with 385 additions and 163 deletions

View File

@@ -13,7 +13,7 @@
/* */
/* */
/* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */
/* 2019-01-12: Bill Kendrick <nbs@sonic.net>: More defines for registers */
/* 2019-01-14: Bill Kendrick <nbs@sonic.net>: More defines for registers */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@@ -56,10 +56,6 @@ struct __gtia_write {
unsigned char sizep3; /* 0x0B: size of player 3 */
unsigned char sizem; /* 0x0C: size of missiles */
#define PMG_SIZE_NORMAL 0x0
#define PMG_SIZE_DOUBLE 0x1
#define PMG_SIZE_QUAD 0x2
unsigned char grafp0; /* 0x0D: graphics shape player 0 (used when ANTIC is not instructed to use DMA; see DMACTL) */
unsigned char grafp1; /* 0x0E: graphics shape player 1 */
unsigned char grafp2; /* 0x0F: graphics shape player 2 */
@@ -76,25 +72,69 @@ struct __gtia_write {
unsigned char colpf3; /* 0x19: color playfield 3 */
unsigned char colbk; /* 0x1A: color background */
/* See the "HUE_..." #defines in "atari.h" for the hue values to use with color registers, above */
/* Bitwise OR (|) with 0x00 (darkest) through 0x0F (lightest) (only even values are unique) */
unsigned char prior; /* 0x1B: priority selection */
unsigned char vdelay;
/* 0x1C: vertical delay -- one-line resolution movement of
** vertical position of an object when two line resolution display is enabled
*/
unsigned char gractl; /* 0x1D: stick/paddle latch, p/m control */
unsigned char hitclr; /* 0x1E: clear p/m collision */
unsigned char consol; /* 0x1F: builtin speaker */
};
/* Values for SIZEP0-SIZEP3 and SIZEM registers: */
#define PMG_SIZE_NORMAL 0x0 /* one color clock per pixel */
#define PMG_SIZE_DOUBLE 0x1 /* two color clocks per pixel */
#define PMG_SIZE_QUAD 0x2 /* four color clocks per pixel */
/* COLPM0-COLPM3, COLPF0-COLPF3, COLBK color registers:
** See the "HUE_..." #defines in "atari.h" for the hue values;
** Bitwise OR (|) with 0x00 (darkest) through 0x0F (lightest) (only even values are unique)
*/
/* PRIOR register values */
#define PRIOR_P03_PF03 0x01 /* Players 0-3, then Playfields 0-3, then background */
#define PRIOR_P01_PF03_P23 0x02 /* Players 0-1, then Playfields 0-3, then Players 2-3, then background */
#define PRIOR_PF03_P03 0x04 /* Playfields 0-3, then Players 0-3, then background */
#define PRIOR_PF01_P03_PF23 0x08 /* Playfields 0-1, then Players 0-3, then Playfields 2-3, then background */
#define PRIOR_5TH_PLAYER 0x10 /* Four missiles combine to be a 5th player (uses COLPF3) */
#define PRIOR_OVERLAP_3RD_COLOR 0x20 /* Overlap of players 0 and 1, and of players 2 and 3, results in a third color
(else overlap is black). The resulting color is a logical OR of the two player colors. */
#define PRIOR_GFX_MODE_9 0x40 /* 80x192 16 shade mode (shades of the background (COLBK) hue; brightness in COLBK cause additional effects) */
#define PRIOR_GFX_MODE_10 0x80 /* 80x192 9 color mode (COLPM0 (acts as background) thru COLPM3, followed by COLPF0 thru COLPF4) */
#define PRIOR_GFX_MODE_11 0xC0 /* 80x192 16 hue mode (hues of the background (COLBK) brightness) */
#define PRIOR_OVERLAP_3RD_COLOR 0x20 /* Overlap of players result in a 3rd color */
/* Overlap of players 0 & 1 and of players 2 & 3 results in a third color,
** the logical OR of the two players' colors;
** Other overlaps (e.g., players 0 and 2) result in black (0x00).
*/
unsigned char vdelay; /* 0x1C: vertical delay (for one-line resolution movement of vertical position of an object when two line resolution display is enabled */
/* GTIA special graphics mode options */
/* Pixels are 2 color clocks wide, and one scanline tall
** (so 80x192 in normal playfield width).
** May be used with both bitmap and character modelines.
*/
#define PRIOR_GFX_MODE_9 0x40
/* 16 shade shades of the background (COLBK) hue;
** Note: brightnesses other than 0 (darkest) in COLBK cause additional effects
*/
#define PRIOR_GFX_MODE_10 0x80
/* 9 color palette mode;
** COLPM0 (acts as background) thru COLPM3, followed by COLPF0 thru COLPF3, and COLBK
*/
#define PRIOR_GFX_MODE_11 0xC0
/* 16 hues of the background (COLBK) brightness;
** Note: hues other than 0 (greys) in COLBK caus additional effects
*/
/* VDELAY register values */
#define VDELAY_MISSILE0 0x01
#define VDELAY_MISSILE1 0x02
@@ -105,15 +145,17 @@ struct __gtia_write {
#define VDELAY_PLAYER2 0x40
#define VDELAY_PLAYER3 0x80
unsigned char gractl; /* 0x1D: stick/paddle latch, p/m control */
/* GRACTL register values */
#define GRACTL_MISSLES 0x01 /* enable missiles */
#define GRACTL_PLAYERS 0x02 /* enable players */
#define GRACTL_LATCH_TRIGGER_INPUTS 0x04 /* "latch" triggers; once pressed, will give a continuous pressed input until this bit is cleared */
unsigned char hitclr; /* 0x1E: clear p/m collision */
unsigned char consol; /* 0x1F: builtin speaker */
};
#define GRACTL_LATCH_TRIGGER_INPUTS 0x04
/* "Latch" triggers; once pressed, will give a continuous
** pressed input until this bit is cleared
*/
/* Define a structure with the GTIA register offsets for read (R) */
struct __gtia_read {
@@ -141,20 +183,26 @@ struct __gtia_read {
unsigned char pal; /* 0x14: pal/ntsc flag */
unsigned char unused[10];
unsigned char consol; /* 0x1F: console buttons */
};
/* PAL register possible values */
#define TV_STD_PAL 0x1
#define TV_STD_NTSC 0xE
/* Note: This only tells you whether the GTIA is PAL or NTSC; some NTSC systems are modded with PAL ANTIC chips; testing VCOUNT limits can be done to check for that */
/* Note: Seems like it's not possible to test for SECAM */
unsigned char unused[10];
unsigned char consol; /* 0x1F: console buttons */
/* Reading console keys (Start, Select, Option) via CONSOL register: */
#define CONSOL_START(x) !((unsigned char)((x) & 1)) /* true if Start pressed */
#define CONSOL_SELECT(x) !((unsigned char)((x) & 2)) /* true if Select pressed */
#define CONSOL_OPTION(x) !((unsigned char)((x) & 4)) /* true if Option pressed */
};
/* End of _gtia.h */
#endif /* #ifndef __GTIA_H */