mirror of
https://github.com/holub/mame
synced 2025-06-07 05:13:46 +03:00
Extra space for i/o in VCU
This commit is contained in:
parent
6c20fc5843
commit
f19a1d4a72
@ -114,17 +114,17 @@ nesapu_device::nesapu_device(const machine_config &mconfig, const char *tag, dev
|
|||||||
{
|
{
|
||||||
m_noise_lut[i] = 0;
|
m_noise_lut[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 0X20; i++)
|
for (int i = 0; i < 0X20; i++)
|
||||||
{
|
{
|
||||||
m_vbl_times[i] = 0;
|
m_vbl_times[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < SYNCS_MAX1; i++)
|
for (int i = 0; i < SYNCS_MAX1; i++)
|
||||||
{
|
{
|
||||||
m_sync_times1[i] = 0;
|
m_sync_times1[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < SYNCS_MAX2; i++)
|
for (int i = 0; i < SYNCS_MAX2; i++)
|
||||||
{
|
{
|
||||||
m_sync_times2[i] = 0;
|
m_sync_times2[i] = 0;
|
||||||
@ -233,7 +233,7 @@ void nesapu_device::device_start()
|
|||||||
#else
|
#else
|
||||||
save_item(NAME(m_APU.buf_pos));
|
save_item(NAME(m_APU.buf_pos));
|
||||||
save_item(NAME(m_APU.step_mode));
|
save_item(NAME(m_APU.step_mode));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: sound channels should *ALL* have DC volume decay */
|
/* TODO: sound channels should *ALL* have DC volume decay */
|
||||||
|
@ -55,7 +55,7 @@ struct queue_t
|
|||||||
queue_t():
|
queue_t():
|
||||||
pos(0),
|
pos(0),
|
||||||
reg(""),val("") {}
|
reg(""),val("") {}
|
||||||
|
|
||||||
int pos;
|
int pos;
|
||||||
unsigned char reg, val;
|
unsigned char reg, val;
|
||||||
};
|
};
|
||||||
@ -108,7 +108,7 @@ struct square_t
|
|||||||
env_vol = 0;
|
env_vol = 0;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 regs[4];
|
uint8 regs[4];
|
||||||
int vbl_length;
|
int vbl_length;
|
||||||
int freq;
|
int freq;
|
||||||
@ -139,7 +139,7 @@ struct triangle_t
|
|||||||
counter_started = false;
|
counter_started = false;
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 regs[4]; /* regs[1] unused */
|
uint8 regs[4]; /* regs[1] unused */
|
||||||
int linear_length;
|
int linear_length;
|
||||||
int vbl_length;
|
int vbl_length;
|
||||||
@ -199,7 +199,7 @@ struct dpcm_t
|
|||||||
memory = NULL;
|
memory = NULL;
|
||||||
vol = NULL;
|
vol = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 regs[4];
|
uint8 regs[4];
|
||||||
uint32 address;
|
uint32 address;
|
||||||
uint32 length;
|
uint32 length;
|
||||||
@ -223,7 +223,7 @@ struct apu_t
|
|||||||
buf_pos = 0;
|
buf_pos = 0;
|
||||||
step_mode = 0;
|
step_mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sound channels */
|
/* Sound channels */
|
||||||
square_t squ[2];
|
square_t squ[2];
|
||||||
triangle_t tri;
|
triangle_t tri;
|
||||||
|
@ -4,6 +4,20 @@
|
|||||||
|
|
||||||
Device for Mazer Blazer/Great Guns custom Video Controller Unit
|
Device for Mazer Blazer/Great Guns custom Video Controller Unit
|
||||||
|
|
||||||
|
Written by Angelo Salese, based off old implementation by Jarek Burczynski
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
- understand what exactly modes 0x03 and 0x13 really reads in set_clr() and
|
||||||
|
where it puts results (yeah, shared VCU RAM, but exactly where?). Almost
|
||||||
|
surely Mazer Blazer tries to read the pixel data for collision detection and
|
||||||
|
Great Guns read backs VRAM for VCU test (patched for now, btw).
|
||||||
|
- Understand look-up tables in i/o space.
|
||||||
|
- Understand how to handle layer clearance.
|
||||||
|
- Understand how planes are really handled.
|
||||||
|
- Understand how transparent pens are handled (is 0x0f always transparent or
|
||||||
|
there's some clut gimmick? Great Guns title screen makes me think of the
|
||||||
|
latter option)
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
@ -22,6 +36,40 @@ static ADDRESS_MAP_START( mb_vcu_vram, AS_0, 8, mb_vcu_device )
|
|||||||
AM_RANGE(0x00000,0x7ffff) AM_RAM // enough for a 256x256x4 x 2 pages of framebuffer with 4 layers (TODO: doubled for simplicity)
|
AM_RANGE(0x00000,0x7ffff) AM_RAM // enough for a 256x256x4 x 2 pages of framebuffer with 4 layers (TODO: doubled for simplicity)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
static ADDRESS_MAP_START( mb_vcu_pal_ram, AS_1, 8, mb_vcu_device )
|
||||||
|
AM_RANGE(0x0000, 0x00ff) AM_RAM
|
||||||
|
AM_RANGE(0x0200, 0x02ff) AM_RAM
|
||||||
|
AM_RANGE(0x0400, 0x04ff) AM_RAM
|
||||||
|
AM_RANGE(0x0600, 0x06ff) AM_WRITE(mb_vcu_paletteram_w)
|
||||||
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
WRITE8_MEMBER( mb_vcu_device::mb_vcu_paletteram_w )
|
||||||
|
{
|
||||||
|
int r,g,b, bit0, bit1, bit2;
|
||||||
|
|
||||||
|
UINT8 colour = data;
|
||||||
|
|
||||||
|
/* red component */
|
||||||
|
bit1 = (colour >> 7) & 0x01;
|
||||||
|
bit0 = (colour >> 6) & 0x01;
|
||||||
|
r = combine_2_weights(m_weights_r, bit0, bit1);
|
||||||
|
|
||||||
|
/* green component */
|
||||||
|
bit2 = (colour >> 5) & 0x01;
|
||||||
|
bit1 = (colour >> 4) & 0x01;
|
||||||
|
bit0 = (colour >> 3) & 0x01;
|
||||||
|
g = combine_3_weights(m_weights_g, bit0, bit1, bit2);
|
||||||
|
|
||||||
|
/* blue component */
|
||||||
|
bit2 = (colour >> 2) & 0x01;
|
||||||
|
bit1 = (colour >> 1) & 0x01;
|
||||||
|
bit0 = (colour >> 0) & 0x01;
|
||||||
|
b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
|
||||||
|
|
||||||
|
palette_set_color(machine(), offset, MAKE_RGB(r, g, b));
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// memory_space_config - return a description of
|
// memory_space_config - return a description of
|
||||||
// any address spaces owned by this device
|
// any address spaces owned by this device
|
||||||
@ -29,7 +77,12 @@ ADDRESS_MAP_END
|
|||||||
|
|
||||||
const address_space_config *mb_vcu_device::memory_space_config(address_spacenum spacenum) const
|
const address_space_config *mb_vcu_device::memory_space_config(address_spacenum spacenum) const
|
||||||
{
|
{
|
||||||
return (spacenum == AS_0) ? &m_space_config : NULL;
|
switch (spacenum)
|
||||||
|
{
|
||||||
|
case AS_0: return &m_videoram_space_config;
|
||||||
|
case AS_1: return &m_paletteram_space_config;
|
||||||
|
default: return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -40,20 +93,39 @@ const address_space_config *mb_vcu_device::memory_space_config(address_spacenum
|
|||||||
// read_byte - read a byte at the given address
|
// read_byte - read a byte at the given address
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
inline UINT16 mb_vcu_device::read_byte(offs_t address)
|
inline UINT8 mb_vcu_device::read_byte(offs_t address)
|
||||||
{
|
{
|
||||||
return space().read_byte(address);
|
return space(AS_0).read_byte(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// write_word - write a word at the given address
|
// write_byte - write a byte at the given address
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
inline void mb_vcu_device::write_byte(offs_t address, UINT8 data)
|
inline void mb_vcu_device::write_byte(offs_t address, UINT8 data)
|
||||||
{
|
{
|
||||||
space().write_byte(address, data);
|
space(AS_0).write_byte(address, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// read_byte - read a byte at the given i/o
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
inline UINT8 mb_vcu_device::read_io(offs_t address)
|
||||||
|
{
|
||||||
|
return space(AS_1).read_byte(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// write_byte - write a byte at the given i/o
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
inline void mb_vcu_device::write_io(offs_t address, UINT8 data)
|
||||||
|
{
|
||||||
|
space(AS_1).write_byte(address, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// LIVE DEVICE
|
// LIVE DEVICE
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -66,7 +138,8 @@ mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, dev
|
|||||||
: device_t(mconfig, MB_VCU, "Mazer Blazer custom VCU", tag, owner, clock, "mb_vcu", __FILE__),
|
: device_t(mconfig, MB_VCU, "Mazer Blazer custom VCU", tag, owner, clock, "mb_vcu", __FILE__),
|
||||||
device_memory_interface(mconfig, *this),
|
device_memory_interface(mconfig, *this),
|
||||||
device_video_interface(mconfig, *this),
|
device_video_interface(mconfig, *this),
|
||||||
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram))
|
m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram)),
|
||||||
|
m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_pal_ram))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,9 +329,8 @@ READ8_MEMBER( mb_vcu_device::load_gfx )
|
|||||||
if(dstx >= 0 && dsty >= 0 && dstx < 256 && dsty < 256)
|
if(dstx >= 0 && dsty >= 0 && dstx < 256 && dsty < 256)
|
||||||
{
|
{
|
||||||
dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (6-(bits & 7));
|
dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (6-(bits & 7));
|
||||||
dot&= 3;
|
|
||||||
|
|
||||||
switch(dot)
|
switch(dot & 3)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
pen = m_color1 & 0xf;
|
pen = m_color1 & 0xf;
|
||||||
@ -292,6 +364,11 @@ READ8_MEMBER( mb_vcu_device::load_gfx )
|
|||||||
return 0; // open bus?
|
return 0; // open bus?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
---0 -111 (0x07) write to i/o?
|
||||||
|
---0 -011 (0x03) read to i/o?
|
||||||
|
---1 -011 (0x13) read to vram?
|
||||||
|
*/
|
||||||
READ8_MEMBER( mb_vcu_device::load_set_clr )
|
READ8_MEMBER( mb_vcu_device::load_set_clr )
|
||||||
{
|
{
|
||||||
int xi,yi;
|
int xi,yi;
|
||||||
@ -355,35 +432,9 @@ READ8_MEMBER( mb_vcu_device::load_set_clr )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x07:
|
case 0x07:
|
||||||
switch(m_ypos)
|
for(int i=0;i<m_pix_xsize;i++)
|
||||||
{
|
write_io(i+(m_ypos<<8),m_ram[offset + i]);
|
||||||
case 6:
|
|
||||||
int r,g,b, bit0, bit1, bit2;
|
|
||||||
|
|
||||||
for(int i=0;i<m_pix_xsize;i++)
|
|
||||||
{
|
|
||||||
UINT8 colour = m_ram[offset + i];
|
|
||||||
/* red component */
|
|
||||||
bit1 = (colour >> 7) & 0x01;
|
|
||||||
bit0 = (colour >> 6) & 0x01;
|
|
||||||
r = combine_2_weights(m_weights_r, bit0, bit1);
|
|
||||||
|
|
||||||
/* green component */
|
|
||||||
bit2 = (colour >> 5) & 0x01;
|
|
||||||
bit1 = (colour >> 4) & 0x01;
|
|
||||||
bit0 = (colour >> 3) & 0x01;
|
|
||||||
g = combine_3_weights(m_weights_g, bit0, bit1, bit2);
|
|
||||||
|
|
||||||
/* blue component */
|
|
||||||
bit2 = (colour >> 2) & 0x01;
|
|
||||||
bit1 = (colour >> 1) & 0x01;
|
|
||||||
bit0 = (colour >> 0) & 0x01;
|
|
||||||
b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
|
|
||||||
|
|
||||||
palette_set_color(machine(), i, MAKE_RGB(r, g, b));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ public:
|
|||||||
DECLARE_WRITE8_MEMBER( background_color_w );
|
DECLARE_WRITE8_MEMBER( background_color_w );
|
||||||
DECLARE_READ8_MEMBER( status_r );
|
DECLARE_READ8_MEMBER( status_r );
|
||||||
DECLARE_WRITE8_MEMBER( vbank_w );
|
DECLARE_WRITE8_MEMBER( vbank_w );
|
||||||
|
DECLARE_WRITE8_MEMBER( mb_vcu_paletteram_w );
|
||||||
|
|
||||||
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
void screen_eof(void);
|
void screen_eof(void);
|
||||||
@ -65,10 +66,13 @@ protected:
|
|||||||
virtual void device_reset();
|
virtual void device_reset();
|
||||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
|
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
|
||||||
private:
|
private:
|
||||||
inline UINT16 read_byte(offs_t address);
|
inline UINT8 read_byte(offs_t address);
|
||||||
inline void write_byte(offs_t address, UINT8 data);
|
inline void write_byte(offs_t address, UINT8 data);
|
||||||
|
inline UINT8 read_io(offs_t address);
|
||||||
|
inline void write_io(offs_t address, UINT8 data);
|
||||||
|
|
||||||
const address_space_config m_space_config;
|
const address_space_config m_videoram_space_config;
|
||||||
|
const address_space_config m_paletteram_space_config;
|
||||||
UINT8 m_status;
|
UINT8 m_status;
|
||||||
UINT8 *m_ram;
|
UINT8 *m_ram;
|
||||||
cpu_device *m_cpu;
|
cpu_device *m_cpu;
|
||||||
|
Loading…
Reference in New Issue
Block a user