Skip to content

Commit

Permalink
Add vera psg registers (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlund authored Sep 19, 2024
1 parent 823135e commit 34121b7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions mos-platform/cx16/cx16.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ struct __vera {
unsigned char control;
} spi; /* SD card interface */
};
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || (defined(__cplusplus) && __cplusplus >= 201103L)
static_assert(sizeof(struct __vera) == 32, "struct __vera must be 32 bytes");
#endif

#define VERA (*(volatile struct __vera *)0x9F20)

/* Audio chip */
Expand All @@ -384,6 +388,22 @@ struct __ym2151 {
};
#define YM2151 (*(volatile struct __ym2151 *)0x9F40)

/** VERA Programmable Sound Generator (PSG) layout */
struct __vera_psg {
union {
unsigned short freq;
struct {
unsigned char freq_lo; //!< Frequency word (7:0)
unsigned char freq_hi; //!< Frequency word (15:8)
};
};
unsigned char volume; //!< Left (bit 7); right (bit 6); volume (bit 5:0)
unsigned char waveform; //!< Waveform (bit 7:6) and pulse width (bit 5:0)
};
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || (defined(__cplusplus) && __cplusplus >= 201103L)
static_assert(sizeof(struct __vera_psg) == 4, "struct __vera_psg must be 4 bytes");
#endif

/* A structure with the x16emu's settings registers */
struct __emul {
unsigned char debug; /* Boolean: debugging enabled */
Expand All @@ -399,6 +419,10 @@ struct __emul {
unsigned char const keymap; /* Keyboard layout number */
char const detect[2]; /* "16" if running on x16emu */
};
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || (defined(__cplusplus) && __cplusplus >= 201103L)
static_assert(sizeof(struct __emul) == 16, "struct __emul must be 16 bytes");
#endif

#define EMULATOR (*(volatile struct __emul *)0x9FB0)

/* An array window into the half Mebibyte or two Mebibytes of banked RAM */
Expand Down

0 comments on commit 34121b7

Please sign in to comment.