summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ville Linde <villedevs@gmail.com>2015-07-02 16:28:29 +0300
committer Ville Linde <villedevs@gmail.com>2015-07-02 16:35:45 +0300
commit8f2baab98af8b38b825b655f57cbe0d9562f0884 (patch)
tree09244b0adf9d13719dfbd83e3e4ad2103fc0560b
parentfaa43ecacdd038415f684604ac26bb2df987c33b (diff)
firebeat: Completely rewrote the graphics chip emulation [Ville Linde]
-rw-r--r--src/mame/drivers/firebeat.c1116
1 files changed, 633 insertions, 483 deletions
diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c
index 346691f8098..48c4d4863cb 100644
--- a/src/mame/drivers/firebeat.c
+++ b/src/mame/drivers/firebeat.c
@@ -82,9 +82,9 @@
------------------------------------------------------------------
GQ972 GQ972 2000 Beatmania III
GQ972(?) ? 2001 Beatmania III Append 6th Mix
- GQ972(?) ? 2002 Beatmania III Append 7th Mix
+ GQ972(?) GCB07 2002 Beatmania III Append 7th Mix
GQ972(?) ? 2000 Beatmania III Append Core Remix
- GQ972(?) ? 2003 Beatmania III The Final
+ GQ972(?) GCC01 2003 Beatmania III The Final
GQ974 GQ974 2000 Keyboardmania
GQ974 GCA01 2000 Keyboardmania 2nd Mix
GQ974 GCA12 2001 Keyboardmania 3rd Mix
@@ -92,13 +92,13 @@
GQ977 GQ977 2000 Para Para Dancing
GQ977 GC977 2000 Para Para Paradise 1.1
GQ977 GQA11 2000 Para Para Paradise 1st Mix+
- GQA02(?) ? 2000 Pop'n Music 4
- ??? ? 2000 Pop'n Music 5
- ??? ? 2001 Pop'n Music 6
+ GQA02(?) GQ986 2000 Pop'n Music 4
+ ??? G?A04 2000 Pop'n Music 5
+ ??? GQA16 2001 Pop'n Music 6
GQA02 GCB00 2001 Pop'n Music 7
- ??? ? 2002 Pop'n Music 8
+ ??? GQB30 2002 Pop'n Music 8
??? ? 2000 Pop'n Music Animelo
- ??? ? 2001 Pop'n Music Animelo 2
+ ??? GEA02 2001 Pop'n Music Animelo 2
??? ? 2001 Pop'n Music Mickey Tunes
TODO:
@@ -144,13 +144,9 @@
#include "firebeat.lh"
-struct GCU_REGS
-{
- UINT32 *vram;
- UINT32 vram_read_address;
- UINT32 vram_write_fifo_address;
- UINT32 visible_area;
-};
+#define DUMP_VRAM 0
+#define PRINT_GCU 0
+
struct IBUTTON_SUBKEY
{
@@ -164,136 +160,324 @@ struct IBUTTON
IBUTTON_SUBKEY subkey[3];
};
+#define MCFG_FIREBEAT_GCU_CPU_TAG(_tag) \
+ firebeat_gcu_device::static_set_cpu_tag(*device, _tag);
-
-class firebeat_state : public driver_device
+class firebeat_gcu_device : public device_t
{
public:
- firebeat_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_work_ram(*this, "work_ram"),
- m_flash_main(*this, "flash_main"),
- m_flash_snd1(*this, "flash_snd1"),
- m_flash_snd2(*this, "flash_snd2"),
- m_duart_midi(*this, "duart_midi"),
- m_duart_com(*this, "duart_com"),
- m_kbd0(*this, "kbd0"),
- m_kbd1(*this, "kbd1"),
- m_ata(*this, "ata")
- { }
+ firebeat_gcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<firebeat_gcu_device &>(device).m_cputag = tag; }
- required_device<ppc4xx_device> m_maincpu;
- required_shared_ptr<UINT32> m_work_ram;
- required_device<fujitsu_29f016a_device> m_flash_main;
- required_device<fujitsu_29f016a_device> m_flash_snd1;
- required_device<fujitsu_29f016a_device> m_flash_snd2;
- optional_device<pc16552_device> m_duart_midi;
- required_device<pc16552_device> m_duart_com;
- optional_device<midi_keyboard_device> m_kbd0;
- optional_device<midi_keyboard_device> m_kbd1;
- required_device<ata_interface_device> m_ata;
+ int draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- UINT8 m_extend_board_irq_enable;
- UINT8 m_extend_board_irq_active;
-// emu_timer *m_keyboard_timer;
- GCU_REGS m_gcu[2];
- int m_tick;
- int m_layer;
- int m_cab_data_ptr;
- const int * m_cur_cab_data;
-// int m_keyboard_state[2];
- UINT8 m_spu_shared_ram[0x400];
- IBUTTON m_ibutton;
- int m_ibutton_state;
- int m_ibutton_read_subkey_ptr;
- UINT8 m_ibutton_subkey_data[0x40];
- DECLARE_READ8_MEMBER(soundram_r);
- DECLARE_DRIVER_INIT(ppd);
- DECLARE_DRIVER_INIT(kbm);
- DECLARE_DRIVER_INIT(ppp);
- DECLARE_MACHINE_START(firebeat);
- DECLARE_MACHINE_RESET(firebeat);
- DECLARE_VIDEO_START(firebeat);
- UINT32 screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- UINT32 screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(firebeat_interrupt);
- DECLARE_READ32_MEMBER(gcu0_r);
- DECLARE_WRITE32_MEMBER(gcu0_w);
- DECLARE_READ32_MEMBER(gcu1_r);
- DECLARE_WRITE32_MEMBER(gcu1_w);
- DECLARE_READ32_MEMBER(input_r);
- DECLARE_READ32_MEMBER(sensor_r );
- DECLARE_READ32_MEMBER(flashram_r);
- DECLARE_WRITE32_MEMBER(flashram_w);
- DECLARE_READ32_MEMBER(soundflash_r);
- DECLARE_WRITE32_MEMBER(soundflash_w);
- DECLARE_WRITE_LINE_MEMBER(ata_interrupt);
- DECLARE_READ32_MEMBER(ata_command_r);
- DECLARE_WRITE32_MEMBER(ata_command_w);
- DECLARE_READ32_MEMBER(ata_control_r);
- DECLARE_WRITE32_MEMBER(ata_control_w);
-// DECLARE_READ32_MEMBER(comm_uart_r);
-// DECLARE_WRITE32_MEMBER(comm_uart_w);
- DECLARE_READ32_MEMBER(cabinet_r);
- DECLARE_READ32_MEMBER(keyboard_wheel_r);
- DECLARE_READ8_MEMBER(midi_uart_r);
- DECLARE_WRITE8_MEMBER(midi_uart_w);
- DECLARE_READ32_MEMBER(extend_board_irq_r);
- DECLARE_WRITE32_MEMBER(extend_board_irq_w);
- DECLARE_WRITE32_MEMBER(lamp_output_w);
- DECLARE_WRITE32_MEMBER(lamp_output_kbm_w);
- DECLARE_WRITE32_MEMBER(lamp_output_ppp_w);
- DECLARE_WRITE32_MEMBER(lamp_output2_w);
- DECLARE_WRITE32_MEMBER(lamp_output2_ppp_w);
- DECLARE_WRITE32_MEMBER(lamp_output3_w);
- DECLARE_WRITE32_MEMBER(lamp_output3_ppp_w);
- DECLARE_READ32_MEMBER(ppc_spu_share_r);
- DECLARE_WRITE32_MEMBER(ppc_spu_share_w);
- DECLARE_READ16_MEMBER(spu_unk_r);
-// TIMER_CALLBACK_MEMBER(keyboard_timer_callback);
- void gcu_draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 *cmd);
- void gcu_fill_rect(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 *cmd);
- void gcu_draw_character(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 *cmd);
- void gcu_exec_display_list(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 address);
- UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip);
- UINT32 GCU_r(int chip, UINT32 offset, UINT32 mem_mask);
- void GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask);
- void set_ibutton(UINT8 *data);
- int ibutton_w(UINT8 data);
- DECLARE_WRITE8_MEMBER(security_w);
- void init_lights(write32_delegate out1, write32_delegate out2, write32_delegate out3);
- void init_firebeat();
- void init_keyboard();
- DECLARE_WRITE_LINE_MEMBER(sound_irq_callback);
- DECLARE_WRITE_LINE_MEMBER(midi_uart_ch0_irq_callback);
- DECLARE_WRITE_LINE_MEMBER(midi_uart_ch1_irq_callback);
+ DECLARE_READ32_MEMBER(read);
+ DECLARE_WRITE32_MEMBER(write);
+
+ struct framebuffer
+ {
+ UINT32 base;
+ int width;
+ int height;
+ };
+
+protected:
+ virtual void device_start();
+ virtual void device_stop();
+ virtual void device_reset();
+
+private:
+ void execute_command(UINT32 *cmd);
+ void execute_display_list(UINT32 addr);
+ void draw_object(UINT32 *cmd);
+ void fill_rect(UINT32 *cmd);
+ void draw_character(UINT32 *cmd);
+ void fb_config(UINT32 *cmd);
+
+ UINT32 *m_vram;
+ UINT32 m_vram_read_addr;
+ UINT32 m_vram_fifo0_addr;
+ UINT32 m_vram_fifo1_addr;
+ UINT32 m_vram_fifo0_mode;
+ UINT32 m_vram_fifo1_mode;
+ UINT32 m_command_fifo0[4];
+ UINT32 m_command_fifo0_ptr;
+ UINT32 m_command_fifo1[4];
+ UINT32 m_command_fifo1_ptr;
+
+ const char* m_cputag;
+ device_t* m_cpu;
+
+ framebuffer m_frame[4];
+ UINT32 m_fb_origin_x;
+ UINT32 m_fb_origin_y;
};
+const device_type FIREBEAT_GCU = &device_creator<firebeat_gcu_device>;
+firebeat_gcu_device::firebeat_gcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, FIREBEAT_GCU, "FireBeat GCU", tag, owner, clock, "firebeat_gcu", __FILE__)
+{
+}
+
+READ32_MEMBER(firebeat_gcu_device::read)
+{
+ int reg = offset * 4;
+
+ // VRAM Read
+ if (reg >= 0x80 && reg < 0x100)
+ {
+ return m_vram[m_vram_read_addr + offset - 0x20];
+ }
+ switch (reg)
+ {
+ case 0x78: // GCU Status
+ /* ppd checks bits 0x0041 of the upper halfword on interrupt */
+ return 0xffff0005;
+ default:
+ break;
+ }
+ return 0xffffffff;
+}
-VIDEO_START_MEMBER(firebeat_state,firebeat)
+WRITE32_MEMBER(firebeat_gcu_device::write)
{
- m_gcu[0].vram = auto_alloc_array(machine(), UINT32, 0x2000000/4);
- m_gcu[1].vram = auto_alloc_array(machine(), UINT32, 0x2000000/4);
- memset(m_gcu[0].vram, 0, 0x2000000);
- memset(m_gcu[1].vram, 0, 0x2000000);
+ int reg = offset * 4;
+
+ switch (reg)
+ {
+ case 0x10:
+ /* IRQ clear/enable; ppd writes bit off then on in response to interrupt */
+ /* it enables bits 0x41, but 0x01 seems to be the one it cares about */
+ if (ACCESSING_BITS_16_31 && (data & 0x00010000) == 0)
+ m_cpu->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
+ if (ACCESSING_BITS_0_15)
+#if PRINT_GCU
+ printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask);
+#endif
+ break;
+
+ case 0x14: // ?
+ break;
+
+ case 0x18: // ?
+ break;
+
+ case 0x20: // Framebuffer 0 Origin(?)
+ break;
+
+ case 0x24: // Framebuffer 1 Origin(?)
+ break;
+
+ case 0x28: // Framebuffer 2 Origin(?)
+ break;
+
+ case 0x2c: // Framebuffer 3 Origin(?)
+ break;
+
+ case 0x30: // Framebuffer 0 Dimensions
+ if (ACCESSING_BITS_16_31)
+ m_frame[0].height = (data >> 16) & 0xffff;
+ if (ACCESSING_BITS_0_15)
+ m_frame[0].width = data & 0xffff;
+ break;
+
+ case 0x34: // Framebuffer 1 Dimensions
+ if (ACCESSING_BITS_16_31)
+ m_frame[1].height = (data >> 16) & 0xffff;
+ if (ACCESSING_BITS_0_15)
+ m_frame[1].width = data & 0xffff;
+ break;
+
+ case 0x38: // Framebuffer 2 Dimensions
+ if (ACCESSING_BITS_16_31)
+ m_frame[2].height = (data >> 16) & 0xffff;
+ if (ACCESSING_BITS_0_15)
+ m_frame[2].width = data & 0xffff;
+ break;
+
+ case 0x3c: // Framebuffer 3 Dimensions
+ if (ACCESSING_BITS_16_31)
+ m_frame[3].height = (data >> 16) & 0xffff;
+ if (ACCESSING_BITS_0_15)
+ m_frame[3].width = data & 0xffff;
+ break;
+
+ case 0x40: // Framebuffer 0 Base
+ m_frame[0].base = data;
+#if PRINT_GCU
+ printf("%s FB0 Base: %08X\n", basetag(), data);
+#endif
+ break;
+
+ case 0x44: // Framebuffer 1 Base
+ m_frame[1].base = data;
+#if PRINT_GCU
+ printf("%s FB1 Base: %08X\n", basetag(), data);
+#endif
+ break;
+
+ case 0x48: // Framebuffer 2 Base
+ m_frame[2].base = data;
+#if PRINT_GCU
+ printf("%s FB2 Base: %08X\n", basetag(), data);
+#endif
+ break;
+
+ case 0x4c: // Framebuffer 3 Base
+ m_frame[3].base = data;
+#if PRINT_GCU
+ printf("%s FB3 Base: %08X\n", basetag(), data);
+#endif
+ break;
+
+ case 0x5c: // VRAM Read Address
+ m_vram_read_addr = (data & 0xffffff) / 2;
+ break;
+
+ case 0x60: // VRAM Port 0 Write Address
+ m_vram_fifo0_addr = (data & 0xffffff) / 2;
+ break;
+
+ case 0x68: // VRAM Port 0/1 Mode
+ if (ACCESSING_BITS_16_31)
+ m_vram_fifo0_mode = data >> 16;
+ if (ACCESSING_BITS_0_15)
+ m_vram_fifo1_mode = data & 0xffff;
+ break;
+
+ case 0x70: // VRAM Port 0 Write FIFO
+ if (m_vram_fifo0_mode & 0x100)
+ {
+ // write to command fifo
+ m_command_fifo0[m_command_fifo0_ptr] = data;
+ m_command_fifo0_ptr++;
+
+ // execute when filled
+ if (m_command_fifo0_ptr >= 4)
+ {
+ //printf("GCU FIFO0 exec: %08X %08X %08X %08X\n", m_command_fifo0[0], m_command_fifo0[1], m_command_fifo0[2], m_command_fifo0[3]);
+ execute_command(m_command_fifo0);
+ m_command_fifo0_ptr = 0;
+ }
+ }
+ else
+ {
+ // write to VRAM fifo
+ m_vram[m_vram_fifo0_addr] = data;
+ m_vram_fifo0_addr++;
+ }
+ break;
+
+ case 0x64: // VRAM Port 1 Write Address
+ m_vram_fifo1_addr = (data & 0xffffff) / 2;
+ printf("GCU FIFO1 addr = %08X\n", data);
+ break;
+
+ case 0x74: // VRAM Port 1 Write FIFO
+ printf("GCU FIFO1 write = %08X\n", data);
+
+ if (m_vram_fifo1_mode & 0x100)
+ {
+ // write to command fifo
+ m_command_fifo1[m_command_fifo1_ptr] = data;
+ m_command_fifo1_ptr++;
+
+ // execute when filled
+ if (m_command_fifo1_ptr >= 4)
+ {
+ printf("GCU FIFO1 exec: %08X %08X %08X %08X\n", m_command_fifo1[0], m_command_fifo1[1], m_command_fifo1[2], m_command_fifo1[3]);
+ m_command_fifo1_ptr = 0;
+ }
+ }
+ else
+ {
+ // write to VRAM fifo
+ m_vram[m_vram_fifo1_addr] = data;
+ m_vram_fifo1_addr++;
+ }
+ break;
+
+ default:
+ //printf("%s_w: %02X, %08X, %08X\n", basetag(), reg, data, mem_mask);
+ break;
+ }
}
+int firebeat_gcu_device::draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ UINT16 *vram16 = (UINT16*)m_vram;
+
+ int x = 0;
+ int y = 0;
+ int width = m_frame[0].width;
+ int height = m_frame[0].height;
+
+ if (width != 0 && height != 0)
+ {
+ rectangle visarea = screen.visible_area();
+ if ((visarea.max_x+1) != width || (visarea.max_y+1) != height)
+ {
+ visarea.max_x = width-1;
+ visarea.max_y = height-1;
+ screen.configure(width, height, visarea, screen.frame_period().attoseconds);
+ }
+ }
+
+ int fb_pitch = 1024;
+
+ for (int j=0; j < height; j++)
+ {
+ UINT16 *d = &bitmap.pix16(j, x);
+ int li = ((j+y) * fb_pitch) + x;
+ UINT32 fbaddr0 = m_frame[0].base + li;
+ UINT32 fbaddr1 = m_frame[1].base + li;
+// UINT32 fbaddr2 = m_frame[2].base + li;
+// UINT32 fbaddr3 = m_frame[3].base + li;
+
+ for (int i=0; i < width; i++)
+ {
+ UINT16 pix0 = vram16[fbaddr0 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)];
+ UINT16 pix1 = vram16[fbaddr1 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)];
+// UINT16 pix2 = vram16[fbaddr2 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)];
+// UINT16 pix3 = vram16[fbaddr3 ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)];
+
+ if (pix0 & 0x8000)
+ {
+ d[i] = pix0 & 0x7fff;
+ }
+ else
+ {
+ d[i] = pix1 & 0x7fff;
+ }
+
+ fbaddr0++;
+ fbaddr1++;
+// fbaddr2++;
+// fbaddr3++;
+ }
+ }
-void firebeat_state::gcu_draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 *cmd)
+ return 0;
+}
+
+void firebeat_gcu_device::draw_object(UINT32 *cmd)
{
- // 0x00: xxx----- -------- -------- -------- command type
+ // 0x00: xxx----- -------- -------- -------- command (5)
+ // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates
+ // 1: relative coordinates from framebuffer origin
+ // 0x00: ----xx-- -------- -------- -------- ?
// 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx object data address in vram
// 0x01: -------- -------- ------xx xxxxxxxx object x
- // 0x01: -------- ----xxxx xxxxxx-- -------- object y
+ // 0x01: -------- xxxxxxxx xxxxxx-- -------- object y
// 0x01: -----x-- -------- -------- -------- object x flip
// 0x01: ----x--- -------- -------- -------- object y flip
// 0x01: ---x---- -------- -------- -------- object alpha enable (?)
+ // 0x01: -x------ -------- -------- -------- object transparency enable (?)
// 0x02: -------- -------- ------xx xxxxxxxx object width
// 0x02: -------- -----xxx xxxxxx-- -------- object x scale
@@ -301,53 +485,49 @@ void firebeat_state::gcu_draw_object(bitmap_ind16 &bitmap, const rectangle &clip
// 0x03: -------- -------- ------xx xxxxxxxx object height
// 0x03: -------- -----xxx xxxxxx-- -------- object y scale
- int x = cmd[1] & 0x3ff;
- int y = (cmd[1] >> 10) & 0x3ff;
- int width = (cmd[2] & 0x3ff) + 1;
- int height = (cmd[3] & 0x3ff) + 1;
- int xscale = (cmd[2] >> 10) & 0x1ff;
- int yscale = (cmd[3] >> 10) & 0x1ff;
- int xflip = (cmd[1] & 0x04000000) ? 1 : 0;
- int yflip = (cmd[1] & 0x08000000) ? 1 : 0;
- int alpha_enable = (cmd[1] & 0x10000000) ? 1 : 0;
- UINT32 address = cmd[0] & 0xffffff;
- int alpha_level = (cmd[2] >> 27) & 0x1f;
+ int x = cmd[1] & 0x3ff;
+ int y = (cmd[1] >> 10) & 0x3fff;
+ int width = (cmd[2] & 0x3ff) + 1;
+ int height = (cmd[3] & 0x3ff) + 1;
+ int xscale = (cmd[2] >> 10) & 0x1ff;
+ int yscale = (cmd[3] >> 10) & 0x1ff;
+ bool xflip = (cmd[1] & 0x04000000) ? true : false;
+ bool yflip = (cmd[1] & 0x08000000) ? true : false;
+ bool alpha_enable = (cmd[1] & 0x10000000) ? true : false;
+ bool trans_enable = (cmd[1] & 0x40000000) ? true : false;
+ UINT32 address = cmd[0] & 0xffffff;
+ int alpha_level = (cmd[2] >> 27) & 0x1f;
+ bool relative_coords = (cmd[0] & 0x10000000) ? true : false;
+
+ if (relative_coords)
+ {
+ x += m_fb_origin_x;
+ y += m_fb_origin_y;
+ }
- int i, j;
- int u, v;
- UINT16 *vr = (UINT16*)m_gcu[chip].vram;
+ UINT16 *vram16 = (UINT16*)m_vram;
if (xscale == 0 || yscale == 0)
{
- xscale = 0x40;
- yscale = 0x40;
return;
}
- //if ((cmd[2] >> 24) != 0x84 && (cmd[2] >> 24) != 0x04 && (cmd[2] >> 24) != 0x00)
- // printf("Unknown value = %d, %d\n", (cmd[2] >> 27) & 0x1f, (cmd[2] >> 22) & 0x1f);
+#if PRINT_GCU
+ printf("%s Draw Object %08X, x %d, y %d, w %d, h %d [%08X %08X %08X %08X]\n", basetag(), address, x, y, width, height, cmd[0], cmd[1], cmd[2], cmd[3]);
+#endif
- width = (((width * 65536) / xscale) * 64) / 65536;
- height = (((height * 65536) / yscale) * 64) / 65536;
+ width = (((width * 65536) / xscale) * 64) / 65536;
+ height = (((height * 65536) / yscale) * 64) / 65536;
- if (y > cliprect.max_y || x > cliprect.max_x) {
- return;
- }
- if ((y+height) > cliprect.max_y) {
- height = cliprect.max_y - y;
- }
- if ((x+width) > cliprect.max_x) {
- width = cliprect.max_x - x;
- }
+ int fb_pitch = 1024;
- v = 0;
- for (j=0; j < height; j++)
+ int v = 0;
+ for (int j=0; j < height; j++)
{
- int xi;
int index;
- UINT16 *d = &bitmap.pix16(j+y, x);
- //int index = address + ((v >> 6) * 1024);
-
+ int xinc;
+ UINT32 fbaddr = ((j+y) * fb_pitch) + x;
+
if (yflip)
{
index = address + ((height - 1 - (v >> 6)) * 1024);
@@ -359,45 +539,26 @@ void firebeat_state::gcu_draw_object(bitmap_ind16 &bitmap, const rectangle &clip
if (xflip)
{
- d += width;
- xi = -1;
+ fbaddr += width;
+ xinc = -1;
}
else
{
- xi = 1;
+ xinc = 1;
}
- u = 0;
- for (i=0; i < width; i++)
+ int u = 0;
+ for (int i=0; i < width; i++)
{
- UINT16 pix = vr[((index + (u >> 6)) ^ 1) & 0xffffff];
-
+ UINT16 pix = vram16[((index + (u >> 6)) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)) & 0xffffff];
+ bool draw = !trans_enable || (trans_enable && (pix & 0x8000));
if (alpha_enable)
{
- if (pix & 0x8000)
+ if (draw)
{
if ((pix & 0x7fff) != 0)
{
- //*d = pix & 0x7fff;
- UINT16 srcpix = *d;
- /*
- UINT32 r = pix & 0x7c00;
- UINT32 g = pix & 0x03e0;
- UINT32 b = pix & 0x001f;
-
- UINT32 sr = srcpix & 0x7c00;
- UINT32 sg = srcpix & 0x03e0;
- UINT32 sb = srcpix & 0x001f;
-
- sr += r;
- sg += g;
- sb += b;
- if (sr > 0x7c00) sr = 0x7c00;
- if (sg > 0x03e0) sg = 0x03e0;
- if (sb > 0x001f) sb = 0x001f;
-
- *d = sr | sg | sb;
- */
+ UINT16 srcpix = vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)];
UINT32 sr = (srcpix >> 10) & 0x1f;
UINT32 sg = (srcpix >> 5) & 0x1f;
@@ -414,22 +575,19 @@ void firebeat_state::gcu_draw_object(bitmap_ind16 &bitmap, const rectangle &clip
if (sg > 0x1f) sg = 0x1f;
if (sb > 0x1f) sb = 0x1f;
- *d = (sr << 10) | (sg << 5) | sb;
+ vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = (sr << 10) | (sg << 5) | sb | 0x8000;
}
}
}
else
{
- if (pix & 0x8000)
+ if (draw)
{
- *d = pix & 0x7fff;
+ vram16[fbaddr ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = pix | 0x8000;
}
}
- if ((cmd[0] & 0x10000000) == 0)
- *d = 0x7fff;
-
- d += xi;
+ fbaddr += xinc;
u += xscale;
}
@@ -437,56 +595,70 @@ void firebeat_state::gcu_draw_object(bitmap_ind16 &bitmap, const rectangle &clip
}
}
-void firebeat_state::gcu_fill_rect(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 *cmd)
+void firebeat_gcu_device::fill_rect(UINT32 *cmd)
{
- int i, j;
- int x1, y1, x2, y2;
+ // 0x00: xxx----- -------- -------- -------- command (4)
+ // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates
+ // 1: relative coordinates from framebuffer origin
+ // 0x00: ----xx-- -------- -------- -------- ?
+ // 0x00: -------- -------- ------xx xxxxxxxx width
+ // 0x00: -------- ----xxxx xxxxxx-- -------- height
- int x = cmd[1] & 0x3ff;
- int y = (cmd[1] >> 10) & 0x3ff;
- int width = (cmd[0] & 0x3ff) + 1;
- int height = ((cmd[0] >> 10) & 0x3ff) + 1;
+ // 0x01: -------- -------- ------xx xxxxxxxx x
+ // 0x01: -------- xxxxxxxx xxxxxx-- -------- y
- UINT16 color[4];
+ // 0x02: xxxxxxxx xxxxxxxx -------- -------- fill pattern pixel 0
+ // 0x02: -------- -------- xxxxxxxx xxxxxxxx fill pattern pixel 1
- color[0] = (cmd[2] >> 16);
- color[1] = (cmd[2] >> 0);
- color[2] = (cmd[3] >> 16);
- color[3] = (cmd[3] >> 0);
+ // 0x03: xxxxxxxx xxxxxxxx -------- -------- fill pattern pixel 2
+ // 0x03: -------- -------- xxxxxxxx xxxxxxxx fill pattern pixel 3
- x1 = x;
- x2 = x + width;
- y1 = y;
- y2 = y + height;
+ int x = cmd[1] & 0x3ff;
+ int y = (cmd[1] >> 10) & 0x3fff;
+ int width = (cmd[0] & 0x3ff) + 1;
+ int height = ((cmd[0] >> 10) & 0x3ff) + 1;
+ bool relative_coords = (cmd[0] & 0x10000000) ? true : false;
- if ((color[0] & 0x8000) == 0 && (color[1] & 0x8000) == 0 && (color[2] & 0x8000) == 0 && (color[3] & 0x8000) == 0)
+ if (relative_coords)
{
- // optimization, nothing to fill
- return;
+ x += m_fb_origin_x;
+ y += m_fb_origin_y;
}
- // clip
- if (x1 < cliprect.min_x) x1 = cliprect.min_x;
- if (y1 < cliprect.min_y) y1 = cliprect.min_y;
- if (x2 > cliprect.max_x) x2 = cliprect.max_x;
- if (y2 > cliprect.max_y) y2 = cliprect.max_y;
+ UINT16 color[4];
+ color[0] = (cmd[2] >> 16);
+ color[1] = (cmd[2] & 0xffff);
+ color[2] = (cmd[3] >> 16);
+ color[3] = (cmd[3] & 0xffff);
+
+#if PRINT_GCU
+ printf("%s Fill Rect x %d, y %d, w %d, h %d, %08X %08X [%08X %08X %08X %08X]\n", basetag(), x, y, width, height, cmd[2], cmd[3], cmd[0], cmd[1], cmd[2], cmd[3]);
+#endif
+
+ int x1 = x;
+ int x2 = x + width;
+ int y1 = y;
+ int y2 = y + height;
+
+ UINT16 *vram16 = (UINT16*)m_vram;
+
+ int fb_pitch = 1024;
- for (j=y1; j < y2; j++)
+ for (int j=y1; j < y2; j++)
{
- UINT16 *d = &bitmap.pix16(j);
- for (i=x1; i < x2; i++)
+ UINT32 fbaddr = j * fb_pitch;
+ for (int i=x1; i < x2; i++)
{
- if (color[i&3] & 0x8000)
- {
- d[i] = color[i&3] & 0x7fff;
- }
+ vram16[(fbaddr+i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = color[i&3];
}
}
}
-void firebeat_state::gcu_draw_character(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 *cmd)
+void firebeat_gcu_device::draw_character(UINT32 *cmd)
{
- // 0x00: xxx----- -------- -------- -------- command type
+ // 0x00: xxx----- -------- -------- -------- command (7)
+ // 0x00: ---x---- -------- -------- -------- 0: absolute coordinates
+ // 1: relative coordinates from framebuffer base (unverified, should be same as other operations)
// 0x00: -------- xxxxxxxx xxxxxxxx xxxxxxxx character data address in vram
// 0x01: -------- -------- ------xx xxxxxxxx character x
@@ -498,345 +670,311 @@ void firebeat_state::gcu_draw_character(bitmap_ind16 &bitmap, const rectangle &c
// 0x03: xxxxxxxx xxxxxxxx -------- -------- color 2
// 0x03: -------- -------- xxxxxxxx xxxxxxxx color 3
- int i, j;
- int x = cmd[1] & 0x3ff;
- int y = (cmd[1] >> 10) & 0x3ff;
- UINT32 address = cmd[0] & 0xffffff;
+ int x = cmd[1] & 0x3ff;
+ int y = (cmd[1] >> 10) & 0x3ff;
+ UINT32 address = cmd[0] & 0xffffff;
UINT16 color[4];
+ bool relative_coords = (cmd[0] & 0x10000000) ? true : false;
- UINT16 *vr = (UINT16*)m_gcu[chip].vram;
-
- color[0] = (cmd[2] >> 16) & 0xffff;
- color[1] = (cmd[2] >> 0) & 0xffff;
- color[2] = (cmd[3] >> 16) & 0xffff;
- color[3] = (cmd[3] >> 0) & 0xffff;
-
-
- if (y > cliprect.max_y || x > cliprect.max_x) {
- return;
+ if (relative_coords)
+ {
+ x += m_fb_origin_x;
+ y += m_fb_origin_y;
}
+#if PRINT_GCU
+ printf("%s Draw Char %08X, x %d, y %d\n", basetag(), address, x, y);
+#endif
+
+ UINT16 *vram16 = (UINT16*)m_vram;
+ int fb_pitch = 1024;
- for (j=0; j < 8; j++)
+ for (int j=0; j < 8; j++)
{
- UINT16 *d = &bitmap.pix16(y+j, x);
- UINT16 line = vr[address^1];
+ UINT32 fbaddr = (y+j) * fb_pitch;
+ UINT16 line = vram16[address ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)];
address += 4;
- for (i=0; i < 8; i++)
+ for (int i=0; i < 8; i++)
{
- int pix = (line >> ((7-i) * 2)) & 3;
- d[i] = color[pix];
+ int p = (line >> ((7-i) * 2)) & 3;
+ vram16[(fbaddr+x+i) ^ NATIVE_ENDIAN_VALUE_LE_BE(1,0)] = color[p];
}
}
}
-void firebeat_state::gcu_exec_display_list(bitmap_ind16 &bitmap, const rectangle &cliprect, int chip, UINT32 address)
+void firebeat_gcu_device::fb_config(UINT32 *cmd)
+{
+ // 0x00: xxx----- -------- -------- -------- command (3)
+
+ // 0x01: -------- -------- -------- -------- unused?
+
+ // 0x02: -------- -------- ------xx xxxxxxxx Framebuffer Origin X
+
+ // 0x03: -------- -------- --xxxxxx xxxxxxxx Framebuffer Origin Y
+
+#if PRINT_GCU
+ printf("%s FB Config %08X %08X %08X %08X\n", basetag(), cmd[0], cmd[1], cmd[2], cmd[3]);
+#endif
+
+ m_fb_origin_x = cmd[2] & 0x3ff;
+ m_fb_origin_y = cmd[3] & 0x3fff;
+}
+
+void firebeat_gcu_device::execute_display_list(UINT32 addr)
{
+ bool end = false;
+
int counter = 0;
- int end = 0;
- int i = address / 4;
- if (i < 0) i = 0;
- while (!end && counter < 0x1000 && i < (0x2000000/4))
+#if PRINT_GCU
+ printf("%s Exec Display List %08X\n", basetag(), addr);
+#endif
+
+ addr /= 2;
+ while (!end && counter < 0x1000 && addr < (0x2000000/4))
{
- int command;
- UINT32 cmd[4];
- cmd[0] = m_gcu[chip].vram[i+0];
- cmd[1] = m_gcu[chip].vram[i+1];
- cmd[2] = m_gcu[chip].vram[i+2];
- cmd[3] = m_gcu[chip].vram[i+3];
+ UINT32 *cmd = &m_vram[addr];
+ addr += 4;
- command = (cmd[0] >> 29) & 0x7;
+ int command = (cmd[0] >> 29) & 0x7;
switch (command)
{
- case 0x0: // ???
- {
+ case 0: // NOP?
break;
- }
- case 0x1: // Branch
- {
- gcu_exec_display_list(bitmap, cliprect, chip, cmd[0] & 0xffffff);
+ case 1: // Execute display list
+ execute_display_list(cmd[0] & 0xffffff);
break;
- }
- case 0x2: // End of display list
- {
- end = 1;
+ case 2: // End of display list
+ end = true;
break;
- }
- case 0x3: // ???
- {
+ case 3: // Framebuffer config
+ fb_config(cmd);
break;
- }
- case 0x4: // Fill rectangle
- {
- gcu_fill_rect(bitmap, cliprect, cmd);
+ case 4: // Fill rectangle
+ fill_rect(cmd);
break;
- }
- case 0x5: // Draw object
- {
- gcu_draw_object(bitmap, cliprect, chip, cmd);
+ case 5: // Draw object
+ draw_object(cmd);
break;
- }
- case 0x7: // Draw 8x8 Character (2-bits per pixel)
- {
- gcu_draw_character(bitmap, cliprect, chip, cmd);
+ case 7: // Draw 8x8 character (2 bits per pixel)
+ draw_character(cmd);
break;
- }
default:
- //printf("Unknown command %08X %08X %08X %08X at %08X\n", cmd[0], cmd[1], cmd[2], cmd[3], i*4);
+ printf("GCU Unknown command %08X %08X %08X %08X\n", cmd[0], cmd[1], cmd[2], cmd[3]);
break;
}
-
- i += 4;
counter++;
};
}
-UINT32 firebeat_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int chip)
+void firebeat_gcu_device::execute_command(UINT32* cmd)
{
- bitmap.fill(0, cliprect);
-
- if ((core_strnicmp(machine().system().name, "popn", 4) == 0) || (core_strnicmp(machine().system().name, "bm3", 3) == 0))
- {
- gcu_exec_display_list( bitmap, cliprect, chip, 0x1f80000);
- }
- else
- {
- if (m_layer >= 2)
- {
- gcu_exec_display_list(bitmap, cliprect, chip, 0x8000);
- gcu_exec_display_list(bitmap, cliprect, chip, 0x0000);
- gcu_exec_display_list(bitmap, cliprect, chip, 0x10000);
- }
- else if (m_layer == 0)
- {
- gcu_exec_display_list(bitmap, cliprect, chip, 0x200000);
+ int command = (cmd[0] >> 29) & 0x7;
- //gcu_exec_display_list(bitmap, cliprect, chip, 0x186040);
- }
- else if (m_layer == 1)
- {
- gcu_exec_display_list(bitmap, cliprect, chip, 0x1d0800);
-
- gcu_exec_display_list(bitmap, cliprect, chip, 0x1a9440);
- }
- }
+#if PRINT_GCU
+ printf("%s Exec Command %08X, %08X, %08X, %08X\n", basetag(), cmd[0], cmd[1], cmd[2], cmd[3]);
+#endif
- m_tick++;
- if (m_tick >= 5)
+ switch (command)
{
- m_tick = 0;
- if (machine().input().code_pressed(KEYCODE_0))
- {
- m_layer++;
- if (m_layer > 2)
- {
- m_layer = 0;
- }
- }
+ case 0: // NOP?
+ break;
- /*
- if (machine().input().code_pressed_once(KEYCODE_9))
- {
- FILE *file = fopen("vram0.bin", "wb");
- int i;
-
- for (i=0; i < 0x2000000/4; i++)
- {
- fputc((m_gcu[0].vram[i] >> 24) & 0xff, file);
- fputc((m_gcu[0].vram[i] >> 16) & 0xff, file);
- fputc((m_gcu[0].vram[i] >> 8) & 0xff, file);
- fputc((m_gcu[0].vram[i] >> 0) & 0xff, file);
- }
-
- fclose(file);
- file = fopen("vram1.bin", "wb");
-
- for (i=0; i < 0x2000000/4; i++)
- {
- fputc((m_gcu[1].vram[i] >> 24) & 0xff, file);
- fputc((m_gcu[1].vram[i] >> 16) & 0xff, file);
- fputc((m_gcu[1].vram[i] >> 8) & 0xff, file);
- fputc((m_gcu[1].vram[i] >> 0) & 0xff, file);
- }
-
- fclose(file);
- }
- */
- }
+ case 1: // Execute display list
+ execute_display_list(cmd[0] & 0xffffff);
+ break;
- return 0;
-}
+ case 2: // End of display list
+ break;
-UINT32 firebeat_state::screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 0); }
-UINT32 firebeat_state::screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 1); }
+ case 3: // Framebuffer config
+ fb_config(cmd);
+ break;
-UINT32 firebeat_state::GCU_r(int chip, UINT32 offset, UINT32 mem_mask)
-{
- int reg = offset * 4;
+ case 4: // Fill rectangle
+ fill_rect(cmd);
+ break;
- /* VRAM Read */
- if (reg >= 0x80 && reg < 0x100)
- {
- return m_gcu[chip].vram[m_gcu[chip].vram_read_address + ((reg/4) - 0x20)];
- }
+ case 5: // Draw object
+ draw_object(cmd);
+ break;
- switch(reg)
- {
- case 0x78: /* GCU Status */
- /* ppd checks bits 0x0041 of the upper halfword on interrupt */
- return 0xffff0005;
+ case 7: // Draw 8x8 character (2 bits per pixel)
+ draw_character(cmd);
+ break;
default:
+ printf("GCU Unknown command %08X %08X %08X %08X\n", cmd[0], cmd[1], cmd[2], cmd[3]);
break;
}
+}
- return 0xffffffff;
+void firebeat_gcu_device::device_start()
+{
+ m_cpu = machine().device(m_cputag);
+
+ m_vram = auto_alloc_array(machine(), UINT32, 0x2000000/4);
+ memset(m_vram, 0, 0x2000000);
}
-void firebeat_state::GCU_w(int chip, UINT32 offset, UINT32 data, UINT32 mem_mask)
+void firebeat_gcu_device::device_reset()
{
- int reg = offset * 4;
+ m_vram_read_addr = 0;
+ m_command_fifo0_ptr = 0;
+ m_command_fifo1_ptr = 0;
+ m_vram_fifo0_addr = 0;
+ m_vram_fifo1_addr = 0;
- if (reg != 0x70 && chip == 0)
+ for (int i=0; i < 4; i++)
{
- //printf("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", machine().describe_context(), chip, data, offset, mem_mask);
- //logerror("%s:gcu%d_w: %08X, %08X, %08X at %08X\n", cmachine->describe_context(), hip, data, offset, mem_mask);
+ m_frame[i].base = 0;
+ m_frame[i].width = 0;
+ m_frame[i].height = 0;
}
+}
- switch(reg)
+void firebeat_gcu_device::device_stop()
+{
+#if DUMP_VRAM
+ char filename[200];
+ sprintf(filename, "%s_vram.bin", basetag());
+ printf("dumping %s\n", filename);
+ FILE *file = fopen(filename, "wb");
+ int i;
+
+ for (i=0; i < 0x2000000/4; i++)
{
- case 0x10: /* ??? */
- /* IRQ clear/enable; ppd writes bit off then on in response to interrupt */
- /* it enables bits 0x41, but 0x01 seems to be the one it cares about */
- if (ACCESSING_BITS_16_31 && (data & 0x0001) == 0)
- m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
- break;
-
- case 0x30:
- //case 0x34:
- //case 0x38:
- //case 0x3c:
- {
- COMBINE_DATA( &m_gcu[chip].visible_area );
- if (ACCESSING_BITS_0_15)
- {
- screen_device_iterator iter(machine().root_device());
- screen_device *screen = iter.byindex(chip);
-
- if (screen != NULL)
- {
- rectangle visarea = screen->visible_area();
- int width, height;
-
- width = (m_gcu[chip].visible_area & 0xffff);
- height = (m_gcu[chip].visible_area >> 16) & 0xffff;
-
- visarea.max_x = width-1;
- visarea.max_y = height-1;
+ fputc((m_vram[i] >> 24) & 0xff, file);
+ fputc((m_vram[i] >> 16) & 0xff, file);
+ fputc((m_vram[i] >> 8) & 0xff, file);
+ fputc((m_vram[i] >> 0) & 0xff, file);
+ }
+
+ fclose(file);
+#endif
+}
- screen->configure(visarea.max_x + 1, visarea.max_y + 1, visarea, screen->frame_period().attoseconds);
- }
- }
- break;
- }
- case 0x40: /* framebuffer config */
- // HACK: switch display lists at the right times for the ParaParaParadise games until we
- // do the video emulation properly
- if (core_strnicmp(machine().system().name, "pp", 2) == 0)
- {
- switch (data)
- {
- case 0x00080000: // post
- m_layer = 0;
- break;
-
- case 0x00008400: // startup tests
- if (m_layer != 2)
- {
- m_layer = 1;
- }
- break;
-
- case 0x00068400: // game & svc menu
- m_layer = 2;
- break;
- }
- }
- else if (core_strnicmp(machine().system().name, "kbm", 3) == 0)
- {
- switch (data)
- {
- case 0x00080000: // post
- m_layer = 0;
- break;
- case 0x0000c400: // game & svn menu
- m_layer = 2;
- break;
- }
- }
- break;
- //case 0x44: /* ??? */
- // break;
- case 0x5c: /* VRAM Read Address */
- m_gcu[chip].vram_read_address = (data & 0xffffff) / 2;
- break;
+class firebeat_state : public driver_device
+{
+public:
+ firebeat_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_work_ram(*this, "work_ram"),
+ m_flash_main(*this, "flash_main"),
+ m_flash_snd1(*this, "flash_snd1"),
+ m_flash_snd2(*this, "flash_snd2"),
+ m_duart_midi(*this, "duart_midi"),
+ m_duart_com(*this, "duart_com"),
+ m_kbd0(*this, "kbd0"),
+ m_kbd1(*this, "kbd1"),
+ m_ata(*this, "ata"),
+ m_gcu0(*this, "gcu0"),
+ m_gcu1(*this, "gcu1")
+ { }
- case 0x60: /* VRAM FIFO Write Address */
- m_gcu[chip].vram_write_fifo_address = (data & 0xffffff) / 2;
+ required_device<ppc4xx_device> m_maincpu;
+ required_shared_ptr<UINT32> m_work_ram;
+ required_device<fujitsu_29f016a_device> m_flash_main;
+ required_device<fujitsu_29f016a_device> m_flash_snd1;
+ required_device<fujitsu_29f016a_device> m_flash_snd2;
+ optional_device<pc16552_device> m_duart_midi;
+ required_device<pc16552_device> m_duart_com;
+ optional_device<midi_keyboard_device> m_kbd0;
+ optional_device<midi_keyboard_device> m_kbd1;
+ required_device<ata_interface_device> m_ata;
+ required_device<firebeat_gcu_device> m_gcu0;
+ required_device<firebeat_gcu_device> m_gcu1;
- // printf("gcu%d_w: %08X, %08X, %08X\n", chip, data, offset, mem_mask);
- break;
+ UINT8 m_extend_board_irq_enable;
+ UINT8 m_extend_board_irq_active;
+// emu_timer *m_keyboard_timer;
+ int m_tick;
+ int m_layer;
+ int m_cab_data_ptr;
+ const int * m_cur_cab_data;
+// int m_keyboard_state[2];
+ UINT8 m_spu_shared_ram[0x400];
+ IBUTTON m_ibutton;
+ int m_ibutton_state;
+ int m_ibutton_read_subkey_ptr;
+ UINT8 m_ibutton_subkey_data[0x40];
+ DECLARE_READ8_MEMBER(soundram_r);
+ DECLARE_DRIVER_INIT(ppd);
+ DECLARE_DRIVER_INIT(kbm);
+ DECLARE_DRIVER_INIT(ppp);
+ DECLARE_MACHINE_START(firebeat);
+ DECLARE_MACHINE_RESET(firebeat);
+ DECLARE_VIDEO_START(firebeat);
+ UINT32 screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ UINT32 screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(firebeat_interrupt);
+ DECLARE_READ32_MEMBER(input_r);
+ DECLARE_READ32_MEMBER(sensor_r );
+ DECLARE_READ32_MEMBER(flashram_r);
+ DECLARE_WRITE32_MEMBER(flashram_w);
+ DECLARE_READ32_MEMBER(soundflash_r);
+ DECLARE_WRITE32_MEMBER(soundflash_w);
+ DECLARE_WRITE_LINE_MEMBER(ata_interrupt);
+ DECLARE_READ32_MEMBER(ata_command_r);
+ DECLARE_WRITE32_MEMBER(ata_command_w);
+ DECLARE_READ32_MEMBER(ata_control_r);
+ DECLARE_WRITE32_MEMBER(ata_control_w);
+// DECLARE_READ32_MEMBER(comm_uart_r);
+// DECLARE_WRITE32_MEMBER(comm_uart_w);
+ DECLARE_READ32_MEMBER(cabinet_r);
+ DECLARE_READ32_MEMBER(keyboard_wheel_r);
+ DECLARE_READ8_MEMBER(midi_uart_r);
+ DECLARE_WRITE8_MEMBER(midi_uart_w);
+ DECLARE_READ32_MEMBER(extend_board_irq_r);
+ DECLARE_WRITE32_MEMBER(extend_board_irq_w);
+ DECLARE_WRITE32_MEMBER(lamp_output_w);
+ DECLARE_WRITE32_MEMBER(lamp_output_kbm_w);
+ DECLARE_WRITE32_MEMBER(lamp_output_ppp_w);
+ DECLARE_WRITE32_MEMBER(lamp_output2_w);
+ DECLARE_WRITE32_MEMBER(lamp_output2_ppp_w);
+ DECLARE_WRITE32_MEMBER(lamp_output3_w);
+ DECLARE_WRITE32_MEMBER(lamp_output3_ppp_w);
+ DECLARE_READ32_MEMBER(ppc_spu_share_r);
+ DECLARE_WRITE32_MEMBER(ppc_spu_share_w);
+ DECLARE_READ16_MEMBER(spu_unk_r);
+// TIMER_CALLBACK_MEMBER(keyboard_timer_callback);
+ void set_ibutton(UINT8 *data);
+ int ibutton_w(UINT8 data);
+ DECLARE_WRITE8_MEMBER(security_w);
+ void init_lights(write32_delegate out1, write32_delegate out2, write32_delegate out3);
+ void init_firebeat();
+ void init_keyboard();
+ DECLARE_WRITE_LINE_MEMBER(sound_irq_callback);
+ DECLARE_WRITE_LINE_MEMBER(midi_uart_ch0_irq_callback);
+ DECLARE_WRITE_LINE_MEMBER(midi_uart_ch1_irq_callback);
+};
- case 0x68: /* Unknown */
- {
- break;
- }
- case 0x70: /* VRAM FIFO Write */
- m_gcu[chip].vram[m_gcu[chip].vram_write_fifo_address] = data;
- m_gcu[chip].vram_write_fifo_address++;
- break;
- default:
- // printf("gcu%d_w: %08X, %08X, %08X\n", chip, data, offset, mem_mask);
- break;
- }
-}
-READ32_MEMBER(firebeat_state::gcu0_r)
-{
- return GCU_r(0, offset, mem_mask);
-}
-WRITE32_MEMBER(firebeat_state::gcu0_w)
-{
- GCU_w(0, offset, data, mem_mask);
-}
-READ32_MEMBER(firebeat_state::gcu1_r)
+VIDEO_START_MEMBER(firebeat_state,firebeat)
{
- return GCU_r(1, offset, mem_mask);
}
-WRITE32_MEMBER(firebeat_state::gcu1_w)
-{
- GCU_w(1, offset, data, mem_mask);
-}
+UINT32 firebeat_state::screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return m_gcu0->draw(screen, bitmap, cliprect); }
+UINT32 firebeat_state::screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return m_gcu1->draw(screen, bitmap, cliprect); }
/*****************************************************************************/
@@ -1508,8 +1646,8 @@ static ADDRESS_MAP_START( firebeat_map, AS_PROGRAM, 32, firebeat_state )
AM_RANGE(0x7dc00000, 0x7dc0000f) AM_DEVREADWRITE8("duart_com", pc16552_device, read, write, 0xffffffff)
AM_RANGE(0x7e000000, 0x7e00003f) AM_DEVREADWRITE8("rtc", rtc65271_device, rtc_r, rtc_w, 0xffffffff)
AM_RANGE(0x7e000100, 0x7e00013f) AM_DEVREADWRITE8("rtc", rtc65271_device, xram_r, xram_w, 0xffffffff)
- AM_RANGE(0x7e800000, 0x7e8000ff) AM_READWRITE(gcu0_r, gcu0_w)
- AM_RANGE(0x7e800100, 0x7e8001ff) AM_READWRITE(gcu1_r, gcu1_w)
+ AM_RANGE(0x7e800000, 0x7e8000ff) AM_DEVREADWRITE("gcu0", firebeat_gcu_device, read, write)
+ AM_RANGE(0x7e800100, 0x7e8001ff) AM_DEVREADWRITE("gcu1", firebeat_gcu_device, read, write)
AM_RANGE(0x7fe00000, 0x7fe0000f) AM_READWRITE(ata_command_r, ata_command_w)
AM_RANGE(0x7fe80000, 0x7fe8000f) AM_READWRITE(ata_control_r, ata_control_w)
AM_RANGE(0x7ff80000, 0x7fffffff) AM_ROM AM_REGION("user1", 0) /* System BIOS */
@@ -1724,6 +1862,12 @@ static MACHINE_CONFIG_START( firebeat, firebeat_state )
/* video hardware */
MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ MCFG_DEVICE_ADD("gcu0", FIREBEAT_GCU, 0)
+ MCFG_FIREBEAT_GCU_CPU_TAG("maincpu")
+
+ MCFG_DEVICE_ADD("gcu1", FIREBEAT_GCU, 0)
+ MCFG_FIREBEAT_GCU_CPU_TAG("maincpu")
+
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
@@ -1778,6 +1922,12 @@ static MACHINE_CONFIG_START( firebeat2, firebeat_state )
/* video hardware */
MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ MCFG_DEVICE_ADD("gcu0", FIREBEAT_GCU, 0)
+ MCFG_FIREBEAT_GCU_CPU_TAG("maincpu")
+
+ MCFG_DEVICE_ADD("gcu1", FIREBEAT_GCU, 0)
+ MCFG_FIREBEAT_GCU_CPU_TAG("maincpu")
+
MCFG_SCREEN_ADD("lscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)