mirror of
https://github.com/holub/mame
synced 2025-04-27 10:43:07 +03:00
(MESS) nanos.c: Reduce tagmap lookups (nw)
This commit is contained in:
parent
b84b7a1e63
commit
07b57e8bc0
@ -31,7 +31,20 @@ public:
|
|||||||
m_ctc_0(*this, "z80ctc_0"),
|
m_ctc_0(*this, "z80ctc_0"),
|
||||||
m_ctc_1(*this, "z80ctc_1"),
|
m_ctc_1(*this, "z80ctc_1"),
|
||||||
m_fdc(*this, "upd765"),
|
m_fdc(*this, "upd765"),
|
||||||
m_key_t(*this, "keyboard_timer")
|
m_key_t(*this, "keyboard_timer"),
|
||||||
|
m_ram(*this, RAM_TAG),
|
||||||
|
m_region_maincpu(*this, "maincpu"),
|
||||||
|
m_bank1(*this, "bank1"),
|
||||||
|
m_bank2(*this, "bank2"),
|
||||||
|
m_bank3(*this, "bank3"),
|
||||||
|
m_line0(*this, "LINE0"),
|
||||||
|
m_line1(*this, "LINE1"),
|
||||||
|
m_line2(*this, "LINE2"),
|
||||||
|
m_line3(*this, "LINE3"),
|
||||||
|
m_line4(*this, "LINE4"),
|
||||||
|
m_line5(*this, "LINE5"),
|
||||||
|
m_line6(*this, "LINE6"),
|
||||||
|
m_linec(*this, "LINEC")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
@ -44,6 +57,7 @@ public:
|
|||||||
required_device<z80ctc_device> m_ctc_1;
|
required_device<z80ctc_device> m_ctc_1;
|
||||||
required_device<upd765a_device> m_fdc;
|
required_device<upd765a_device> m_fdc;
|
||||||
required_device<timer_device> m_key_t;
|
required_device<timer_device> m_key_t;
|
||||||
|
required_device<ram_device> m_ram;
|
||||||
const UINT8 *m_p_chargen;
|
const UINT8 *m_p_chargen;
|
||||||
UINT8 m_key_command;
|
UINT8 m_key_command;
|
||||||
UINT8 m_last_code;
|
UINT8 m_last_code;
|
||||||
@ -62,6 +76,20 @@ public:
|
|||||||
DECLARE_READ8_MEMBER(nanos_port_b_r);
|
DECLARE_READ8_MEMBER(nanos_port_b_r);
|
||||||
DECLARE_WRITE8_MEMBER(nanos_port_b_w);
|
DECLARE_WRITE8_MEMBER(nanos_port_b_w);
|
||||||
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
required_memory_region m_region_maincpu;
|
||||||
|
required_memory_bank m_bank1;
|
||||||
|
required_memory_bank m_bank2;
|
||||||
|
required_memory_bank m_bank3;
|
||||||
|
required_ioport m_line0;
|
||||||
|
required_ioport m_line1;
|
||||||
|
required_ioport m_line2;
|
||||||
|
required_ioport m_line3;
|
||||||
|
required_ioport m_line4;
|
||||||
|
required_ioport m_line5;
|
||||||
|
required_ioport m_line6;
|
||||||
|
required_ioport m_linec;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +155,7 @@ static Z80PIO_INTERFACE( pio2_intf )
|
|||||||
|
|
||||||
WRITE_LINE_MEMBER(nanos_state::z80daisy_interrupt)
|
WRITE_LINE_MEMBER(nanos_state::z80daisy_interrupt)
|
||||||
{
|
{
|
||||||
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, state);
|
m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const z80sio_interface sio_intf =
|
static const z80sio_interface sio_intf =
|
||||||
@ -286,7 +314,7 @@ UINT32 nanos_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
|
|||||||
{
|
{
|
||||||
if (ra < 8)
|
if (ra < 8)
|
||||||
{
|
{
|
||||||
chr = machine().device<ram_device>(RAM_TAG)->pointer()[0xf800+ x];
|
chr = m_ram->pointer()[0xf800+ x];
|
||||||
|
|
||||||
/* get pattern of pixels for that character scanline */
|
/* get pattern of pixels for that character scanline */
|
||||||
gfx = m_p_chargen[(chr<<3) | ra ];
|
gfx = m_p_chargen[(chr<<3) | ra ];
|
||||||
@ -332,9 +360,9 @@ WRITE8_MEMBER(nanos_state::nanos_port_b_w)
|
|||||||
{
|
{
|
||||||
m_key_command = BIT(data,1);
|
m_key_command = BIT(data,1);
|
||||||
if (BIT(data,7)) {
|
if (BIT(data,7)) {
|
||||||
membank("bank1")->set_base(memregion("maincpu")->base());
|
m_bank1->set_base(m_region_maincpu->base());
|
||||||
} else {
|
} else {
|
||||||
membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
|
m_bank1->set_base(m_ram->pointer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,17 +380,17 @@ static UINT8 row_number(UINT8 code) {
|
|||||||
|
|
||||||
TIMER_DEVICE_CALLBACK_MEMBER(nanos_state::keyboard_callback)
|
TIMER_DEVICE_CALLBACK_MEMBER(nanos_state::keyboard_callback)
|
||||||
{
|
{
|
||||||
static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6" };
|
ioport_port *io_ports[] = { m_line0, m_line1, m_line2, m_line3, m_line4, m_line5, m_line6 };
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
UINT8 code;
|
UINT8 code;
|
||||||
UINT8 key_code = 0;
|
UINT8 key_code = 0;
|
||||||
UINT8 shift = machine().root_device().ioport("LINEC")->read() & 0x02 ? 1 : 0;
|
UINT8 shift = m_linec->read() & 0x02 ? 1 : 0;
|
||||||
UINT8 ctrl = machine().root_device().ioport("LINEC")->read() & 0x01 ? 1 : 0;
|
UINT8 ctrl = m_linec->read() & 0x01 ? 1 : 0;
|
||||||
m_key_pressed = 0xff;
|
m_key_pressed = 0xff;
|
||||||
for(i = 0; i < 7; i++)
|
for(i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
code = machine().root_device().ioport(keynames[i])->read();
|
code = io_ports[i]->read();
|
||||||
if (code != 0)
|
if (code != 0)
|
||||||
{
|
{
|
||||||
if (i==0 && shift==0) {
|
if (i==0 && shift==0) {
|
||||||
@ -439,14 +467,14 @@ void nanos_state::machine_start()
|
|||||||
|
|
||||||
void nanos_state::machine_reset()
|
void nanos_state::machine_reset()
|
||||||
{
|
{
|
||||||
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
|
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||||
|
|
||||||
space.install_write_bank(0x0000, 0x0fff, "bank3");
|
space.install_write_bank(0x0000, 0x0fff, "bank3");
|
||||||
space.install_write_bank(0x1000, 0xffff, "bank2");
|
space.install_write_bank(0x1000, 0xffff, "bank2");
|
||||||
|
|
||||||
membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base());
|
m_bank1->set_base(m_region_maincpu->base());
|
||||||
membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x1000);
|
m_bank2->set_base(m_ram->pointer() + 0x1000);
|
||||||
membank("bank3")->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
|
m_bank3->set_base(m_ram->pointer());
|
||||||
|
|
||||||
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(false);
|
machine().device<floppy_connector>("upd765:0")->get_device()->mon_w(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user