abc800: Cleanup. (nw)

This commit is contained in:
Curt Coder 2018-05-14 15:23:14 +03:00
parent f3d19e977c
commit 0298e45fcf
5 changed files with 154 additions and 250 deletions

View File

@ -142,6 +142,7 @@ Notes:
TODO: TODO:
- abc802 video is all black - abc802 video is all black
- abc850 is broken
- cassette - cassette
*/ */
@ -160,7 +161,8 @@ Notes:
static DISCRETE_SOUND_START( abc800_discrete ) static DISCRETE_SOUND_START( abc800_discrete )
DISCRETE_INPUT_LOGIC(NODE_01) DISCRETE_INPUT_LOGIC(NODE_01)
DISCRETE_OUTPUT(NODE_01, 5000) DISCRETE_LOGIC_JKFLIPFLOP(NODE_02, 1,1, NODE_01, 1, 1) // 74LS393 @ 7C (input _CP0, output Q0)
DISCRETE_OUTPUT(NODE_02, 5000)
DISCRETE_SOUND_END DISCRETE_SOUND_END
@ -170,9 +172,8 @@ DISCRETE_SOUND_END
READ8_MEMBER( abc800_state::pling_r ) READ8_MEMBER( abc800_state::pling_r )
{ {
m_pling = !m_pling; m_discrete->write(space, NODE_01, 0);
m_discrete->write(space, NODE_01, 1);
m_discrete->write(space, NODE_01, m_pling);
return 0xff; return 0xff;
} }
@ -233,7 +234,7 @@ void abc802_state::bankswitch()
void abc806_state::bankswitch() void abc806_state::bankswitch()
{ {
address_space &program = m_maincpu->space(AS_PROGRAM); address_space &program = m_maincpu->space(AS_PROGRAM);
uint32_t videoram_mask = m_ram->size() - (32 * 1024) - 1; uint32_t videoram_mask = m_ram->size() - 0x8000 - 1;
int bank; int bank;
char bank_name[10]; char bank_name[10];
@ -371,7 +372,7 @@ READ8_MEMBER( abc800_state::m1_r )
{ {
if (!m_fetch_charram) if (!m_fetch_charram)
{ {
m_fetch_charram = 1; m_fetch_charram = true;
bankswitch(); bankswitch();
} }
@ -380,7 +381,7 @@ READ8_MEMBER( abc800_state::m1_r )
if (m_fetch_charram) if (m_fetch_charram)
{ {
m_fetch_charram = 0; m_fetch_charram = false;
bankswitch(); bankswitch();
} }
@ -393,7 +394,7 @@ READ8_MEMBER( abc800c_state::m1_r )
{ {
if (!m_fetch_charram) if (!m_fetch_charram)
{ {
m_fetch_charram = 1; m_fetch_charram = true;
bankswitch(); bankswitch();
} }
@ -402,7 +403,7 @@ READ8_MEMBER( abc800c_state::m1_r )
if (m_fetch_charram) if (m_fetch_charram)
{ {
m_fetch_charram = 0; m_fetch_charram = false;
bankswitch(); bankswitch();
} }
@ -511,7 +512,7 @@ void abc800_state::abc800c_io(address_map &map)
map(0x06, 0x06).mirror(0x18).w(this, FUNC(abc800_state::hrs_w)); map(0x06, 0x06).mirror(0x18).w(this, FUNC(abc800_state::hrs_w));
map(0x07, 0x07).mirror(0x18).r(ABCBUS_TAG, FUNC(abcbus_slot_device::rst_r)).w(this, FUNC(abc800_state::hrc_w)); map(0x07, 0x07).mirror(0x18).r(ABCBUS_TAG, FUNC(abcbus_slot_device::rst_r)).w(this, FUNC(abc800_state::hrc_w));
map(0x20, 0x23).mirror(0x0c).rw(m_dart, FUNC(z80dart_device::ba_cd_r), FUNC(z80dart_device::ba_cd_w)); map(0x20, 0x23).mirror(0x0c).rw(m_dart, FUNC(z80dart_device::ba_cd_r), FUNC(z80dart_device::ba_cd_w));
map(0x40, 0x43).mirror(0x1c).rw(m_sio, FUNC(z80sio2_device::ba_cd_r), FUNC(z80sio2_device::ba_cd_w)); map(0x40, 0x43).mirror(0x1c).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w));
map(0x60, 0x63).mirror(0x1c).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x60, 0x63).mirror(0x1c).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write));
} }
@ -576,7 +577,7 @@ void abc802_state::abc802_io(address_map &map)
map(0x31, 0x31).mirror(0x06).r(m_crtc, FUNC(mc6845_device::register_r)); map(0x31, 0x31).mirror(0x06).r(m_crtc, FUNC(mc6845_device::register_r));
map(0x38, 0x38).mirror(0x06).w(m_crtc, FUNC(mc6845_device::address_w)); map(0x38, 0x38).mirror(0x06).w(m_crtc, FUNC(mc6845_device::address_w));
map(0x39, 0x39).mirror(0x06).w(m_crtc, FUNC(mc6845_device::register_w)); map(0x39, 0x39).mirror(0x06).w(m_crtc, FUNC(mc6845_device::register_w));
map(0x40, 0x43).mirror(0x1c).rw(m_sio, FUNC(z80sio2_device::ba_cd_r), FUNC(z80sio2_device::ba_cd_w)); map(0x40, 0x43).mirror(0x1c).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w));
map(0x60, 0x63).mirror(0x1c).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x60, 0x63).mirror(0x1c).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write));
} }
@ -631,7 +632,7 @@ void abc806_state::abc806_io(address_map &map)
map(0x37, 0x37).select(0xff00).rw(this, FUNC(abc806_state::cli_r), FUNC(abc806_state::sso_w)); map(0x37, 0x37).select(0xff00).rw(this, FUNC(abc806_state::cli_r), FUNC(abc806_state::sso_w));
map(0x38, 0x38).mirror(0xff00).w(m_crtc, FUNC(mc6845_device::address_w)); map(0x38, 0x38).mirror(0xff00).w(m_crtc, FUNC(mc6845_device::address_w));
map(0x39, 0x39).mirror(0xff00).w(m_crtc, FUNC(mc6845_device::register_w)); map(0x39, 0x39).mirror(0xff00).w(m_crtc, FUNC(mc6845_device::register_w));
map(0x40, 0x43).mirror(0xff1c).rw(m_sio, FUNC(z80sio2_device::ba_cd_r), FUNC(z80sio2_device::ba_cd_w)); map(0x40, 0x43).mirror(0xff1c).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w));
map(0x60, 0x63).mirror(0xff1c).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); map(0x60, 0x63).mirror(0xff1c).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write));
} }
@ -660,12 +661,7 @@ INPUT_PORTS_END
//------------------------------------------------- //-------------------------------------------------
static INPUT_PORTS_START( abc802 ) static INPUT_PORTS_START( abc802 )
PORT_START("SB") PORT_INCLUDE(abc800)
PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8")
PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" )
PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" )
PORT_DIPSETTING( 0x50, "Synchronous" )
PORT_DIPSETTING( 0x8b, "ABC NET" )
PORT_START("CONFIG") PORT_START("CONFIG")
PORT_DIPNAME( 0x01, 0x00, "Clear Screen Time Out" ) PORT_DIPLOCATION("S1:1") PORT_DIPNAME( 0x01, 0x00, "Clear Screen Time Out" ) PORT_DIPLOCATION("S1:1")
@ -688,12 +684,7 @@ INPUT_PORTS_END
//------------------------------------------------- //-------------------------------------------------
static INPUT_PORTS_START( abc806 ) static INPUT_PORTS_START( abc806 )
PORT_START("SB") PORT_INCLUDE(abc800)
PORT_DIPNAME( 0xff, 0xaa, "Serial Communications" ) PORT_DIPLOCATION("SB:1,2,3,4,5,6,7,8")
PORT_DIPSETTING( 0xaa, "Asynchronous, Single Speed" )
PORT_DIPSETTING( 0x2e, "Asynchronous, Split Speed" )
PORT_DIPSETTING( 0x50, "Synchronous" )
PORT_DIPSETTING( 0x8b, "ABC NET" )
INPUT_PORTS_END INPUT_PORTS_END
@ -703,39 +694,29 @@ INPUT_PORTS_END
//************************************************************************** //**************************************************************************
//------------------------------------------------- //-------------------------------------------------
// Z80CTC // cassette
//------------------------------------------------- //-------------------------------------------------
WRITE_LINE_MEMBER( abc800_state::ctc_z0_w ) TIMER_DEVICE_CALLBACK_MEMBER( abc800_state::cassette_input_tick )
{ {
if (BIT(m_sb, 2)) if (m_cassette == nullptr) return;
int dfd_in = m_cassette->input() > 0;
if (m_dfd_in && !dfd_in)
{ {
m_sio->txca_w(state); m_sio->rxb_w(!(m_tape_ctr == 15));
m_ctc->trg3(state);
} }
clock_cassette(state); if (!dfd_in && (m_tape_ctr == 15))
{
m_tape_ctr = 4;
}
m_dfd_in = dfd_in;
} }
WRITE_LINE_MEMBER( abc800_state::ctc_z1_w ) void abc800_state::cassette_output_tick(int state)
{
if (BIT(m_sb, 3))
{
m_sio->rxca_w(state);
}
if (BIT(m_sb, 4))
{
m_sio->txca_w(state);
m_ctc->trg3(state);
}
}
//-------------------------------------------------
// Z80SIO
//-------------------------------------------------
void abc800_state::clock_cassette(int state)
{ {
if (m_cassette == nullptr) return; if (m_cassette == nullptr) return;
@ -761,6 +742,53 @@ void abc800_state::clock_cassette(int state)
m_ctc_z0 = state; m_ctc_z0 = state;
} }
//-------------------------------------------------
// Z80CTC
//-------------------------------------------------
TIMER_DEVICE_CALLBACK_MEMBER( abc800_state::ctc_tick )
{
m_ctc->trg0(1);
m_ctc->trg0(0);
m_ctc->trg1(1);
m_ctc->trg1(0);
m_ctc->trg2(1);
m_ctc->trg2(0);
}
WRITE_LINE_MEMBER( abc800_state::ctc_z0_w )
{
if (BIT(m_sb, 2))
{
m_sio->txca_w(state);
m_ctc->trg3(state);
}
cassette_output_tick(state);
}
WRITE_LINE_MEMBER( abc800_state::ctc_z1_w )
{
if (BIT(m_sb, 3))
{
m_sio->rxca_w(state);
}
if (BIT(m_sb, 4))
{
m_sio->txca_w(state);
m_ctc->trg3(state);
}
}
//-------------------------------------------------
// Z80SIO
//-------------------------------------------------
WRITE_LINE_MEMBER( abc800_state::sio_txdb_w ) WRITE_LINE_MEMBER( abc800_state::sio_txdb_w )
{ {
m_sio_txdb = state; m_sio_txdb = state;
@ -773,12 +801,10 @@ WRITE_LINE_MEMBER( abc800_state::sio_dtrb_w )
if (state) if (state)
{ {
m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
m_cassette_timer->enable(true);
} }
else else
{ {
m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
m_cassette_timer->enable(false);
} }
} }
@ -794,6 +820,7 @@ WRITE_LINE_MEMBER( abc800_state::sio_rtsb_w )
} }
} }
//------------------------------------------------- //-------------------------------------------------
// Z80DART abc802 // Z80DART abc802
//------------------------------------------------- //-------------------------------------------------
@ -810,6 +837,7 @@ WRITE_LINE_MEMBER( abc802_state::mux80_40_w )
m_80_40_mux = state; m_80_40_mux = state;
} }
//------------------------------------------------- //-------------------------------------------------
// Z80DART abc806 // Z80DART abc806
//------------------------------------------------- //-------------------------------------------------
@ -821,6 +849,7 @@ WRITE_LINE_MEMBER( abc806_state::keydtr_w )
bankswitch(); bankswitch();
} }
//------------------------------------------------- //-------------------------------------------------
// z80_daisy_config abc800_daisy_chain // z80_daisy_config abc800_daisy_chain
//------------------------------------------------- //-------------------------------------------------
@ -834,67 +863,19 @@ static const z80_daisy_config abc800_daisy_chain[] =
}; };
//************************************************************************** //**************************************************************************
// MACHINE INITIALIZATION // MACHINE INITIALIZATION
//************************************************************************** //**************************************************************************
//------------------------------------------------- //-------------------------------------------------
// device_timer - handler timer events // abc800
//-------------------------------------------------
void abc800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
switch (id)
{
case TIMER_ID_CTC:
m_ctc->trg0(1);
m_ctc->trg0(0);
m_ctc->trg1(1);
m_ctc->trg1(0);
m_ctc->trg2(1);
m_ctc->trg2(0);
break;
case TIMER_ID_CASSETTE:
{
int dfd_in = m_cassette->input() > 0;
if (m_dfd_in && !dfd_in)
{
m_sio->rxb_w(!(m_tape_ctr == 15));
}
if (!dfd_in && (m_tape_ctr == 15))
{
m_tape_ctr = 4;
}
m_dfd_in = dfd_in;
}
break;
}
}
//-------------------------------------------------
// machine_start
//------------------------------------------------- //-------------------------------------------------
void abc800_state::machine_start() void abc800_state::machine_start()
{ {
// start timers
m_ctc_timer = timer_alloc(TIMER_ID_CTC);
m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2));
m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE);
m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
m_cassette_timer->enable(false);
// register for state saving // register for state saving
save_item(NAME(m_fetch_charram)); save_item(NAME(m_fetch_charram));
save_item(NAME(m_pling));
save_item(NAME(m_sb)); save_item(NAME(m_sb));
save_item(NAME(m_ctc_z0)); save_item(NAME(m_ctc_z0));
save_item(NAME(m_sio_txcb)); save_item(NAME(m_sio_txcb));
@ -903,18 +884,15 @@ void abc800_state::machine_start()
save_item(NAME(m_dfd_out)); save_item(NAME(m_dfd_out));
save_item(NAME(m_dfd_in)); save_item(NAME(m_dfd_in));
save_item(NAME(m_tape_ctr)); save_item(NAME(m_tape_ctr));
save_item(NAME(m_hrs));
save_item(NAME(m_fgctl));
} }
//-------------------------------------------------
// machine_reset
//-------------------------------------------------
void abc800_state::machine_reset() void abc800_state::machine_reset()
{ {
m_sb = m_io_sb->read(); m_sb = m_io_sb->read();
m_fetch_charram = 0; m_fetch_charram = false;
bankswitch(); bankswitch();
m_dart->ria_w(1); m_dart->ria_w(1);
@ -927,20 +905,12 @@ void abc800_state::machine_reset()
//------------------------------------------------- //-------------------------------------------------
// machine_start // abc802
//------------------------------------------------- //-------------------------------------------------
void abc802_state::machine_start() void abc802_state::machine_start()
{ {
// start timers
m_ctc_timer = timer_alloc(TIMER_ID_CTC);
m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2));
m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE);
m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100));
// register for state saving // register for state saving
save_item(NAME(m_pling));
save_item(NAME(m_sb)); save_item(NAME(m_sb));
save_item(NAME(m_ctc_z0)); save_item(NAME(m_ctc_z0));
save_item(NAME(m_sio_txcb)); save_item(NAME(m_sio_txcb));
@ -950,13 +920,11 @@ void abc802_state::machine_start()
save_item(NAME(m_dfd_in)); save_item(NAME(m_dfd_in));
save_item(NAME(m_tape_ctr)); save_item(NAME(m_tape_ctr));
save_item(NAME(m_lrs)); save_item(NAME(m_lrs));
save_item(NAME(m_flshclk_ctr));
save_item(NAME(m_flshclk));
save_item(NAME(m_80_40_mux));
} }
//-------------------------------------------------
// machine_reset
//-------------------------------------------------
void abc802_state::machine_reset() void abc802_state::machine_reset()
{ {
uint8_t config = m_config->read(); uint8_t config = m_config->read();
@ -983,34 +951,26 @@ void abc802_state::machine_reset()
//------------------------------------------------- //-------------------------------------------------
// machine_start // abc806
//------------------------------------------------- //-------------------------------------------------
void abc806_state::machine_start() void abc806_state::machine_start()
{ {
// start timers // allocate video RAM
m_ctc_timer = timer_alloc(TIMER_ID_CTC); uint32_t videoram_size = m_ram->size() - 0x8000;
m_ctc_timer->adjust(attotime::from_hz(ABC800_X01/2/2/2), 0, attotime::from_hz(ABC800_X01/2/2/2));
// setup memory banking
uint8_t *mem = m_rom->base();
uint32_t videoram_size = m_ram->size() - (32 * 1024);
int bank;
char bank_name[10];
m_video_ram.allocate(videoram_size); m_video_ram.allocate(videoram_size);
for (bank = 1; bank <= 16; bank++) // setup memory banks
{ for (int bank = 1; bank <= 16; bank++) {
char bank_name[10];
sprintf(bank_name,"bank%d",bank); sprintf(bank_name,"bank%d",bank);
membank(bank_name)->configure_entry(0, mem + (0x1000 * (bank - 1)));
membank(bank_name)->configure_entry(0, m_rom->base() + (0x1000 * (bank - 1)));
membank(bank_name)->configure_entry(1, m_video_ram); membank(bank_name)->configure_entry(1, m_video_ram);
membank(bank_name)->set_entry(0);
} }
// register for state saving // register for state saving
save_item(NAME(m_fetch_charram)); save_item(NAME(m_fetch_charram));
save_item(NAME(m_pling));
save_item(NAME(m_sb)); save_item(NAME(m_sb));
save_item(NAME(m_ctc_z0)); save_item(NAME(m_ctc_z0));
save_item(NAME(m_sio_txcb)); save_item(NAME(m_sio_txcb));
@ -1022,47 +982,43 @@ void abc806_state::machine_start()
save_item(NAME(m_keydtr)); save_item(NAME(m_keydtr));
save_item(NAME(m_eme)); save_item(NAME(m_eme));
save_item(NAME(m_map)); save_item(NAME(m_map));
save_item(NAME(m_txoff));
save_item(NAME(m_40));
save_item(NAME(m_flshclk_ctr));
save_item(NAME(m_flshclk));
save_item(NAME(m_attr_data));
save_item(NAME(m_hrs));
save_item(NAME(m_hrc));
save_item(NAME(m_sync));
save_item(NAME(m_v50_addr));
save_item(NAME(m_hru2_a8));
save_item(NAME(m_vsync_shift));
save_item(NAME(m_vsync));
save_item(NAME(m_d_vsync));
} }
//-------------------------------------------------
// machine_reset
//-------------------------------------------------
void abc806_state::machine_reset() void abc806_state::machine_reset()
{ {
m_sb = m_io_sb->read(); // reset memory banks
for (int bank = 1; bank <= 16; bank++) {
// setup memory banking
int bank;
char bank_name[10]; char bank_name[10];
for (bank = 1; bank <= 16; bank++)
{
sprintf(bank_name,"bank%d",bank); sprintf(bank_name,"bank%d",bank);
membank(bank_name)->set_entry(0); membank(bank_name)->set_entry(0);
} }
bankswitch(); abc800_state::machine_reset();
// clear STO lines // clear STO lines
m_eme = 0; for (int i = 0; i < 8; i++) {
m_40 = 0; sto_w(m_maincpu->space(AS_PROGRAM), 0, i);
m_hru2_a8 = 0; }
m_txoff = 0;
m_rtc->cs_w(1);
m_rtc->clk_w(1);
m_rtc->dio_w(1);
m_dart->ria_w(1);
// 50/60 Hz
m_dart->ctsb_w(0); // 0 = 50Hz, 1 = 60Hz
m_dfd_in = 0;
} }
//-------------------------------------------------
// bac quickload
//-------------------------------------------------
QUICKLOAD_LOAD_MEMBER( abc800_state, bac ) QUICKLOAD_LOAD_MEMBER( abc800_state, bac )
{ {
address_space &space = m_maincpu->space(AS_PROGRAM); address_space &space = m_maincpu->space(AS_PROGRAM);
@ -1140,15 +1096,16 @@ MACHINE_CONFIG_START(abc800_state::common)
MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, abc800_state, ctc_z1_w)) MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, abc800_state, ctc_z1_w))
MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80DART_TAG, z80dart_device, rxca_w)) MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80DART_TAG, z80dart_device, rxca_w))
MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_TAG, z80dart_device, txca_w)) MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_TAG, z80dart_device, txca_w))
MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_CTC_TAG, abc800_state, ctc_tick, attotime::from_hz(ABC800_X01/2/2/2))
MCFG_DEVICE_ADD(Z80SIO_TAG, Z80SIO2, ABC800_X01/2/2) MCFG_DEVICE_ADD(Z80SIO_TAG, Z80SIO, ABC800_X01/2/2)
MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE(RS232_B_TAG, rs232_port_device, write_txd))
MCFG_Z80DART_OUT_DTRA_CB(WRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE(RS232_B_TAG, rs232_port_device, write_dtr))
MCFG_Z80DART_OUT_RTSA_CB(WRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE(RS232_B_TAG, rs232_port_device, write_rts))
MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(*this, abc800_state, sio_txdb_w)) MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE(*this, abc800_state, sio_txdb_w))
MCFG_Z80DART_OUT_DTRB_CB(WRITELINE(*this, abc800_state, sio_txdb_w)) MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE(*this, abc800_state, sio_dtrb_w))
MCFG_Z80DART_OUT_RTSB_CB(WRITELINE(*this, abc800_state, sio_txdb_w)) MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE(*this, abc800_state, sio_rtsb_w))
MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0))
MCFG_DEVICE_ADD(Z80DART_TAG, Z80DART, ABC800_X01/2/2) MCFG_DEVICE_ADD(Z80DART_TAG, Z80DART, ABC800_X01/2/2)
MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_txd))
@ -1159,6 +1116,7 @@ MACHINE_CONFIG_START(abc800_state::common)
MCFG_CASSETTE_ADD(CASSETTE_TAG) MCFG_CASSETTE_ADD(CASSETTE_TAG)
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_CASSETTE_TAG, abc800_state, cassette_input_tick, attotime::from_hz(44100))
MCFG_DEVICE_ADD(RS232_A_TAG, RS232_PORT, default_rs232_devices, nullptr) MCFG_DEVICE_ADD(RS232_A_TAG, RS232_PORT, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) MCFG_RS232_RXD_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxa_w))
@ -1166,9 +1124,9 @@ MACHINE_CONFIG_START(abc800_state::common)
MCFG_RS232_CTS_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, ctsa_w)) MCFG_RS232_CTS_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, ctsa_w))
MCFG_DEVICE_ADD(RS232_B_TAG, RS232_PORT, default_rs232_devices, nullptr) MCFG_DEVICE_ADD(RS232_B_TAG, RS232_PORT, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(WRITELINE(Z80SIO_TAG, z80dart_device, rxa_w)) MCFG_RS232_RXD_HANDLER(WRITELINE(Z80SIO_TAG, z80sio_device, rxa_w))
MCFG_RS232_DCD_HANDLER(WRITELINE(Z80SIO_TAG, z80dart_device, dcda_w)) MCFG_RS232_DCD_HANDLER(WRITELINE(Z80SIO_TAG, z80sio_device, dcda_w))
MCFG_RS232_CTS_HANDLER(WRITELINE(Z80SIO_TAG, z80dart_device, ctsa_w)) MCFG_RS232_CTS_HANDLER(WRITELINE(Z80SIO_TAG, z80sio_device, ctsa_w))
MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, nullptr) MCFG_ABC_KEYBOARD_PORT_ADD(ABC_KEYBOARD_PORT_TAG, nullptr)
MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) MCFG_ABC_KEYBOARD_OUT_RX_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxb_w))

