mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
Fully hooked up VCU
This commit is contained in:
parent
9ca0768ead
commit
708aceb9dc
@ -1,4 +1,4 @@
|
||||
// license: ?
|
||||
// license: MAME
|
||||
// copyright-holders: Angelo Salese
|
||||
/***************************************************************************
|
||||
|
||||
@ -8,7 +8,7 @@ Device for Mazer Blazer/Great Guns custom Video Controller Unit
|
||||
|
||||
#include "emu.h"
|
||||
#include "video/mb_vcu.h"
|
||||
|
||||
#include "video/resnet.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -18,10 +18,8 @@ Device for Mazer Blazer/Great Guns custom Video Controller Unit
|
||||
// device type definition
|
||||
const device_type MB_VCU = &device_creator<mb_vcu_device>;
|
||||
|
||||
static ADDRESS_MAP_START( mb_vcu_vram, AS_0, 16, mb_vcu_device )
|
||||
// AM_RANGE() internal ROM space (shared with 0x4000 - 0x5fff)
|
||||
// AM_RANGE() RAM space (shared with 0x6000 - 0x67ff)
|
||||
// AM_RANGE() fb area
|
||||
static ADDRESS_MAP_START( mb_vcu_vram, AS_0, 8, mb_vcu_device )
|
||||
AM_RANGE(0x00000,0x1ffff) AM_RAM // enough for a 256x256x4 x 2 pages of framebuffer (TODO: doubled for simplicity)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -68,7 +66,7 @@ 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_memory_interface(mconfig, *this),
|
||||
device_video_interface(mconfig, *this),
|
||||
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram))
|
||||
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram))
|
||||
{
|
||||
}
|
||||
|
||||
@ -90,6 +88,7 @@ void mb_vcu_device::device_config_complete()
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
m_cpu_tag = NULL;
|
||||
//m_screen_tag = NULL;
|
||||
}
|
||||
}
|
||||
@ -111,6 +110,19 @@ void mb_vcu_device::device_validity_check(validity_checker &valid) const
|
||||
void mb_vcu_device::device_start()
|
||||
{
|
||||
// TODO: m_screen_tag
|
||||
m_cpu = machine().device<cpu_device>(m_cpu_tag);
|
||||
m_ram = auto_alloc_array_clear(machine(), UINT8, 0x800);
|
||||
|
||||
{
|
||||
static const int resistances_r[2] = { 4700, 2200 };
|
||||
static const int resistances_gb[3] = { 10000, 4700, 2200 };
|
||||
|
||||
/* just to calculate coefficients for later use */
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
3, resistances_gb, m_weights_g, 3600, 0,
|
||||
3, resistances_gb, m_weights_b, 3600, 0,
|
||||
2, resistances_r, m_weights_r, 3600, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,48 +132,236 @@ void mb_vcu_device::device_start()
|
||||
|
||||
void mb_vcu_device::device_reset()
|
||||
{
|
||||
m_status = 1;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// READ/WRITE HANDLERS
|
||||
//**************************************************************************
|
||||
// UINT8 *pcg = memregion("sub2")->base();
|
||||
|
||||
READ8_MEMBER( mb_vcu_device::read_ram )
|
||||
{
|
||||
return 0;
|
||||
return m_ram[offset];
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( mb_vcu_device::write_ram )
|
||||
{
|
||||
m_ram[offset] = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( mb_vcu_device::write_vregs )
|
||||
{
|
||||
m_vregs[offset] = data;
|
||||
}
|
||||
|
||||
/* latches RAM offset to send to params */
|
||||
READ8_MEMBER( mb_vcu_device::load_params )
|
||||
{
|
||||
return 0;
|
||||
m_param_offset_latch = offset;
|
||||
|
||||
m_xpos = m_ram[m_param_offset_latch + 1] | (m_ram[m_param_offset_latch + 2]<<8);
|
||||
m_ypos = m_ram[m_param_offset_latch + 3] | (m_ram[m_param_offset_latch + 4]<<8);
|
||||
m_color1 = m_ram[m_param_offset_latch + 5];
|
||||
m_color2 = m_ram[m_param_offset_latch + 6];
|
||||
m_mode = m_ram[m_param_offset_latch + 7];
|
||||
m_pix_xsize = m_ram[m_param_offset_latch + 8] + 1;
|
||||
m_pix_ysize = m_ram[m_param_offset_latch + 9] + 1;
|
||||
|
||||
if(0)
|
||||
{
|
||||
printf("[0] %02x ",m_ram[m_param_offset_latch]);
|
||||
printf("X: %04x ",m_xpos);
|
||||
printf("Y: %04x ",m_ypos);
|
||||
printf("C1:%02x ",m_color1);
|
||||
printf("C2:%02x ",m_color2);
|
||||
printf("M :%02x ",m_mode);
|
||||
printf("XS:%02x ",m_pix_xsize);
|
||||
printf("YS:%02x ",m_pix_ysize);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return 0; // open bus?
|
||||
}
|
||||
|
||||
READ8_MEMBER( mb_vcu_device::load_gfx )
|
||||
{
|
||||
return 0;
|
||||
int xi,yi;
|
||||
int dstx,dsty;
|
||||
UINT8 dot;
|
||||
int bits = 0;
|
||||
|
||||
switch(m_mode >> 2)
|
||||
{
|
||||
case 0x00: // 4bpp
|
||||
for(yi=0;yi<m_pix_ysize;yi++)
|
||||
{
|
||||
for(xi=0;xi<m_pix_xsize;xi++)
|
||||
{
|
||||
dstx = (m_xpos + xi);
|
||||
dsty = (m_ypos + yi);
|
||||
|
||||
if(dstx < 256 && dsty < 256)
|
||||
{
|
||||
dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (4-(bits & 7));
|
||||
dot&= 0xf;
|
||||
|
||||
write_byte(dstx|dsty<<8, dot);
|
||||
|
||||
}
|
||||
bits += 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x02: // 1bpp
|
||||
for(yi=0;yi<m_pix_ysize;yi++)
|
||||
{
|
||||
for(xi=0;xi<m_pix_xsize;xi++)
|
||||
{
|
||||
dstx = (m_xpos + xi);
|
||||
dsty = (m_ypos + yi);
|
||||
|
||||
if(dstx < 256 && dsty < 256)
|
||||
{
|
||||
dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (7-(bits & 7));
|
||||
dot&= 1;
|
||||
|
||||
write_byte(dstx|dsty<<8, dot ? (m_color1 >> 4) : (m_color1 & 0xf));
|
||||
}
|
||||
bits++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x03: //2bpp
|
||||
for (yi = 0; yi < m_pix_ysize; yi++)
|
||||
{
|
||||
for (xi = 0; xi < m_pix_xsize; xi++)
|
||||
{
|
||||
dstx = (m_xpos + xi);
|
||||
dsty = (m_ypos + yi);
|
||||
|
||||
if(dstx < 256 && dsty < 256)
|
||||
{
|
||||
dot = m_cpu->space(AS_PROGRAM).read_byte(((offset + (bits >> 3)) & 0x1fff) + 0x4000) >> (6-(bits & 7));
|
||||
dot&= 3;
|
||||
|
||||
switch(dot)
|
||||
{
|
||||
case 0:
|
||||
write_byte(dstx|dsty<<8, m_color1 & 0xf);
|
||||
break;
|
||||
case 1:
|
||||
write_byte(dstx|dsty<<8, m_color1 >> 4);
|
||||
break;
|
||||
case 2:
|
||||
write_byte(dstx|dsty<<8, m_color2 & 0xf);
|
||||
break;
|
||||
case 3:
|
||||
write_byte(dstx|dsty<<8, m_color2 >> 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bits+=2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
popmessage("Unsupported draw mode");
|
||||
break;
|
||||
}
|
||||
|
||||
return 0; // open bus?
|
||||
}
|
||||
|
||||
READ8_MEMBER( mb_vcu_device::load_clr )
|
||||
READ8_MEMBER( mb_vcu_device::load_set_clr )
|
||||
{
|
||||
return 0;
|
||||
if(0)
|
||||
{
|
||||
printf("[0] %02x ",m_ram[m_param_offset_latch]);
|
||||
printf("X: %04x ",m_xpos);
|
||||
printf("Y: %04x ",m_ypos);
|
||||
printf("C1:%02x ",m_color1);
|
||||
printf("C2:%02x ",m_color2);
|
||||
printf("M :%02x ",m_mode);
|
||||
printf("XS:%02x ",m_pix_xsize);
|
||||
printf("YS:%02x ",m_pix_ysize);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
switch(m_mode)
|
||||
{
|
||||
case 0x07:
|
||||
switch(m_ypos)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
return 0; // open bus?
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( mb_vcu_device::background_color_w )
|
||||
{
|
||||
int bit0,bit1,bit2;
|
||||
int r,g,b;
|
||||
m_bk_color = data;
|
||||
|
||||
/* red component */
|
||||
bit1 = (m_bk_color >> 7) & 0x01;
|
||||
bit0 = (m_bk_color >> 6) & 0x01;
|
||||
r = combine_2_weights(m_weights_r, bit0, bit1);
|
||||
|
||||
/* green component */
|
||||
bit2 = (m_bk_color >> 5) & 0x01;
|
||||
bit1 = (m_bk_color >> 4) & 0x01;
|
||||
bit0 = (m_bk_color >> 3) & 0x01;
|
||||
g = combine_3_weights(m_weights_g, bit0, bit1, bit2);
|
||||
|
||||
/* blue component */
|
||||
bit2 = (m_bk_color >> 2) & 0x01;
|
||||
bit1 = (m_bk_color >> 1) & 0x01;
|
||||
bit0 = (m_bk_color >> 0) & 0x01;
|
||||
b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
|
||||
|
||||
palette_set_color(machine(), 0x100, MAKE_RGB(r, g, b));
|
||||
}
|
||||
|
||||
READ8_MEMBER( mb_vcu_device::status_r )
|
||||
{
|
||||
return 0;
|
||||
/*
|
||||
---- ---x busy or vblank flag
|
||||
*/
|
||||
return m_status;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( mb_vcu_device::vbank_w )
|
||||
@ -172,7 +372,26 @@ WRITE8_MEMBER( mb_vcu_device::vbank_w )
|
||||
// update_screen -
|
||||
//-------------------------------------------------
|
||||
|
||||
UINT32 mb_vcu_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 mb_vcu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int x,y;
|
||||
UINT8 dot;
|
||||
|
||||
bitmap.fill(0x100,cliprect);
|
||||
|
||||
for(y=0;y<256;y++)
|
||||
{
|
||||
for(x=0;x<256;x++)
|
||||
{
|
||||
dot = read_byte((x >> 0)|(y<<8));
|
||||
//if(dot != 0xf)
|
||||
{
|
||||
dot|= m_vregs[1] << 4;
|
||||
|
||||
bitmap.pix32(y,x) = machine().pens[dot];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ Template for skeleton device
|
||||
|
||||
struct mb_vcu_interface
|
||||
{
|
||||
const char *m_screen_tag;
|
||||
const char *m_cpu_tag;
|
||||
};
|
||||
|
||||
// ======================> mb_vcu_device
|
||||
@ -49,12 +49,12 @@ public:
|
||||
DECLARE_WRITE8_MEMBER( write_ram );
|
||||
DECLARE_READ8_MEMBER( load_params );
|
||||
DECLARE_READ8_MEMBER( load_gfx );
|
||||
DECLARE_READ8_MEMBER( load_clr );
|
||||
DECLARE_READ8_MEMBER( load_set_clr );
|
||||
DECLARE_WRITE8_MEMBER( background_color_w );
|
||||
DECLARE_READ8_MEMBER( status_r );
|
||||
DECLARE_WRITE8_MEMBER( vbank_w );
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -68,6 +68,21 @@ private:
|
||||
inline void write_byte(offs_t address, UINT8 data);
|
||||
|
||||
const address_space_config m_space_config;
|
||||
UINT8 m_status;
|
||||
UINT8 *m_ram;
|
||||
cpu_device *m_cpu;
|
||||
UINT16 m_param_offset_latch;
|
||||
|
||||
UINT16 m_xpos, m_ypos;
|
||||
UINT8 m_color1, m_color2;
|
||||
UINT8 m_mode;
|
||||
UINT16 m_pix_xsize, m_pix_ysize;
|
||||
UINT8 m_vregs[4];
|
||||
UINT8 m_bk_color;
|
||||
|
||||
double m_weights_r[2];
|
||||
double m_weights_g[3];
|
||||
double m_weights_b[3];
|
||||
};
|
||||
|
||||
|
||||
|
@ -119,6 +119,7 @@ video z80
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "video/resnet.h"
|
||||
#include "video/mb_vcu.h"
|
||||
|
||||
|
||||
#define MAZERBLA 0x01
|
||||
@ -133,14 +134,15 @@ class mazerbla_state : public driver_device
|
||||
public:
|
||||
mazerbla_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_cfb_ram(*this, "cfb_ram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_subcpu(*this, "sub"){ }
|
||||
m_subcpu(*this, "sub"),
|
||||
m_vcu(*this,"vcu")
|
||||
{ }
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_cfb_ram;
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
required_device<mb_vcu_device> m_vcu;
|
||||
|
||||
/* video-related */
|
||||
bitmap_ind16 m_tmpbitmaps[4];
|
||||
@ -179,10 +181,6 @@ public:
|
||||
UINT8 m_vsb_ls273;
|
||||
UINT8 m_soundlatch;
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_subcpu;
|
||||
|
||||
#if 0
|
||||
int m_dbg_info;
|
||||
int m_dbg_gfx_e;
|
||||
@ -224,8 +222,7 @@ public:
|
||||
virtual void machine_reset();
|
||||
virtual void video_start();
|
||||
virtual void palette_init();
|
||||
UINT32 screen_update_mazerbla(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_test_vcu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_mazerbla(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(sound_interrupt);
|
||||
TIMER_CALLBACK_MEMBER(deferred_ls670_0_w);
|
||||
TIMER_CALLBACK_MEMBER(deferred_ls670_1_w);
|
||||
@ -263,7 +260,6 @@ void mazerbla_state::palette_init()
|
||||
3, resistances_gb, m_weights_g, 3600, 0,
|
||||
3, resistances_gb, m_weights_b, 3600, 0,
|
||||
2, resistances_r, m_weights_r, 3600, 0);
|
||||
|
||||
}
|
||||
|
||||
void mazerbla_state::video_start()
|
||||
@ -288,125 +284,15 @@ void mazerbla_state::video_start()
|
||||
save_item(NAME(m_tmpbitmaps[3]));
|
||||
}
|
||||
|
||||
#ifdef UNUSED_DEFINITION
|
||||
|
||||
UINT32 mazerbla_state::screen_update_test_vcu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 mazerbla_state::screen_update_mazerbla(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int *planes_enabled = m_planes_enabled;
|
||||
char buf[128];
|
||||
|
||||
UINT32 color_base = 0;
|
||||
|
||||
if (m_game_id == MAZERBLA)
|
||||
color_base = 0x80; /* 0x80 constant: matches Mazer Blazer movie */
|
||||
|
||||
if (m_game_id == GREATGUN)
|
||||
color_base = 0x00;
|
||||
|
||||
bitmap.fill(0);
|
||||
// logerror("-->frame\n");
|
||||
|
||||
if (planes_enabled[3])
|
||||
copybitmap(bitmap, m_tmpbitmaps[3], 0, 0, 0, 0, cliprect);
|
||||
|
||||
if (planes_enabled[2])
|
||||
copybitmap_trans(bitmap, m_tmpbitmaps[2], 0, 0, 0, 0,cliprect, color_base);
|
||||
|
||||
m_tmpbitmaps[2].fill(color_base);
|
||||
|
||||
if (planes_enabled[1])
|
||||
copybitmap_trans(bitmap, m_tmpbitmaps[1], 0, 0, 0, 0,cliprect, color_base);
|
||||
|
||||
m_tmpbitmaps[1].fill(color_base);
|
||||
|
||||
if (planes_enabled[0])
|
||||
copybitmap_trans(bitmap, m_tmpbitmaps[0], 0, 0, 0, 0,cliprect, color_base);
|
||||
|
||||
m_tmpbitmaps[0].fill(color_base);
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_1)) /* plane 1 */
|
||||
planes_enabled[0] ^= 1;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_2)) /* plane 2 */
|
||||
planes_enabled[1] ^= 1;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_3)) /* plane 3 */
|
||||
planes_enabled[2] ^= 1;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_4)) /* plane 4 */
|
||||
planes_enabled[3] ^= 1;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_I)) /* show/hide debug info */
|
||||
m_dbg_info = !m_dbg_info;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_G)) /* enable gfx area handling */
|
||||
m_dbg_gfx_e = !m_dbg_gfx_e;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_C)) /* enable color area handling */
|
||||
m_dbg_clr_e = !m_dbg_clr_e;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_V)) /* draw only when vbank==dbg_vbank */
|
||||
m_dbg_vbank ^= 1;
|
||||
|
||||
if (machine().input().code_pressed_once(KEYCODE_L)) /* showlookup ram */
|
||||
m_dbg_lookup = (m_dbg_lookup + 1) % 5; //0,1,2,3, 4-off
|
||||
|
||||
|
||||
if (m_dbg_info)
|
||||
{
|
||||
sprintf(buf,"I-info, G-gfx, C-color, V-vbank, 1-4 enable planes");
|
||||
ui_draw_text(buf, 10, 0 * ui_get_line_height(machine()));
|
||||
|
||||
sprintf(buf,"g:%1i c:%1i v:%1i vbk=%1i planes=%1i%1i%1i%1i ", m_dbg_gfx_e&1, m_dbg_clr_e&1, m_dbg_vbank, vbank&1,
|
||||
planes_enabled[0],
|
||||
planes_enabled[1],
|
||||
planes_enabled[2],
|
||||
planes_enabled[3] );
|
||||
|
||||
ui_draw_text(buf, 10, 1 * ui_get_line_height(machine()));
|
||||
|
||||
if (m_dbg_lookup!=4)
|
||||
{
|
||||
int lookup_offs = (m_dbg_lookup)*256; //=0,1,2,3*256
|
||||
int y, x;
|
||||
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
memset(buf, 0, 128);
|
||||
sprintf(buf + strlen(buf), "%04x ", lookup_offs + y * 16);
|
||||
for (x = 0; x < 16; x++)
|
||||
{
|
||||
sprintf(buf + strlen(buf), "%02x ", lookup_ram[lookup_offs + x + y * 16]);
|
||||
}
|
||||
ui_draw_text(buf, 0, (2 + y) * ui_get_line_height(machine()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
UINT32 mazerbla_state::screen_update_mazerbla(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// UINT32 color_base = 0;
|
||||
|
||||
// if (m_game_id == MAZERBLA)
|
||||
// color_base = 0x80; /* 0x80 constant: matches Mazer Blazer movie */
|
||||
|
||||
// if (m_game_id == GREATGUN)
|
||||
// color_base = 0x00;
|
||||
bitmap.fill(get_black_pen(machine()), cliprect);
|
||||
|
||||
//copybitmap_trans(bitmap, m_tmpbitmaps[3], 0, 0, 0, 0, cliprect, 0);
|
||||
//copybitmap_trans(bitmap, m_tmpbitmaps[2], 0, 0, 0, 0, cliprect, 0);
|
||||
//copybitmap_trans(bitmap, m_tmpbitmaps[1], 0, 0, 0, 0, cliprect, 0);
|
||||
copybitmap_trans(bitmap, m_tmpbitmaps[0], 0, 0, 0, 0, cliprect, 0);
|
||||
m_vcu->screen_update(screen,bitmap,cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* reference */
|
||||
#if 0
|
||||
WRITE8_MEMBER(mazerbla_state::cfb_backgnd_color_w)
|
||||
{
|
||||
if (m_bknd_col != data)
|
||||
@ -436,13 +322,15 @@ WRITE8_MEMBER(mazerbla_state::cfb_backgnd_color_w)
|
||||
//logerror("background color (port 01) write=%02x\n",data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
WRITE8_MEMBER(mazerbla_state::cfb_vbank_w)
|
||||
{
|
||||
/* only bit 6 connected */
|
||||
m_vbank = BIT(data, 6);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
WRITE8_MEMBER(mazerbla_state::cfb_rom_bank_sel_w)/* mazer blazer */
|
||||
@ -453,14 +341,7 @@ WRITE8_MEMBER(mazerbla_state::cfb_rom_bank_sel_w)/* mazer blazer */
|
||||
}
|
||||
|
||||
|
||||
/* VCU status? */
|
||||
READ8_MEMBER(mazerbla_state::cfb_port_02_r)
|
||||
{
|
||||
m_port02_status ^= 0xff;
|
||||
return m_port02_status;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
WRITE8_MEMBER(mazerbla_state::vcu_video_reg_w)
|
||||
{
|
||||
if (m_vcu_video_reg[offset] != data)
|
||||
@ -846,6 +727,7 @@ READ8_MEMBER(mazerbla_state::vcu_set_clr_addr_r)
|
||||
|
||||
return machine().rand();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -1074,8 +956,7 @@ static ADDRESS_MAP_START( mazerbla_map, AS_PROGRAM, 8, mazerbla_state )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM AM_SHARE("share1")
|
||||
AM_RANGE(0xd800, 0xd800) AM_READ(cfb_zpu_int_req_clr)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("videoram")
|
||||
AM_RANGE(0xe800, 0xefff) AM_RAM
|
||||
AM_RANGE(0xe000, 0xefff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( mazerbla_io_map, AS_IO, 8, mazerbla_state )
|
||||
@ -1104,20 +985,20 @@ static ADDRESS_MAP_START( mazerbla_cpu3_map, AS_PROGRAM, 8, mazerbla_state )
|
||||
AM_RANGE(0x0000, 0x37ff) AM_ROM
|
||||
AM_RANGE(0x3800, 0x3fff) AM_RAM AM_SHARE("share1")
|
||||
AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1") /* GFX roms */
|
||||
AM_RANGE(0x4000, 0x4003) AM_WRITE(vcu_video_reg_w)
|
||||
AM_RANGE(0x6000, 0x67ff) AM_RAM AM_SHARE("cfb_ram") /* Color Frame Buffer PCB, a.k.a. RAM for VCU commands and parameters */
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_READ(vcu_set_cmd_param_r) /* VCU command and parameters LOAD */
|
||||
AM_RANGE(0xc000, 0xdfff) AM_READ(vcu_set_gfx_addr_r) /* gfx LOAD (blit) */
|
||||
AM_RANGE(0xe000, 0xffff) AM_READ(vcu_set_clr_addr_r) /* palette? LOAD */
|
||||
AM_RANGE(0x4000, 0x4003) AM_DEVWRITE("vcu", mb_vcu_device, write_vregs)
|
||||
AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE("vcu", mb_vcu_device, read_ram, write_ram)
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_DEVREAD("vcu", mb_vcu_device, load_params)
|
||||
AM_RANGE(0xc000, 0xdfff) AM_DEVREAD("vcu", mb_vcu_device, load_gfx)
|
||||
AM_RANGE(0xe000, 0xffff) AM_DEVREAD("vcu", mb_vcu_device, load_set_clr)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( mazerbla_cpu3_io_map, AS_IO, 8, mazerbla_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x01, 0x01) AM_WRITE(cfb_backgnd_color_w)
|
||||
AM_RANGE(0x02, 0x02) AM_READWRITE(cfb_port_02_r, cfb_led_w) /* Read = VCU status ? */
|
||||
AM_RANGE(0x01, 0x01) AM_DEVWRITE("vcu", mb_vcu_device, background_color_w)
|
||||
AM_RANGE(0x02, 0x02) AM_DEVREAD("vcu", mb_vcu_device, status_r) AM_WRITE(cfb_led_w)
|
||||
AM_RANGE(0x03, 0x03) AM_WRITE(cfb_zpu_int_req_set_w)
|
||||
AM_RANGE(0x04, 0x04) AM_WRITE(cfb_rom_bank_sel_w)
|
||||
AM_RANGE(0x05, 0x05) AM_WRITE(cfb_vbank_w) //visible/writable videopage select?
|
||||
AM_RANGE(0x05, 0x05) AM_DEVWRITE("vcu", mb_vcu_device, vbank_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -1574,6 +1455,10 @@ void mazerbla_state::machine_reset()
|
||||
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(mazerbla_state::irq_callback),this));
|
||||
}
|
||||
|
||||
static const mb_vcu_interface vcu_interface =
|
||||
{
|
||||
"sub2"
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( mazerbla, mazerbla_state )
|
||||
|
||||
@ -1597,16 +1482,17 @@ static MACHINE_CONFIG_START( mazerbla, mazerbla_state )
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mazerbla_state, irq0_line_hold)
|
||||
|
||||
/* synchronization forced on the fly */
|
||||
MCFG_MB_VCU_ADD("vcu",SOUND_CLOCK/4,vcu_interface)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(40*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(mazerbla_state, screen_update_mazerbla)
|
||||
|
||||
MCFG_PALETTE_LENGTH(256)
|
||||
MCFG_PALETTE_LENGTH(256+1)
|
||||
|
||||
|
||||
/* sound hardware */
|
||||
@ -1633,16 +1519,17 @@ static MACHINE_CONFIG_START( greatgun, mazerbla_state )
|
||||
*/
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", mazerbla_state, irq0_line_hold)
|
||||
|
||||
MCFG_MB_VCU_ADD("vcu",SOUND_CLOCK/4,vcu_interface)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(40*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(mazerbla_state, screen_update_mazerbla)
|
||||
|
||||
MCFG_PALETTE_LENGTH(256)
|
||||
MCFG_PALETTE_LENGTH(256+1)
|
||||
|
||||
|
||||
/* sound hardware */
|
||||
|
Loading…
Reference in New Issue
Block a user