mirror of
https://github.com/holub/mame
synced 2025-04-26 02:07:14 +03:00
Fix up GBA build and replace some stupid macros with members
This commit is contained in:
parent
8aebdfc06d
commit
222d054bdc
@ -419,7 +419,7 @@ void gb_lcd_device::common_reset()
|
||||
// specific reg initialization
|
||||
m_vid_regs[0x06] = 0xff;
|
||||
|
||||
for (int i = 0x0c; i < _NR_GB_VID_REGS; i++)
|
||||
for (int i = 0x0c; i < NR_GB_VID_REGS; i++)
|
||||
m_vid_regs[i] = 0xff;
|
||||
|
||||
LCDSTAT = 0x80;
|
||||
|
@ -12,9 +12,6 @@
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
#define _NR_GB_VID_REGS 0x40
|
||||
|
||||
|
||||
struct layer_struct {
|
||||
UINT8 enabled;
|
||||
UINT8 *bg_tiles;
|
||||
@ -82,7 +79,9 @@ protected:
|
||||
|
||||
int m_window_lines_drawn;
|
||||
|
||||
UINT8 m_vid_regs[_NR_GB_VID_REGS];
|
||||
static constexpr unsigned NR_GB_VID_REGS = 0x40;
|
||||
|
||||
UINT8 m_vid_regs[NR_GB_VID_REGS];
|
||||
UINT8 m_bg_zbuf[160];
|
||||
|
||||
UINT16 m_cgb_bpal[32]; /* CGB current background palette table */
|
||||
|
@ -15,9 +15,7 @@
|
||||
|
||||
#include "gba_lcd.h"
|
||||
|
||||
#include "includes/gba.h"
|
||||
|
||||
#define REG_BASE 0x000
|
||||
#include "includes/gba.h" // this is a dependency from src/devices to src/mame which is very bad and should be fixed
|
||||
|
||||
/* LCD I/O Registers */
|
||||
#define DISPCNT HWLO(0x000) /* 0x4000000 2 R/W LCD Control */
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
@ -38,8 +39,33 @@ extern const device_type GBA_LCD;
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class gba_lcd_device : public device_t,
|
||||
public device_video_interface
|
||||
template <unsigned COUNT, unsigned BASE>
|
||||
class gba_registers
|
||||
{
|
||||
protected:
|
||||
static constexpr unsigned REG_BASE = BASE;
|
||||
|
||||
UINT32 &WORD(unsigned x) { return m_regs[(x - REG_BASE) / 4]; } // 32-bit Register
|
||||
const UINT32 &WORD(unsigned x) const { return m_regs[(x - REG_BASE) / 4]; } // 32-bit Register
|
||||
UINT16 HWHI(unsigned x) const { return UINT16(WORD(x) >> 16); } // 16-bit Register, Upper Half-Word
|
||||
UINT16 HWLO(unsigned x) const { return UINT16(WORD(x)); } // 16-bit Register, Lower Half-Word
|
||||
|
||||
UINT32 &WORD_SET(unsigned x, UINT32 y) { return WORD(x) |= y; }
|
||||
UINT32 &HWHI_SET(unsigned x, UINT16 y) { return WORD(x) |= UINT32(y) << 16; }
|
||||
UINT32 &HWLO_SET(unsigned x, UINT16 y) { return WORD(x) |= UINT32(y); }
|
||||
|
||||
UINT32 &WORD_RESET(unsigned x, UINT32 y) { return WORD(x) &= ~y; }
|
||||
UINT32 &HWHI_RESET(unsigned x, UINT16 y) { return WORD(x) &= ~(UINT32(y) << 16); }
|
||||
UINT32 &HWLO_RESET(unsigned x, UINT16 y) { return WORD(x) &= ~UINT32(y); }
|
||||
|
||||
UINT32 m_regs[COUNT];
|
||||
};
|
||||
|
||||
|
||||
class gba_lcd_device
|
||||
: public device_t
|
||||
, public device_video_interface
|
||||
, protected gba_registers<0x060 / 4, 0x000>
|
||||
{
|
||||
public:
|
||||
gba_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
@ -83,8 +109,6 @@ private:
|
||||
|
||||
bitmap_ind16 m_bitmap;
|
||||
|
||||
UINT32 m_regs[0x60 / 4];
|
||||
|
||||
UINT8 m_windowOn;
|
||||
UINT8 m_fxOn;
|
||||
UINT8 m_gfxBG2Changed;
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "bus/gba/rom.h"
|
||||
#include "softlist.h"
|
||||
|
||||
#define REG_BASE 0x060
|
||||
|
||||
/* Sound Registers */
|
||||
#define SOUNDCNT_L HWLO(0x080) /* 0x4000080 2 R/W Control Stereo/Volume/Enable */
|
||||
#define SOUNDCNT_H HWHI(0x080) /* 0x4000082 2 R/W Control Mixing/DMA Control */
|
||||
|
@ -9,18 +9,6 @@
|
||||
#include "sound/dac.h"
|
||||
#include "video/gba_lcd.h"
|
||||
|
||||
#define WORD(x) (m_regs[(x - REG_BASE) / 4]) /* 32-bit Register */
|
||||
#define HWHI(x) (m_regs[(x - REG_BASE) / 4] >> 16) /* 16-bit Register, Upper Half-Word */
|
||||
#define HWLO(x) (m_regs[(x - REG_BASE) / 4] & 0x0000ffff) /* 16-bit Register, Lower Half-Word */
|
||||
|
||||
#define WORD_SET(x, y) (m_regs[(x - REG_BASE) / 4] |= (y))
|
||||
#define HWHI_SET(x, y) ((m_regs[(x - REG_BASE) / 4] |= (y << 16)))
|
||||
#define HWLO_SET(x, y) (m_regs[(x - REG_BASE) / 4] |= (y))
|
||||
|
||||
#define WORD_RESET(x, y) (m_regs[(x - REG_BASE) / 4] &= ~(y))
|
||||
#define HWHI_RESET(x, y) ((m_regs[(x - REG_BASE) / 4] &= ~(y << 16)))
|
||||
#define HWLO_RESET(x, y) (m_regs[(x - REG_BASE) / 4] &= ~(y))
|
||||
|
||||
#define INT_VBL 0x0001
|
||||
#define INT_HBL 0x0002
|
||||
#define INT_VCNT 0x0004
|
||||
@ -37,7 +25,7 @@
|
||||
#define INT_GAMEPAK 0x2000
|
||||
|
||||
/* driver state */
|
||||
class gba_state : public driver_device
|
||||
class gba_state : public driver_device, protected gba_registers<(0x400 - 0x060) / 4, 0x060>
|
||||
{
|
||||
public:
|
||||
gba_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
@ -75,8 +63,6 @@ public:
|
||||
void dma_exec(int ch);
|
||||
void audio_tick(int ref);
|
||||
|
||||
UINT32 m_regs[(0x400 - 0x60) / 4];
|
||||
|
||||
// DMA
|
||||
emu_timer *m_dma_timer[4];
|
||||
UINT32 m_dma_src[4];
|
||||
|
Loading…
Reference in New Issue
Block a user