View File

@ -17,7 +17,9 @@
#include "machine/e0516.h" #include "machine/e0516.h"
#include "machine/z80ctc.h" #include "machine/z80ctc.h"
#include "machine/z80dart.h" #include "machine/z80dart.h"
#include "machine/z80sio.h"
#include "machine/ram.h" #include "machine/ram.h"
#include "machine/timer.h"
#include "sound/discrete.h" #include "sound/discrete.h"
#include "video/mc6845.h" #include "video/mc6845.h"
#include "video/saa5050.h" #include "video/saa5050.h"
@ -61,6 +63,9 @@
#define RS232_A_TAG "rs232a" #define RS232_A_TAG "rs232a"
#define RS232_B_TAG "rs232b" #define RS232_B_TAG "rs232b"
#define ABC_KEYBOARD_PORT_TAG "kb" #define ABC_KEYBOARD_PORT_TAG "kb"
#define TIMER_CTC_TAG "timer_ctc"
#define TIMER_CASSETTE_TAG "timer_cass"
//************************************************************************** //**************************************************************************
@ -96,7 +101,7 @@ public:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<z80ctc_device> m_ctc; required_device<z80ctc_device> m_ctc;
required_device<z80dart_device> m_dart; required_device<z80dart_device> m_dart;
required_device<z80sio2_device> m_sio; required_device<z80sio_device> m_sio;
optional_device<discrete_sound_device> m_discrete; optional_device<discrete_sound_device> m_discrete;
optional_device<cassette_image_device> m_cassette; optional_device<cassette_image_device> m_cassette;
required_device<ram_device> m_ram; required_device<ram_device> m_ram;
@ -105,21 +110,11 @@ public:
optional_shared_ptr<uint8_t> m_char_ram; optional_shared_ptr<uint8_t> m_char_ram;
required_ioport m_io_sb; required_ioport m_io_sb;
enum
{
TIMER_ID_CTC,
TIMER_ID_CASSETTE
};
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override; virtual void machine_reset() override;
virtual void video_start() override;
void bankswitch(); void bankswitch();
void clock_cassette(int state); void cassette_output_tick(int state);
virtual DECLARE_READ8_MEMBER( m1_r ); virtual DECLARE_READ8_MEMBER( m1_r );
DECLARE_READ8_MEMBER( pling_r ); DECLARE_READ8_MEMBER( pling_r );
@ -130,16 +125,13 @@ public:
DECLARE_WRITE_LINE_MEMBER( sio_txdb_w ); DECLARE_WRITE_LINE_MEMBER( sio_txdb_w );
DECLARE_WRITE_LINE_MEMBER( sio_dtrb_w ); DECLARE_WRITE_LINE_MEMBER( sio_dtrb_w );
DECLARE_WRITE_LINE_MEMBER( sio_rtsb_w ); DECLARE_WRITE_LINE_MEMBER( sio_rtsb_w );
TIMER_DEVICE_CALLBACK_MEMBER( ctc_tick );
TIMER_DEVICE_CALLBACK_MEMBER( cassette_input_tick );
DECLARE_QUICKLOAD_LOAD_MEMBER( bac ); DECLARE_QUICKLOAD_LOAD_MEMBER( bac );
// memory state // memory state
bool m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff) bool m_fetch_charram; // opcode fetched from character RAM region (0x7800-0x7fff)
uint16_t m_char_ram_start;
uint16_t m_char_ram_mask;
// sound state
int m_pling;
// serial state // serial state
uint8_t m_sb; uint8_t m_sb;
@ -156,7 +148,6 @@ public:
uint8_t m_fgctl; // HR foreground control uint8_t m_fgctl; // HR foreground control
// timers // timers
emu_timer *m_ctc_timer;
emu_timer *m_cassette_timer; emu_timer *m_cassette_timer;
void common(machine_config &config); void common(machine_config &config);
void abc800_m1(address_map &map); void abc800_m1(address_map &map);
@ -212,7 +203,6 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
offs_t translate_trom_offset(offs_t offset);
void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect); void hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER( m1_r ) override; DECLARE_READ8_MEMBER( m1_r ) override;
@ -245,8 +235,6 @@ public:
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override; virtual void machine_reset() override;
virtual void video_start() override;
void bankswitch(); void bankswitch();
DECLARE_READ8_MEMBER( m1_r ) override; DECLARE_READ8_MEMBER( m1_r ) override;

