mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Merge pull request #4731 from cam900/tms34061_args
tms34061.cpp : Simplify handlers, Use shorter type values
This commit is contained in:
commit
aaadc281cf
@ -32,7 +32,7 @@
|
||||
|
||||
DEFINE_DEVICE_TYPE(TMS34061, tms34061_device, "tms34061", "TI TMS34061 VSC")
|
||||
|
||||
tms34061_device::tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
tms34061_device::tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, TMS34061, tag, owner, clock),
|
||||
device_video_interface(mconfig, *this),
|
||||
m_rowshift(0),
|
||||
@ -64,10 +64,10 @@ void tms34061_device::device_start()
|
||||
m_vrammask = m_vramsize - 1;
|
||||
|
||||
/* allocate memory for VRAM */
|
||||
m_vram = auto_alloc_array_clear(machine(), uint8_t, m_vramsize + 256 * 2);
|
||||
m_vram = auto_alloc_array_clear(machine(), u8, m_vramsize + 256 * 2);
|
||||
|
||||
/* allocate memory for latch RAM */
|
||||
m_latchram = auto_alloc_array_clear(machine(), uint8_t, m_vramsize + 256 * 2);
|
||||
m_latchram = auto_alloc_array_clear(machine(), u8, m_vramsize + 256 * 2);
|
||||
|
||||
/* add some buffer space for VRAM and latch RAM */
|
||||
m_vram += 256;
|
||||
@ -171,7 +171,7 @@ TIMER_CALLBACK_MEMBER( tms34061_device::interrupt )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void tms34061_device::register_w(address_space &space, offs_t offset, uint8_t data)
|
||||
void tms34061_device::register_w(offs_t offset, u8 data)
|
||||
{
|
||||
int scanline;
|
||||
int regnum = offset >> 2;
|
||||
@ -242,10 +242,10 @@ void tms34061_device::register_w(address_space &space, offs_t offset, uint8_t da
|
||||
*
|
||||
*************************************/
|
||||
|
||||
uint8_t tms34061_device::register_r(address_space &space, offs_t offset)
|
||||
u8 tms34061_device::register_r(offs_t offset)
|
||||
{
|
||||
int regnum = offset >> 2;
|
||||
uint16_t result;
|
||||
u16 result;
|
||||
|
||||
/* extract the correct portion of the register */
|
||||
if (regnum < ARRAY_LENGTH(m_regs))
|
||||
@ -364,7 +364,7 @@ void tms34061_device::adjust_xyaddress(int offset)
|
||||
}
|
||||
|
||||
|
||||
void tms34061_device::xypixel_w(address_space &space, int offset, uint8_t data)
|
||||
void tms34061_device::xypixel_w(int offset, u8 data)
|
||||
{
|
||||
/* determine the offset, then adjust it */
|
||||
offs_t pixeloffs = m_regs[TMS34061_XYADDRESS];
|
||||
@ -384,7 +384,7 @@ void tms34061_device::xypixel_w(address_space &space, int offset, uint8_t data)
|
||||
}
|
||||
|
||||
|
||||
uint8_t tms34061_device::xypixel_r(address_space &space, int offset)
|
||||
u8 tms34061_device::xypixel_r(int offset)
|
||||
{
|
||||
/* determine the offset, then adjust it */
|
||||
offs_t pixeloffs = m_regs[TMS34061_XYADDRESS];
|
||||
@ -409,7 +409,7 @@ uint8_t tms34061_device::xypixel_r(address_space &space, int offset)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void tms34061_device::write(address_space &space, int col, int row, int func, uint8_t data)
|
||||
void tms34061_device::write(int col, int row, int func, u8 data)
|
||||
{
|
||||
offs_t offs;
|
||||
|
||||
@ -419,12 +419,12 @@ void tms34061_device::write(address_space &space, int col, int row, int func, ui
|
||||
/* both 0 and 2 map to register access */
|
||||
case 0:
|
||||
case 2:
|
||||
register_w(space, col, data);
|
||||
register_w(col, data);
|
||||
break;
|
||||
|
||||
/* function 1 maps to XY access; col is the address adjustment */
|
||||
case 1:
|
||||
xypixel_w(space, col, data);
|
||||
xypixel_w(col, data);
|
||||
break;
|
||||
|
||||
/* function 3 maps to direct access */
|
||||
@ -471,7 +471,7 @@ void tms34061_device::write(address_space &space, int col, int row, int func, ui
|
||||
}
|
||||
|
||||
|
||||
uint8_t tms34061_device::read(address_space &space, int col, int row, int func)
|
||||
u8 tms34061_device::read(int col, int row, int func)
|
||||
{
|
||||
int result = 0;
|
||||
offs_t offs;
|
||||
@ -482,12 +482,12 @@ uint8_t tms34061_device::read(address_space &space, int col, int row, int func)
|
||||
/* both 0 and 2 map to register access */
|
||||
case 0:
|
||||
case 2:
|
||||
result = register_r(space, col);
|
||||
result = register_r(col);
|
||||
break;
|
||||
|
||||
/* function 1 maps to XY access; col is the address adjustment */
|
||||
case 1:
|
||||
result = xypixel_r(space, col);
|
||||
result = xypixel_r(col);
|
||||
break;
|
||||
|
||||
/* function 3 maps to direct access */
|
||||
@ -535,13 +535,13 @@ uint8_t tms34061_device::read(address_space &space, int col, int row, int func)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ8_MEMBER( tms34061_device::latch_r )
|
||||
u8 tms34061_device::latch_r()
|
||||
{
|
||||
return m_latchdata;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER( tms34061_device::latch_w )
|
||||
void tms34061_device::latch_w(u8 data)
|
||||
{
|
||||
LOG("tms34061_latch = %02X\n", data);
|
||||
m_latchdata = data;
|
||||
|
@ -23,35 +23,35 @@ public:
|
||||
/* display state structure */
|
||||
struct tms34061_display
|
||||
{
|
||||
uint8_t blanked; /* true if blanked */
|
||||
uint8_t *vram; /* base of VRAM */
|
||||
uint8_t *latchram; /* base of latch RAM */
|
||||
uint16_t *regs; /* pointer to array of registers */
|
||||
u8 blanked; /* true if blanked */
|
||||
u8 *vram; /* base of VRAM */
|
||||
u8 *latchram; /* base of latch RAM */
|
||||
u16 *regs; /* pointer to array of registers */
|
||||
offs_t dispstart; /* display start */
|
||||
};
|
||||
|
||||
// construction/destruction
|
||||
tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
tms34061_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
void set_rowshift(uint8_t rowshift) { m_rowshift = rowshift; }
|
||||
void set_vram_size(uint32_t vramsize) { m_vramsize = vramsize; }
|
||||
void set_rowshift(u8 rowshift) { m_rowshift = rowshift; }
|
||||
void set_vram_size(u32 vramsize) { m_vramsize = vramsize; }
|
||||
auto int_callback() { return m_interrupt_cb.bind(); }
|
||||
|
||||
/* reads/writes to the 34061 */
|
||||
uint8_t read(address_space &space, int col, int row, int func);
|
||||
void write(address_space &space, int col, int row, int func, uint8_t data);
|
||||
u8 read(int col, int row, int func);
|
||||
void write(int col, int row, int func, u8 data);
|
||||
|
||||
/* latch settings */
|
||||
DECLARE_READ8_MEMBER( latch_r );
|
||||
DECLARE_WRITE8_MEMBER( latch_w );
|
||||
u8 latch_r();
|
||||
void latch_w(u8 data);
|
||||
|
||||
/* video update handling */
|
||||
void get_display_state();
|
||||
|
||||
bool blanked() const { return bool(m_display.blanked); }
|
||||
uint8_t const &vram(unsigned row) const { return m_display.vram[row << m_rowshift]; }
|
||||
uint16_t xyoffset() const { return m_display.regs[TMS34061_XYOFFSET]; }
|
||||
uint16_t xyaddress() const { return m_display.regs[TMS34061_XYADDRESS]; }
|
||||
u8 const &vram(unsigned row) const { return m_display.vram[row << m_rowshift]; }
|
||||
u16 xyoffset() const { return m_display.regs[TMS34061_XYOFFSET]; }
|
||||
u16 xyaddress() const { return m_display.regs[TMS34061_XYADDRESS]; }
|
||||
|
||||
// TODO: encapsulate this properly
|
||||
tms34061_display m_display;
|
||||
@ -86,27 +86,27 @@ private:
|
||||
TMS34061_REGCOUNT
|
||||
};
|
||||
|
||||
uint8_t m_rowshift; /* VRAM address is (row << rowshift) | col */
|
||||
uint32_t m_vramsize; /* size of video RAM */
|
||||
u8 m_rowshift; /* VRAM address is (row << rowshift) | col */
|
||||
u32 m_vramsize; /* size of video RAM */
|
||||
devcb_write_line m_interrupt_cb; /* interrupt gen callback */
|
||||
|
||||
uint16_t m_regs[TMS34061_REGCOUNT];
|
||||
uint16_t m_xmask;
|
||||
uint8_t m_yshift;
|
||||
uint32_t m_vrammask;
|
||||
uint8_t * m_vram;
|
||||
uint8_t * m_latchram;
|
||||
uint8_t m_latchdata;
|
||||
uint8_t * m_shiftreg;
|
||||
emu_timer * m_timer;
|
||||
u16 m_regs[TMS34061_REGCOUNT];
|
||||
u16 m_xmask;
|
||||
u8 m_yshift;
|
||||
u32 m_vrammask;
|
||||
u8 * m_vram;
|
||||
u8 * m_latchram;
|
||||
u8 m_latchdata;
|
||||
u8 * m_shiftreg;
|
||||
emu_timer * m_timer;
|
||||
|
||||
void update_interrupts();
|
||||
TIMER_CALLBACK_MEMBER( interrupt );
|
||||
void register_w(address_space &space, offs_t offset, uint8_t data);
|
||||
uint8_t register_r(address_space &space, offs_t offset);
|
||||
void register_w(offs_t offset, u8 data);
|
||||
u8 register_r(offs_t offset);
|
||||
void adjust_xyaddress(int offset);
|
||||
void xypixel_w(address_space &space, int offset, uint8_t data);
|
||||
uint8_t xypixel_r(address_space &space, int offset);
|
||||
void xypixel_w(int offset, u8 data);
|
||||
u8 xypixel_r(int offset);
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -241,10 +241,10 @@ WRITE16_MEMBER( guab_state::tms34061_w )
|
||||
col = offset <<= 1;
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
m_tms34061->write(space, col, row, func, data >> 8);
|
||||
m_tms34061->write(col, row, func, data >> 8);
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
m_tms34061->write(space, col | 1, row, func, data & 0xff);
|
||||
m_tms34061->write(col | 1, row, func, data & 0xff);
|
||||
}
|
||||
|
||||
READ16_MEMBER( guab_state::tms34061_r )
|
||||
@ -260,10 +260,10 @@ READ16_MEMBER( guab_state::tms34061_r )
|
||||
col = offset <<= 1;
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
data |= m_tms34061->read(space, col, row, func) << 8;
|
||||
data |= m_tms34061->read(col, row, func) << 8;
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
data |= m_tms34061->read(space, col | 1, row, func);
|
||||
data |= m_tms34061->read(col | 1, row, func);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -91,10 +91,10 @@ WRITE16_MEMBER(jpmsys5v_state::sys5_tms34061_w)
|
||||
}
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
m_tms34061->write(space, col, row, func, data >> 8);
|
||||
m_tms34061->write(col, row, func, data >> 8);
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
m_tms34061->write(space, col | 1, row, func, data & 0xff);
|
||||
m_tms34061->write(col | 1, row, func, data & 0xff);
|
||||
}
|
||||
|
||||
READ16_MEMBER(jpmsys5v_state::sys5_tms34061_r)
|
||||
@ -115,10 +115,10 @@ READ16_MEMBER(jpmsys5v_state::sys5_tms34061_r)
|
||||
}
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
data |= m_tms34061->read(space, col, row, func) << 8;
|
||||
data |= m_tms34061->read(col, row, func) << 8;
|
||||
|
||||
if (ACCESSING_BITS_0_7)
|
||||
data |= m_tms34061->read(space, col | 1, row, func);
|
||||
data |= m_tms34061->read(col | 1, row, func);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ protected:
|
||||
inline void consume_raw(int count);
|
||||
inline uint8_t fetch_next_rle();
|
||||
inline void consume_rle(int count);
|
||||
void perform_blit(address_space &space);
|
||||
void perform_blit();
|
||||
void update_interrupts(int periodic, int tms34061, int blitter);
|
||||
|
||||
/*----------- defined in machine/itech8.cpp -----------*/
|
||||
|
@ -28,7 +28,7 @@ WRITE8_MEMBER(capbowl_state::tms34061_w)
|
||||
col ^= 2;
|
||||
|
||||
/* Row address (RA0-RA8) is not dependent on the offset */
|
||||
m_tms34061->write(space, col, *m_rowaddress, func, data);
|
||||
m_tms34061->write(col, *m_rowaddress, func, data);
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ READ8_MEMBER(capbowl_state::tms34061_r)
|
||||
col ^= 2;
|
||||
|
||||
/* Row address (RA0-RA8) is not dependent on the offset */
|
||||
return m_tms34061->read(space, col, *m_rowaddress, func);
|
||||
return m_tms34061->read(col, *m_rowaddress, func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,7 +257,7 @@ inline void itech8_state::consume_rle(int count)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void itech8_state::perform_blit(address_space &space)
|
||||
void itech8_state::perform_blit()
|
||||
{
|
||||
offs_t addr = m_tms34061->xyaddress() | ((m_tms34061->xyoffset() & 0x300) << 8);
|
||||
uint8_t shift = (BLITTER_FLAGS & BLITFLAG_SHIFT) ? 4 : 0;
|
||||
@ -266,7 +266,7 @@ void itech8_state::perform_blit(address_space &space)
|
||||
int xdir = (BLITTER_FLAGS & BLITFLAG_XFLIP) ? -1 : 1;
|
||||
int xflip = (BLITTER_FLAGS & BLITFLAG_XFLIP);
|
||||
int rle = (BLITTER_FLAGS & BLITFLAG_RLE);
|
||||
int color = m_tms34061->latch_r(space, 0);
|
||||
int color = m_tms34061->latch_r();
|
||||
int width = BLITTER_WIDTH;
|
||||
int height = BLITTER_HEIGHT;
|
||||
uint8_t transmaskhi, transmasklo;
|
||||
@ -468,7 +468,7 @@ WRITE8_MEMBER(itech8_state::blitter_w)
|
||||
}
|
||||
|
||||
/* perform the blit */
|
||||
perform_blit(space);
|
||||
perform_blit();
|
||||
m_blit_in_progress = 1;
|
||||
|
||||
/* set a timer to go off when we're done */
|
||||
@ -498,7 +498,7 @@ WRITE8_MEMBER(itech8_state::tms34061_w)
|
||||
col ^= 2;
|
||||
|
||||
/* Row address (RA0-RA8) is not dependent on the offset */
|
||||
m_tms34061->write(space, col, 0xff, func, data);
|
||||
m_tms34061->write(col, 0xff, func, data);
|
||||
}
|
||||
|
||||
|
||||
@ -513,7 +513,7 @@ READ8_MEMBER(itech8_state::tms34061_r)
|
||||
col ^= 2;
|
||||
|
||||
/* Row address (RA0-RA8) is not dependent on the offset */
|
||||
return m_tms34061->read(space, col, 0xff, func);
|
||||
return m_tms34061->read(col, 0xff, func);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user