TX-1 improvements (co-credit Guru):

* Fixed remaining arithmetic unit issues
* Added correct object colour pixel LUT PROM to tx1a
* Fixed x-flipping
* Added engine sounds
This commit is contained in:
Phil Bennett 2008-01-09 00:17:09 +00:00
parent 9756e82982
commit 352e1e6879
5 changed files with 557 additions and 325 deletions

View File

@ -9,8 +9,76 @@
#include "sound/custom.h"
#include "streams.h"
/*************************************
*
* Common
*
*************************************/
static sound_stream *stream;
static int freq_to_step;
static UINT32 freq_to_step;
static UINT32 step0;
static UINT32 step1;
static UINT32 step2;
/*************************************
*
* 8253 Programmable Interval Timer
*
*************************************/
static struct
{
union
{
#ifdef LSB_FIRST
struct { UINT8 LSB; UINT8 MSB; };
#else
struct { UINT8 MSB; UINT8 LSB; };
#endif
UINT16 val;
} counts[3];
int idx[3];
} pit8253;
WRITE8_HANDLER( pit8253_w )
{
stream_update(stream);
if (offset < 3)
{
if (pit8253.idx[offset] == 0)
{
pit8253.counts[offset].LSB = data;
pit8253.idx[offset] = 1;
}
else
{
pit8253.counts[offset].MSB = data;
pit8253.idx[offset] = 0;
}
}
else
{
int mode = (data >> 1) & 7;
if (mode == 3)
{
int cntsel = (data >> 6) & 3;
pit8253.idx[cntsel] = 0;
pit8253.counts[cntsel].val = 0;
}
else
mame_printf_debug("PIT8253: Unsupported mode %d.\n", mode);
}
}
READ8_HANDLER( pit8253_r )
{
mame_printf_debug("PIT R: %x", offset);
return 0;
}
/*************************************
*
@ -18,6 +86,217 @@ static int freq_to_step;
*
*************************************/
/* RC oscillator: 1785Hz */
#define TX1_NOISE_CLOCK (1/(1000.0e-12 * 560000.0))
#define TX1_PIT_CLOCK (TX1_PIXEL_CLOCK / 16)
#define TX1_FRAC 30
#define TX1_SHUNT (250.0)
#define TX1_R0 (180000.0 + TX1_SHUNT)
#define TX1_R1 (56000.0 + TX1_SHUNT)
#define TX1_R2 (22000.0 + TX1_SHUNT)
#define TX1_R (100000.0 + TX1_SHUNT)
#define TX1_RI (180000.0)
static const double tx1_engine_gains[16] =
{
-( TX1_R )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R1) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R1 + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R2) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R2 + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R2 + 1.0/TX1_R1) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_R2 + 1.0/TX1_R1 + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT ) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R1) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R1 + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R2) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R2 + 1.0/TX1_R0) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R2 + 1.0/TX1_R1) )/TX1_RI,
-( 1.0/(1.0/TX1_R + 1.0/TX1_SHUNT + 1.0/TX1_R2 + 1.0/TX1_R1 + 1.0/TX1_R0) )/TX1_RI
};
static UINT8 ay_outputa;
static UINT8 ay_outputb;
static double weights0[3], weights1[3], weights2[4];
static int eng0[4];
static int eng1[4];
static int eng2[4];
/***************************************************************************
AY-8910 port mappings:
Port A Port B
======= ======
0: Engine 0 gain #0 0: Engine 0 gain #8
1: Engine 0 gain #1 1: Engine 0 gain #9
2: Engine 0 gain #2 2: Engine 0 gain #10
3: Engine 0 gain #3 3: Engine 0 gain #11
4: Engine 0 gain #4 4: /Enable AY on speaker CR
5: Engine 0 gain #5 5: /Enable Engines 1/2 on speakers LR/RR/CF
6: Engine 0 gain #6 6: /Skid 0 enable
7: Engine 0 gain #7 7: /Skid 1 enable
***************************************************************************/
WRITE8_HANDLER( tx1_ay8910_a_w )
{
stream_update(stream);
/* All outputs inverted */
ay_outputa = ~data;
}
WRITE8_HANDLER( tx1_ay8910_b_w )
{
double gain;
stream_update(stream);
/* Only B3-0 are inverted */
ay_outputb = data ^ 0xf;
/* It'll do until we get quadrophonic speaker support! */
gain = BIT(ay_outputb, 4) ? 1.5 : 2.0;
sndti_set_output_gain(SOUND_AY8910, 0, 0, gain);
sndti_set_output_gain(SOUND_AY8910, 0, 1, gain);
sndti_set_output_gain(SOUND_AY8910, 0, 2, gain);
if (!BIT(ay_outputb, 6))
popmessage("Skid!");
if (!BIT(ay_outputb, 7))
popmessage("Screech!");
}
/***************************************************************************
Engine sounds are produced by three of these 4013B chains:
+------------------
| +---------+
+-----+ | | +-----+ |
+-|D 1 Q|-+ +-|D 2 Q|-|-----
| |C /Q|-o----|C /Q|-+
| +-----+ | +-----+
+---------+
+----------+
| +-----+ | +-----+
| |C 3 Q|-+ |C 4 Q|-------
!&--|D /Q|------|D /Q|-+
| +-----+ +-----+ |
+-----------------------+
Common clocks omitted for clarity (all driven from an 8253 output pin).
Player: ES0, ES1, ES2
Opponent 2: ES2
***************************************************************************/
INLINE void update_engine (int eng[4])
{
int p0 = eng[0];
int p1 = eng[1];
int p2 = eng[2];
int p3 = eng[3];
eng[0] = !p0;
if (p0 && !eng[0]) eng[1] = !p1;
eng[2] = !(p2 && !p3);
eng[3] = !p2;
}
static void tx1_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
{
UINT32 step_0, step_1, step_2;
double gain_0, gain_1, gain_2, gain_3;
stream_sample_t *fl = &buffer[0][0];
stream_sample_t *fr = &buffer[1][0];
static stream_sample_t pit0 = 0;
static stream_sample_t pit1 = 0;
static stream_sample_t pit2 = 0;
/* Clear the buffers */
memset(buffer[0], 0, length * sizeof(*buffer[0]));
memset(buffer[1], 0, length * sizeof(*buffer[1]));
/* 8253 outputs for the player/opponent buggy engine sounds. */
step_0 = pit8253.counts[0].val ? (TX1_PIT_CLOCK / pit8253.counts[0].val) * freq_to_step : 0;
step_1 = pit8253.counts[1].val ? (TX1_PIT_CLOCK / pit8253.counts[1].val) * freq_to_step : 0;
step_2 = pit8253.counts[2].val ? (TX1_PIT_CLOCK / pit8253.counts[2].val) * freq_to_step : 0;
gain_0 = tx1_engine_gains[ay_outputa & 0xf];
gain_1 = tx1_engine_gains[ay_outputa >> 4];
gain_2 = tx1_engine_gains[ay_outputb & 0xf];
gain_3 = BIT(ay_outputb, 5) ? 1.0f : 1.5f;
while (length--)
{
if (step0 & ((1 << TX1_FRAC)))
{
update_engine(eng0);
pit0 = combine_4_weights(weights0, eng0[0], eng0[1], eng0[2], eng0[3]);
step0 &= ((1 << TX1_FRAC) - 1);
}
if (step1 & ((1 << TX1_FRAC)))
{
update_engine(eng1);
pit1 = combine_3_weights(weights1, eng1[0], eng1[1], eng1[3]);
step1 &= ((1 << TX1_FRAC) - 1);
}
if (step2 & ((1 << TX1_FRAC)))
{
update_engine(eng2);
pit2 = combine_3_weights(weights2, eng2[0], eng2[1], eng2[3]);
step2 &= ((1 << TX1_FRAC) - 1);
}
*fl++ = (pit0 + pit1)*gain_3 + 2*pit2*gain_2;
*fr++ = (pit0 + pit1)*gain_3 + 2*pit2*gain_2;
step0 += step_0;
step1 += step_1;
step2 += step_2;
}
}
void *tx1_sh_start(int clock, const struct CustomSound_interface *config)
{
const int r0[4] = { 390e3, 180e3, 180e3, 180e3 };
const int r1[3] = { 180e3, 390e3, 56e3 };
const int r2[3] = { 390e3, 390e3, 180e3 };
/* Allocate the stream */
stream = stream_create(0, 2, Machine->sample_rate, NULL, tx1_stream_update);
freq_to_step = (double)(1 << TX1_FRAC) / (double)Machine->sample_rate;
/* Compute the engine resistor weights */
compute_resistor_weights(0, 10000, -1.0,
4, &r0[0], weights0, 0, 0,
3, &r1[0], weights1, 0, 0,
3, &r2[0], weights2, 0, 0);
return auto_malloc(1);
}
void tx1_sh_reset(void *token)
{
step0 = step1 = step2 = 0;
}
/*************************************
*
@ -44,61 +323,45 @@ static int noise_lfsrb;
static int noise_lfsrc;
static int noise_lfsrd;
static int noise_counter;
static int step0;
static int step1;
static UINT8 ym_outputa;
static UINT8 ym_outputb;
static UINT16 buggyboy_eng_voltages[16];
static const double bb_engine_gains[16] =
{
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100E3)/100E3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1 + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2 + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3 + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4 ) + 1.0/100e3)/100e3,
-1.0/(1.0/(BUGGYBOY_R1S + BUGGYBOY_R2S + BUGGYBOY_R3S + BUGGYBOY_R4S) + 1.0/100e3)/100e3,
};
/*
8253 Programmable Interval Timer
*/
static struct
{
union
{
#ifdef LSB_FIRST
struct { UINT8 LSB; UINT8 MSB; };
#else
struct { UINT8 MSB; UINT8 LSB; };
#endif
UINT16 val;
} counts[3];
int idx[3];
} pit8253;
/***************************************************************************
/*
Port A Port B
====== ======
YM-2149, IC24 port mappings:
Port A Port B
======= ======
0: Engine 1 gain (FR) #0 0: Coin Counter 1
1: Engine 1 gain (FR) #1 1: Coin Counter 2
2: Engine 1 gain (FR) #2 2: Coin Counter 3 (Unused)
3: Engine 1 gain (FR) #3 3: Engine 0 gain
4: Engine 1 gain (FL) #0 4: Noise EN1
5: Engine 1 gain (FL) #1 5: Noise EN2
4: Engine 1 gain (FL) #0 4: Skid 0 enable
5: Engine 1 gain (FL) #1 5: Skid 1 enable
6: Engine 1 gain (FL) #2 6: Enable YM IC24 output on RR
7: Engine 1 gain (FL) #3 7: Enable YM IC19 output on RL
@ -120,7 +383,7 @@ static struct
[1] is used to amplify sound during tunnel.
[2] and [3] are stereo fades
*/
***************************************************************************/
WRITE8_HANDLER( bb_ym1_a_w )
{
@ -155,57 +418,10 @@ WRITE8_HANDLER( bb_ym1_b_w )
sndti_set_output_gain(SOUND_AY8910, 1, 2, gain);
}
WRITE8_HANDLER( pit8253_w )
{
stream_update(stream);
if (offset < 3)
{
if (pit8253.idx[offset] == 0)
{
pit8253.counts[offset].LSB = data;
pit8253.idx[offset] = 1;
}
else
{
pit8253.counts[offset].MSB = data;
pit8253.idx[offset] = 0;
}
}
else
{
int mode = (data >> 1) & 7;
if (mode == 3)
{
int cntsel = (data >> 6) & 3;
pit8253.idx[cntsel] = 0;
pit8253.counts[cntsel].val = 0;
}
else
mame_printf_debug("PIT8253: Unsupported mode %d.\n", mode);
}
}
READ8_HANDLER( pit8253_r )
{
mame_printf_debug("PIT R: %x", offset);
return 0;
}
static void tx1_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
{
}
/*
This is admittedly a bit of a hack job...
*/
/* This is admittedly a bit of a hack job... */
static void buggyboy_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
{
int step_0, step_1;
UINT32 step_0, step_1;
int n1_en, n2_en;
double gain0, gain1_l, gain1_r;
@ -298,9 +514,7 @@ void *buggyboy_sh_start(int clock, const struct CustomSound_interface *config)
/* Allocate the stream */
stream = stream_create(0, 2, Machine->sample_rate, NULL, buggyboy_stream_update);
freq_to_step = (double)(1 << 24) / (double)Machine->sample_rate;
step0 = step1 = 0;
return auto_malloc(1);
}
@ -315,19 +529,3 @@ void buggyboy_sh_reset(void *token)
noise_lfsrc = 0;
noise_lfsrd = 0;
}
void *tx1_sh_start(int clock, const struct CustomSound_interface *config)
{
/* Allocate the stream */
stream = stream_create(0, 2, Machine->sample_rate, NULL, tx1_stream_update);
freq_to_step = (double)(1 << 24) / (double)Machine->sample_rate;
step0 = 0;
step1 = 0;
return auto_malloc(1);
}
void tx1_sh_reset(void *token)
{
}