View File

@ -48,24 +48,6 @@ WRITE8_MEMBER( abc800_state::hrc_w )
// ABC 800 COLOR // ABC 800 COLOR
//************************************************************************** //**************************************************************************
//-------------------------------------------------
// translate_trom_offset -
//-------------------------------------------------
offs_t abc800c_state::translate_trom_offset(offs_t offset)
{
int row = offset / 40;
int col = offset % 40;
offset = ((row & 0x07) * 0x80) + col;
if (row & 0x08) offset += 0x28;
if (row & 0x10) offset += 0x50;
return offset;
}
//------------------------------------------------- //-------------------------------------------------
// hr_update - high resolution screen update // hr_update - high resolution screen update
//------------------------------------------------- //-------------------------------------------------
@ -113,14 +95,6 @@ void abc800c_state::hr_update(bitmap_rgb32 &bitmap, const rectangle &cliprect)
} }
void abc800_state::video_start()
{
// register for state saving
save_item(NAME(m_hrs));
save_item(NAME(m_fgctl));
}
//------------------------------------------------- //-------------------------------------------------
// SCREEN_UPDATE( abc800c ) // SCREEN_UPDATE( abc800c )
//------------------------------------------------- //-------------------------------------------------
@ -149,7 +123,15 @@ uint32_t abc800c_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma
READ8_MEMBER( abc800c_state::char_ram_r ) READ8_MEMBER( abc800c_state::char_ram_r )
{ {
return m_char_ram[translate_trom_offset(offset)]; int row = offset / 40;
int col = offset % 40;
offset = ((row & 0x07) * 0x80) + col;
if (row & 0x08) offset += 0x28;
if (row & 0x10) offset += 0x50;
return m_char_ram[offset];
} }
@ -159,7 +141,7 @@ READ8_MEMBER( abc800c_state::char_ram_r )
PALETTE_INIT_MEMBER( abc800c_state, abc800c ) PALETTE_INIT_MEMBER( abc800c_state, abc800c )
{ {
palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red
palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green
palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow

View File

@ -177,15 +177,6 @@ WRITE_LINE_MEMBER( abc802_state::vs_w )
} }
void abc802_state::video_start()
{
// register for state saving
save_item(NAME(m_flshclk_ctr));
save_item(NAME(m_flshclk));
save_item(NAME(m_80_40_mux));
}
//------------------------------------------------- //-------------------------------------------------
// MACHINE_CONFIG_START( abc802_video ) // MACHINE_CONFIG_START( abc802_video )
//------------------------------------------------- //-------------------------------------------------

