(MESS) odyssey2: Some small EF934x changes (nw)

This commit is contained in:
Wilbert Pol 2012-12-30 20:14:04 +00:00
parent a0ef569e93
commit 22f330482b
3 changed files with 79 additions and 15 deletions

View File

@ -117,6 +117,7 @@ public:
DECLARE_WRITE8_MEMBER(lum_write); DECLARE_WRITE8_MEMBER(lum_write);
DECLARE_READ8_MEMBER(t1_read); DECLARE_READ8_MEMBER(t1_read);
DECLARE_DRIVER_INIT(odyssey2); DECLARE_DRIVER_INIT(odyssey2);
virtual void machine_start();
virtual void machine_reset(); virtual void machine_reset();
virtual void video_start(); virtual void video_start();
void video_start_g7400(); void video_start_g7400();
@ -132,10 +133,13 @@ protected:
ef9341_t m_ef9341; ef9341_t m_ef9341;
UINT8 m_ef934x_ram_a[1024]; UINT8 m_ef934x_ram_a[1024];
UINT8 m_ef934x_ram_b[1024]; UINT8 m_ef934x_ram_b[1024];
UINT8 m_ef934x_ext_char_ram[1024];
bool m_g7400; bool m_g7400;
inline UINT16 ef9340_get_c_addr(); inline UINT16 ef9340_get_c_addr();
inline void ef9340_inc_c(); inline void ef9340_inc_c();
// Calculate the external chargen address for a character and slice
inline UINT16 external_chargen_address(UINT8 b, UINT8 slice);
void i824x_scanline(int vpos); void i824x_scanline(int vpos);
void er9340_scanline(int vpos); void er9340_scanline(int vpos);

View File

@ -79,6 +79,22 @@ DRIVER_INIT_MEMBER(odyssey2_state,odyssey2)
} }
void odyssey2_state::machine_start()
{
save_item(NAME(m_ef934x_ram_a));
save_item(NAME(m_ef934x_ram_b));
save_item(NAME(m_ef9340.X));
save_item(NAME(m_ef9340.Y));
save_item(NAME(m_ef9340.Y0));
save_item(NAME(m_ef9340.R));
save_item(NAME(m_ef9340.M));
save_item(NAME(m_ef9341.TA));
save_item(NAME(m_ef9341.TB));
save_item(NAME(m_ef9341.busy));
save_item(NAME(m_ef934x_ext_char_ram));
}
void odyssey2_state::machine_reset() void odyssey2_state::machine_reset()
{ {
/* jump to "last" bank, will work for all sizes due to being mirrored */ /* jump to "last" bank, will work for all sizes due to being mirrored */

View File

@ -721,15 +721,32 @@ UINT16 odyssey2_state::ef9340_get_c_addr()
return ( m_ef9340.Y << 5 ) | m_ef9340.X; return ( m_ef9340.Y << 5 ) | m_ef9340.X;
} }
void odyssey2_state::ef9340_inc_c() void odyssey2_state::ef9340_inc_c()
{ {
m_ef9340.X++; m_ef9340.X++;
if ( m_ef9340.X >= 40 ) if ( m_ef9340.X >= 40 )
{ {
m_ef9340.Y = ( m_ef9340.Y + 1 ) % 24; m_ef9340.Y = ( m_ef9340.Y + 1 ) % 24;
m_ef9340.X = 0;
} }
} }
UINT16 odyssey2_state::external_chargen_address(UINT8 b, UINT8 slice)
{
UINT8 cc = b & 0x7f;
if ( slice & 8 )
{
// 0 0 CCE4 CCE3 CCE2 CCE1 CCE0 CCE6 CCE5 ADR0
return ( ( cc << 3 ) & 0xf8 ) | ( ( cc >> 4 ) & 0x06) | ( slice & 0x01 );
}
// CCE6 CCE5 CCE4 CCE3 CCE2 CCE1 CCE0 ADR2 ADR1 ADR0
return ( cc << 3 ) | ( slice & 0x07 );
}
void odyssey2_state::ef9341_w( UINT8 command, UINT8 b, UINT8 data ) void odyssey2_state::ef9341_w( UINT8 command, UINT8 b, UINT8 data )
{ {
logerror("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data ); logerror("ef9341 %s write, t%s, data %02X\n", command ? "command" : "data", b ? "B" : "A", data );
@ -776,24 +793,52 @@ void odyssey2_state::ef9341_w( UINT8 command, UINT8 b, UINT8 data )
{ {
if ( b ) if ( b )
{ {
UINT16 addr = ef9340_get_c_addr() & 0x3ff;
m_ef9341.TB = data; m_ef9341.TB = data;
m_ef9341.busy = 0x80; m_ef9341.busy = 0x80;
switch ( m_ef9340.M & 0xE0 ) switch ( m_ef9340.M & 0xE0 )
{ {
case 0x00: /* Write */ case 0x00: /* Write */
m_ef934x_ram_b[ ef9340_get_c_addr() & 0x3ff ] = m_ef9341.TB; m_ef934x_ram_a[addr] = m_ef9341.TA;
ef9340_inc_c(); m_ef934x_ram_b[addr] = m_ef9341.TB;
break; ef9340_inc_c();
case 0x20: /* Read */ break;
logerror("ef9341 unimplemented data action %02X\n", m_ef9340.M & 0xE0 );
ef9340_inc_c(); case 0x20: /* Read */
break; m_ef9341.TA = m_ef934x_ram_a[addr];
case 0x40: /* Write without increment */ m_ef9341.TB = m_ef934x_ram_b[addr];
case 0x60: /* Read without increment */ ef9340_inc_c();
case 0x80: /* Write slice */ break;
case 0xA0: /* Read slice */
logerror("ef9341 unimplemented data action %02X\n", m_ef9340.M & 0xE0 ); case 0x40: /* Write without increment */
break; m_ef934x_ram_a[addr] = m_ef9341.TA;
m_ef934x_ram_b[addr] = m_ef9341.TB;
break;
case 0x60: /* Read without increment */
m_ef9341.TA = m_ef934x_ram_a[addr];
m_ef9341.TB = m_ef934x_ram_b[addr];
break;
case 0x80: /* Write slice */
{
UINT8 b = m_ef934x_ram_b[addr];
UINT8 slice = ( m_ef9340.M & 0x0f ) % 10;
if ( b >= 0xa0 )
{
m_ef934x_ext_char_ram[ external_chargen_address( b, slice ) ] = m_ef9341.TA;
}
// Increment slice number
m_ef9340.M = ( m_ef9340.M & 0xf0) | ( ( slice + 1 ) % 10 );
}
break;
case 0xA0: /* Read slice */
fatalerror/*logerror*/("ef9341 unimplemented data action %02X\n", m_ef9340.M & 0xE0 );
break;
} }
m_ef9341.busy = 0; m_ef9341.busy = 0;
} }
@ -825,7 +870,6 @@ UINT8 odyssey2_state::ef9341_r( UINT8 command, UINT8 b )
if ( b ) if ( b )
{ {
data = m_ef9341.TB; data = m_ef9341.TB;
m_ef9341.busy = 0x80;
} }
else else
{ {