View File

@ -9,6 +9,9 @@
* Buggy Boy (1985)
* Buggy Boy Junior (1986)
ROMs wanted:
* TX-1 V8 (1984)
Notes:
* 'buggyboy' and 'tx1' are preliminary
* 'buggyboy' set is using ROMs from 'buggybjr' for testing purposes
@ -27,7 +30,7 @@
6 Sound ROM 6 Sound ROM
8 Auxillary ROM 10 Interface ROM (time-out error)
12 Arithmetic unit 11 Common RAM (access for arithmetic CPU)
22 Main 8086-Z80 timeout 12 Common RAM (access for arithmetic CPU)
22 Main 8086-Z80 time-out 12 Common RAM (access for arithmetic CPU)
13 Arithmetic RAM
14 Common RAM (access for arithmetic CPU)
15 Object RAM
@ -158,7 +161,7 @@ PORT_START_TAG("DSW")
PORT_DIPSETTING( 0xe000, "7" )
PORT_START_TAG("AN_STEERING")
PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25)
PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
PORT_START_TAG("AN_ACCELERATOR")
PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
@ -468,7 +471,6 @@ static ADDRESS_MAP_START( tx1_sound_prg, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xb000, 0xbfff) AM_READWRITE(ts_r, ts_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( tx1_sound_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
AM_RANGE(0x40, 0x40) AM_WRITE(AY8910_write_port_0_w)
@ -617,11 +619,10 @@ GFXDECODE_END
static const struct AY8910interface tx1_ay8910_interface =
{
/* TODO */
0,
0,
0,
0,
tx1_ay8910_a_w,
tx1_ay8910_b_w,
};
@ -652,8 +653,8 @@ static WRITE8_HANDLER( tx1_coin_cnt )
const ppi8255_interface tx1_ppi8255_intf =
{
1,
{ tx1_ppi_porta_r }, /* Accelerator and brake */
{ tx1_ppi_portb_r }, /* Steering and sound wire jumpers */
{ tx1_ppi_porta_r },
{ tx1_ppi_portb_r },
{ input_port_4_r },
{ 0 },
{ 0 },
@ -739,8 +740,8 @@ static MACHINE_DRIVER_START( tx1 )
MDRV_SOUND_ADD(AY8910, TX1_PIXEL_CLOCK / 8)
MDRV_SOUND_CONFIG(tx1_ay8910_interface)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Left", 0.5)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Right", 0.5)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Left", 0.1)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "Front Right", 0.1)
MDRV_SOUND_ADD(CUSTOM, 0)
MDRV_SOUND_CONFIG(tx1_custom_interface)
@ -967,6 +968,7 @@ ROM_START( tx1 )
ROM_LOAD16_BYTE( "xb01b.ic213", 0x1801, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
ROM_END
/* Some PROMs haven't been confirmed to be the same as the Tatsumi set (but are very likely identical) */
ROM_START( tx1a )
ROM_REGION( 0x100000, REGION_CPU1, 0 )
ROM_LOAD16_BYTE( "8412-136027-244.22", 0xf0000, 0x4000, CRC(2e9cefa2) SHA1(4ca04eae446e8df08ab793488a79217ed1a27875) )
@ -1013,53 +1015,54 @@ ROM_START( tx1a )
ROM_LOAD16_BYTE( "xb02b.ic223", 0x8000, 0x200, CRC(22c77af6) SHA1(1be8585b95316b4fc5712cdaef699e676320cd4d) )
ROM_LOAD16_BYTE( "xb01b.ic213", 0x8001, 0x200, CRC(f6b8b70b) SHA1(b79374acf11d71db1e4ad3c494ac5f500a52677b) )
/* Object chunk sequence LUTs */
ROM_REGION( 0x50000, REGION_USER2, 0 )
ROM_LOAD( "8411-136027-119.106", 0x0000, 0x4000, CRC(88eec0fb) SHA1(81d7a69dc1a4b3b81d7f28d97a3f80697cdcc6eb) ) /* Object chunk sequence LUT */
ROM_LOAD( "8411-136027-120.73", 0x4000, 0x4000, CRC(407cbe65) SHA1(e1c11b65f3c6abde6d55afeaffdb39cdd6d66377) ) /* Object chunk sequence LUT */
ROM_LOAD( "8411-136027-119.106", 0x0000, 0x4000, CRC(88eec0fb) SHA1(81d7a69dc1a4b3b81d7f28d97a3f80697cdcc6eb) )
ROM_LOAD( "8411-136027-120.73", 0x4000, 0x4000, CRC(407cbe65) SHA1(e1c11b65f3c6abde6d55afeaffdb39cdd6d66377) )
/* Object code and palette LUTs */
ROM_REGION( 0x50000, REGION_USER3, 0 )
ROM_LOAD( "8411-136027-113.48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) ) /* Object LUT */
ROM_LOAD( "8411-136027-118.281", 0x2000, 0x4000, CRC(de418dc7) SHA1(1233e2f7499ec5a73a40ee336d3fe26c06187784) ) /* Object palette LUT */
ROM_LOAD( "8411-136027-113.48", 0x0000, 0x2000, CRC(4b3d7956) SHA1(fc2432dd69f3be7007d4fd6f7c86c7c19453b1ba) )
ROM_LOAD( "8411-136027-118.281", 0x2000, 0x4000, CRC(de418dc7) SHA1(1233e2f7499ec5a73a40ee336d3fe26c06187784) )
/* Atari PROMs are not dumped but should be the same as the Tatsumi set. */
ROM_REGION( 0x10000, REGION_PROMS, 0 )
/* RGB palette (left) */
ROM_LOAD( "xb05a.ic57", 0x0000, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
ROM_LOAD( "xb06a.ic58", 0x0100, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
ROM_LOAD( "xb07a.ic59", 0x0200, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
ROM_LOAD( "136027-133.57", 0x0000, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
ROM_LOAD( "136027-134.58", 0x0100, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
ROM_LOAD( "136027-135.59", 0x0200, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
/* RGB palette (center) */
ROM_LOAD( "xb05a.ic36", 0x0300, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
ROM_LOAD( "xb06a.ic37", 0x0400, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
ROM_LOAD( "xb07a.ic38", 0x0500, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
ROM_LOAD( "136027-133.36", 0x0300, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
ROM_LOAD( "136027-134.37", 0x0400, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
ROM_LOAD( "136027-135.38", 0x0500, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
/* RGB palette (right) */
ROM_LOAD( "xb05a.ic8", 0x0600, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
ROM_LOAD( "xb06a.ic9", 0x0700, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
ROM_LOAD( "xb07a.ic10", 0x0800, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
ROM_LOAD( "136027-133.8", 0x0600, 0x100, CRC(3b387d01) SHA1(1229548e3052ad34eeee9598743091d19f6b8f88) )
ROM_LOAD( "136027-134.9", 0x0700, 0x100, CRC(f6f4d7d9) SHA1(866024b76b26d6942bd4e1d2494686299414f6be) )
ROM_LOAD( "136027-135.10", 0x0800, 0x100, CRC(824e7532) SHA1(917ce74d2bae6af90f2c4e41d12a69f884320915) )
/* Character colour tables (L, C, R) */
ROM_LOAD( "xb08.ic85", 0x0900, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
ROM_LOAD( "xb08.ic116", 0x0a00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
ROM_LOAD( "xb08.ic148", 0x0b00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
ROM_LOAD( "136027-124.85", 0x0900, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
ROM_LOAD( "136027-124.116", 0x0a00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
ROM_LOAD( "136027-124.148", 0x0b00, 0x100, CRC(5aeef5cc) SHA1(e123bf01d556178b0cf9d495bcce445f3f8421cd) )
/* Object colour table */
ROM_LOAD( "xb04a.ic276",0x0c00, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
ROM_LOAD( "xb04a.ic277",0x0e00, 0x200, CRC(92bf5533) SHA1(4d9127417325af66099234178ab2641d23ee9d22) )
ROM_LOAD( "136027-136.276", 0x0c00, 0x200, CRC(7b675b8b) SHA1(3a7617d8ca29aa5d9832e317736598646a466b8b) )
ROM_LOAD( "136027-136.277", 0x0e00, 0x200, CRC(7b675b8b) SHA1(3a7617d8ca29aa5d9832e317736598646a466b8b) )
/* Object tile lookup */
ROM_LOAD( "xb03a.ic25", 0x1000, 0x100, CRC(616a7a85) SHA1(b7c1060ecb128154092441212de64dc304aa3fcd) )
ROM_LOAD( "136027-123.25", 0x1000, 0x100, CRC(616a7a85) SHA1(b7c1060ecb128154092441212de64dc304aa3fcd) )
/* Road graphics */
ROM_LOAD( "xb09.ic33", 0x1100, 0x200, CRC(fafb6917) SHA1(30eb182c7623026dce7dba9e249bc8a9eb7a7f3e) )
ROM_LOAD( "xb10.ic40", 0x1300, 0x200, CRC(93deb894) SHA1(5ae9a21298c836fe649a52f3df2b4067f9012b91) )
ROM_LOAD( "xb11.ic49", 0x1500, 0x200, CRC(aa5ed232) SHA1(f33e7bc2dd33ac6d75fb06b93c4dd58e5d10010d) )
/* Road related */
/* Road stripes */
ROM_LOAD( "xb12.ic50", 0x1700, 0x200, CRC(6b424cea) SHA1(83127326c20116b0a4be1126e163f9c6755e19dc) )
ROM_END
/* The single monitor is the parent set at the moment, as the 3-monitor dump is incomplete */
/* The single monitor is the parent set at the moment, as the 3-monitor is incomplete */
ROM_START( buggybjr )
ROM_REGION( 0x100000, REGION_CPU1, 0 )
ROM_LOAD16_BYTE( "bug1a.214", 0x20000, 0x8000, CRC(92797c25) SHA1(8f7434abbd7f557d3202abb01b1e4899c82c67a5) )
@ -1069,14 +1072,14 @@ ROM_START( buggybjr )
ROM_LOAD16_BYTE( "bug5s.174", 0xf0001, 0x8000, CRC(5e352d8d) SHA1(350c206b5241d5628e673ce1108f728c8c4f980c) )
ROM_REGION( 0x100000, REGION_CPU2, 0 )
ROM_LOAD16_BYTE( "bug8s.26", 0x4000, 0x2000, CRC(efd66282) SHA1(8355422c0732c92951659930eb399129fe8d6230) )
ROM_RELOAD( 0x8000, 0x2000 )
ROM_RELOAD( 0xc000, 0x2000 )
ROM_LOAD16_BYTE( "bug8s.26", 0x4000, 0x2000, CRC(efd66282) SHA1(8355422c0732c92951659930eb399129fe8d6230) )
ROM_RELOAD( 0x8000, 0x2000 )
ROM_RELOAD( 0xc000, 0x2000 )
ROM_RELOAD( 0xfc000, 0x2000 )
ROM_LOAD16_BYTE( "bug7s.25", 0x4001, 0x2000, CRC(bd75b5eb) SHA1(f2b55f84f4c968df177a56103924ac64705285cd) )
ROM_RELOAD( 0x8001, 0x2000 )
ROM_RELOAD( 0xc001, 0x2000 )
ROM_LOAD16_BYTE( "bug7s.25", 0x4001, 0x2000, CRC(bd75b5eb) SHA1(f2b55f84f4c968df177a56103924ac64705285cd) )
ROM_RELOAD( 0x8001, 0x2000 )
ROM_RELOAD( 0xc001, 0x2000 )
ROM_RELOAD( 0xfc001, 0x2000 )
ROM_REGION( 0x10000, REGION_CPU3, 0 )
@ -1118,7 +1121,7 @@ ROM_START( buggybjr )
/* Object LUT and palette LUT*/
ROM_REGION( 0x10000, REGION_USER3, 0 )
ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
ROM_REGION( 0x10000, REGION_PROMS, 0 )
@ -1185,8 +1188,8 @@ ROM_START( buggyboy )
ROM_LOAD( "bug23s.142", 0x8000, 0x8000, CRC(015db5d8) SHA1(39ef8b44f2eb9399fb1555cffa6763e06d59c181) )
ROM_REGION( 0x40000, REGION_GFX5, ROMREGION_DISPOSE )
ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) )
ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
ROM_LOAD( "bug16s.139", 0x0000, 0x8000, CRC(1903a9ad) SHA1(526c404c15e3f04b4afb27dee66e9deb0a6b9704) )
ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
ROM_LOAD( "bug18s.141", 0x10000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
ROM_REGION( 0x40000, REGION_GFX6, 0)
@ -1206,7 +1209,7 @@ ROM_START( buggyboy )
ROM_LOAD( "bug17s.140", 0x8000, 0x8000, CRC(82cabdd4) SHA1(94324fcf83c373621fc40553473ae3cb552ab704) )
ROM_REGION( 0x10000, REGION_USER3, 0 )
ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
ROM_LOAD( "bug13.32", 0x0000, 0x2000, CRC(53604d7a) SHA1(bfa304cd885162ece7a5f54988d9880fc541eb3a) )
ROM_LOAD( "bug18s.141", 0x2000, 0x4000, CRC(67786327) SHA1(32cc1f5bc654497c968ddcd4af29720c6d659482) )
ROM_REGION( 0x10000, REGION_PROMS, 0 )

View File

@ -61,6 +61,8 @@ WRITE8_HANDLER( bb_ym1_b_w );
void *buggyboy_sh_start(int clock, const struct CustomSound_interface *config);
void buggyboy_sh_reset(void *token);
WRITE8_HANDLER( tx1_ay8910_a_w );
WRITE8_HANDLER( tx1_ay8910_b_w );
void *tx1_sh_start(int clock, const struct CustomSound_interface *config);
void tx1_sh_reset(void *token);

View File

@ -192,7 +192,13 @@ static void sn_divide(void)
INT32 W = 0;
if ( SN74S516.X == 0 )
fatalerror("SN74S516 tried to divide by zero (PC=%x)\n", activecpu_get_pc());
{
mame_printf_debug("SN74S516 tried to divide by zero (PC=%x)\n", activecpu_get_pc());
SN74S516.ZW.Z = 0xffff;
SN74S516.ZW.W = 0xffff;
SN74S516.ZWfl = 0;
return;
}
switch ( SN74S516.code )
{
@ -434,13 +440,16 @@ static void kick_sn74s516(UINT16 *data, const int ins)
#define TX1_RADCHG 0x20
#define TX1_DSEL 0x03
#define TX1_SEL_MULEN 0x00
#define TX1_SEL_PPSEN 0x01
#define TX1_SEL_PSSEN 0x02
#define TX1_SEL_LMSEL 0x03
#define TX1_SEL_DSELOE 0x04
#define TX1_SEL_INSCL 0x06
#define TX1_SEL_ILDEN 0x07
enum
{
TX1_SEL_MULEN = 0x00,
TX1_SEL_PPSEN,
TX1_SEL_PSSEN,
TX1_SEL_LMSEL,
TX1_SEL_DSELOE,
TX1_SEL_INSCL = 0x06,
TX1_SEL_ILDEN
};
#define TX1_SET_INS0_BIT do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff; } while(0)
@ -508,20 +517,21 @@ static void tx1_update_state(void)
TX1_SET_INS0_BIT;
if ( math.mux == TX1_SEL_DSELOE )
{
UINT16 data;
int dsel = (math.inslatch >> 8) & TX1_DSEL;
{
int dsel = (math.inslatch >> 8) & TX1_DSEL;
int tfad = (math.inslatch & 0x1c00) << 1;
int sd = math.ppshift;
int o4;
UINT16 data;
o4 =
(!BIT(sd, 9) && !BIT(sd,10)) ||
( BIT(sd, 7) && BIT(sd,10)) ||
(!BIT(sd, 8) && BIT(sd, 9)) ||
(!BIT(sd, 7) && BIT(sd, 8)) ||
!BIT(dsel, 1) || BIT(tfad, 13) || BIT(tfad, 12) || BIT(tfad, 11);
// int tfad = (math.inslatch & 0x1c00);
// int ps = math.ppshift & 0x78;
if ( (dsel & 1) == 0 )
dsel |= 1;
else
{
dsel &= ~1;
}
dsel = (dsel & 2) | ((dsel & o4) ^ 1);
if ( dsel == 0 )
data = math.muxlatch;
@ -540,25 +550,34 @@ static void tx1_update_state(void)
}
/*
TODO: Changed ppshift to muxlatch for TX-1
Changed masks.
*/
/TMPLD1: /LHIEN
/TMPLD2: /LLOEN.!O4 + (/LHIEN.O4)
/TMPLD3: /LLOEN
O4: !SD9.!SD10./LMSEL + SD7.SD10./LMSEL +
!SD8.SD9./LMSEL + !SD7.SD8./LMSEL +
/LMSEL./DSEL1 + /LMSEL.TFAD13 + /LMSEL.TFAD12 + /LMSEL.TFAD11
*/
else if ( LHIEN(math.inslatch) || LLOEN(math.inslatch) )
{
UINT16 data;
kick_sn74s516(&data, ins);
/* All latches enabled */
if ( LHIEN(math.inslatch) && LLOEN(math.inslatch) )
{
math.muxlatch = data;
}
else if ( math.mux == TX1_SEL_LMSEL )
else if ( math.mux == TX1_SEL_LMSEL ) // O4 = 0
{
// TMPLD2/TMPLD3 15-5
if ( LLOEN(math.inslatch) )
{
math.muxlatch &= 0x001f;
math.muxlatch |= data & 0xffe0;
}
// TMLPD1 4-0???????
else if ( LHIEN(math.inslatch) )
{
math.muxlatch &= 0xffe0;
@ -567,15 +586,49 @@ static void tx1_update_state(void)
}
else
{
/*
/TMPLD1: /LHIEN
/TMPLD2: /LLOEN.!O4 + /LHIEN.O4
/TMPLD3: /LLOEN
O4: !SD9.!SD10./LMSEL + SD7.SD10./LMSEL +
!SD8.SD9./LMSEL + !SD7.SD8./LMSEL +
/LMSEL./DSEL1 + /LMSEL.TFAD13 + /LMSEL.TFAD12 + /LMSEL.TFAD11
*/
int dsel = (math.inslatch >> 8) & TX1_DSEL;
int tfad = (math.inslatch & 0x1c00) << 1;
int sd = math.ppshift;
int o4;
o4 =
(!BIT(sd, 9) && !BIT(sd,10)) ||
( BIT(sd, 7) && BIT(sd,10)) ||
(!BIT(sd, 8) && BIT(sd, 9)) ||
(!BIT(sd, 7) && BIT(sd, 8)) ||
!BIT(dsel, 1) || BIT(tfad, 13) || BIT(tfad, 12) || BIT(tfad, 11);
if ( LLOEN(math.inslatch) )
{
math.muxlatch &= 0x0fff;
math.muxlatch |= data & 0xf000;
if (!o4)
{
// TMPLD11-5
math.muxlatch &= 0xf01f;
math.muxlatch |= data & 0x0fe0;
}
}
else if ( LHIEN(math.inslatch) )
{
math.muxlatch &= 0xf000;
math.muxlatch |= data & 0x0fff;
math.muxlatch &= 0xffe0;
math.muxlatch |= data & 0x001f;
if (o4)
{
// TMPLD11-5
math.muxlatch &= 0xf01f;
math.muxlatch |= data & 0x0fe0;
}
}
}
}
@ -633,40 +686,25 @@ READ16_HANDLER( tx1_math_r )
/* /MUXCS */
else if ( (offset & 0xc00) == 0xc00 )
{
/* TODO
SEL0 = 1 (DSEL = 0 or ???????)
DSEL1 = 0
*/
int dsel = (math.inslatch >> 8) & TX1_DSEL;
// int tfad = (math.inslatch & 0x1c00);
// int ps = math.ppshift & 0x78;
/*
Actual MUX selects
00 Straight from DLATCH
01 Straight from ROM
10 << 4
11 Halves swapped, << 3
If DSEL = x0, MUX = x1
00 -> 01
10 -> 11
10 = 11
00 = 01
*/
// TEST!
if ( (dsel & 1) == 0 )
dsel |= 1;
int dsel = (math.inslatch >> 8) & TX1_DSEL;
int tfad = (math.inslatch & 0x1c00) << 1;
int sd = math.ppshift;
int o4;
if ( math.mux == TX1_SEL_LMSEL )
o4 = 0;
else
{
dsel &= ~1;
o4 =
(!BIT(sd, 9) && !BIT(sd,10)) ||
( BIT(sd, 7) && BIT(sd,10)) ||
(!BIT(sd, 8) && BIT(sd, 9)) ||
(!BIT(sd, 7) && BIT(sd, 8)) ||
!BIT(dsel, 1) || BIT(tfad, 13) || BIT(tfad, 12) || BIT(tfad, 11);
}
dsel = (dsel & 2) | ((dsel & o4) ^ 1);
if ( dsel == 0 )
math.retval = math.muxlatch;
else if ( dsel == 1 )
@ -694,7 +732,8 @@ READ16_HANDLER( tx1_math_r )
}
else if ( math.mux == TX1_SEL_PSSEN )
{
// ????????
// WRONG!!!!
mame_printf_debug("Math Read with PSSEN!\n");
math.ppshift = math.retval;
}
@ -711,7 +750,7 @@ READ16_HANDLER( tx1_math_r )
else
{
if ( math.mux == TX1_SEL_PPSEN )
math.retval = math.ppshift;
math.retval = math.ppshift & 0x3fff;
else
/* Nothing is mapped - read from pull up resistors! */
math.retval = 0xffff;
@ -791,13 +830,18 @@ WRITE16_HANDLER( tx1_math_w )
shift >>= 1;
}
}
math.ppshift = val & 0x7ff;
math.ppshift = val;
}
}
/* /MUXCS */
else if ( (offset & 0xc00) == 0xc00 )
{
/* TODO */
/*
/TMPLD1: 0
/TMPLD2: 0
/TMPLD3: 0
*/
math.muxlatch = math.cpulatch;
}
@ -894,7 +938,8 @@ READ16_HANDLER( tx1_spcs_ram_r )
}
else if ( math.mux == TX1_SEL_PPSEN )
{
math.ppshift = math.retval & 0x3fff;
// math.ppshift = math.retval & 0x3fff;
math.ppshift = math.cpulatch;
}
else if ( math.mux == TX1_SEL_PSSEN )
{
@ -953,14 +998,17 @@ WRITE16_HANDLER( tx1_spcs_ram_w )
#define BB_RADCHG 0x20
#define BB_DSEL 0x03
#define BB_MUX_MULEN 0x00
#define BB_MUX_PPSEN 0x01
#define BB_MUX_PSSEN 0x02
#define BB_MUX_LMSEL 0x03
#define BB_MUX_DPROE 0x04
#define BB_MUX_PPOE 0x05
#define BB_MUX_INSCL 0x06
#define BB_MUX_ILDEN 0x07
enum
{
BB_MUX_MULEN = 0x00,
BB_MUX_PPSEN,
BB_MUX_PSSEN,
BB_MUX_LMSEL,
BB_MUX_DPROE,
BB_MUX_PPOE,
BB_MUX_INSCL,
BB_MUX_ILDEN,
};
#define BB_SET_INS0_BIT do { if (!(ins & 0x4) && math.i0ff) ins |= math.i0ff;} while(0)

View File

@ -273,7 +273,7 @@ static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
/* TODO: Confirm against hardware? */
if ( x_scale == 0 )
continue;
/* 16-bit y-scale accumulator */
y_scale = tx1_objram[offs + 1];
y_step = tx1_objram[offs + 3];
@ -335,17 +335,22 @@ static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
x_step = (128 << FRAC) / x_scale;
x_acc = (psa0_11 & 0xff) << (FRAC + 5);
/* TODO */
//x = tx1_objram[offs + 4] & 0x7ff;
x = tx1_objram[offs + 4];
#define TX1_MASK 0xfff
x = tx1_objram[offs + 4] & TX1_MASK;
for (;;)
{
#define MASK 0x3ff
if (newtile)
{
UINT32 low_addr = ((x_acc >> (FRAC + 3)) & MASK);
UINT32 psbb0_12;
UINT32 pscb0_14;
UINT32 pscb11;
UINT8 *romptr;
UINT32 ic281_addr;
UINT32 grom_addr;
UINT32 lut_data;
UINT32 low_addr = ((x_acc >> (FRAC + 3)) & TX1_MASK);
if (gxflip)
{
@ -353,7 +358,7 @@ static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
if ( BIT(psa0_11, 11) && BIT(psa0_11, 10) )
xor_mask = 0xf;
else if ( BIT(psa0_11, 9) )
else if ( BIT(psa0_11, 11) || BIT(psa0_11, 10) || BIT(psa0_11, 9) )
xor_mask = 0x7;
else
xor_mask = 0x3;
@ -369,121 +374,97 @@ static void tx1_draw_objects(mame_bitmap *bitmap, const rectangle *cliprect)
lasttile = 1;
dataend |= ic106_data & 0x40;
/* Retrieve data for an 8x8 tile */
ic73_data = ic73[rom_addr2];
// This is the data from the LUT pair
lut_data = (ic106_data << 8) | ic73_data;
psbb0_12 = lut_data & 0x1fff;
// 0000 1100 0011 1111
pscb0_14 = (psbb0_12 & 0xc3f);
/* Bits 9_6 are from PCTMP11-8 or PSBB9-6 */
if ( BIT(psbb0_12, 12) )
pscb0_14 |= psbb0_12 & 0x3c0;
else
pscb0_14 |= (pctmp0_7 & 0xf) << 6;
if ( BIT(lut_data, 13) )
pscb0_14 |= BIT(psbb0_12, 10) << 12; // NOT USED
else
pscb0_14 |= ((pctmp0_7 & 0x70) << 8);
/* Bit 12 is Bit 10 duplicated. */
pscb0_14 &= ~(1 << 12);
pscb0_14 |= BIT(psbb0_12, 10) << 12;
pscb11 = BIT(pscb0_14, 11);
/* TODO: Remove this - it's constant. */
romptr = (UINT8*)(pixdata_rgn + pscb11 * (0x4000 * 2));
grom_addr = ((pscb0_14 << 3) | ((y_scale >> 8) & 7)) & 0x3fff;
/* Get raw 8x8 2bpp pixel row data */
data1 = *(grom_addr + romptr);
data2 = *(grom_addr + romptr + 0x4000);
/* Determine flip state (global XOR local) */
xflip = gxflip ^ !BIT(lut_data, 15);
ic281_addr = pscb0_14 & 0x3ff;
ic281_addr |= ((pscb0_14 & 0x7000) >> 2);
ic281_addr |= pscb11 << 13;
opcd0_7 = ic281[ic281_addr];
newtile = 0;
}
/* Draw a pixel? */
if ( x <= cliprect->max_x )
{
if ( newtile )
UINT8 pix;
UINT8 bit;
bit = (x_acc >> FRAC) & 7;
if ( xflip )
bit ^= 7;
pix = (((data1 >> bit) & 1) << 1) | ((data2 >> bit) & 1);
/* Draw pixel, if not transparent */
if ( !(!(opcd0_7 & 0x80) && !pix) )
{
UINT32 psbb0_12;
UINT32 pscb0_14;
UINT32 pscb11;
UINT8 *romptr;
UINT32 ic281_addr;
UINT32 grom_addr;
UINT32 lut_data;
UINT8 color;
UINT32 prom_addr;
/* Retrieve data for an 8x8 tile */
ic73_data = ic73[rom_addr2];
prom_addr = ((opcd0_7 << 2) | pix) & 0x1ff;
// This is the data from the LUT pair
lut_data = (ic106_data << 8) | ic73_data;
psbb0_12 = lut_data & 0x1fff;
// 0000 1100 0011 1111
pscb0_14 = (psbb0_12 & 0xc3f);
/* Bits 9_6 are from PCTMP11-8 or PSBB9-6 */
/* 0000 0011 1100 0000 */
if ( BIT(psbb0_12, 12) )
pscb0_14 |= psbb0_12 & 0x3c0;
/* Inverted on schematic */
if (x & 1)
color = ~ic190[prom_addr] & 0x3f;
else
pscb0_14 |= (pctmp0_7 & 0xf) << 6;
color = ~ic162[prom_addr] & 0x3f;
// This is the important one!
if ( BIT(lut_data, 13) ) // PSBB13
pscb0_14 |= BIT(psbb0_12, 10) << 12;
else
pscb0_14 |= ((pctmp0_7 & 0x70) << 8);
// 1 = Bit 12 is Bit 10 duplicated.
// Schematics indicate otherwise...
#if 1
pscb0_14 &= ~(1 << 12);
pscb0_14 |= BIT(psbb0_12, 10) << 12;
#endif
pscb11 = BIT(pscb0_14, 11);
/* TODO: Remove this - it's constant. */
romptr = (UINT8*)(pixdata_rgn + pscb11 * (0x4000 * 2));
grom_addr = ((pscb0_14 << 3) | ((y_scale >> 8) & 7)) & 0x3fff;
/* Get raw 8x8 2bpp pixel row data */
data1 = *(grom_addr + romptr);
data2 = *(grom_addr + romptr + 0x4000);
/* Determine flip state (global XOR local) */
xflip = gxflip ^ !BIT(lut_data, 15);
/* WRONG */
ic281_addr = pscb0_14 & 0x3ff; // Bits 9_0
ic281_addr |= ((pscb0_14 & 0x7000) >> 2); //Bits 14 13 12
ic281_addr |= pscb11 << 13; // Bit 11
opcd0_7 = ic281[ic281_addr];
}
/* Draw a pixel? */
if ( x <= cliprect->max_x )
{
UINT8 pix;
UINT8 bit;
bit = (x_acc >> FRAC) & 7;
if ( xflip )
bit ^= 7;
pix = (((data1 >> bit) & 1) << 1) | ((data2 >> bit) & 1);
/* Draw pixel, if not transparent */
if ( !(!(opcd0_7 & 0x80) && !pix) )
{
UINT8 color;
UINT32 prom_addr;
prom_addr = ((opcd0_7 << 2) | pix) & 0x1ff;
/* Inverted on schematic */
if (x & 1)
color = ~ic190[prom_addr] & 0x3f;
else
color = ~ic162[prom_addr] & 0x3f;
*BITMAP_ADDR16(bitmap, y, x) = Machine->pens[TX1_COLORS_OBJ + color];
}
*BITMAP_ADDR16(bitmap, y, x) = Machine->pens[TX1_COLORS_OBJ + color];
}
}
newtile = 0;
/* Check if we've stepped into a new 8x8 tile */
/* TODO */
if ( (((x_acc + x_step) >> (FRAC + 3)) & MASK) != ((x_acc >> (FRAC + 3)) & MASK) )
if ( (((x_acc + x_step) >> (FRAC + 3)) & TX1_MASK) != ((x_acc >> (FRAC + 3)) & TX1_MASK) )
{
newtile = 1;
if ( lasttile )
if (lasttile)
break;
newtile = 1;
}
// TODO!
//x = (x + 1) & 0x7ff;
x = (x + 1);
x = (x + 1) & TX1_MASK;
x_acc += x_step;
}
}// if (yscale)