View File

@ -428,21 +428,6 @@ void abc806_state::video_start()
// allocate memory // allocate memory
m_char_ram.allocate(ABC806_CHAR_RAM_SIZE); m_char_ram.allocate(ABC806_CHAR_RAM_SIZE);
m_attr_ram.allocate(ABC806_ATTR_RAM_SIZE); m_attr_ram.allocate(ABC806_ATTR_RAM_SIZE);
// register for state saving
save_item(NAME(m_txoff));
save_item(NAME(m_40));
save_item(NAME(m_flshclk_ctr));
save_item(NAME(m_flshclk));
save_item(NAME(m_attr_data));
save_item(NAME(m_hrs));
save_item(NAME(m_hrc));
save_item(NAME(m_sync));
save_item(NAME(m_v50_addr));
save_item(NAME(m_hru2_a8));
save_item(NAME(m_vsync_shift));
save_item(NAME(m_vsync));
save_item(NAME(m_d_vsync));
} }
@ -474,7 +459,7 @@ uint32_t abc806_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
PALETTE_INIT_MEMBER( abc806_state, abc806 ) PALETTE_INIT_MEMBER( abc806_state, abc806 )
{ {
palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red
palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green
palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow palette.set_pen_color(3, rgb_t(0xff, 0xff, 0x00)); // yellow