summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2010-10-17 20:19:51 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2010-10-17 20:19:51 +0000
commit8d4e4262c19ed6fc827a0082ca5cef229b1a8e86 (patch)
tree30b0f4d4abfc7b418cd815383a674b65b9a32068
parent0d8e40acb6ee20a04d82b80aa38f48f4874cc1e1 (diff)
- Re-worked Quizard MCU communications handling to be more easily expanded. [Harmony]
MAMETesters Bugs Fixed: ----------------------- 04083: All sets in balsente.c: Black screen corruption (missing graphics) [Harmony]
-rw-r--r--src/mame/drivers/balsente.c2
-rw-r--r--src/mame/drivers/cdi.c3
-rw-r--r--src/mame/includes/balsente.h3
-rw-r--r--src/mame/machine/cdi070.c138
-rw-r--r--src/mame/video/balsente.c12
5 files changed, 92 insertions, 66 deletions
diff --git a/src/mame/drivers/balsente.c b/src/mame/drivers/balsente.c
index 92916a3c678..55bec0d5d03 100644
--- a/src/mame/drivers/balsente.c
+++ b/src/mame/drivers/balsente.c
@@ -244,7 +244,7 @@ DIP locations verified for:
static ADDRESS_MAP_START( cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE_GENERIC(spriteram)
- AM_RANGE(0x0800, 0x7fff) AM_RAM_WRITE(balsente_videoram_w)
+ AM_RANGE(0x0800, 0x7fff) AM_RAM_WRITE(balsente_videoram_w) AM_BASE_MEMBER(balsente_state, videoram)
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(balsente_paletteram_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x9000, 0x9007) AM_WRITE(balsente_adc_select_w)
AM_RANGE(0x9400, 0x9401) AM_READ(balsente_adc_data_r)
diff --git a/src/mame/drivers/cdi.c b/src/mame/drivers/cdi.c
index 6cd277bc6b9..1a60210e92c 100644
--- a/src/mame/drivers/cdi.c
+++ b/src/mame/drivers/cdi.c
@@ -247,7 +247,8 @@ static MACHINE_RESET( quizrr41 )
{
MACHINE_RESET_CALL( cdi );
- scc68070_set_quizard_mcu_value(machine, 0x0139);
+ //scc68070_set_quizard_mcu_value(machine, 0x0139);
+ scc68070_set_quizard_mcu_value(machine, 0x011f);
scc68070_set_quizard_mcu_ack(machine, 0x57);
}
diff --git a/src/mame/includes/balsente.h b/src/mame/includes/balsente.h
index 6ee763bc67e..20e155f273d 100644
--- a/src/mame/includes/balsente.h
+++ b/src/mame/includes/balsente.h
@@ -115,7 +115,8 @@ public:
UINT8 grudge_last_steering[3];
/* video data */
- UINT8 videoram[256 * 256];
+ UINT8 *videoram;
+ UINT8 expanded_videoram[256*256];
UINT8 *sprite_data;
UINT32 sprite_mask;
UINT8 *sprite_bank[2];
diff --git a/src/mame/machine/cdi070.c b/src/mame/machine/cdi070.c
index 9d178e46141..596a770df4a 100644
--- a/src/mame/machine/cdi070.c
+++ b/src/mame/machine/cdi070.c
@@ -197,10 +197,6 @@ static UINT8 g_state[8] = { 0 };
void scc68070_quizard_rx(running_machine *machine, scc68070_regs_t *scc68070, UINT8 data)
{
scc68070_uart_rx(machine, scc68070, 0x5a);
- for(int index = 0; index < 8; index++)
- {
- scc68070_uart_rx(machine, scc68070, g_state[index]);
- }
scc68070_uart_rx(machine, scc68070, data);
}
@@ -274,69 +270,95 @@ INTERRUPT_GEN( scc68070_mcu_frame )
static void quizard_handle_byte_tx(running_machine *machine, scc68070_regs_t *scc68070)
{
+ static int state = 0;
static UINT8 rx[0x100];
static UINT8 rx_ptr = 0xff;
- static UINT8 ack_count = 0;
UINT8 tx = scc68070->uart.transmit_holding_register;
- /*
+ //printf("T: %02x ", tx );
if((tx >= 0x20 && tx < 0x7f) || tx == 0x0d || tx == 0x0a)
{
- printf("%c", tx);
- }
- else
- {
- printf("\n%02x? %02x\n", tx, mcu_ack);
+ //printf("%c ", tx);
}
- */
+ //printf("\n");
- if(tx == 0x56)
- {
- ack_count = 0;
- rx_ptr = 0xff;
- // We're about to lead off a sequence!
- }
- else if(tx == 0x0d || tx == 0x0a)
- {
- ack_count++;
- if(ack_count == 2)
- {
- scc68070_uart_rx(machine, scc68070, 0x5a);
- scc68070_uart_rx(machine, scc68070, g_state[0]);
- scc68070_uart_rx(machine, scc68070, g_state[1]);
- scc68070_uart_rx(machine, scc68070, g_state[2]);
- scc68070_uart_rx(machine, scc68070, g_state[3]);
- scc68070_uart_rx(machine, scc68070, g_state[4]);
- scc68070_uart_rx(machine, scc68070, g_state[5]);
- scc68070_uart_rx(machine, scc68070, g_state[6]);
- scc68070_uart_rx(machine, scc68070, g_state[7]);
- }
- }
- else if(tx == mcu_ack)
- {
- ack_count++;
- if(ack_count == 2)
- {
- //printf("Calculating seeds\n");
- quizard_set_seeds(rx);
- quizard_calculate_state(machine, scc68070);
- scc68070_uart_rx(machine, scc68070, 0x5a);
- scc68070_uart_rx(machine, scc68070, g_state[0]);
- scc68070_uart_rx(machine, scc68070, g_state[1]);
- scc68070_uart_rx(machine, scc68070, g_state[2]);
- scc68070_uart_rx(machine, scc68070, g_state[3]);
- scc68070_uart_rx(machine, scc68070, g_state[4]);
- scc68070_uart_rx(machine, scc68070, g_state[5]);
- scc68070_uart_rx(machine, scc68070, g_state[6]);
- scc68070_uart_rx(machine, scc68070, g_state[7]);
- rx_ptr = 0xff;
- }
- }
- else
+ switch(state)
{
- ack_count = 0;
- rx_ptr++;
- rx[rx_ptr] = tx;
+ case 0: // Waiting for a leadoff byte
+ if(tx == mcu_ack) // Sequence end
+ {
+ //scc68070_uart_rx(machine, scc68070, 0x5a);
+ //scc68070_uart_rx(machine, scc68070, 0x42);
+ }
+ else
+ {
+ switch(tx)
+ {
+ case 0x44: // DATABASEPATH = **_DATABASE/
+ rx[0] = 0x44;
+ rx_ptr = 1;
+ state = 3;
+ break;
+ case 0x2e: // Unknown; ignored
+ break;
+ case 0x56: // Seed start
+ rx_ptr = 0;
+ state = 1;
+ break;
+ default:
+ //printf("Unknown leadoff byte: %02x\n", tx);
+ break;
+ }
+ }
+ break;
+
+ case 1: // Receiving the seed
+ rx[rx_ptr] = tx;
+ rx_ptr++;
+ if(rx_ptr == 20)
+ {
+ //printf("Calculating seeds\n");
+ quizard_set_seeds(rx);
+ quizard_calculate_state(machine, scc68070);
+ state = 2;
+ }
+ break;
+
+ case 2: // Receiving the seed acknowledge
+ if(tx == mcu_ack)
+ {
+ state = 0;
+ scc68070_uart_rx(machine, scc68070, 0x5a);
+ scc68070_uart_rx(machine, scc68070, g_state[0]);
+ scc68070_uart_rx(machine, scc68070, g_state[1]);
+ scc68070_uart_rx(machine, scc68070, g_state[2]);
+ scc68070_uart_rx(machine, scc68070, g_state[3]);
+ scc68070_uart_rx(machine, scc68070, g_state[4]);
+ scc68070_uart_rx(machine, scc68070, g_state[5]);
+ scc68070_uart_rx(machine, scc68070, g_state[6]);
+ scc68070_uart_rx(machine, scc68070, g_state[7]);
+ }
+ break;
+
+ case 3: // Receiving the database path
+ rx[rx_ptr] = tx;
+ rx_ptr++;
+ if(tx == 0x0a)
+ {
+ rx[rx_ptr] = 0;
+ //printf("Database path: %s\n", rx);
+ scc68070_uart_rx(machine, scc68070, 0x5a);
+ scc68070_uart_rx(machine, scc68070, g_state[0]);
+ scc68070_uart_rx(machine, scc68070, g_state[1]);
+ scc68070_uart_rx(machine, scc68070, g_state[2]);
+ scc68070_uart_rx(machine, scc68070, g_state[3]);
+ scc68070_uart_rx(machine, scc68070, g_state[4]);
+ scc68070_uart_rx(machine, scc68070, g_state[5]);
+ scc68070_uart_rx(machine, scc68070, g_state[6]);
+ scc68070_uart_rx(machine, scc68070, g_state[7]);
+ state = 0;
+ }
+ break;
}
}
diff --git a/src/mame/video/balsente.c b/src/mame/video/balsente.c
index 2e6f83e5362..053ed72ac6a 100644
--- a/src/mame/video/balsente.c
+++ b/src/mame/video/balsente.c
@@ -30,7 +30,7 @@ VIDEO_START( balsente )
state->sprite_mask = memory_region_length(machine, "gfx1") - 1;
/* register for saving */
- state_save_register_global_array(machine, state->videoram);
+ state_save_register_global_array(machine, state->expanded_videoram);
state_save_register_global(machine, state->palettebank_vis);
}
@@ -47,8 +47,10 @@ WRITE8_HANDLER( balsente_videoram_w )
balsente_state *state = space->machine->driver_data<balsente_state>();
/* expand the two pixel values into two bytes */
- state->videoram[offset * 2 + 0] = data >> 4;
- state->videoram[offset * 2 + 1] = data & 15;
+ state->videoram[offset] = data;
+
+ state->expanded_videoram[offset * 2 + 0] = data >> 4;
+ state->expanded_videoram[offset * 2 + 1] = data & 15;
}
@@ -144,7 +146,7 @@ static void draw_one_sprite(running_machine *machine, bitmap_t *bitmap, const re
if (ypos >= (16 + BALSENTE_VBEND) && ypos >= cliprect->min_y && ypos <= cliprect->max_y)
{
const pen_t *pens = &machine->pens[state->palettebank_vis * 256];
- UINT8 *old = &state->videoram[(ypos - BALSENTE_VBEND) * 256 + xpos];
+ UINT8 *old = &state->expanded_videoram[(ypos - BALSENTE_VBEND) * 256 + xpos];
int currx = xpos;
/* standard case */
@@ -216,7 +218,7 @@ VIDEO_UPDATE( balsente )
/* draw scanlines from the VRAM directly */
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
- draw_scanline8(bitmap, 0, y, 256, &state->videoram[(y - BALSENTE_VBEND) * 256], pens);
+ draw_scanline8(bitmap, 0, y, 256, &state->expanded_videoram[(y - BALSENTE_VBEND) * 256], pens);
/* draw the sprite images */
for (i = 0; i < 40; i++)