diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2013-04-18 08:44:08 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2013-04-18 08:44:08 +0000 |
commit | f30a3117806c7190217a6a1bccf344ff730a6bb7 (patch) | |
tree | 240d47327de16ed57117be50c49d42c70265dc7c | |
parent | eb0b5a552e90e20fd042ee694078a8f76e1513ef (diff) |
moving some static functions in driver state for MESS drivers plus some other modernization (nw)
153 files changed, 3978 insertions, 3974 deletions
diff --git a/src/emu/video/dl1416.c b/src/emu/video/dl1416.c index 32bf1f5a3c2..3e05a32aef3 100644 --- a/src/emu/video/dl1416.c +++ b/src/emu/video/dl1416.c @@ -55,7 +55,7 @@ #define CURSOR_OFF (0) /* character set DL1416T */ -static const int dl1416t_segments[128] = { +static const UINT16 dl1416t_segments[128] = { SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, SEG_UNDEF, /* undefined */ @@ -100,6 +100,7 @@ struct dl1416_state int write_enable; int chip_enable; int cursor_enable; + devcb_resolved_write16 update_func; UINT16 digit_ram[4]; // holds the digit code for each position UINT8 cursor_state[4]; // holds the cursor state for each position, 0=off, 1=on @@ -126,7 +127,7 @@ INLINE dl1416_state *get_safe_token(device_t *device) static DEVICE_START( dl1416 ) { dl1416_state *dl1416 = get_safe_token(device); - + /* register for state saving */ state_save_register_item(device->machine(), "dl1416", device->tag(), 0, dl1416->chip_enable); state_save_register_item(device->machine(), "dl1416", device->tag(), 0, dl1416->cursor_enable); @@ -137,7 +138,8 @@ static DEVICE_START( dl1416 ) static DEVICE_RESET( dl1416 ) { - int i, pattern; + int i; + UINT16 pattern; dl1416_state *chip = get_safe_token(device); const dl1416_interface *intf = (const dl1416_interface *)device->static_config(); /* disable all lines */ @@ -145,6 +147,8 @@ static DEVICE_RESET( dl1416 ) chip->write_enable = FALSE; chip->cursor_enable = FALSE; + chip->update_func.resolve(intf->update, *device); + /* randomize digit and cursor memory */ for (i = 0; i < 4; i++) { @@ -164,8 +168,8 @@ static DEVICE_RESET( dl1416 ) pattern = SEG_BLANK; /* Call update function */ - if (intf->update) - intf->update(device, i, pattern); + if (!chip->update_func.isnull()) + chip->update_func(i, pattern); } } @@ -199,7 +203,6 @@ WRITE_LINE_DEVICE_HANDLER( dl1416_cu_w ) WRITE8_DEVICE_HANDLER( dl1416_data_w ) { dl1416_state *chip = get_safe_token(device); - const dl1416_interface *intf = (const dl1416_interface *)device->static_config(); offset &= 0x03; /* A0-A1 */ data &= 0x7f; /* D0-D6 */ @@ -235,8 +238,8 @@ WRITE8_DEVICE_HANDLER( dl1416_data_w ) pattern = SEG_BLANK; /* Call update function */ - if (intf->update) - intf->update(device, offset, pattern); + if (!chip->update_func.isnull()) + chip->update_func(offset, pattern); } } else { @@ -263,8 +266,8 @@ WRITE8_DEVICE_HANDLER( dl1416_data_w ) pattern = SEG_BLANK; /* Call update function */ - if (intf->update) - intf->update(device, i, pattern); + if (!chip->update_func.isnull()) + chip->update_func(i, pattern); } } } @@ -287,8 +290,8 @@ WRITE8_DEVICE_HANDLER( dl1416_data_w ) pattern = SEG_BLANK; /* Call update function */ - if (intf->update) - intf->update(device, offset, pattern); + if (!chip->update_func.isnull()) + chip->update_func(offset, pattern); } } } diff --git a/src/emu/video/dl1416.h b/src/emu/video/dl1416.h index e1ecf8f000a..d59c6ab5c70 100644 --- a/src/emu/video/dl1416.h +++ b/src/emu/video/dl1416.h @@ -20,11 +20,9 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef void (*dl1416_update_func)(device_t *device, int digit, int data); - struct dl1416_interface { - dl1416_update_func update; + devcb_write16 update; }; diff --git a/src/mess/drivers/aim65.c b/src/mess/drivers/aim65.c index 6225da8fcb2..539224b1344 100644 --- a/src/mess/drivers/aim65.c +++ b/src/mess/drivers/aim65.c @@ -228,27 +228,27 @@ static const cassette_interface aim65_2_cassette_interface = const dl1416_interface aim65_ds1_intf = { - aim65_update_ds1 + DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds1) }; const dl1416_interface aim65_ds2_intf = { - aim65_update_ds2 + DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds2) }; const dl1416_interface aim65_ds3_intf = { - aim65_update_ds3 + DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds3) }; const dl1416_interface aim65_ds4_intf = { - aim65_update_ds4 + DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds4) }; const dl1416_interface aim65_ds5_intf = { - aim65_update_ds5 + DEVCB_DRIVER_MEMBER16(aim65_state, aim65_update_ds5) }; /*************************************************************************** diff --git a/src/mess/drivers/apple2gs.c b/src/mess/drivers/apple2gs.c index 5774191efd2..cb6ba3176d7 100644 --- a/src/mess/drivers/apple2gs.c +++ b/src/mess/drivers/apple2gs.c @@ -266,11 +266,11 @@ WRITE8_MEMBER(apple2gs_state::a2bus_irq_w) { if (data) { - apple2gs_add_irq(machine(), IRQ_SLOT); + apple2gs_add_irq(IRQ_SLOT); } else { - apple2gs_remove_irq(machine(), IRQ_SLOT); + apple2gs_remove_irq(IRQ_SLOT); } } diff --git a/src/mess/drivers/busicom.c b/src/mess/drivers/busicom.c index 3e97d142934..0ceceacd106 100644 --- a/src/mess/drivers/busicom.c +++ b/src/mess/drivers/busicom.c @@ -11,7 +11,7 @@ #include "includes/busicom.h" -static UINT8 get_bit_selected(UINT32 val,int num) +UINT8 busicom_state::get_bit_selected(UINT32 val,int num) { int i; for(i=0;i<num;i++) { diff --git a/src/mess/drivers/enterp.c b/src/mess/drivers/enterp.c index 6b02ac77c5d..eaef84d826c 100644 --- a/src/mess/drivers/enterp.c +++ b/src/mess/drivers/enterp.c @@ -31,9 +31,8 @@ MEMORY / I/O ***************************************************************************/ -static void enterprise_update_memory_page(address_space &space, offs_t page, int index) +void ep_state::enterprise_update_memory_page(address_space &space, offs_t page, int index) { - ep_state *state = space.machine().driver_data<ep_state>(); int start = (page - 1) * 0x4000; int end = (page - 1) * 0x4000 + 0x3fff; char page_num[10]; @@ -47,7 +46,7 @@ static void enterprise_update_memory_page(address_space &space, offs_t page, int case 0x03: space.install_read_bank(start, end, page_num); space.nop_write(start, end); - state->membank(page_num)->set_base(state->memregion("exos")->base() + (index * 0x4000)); + membank(page_num)->set_base(memregion("exos")->base() + (index * 0x4000)); break; case 0x04: @@ -56,14 +55,14 @@ static void enterprise_update_memory_page(address_space &space, offs_t page, int case 0x07: space.install_read_bank(start, end, page_num); space.nop_write(start, end); - state->membank(page_num)->set_base(state->memregion("cartridges")->base() + ((index - 0x04) * 0x4000)); + membank(page_num)->set_base(memregion("cartridges")->base() + ((index - 0x04) * 0x4000)); break; case 0x20: case 0x21: space.install_read_bank(start, end, page_num); space.nop_write(start, end); - state->membank(page_num)->set_base(state->memregion("exdos")->base() + ((index - 0x20) * 0x4000)); + membank(page_num)->set_base(memregion("exdos")->base() + ((index - 0x20) * 0x4000)); break; case 0xf8: @@ -74,7 +73,7 @@ static void enterprise_update_memory_page(address_space &space, offs_t page, int if (space.machine().device<ram_device>(RAM_TAG)->size() == 128*1024) { space.install_readwrite_bank(start, end, page_num); - state->membank(page_num)->set_base(space.machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xf4) * 0x4000); + membank(page_num)->set_base(space.machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xf4) * 0x4000); } else { @@ -88,7 +87,7 @@ static void enterprise_update_memory_page(address_space &space, offs_t page, int case 0xff: /* basic 64k ram */ space.install_readwrite_bank(start, end, page_num); - state->membank(page_num)->set_base(space.machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xfc) * 0x4000); + membank(page_num)->set_base(space.machine().device<ram_device>(RAM_TAG)->pointer() + (index - 0xfc) * 0x4000); break; default: diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c index a92d790dd3c..ce7dc7b4011 100644 --- a/src/mess/drivers/fm7.c +++ b/src/mess/drivers/fm7.c @@ -52,11 +52,6 @@ #include "includes/fm7.h" - -static void fm7_mmr_refresh(address_space&); - - - /* key scancode conversion table * The FM-7 expects different scancodes when shift,ctrl or graph is held, or * when kana is active. @@ -165,22 +160,20 @@ static const UINT16 fm7_key_list[0x60][7] = }; -static void main_irq_set_flag(running_machine &machine, UINT8 flag) +void fm7_state::main_irq_set_flag(UINT8 flag) { - fm7_state *state = machine.driver_data<fm7_state>(); - state->m_irq_flags |= flag; + m_irq_flags |= flag; - if(state->m_irq_flags != 0) - state->m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); + if(m_irq_flags != 0) + m_maincpu->set_input_line(M6809_IRQ_LINE,ASSERT_LINE); } -static void main_irq_clear_flag(running_machine &machine, UINT8 flag) +void fm7_state::main_irq_clear_flag(UINT8 flag) { - fm7_state *state = machine.driver_data<fm7_state>(); - state->m_irq_flags &= ~flag; + m_irq_flags &= ~flag; - if(state->m_irq_flags == 0) - state->m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); + if(m_irq_flags == 0) + m_maincpu->set_input_line(M6809_IRQ_LINE,CLEAR_LINE); } @@ -226,9 +219,9 @@ READ8_MEMBER(fm7_state::fm7_irq_cause_r) // Keyboard IRQ flag is cleared when the scancode is read from // either keyboard data port (main CPU 0xfd01 or sub CPU 0xd401) if(m_irq_flags & 0x04) - main_irq_clear_flag(machine(),IRQ_FLAG_TIMER); + main_irq_clear_flag(IRQ_FLAG_TIMER); if(m_irq_flags & 0x02) - main_irq_clear_flag(machine(),IRQ_FLAG_PRINTER); + main_irq_clear_flag(IRQ_FLAG_PRINTER); logerror("IRQ flags read: 0x%02x\n",ret); return ret; @@ -506,7 +499,7 @@ READ8_MEMBER(fm7_state::fm7_keyboard_r) ret |= 0x01; // 1 = 2MHz, 0 = 1.2MHz return ret; case 1: - main_irq_clear_flag(machine(),IRQ_FLAG_KEY); + main_irq_clear_flag(IRQ_FLAG_KEY); return m_current_scancode & 0xff; default: return 0x00; @@ -522,7 +515,7 @@ READ8_MEMBER(fm7_state::fm7_sub_keyboard_r) ret = (m_current_scancode >> 1) & 0x80; return ret; case 1: - main_irq_clear_flag(machine(),IRQ_FLAG_KEY); + main_irq_clear_flag(IRQ_FLAG_KEY); return m_current_scancode & 0xff; default: return 0x00; @@ -818,60 +811,59 @@ READ8_MEMBER(fm7_state::fm77av_boot_mode_r) * 0xfd0e - data register * AY I/O ports are not connected to anything. */ -static void fm7_update_psg(running_machine &machine) +void fm7_state::fm7_update_psg() { - fm7_state *state = machine.driver_data<fm7_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); - if(state->m_type == SYS_FM7) + if(m_type == SYS_FM7) { - switch(state->m_psg_regsel) + switch(m_psg_regsel) { case 0x00: // High impedance break; case 0x01: // Data read - state->m_psg_data = ay8910_r(space.machine().device("psg"),space, 0); + m_psg_data = ay8910_r(space.machine().device("psg"),space, 0); break; case 0x02: // Data write - ay8910_data_w(space.machine().device("psg"),space, 0,state->m_psg_data); + ay8910_data_w(space.machine().device("psg"),space, 0,m_psg_data); break; case 0x03: // Address latch - ay8910_address_w(space.machine().device("psg"),space, 0,state->m_psg_data); + ay8910_address_w(space.machine().device("psg"),space, 0,m_psg_data); break; } } else { // FM-77AV and later use a YM2203 - switch(state->m_psg_regsel) + switch(m_psg_regsel) { case 0x00: // High impedance break; case 0x01: // Data read - state->m_psg_data = ym2203_r(space.machine().device("ym"),space, 1); + m_psg_data = ym2203_r(space.machine().device("ym"),space, 1); break; case 0x02: // Data write - ym2203_w(space.machine().device("ym"),space, 1,state->m_psg_data); - logerror("YM: data write 0x%02x\n",state->m_psg_data); + ym2203_w(space.machine().device("ym"),space, 1,m_psg_data); + logerror("YM: data write 0x%02x\n",m_psg_data); break; case 0x03: // Address latch - ym2203_w(space.machine().device("ym"),space, 0,state->m_psg_data); - logerror("YM: address latch 0x%02x\n",state->m_psg_data); + ym2203_w(space.machine().device("ym"),space, 0,m_psg_data); + logerror("YM: address latch 0x%02x\n",m_psg_data); break; case 0x04: // Status register - state->m_psg_data = ym2203_r(space.machine().device("ym"),space, 0); + m_psg_data = ym2203_r(space.machine().device("ym"),space, 0); break; case 0x09: // Joystick port read - state->m_psg_data = state->ioport("joy1")->read(); + m_psg_data = ioport("joy1")->read(); break; } } @@ -885,25 +877,25 @@ READ8_MEMBER(fm7_state::fm7_psg_select_r) WRITE8_MEMBER(fm7_state::fm7_psg_select_w) { m_psg_regsel = data & 0x03; - fm7_update_psg(machine()); + fm7_update_psg(); } WRITE8_MEMBER(fm7_state::fm77av_ym_select_w) { m_psg_regsel = data & 0x0f; - fm7_update_psg(machine()); + fm7_update_psg(); } READ8_MEMBER(fm7_state::fm7_psg_data_r) { -// fm7_update_psg(machine()); +// fm7_update_psg(); return m_psg_data; } WRITE8_MEMBER(fm7_state::fm7_psg_data_w) { m_psg_data = data; -// fm7_update_psg(machine()); +// fm7_update_psg(); } WRITE8_MEMBER(fm7_state::fm77av_bootram_w) @@ -982,10 +974,10 @@ READ8_MEMBER(fm7_state::fm7_mmr_r) return 0xff; } -static void fm7_update_bank(address_space & space, int bank, UINT8 physical) +void fm7_state::fm7_update_bank(address_space & space, int bank, UINT8 physical) { fm7_state *state = space.machine().driver_data<fm7_state>(); - UINT8* RAM = state->memregion("maincpu")->base(); + UINT8* RAM = memregion("maincpu")->base(); UINT16 size = 0xfff; char bank_name[10]; @@ -1035,7 +1027,7 @@ static void fm7_update_bank(address_space & space, int bank, UINT8 physical) space.install_readwrite_handler(bank*0x1000,(bank*0x1000)+size,read8_delegate(FUNC(fm7_state::fm7_vramB_r),state),write8_delegate(FUNC(fm7_state::fm7_vramB_w),state)); break; } -// state->membank(bank+1)->set_base(RAM+(physical<<12)-0x10000); +// membank(bank+1)->set_base(RAM+(physical<<12)-0x10000); return; } if(physical == 0x1c) @@ -1050,52 +1042,51 @@ static void fm7_update_bank(address_space & space, int bank, UINT8 physical) } if(physical == 0x35) { - if(state->m_init_rom_en && (state->m_type == SYS_FM11 || state->m_type == SYS_FM16)) + if(m_init_rom_en && (m_type == SYS_FM11 || m_type == SYS_FM16)) { - RAM = state->memregion("init")->base(); + RAM = memregion("init")->base(); space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); space.nop_write(bank*0x1000,(bank*0x1000)+size); - state->membank(bank_name)->set_base(RAM+(physical<<12)-0x35000); + membank(bank_name)->set_base(RAM+(physical<<12)-0x35000); return; } } if(physical == 0x36 || physical == 0x37) { - if(state->m_init_rom_en && (state->m_type != SYS_FM11 && state->m_type != SYS_FM16)) + if(m_init_rom_en && (m_type != SYS_FM11 && m_type != SYS_FM16)) { - RAM = state->memregion("init")->base(); + RAM = memregion("init")->base(); space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); space.nop_write(bank*0x1000,(bank*0x1000)+size); - state->membank(bank_name)->set_base(RAM+(physical<<12)-0x36000); + membank(bank_name)->set_base(RAM+(physical<<12)-0x36000); return; } } if(physical > 0x37 && physical <= 0x3f) { - if(state->m_basic_rom_en && (state->m_type != SYS_FM11 && state->m_type != SYS_FM16)) + if(m_basic_rom_en && (m_type != SYS_FM11 && m_type != SYS_FM16)) { - RAM = state->memregion("fbasic")->base(); + RAM = memregion("fbasic")->base(); space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); space.nop_write(bank*0x1000,(bank*0x1000)+size); - state->membank(bank_name)->set_base(RAM+(physical<<12)-0x38000); + membank(bank_name)->set_base(RAM+(physical<<12)-0x38000); return; } } space.install_readwrite_bank(bank*0x1000,(bank*0x1000)+size,bank_name); - state->membank(bank_name)->set_base(RAM+(physical<<12)); + membank(bank_name)->set_base(RAM+(physical<<12)); } -static void fm7_mmr_refresh(address_space& space) +void fm7_state::fm7_mmr_refresh(address_space& space) { - fm7_state *state = space.machine().driver_data<fm7_state>(); int x; UINT16 window_addr; - UINT8* RAM = state->memregion("maincpu")->base(); + UINT8* RAM = memregion("maincpu")->base(); - if(state->m_mmr.enabled) + if(m_mmr.enabled) { for(x=0;x<16;x++) - fm7_update_bank(space,x,state->m_mmr.bank_addr[state->m_mmr.segment][x]); + fm7_update_bank(space,x,m_mmr.bank_addr[m_mmr.segment][x]); } else { @@ -1104,16 +1095,16 @@ static void fm7_mmr_refresh(address_space& space) fm7_update_bank(space,x,0x30+x); } - if(state->m_mmr.mode & 0x40) + if(m_mmr.mode & 0x40) { // Handle window offset - 0x7c00-0x7fff will show the area of extended // memory (0x00000-0x0ffff) defined by the window address register // 0x00 = 0x07c00, 0x04 = 0x08000 ... 0xff = 0x07400. - window_addr = ((state->m_mmr.window_offset << 8) + 0x7c00) & 0xffff; + window_addr = ((m_mmr.window_offset << 8) + 0x7c00) & 0xffff; // if(window_addr < 0xfc00) { space.install_readwrite_bank(0x7c00,0x7fff,"bank24"); - state->membank("bank24")->set_base(RAM+window_addr); + membank("bank24")->set_base(RAM+window_addr); } } } @@ -1205,7 +1196,7 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm7_timer_irq) { if(m_irq_mask & IRQ_FLAG_TIMER) { - main_irq_set_flag(machine(),IRQ_FLAG_TIMER); + main_irq_set_flag(IRQ_FLAG_TIMER); } } @@ -1218,69 +1209,67 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm7_subtimer_irq) // When a key is pressed or released (in scan mode only), an IRQ is generated on the main CPU, // or an FIRQ on the sub CPU, if masked. Both CPUs have ports to read keyboard data. // Scancodes are 9 bits in FM-7 mode, 8 bits in scan mode. -static void key_press(running_machine &machine, UINT16 scancode) +void fm7_state::key_press(UINT16 scancode) { - fm7_state *state = machine.driver_data<fm7_state>(); - state->m_current_scancode = scancode; + m_current_scancode = scancode; if(scancode == 0) return; - if(state->m_irq_mask & IRQ_FLAG_KEY) + if(m_irq_mask & IRQ_FLAG_KEY) { - main_irq_set_flag(machine,IRQ_FLAG_KEY); + main_irq_set_flag(IRQ_FLAG_KEY); } else { - state->m_sub->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); + m_sub->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); } logerror("KEY: sent scancode 0x%03x\n",scancode); } -static void fm7_keyboard_poll_scan(running_machine &machine) +void fm7_state::fm7_keyboard_poll_scan() { - fm7_state *state = machine.driver_data<fm7_state>(); static const char *const portnames[3] = { "key1","key2","key3" }; int bit = 0; int x,y; UINT32 keys; - UINT32 modifiers = machine.root_device().ioport("key_modifiers")->read(); + UINT32 modifiers = machine().root_device().ioport("key_modifiers")->read(); static const UINT16 modscancodes[6] = { 0x52, 0x53, 0x54, 0x55, 0x56, 0x5a }; for(x=0;x<3;x++) { - keys = machine.root_device().ioport(portnames[x])->read(); + keys = machine().root_device().ioport(portnames[x])->read(); for(y=0;y<32;y++) // loop through each bit in the port { - if((keys & (1<<y)) != 0 && (state->m_key_data[x] & (1<<y)) == 0) + if((keys & (1<<y)) != 0 && (m_key_data[x] & (1<<y)) == 0) { - key_press(machine,fm7_key_list[bit][6]); // key press + key_press(fm7_key_list[bit][6]); // key press } - if((keys & (1<<y)) == 0 && (state->m_key_data[x] & (1<<y)) != 0) + if((keys & (1<<y)) == 0 && (m_key_data[x] & (1<<y)) != 0) { - key_press(machine,fm7_key_list[bit][6] | 0x80); // key release + key_press(fm7_key_list[bit][6] | 0x80); // key release } bit++; } - state->m_key_data[x] = keys; + m_key_data[x] = keys; } // check modifier keys bit = 0; for(y=0;x<7;x++) { - if((modifiers & (1<<y)) != 0 && (state->m_mod_data & (1<<y)) == 0) + if((modifiers & (1<<y)) != 0 && (m_mod_data & (1<<y)) == 0) { - key_press(machine,modscancodes[bit]); // key press + key_press(modscancodes[bit]); // key press } - if((modifiers & (1<<y)) == 0 && (state->m_mod_data & (1<<y)) != 0) + if((modifiers & (1<<y)) == 0 && (m_mod_data & (1<<y)) != 0) { - key_press(machine,modscancodes[bit] | 0x80); // key release + key_press(modscancodes[bit] | 0x80); // key release } bit++; } - state->m_mod_data = modifiers; + m_mod_data = modifiers; } TIMER_CALLBACK_MEMBER(fm7_state::fm7_keyboard_poll) @@ -1303,7 +1292,7 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm7_keyboard_poll) if(m_key_scan_mode == KEY_MODE_SCAN) { // handle scancode mode - fm7_keyboard_poll_scan(machine()); + fm7_keyboard_poll_scan(); return; } @@ -1327,7 +1316,7 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm7_keyboard_poll) { if((keys & (1<<y)) != 0 && (m_key_data[x] & (1<<y)) == 0) { - key_press(machine(),fm7_key_list[bit][mod]); // key press + key_press(fm7_key_list[bit][mod]); // key press } bit++; } @@ -1354,13 +1343,13 @@ WRITE_LINE_MEMBER(fm7_state::fm77av_fmirq) if(state == 1) { // cannot be masked - main_irq_set_flag(machine(),IRQ_FLAG_OTHER); + main_irq_set_flag(IRQ_FLAG_OTHER); m_fm77av_ym_irq = 1; logerror("YM: IRQ on\n"); } else { - main_irq_clear_flag(machine(),IRQ_FLAG_OTHER); + main_irq_clear_flag(IRQ_FLAG_OTHER); m_fm77av_ym_irq = 0; logerror("YM: IRQ off\n"); } diff --git a/src/mess/drivers/fmtowns.c b/src/mess/drivers/fmtowns.c index b22543bab3a..f6c59607564 100644 --- a/src/mess/drivers/fmtowns.c +++ b/src/mess/drivers/fmtowns.c @@ -194,17 +194,17 @@ enum -INLINE UINT8 byte_to_bcd(UINT8 val) +inline UINT8 towns_state::byte_to_bcd(UINT8 val) { return ((val / 10) << 4) | (val % 10); } -INLINE UINT8 bcd_to_byte(UINT8 val) +inline UINT8 towns_state::bcd_to_byte(UINT8 val) { return (((val & 0xf0) >> 4) * 10) + (val & 0x0f); } -INLINE UINT32 msf_to_lbafm(UINT32 val) // because the CDROM core doesn't provide this +inline UINT32 towns_state::msf_to_lbafm(UINT32 val) // because the CDROM core doesn't provide this { UINT8 m,s,f; f = bcd_to_byte(val & 0x0000ff); @@ -611,18 +611,16 @@ WRITE8_MEMBER(towns_state::towns_floppy_w) } } -static UINT16 towns_fdc_dma_r(running_machine &machine) +READ16_MEMBER(towns_state::towns_fdc_dma_r) { - towns_state* state = machine.driver_data<towns_state>(); - device_t* fdc = state->m_fdc; - return wd17xx_data_r(fdc,state->generic_space(), 0); + device_t* fdc = m_fdc; + return wd17xx_data_r(fdc,generic_space(), 0); } -static void towns_fdc_dma_w(running_machine &machine, UINT16 data) +WRITE16_MEMBER(towns_state::towns_fdc_dma_w) { - towns_state* state = machine.driver_data<towns_state>(); - device_t* fdc = state->m_fdc; - wd17xx_data_w(fdc,state->generic_space(), 0,data); + device_t* fdc = m_fdc; + wd17xx_data_w(fdc,generic_space(), 0,data); } /* @@ -1311,52 +1309,51 @@ READ8_MEMBER( towns_state::towns_video_404_r ) * bit 4 - DMA transfer mode * */ -static void towns_cdrom_set_irq(running_machine &machine,int line,int state) +void towns_state::towns_cdrom_set_irq(int line,int state) { - towns_state* tstate = machine.driver_data<towns_state>(); switch(line) { case TOWNS_CD_IRQ_MPU: if(state != 0) { - if(tstate->m_towns_cd.command & 0x40) + if(m_towns_cd.command & 0x40) { -// if(tstate->m_towns_cd.mpu_irq_enable) +// if(m_towns_cd.mpu_irq_enable) { - tstate->m_towns_cd.status |= 0x80; - pic8259_ir1_w(tstate->m_pic_slave, 1); + m_towns_cd.status |= 0x80; + pic8259_ir1_w(m_pic_slave, 1); if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set high\n"); } } else - tstate->m_towns_cd.status |= 0x80; + m_towns_cd.status |= 0x80; } else { - tstate->m_towns_cd.status &= ~0x80; - pic8259_ir1_w(tstate->m_pic_slave, 0); + m_towns_cd.status &= ~0x80; + pic8259_ir1_w(m_pic_slave, 0); if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM) set low\n"); } break; case TOWNS_CD_IRQ_DMA: if(state != 0) { - if(tstate->m_towns_cd.command & 0x40) + if(m_towns_cd.command & 0x40) { -// if(tstate->m_towns_cd.dma_irq_enable) +// if(m_towns_cd.dma_irq_enable) { - tstate->m_towns_cd.status |= 0x40; - pic8259_ir1_w(tstate->m_pic_slave, 1); + m_towns_cd.status |= 0x40; + pic8259_ir1_w(m_pic_slave, 1); if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set high\n"); } } else - tstate->m_towns_cd.status |= 0x40; + m_towns_cd.status |= 0x40; } else { - tstate->m_towns_cd.status &= ~0x40; - pic8259_ir1_w(tstate->m_pic_slave, 0); + m_towns_cd.status &= ~0x40; + pic8259_ir1_w(m_pic_slave, 0); if(IRQ_LOG) logerror("PIC: IRQ9 (CD-ROM DMA) set low\n"); } break; @@ -1368,7 +1365,7 @@ void towns_state::towns_cd_status_ready() m_towns_cd.status |= 0x02; // status read request m_towns_cd.status |= 0x01; // ready m_towns_cd.cmd_status_ptr = 0; - towns_cdrom_set_irq((running_machine&)machine(),TOWNS_CD_IRQ_MPU,1); + towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,1); } void towns_state::towns_cd_set_status(UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3) @@ -1381,11 +1378,10 @@ void towns_state::towns_cd_set_status(UINT8 st0, UINT8 st1, UINT8 st2, UINT8 st3 m_towns_status_timer->adjust(attotime::from_msec(1),0,attotime::never); } -static UINT8 towns_cd_get_track(running_machine &machine) +UINT8 towns_state::towns_cd_get_track() { - towns_state* state = machine.driver_data<towns_state>(); - cdrom_image_device* cdrom = state->m_cdrom; - device_t* cdda = state->m_cdda; + cdrom_image_device* cdrom = m_cdrom; + device_t* cdda = m_cdda; UINT32 lba = cdda_get_audio_lba(cdda); UINT8 track; @@ -1430,7 +1426,7 @@ TIMER_CALLBACK_MEMBER(towns_state::towns_cdrom_read_byte) { m_towns_cd.extra_status = 0; towns_cd_set_status(0x06,0x00,0x00,0x00); - towns_cdrom_set_irq(device->machine(),TOWNS_CD_IRQ_DMA,1); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); m_towns_cd.buffer_ptr = -1; m_towns_cd.status |= 0x01; // ready } @@ -1438,7 +1434,7 @@ TIMER_CALLBACK_MEMBER(towns_state::towns_cdrom_read_byte) { m_towns_cd.extra_status = 0; towns_cd_set_status(0x22,0x00,0x00,0x00); - towns_cdrom_set_irq(device->machine(),TOWNS_CD_IRQ_DMA,1); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); m_towns_cd.read_timer->adjust(attotime::from_hz(300000),1); m_towns_cd.buffer_ptr = -1; @@ -1464,7 +1460,7 @@ UINT8 towns_state::towns_cdrom_read_byte_software() { m_towns_cd.extra_status = 0; towns_cd_set_status(0x06,0x00,0x00,0x00); - towns_cdrom_set_irq(machine(),TOWNS_CD_IRQ_DMA,1); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); m_towns_cd.buffer_ptr = -1; m_towns_cd.status |= 0x01; // ready } @@ -1473,7 +1469,7 @@ UINT8 towns_state::towns_cdrom_read_byte_software() cdrom_read_data(m_cdrom->get_cdrom_file(),++m_towns_cd.lba_current,m_towns_cd.buffer,CD_TRACK_MODE1); m_towns_cd.extra_status = 0; towns_cd_set_status(0x21,0x00,0x00,0x00); - towns_cdrom_set_irq(machine(),TOWNS_CD_IRQ_DMA,1); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,1); m_towns_cd.status &= ~0x10; m_towns_cd.status |= 0x20; m_towns_cd.buffer_ptr = -1; @@ -1690,12 +1686,11 @@ void towns_state::towns_cdrom_execute_command(cdrom_image_device* device) } } -static UINT16 towns_cdrom_dma_r(running_machine &machine) +READ16_MEMBER(towns_state::towns_cdrom_dma_r) { - towns_state* state = machine.driver_data<towns_state>(); - if(state->m_towns_cd.buffer_ptr >= 2048) + if(m_towns_cd.buffer_ptr >= 2048) return 0x00; - return state->m_towns_cd.buffer[state->m_towns_cd.buffer_ptr++]; + return m_towns_cd.buffer[m_towns_cd.buffer_ptr++]; } READ8_MEMBER(towns_state::towns_cdrom_r) @@ -1793,7 +1788,7 @@ READ8_MEMBER(towns_state::towns_cdrom_r) { case 1: // st2 = track number towns_cd_set_status(0x18, - 0x00,towns_cd_get_track(space.machine()),0x00); + 0x00,towns_cd_get_track(),0x00); m_towns_cd.extra_status++; break; case 2: // st0/1/2 = MSF from beginning of current track @@ -1859,9 +1854,9 @@ WRITE8_MEMBER(towns_state::towns_cdrom_w) { case 0x00: // status if(data & 0x80) - towns_cdrom_set_irq(space.machine(),TOWNS_CD_IRQ_MPU,0); + towns_cdrom_set_irq(TOWNS_CD_IRQ_MPU,0); if(data & 0x40) - towns_cdrom_set_irq(space.machine(),TOWNS_CD_IRQ_DMA,0); + towns_cdrom_set_irq(TOWNS_CD_IRQ_DMA,0); if(data & 0x04) logerror("CD: sub MPU reset\n"); m_towns_cd.mpu_irq_enable = data & 0x02; @@ -1933,36 +1928,34 @@ WRITE8_MEMBER(towns_state::towns_rtc_select_w) } } -static void rtc_hour(running_machine &machine) +void towns_state::rtc_hour() { - towns_state* state = machine.driver_data<towns_state>(); - state->m_towns_rtc_reg[4]++; - if(state->m_towns_rtc_reg[4] > 4 && state->m_towns_rtc_reg[5] == 2) + m_towns_rtc_reg[4]++; + if(m_towns_rtc_reg[4] > 4 && m_towns_rtc_reg[5] == 2) { - state->m_towns_rtc_reg[4] = 0; - state->m_towns_rtc_reg[5] = 0; + m_towns_rtc_reg[4] = 0; + m_towns_rtc_reg[5] = 0; } - else if(state->m_towns_rtc_reg[4] > 9) + else if(m_towns_rtc_reg[4] > 9) { - state->m_towns_rtc_reg[4] = 0; - state->m_towns_rtc_reg[5]++; + m_towns_rtc_reg[4] = 0; + m_towns_rtc_reg[5]++; } } -static void rtc_minute(running_machine &machine) +void towns_state::rtc_minute() { - towns_state* state = machine.driver_data<towns_state>(); - state->m_towns_rtc_reg[2]++; - if(state->m_towns_rtc_reg[2] > 9) + m_towns_rtc_reg[2]++; + if(m_towns_rtc_reg[2] > 9) { - state->m_towns_rtc_reg[2] = 0; - state->m_towns_rtc_reg[3]++; - if(state->m_towns_rtc_reg[3] > 5) + m_towns_rtc_reg[2] = 0; + m_towns_rtc_reg[3]++; + if(m_towns_rtc_reg[3] > 5) { - state->m_towns_rtc_reg[3] = 0; - rtc_hour(machine); + m_towns_rtc_reg[3] = 0; + rtc_hour(); } } } @@ -1978,22 +1971,20 @@ void towns_state::rtc_second() if(m_towns_rtc_reg[1] > 5) { m_towns_rtc_reg[1] = 0; - rtc_minute(machine()); + rtc_minute(); } } } // SCSI controller - I/O ports 0xc30 and 0xc32 -static UINT16 towns_scsi_dma_r(running_machine &machine) +READ16_MEMBER(towns_state::towns_scsi_dma_r) { - towns_state* state = machine.driver_data<towns_state>(); - return state->m_scsi->fmscsi_data_r(); + return m_scsi->fmscsi_data_r(); } -static void towns_scsi_dma_w(running_machine &machine, UINT16 data) +WRITE16_MEMBER(towns_state::towns_scsi_dma_w) { - towns_state* state = machine.driver_data<towns_state>(); - state->m_scsi->fmscsi_data_w(data & 0xff); + m_scsi->fmscsi_data_w(data & 0xff); } WRITE_LINE_MEMBER(towns_state::towns_scsi_irq) @@ -2755,8 +2746,8 @@ static const upd71071_intf towns_dma_config = 4000000, DEVCB_NULL, DEVCB_NULL, - { towns_fdc_dma_r, towns_scsi_dma_r, 0, towns_cdrom_dma_r }, - { towns_fdc_dma_w, towns_scsi_dma_w, 0, 0 }, + { DEVCB_DRIVER_MEMBER16(towns_state, towns_fdc_dma_r), DEVCB_DRIVER_MEMBER16(towns_state,towns_scsi_dma_r), DEVCB_NULL, DEVCB_DRIVER_MEMBER16(towns_state,towns_cdrom_dma_r) }, + { DEVCB_DRIVER_MEMBER16(towns_state, towns_fdc_dma_w), DEVCB_DRIVER_MEMBER16(towns_state,towns_scsi_dma_w), DEVCB_NULL, DEVCB_NULL }, { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL } }; diff --git a/src/mess/drivers/hec2hrp.c b/src/mess/drivers/hec2hrp.c index 491ad26fc83..a1dd7e31b89 100644 --- a/src/mess/drivers/hec2hrp.c +++ b/src/mess/drivers/hec2hrp.c @@ -290,13 +290,13 @@ INPUT_PORTS_END MACHINE_START_MEMBER(hec2hrp_state,hec2hrp) /*****************************************************************************/ { - hector_init(machine()); + hector_init(); } MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrp) { // Machines init - hector_reset(machine(), 1, 0); + hector_reset(1, 0); } /*****************************************************************************/ MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) @@ -329,7 +329,7 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) // As video HR ram is in bank, use extern memory m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); - hector_init(machine()); + hector_init(); hector_disc2_init(machine()); // Init of the Disc II ! } /*****************************************************************************/ @@ -355,8 +355,8 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx) // As video HR ram is in bank, use extern memory m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); - hector_init(machine()); - hector_minidisc_init(machine()); + hector_init(); + hector_minidisc_init(); } MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx) { @@ -367,7 +367,7 @@ MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx) membank("bank3")->set_entry(DISCII_BANK_ROM); // Machines init - hector_reset(machine(), 1, 1); + hector_reset(1, 1); hector_disc2_reset(machine()); } //minidisc @@ -378,7 +378,7 @@ MACHINE_RESET_MEMBER(hec2hrp_state,hec2mdhrx) membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); // Machines init - hector_reset(machine(), 1, 0); + hector_reset(1, 0); } /* Cassette definition */ diff --git a/src/mess/drivers/interact.c b/src/mess/drivers/interact.c index 8412c628896..cb6609dd44e 100644 --- a/src/mess/drivers/interact.c +++ b/src/mess/drivers/interact.c @@ -122,19 +122,19 @@ DISCRETE_SOUND_END MACHINE_RESET_MEMBER(interact_state,interact) { - hector_reset(machine(), 0, 0); + hector_reset(0, 0); } MACHINE_START_MEMBER(interact_state,interact) { - hector_init(machine()); + hector_init(); } UINT32 interact_state::screen_update_interact(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { UINT8 *videoram = m_videoram; screen.set_visible_area(0, 113, 0, 75); - hector_hr( machine(), bitmap, videoram, 77, 32); + hector_hr(bitmap, videoram, 77, 32); return 0; } diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c index c7b0eb128ee..1f5bfa220ca 100644 --- a/src/mess/drivers/nc.c +++ b/src/mess/drivers/nc.c @@ -118,8 +118,6 @@ /* the serial clock is generated by the nc hardware and connected to the i8251 receive clock and transmit clock inputs */ -static void nc_printer_update(running_machine &machine, UINT8 data); - /* Port 0x00: ========== @@ -254,10 +252,9 @@ static void nc_printer_update(running_machine &machine, UINT8 data); /* ==0, card not inserted, !=0 card is inserted */ /* set pcmcia card present state */ -void nc_set_card_present_state(running_machine &machine, int state) +void nc_state::nc_set_card_present_state(int state) { - nc_state *drvstate = machine.driver_data<nc_state>(); - drvstate->m_card_status = state; + m_card_status = state; } @@ -267,25 +264,24 @@ device e.g. serial chip, fdc */ /* this is a mask of irqs that are latched, and it is different for nc100 and nc200 */ -static void nc_update_interrupts(running_machine &machine) +void nc_state::nc_update_interrupts() { - nc_state *state = machine.driver_data<nc_state>(); - state->m_irq_status &= ~state->m_irq_latch_mask; - state->m_irq_status |= state->m_irq_latch; + m_irq_status &= ~m_irq_latch_mask; + m_irq_status |= m_irq_latch; /* any ints set and they are not masked? */ if ( - (((state->m_irq_status & state->m_irq_mask) & 0x3f)!=0) + (((m_irq_status & m_irq_mask) & 0x3f)!=0) ) { - logerror("int set %02x\n", state->m_irq_status & state->m_irq_mask); + logerror("int set %02x\n", m_irq_status & m_irq_mask); /* set int */ - state->m_maincpu->set_input_line(0, HOLD_LINE); + m_maincpu->set_input_line(0, HOLD_LINE); } else { /* clear int */ - state->m_maincpu->set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } } @@ -297,7 +293,7 @@ TIMER_CALLBACK_MEMBER(nc_state::nc_keyboard_timer_callback) m_irq_status |= (1<<3); /* update ints */ - nc_update_interrupts(machine()); + nc_update_interrupts(); /* don't trigger again, but don't free it */ m_keyboard_timer->reset(); @@ -310,10 +306,9 @@ static const char *const nc_bankhandler_r[]={ static const char *const nc_bankhandler_w[]={ "bank5", "bank6", "bank7", "bank8"}; -static void nc_refresh_memory_bank_config(running_machine &machine, int bank) +void nc_state::nc_refresh_memory_bank_config(int bank) { - nc_state *state = machine.driver_data<nc_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); int mem_type; int mem_bank; char bank1[10]; @@ -321,8 +316,8 @@ static void nc_refresh_memory_bank_config(running_machine &machine, int bank) sprintf(bank1,"bank%d",bank+1); sprintf(bank5,"bank%d",bank+5); - mem_type = (state->m_memory_config[bank]>>6) & 0x03; - mem_bank = state->m_memory_config[bank] & 0x03f; + mem_type = (m_memory_config[bank]>>6) & 0x03; + mem_bank = m_memory_config[bank] & 0x03f; space.install_read_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_r[bank]); @@ -334,11 +329,11 @@ static void nc_refresh_memory_bank_config(running_machine &machine, int bank) { unsigned char *addr; - mem_bank = mem_bank & state->m_membank_rom_mask; + mem_bank = mem_bank & m_membank_rom_mask; - addr = (state->memregion("maincpu")->base()+0x010000) + (mem_bank<<14); + addr = (memregion("maincpu")->base()+0x010000) + (mem_bank<<14); - state->membank(bank1)->set_base(addr); + membank(bank1)->set_base(addr); space.nop_write((bank * 0x4000), (bank * 0x4000) + 0x3fff); LOG(("BANK %d: ROM %d\n",bank,mem_bank)); @@ -350,12 +345,12 @@ static void nc_refresh_memory_bank_config(running_machine &machine, int bank) { unsigned char *addr; - mem_bank = mem_bank & state->m_membank_internal_ram_mask; + mem_bank = mem_bank & m_membank_internal_ram_mask; - addr = machine.device<ram_device>(RAM_TAG)->pointer() + (mem_bank<<14); + addr = machine().device<ram_device>(RAM_TAG)->pointer() + (mem_bank<<14); - state->membank(bank1)->set_base(addr); - state->membank(bank5)->set_base(addr); + membank(bank1)->set_base(addr); + membank(bank5)->set_base(addr); space.install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]); LOG(("BANK %d: RAM\n",bank)); @@ -366,20 +361,20 @@ static void nc_refresh_memory_bank_config(running_machine &machine, int bank) case 2: { /* card connected? */ - if ((state->m_card_status) && (state->m_card_ram!=NULL)) + if ((m_card_status) && (m_card_ram!=NULL)) { unsigned char *addr; - mem_bank = mem_bank & state->m_membank_card_ram_mask; - addr = state->m_card_ram + (mem_bank<<14); + mem_bank = mem_bank & m_membank_card_ram_mask; + addr = m_card_ram + (mem_bank<<14); - state->membank(bank1)->set_base(addr); + membank(bank1)->set_base(addr); /* write enabled? */ - if (machine.root_device().ioport("EXTRA")->read() & 0x02) + if (machine().root_device().ioport("EXTRA")->read() & 0x02) { /* yes */ - state->membank(bank5)->set_base(addr); + membank(bank5)->set_base(addr); space.install_write_bank((bank * 0x4000), (bank * 0x4000) + 0x3fff, nc_bankhandler_w[bank]); } @@ -401,86 +396,81 @@ static void nc_refresh_memory_bank_config(running_machine &machine, int bank) } } -static void nc_refresh_memory_config(running_machine &machine) +void nc_state::nc_refresh_memory_config() { - nc_refresh_memory_bank_config(machine, 0); - nc_refresh_memory_bank_config(machine, 1); - nc_refresh_memory_bank_config(machine, 2); - nc_refresh_memory_bank_config(machine, 3); + nc_refresh_memory_bank_config(0); + nc_refresh_memory_bank_config(1); + nc_refresh_memory_bank_config(2); + nc_refresh_memory_bank_config(3); } /* restore a block of memory from the nvram file */ -static void nc_common_restore_memory_from_stream(running_machine &machine) +void nc_state::nc_common_restore_memory_from_stream() { - nc_state *state = machine.driver_data<nc_state>(); UINT32 stored_size; UINT32 restore_size; - if (!state->m_file) + if (!m_file) return; LOG(("restoring nc memory\n")); /* get size of memory data stored */ - if (state->m_file->read(&stored_size, sizeof(UINT32)) != sizeof(UINT32)) + if (m_file->read(&stored_size, sizeof(UINT32)) != sizeof(UINT32)) stored_size = 0; - if (stored_size > machine.device<ram_device>(RAM_TAG)->size()) - restore_size = machine.device<ram_device>(RAM_TAG)->size(); + if (stored_size > machine().device<ram_device>(RAM_TAG)->size()) + restore_size = machine().device<ram_device>(RAM_TAG)->size(); else restore_size = stored_size; /* read as much as will fit into memory */ - state->m_file->read(machine.device<ram_device>(RAM_TAG)->pointer(), restore_size); + m_file->read(machine().device<ram_device>(RAM_TAG)->pointer(), restore_size); /* seek over remaining data */ - state->m_file->seek(SEEK_CUR,stored_size - restore_size); + m_file->seek(SEEK_CUR,stored_size - restore_size); } /* store a block of memory to the nvram file */ -static void nc_common_store_memory_to_stream(running_machine &machine) +void nc_state::nc_common_store_memory_to_stream() { - nc_state *state = machine.driver_data<nc_state>(); - UINT32 size = machine.device<ram_device>(RAM_TAG)->size(); - if (!state->m_file) + UINT32 size = machine().device<ram_device>(RAM_TAG)->size(); + if (!m_file) return; LOG(("storing nc memory\n")); /* write size of memory data */ - state->m_file->write(&size, sizeof(UINT32)); + m_file->write(&size, sizeof(UINT32)); /* write data block */ - state->m_file->write(machine.device<ram_device>(RAM_TAG)->pointer(), size); + m_file->write(machine().device<ram_device>(RAM_TAG)->pointer(), size); } -static void nc_common_open_stream_for_reading(running_machine &machine) +void nc_state::nc_common_open_stream_for_reading() { - nc_state *state = machine.driver_data<nc_state>(); char filename[MAX_DRIVER_NAME_CHARS + 5]; - sprintf(filename,"%s.hack", machine.system().name); + sprintf(filename,"%s.hack", machine().system().name); - state->m_file = global_alloc(emu_file(machine.options().memcard_directory(), OPEN_FLAG_WRITE)); - state->m_file->open(filename); + m_file = global_alloc(emu_file(machine().options().memcard_directory(), OPEN_FLAG_WRITE)); + m_file->open(filename); } -static void nc_common_open_stream_for_writing(running_machine &machine) +void nc_state::nc_common_open_stream_for_writing() { - nc_state *state = machine.driver_data<nc_state>(); char filename[MAX_DRIVER_NAME_CHARS + 5]; - sprintf(filename,"%s.hack", machine.system().name); + sprintf(filename,"%s.hack", machine().system().name); - state->m_file = global_alloc(emu_file(machine.options().memcard_directory(), OPEN_FLAG_WRITE)); - state->m_file->open(filename); + m_file = global_alloc(emu_file(machine().options().memcard_directory(), OPEN_FLAG_WRITE)); + m_file->open(filename); } -static void nc_common_close_stream(running_machine &machine) +void nc_state::nc_common_close_stream() { - nc_state *state = machine.driver_data<nc_state>(); - if (state->m_file) - global_free(state->m_file); + if (m_file) + global_free(m_file); } @@ -514,7 +504,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) case NC_TYPE_200: { m_irq_status |= (1 << 4); - nc_update_interrupts(machine()); + nc_update_interrupts(); } break; } @@ -525,7 +515,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) if (changed_bits & 0x02) { /* yes refresh memory config */ - nc_refresh_memory_config(machine()); + nc_refresh_memory_config(); } m_previous_inputport_10_state = inputport_10_state; @@ -533,40 +523,39 @@ TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) -static void nc_common_init_machine(running_machine &machine) +void nc_state::nc_common_init_machine() { - nc_state *state = machine.driver_data<nc_state>(); /* setup reset state */ - state->m_display_memory_start = 0; + m_display_memory_start = 0; /* setup reset state */ - state->m_memory_config[0] = 0; - state->m_memory_config[1] = 0; - state->m_memory_config[2] = 0; - state->m_memory_config[3] = 0; + m_memory_config[0] = 0; + m_memory_config[1] = 0; + m_memory_config[2] = 0; + m_memory_config[3] = 0; - state->m_previous_inputport_10_state = machine.root_device().ioport("EXTRA")->read(); + m_previous_inputport_10_state = machine().root_device().ioport("EXTRA")->read(); /* setup reset state ints are masked */ - state->m_irq_mask = 0; + m_irq_mask = 0; /* setup reset state no ints wanting servicing */ - state->m_irq_status = 0; + m_irq_status = 0; /* at reset set to 0x0ffff */ - state->m_irq_latch = 0; - state->m_irq_latch_mask = 0; + m_irq_latch = 0; + m_irq_latch_mask = 0; /* setup reset state */ - state->m_sound_channel_periods[0] = (state->m_sound_channel_periods[1] = 0x0ffff); + m_sound_channel_periods[0] = (m_sound_channel_periods[1] = 0x0ffff); /* at reset set to 1 */ - state->m_poweroff_control = 1; + m_poweroff_control = 1; - nc_refresh_memory_config(machine); - nc_update_interrupts(machine); + nc_refresh_memory_config(); + nc_update_interrupts(); /* at reset set to 0x0ff */ - state->m_uart_control = 0x0ff; + m_uart_control = 0x0ff; } static ADDRESS_MAP_START(nc_map, AS_PROGRAM, 8, nc_state ) @@ -587,7 +576,7 @@ WRITE8_MEMBER(nc_state::nc_memory_management_w) LOG(("Memory management W: %02x %02x\n",offset,data)); m_memory_config[offset] = data; - nc_refresh_memory_config(machine()); + nc_refresh_memory_config(); } WRITE8_MEMBER(nc_state::nc_irq_mask_w) @@ -598,7 +587,7 @@ WRITE8_MEMBER(nc_state::nc_irq_mask_w) /* writing mask clears ints that are to be masked? */ m_irq_mask = data; - nc_update_interrupts(machine()); + nc_update_interrupts(); } WRITE8_MEMBER(nc_state::nc_irq_status_w) @@ -615,7 +604,7 @@ WRITE8_MEMBER(nc_state::nc_irq_status_w) /* set timer to occur again */ m_keyboard_timer->reset(attotime::from_msec(10)); - nc_update_interrupts(machine()); + nc_update_interrupts(); } } @@ -635,7 +624,7 @@ WRITE8_MEMBER(nc_state::nc_irq_status_w) #endif m_irq_status &=~data; - nc_update_interrupts(machine()); + nc_update_interrupts(); } READ8_MEMBER(nc_state::nc_irq_status_r) @@ -659,16 +648,15 @@ READ8_MEMBER(nc_state::nc_key_data_in_r) /* set timer to occur again */ m_keyboard_timer->reset(attotime::from_msec(10)); - nc_update_interrupts(machine()); + nc_update_interrupts(); } return ioport(keynames[offset])->read(); } -static void nc_sound_update(running_machine &machine, int channel) +void nc_state::nc_sound_update(int channel) { - nc_state *state = machine.driver_data<nc_state>(); int on; int frequency; int period; @@ -684,7 +672,7 @@ static void nc_sound_update(running_machine &machine, int channel) break; } - period = state->m_sound_channel_periods[channel]; + period = m_sound_channel_periods[channel]; /* if top bit is 0, sound is on */ on = ((period & (1<<15))==0); @@ -693,9 +681,9 @@ static void nc_sound_update(running_machine &machine, int channel) frequency = (int)(1000000.0f/((float)((period & 0x07fff)<<1) * 1.6276f)); /* set state */ - machine.device<beep_device>(beeper_device)->set_state(on); + machine().device<beep_device>(beeper_device)->set_state(on); /* set frequency */ - machine.device<beep_device>(beeper_device)->set_frequency(frequency); + machine().device<beep_device>(beeper_device)->set_frequency(frequency); } WRITE8_MEMBER(nc_state::nc_sound_w) @@ -710,7 +698,7 @@ WRITE8_MEMBER(nc_state::nc_sound_w) m_sound_channel_periods[0] = (m_sound_channel_periods[0] & 0x0ff00) | (data & 0x0ff); - nc_sound_update(machine(), 0); + nc_sound_update(0); } break; @@ -719,7 +707,7 @@ WRITE8_MEMBER(nc_state::nc_sound_w) m_sound_channel_periods[0] = (m_sound_channel_periods[0] & 0x0ff) | ((data & 0x0ff)<<8); - nc_sound_update(machine(), 0); + nc_sound_update(0); } break; @@ -729,7 +717,7 @@ WRITE8_MEMBER(nc_state::nc_sound_w) m_sound_channel_periods[1] = (m_sound_channel_periods[1] & 0x0ff00) | (data & 0x0ff); - nc_sound_update(machine(), 1); + nc_sound_update(1); } break; @@ -738,7 +726,7 @@ WRITE8_MEMBER(nc_state::nc_sound_w) m_sound_channel_periods[1] = (m_sound_channel_periods[1] & 0x0ff) | ((data & 0x0ff)<<8); - nc_sound_update(machine(), 1); + nc_sound_update(1); } break; @@ -770,7 +758,7 @@ TIMER_CALLBACK_MEMBER(nc_state::nc_serial_timer_callback) WRITE8_MEMBER(nc_state::nc_uart_control_w) { /* update printer state */ - nc_printer_update(machine(), data); + nc_printer_update(data); /* on/off changed state? */ if (((m_uart_control ^ data) & (1<<3))!=0) @@ -793,9 +781,9 @@ WRITE8_MEMBER(nc_state::nc_uart_control_w) /* same for nc100 and nc200 */ -static void nc_printer_update(running_machine &machine, UINT8 data) +void nc_state::nc_printer_update(UINT8 data) { - centronics_device *printer = machine.device<centronics_device>("centronics"); + centronics_device *printer = machine().device<centronics_device>("centronics"); printer->strobe_w(BIT(data, 6)); } @@ -850,7 +838,7 @@ WRITE_LINE_MEMBER(nc_state::nc100_txrdy_callback) } } - nc_update_interrupts(machine()); + nc_update_interrupts(); } WRITE_LINE_MEMBER(nc_state::nc100_rxrdy_callback) @@ -866,7 +854,7 @@ WRITE_LINE_MEMBER(nc_state::nc100_rxrdy_callback) } } - nc_update_interrupts(machine()); + nc_update_interrupts(); } @@ -897,7 +885,7 @@ WRITE_LINE_MEMBER(nc_state::nc100_centronics_ack_w) m_irq_status &= ~0x04; /* trigger an int if the irq is set */ - nc_update_interrupts(machine()); + nc_update_interrupts(); } static const centronics_interface nc100_centronics_config = @@ -917,11 +905,11 @@ void nc_state::machine_reset() m_membank_card_ram_mask = 0x03f; - nc_common_init_machine(machine()); + nc_common_init_machine(); - nc_common_open_stream_for_reading(machine()); - nc_common_restore_memory_from_stream(machine()); - nc_common_close_stream(machine()); + nc_common_open_stream_for_reading(); + nc_common_restore_memory_from_stream(); + nc_common_close_stream(); /* serial */ m_irq_latch_mask = (1<<0) | (1<<1); @@ -929,9 +917,9 @@ void nc_state::machine_reset() void nc_state::nc100_machine_stop() { - nc_common_open_stream_for_writing(machine()); - nc_common_store_memory_to_stream(machine()); - nc_common_close_stream(machine()); + nc_common_open_stream_for_writing(); + nc_common_store_memory_to_stream(); + nc_common_close_stream(); } void nc_state::machine_start() @@ -1144,12 +1132,11 @@ INPUT_PORTS_END /* to be completed! */ #if 0 -void nc150_init_machine(running_machine &machine) +void nc_state::nc150_init_machine() { - nc_state *state = machine.driver_data<nc_state>(); - state->m_membank_internal_ram_mask = 7; + m_membank_internal_ram_mask = 7; - state->m_membank_card_ram_mask = 0x03f; + m_membank_card_ram_mask = 0x03f; nc_common_init_machine(machine); } @@ -1182,7 +1169,7 @@ WRITE_LINE_MEMBER(nc_state::nc200_centronics_ack_w) m_irq_status &= ~0x01; /* trigger an int if the irq is set */ - nc_update_interrupts(machine()); + nc_update_interrupts(); } static const centronics_interface nc200_centronics_config = @@ -1196,20 +1183,19 @@ static const centronics_interface nc200_centronics_config = /* assumption. nc200 uses the same uart chip. The rxrdy and txrdy are combined together with a or to generate a single interrupt */ -static void nc200_refresh_uart_interrupt(running_machine &machine) +void nc_state::nc200_refresh_uart_interrupt() { - nc_state *state = machine.driver_data<nc_state>(); - state->m_irq_latch &=~(1<<2); + m_irq_latch &=~(1<<2); /* uart enabled? */ - if ((state->m_uart_control & (1<<3))==0) + if ((m_uart_control & (1<<3))==0) { - if ((state->m_nc200_uart_interrupt_irq & 0x03)!=0) + if ((m_nc200_uart_interrupt_irq & 0x03)!=0) { - state->m_irq_latch |= (1<<2); + m_irq_latch |= (1<<2); } } - nc_update_interrupts(machine); + nc_update_interrupts(); } WRITE_LINE_MEMBER(nc_state::nc200_txrdy_callback) @@ -1234,7 +1220,7 @@ WRITE_LINE_MEMBER(nc_state::nc200_rxrdy_callback) m_nc200_uart_interrupt_irq |=(1<<1); } - nc200_refresh_uart_interrupt(machine()); + nc200_refresh_uart_interrupt(); } static const i8251_interface nc200_uart_interface= @@ -1268,15 +1254,14 @@ void nc_state::nc200_fdc_interrupt(bool state) m_irq_status |=(1<<5); } - nc_update_interrupts(machine()); + nc_update_interrupts(); } #ifdef UNUSED_FUNCTION -static void nc200_floppy_drive_index_callback(int drive_id) +void nc_state::nc200_floppy_drive_index_callback(int drive_id) { - nc_state *state = machine.driver_data<nc_state>(); LOG_DEBUG(("nc200 index pulse\n")); -// state->m_irq_status |= (1<<4); +// m_irq_status |= (1<<4); // nc_update_interrupts(Machine); } @@ -1291,25 +1276,25 @@ MACHINE_RESET_MEMBER(nc_state,nc200) m_membank_card_ram_mask = 0x03f; - nc_common_init_machine(machine()); + nc_common_init_machine(); m_nc200_uart_interrupt_irq = 0; - nc_common_open_stream_for_reading(machine()); - nc_common_restore_memory_from_stream(machine()); - nc_common_close_stream(machine()); + nc_common_open_stream_for_reading(); + nc_common_restore_memory_from_stream(); + nc_common_close_stream(); /* fdc, serial */ m_irq_latch_mask = /*(1<<5) |*/ (1<<2); - nc200_video_set_backlight(machine(), 0); + nc200_video_set_backlight(0); } void nc_state::nc200_machine_stop() { - nc_common_open_stream_for_writing(machine()); - nc_common_store_memory_to_stream(machine()); - nc_common_close_stream(machine()); + nc_common_open_stream_for_writing(); + nc_common_store_memory_to_stream(); + nc_common_close_stream(); } MACHINE_START_MEMBER(nc_state,nc200) @@ -1396,7 +1381,7 @@ WRITE8_MEMBER(nc_state::nc200_uart_control_w) { m_nc200_uart_interrupt_irq &=~3; - nc200_refresh_uart_interrupt(machine()); + nc200_refresh_uart_interrupt(); } /* bit 5 is used in disk interface */ @@ -1434,7 +1419,7 @@ WRITE8_MEMBER(nc_state::nc200_poweroff_control_w) { LOG_DEBUG(("nc200 power off: PC: %04x %02x\n", m_maincpu->pc(), data)); - nc200_video_set_backlight(machine(), ((data ^ (1 << 2)) >> 2) & 0x01); + nc200_video_set_backlight(((data ^ (1 << 2)) >> 2) & 0x01); } static ADDRESS_MAP_START(nc200_io, AS_IO, 8, nc_state ) diff --git a/src/mess/drivers/pc88va.c b/src/mess/drivers/pc88va.c index e3eed225086..4cfa0ae6757 100644 --- a/src/mess/drivers/pc88va.c +++ b/src/mess/drivers/pc88va.c @@ -146,6 +146,8 @@ public: // void m_fdc_dma_w(running_machine &machine, UINT16 data); DECLARE_WRITE_LINE_MEMBER(pc88va_hlda_w); DECLARE_WRITE_LINE_MEMBER(pc88va_tc_w); + DECLARE_READ16_MEMBER(fdc_dma_r); + DECLARE_WRITE16_MEMBER(fdc_dma_w); void fdc_irq(bool state); void fdc_drq(bool state); @@ -1794,18 +1796,16 @@ WRITE_LINE_MEMBER( pc88va_state::pc88va_tc_w ) } -static UINT16 m_fdc_dma_r(running_machine &machine) +READ16_MEMBER(pc88va_state::fdc_dma_r) { - pc88va_state *state = machine.driver_data<pc88va_state>(); printf("R DMA\n"); - return state->m_fdc->dma_r(); + return m_fdc->dma_r(); } -static void m_fdc_dma_w(running_machine &machine, UINT16 data) +WRITE16_MEMBER(pc88va_state::fdc_dma_w) { - pc88va_state *state = machine.driver_data<pc88va_state>(); printf("W DMA %08x\n",data); - state->m_fdc->dma_w(data); + m_fdc->dma_w(data); } @@ -1816,8 +1816,8 @@ static const upd71071_intf pc88va_dma_config = 8000000, DEVCB_DRIVER_LINE_MEMBER(pc88va_state, pc88va_hlda_w), DEVCB_DRIVER_LINE_MEMBER(pc88va_state, pc88va_tc_w), - { 0, 0, m_fdc_dma_r, 0 }, - { 0, 0, m_fdc_dma_w, 0 }, + { DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER16(pc88va_state, fdc_dma_r), DEVCB_NULL }, + { DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER16(pc88va_state, fdc_dma_w), DEVCB_NULL }, { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL } }; diff --git a/src/mess/drivers/pcw.c b/src/mess/drivers/pcw.c index f819ca8a516..67fd0d9d283 100644 --- a/src/mess/drivers/pcw.c +++ b/src/mess/drivers/pcw.c @@ -114,56 +114,55 @@ static const UINT8 half_step_table[4] = { 0x01, 0x02, 0x04, 0x08 }; static const UINT8 full_step_table[4] = { 0x03, 0x06, 0x0c, 0x09 }; -static void pcw_update_interrupt_counter(pcw_state *state) +void pcw_state::pcw_update_interrupt_counter() { /* never increments past 15! */ - if (state->m_interrupt_counter==0x0f) + if (m_interrupt_counter==0x0f) return; /* increment count */ - state->m_interrupt_counter++; + m_interrupt_counter++; } // set/reset INT and NMI lines -static void pcw_update_irqs(running_machine &machine) +void pcw_state::pcw_update_irqs() { - pcw_state *state = machine.driver_data<pcw_state>(); // set NMI line, remains set until FDC interrupt type is changed - if(state->m_nmi_flag != 0) - state->m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + if(m_nmi_flag != 0) + m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); else - state->m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); // set IRQ line, timer pulses IRQ line, all other devices hold it as necessary - if(state->m_fdc_interrupt_code == 1 && (state->m_system_status & 0x20)) + if(m_fdc_interrupt_code == 1 && (m_system_status & 0x20)) { - state->m_maincpu->set_input_line(0, ASSERT_LINE); + m_maincpu->set_input_line(0, ASSERT_LINE); return; } - if(state->m_timer_irq_flag != 0) + if(m_timer_irq_flag != 0) { - state->m_maincpu->set_input_line(0, ASSERT_LINE); + m_maincpu->set_input_line(0, ASSERT_LINE); return; } - state->m_maincpu->set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } TIMER_CALLBACK_MEMBER(pcw_state::pcw_timer_pulse) { m_timer_irq_flag = 0; - pcw_update_irqs(machine()); + pcw_update_irqs(); } /* callback for 1/300ths of a second interrupt */ TIMER_DEVICE_CALLBACK_MEMBER(pcw_state::pcw_timer_interrupt) { - pcw_update_interrupt_counter(this); + pcw_update_interrupt_counter(); m_timer_irq_flag = 1; - pcw_update_irqs(machine()); + pcw_update_irqs(); machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(pcw_state::pcw_timer_pulse),this)); } @@ -219,10 +218,9 @@ READ8_MEMBER(pcw_state::pcw_keyboard_data_r) * PCW Banking * ----------------------------------------------------------------------- */ -static void pcw_update_read_memory_block(running_machine &machine, int block, int bank) +void pcw_state::pcw_update_read_memory_block(int block, int bank) { - pcw_state *state = machine.driver_data<pcw_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); char block_name[10]; sprintf(block_name,"bank%d",block+1); @@ -232,7 +230,7 @@ static void pcw_update_read_memory_block(running_machine &machine, int block, in /* when upper 16 bytes are accessed use keyboard read handler */ space.install_read_handler( - block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, read8_delegate(FUNC(pcw_state::pcw_keyboard_data_r),state)); + block * 0x04000 + 0x3ff0, block * 0x04000 + 0x3fff, read8_delegate(FUNC(pcw_state::pcw_keyboard_data_r),this)); // LOG(("MEM: read block %i -> bank %i\n",block,bank)); } else @@ -241,18 +239,17 @@ static void pcw_update_read_memory_block(running_machine &machine, int block, in space.install_read_bank(block * 0x04000 + 0x0000, block * 0x04000 + 0x3fff,block_name); // LOG(("MEM: read block %i -> bank %i\n",block,bank)); } - state->membank(block_name)->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine.device<ram_device>(RAM_TAG)->size())); + membank(block_name)->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine().device<ram_device>(RAM_TAG)->size())); } -static void pcw_update_write_memory_block(running_machine &machine, int block, int bank) +void pcw_state::pcw_update_write_memory_block(int block, int bank) { - pcw_state *state = machine.driver_data<pcw_state>(); char block_name[10]; sprintf(block_name,"bank%d",block+5); - state->membank(block_name)->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine.device<ram_device>(RAM_TAG)->size())); + membank(block_name)->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + ((bank * 0x4000) % machine().device<ram_device>(RAM_TAG)->size())); // LOG(("MEM: write block %i -> bank %i\n",block,bank)); } @@ -262,9 +259,8 @@ static void pcw_update_write_memory_block(running_machine &machine, int block, i /* &F4 O b7-b4: when set, force memory reads to access the same bank as writes for &C000, &0000, &8000, and &4000 respectively */ -static void pcw_update_mem(running_machine &machine, int block, int data) +void pcw_state::pcw_update_mem(int block, int data) { - pcw_state *state = machine.driver_data<pcw_state>(); /* expansion ram select. if block is 0-7, selects internal ram instead for read/write */ @@ -275,8 +271,8 @@ static void pcw_update_mem(running_machine &machine, int block, int data) /* same bank for reading and writing */ bank = data & 0x7f; - pcw_update_read_memory_block(machine, block, bank); - pcw_update_write_memory_block(machine, block, bank); + pcw_update_read_memory_block(block, bank); + pcw_update_write_memory_block(block, bank); } else { @@ -312,7 +308,7 @@ static void pcw_update_mem(running_machine &machine, int block, int data) break; } - if (state->m_bank_force & mask) + if (m_bank_force & mask) { read_bank = data & 0x07; } @@ -321,32 +317,31 @@ static void pcw_update_mem(running_machine &machine, int block, int data) read_bank = (data>>4) & 0x07; } - pcw_update_read_memory_block(machine, block, read_bank); + pcw_update_read_memory_block(block, read_bank); write_bank = data & 0x07; - pcw_update_write_memory_block(machine, block, write_bank); + pcw_update_write_memory_block(block, write_bank); } /* if boot is active, page in fake ROM */ -/* if ((state->m_boot) && (block==0)) +/* if ((m_boot) && (block==0)) { unsigned char *FakeROM; - FakeROM = &machine.root_device().memregion("maincpu")->base()[0x010000]; + FakeROM = &machine().root_device().memregion("maincpu")->base()[0x010000]; - state->membank("bank1")->set_base(FakeROM); + membank("bank1")->set_base(FakeROM); }*/ } /* from Jacob Nevins docs */ -static int pcw_get_sys_status(running_machine &machine) +int pcw_state::pcw_get_sys_status() { - pcw_state *state = machine.driver_data<pcw_state>(); return - state->m_interrupt_counter - | (state->m_screen->vblank() ? 0x40 : 0x00) - | (machine.root_device().ioport("EXTRA")->read() & 0x010) - | (state->m_system_status & 0x20); + m_interrupt_counter + | (m_screen->vblank() ? 0x40 : 0x00) + | (machine().root_device().ioport("EXTRA")->read() & 0x010) + | (m_system_status & 0x20); } READ8_MEMBER(pcw_state::pcw_interrupt_counter_r) @@ -356,11 +351,11 @@ READ8_MEMBER(pcw_state::pcw_interrupt_counter_r) /* from Jacob Nevins docs */ /* get data */ - data = pcw_get_sys_status(machine()); + data = pcw_get_sys_status(); /* clear int counter */ m_interrupt_counter = 0; /* check interrupts */ - pcw_update_irqs(machine()); + pcw_update_irqs(); /* return data */ //LOG(("SYS: IRQ counter read, returning %02x\n",data)); return data; @@ -372,7 +367,7 @@ WRITE8_MEMBER(pcw_state::pcw_bank_select_w) //LOG(("BANK: %2x %x\n",offset, data)); m_banks[offset] = data; - pcw_update_mem(machine(), offset, data); + pcw_update_mem(offset, data); // popmessage("RAM Banks: %02x %02x %02x %02x Lock:%02x",m_banks[0],m_banks[1],m_banks[2],m_banks[3],m_bank_force); } @@ -380,10 +375,10 @@ WRITE8_MEMBER(pcw_state::pcw_bank_force_selection_w) { m_bank_force = data; - pcw_update_mem(machine(), 0, m_banks[0]); - pcw_update_mem(machine(), 1, m_banks[1]); - pcw_update_mem(machine(), 2, m_banks[2]); - pcw_update_mem(machine(), 3, m_banks[3]); + pcw_update_mem(0, m_banks[0]); + pcw_update_mem(1, m_banks[1]); + pcw_update_mem(2, m_banks[2]); + pcw_update_mem(3, m_banks[3]); } @@ -421,7 +416,7 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) case 0: { m_boot = 0; - pcw_update_mem(machine(), 0, m_banks[0]); + pcw_update_mem(0, m_banks[0]); } break; @@ -445,7 +440,7 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) { /* yes */ - pcw_update_irqs(machine()); + pcw_update_irqs(); } } @@ -470,7 +465,7 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) } /* re-issue interrupt */ - pcw_update_irqs(machine()); + pcw_update_irqs(); } break; @@ -490,7 +485,7 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) /* Clear NMI */ m_nmi_flag = 0; } - pcw_update_irqs(machine()); + pcw_update_irqs(); } break; @@ -567,7 +562,7 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) READ8_MEMBER(pcw_state::pcw_system_status_r) { /* from Jacob Nevins docs */ - UINT8 ret = pcw_get_sys_status(machine()); + UINT8 ret = pcw_get_sys_status(); return ret; } @@ -628,21 +623,20 @@ WRITE8_MEMBER(pcw_state::pcw_expansion_w) logerror("pcw expansion w: %04x %02x\n",offset+0x080, data); } -static void pcw_printer_fire_pins(running_machine &machine, UINT16 pins) +void pcw_state::pcw_printer_fire_pins(UINT16 pins) { - pcw_state *state = machine.driver_data<pcw_state>(); int x,line; - INT32 feed = (state->m_paper_feed / 2); + INT32 feed = (m_paper_feed / 2); for(x=feed+PCW_PRINTER_HEIGHT-16;x<feed+PCW_PRINTER_HEIGHT-7;x++) { line = x % PCW_PRINTER_HEIGHT; if((pins & 0x01) == 0) - state->m_prn_output->pix16(line, state->m_printer_headpos) = (UINT16)(pins & 0x01); + m_prn_output->pix16(line, m_printer_headpos) = (UINT16)(pins & 0x01); pins >>= 1; } -// if(state->m_printer_headpos < PCW_PRINTER_WIDTH) -// state->m_printer_headpos++; +// if(m_printer_headpos < PCW_PRINTER_WIDTH) +// m_printer_headpos++; } WRITE8_MEMBER(pcw_state::pcw_printer_data_w) @@ -763,7 +757,7 @@ TIMER_CALLBACK_MEMBER(pcw_state::pcw_stepper_callback) TIMER_CALLBACK_MEMBER(pcw_state::pcw_pins_callback) { - pcw_printer_fire_pins(machine(),m_printer_pins); + pcw_printer_fire_pins(m_printer_pins); m_printer_p2 |= 0x40; } @@ -1026,10 +1020,10 @@ void pcw_state::machine_reset() m_banks[2] = 0x82; m_banks[3] = 0x83; - pcw_update_mem(machine(), 0, m_banks[0]); - pcw_update_mem(machine(), 1, m_banks[1]); - pcw_update_mem(machine(), 2, m_banks[2]); - pcw_update_mem(machine(), 3, m_banks[3]); + pcw_update_mem(0, m_banks[0]); + pcw_update_mem(1, m_banks[1]); + pcw_update_mem(2, m_banks[2]); + pcw_update_mem(3, m_banks[3]); m_boot = 0; // System starts up in bootstrap mode, disabled until it's possible to emulate it. diff --git a/src/mess/drivers/pcw16.c b/src/mess/drivers/pcw16.c index 3b18e01c9ba..4d169e84c94 100644 --- a/src/mess/drivers/pcw16.c +++ b/src/mess/drivers/pcw16.c @@ -390,7 +390,7 @@ int pcw16_state::pcw16_keyboard_can_transmit() #ifdef UNUSED_FUNCTION /* issue a begin byte transfer */ -static void pcw16_begin_byte_transfer(void) +void ::pcw16_begin_byte_transfer(void) { } #endif diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c index b4da8ea4bd1..d6b588392f0 100644 --- a/src/mess/drivers/pdp1.c +++ b/src/mess/drivers/pdp1.c @@ -381,12 +381,6 @@ or both IOT incompletely, or screw up completely. I insist that such an error c by a pdp-1 programming error, even if there is no emulator error. */ #define LOG_IOT_OVERLAP 0 - -static int tape_read(pdp1_state *state, UINT8 *reply); - - - - static void pdp1_tape_read_binary(device_t *device); static void pdp1_io_sc_callback(device_t *device); @@ -503,7 +497,7 @@ void pdp1_state::machine_reset() m_lightpen.active = m_lightpen.down = 0; m_lightpen.x = m_lightpen.y = 0; m_lightpen.radius = 10; /* ??? */ - pdp1_update_lightpen_state(machine(), &m_lightpen); + pdp1_update_lightpen_state(&m_lightpen); } @@ -859,9 +853,9 @@ void pdp1_readtape_image_device::call_unload() /* Read a byte from perforated tape */ -static int tape_read(pdp1_state *state, UINT8 *reply) +int pdp1_state::tape_read(UINT8 *reply) { - if (state->m_tape_reader.fd && (state->m_tape_reader.fd->fread(reply, 1) == 1)) + if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1)) return 0; /* unit OK */ else return 1; /* unit not ready */ @@ -871,28 +865,28 @@ static int tape_read(pdp1_state *state, UINT8 *reply) /* common code for tape read commands (RPA, RPB, and read-in mode) */ -static void begin_tape_read(pdp1_state *state, int binary, int nac) +void pdp1_state::begin_tape_read( int binary, int nac) { - state->m_tape_reader.rb = 0; - state->m_tape_reader.rcl = 1; - state->m_tape_reader.rc = (binary) ? 1 : 3; - state->m_tape_reader.rby = (binary) ? 1 : 0; - state->m_tape_reader.rcp = nac; + m_tape_reader.rb = 0; + m_tape_reader.rcl = 1; + m_tape_reader.rc = (binary) ? 1 : 3; + m_tape_reader.rby = (binary) ? 1 : 0; + m_tape_reader.rcp = nac; if (LOG_IOT_OVERLAP) { - if (state->m_tape_reader.timer->enable(0)) + if (m_tape_reader.timer->enable(0)) logerror("Error: overlapped perforated tape reads (Read-in mode, RPA/RPB instruction)\n"); } /* set up delay if tape is advancing */ - if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) + if (m_tape_reader.motor_on && m_tape_reader.rcl) { /* delay is approximately 1/400s */ - state->m_tape_reader.timer->enable(1); + m_tape_reader.timer->enable(1); } else { - state->m_tape_reader.timer->enable(0); + m_tape_reader.timer->enable(0); } } @@ -906,7 +900,7 @@ TIMER_CALLBACK_MEMBER(pdp1_state::reader_callback) if (m_tape_reader.rc) { - not_ready = tape_read(this, & data); + not_ready = tape_read(& data); if (not_ready) { m_tape_reader.motor_on = 0; /* let us stop the motor */ @@ -955,7 +949,7 @@ TIMER_CALLBACK_MEMBER(pdp1_state::reader_callback) void pdp1_tape_read_binary(device_t *device) { pdp1_state *state = device->machine().driver_data<pdp1_state>(); - begin_tape_read(state, 1, 1); + state->begin_tape_read(1, 1); } /* @@ -991,7 +985,7 @@ static void iot_rpa(device_t *device, int op2, int nac, int mb, int *io, int ac) if (LOG_IOT_EXTRA) logerror("Warning, RPA instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - begin_tape_read(state, 0, nac); + state->begin_tape_read(0, nac); } /* @@ -1029,7 +1023,7 @@ static void iot_rpb(device_t *device, int op2, int nac, int mb, int *io, int ac) if (LOG_IOT_EXTRA) logerror("Warning, RPB instruction not fully emulated: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - begin_tape_read(state, 1, nac); + state->begin_tape_read(1, nac); } /* @@ -1067,10 +1061,10 @@ void pdp1_punchtape_image_device::call_unload() /* Write a byte to perforated tape */ -static void tape_write(pdp1_state *state, UINT8 data) +void pdp1_state::tape_write(UINT8 data) { - if (state->m_tape_puncher.fd) - state->m_tape_puncher.fd->fwrite(& data, 1); + if (m_tape_puncher.fd) + m_tape_puncher.fd->fwrite(& data, 1); } /* @@ -1106,7 +1100,7 @@ static void iot_ppa(device_t *device, int op2, int nac, int mb, int *io, int ac) if (LOG_IOT_EXTRA) logerror("PPA instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - tape_write(state, *io & 0377); + state->tape_write(*io & 0377); state->m_io_status &= ~io_st_ptp; /* delay is approximately 1/63.3 second */ if (LOG_IOT_OVERLAP) @@ -1135,7 +1129,7 @@ static void iot_ppb(device_t *device, int op2, int nac, int mb, int *io, int ac) if (LOG_IOT_EXTRA) logerror("PPB instruction: mb=0%06o, (%s)\n", (unsigned) mb, device->machine().describe_context()); - tape_write(state, (*io >> 12) | 0200); + state->tape_write((*io >> 12) | 0200); state->m_io_status &= ~io_st_ptp; /* delay is approximately 1/63.3 second */ if (LOG_IOT_OVERLAP) @@ -1177,16 +1171,15 @@ void pdp1_printer_image_device::call_unload() /* Write a character to typewriter */ -static void typewriter_out(running_machine &machine, UINT8 data) +void pdp1_state::typewriter_out(UINT8 data) { - pdp1_state *state = machine.driver_data<pdp1_state>(); if (LOG_IOT_EXTRA) logerror("typewriter output %o\n", data); - pdp1_typewriter_drawchar(machine, data); - if (state->m_typewriter.fd) + pdp1_typewriter_drawchar(data); + if (m_typewriter.fd) #if 1 - state->m_typewriter.fd->fwrite(& data, 1); + m_typewriter.fd->fwrite(& data, 1); #else { static const char ascii_table[2][64] = @@ -1238,7 +1231,7 @@ static void typewriter_out(running_machine &machine, UINT8 data) //color = color_typewriter_black; { static const char black[5] = { '\033', '[', '3', '0', 'm' }; - image_fwrite(state->m_typewriter.fd, black, sizeof(black)); + image_fwrite(m_typewriter.fd, black, sizeof(black)); } break; @@ -1247,25 +1240,25 @@ static void typewriter_out(running_machine &machine, UINT8 data) //color = color_typewriter_red; { static const char red[5] = { '\033', '[', '3', '1', 'm' }; - image_fwrite(state->m_typewriter.fd, red, sizeof(red)); + image_fwrite(m_typewriter.fd, red, sizeof(red)); } break; case 072: /* Lower case */ - state->m_case_shift = 0; + m_case_shift = 0; break; case 074: /* Upper case */ - state->m_case_shift = 1; + m_case_shift = 1; break; case 077: /* Carriage Return */ { static const char line_end[2] = { '\r', '\n' }; - image_fwrite(state->m_typewriter.fd, line_end, sizeof(line_end)); + image_fwrite(m_typewriter.fd, line_end, sizeof(line_end)); } break; @@ -1274,7 +1267,7 @@ static void typewriter_out(running_machine &machine, UINT8 data) if ((data != 040) && (data != 056)) /* 040 and 056 are non-spacing characters: don't try to print right now */ /* print character (lookup ASCII equivalent in table) */ - image_fwrite(state->m_typewriter.fd, & ascii_table[state->m_case_shift][data], 1); + image_fwrite(m_typewriter.fd, & ascii_table[m_case_shift][data], 1); break; } @@ -1308,7 +1301,7 @@ static void iot_tyo(device_t *device, int op2, int nac, int mb, int *io, int ac) ch = (*io) & 077; - typewriter_out(device->machine(), ch); + state->typewriter_out(ch); state->m_io_status &= ~io_st_tyo; /* compute completion delay (source: maintainance manual 9-12, 9-13 and 9-14) */ @@ -1427,7 +1420,7 @@ static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac) x = ((ac+0400000) & 0777777) >> 8; y = (((*io)+0400000) & 0777777) >> 8; - pdp1_plot(device->machine(), x, y); + state->pdp1_plot(x, y); /* light pen 32 support */ state->m_io_status &= ~io_st_pen; @@ -1459,16 +1452,16 @@ static void iot_dpy(device_t *device, int op2, int nac, int mb, int *io, int ac) MIT parallel drum (variant of type 23) */ -static void parallel_drum_set_il(pdp1_state *state, int il) +void pdp1_state::parallel_drum_set_il(int il) { attotime il_phase; - state->m_parallel_drum.il = il; + m_parallel_drum.il = il; - il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - state->m_parallel_drum.rotation_timer->elapsed()); + il_phase = ((PARALLEL_DRUM_WORD_TIME * il) - m_parallel_drum.rotation_timer->elapsed()); if (il_phase < attotime::zero) il_phase = il_phase + PARALLEL_DRUM_ROTATION_TIME; - state->m_parallel_drum.il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME); + m_parallel_drum.il_timer->adjust(il_phase, 0, PARALLEL_DRUM_ROTATION_TIME); } #ifdef UNUSED_FUNCTION @@ -1481,12 +1474,12 @@ TIMER_CALLBACK_MEMBER(pdp1_state::il_timer_callback) } } -static void parallel_drum_init(pdp1_state *state) +void pdp1_state::parallel_drum_init(pdp1_state *state) { - state->m_parallel_drum.rotation_timer = machine.scheduler().timer_alloc(); - state->m_parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); + m_parallel_drum.rotation_timer = machine().scheduler().timer_alloc(); + m_parallel_drum.rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); - state->m_parallel_drum.il_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::il_timer_callback),this)); + m_parallel_drum.il_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::il_timer_callback),this)); parallel_drum_set_il(0); } #endif @@ -1513,7 +1506,7 @@ static void iot_dia(device_t *device, int op2, int nac, int mb, int *io, int ac) { pdp1_state *state = device->machine().driver_data<pdp1_state>(); state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12; - parallel_drum_set_il(state, (*io) & 0007777); + state->parallel_drum_set_il((*io) & 0007777); state->m_parallel_drum.dba = 0; /* right? */ } @@ -1522,7 +1515,7 @@ static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac) { pdp1_state *state = device->machine().driver_data<pdp1_state>(); state->m_parallel_drum.wfb = ((*io) & 0370000) >> 12; - parallel_drum_set_il(state, (*io) & 0007777); + state->parallel_drum_set_il((*io) & 0007777); state->m_parallel_drum.dba = 1; } @@ -1530,12 +1523,12 @@ static void iot_dba(device_t *device, int op2, int nac, int mb, int *io, int ac) /* Read a word from drum */ -static UINT32 drum_read(pdp1_state *state, int field, int position) +UINT32 pdp1_state::drum_read(int field, int position) { int offset = (field*4096+position)*3; UINT8 buf[3]; - if (state->m_parallel_drum.fd && (!state->m_parallel_drum.fd->fseek(offset, SEEK_SET)) && (state->m_parallel_drum.fd->fread( buf, 3) == 3)) + if (m_parallel_drum.fd && (!m_parallel_drum.fd->fseek(offset, SEEK_SET)) && (m_parallel_drum.fd->fread( buf, 3) == 3)) return ((buf[0] << 16) | (buf[1] << 8) | buf[2]) & 0777777; return 0; @@ -1544,19 +1537,19 @@ static UINT32 drum_read(pdp1_state *state, int field, int position) /* Write a word to drum */ -static void drum_write(pdp1_state *state, int field, int position, UINT32 data) +void pdp1_state::drum_write(int field, int position, UINT32 data) { int offset = (field*4096+position)*3; UINT8 buf[3]; - if (state->m_parallel_drum.fd) + if (m_parallel_drum.fd) { buf[0] = data >> 16; buf[1] = data >> 8; buf[2] = data; - state->m_parallel_drum.fd->fseek(offset, SEEK_SET); - state->m_parallel_drum.fd->fwrite( buf, 3); + m_parallel_drum.fd->fseek(offset, SEEK_SET); + m_parallel_drum.fd->fwrite( buf, 3); } } @@ -1581,12 +1574,12 @@ static void iot_dcc(device_t *device, int op2, int nac, int mb, int *io, int ac) { if ((state->m_parallel_drum.wfb >= 1) && (state->m_parallel_drum.wfb <= 22)) { - drum_write(state, state->m_parallel_drum.wfb-1, dc, (signed)state->m_maincpu->space(AS_PROGRAM).read_dword(state->m_parallel_drum.wcl<<2)); + state->drum_write(state->m_parallel_drum.wfb-1, dc, (signed)state->m_maincpu->space(AS_PROGRAM).read_dword(state->m_parallel_drum.wcl<<2)); } if ((state->m_parallel_drum.rfb >= 1) && (state->m_parallel_drum.rfb <= 22)) { - state->m_maincpu->space(AS_PROGRAM).write_dword(state->m_parallel_drum.wcl<<2, drum_read(state, state->m_parallel_drum.rfb-1, dc)); + state->m_maincpu->space(AS_PROGRAM).write_dword(state->m_parallel_drum.wcl<<2, state->drum_read(state->m_parallel_drum.rfb-1, dc)); } state->m_parallel_drum.wc = (state->m_parallel_drum.wc+1) & 07777; @@ -1699,9 +1692,8 @@ void pdp1_io_sc_callback(device_t *device) /* typewriter keyboard handler */ -static void pdp1_keyboard(running_machine &machine) +void pdp1_state::pdp1_keyboard() { - pdp1_state *state = machine.driver_data<pdp1_state>(); int i; int j; @@ -1713,82 +1705,81 @@ static void pdp1_keyboard(running_machine &machine) for (i=0; i<4; i++) { - typewriter_keys[i] = machine.root_device().ioport(twrnames[i])->read(); + typewriter_keys[i] = machine().root_device().ioport(twrnames[i])->read(); } for (i=0; i<4; i++) { - typewriter_transitions = typewriter_keys[i] & (~ state->m_old_typewriter_keys[i]); + typewriter_transitions = typewriter_keys[i] & (~ m_old_typewriter_keys[i]); if (typewriter_transitions) { for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++) ; - state->m_typewriter.tb = (i << 4) + j; - state->m_io_status |= io_st_tyi; + m_typewriter.tb = (i << 4) + j; + m_io_status |= io_st_tyi; #if USE_SBS - state->m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0); /* interrupt it, baby */ + m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0); /* interrupt it, baby */ #endif - state->m_maincpu->set_state_int(PDP1_PF1, 1); - pdp1_typewriter_drawchar(machine, state->m_typewriter.tb); /* we want to echo input */ + m_maincpu->set_state_int(PDP1_PF1, 1); + pdp1_typewriter_drawchar(m_typewriter.tb); /* we want to echo input */ break; } } for (i=0; i<4; i++) - state->m_old_typewriter_keys[i] = typewriter_keys[i]; + m_old_typewriter_keys[i] = typewriter_keys[i]; } -static void pdp1_lightpen(running_machine &machine) +void pdp1_state::pdp1_lightpen() { - pdp1_state *state = machine.driver_data<pdp1_state>(); int x_delta, y_delta; int current_state; - state->m_lightpen.active = (machine.root_device().ioport("CFG")->read() >> pdp1_config_lightpen_bit) & pdp1_config_lightpen_mask; + m_lightpen.active = (machine().root_device().ioport("CFG")->read() >> pdp1_config_lightpen_bit) & pdp1_config_lightpen_mask; - current_state = machine.root_device().ioport("LIGHTPEN")->read(); + current_state = machine().root_device().ioport("LIGHTPEN")->read(); /* update pen down state */ - state->m_lightpen.down = state->m_lightpen.active && (current_state & pdp1_lightpen_down); + m_lightpen.down = m_lightpen.active && (current_state & pdp1_lightpen_down); /* update size of pen tip hole */ - if ((current_state & ~state->m_old_lightpen) & pdp1_lightpen_smaller) + if ((current_state & ~m_old_lightpen) & pdp1_lightpen_smaller) { - state->m_lightpen.radius --; - if (state->m_lightpen.radius < 0) - state->m_lightpen.radius = 0; + m_lightpen.radius --; + if (m_lightpen.radius < 0) + m_lightpen.radius = 0; } - if ((current_state & ~state->m_old_lightpen) & pdp1_lightpen_larger) + if ((current_state & ~m_old_lightpen) & pdp1_lightpen_larger) { - state->m_lightpen.radius ++; - if (state->m_lightpen.radius > 32) - state->m_lightpen.radius = 32; + m_lightpen.radius ++; + if (m_lightpen.radius > 32) + m_lightpen.radius = 32; } - state->m_old_lightpen = current_state; + m_old_lightpen = current_state; /* update pen position */ - x_delta = machine.root_device().ioport("LIGHTX")->read(); - y_delta = machine.root_device().ioport("LIGHTY")->read(); + x_delta = machine().root_device().ioport("LIGHTX")->read(); + y_delta = machine().root_device().ioport("LIGHTY")->read(); if (x_delta >= 0x80) x_delta -= 0x100; if (y_delta >= 0x80) y_delta -= 256; - state->m_lightpen.x += x_delta; - state->m_lightpen.y += y_delta; + m_lightpen.x += x_delta; + m_lightpen.y += y_delta; - if (state->m_lightpen.x < 0) - state->m_lightpen.x = 0; - if (state->m_lightpen.x > 1023) - state->m_lightpen.x = 1023; - if (state->m_lightpen.y < 0) - state->m_lightpen.y = 0; - if (state->m_lightpen.y > 1023) - state->m_lightpen.y = 1023; + if (m_lightpen.x < 0) + m_lightpen.x = 0; + if (m_lightpen.x > 1023) + m_lightpen.x = 1023; + if (m_lightpen.y < 0) + m_lightpen.y = 0; + if (m_lightpen.y > 1023) + m_lightpen.y = 1023; - pdp1_update_lightpen_state(machine, &state->m_lightpen); + pdp1_update_lightpen_state(&m_lightpen); } /* @@ -1931,10 +1922,10 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) m_old_tw_keys = 0; m_old_ta_keys = 0; - pdp1_keyboard(machine()); + pdp1_keyboard(); } - pdp1_lightpen(machine()); + pdp1_lightpen(); } diff --git a/src/mess/drivers/samcoupe.c b/src/mess/drivers/samcoupe.c index ebc860540f2..ef1bb9e9caf 100644 --- a/src/mess/drivers/samcoupe.c +++ b/src/mess/drivers/samcoupe.c @@ -228,7 +228,7 @@ READ8_MEMBER(samcoupe_state::samcoupe_keyboard_r) /* if no key has been pressed, return the mouse state */ if (data == 0x1f) - data = samcoupe_mouse_r(machine()); + data = samcoupe_mouse_r(); } /* bit 5, lightpen strobe */ @@ -330,22 +330,20 @@ TIMER_CALLBACK_MEMBER(samcoupe_state::irq_off) } -void samcoupe_irq(device_t *device, UINT8 src) +void samcoupe_state::samcoupe_irq(UINT8 src) { - samcoupe_state *state = device->machine().driver_data<samcoupe_state>(); - /* assert irq and a timer to set it off again */ - device->execute().set_input_line(0, ASSERT_LINE); - device->machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(samcoupe_state::irq_off),state), src); + m_maincpu->set_input_line(0, ASSERT_LINE); + machine().scheduler().timer_set(attotime::from_usec(20), timer_expired_delegate(FUNC(samcoupe_state::irq_off),this), src); /* adjust STATUS register */ - state->m_status &= ~src; + m_status &= ~src; } INTERRUPT_GEN_MEMBER(samcoupe_state::samcoupe_frame_interrupt) { /* signal frame interrupt */ - samcoupe_irq(&device, SAM_FRAME_INT); + samcoupe_irq(SAM_FRAME_INT); } diff --git a/src/mess/drivers/sitcom.c b/src/mess/drivers/sitcom.c index f2cddc65ce9..251bbe50706 100644 --- a/src/mess/drivers/sitcom.c +++ b/src/mess/drivers/sitcom.c @@ -51,6 +51,8 @@ public: DECLARE_WRITE_LINE_MEMBER(sod_led); DECLARE_READ_LINE_MEMBER(sid_line); virtual void machine_reset(); + DECLARE_WRITE16_MEMBER(sitcom_update_ds0); + DECLARE_WRITE16_MEMBER(sitcom_update_ds1); }; static ADDRESS_MAP_START( sitcom_mem, AS_PROGRAM, 8, sitcom_state ) @@ -81,24 +83,24 @@ void sitcom_state::machine_reset() dl1416_cu_w(m_ds1, 1); } -void sitcom_update_ds0(device_t *device, int digit, int data) +WRITE16_MEMBER(sitcom_state::sitcom_update_ds0) { - output_set_digit_value(digit, data); + output_set_digit_value(offset, data); } -void sitcom_update_ds1(device_t *device, int digit, int data) +WRITE16_MEMBER(sitcom_state::sitcom_update_ds1) { - output_set_digit_value(4 + digit, data); + output_set_digit_value(4 + offset, data); } const dl1416_interface sitcom_ds0_intf = { - sitcom_update_ds0 + DEVCB_DRIVER_MEMBER16(sitcom_state, sitcom_update_ds0) }; const dl1416_interface sitcom_ds1_intf = { - sitcom_update_ds1 + DEVCB_DRIVER_MEMBER16(sitcom_state, sitcom_update_ds1) }; // SID line used as serial input from a pc diff --git a/src/mess/drivers/ssystem3.c b/src/mess/drivers/ssystem3.c index c76514523ea..984de853d93 100644 --- a/src/mess/drivers/ssystem3.c +++ b/src/mess/drivers/ssystem3.c @@ -42,78 +42,74 @@ backup of playfield rom and picture/description of its board // in my opinion own cpu to display lcd field and to handle own buttons -void ssystem3_playfield_getfigure(running_machine &machine, int x, int y, int *figure, int *black) +void ssystem3_state::ssystem3_playfield_getfigure(int x, int y, int *figure, int *black) { - ssystem3_state *state = machine.driver_data<ssystem3_state>(); int d; if (x&1) - d=state->m_playfield.u.s.field[y][x/2]&0xf; + d=m_playfield.u.s.field[y][x/2]&0xf; else - d=state->m_playfield.u.s.field[y][x/2]>>4; + d=m_playfield.u.s.field[y][x/2]>>4; *figure=d&7; *black=d&8; } -static void ssystem3_playfield_reset(running_machine &machine) +void ssystem3_state::ssystem3_playfield_reset() { - ssystem3_state *state = machine.driver_data<ssystem3_state>(); - memset(&state->m_playfield, 0, sizeof(state->m_playfield)); - state->m_playfield.signal=FALSE; - // state->m_playfield.on=TRUE; //machine.root_device().ioport("Configuration")->read()&1; + memset(&m_playfield, 0, sizeof(m_playfield)); + m_playfield.signal=FALSE; + // m_playfield.on=TRUE; //machine().root_device().ioport("Configuration")->read()&1; } -static void ssystem3_playfield_write(running_machine &machine, int reset, int signal) +void ssystem3_state::ssystem3_playfield_write(int reset, int signal) { - ssystem3_state *state = machine.driver_data<ssystem3_state>(); int d=FALSE; if (!reset) { - state->m_playfield.count=0; - state->m_playfield.bit=0; - state->m_playfield.started=FALSE; - state->m_playfield.signal=signal; - state->m_playfield.time=machine.time(); + m_playfield.count=0; + m_playfield.bit=0; + m_playfield.started=FALSE; + m_playfield.signal=signal; + m_playfield.time=machine().time(); } - if (!signal && state->m_playfield.signal) { - attotime t=machine.time(); - state->m_playfield.high_time=t - state->m_playfield.time; - state->m_playfield.time=t; + if (!signal && m_playfield.signal) { + attotime t=machine().time(); + m_playfield.high_time=t - m_playfield.time; + m_playfield.time=t; - // logerror("%.4x playfield %d lowtime %s hightime %s\n",(int)activecpu_get_pc(), state->m_playfield.count, - // state->m_playfield.low_time.as_string(7), state->m_playfield.high_time.as_string(7) ); + // logerror("%.4x playfield %d lowtime %s hightime %s\n",(int)activecpu_get_pc(), m_playfield.count, + // m_playfield.low_time.as_string(7), m_playfield.high_time.as_string(7) ); - if (state->m_playfield.started) { + if (m_playfield.started) { // 0 twice as long low // 1 twice as long high - if (state->m_playfield.low_time > state->m_playfield.high_time) d=TRUE; - - state->m_playfield.data&=~(1<<(state->m_playfield.bit^7)); - if (d) state->m_playfield.data|=1<<(state->m_playfield.bit^7); - state->m_playfield.bit++; - if (state->m_playfield.bit==8) { - logerror("%.4x playfield wrote %d %02x\n", (int)machine.device("maincpu")->safe_pc(), state->m_playfield.count, state->m_playfield.data); - state->m_playfield.u.data[state->m_playfield.count]=state->m_playfield.data; - state->m_playfield.bit=0; - state->m_playfield.count=(state->m_playfield.count+1)%ARRAY_LENGTH(state->m_playfield.u.data); - if (state->m_playfield.count==0) state->m_playfield.started=FALSE; + if (m_playfield.low_time > m_playfield.high_time) d=TRUE; + + m_playfield.data&=~(1<<(m_playfield.bit^7)); + if (d) m_playfield.data|=1<<(m_playfield.bit^7); + m_playfield.bit++; + if (m_playfield.bit==8) { + logerror("%.4x playfield wrote %d %02x\n", (int)machine().device("maincpu")->safe_pc(), m_playfield.count, m_playfield.data); + m_playfield.u.data[m_playfield.count]=m_playfield.data; + m_playfield.bit=0; + m_playfield.count=(m_playfield.count+1)%ARRAY_LENGTH(m_playfield.u.data); + if (m_playfield.count==0) m_playfield.started=FALSE; } } - } else if (signal && !state->m_playfield.signal) { - attotime t=machine.time(); - state->m_playfield.low_time= t - state->m_playfield.time; - state->m_playfield.time=t; - state->m_playfield.started=TRUE; + } else if (signal && !m_playfield.signal) { + attotime t=machine().time(); + m_playfield.low_time= t - m_playfield.time; + m_playfield.time=t; + m_playfield.started=TRUE; } - state->m_playfield.signal=signal; + m_playfield.signal=signal; } -static void ssystem3_playfield_read(running_machine &machine, int *on, int *ready) +void ssystem3_state::ssystem3_playfield_read(int *on, int *ready) { - //ssystem3_state *state = machine.driver_data<ssystem3_state>(); - *on=!(machine.root_device().ioport("Configuration")->read()&1); - // *on=!state->m_playfield.on; + *on=!(machine().root_device().ioport("Configuration")->read()&1); + // *on=!m_playfield.on; *ready=FALSE; } @@ -191,7 +187,7 @@ READ8_MEMBER(ssystem3_state::ssystem3_via_read_b) { UINT8 data=0xff; int on, ready; - ssystem3_playfield_read(machine(), &on, &ready); + ssystem3_playfield_read(&on, &ready); if (!on) data&=~0x20; if (!ready) data&=~0x10; return data; @@ -202,8 +198,8 @@ WRITE8_MEMBER(ssystem3_state::ssystem3_via_write_b) via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); UINT8 d; - ssystem3_playfield_write(machine(), data&1, data&8); - ssystem3_lcd_write(machine(), data&4, data&2); + ssystem3_playfield_write(data&1, data&8); + ssystem3_lcd_write(data&4, data&2); d=ssystem3_via_read_b(space, 0, mem_mask)&~0x40; if (data&0x80) d|=0x40; @@ -228,8 +224,8 @@ static const via6522_interface ssystem3_via_config= DRIVER_INIT_MEMBER(ssystem3_state,ssystem3) { - ssystem3_playfield_reset(machine()); - ssystem3_lcd_reset(machine()); + ssystem3_playfield_reset(); + ssystem3_lcd_reset(); } static ADDRESS_MAP_START( ssystem3_map , AS_PROGRAM, 8, ssystem3_state ) diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c index 3773c48f16e..e69078bbc64 100644 --- a/src/mess/drivers/tx0.c +++ b/src/mess/drivers/tx0.c @@ -589,9 +589,9 @@ void tx0_readtape_image_device::call_unload() /* Read a byte from perforated tape */ -static int tape_read(tx0_state *state, UINT8 *reply) +int tx0_state::tape_read(UINT8 *reply) { - if (state->m_tape_reader.fd && (state->m_tape_reader.fd->fread(reply, 1) == 1)) + if (m_tape_reader.fd && (m_tape_reader.fd->fread(reply, 1) == 1)) return 0; /* unit OK */ else return 1; /* unit not ready */ @@ -600,29 +600,29 @@ static int tape_read(tx0_state *state, UINT8 *reply) /* Write a byte to perforated tape */ -static void tape_write(tx0_state *state, UINT8 data) +void tx0_state::tape_write(UINT8 data) { - if (state->m_tape_puncher.fd) - state->m_tape_puncher.fd->fwrite(& data, 1); + if (m_tape_puncher.fd) + m_tape_puncher.fd->fwrite(& data, 1); } /* common code for tape read commands (R1C, R3C, and read-in mode) */ -static void begin_tape_read(tx0_state *state, int binary) +void tx0_state::begin_tape_read(int binary) { - state->m_tape_reader.rcl = 1; - state->m_tape_reader.rc = (binary) ? 1 : 3; + m_tape_reader.rcl = 1; + m_tape_reader.rc = (binary) ? 1 : 3; /* set up delay if tape is advancing */ - if (state->m_tape_reader.motor_on && state->m_tape_reader.rcl) + if (m_tape_reader.motor_on && m_tape_reader.rcl) { /* delay is approximately 1/400s */ - state->m_tape_reader.timer->adjust(attotime::from_usec(2500)); + m_tape_reader.timer->adjust(attotime::from_usec(2500)); } else { - state->m_tape_reader.timer->enable(0); + m_tape_reader.timer->enable(0); } } @@ -638,7 +638,7 @@ TIMER_CALLBACK_MEMBER(tx0_state::reader_callback) if (m_tape_reader.rc) { - not_ready = tape_read(this, & data); + not_ready = tape_read( & data); if (not_ready) { m_tape_reader.motor_on = 0; /* let us stop the motor */ @@ -706,7 +706,7 @@ TIMER_CALLBACK_MEMBER(tx0_state::puncher_callback) static void tx0_io_r1l(device_t *device) { tx0_state *state = device->machine().driver_data<tx0_state>(); - begin_tape_read(state, 0); + state->begin_tape_read( 0); } /* @@ -715,7 +715,7 @@ static void tx0_io_r1l(device_t *device) static void tx0_io_r3l(device_t *device) { tx0_state *state = device->machine().driver_data<tx0_state>(); - begin_tape_read(state, 1); + state->begin_tape_read(1); } /* @@ -729,7 +729,7 @@ static void tx0_io_p6h(device_t *device) /* read current AC */ ac = device->state().state_int(TX0_AC); /* shuffle and punch 6-bit word */ - tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5)); + state->tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5)); state->m_tape_puncher.timer->adjust(attotime::from_usec(15800)); } @@ -745,7 +745,7 @@ static void tx0_io_p7h(device_t *device) /* read current AC */ ac = device->state().state_int(TX0_AC); /* shuffle and punch 6-bit word */ - tape_write(state, ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100); + state->tape_write(((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5) | 0100); state->m_tape_puncher.timer->adjust(attotime::from_usec(15800)); } @@ -779,12 +779,11 @@ void tx0_printer_image_device::call_unload() /* Write a character to typewriter */ -static void typewriter_out(running_machine &machine, UINT8 data) +void tx0_state::typewriter_out(UINT8 data) { - tx0_state *state = machine.driver_data<tx0_state>(); - tx0_typewriter_drawchar(machine, data); - if (state->m_typewriter.fd) - state->m_typewriter.fd->fwrite(& data, 1); + tx0_typewriter_drawchar(data); + if (m_typewriter.fd) + m_typewriter.fd->fwrite(& data, 1); } /* @@ -808,7 +807,7 @@ static void tx0_io_prt(device_t *device) ac = device->state().state_int(TX0_AC); /* shuffle and print 6-bit word */ ch = ((ac & 0100000) >> 15) | ((ac & 0010000) >> 11) | ((ac & 0001000) >> 7) | ((ac & 0000100) >> 3) | ((ac & 0000010) << 1) | ((ac & 0000001) << 5); - typewriter_out(device->machine(), ch); + state->typewriter_out(ch); state->m_typewriter.prt_timer->adjust(attotime::from_msec(100)); } @@ -835,7 +834,7 @@ static void tx0_io_dis(device_t *device) ac = device->state().state_int(TX0_AC); x = ac >> 9; y = ac & 0777; - tx0_plot(device->machine(), x, y); + state->tx0_plot(x, y); state->m_dis_timer->adjust(attotime::from_usec(50)); } @@ -851,11 +850,11 @@ static void tx0_io_dis(device_t *device) */ -static void schedule_select(tx0_state *state) +void tx0_state::schedule_select() { attotime delay = attotime::zero; - switch (state->m_magtape.command) + switch (m_magtape.command) { case 0: /* backspace */ delay = attotime::from_usec(4600); @@ -870,14 +869,14 @@ static void schedule_select(tx0_state *state) delay = attotime::from_usec(4600); break; } - state->m_magtape.timer->adjust(delay); + m_magtape.timer->adjust(delay); } -static void schedule_unselect(tx0_state *state) +void tx0_state::schedule_unselect() { attotime delay = attotime::zero; - switch (state->m_magtape.command) + switch (m_magtape.command) { case 0: /* backspace */ delay = attotime::from_usec(5750); @@ -892,7 +891,7 @@ static void schedule_unselect(tx0_state *state) delay = attotime::from_usec(5750); break; } - state->m_magtape.timer->adjust(delay); + m_magtape.timer->adjust(delay); } void tx0_magtape_image_device::device_start() @@ -918,7 +917,7 @@ bool tx0_magtape_image_device::call_load() if (state->m_magtape.timer) { if (state->m_magtape.state == MTS_SELECTING) - schedule_select(state); + state->schedule_select(); } return IMAGE_INIT_PASS; @@ -938,7 +937,7 @@ void tx0_magtape_image_device::call_unload() { /* unit has become unavailable */ state->m_magtape.state = MTS_UNSELECTING; state->m_maincpu->set_state_int(TX0_PF, state->m_maincpu->state_int(TX0_PF) | PF_RWC); - schedule_unselect(state); + state->schedule_unselect(); } } } @@ -975,7 +974,7 @@ static void magtape_callback(device_t *device) state->m_magtape.binary_flag = (mar & 020 >> 4); if (state->m_magtape.img) - schedule_select(state); + state->schedule_select(); } state->m_magtape.sel_pending = FALSE; @@ -1023,7 +1022,7 @@ static void magtape_callback(device_t *device) { /* tape at ldp */ state->m_magtape.state = MTS_UNSELECTING; device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_RWC); - schedule_unselect(state); + state->schedule_unselect(); } else if (state->m_magtape.img->fseek( -1, SEEK_CUR)) { /* eject tape */ @@ -1092,7 +1091,7 @@ static void magtape_callback(device_t *device) /* set EOR and unselect... */ state->m_magtape.state = MTS_UNSELECTING; device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOR); - schedule_unselect(state); + state->schedule_unselect(); state->m_magtape.irg_pos = MTIRGP_ENDMINUS1; } else @@ -1148,7 +1147,7 @@ static void magtape_callback(device_t *device) /* Or do we stop at EOT mark??? */ state->m_magtape.state = MTS_UNSELECTING; device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOT); - schedule_unselect(state); + state->schedule_unselect(); } } else @@ -1276,7 +1275,7 @@ static void magtape_callback(device_t *device) /* set EOR and unselect... */ state->m_magtape.state = MTS_UNSELECTING; device->state().set_state_int(TX0_PF, device->state().state_int(TX0_PF) | PF_EOR); - schedule_unselect(state); + state->schedule_unselect(); state->m_magtape.irg_pos = MTIRGP_START; break; } @@ -1362,7 +1361,7 @@ static void magtape_callback(device_t *device) else { state->m_magtape.state = MTS_UNSELECTING; - schedule_unselect(state); + state->schedule_unselect(); state->m_magtape.irg_pos = MTIRGP_END; } break; @@ -1453,9 +1452,8 @@ static void tx0_io_reset_callback(device_t *device) /* typewriter keyboard handler */ -static void tx0_keyboard(running_machine &machine) +void tx0_state::tx0_keyboard() { - tx0_state *state = machine.driver_data<tx0_state>(); int i; int j; @@ -1467,12 +1465,12 @@ static void tx0_keyboard(running_machine &machine) for (i=0; i<4; i++) { - typewriter_keys[i] = machine.root_device().ioport(twrnames[i])->read(); + typewriter_keys[i] = machine().root_device().ioport(twrnames[i])->read(); } for (i=0; i<4; i++) { - typewriter_transitions = typewriter_keys[i] & (~ state->m_old_typewriter_keys[i]); + typewriter_transitions = typewriter_keys[i] & (~ m_old_typewriter_keys[i]); if (typewriter_transitions) { for (j=0; (((typewriter_transitions >> j) & 1) == 0) /*&& (j<16)*/; j++) @@ -1483,14 +1481,14 @@ static void tx0_keyboard(running_machine &machine) previous LR */ lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); /* write modified LR */ - machine.device("maincpu")->state().set_state_int(TX0_LR, lr); - tx0_typewriter_drawchar(machine, charcode); /* we want to echo input */ + machine().device("maincpu")->state().set_state_int(TX0_LR, lr); + tx0_typewriter_drawchar(charcode); /* we want to echo input */ break; } } for (i=0; i<4; i++) - state->m_old_typewriter_keys[i] = typewriter_keys[i]; + m_old_typewriter_keys[i] = typewriter_keys[i]; } /* @@ -1592,7 +1590,7 @@ INTERRUPT_GEN_MEMBER(tx0_state::tx0_interrupt) m_old_control_keys = 0; m_old_tsr_keys = 0; - tx0_keyboard(machine()); + tx0_keyboard(); } } diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index d7f160e1e18..fb17b0bdabe 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -467,7 +467,7 @@ void x1_state::draw_fgtilemap(running_machine &machine, bitmap_rgb32 &bitmap,con * of the bitmap. * */ -static int priority_mixer_pri(running_machine &machine,int color) +int x1_state::priority_mixer_pri(int color) { int pri_i,pri_mask_calc; @@ -521,7 +521,7 @@ void x1_state::draw_gfxbitmap(running_machine &machine, bitmap_rgb32 &bitmap,con color = (pen_g<<2 | pen_r<<1 | pen_b<<0) | 8; - pri_mask_val = priority_mixer_pri(machine,color); + pri_mask_val = priority_mixer_pri(color); if(pri_mask_val & pri) continue; if((color == 8 && m_scrn_reg.blackclip & 0x10) || (color == 9 && m_scrn_reg.blackclip & 0x20)) // bitmap color clip to black conditions @@ -742,9 +742,8 @@ READ8_MEMBER( x1_state::x1_sub_io_r ) return ret; } -static void cmt_command( running_machine &machine, UINT8 cmd ) +void x1_state::cmt_command( UINT8 cmd ) { - x1_state *state = machine.driver_data<x1_state>(); // CMT deck control command (E9 xx) // E9 00 - Eject // E9 01 - Stop @@ -758,47 +757,47 @@ static void cmt_command( running_machine &machine, UINT8 cmd ) APSS is a Sharp invention and stands for Automatic Program Search System, it scans the tape for silent parts that are bigger than 4 seconds. It's basically used for audio tapes in order to jump over the next/previous "track". */ - state->m_cmt_current_cmd = cmd; + m_cmt_current_cmd = cmd; - if(state->m_cassette->get_image() == NULL) //avoid a crash if a disk game tries to access this + if(m_cassette->get_image() == NULL) //avoid a crash if a disk game tries to access this return; switch(cmd) { case 0x01: // Stop - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); - state->m_cmt_test = 1; + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cmt_test = 1; popmessage("CMT: Stop"); break; case 0x02: // Play - state->m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); + m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE); popmessage("CMT: Play"); break; case 0x03: // Fast Forward - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); popmessage("CMT: Fast Forward"); break; case 0x04: // Rewind - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); popmessage("CMT: Rewind"); break; case 0x05: // APSS Fast Forward - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); popmessage("CMT: APSS Fast Forward"); break; case 0x06: // APSS Rewind - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE); popmessage("CMT: APSS Rewind"); break; case 0x0a: // Record - state->m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); - state->m_cassette->change_state(CASSETTE_RECORD,CASSETTE_MASK_UISTATE); + m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_RECORD,CASSETTE_MASK_UISTATE); popmessage("CMT: Record"); break; default: @@ -818,13 +817,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_cmt_wind_timer) case 0x05: // Fast Forwarding tape m_cassette->seek(1,SEEK_CUR); if(m_cassette->get_position() >= m_cassette->get_length()) // at end? - cmt_command(machine(),0x01); // Stop tape + cmt_command(0x01); // Stop tape break; case 0x04: case 0x06: // Rewinding tape m_cassette->seek(-1,SEEK_CUR); if(m_cassette->get_position() <= 0) // at beginning? - cmt_command(machine(),0x01); // Stop tape + cmt_command(0x01); // Stop tape break; } } @@ -847,7 +846,7 @@ WRITE8_MEMBER( x1_state::x1_sub_io_w ) if(m_sub_cmd == 0xe9) { - cmt_command(machine(),data); + cmt_command(data); data = 0; } @@ -1424,7 +1423,7 @@ WRITE8_MEMBER( x1_state::x1turbo_gfxpal_w ) * FIXME: bit-wise this doesn't make any sense, I guess that it uses the lv 2 kanji roms * Test cases for this port so far are Hyper Olympics '84 disk version and Might & Magic. */ -static UINT16 jis_convert(int kanji_addr) +UINT16 x1_state::jis_convert(int kanji_addr) { if(kanji_addr >= 0x0e00 && kanji_addr <= 0x0e9f) { kanji_addr -= 0x0e00; kanji_addr &= 0x0ff; return ((0x0e0) + (kanji_addr >> 3)) << 4; } // numbers if(kanji_addr >= 0x0f00 && kanji_addr <= 0x109f) { kanji_addr -= 0x0f00; kanji_addr &= 0x1ff; return ((0x4c0) + (kanji_addr >> 3)) << 4; } // lower case chars diff --git a/src/mess/drivers/x68k.c b/src/mess/drivers/x68k.c index 7cf97dd606d..8e0839d78dd 100644 --- a/src/mess/drivers/x68k.c +++ b/src/mess/drivers/x68k.c @@ -145,7 +145,7 @@ // MFP is clocked at 4MHz, so at /4 prescaler the timer is triggered after 1us (4 cycles) // No longer necessary with the new MFP core #ifdef UNUSED_FUNCTION -static attotime prescale(int val) +attotime x68k_state::prescale(int val) { switch(val) { @@ -229,26 +229,25 @@ TIMER_CALLBACK_MEMBER(x68k_state::mfp_update_irq) } } -void mfp_trigger_irq(running_machine &machine, int irq) +void x68k_state::mfp_trigger_irq(int irq) { - x68k_state *state = machine.driver_data<x68k_state>(); // check if interrupt is enabled if(irq > 7) { - if(!(state->m_mfp.iera & (1 << (irq-8)))) + if(!(m_mfp.iera & (1 << (irq-8)))) return; // not enabled, no action taken } else { - if(!(state->m_mfp.ierb & (1 << irq))) + if(!(m_mfp.ierb & (1 << irq))) return; // not enabled, no action taken } // set requested IRQ as pending if(irq > 7) - state->m_mfp.ipra |= (1 << (irq-8)); + m_mfp.ipra |= (1 << (irq-8)); else - state->m_mfp.iprb |= (1 << irq); + m_mfp.iprb |= (1 << irq); // check for IRQs to be called // mfp_update_irq(0); @@ -295,7 +294,7 @@ TIMER_CALLBACK_MEMBER(x68k_state::mfp_timer_d_callback) } } -void mfp_set_timer(int timer, unsigned char data) +void x68k_state::mfp_set_timer(int timer, unsigned char data) { if((data & 0x07) == 0x0000) { // Timer stop @@ -506,13 +505,12 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_keyboard_poll) #ifdef UNUSED_FUNCTION -void mfp_recv_data(int data) +void x68k_state::mfp_recv_data(int data) { - x68k_state *state = machine.driver_data<x68k_state>(); - state->m_mfp.rsr |= 0x80; // Buffer full - state->m_mfp.tsr |= 0x80; - state->m_mfp.usart.recv_buffer = 0x00; // TODO: set up keyboard data - state->m_mfp.vector = state->m_current_vector[6] = (state->m_mfp.vr & 0xf0) | 0x0c; + m_mfp.rsr |= 0x80; // Buffer full + m_mfp.tsr |= 0x80; + m_mfp.usart.recv_buffer = 0x00; // TODO: set up keyboard data + m_mfp.vector = m_current_vector[6] = (m_mfp.vr & 0xf0) | 0x0c; // mfp_trigger_irq(MFP_IRQ_RX_FULL); // logerror("MFP: Receive buffer full IRQ sent\n"); } diff --git a/src/mess/includes/a7800.h b/src/mess/includes/a7800.h index d287de860fc..0a7ba48a951 100644 --- a/src/mess/includes/a7800.h +++ b/src/mess/includes/a7800.h @@ -113,6 +113,8 @@ protected: memory_bank *m_bank11; void maria_draw_scanline(); + int a7800_verify_cart(char header[128]); + UINT16 a7800_get_pcb_id(const char *pcb); }; /*----------- defined in machine/a7800.c -----------*/ diff --git a/src/mess/includes/aim65.h b/src/mess/includes/aim65.h index 23c6155f5d5..5a16a6164e8 100644 --- a/src/mess/includes/aim65.h +++ b/src/mess/includes/aim65.h @@ -58,16 +58,14 @@ public: required_device<cassette_image_device> m_cassette2; virtual void machine_start(); TIMER_CALLBACK_MEMBER(aim65_printer_timer); + void aim65_pia(); + + DECLARE_WRITE16_MEMBER(aim65_update_ds1); + DECLARE_WRITE16_MEMBER(aim65_update_ds2); + DECLARE_WRITE16_MEMBER(aim65_update_ds3); + DECLARE_WRITE16_MEMBER(aim65_update_ds4); + DECLARE_WRITE16_MEMBER(aim65_update_ds5); }; -/*----------- defined in machine/aim65.c -----------*/ - -void aim65_update_ds1(device_t *device, int digit, int data); -void aim65_update_ds2(device_t *device, int digit, int data); -void aim65_update_ds3(device_t *device, int digit, int data); -void aim65_update_ds4(device_t *device, int digit, int data); -void aim65_update_ds5(device_t *device, int digit, int data); - - #endif /* AIM65_H_ */ diff --git a/src/mess/includes/amstrad.h b/src/mess/includes/amstrad.h index 83b856f50fe..8e75aa36252 100644 --- a/src/mess/includes/amstrad.h +++ b/src/mess/includes/amstrad.h @@ -288,6 +288,7 @@ protected: void kccomp_reset_machine(); void update_psg(); void amstrad_common_init(); + unsigned char kccomp_get_colour_element(int colour_value); }; diff --git a/src/mess/includes/apple1.h b/src/mess/includes/apple1.h index a13ccce1cbf..0f9b050d0c1 100644 --- a/src/mess/includes/apple1.h +++ b/src/mess/includes/apple1.h @@ -60,6 +60,25 @@ public: DECLARE_WRITE8_MEMBER(apple1_pia0_dsp_write_signal); required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; + void terminal_draw(bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal); + void verify_coords(terminal_t *terminal, int x, int y); + void terminal_putchar(terminal_t *terminal, int x, int y, int ch); + int terminal_getchar(terminal_t *terminal, int x, int y); + void terminal_putblank(terminal_t *terminal, int x, int y); + void terminal_dirtycursor(terminal_t *terminal); + void terminal_setcursor(terminal_t *terminal, int x, int y); + void terminal_hidecursor(terminal_t *terminal); + void terminal_showcursor(terminal_t *terminal); + void terminal_getcursor(terminal_t *terminal, int *x, int *y); + void terminal_fill(terminal_t *terminal, int val); + void terminal_clear(terminal_t *terminal); + void apple1_vh_dsp_w (int data); + void apple1_vh_dsp_clr (); + void apple1_vh_cursor_blink (); + int apple1_verify_header (UINT8 *data); + void cassette_toggle_output(); + terminal_t *terminal_create(int gfx, int blank_char, int char_bits,int (*getcursorcode)(int original_code),int num_cols, int num_rows); + attotime apple1_vh_dsp_time_to_ready(); }; @@ -68,12 +87,6 @@ public: extern const pia6821_interface apple1_pia0; SNAPSHOT_LOAD( apple1 ); -/*----------- defined in video/apple1.c -----------*/ -void apple1_vh_dsp_w (running_machine &machine, int data); -void apple1_vh_dsp_clr (running_machine &machine); -attotime apple1_vh_dsp_time_to_ready (running_machine &machine); - - /*----------- defined in drivers/apple1.c -----------*/ extern const gfx_layout apple1_charlayout; diff --git a/src/mess/includes/apple2.h b/src/mess/includes/apple2.h index 9b9ddb117df..3f82586695b 100644 --- a/src/mess/includes/apple2.h +++ b/src/mess/includes/apple2.h @@ -336,43 +336,26 @@ public: virtual void machine_reset(); void apple2_setup_memory(const apple2_memmap_config *config); void apple2_update_memory(); + inline UINT32 effective_a2(); + UINT32 compute_video_address(int col, int row); + void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow); + inline void apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, + const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2); + void apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); + void apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); + void apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow); + void apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo); + void apple2_setvar(UINT32 val, UINT32 mask); + UINT8 apple2_getfloatingbusvalue(); + int apple2_fdc_has_35(); + int apple2_fdc_has_525(); + void apple2_iwm_setdiskreg(UINT8 data); + void apple2_init_common(); + INT8 apple2_slotram_r(address_space &space, int slotnum, int offset); }; - - /*----------- defined in drivers/apple2.c -----------*/ - INPUT_PORTS_EXTERN( apple2ep ); - - - /*----------- defined in machine/apple2.c -----------*/ - extern const applefdc_interface apple2_fdc_interface; -void apple2_iwm_setdiskreg(running_machine &machine, UINT8 data); -UINT8 apple2_iwm_getdiskreg(running_machine &machine); - -void apple2_init_common(running_machine &machine); - - - - - -UINT8 apple2_getfloatingbusvalue(running_machine &machine); -DECLARE_READ8_HANDLER( apple2_c0xx_r ); -DECLARE_WRITE8_HANDLER( apple2_c0xx_w ); -DECLARE_READ8_HANDLER( apple2_c080_r ); -DECLARE_WRITE8_HANDLER( apple2_c080_w ); - -INT8 apple2_slotram_r(running_machine &machine, int slotnum, int offset); - -void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask); - -int apple2_pressed_specialkey(running_machine &machine, UINT8 key); - -/*----------- defined in video/apple2.c -----------*/ - -void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo); - - #endif /* APPLE2_H_ */ diff --git a/src/mess/includes/apple2gs.h b/src/mess/includes/apple2gs.h index 39fccfd79b0..53fd104bc8c 100644 --- a/src/mess/includes/apple2gs.h +++ b/src/mess/includes/apple2gs.h @@ -215,6 +215,29 @@ public: DECLARE_WRITE8_MEMBER(adbmicro_p2_out); DECLARE_WRITE8_MEMBER(adbmicro_p3_out); #endif + void process_clock(); + const char *apple2gs_irq_name(UINT16 irq_mask); + void apple2gs_add_irq(UINT16 irq_mask); + void apple2gs_remove_irq(UINT16 irq_mask); + UINT8 adb_read_memory(UINT32 address); + void adb_write_memory(UINT32 address, UINT8 data); + void adb_set_mode(UINT8 mode); + void adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3); + void adb_post_response(const UINT8 *bytes, size_t length); + void adb_post_response_1(UINT8 b); + void adb_post_response_2(UINT8 b1, UINT8 b2); + void adb_do_command(); + void adb_write_datareg(UINT8 data); + void adb_write_kmstatus(UINT8 data); + UINT8 adb_read_mousedata(); + INT8 seven_bit_diff(UINT8 v1, UINT8 v2); + void adb_check_mouse(); + void apple2gs_set_scanint(UINT8 data); + int apple2gs_get_vpos(); + UINT8 *apple2gs_getslotmem(offs_t address); + UINT8 apple2gs_xxCxxx_r(address_space &space, offs_t address); + void apple2gs_xxCxxx_w(address_space &space, offs_t address, UINT8 data); + void apple2gs_setup_memory(); }; diff --git a/src/mess/includes/apple3.h b/src/mess/includes/apple3.h index 913a04f07ac..1ee5ce924cf 100644 --- a/src/mess/includes/apple3.h +++ b/src/mess/includes/apple3.h @@ -68,6 +68,22 @@ public: DECLARE_WRITE8_MEMBER(apple3_via_1_out_a); DECLARE_WRITE8_MEMBER(apple3_via_1_out_b); DECLARE_WRITE_LINE_MEMBER(apple2_via_1_irq_func); + void apple3_write_charmem(); + void apple3_video_text40(bitmap_ind16 &bitmap); + void apple3_video_text80(bitmap_ind16 &bitmap); + void apple3_video_graphics_hgr(bitmap_ind16 &bitmap); + UINT8 swap_bits(UINT8 b); + void apple3_video_graphics_chgr(bitmap_ind16 &bitmap); + void apple3_video_graphics_shgr(bitmap_ind16 &bitmap); + void apple3_video_graphics_chires(bitmap_ind16 &bitmap); + void apple3_profile_init(void); + void apple3_profile_statemachine(void); + UINT8 *apple3_bankaddr(UINT16 bank, offs_t offset); + void apple3_setbank(const char *mame_bank, UINT16 bank, offs_t offset); + UINT8 *apple3_get_zpa_addr(offs_t offset); + void apple3_update_memory(); + void apple3_via_out(UINT8 *var, UINT8 data); + UINT8 *apple3_get_indexed_addr(offs_t offset); }; @@ -77,9 +93,4 @@ extern const applefdc_interface apple3_fdc_interface; extern const via6522_interface apple3_via_0_intf; extern const via6522_interface apple3_via_1_intf; -/*----------- defined in video/apple3.c -----------*/ - -void apple3_write_charmem(running_machine &machine); - - #endif /* APPLE3_H_ */ diff --git a/src/mess/includes/at.h b/src/mess/includes/at.h index ab1be613668..5e7773c5f48 100644 --- a/src/mess/includes/at.h +++ b/src/mess/includes/at.h @@ -186,6 +186,7 @@ public: DECLARE_MACHINE_RESET(at); void pc_set_dma_channel(int channel, int state); IRQ_CALLBACK_MEMBER(at_irq_callback); + void init_at_common(); }; diff --git a/src/mess/includes/b2m.h b/src/mess/includes/b2m.h index 643c94a4fd0..ea3bc1711fb 100644 --- a/src/mess/includes/b2m.h +++ b/src/mess/includes/b2m.h @@ -68,6 +68,7 @@ public: DECLARE_FLOPPY_FORMATS( b2m_floppy_formats ); IRQ_CALLBACK_MEMBER(b2m_irq_callback); void b2m_postload(); + void b2m_set_bank(int bank); }; /*----------- defined in machine/b2m.c -----------*/ diff --git a/src/mess/includes/bbc.h b/src/mess/includes/bbc.h index 65db6da690e..4499f6c2ff3 100644 --- a/src/mess/includes/bbc.h +++ b/src/mess/includes/bbc.h @@ -338,6 +338,24 @@ protected: void bbcbp_setvideoshadow(int vdusel); void common_init(int memorySize); void set_pixel_lookup(); + void set_cursor(bbc_state *state); + void BBC_Clock_CR(bbc_state *state); + void BBC_draw_teletext(); + void BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels); + void BBC_draw_hi_res(); + void BBC_Set_HSync(int offset, int data); + void BBC_Set_VSync(int offset, int data); + void BBC_Set_CRE(int offset, int data); + void bbc_frameclock(); + int vdudriverset(); + int bbcm_vdudriverset(); + int bbc_keyboard(address_space &space, int data); + void bbcb_IC32_initialise(bbc_state *state); + void MC146818_set(address_space &space); + void bbc_TMSint(int status); + void MC6850_Receive_Clock(int new_clock); + void BBC_Cassette_motor(unsigned char status); + void bbc_update_fdq_int(int state); }; diff --git a/src/mess/includes/busicom.h b/src/mess/includes/busicom.h index 1ae7f4fb423..003bdfa77d1 100644 --- a/src/mess/includes/busicom.h +++ b/src/mess/includes/busicom.h @@ -34,6 +34,7 @@ public: UINT32 screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(timer_callback); required_device<cpu_device> m_maincpu; + UINT8 get_bit_selected(UINT32 val,int num); }; #endif /* BUSICOM_H_ */ diff --git a/src/mess/includes/cgenie.h b/src/mess/includes/cgenie.h index 4b3252993a8..aa164a378da 100644 --- a/src/mess/includes/cgenie.h +++ b/src/mess/includes/cgenie.h @@ -82,6 +82,13 @@ public: DECLARE_WRITE8_MEMBER(cgenie_sh_control_port_w); required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; + void cgenie_offset_xy(); + int cgenie_get_register(int indx); + void cgenie_mode_select(int mode); + void cgenie_refresh_monitor(bitmap_ind16 &bitmap, const rectangle &cliprect); + void cgenie_refresh_tv_set(bitmap_ind16 &bitmap, const rectangle &cliprect); + int cgenie_port_xx_r( int offset ); + int cgenie_videoram_r( int offset ); }; @@ -107,7 +114,6 @@ DECLARE_WRITE8_HANDLER ( cgenie_fontram_w ); DECLARE_WRITE8_HANDLER ( cgenie_port_ff_w ); DECLARE_READ8_HANDLER ( cgenie_port_ff_r ); -int cgenie_port_xx_r(int offset); DECLARE_READ8_HANDLER ( cgenie_status_r ); DECLARE_READ8_HANDLER ( cgenie_track_r ); @@ -124,7 +130,6 @@ DECLARE_WRITE8_HANDLER ( cgenie_data_w ); DECLARE_WRITE8_HANDLER ( cgenie_motor_w ); DECLARE_READ8_HANDLER ( cgenie_keyboard_r ); -int cgenie_videoram_r(running_machine &machine,int offset); DECLARE_WRITE8_HANDLER ( cgenie_videoram_w ); @@ -139,8 +144,4 @@ DECLARE_READ8_HANDLER ( cgenie_register_r ); DECLARE_WRITE8_HANDLER ( cgenie_index_w ); DECLARE_WRITE8_HANDLER ( cgenie_register_w ); -int cgenie_get_register(running_machine &machine, int indx); -void cgenie_mode_select(running_machine &machine, int graphics); - - #endif /* CGENIE_H_ */ diff --git a/src/mess/includes/channelf.h b/src/mess/includes/channelf.h index 7b32fdcdf75..43e7d10ed4a 100644 --- a/src/mess/includes/channelf.h +++ b/src/mess/includes/channelf.h @@ -57,6 +57,7 @@ public: DECLARE_DEVICE_IMAGE_LOAD_MEMBER( channelf_cart ); required_device<channelf_sound_device> m_custom; required_device<cpu_device> m_maincpu; + int recalc_palette_offset(int reg1, int reg2); }; #endif /* CHANNELF_H_ */ diff --git a/src/mess/includes/concept.h b/src/mess/includes/concept.h index 4ccfe8832cd..079105a1dea 100644 --- a/src/mess/includes/concept.h +++ b/src/mess/includes/concept.h @@ -86,6 +86,9 @@ public: DECLARE_WRITE_LINE_MEMBER(concept_fdc_intrq_w); DECLARE_WRITE_LINE_MEMBER(concept_fdc_drq_w); required_device<cpu_device> m_maincpu; + void concept_set_interrupt(int level, int state); + inline void post_in_KeyQueue(int keycode); + void poll_keyboard(); }; diff --git a/src/mess/includes/dai.h b/src/mess/includes/dai.h index 195b7d8d4c3..fc33a12b0b6 100644 --- a/src/mess/includes/dai.h +++ b/src/mess/includes/dai.h @@ -86,6 +86,7 @@ public: TIMER_CALLBACK_MEMBER(dai_timer); required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; + void dai_update_memory(int dai_rom_bank); }; diff --git a/src/mess/includes/dgn_beta.h b/src/mess/includes/dgn_beta.h index 0d16e02610b..eb6322e123f 100644 --- a/src/mess/includes/dgn_beta.h +++ b/src/mess/includes/dgn_beta.h @@ -195,6 +195,18 @@ public: DECLARE_READ8_HANDLER(dgnbeta_wd2797_r); DECLARE_WRITE8_HANDLER(dgnbeta_wd2797_w); required_device<cpu_device> m_maincpu; + void dgnbeta_vid_set_gctrl(int data); + void UpdateBanks(int first, int last); + void SetDefaultTask(); + void dgn_beta_bank_memory(int offset, int data, int bank); + int SelectedKeyrow(dgn_beta_state *state, int Rows); + int GetKeyRow(dgn_beta_state *state, int RowNo); + void cpu0_recalc_irq(int state); + void cpu0_recalc_firq(int state); + void cpu1_recalc_firq(int state); + void ScanInKeyboard(void); + void dgn_beta_frame_interrupt (int data); + void dgn_beta_line_interrupt (int data); }; @@ -204,14 +216,8 @@ extern const wd17xx_interface dgnbeta_wd17xx_interface; extern const pia6821_interface dgnbeta_pia_intf[]; -void dgn_beta_frame_interrupt (running_machine &machine, int data); - - /*----------- defined in video/dgn_beta.c -----------*/ -/* mc6845 video display generator */ -void dgnbeta_vid_set_gctrl(running_machine &machine, int data); - extern const mc6845_interface dgnbeta_crtc6845_interface; #endif /* DGN_BETA_H_ */ diff --git a/src/mess/includes/electron.h b/src/mess/includes/electron.h index 7b25f1978d8..0fe96e264ce 100644 --- a/src/mess/includes/electron.h +++ b/src/mess/includes/electron.h @@ -84,10 +84,10 @@ public: TIMER_CALLBACK_MEMBER(electron_scanline_interrupt); required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; + inline UINT8 read_vram( UINT16 addr ); + inline void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void electron_interrupt_handler(int mode, int interrupt); }; -/*----------- defined in machine/electron.c -----------*/ -void electron_interrupt_handler(running_machine &machine, int mode, int interrupt); - #endif /* ELECTRON_H_ */ diff --git a/src/mess/includes/enterp.h b/src/mess/includes/enterp.h index a02cd8e958e..9e44129037c 100644 --- a/src/mess/includes/enterp.h +++ b/src/mess/includes/enterp.h @@ -38,6 +38,7 @@ public: DECLARE_WRITE_LINE_MEMBER(enterp_wd1770_intrq_w); DECLARE_WRITE_LINE_MEMBER(enterp_wd1770_drq_w); required_device<cpu_device> m_maincpu; + void enterprise_update_memory_page(address_space &space, offs_t page, int index); }; diff --git a/src/mess/includes/fm7.h b/src/mess/includes/fm7.h index 0b2fa1285fb..81ae378b348 100644 --- a/src/mess/includes/fm7.h +++ b/src/mess/includes/fm7.h @@ -262,6 +262,25 @@ public: required_device<cpu_device> m_sub; optional_device<cpu_device> m_x86; required_device<cassette_image_device> m_cassette; + void fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat); + void fm7_alu_function_compare(UINT32 offset); + void fm7_alu_function_pset(UINT32 offset); + void fm7_alu_function_or(UINT32 offset); + void fm7_alu_function_and(UINT32 offset); + void fm7_alu_function_xor(UINT32 offset); + void fm7_alu_function_not(UINT32 offset); + void fm7_alu_function_invalid(UINT32 offset); + void fm7_alu_function_tilepaint(UINT32 offset); + void fm7_alu_function(UINT32 offset); + UINT32 fm7_line_set_pixel(int x, int y); + void fm77av_line_draw(); + void main_irq_set_flag(UINT8 flag); + void main_irq_clear_flag(UINT8 flag); + void fm7_update_psg(); + void fm7_update_bank(address_space & space, int bank, UINT8 physical); + void fm7_mmr_refresh(address_space& space); + void key_press(UINT16 scancode); + void fm7_keyboard_poll_scan(); }; #endif /*FM7_H_*/ diff --git a/src/mess/includes/fmtowns.h b/src/mess/includes/fmtowns.h index 4305e03660a..201dcafad01 100644 --- a/src/mess/includes/fmtowns.h +++ b/src/mess/includes/fmtowns.h @@ -281,6 +281,29 @@ public: DECLARE_READ8_MEMBER(get_slave_ack); IRQ_CALLBACK_MEMBER(towns_irq_callback); DECLARE_WRITE_LINE_MEMBER(towns_fm_irq); + void towns_crtc_refresh_mode(); + void towns_update_kanji_offset(); + void render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect); + void render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect); + void draw_sprites(const rectangle* rect); + void towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer); + void render_text_char(UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr); + void draw_text_layer(); + inline UINT8 byte_to_bcd(UINT8 val); + inline UINT8 bcd_to_byte(UINT8 val); + inline UINT32 msf_to_lbafm(UINT32 val); // because the CDROM core doesn't provide this; + DECLARE_READ16_MEMBER(towns_fdc_dma_r); + DECLARE_WRITE16_MEMBER(towns_fdc_dma_w); + void towns_cdrom_set_irq(int line,int state); + UINT8 towns_cd_get_track(); + DECLARE_READ16_MEMBER(towns_cdrom_dma_r); + void rtc_hour(); + void rtc_minute(); + DECLARE_READ16_MEMBER(towns_scsi_dma_r); + DECLARE_WRITE16_MEMBER(towns_scsi_dma_w); }; class towns16_state : public towns_state diff --git a/src/mess/includes/galaxy.h b/src/mess/includes/galaxy.h index 3b4aab1444e..31e73e4d09a 100644 --- a/src/mess/includes/galaxy.h +++ b/src/mess/includes/galaxy.h @@ -42,6 +42,7 @@ public: TIMER_CALLBACK_MEMBER(gal_video); IRQ_CALLBACK_MEMBER(galaxy_irq_callback); void galaxy_set_timer(); + void galaxy_setup_snapshot (const UINT8 * data, UINT32 size); required_device<cpu_device> m_maincpu; protected: required_device<cassette_image_device> m_cassette; diff --git a/src/mess/includes/gb.h b/src/mess/includes/gb.h index 62b05106493..051346c5238 100644 --- a/src/mess/includes/gb.h +++ b/src/mess/includes/gb.h @@ -230,6 +230,7 @@ protected: void gbc_hdma(UINT16 length); void gb_increment_scanline(); void gb_lcd_switch_on(); + inline void gb_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); }; diff --git a/src/mess/includes/hec2hrp.h b/src/mess/includes/hec2hrp.h index a641a1ba601..a5a962d676b 100644 --- a/src/mess/includes/hec2hrp.h +++ b/src/mess/includes/hec2hrp.h @@ -148,6 +148,20 @@ public: required_device<cpu_device> m_maincpu; optional_device<cpu_device> m_disc2cpu; required_device<cassette_image_device> m_cassette; + int isHectorWithDisc2(); + int isHectorWithMiniDisc(); + int isHectorHR(); + int isHectoreXtend(); + void hector_minidisc_init(); + void Mise_A_Jour_Etat(int Adresse, int Value ); + void Init_Value_SN76477_Hector(); + void Update_Sound(address_space &space, UINT8 data); + void hector_reset(int hr, int with_D2 ); + void hector_init(); + void Init_Hector_Palette(); + void hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; + void hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; + }; /*----------- defined in machine/hec2hrp.c -----------*/ @@ -155,16 +169,10 @@ public: /* Protoype of memory Handler*/ DECLARE_WRITE8_HANDLER( hector_switch_bank_rom_w ); -void hector_init( running_machine &machine); -void hector_reset(running_machine &machine, int hr, int with_D2); -void hector_disc2_reset( running_machine &machine); - /* Prototype of I/O Handler*/ DECLARE_READ8_HANDLER( hector_mx_io_port_r ); /*----------- defined in video/hec2video.c -----------*/ -void hector_80c(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; -void hector_hr(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) ; @@ -185,6 +193,7 @@ DECLARE_WRITE8_HANDLER( hector_disc2_io40_port_w); DECLARE_READ8_HANDLER( hector_disc2_io50_port_r); DECLARE_WRITE8_HANDLER( hector_disc2_io50_port_w); +void hector_disc2_reset( running_machine &machine); void hector_disc2_init( running_machine &machine); void hector_minidisc_init( running_machine &machine); diff --git a/src/mess/includes/hp48.h b/src/mess/includes/hp48.h index 8514f545c9c..fe9e72b6d2d 100644 --- a/src/mess/includes/hp48.h +++ b/src/mess/includes/hp48.h @@ -90,6 +90,14 @@ public: void hp48_apply_modules(); required_device<cpu_device> m_maincpu; required_device<dac_device> m_dac; + void hp48_pulse_irq( int irq_line); + void hp48_rs232_start_recv_byte( UINT8 data ); + void hp48_rs232_send_byte( ); + int hp48_get_in( ); + void hp48_update_kdn( ); + void hp48_reset_modules( ); + void hp48_decode_nibble( UINT8* dst, UINT8* src, int size ); + void hp48_encode_nibble( UINT8* dst, UINT8* src, int size ); }; @@ -98,11 +106,11 @@ public: ***************************************************************************/ /* read from I/O memory */ -#define HP48_IO_4(x) (state->m_io[(x)]) -#define HP48_IO_8(x) (state->m_io[(x)] | (state->m_io[(x)+1] << 4)) -#define HP48_IO_12(x) (state->m_io[(x)] | (state->m_io[(x)+1] << 4) | (state->m_io[(x)+2] << 8)) -#define HP48_IO_20(x) (state->m_io[(x)] | (state->m_io[(x)+1] << 4) | (state->m_io[(x)+2] << 8) | \ - (state->m_io[(x)+3] << 12) | (state->m_io[(x)+4] << 16)) +#define HP48_IO_4(x) (m_io[(x)]) +#define HP48_IO_8(x) (m_io[(x)] | (m_io[(x)+1] << 4)) +#define HP48_IO_12(x) (m_io[(x)] | (m_io[(x)+1] << 4) | (m_io[(x)+2] << 8)) +#define HP48_IO_20(x) (m_io[(x)] | (m_io[(x)+1] << 4) | (m_io[(x)+2] << 8) | \ + (m_io[(x)+3] << 12) | (m_io[(x)+4] << 16)) /*----------- defined in machine/hp48.c -----------*/ diff --git a/src/mess/includes/intv.h b/src/mess/includes/intv.h index 0a0e16a84dd..0f424a5324d 100644 --- a/src/mess/includes/intv.h +++ b/src/mess/includes/intv.h @@ -262,6 +262,8 @@ protected: void render_background(bitmap_ind16 &bitmap); void draw_borders(bitmap_ind16 &bm); void intv_stic_screenrefresh(); + void draw_background(bitmap_ind16 &bitmap, int transparency); + void draw_sprites(bitmap_ind16 &bitmap, int behind_foreground); }; #endif /* INTV_H_ */ diff --git a/src/mess/includes/lisa.h b/src/mess/includes/lisa.h index 0982cd7dc8c..4cbac241722 100644 --- a/src/mess/includes/lisa.h +++ b/src/mess/includes/lisa.h @@ -225,6 +225,7 @@ public: void scan_keyboard(); void unplug_keyboard(); void plug_keyboard(); + void init_lisa1(void); }; diff --git a/src/mess/includes/lviv.h b/src/mess/includes/lviv.h index 91707ebd516..0f5a31d7d80 100644 --- a/src/mess/includes/lviv.h +++ b/src/mess/includes/lviv.h @@ -48,6 +48,11 @@ public: required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; required_device<cassette_image_device> m_cassette; + void lviv_update_palette(UINT8 pal); + void lviv_update_memory (); + void lviv_setup_snapshot (UINT8 * data); + void dump_registers(); + int lviv_verify_snapshot (UINT8 * data, UINT32 size); }; @@ -62,7 +67,6 @@ SNAPSHOT_LOAD( lviv ); /*----------- defined in video/lviv.c -----------*/ extern const unsigned char lviv_palette[8*3]; -extern void lviv_update_palette(running_machine &, UINT8); #endif /* LVIV_H_ */ diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h index 51818a81fda..b2d4f4a5f9b 100644 --- a/src/mess/includes/mac.h +++ b/src/mess/includes/mac.h @@ -512,6 +512,16 @@ public: void mac_state_load(); DECLARE_WRITE_LINE_MEMBER(mac_via_irq); DECLARE_WRITE_LINE_MEMBER(mac_via2_irq); + void dafb_recalc_ints(); + void set_scc_waitrequest(int waitrequest); + int scan_keyboard(); + void keyboard_init(); + void kbd_shift_out(int data); + void keyboard_receive(int val); + void mac_driver_init(model_t model); + void mac_tracetrap(const char *cpu_name_local, int addr, int trap); + void mac_install_memory(offs_t memory_begin, offs_t memory_end, + offs_t memory_size, void *memory_data, int is_rom, const char *bank); }; #endif /* MAC_H_ */ diff --git a/src/mess/includes/macpci.h b/src/mess/includes/macpci.h index f5f327fc539..ba7b47f1185 100644 --- a/src/mess/includes/macpci.h +++ b/src/mess/includes/macpci.h @@ -167,6 +167,7 @@ public: DECLARE_READ8_MEMBER(mac_adb_via_in_cb2); DECLARE_WRITE8_MEMBER(mac_adb_via_out_cb2); DECLARE_WRITE_LINE_MEMBER(mac_via_irq); + void mac_driver_init(model_t model); }; #endif /* PCIMAC_H_ */ diff --git a/src/mess/includes/mbc55x.h b/src/mess/includes/mbc55x.h index 80fa33e5727..152645f6a10 100644 --- a/src/mess/includes/mbc55x.h +++ b/src/mess/includes/mbc55x.h @@ -159,6 +159,9 @@ public: void screen_eof_mbc55x(screen_device &screen, bool state); TIMER_CALLBACK_MEMBER(keyscan_callback); IRQ_CALLBACK_MEMBER(mbc55x_irq_callback); + void keyboard_reset(); + void scan_keyboard(); + void set_ram_size(); }; /*----------- defined in drivers/mbc55x.c -----------*/ diff --git a/src/mess/includes/microtan.h b/src/mess/includes/microtan.h index 3b4bc0b47ad..d5ebd15da90 100644 --- a/src/mess/includes/microtan.h +++ b/src/mess/includes/microtan.h @@ -81,6 +81,14 @@ public: DECLARE_WRITE_LINE_MEMBER(via_1_irq); required_device<cpu_device> m_maincpu; required_device<cassette_image_device> m_cassette; + UINT8 read_dsw(); + void microtan_set_irq_line(); + void store_key(int key); + int microtan_verify_snapshot(UINT8 *data, int size); + int parse_intel_hex(UINT8 *snapshot_buff, char *src); + int parse_zillion_hex(UINT8 *snapshot_buff, char *src); + void microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base); + void microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size); }; diff --git a/src/mess/includes/mtx.h b/src/mess/includes/mtx.h index a236fd6e8b2..486171837bf 100644 --- a/src/mess/includes/mtx.h +++ b/src/mess/includes/mtx.h @@ -76,6 +76,7 @@ public: DECLARE_READ8_MEMBER(mtx_sound_strobe_r); DECLARE_WRITE8_MEMBER(mtx_cst_w); DECLARE_READ8_MEMBER(mtx_prt_r); + void bankswitch(UINT8 data); }; /*----------- defined in machine/mtx.c -----------*/ diff --git a/src/mess/includes/nc.h b/src/mess/includes/nc.h index a7da37d875b..016863cef70 100644 --- a/src/mess/includes/nc.h +++ b/src/mess/includes/nc.h @@ -103,20 +103,27 @@ public: void nc100_machine_stop(); void nc200_machine_stop(); required_device<cpu_device> m_maincpu; + void nc200_video_set_backlight(int state); + void nc_card_save(device_image_interface &image); + int nc_card_calculate_mask(int size); + int nc_card_load(device_image_interface &image, unsigned char **ptr); + void nc_set_card_present_state(int state); + void nc_update_interrupts(); + void nc_refresh_memory_bank_config(int bank); + void nc_refresh_memory_config(); + void nc_common_restore_memory_from_stream(); + void nc_common_store_memory_to_stream(); + void nc_common_open_stream_for_reading(); + void nc_common_open_stream_for_writing(); + void nc_common_close_stream(); + void nc_common_init_machine(); + void nc_sound_update(int channel); + void nc_printer_update(UINT8 data); + void nc150_init_machine(); + void nc200_refresh_uart_interrupt(); + void nc200_floppy_drive_index_callback(int drive_id); }; -/*----------- defined in video/nc.c -----------*/ - -void nc200_video_set_backlight(running_machine &machine, int state); - - -/*----------- defined in drivers/nc.c -----------*/ - -/* pointer to loaded data */ -/* mask used to stop access over end of card ram area */ - - -void nc_set_card_present_state(running_machine &machine, int state); #endif /* NC_H_ */ diff --git a/src/mess/includes/oric.h b/src/mess/includes/oric.h index e1163dcc3ed..e1046f10581 100644 --- a/src/mess/includes/oric.h +++ b/src/mess/includes/oric.h @@ -193,6 +193,8 @@ protected: void oric_vh_update_attribute(UINT8 c); void oric_vh_update_flash(); void oric_refresh_charset(); + void oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag); + void telestrat_acia_callback(int irq_state); }; /*----------- defined in machine/oric.c -----------*/ diff --git a/src/mess/includes/partner.h b/src/mess/includes/partner.h index b9087e8af4d..6b69deb4a2a 100644 --- a/src/mess/includes/partner.h +++ b/src/mess/includes/partner.h @@ -28,6 +28,10 @@ public: DECLARE_MACHINE_RESET(partner); DECLARE_WRITE_LINE_MEMBER(partner_wd17xx_drq_w); DECLARE_WRITE_LINE_MEMBER(hrq_w); + void partner_window_1(UINT8 bank_num, UINT16 offset,UINT8 *rom); + void partner_window_2(UINT8 bank_num, UINT16 offset,UINT8 *rom); + void partner_iomap_bank(UINT8 *rom); + void partner_bank_switch(); }; diff --git a/src/mess/includes/pc.h b/src/mess/includes/pc.h index de48512e8fb..41806cc99fd 100644 --- a/src/mess/includes/pc.h +++ b/src/mess/includes/pc.h @@ -155,6 +155,12 @@ public: IRQ_CALLBACK_MEMBER(pc_irq_callback); DECLARE_DEVICE_IMAGE_LOAD_MEMBER( pcjr_cartridge ); + UINT8 pc_speaker_get_spk(); + void pc_speaker_set_spkrdata(UINT8 data); + void pc_speaker_set_input(UINT8 data); + void pcjr_keyb_init(); + void mess_init_pc_common(UINT32 flags, void (*set_keyb_int_func)(running_machine &, int), void (*set_hdc_int_func)(running_machine &,int,int)); + void pc_rtc_init(); }; /*----------- defined in machine/pc.c -----------*/ @@ -174,13 +180,4 @@ extern const i8255_interface pcjr_ppi8255_interface; extern const i8255_interface mc1502_ppi8255_interface; extern const i8255_interface mc1502_ppi8255_interface_2; -UINT8 pc_speaker_get_spk(running_machine &machine); -void pc_speaker_set_spkrdata(running_machine &machine, UINT8 data); -void pc_speaker_set_input(running_machine &machine, UINT8 data); - -void mess_init_pc_common( running_machine &machine, UINT32 flags, void (*set_keyb_int_func)(running_machine &, int), void (*set_hdc_int_func)(running_machine &,int,int)); - -void pc_rtc_init(running_machine &machine); - - #endif /* PC_H_ */ diff --git a/src/mess/includes/pcw.h b/src/mess/includes/pcw.h index f9f8488c839..22762480fe6 100644 --- a/src/mess/includes/pcw.h +++ b/src/mess/includes/pcw.h @@ -116,6 +116,14 @@ public: required_device<cpu_device> m_maincpu; required_device<screen_device> m_screen; required_device<upd765a_device> m_fdc; + inline void pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void pcw_update_interrupt_counter(); + void pcw_update_irqs(); + void pcw_update_read_memory_block(int block, int bank); + void pcw_update_write_memory_block(int block, int bank); + void pcw_update_mem(int block, int data); + int pcw_get_sys_status(); + void pcw_printer_fire_pins(UINT16 pins); }; #endif /* PCW_H_ */ diff --git a/src/mess/includes/pcw16.h b/src/mess/includes/pcw16.h index e8816688ad1..87abe82b6a1 100644 --- a/src/mess/includes/pcw16.h +++ b/src/mess/includes/pcw16.h @@ -145,6 +145,11 @@ public: void trigger_fdc_int(); void fdc_interrupt(bool state); DECLARE_FLOPPY_FORMATS( floppy_formats ); + inline void pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); + void pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); + void pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte); + void pcw16_begin_byte_transfer(); }; #endif /* PCW16_H_ */ diff --git a/src/mess/includes/pdp1.h b/src/mess/includes/pdp1.h index 5e067d03758..748b0524b99 100644 --- a/src/mess/includes/pdp1.h +++ b/src/mess/includes/pdp1.h @@ -271,12 +271,31 @@ public: TIMER_CALLBACK_MEMBER(il_timer_callback); void pdp1_machine_stop(); required_device<cpu_device> m_maincpu; + inline void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void pdp1_plot(int x, int y); + void pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); + void pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state); + void pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); + void pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); + void pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap); + void pdp1_draw_panel(bitmap_ind16 &bitmap); + void pdp1_typewriter_linefeed(); + void pdp1_typewriter_drawchar(int character); + void pdp1_update_lightpen_state(const lightpen_t *new_state); + void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_); + void pdp1_erase_lightpen(bitmap_ind16 &bitmap); + void pdp1_draw_lightpen(bitmap_ind16 &bitmap); + int tape_read(UINT8 *reply); + void begin_tape_read(int binary, int nac); + void tape_write(UINT8 data); + void typewriter_out(UINT8 data); + void parallel_drum_set_il(int il); + void parallel_drum_init(); + UINT32 drum_read(int field, int position); + void drum_write(int field, int position, UINT32 data); + void pdp1_keyboard(); + void pdp1_lightpen(); }; - -/*----------- defined in video/pdp1.c -----------*/ -void pdp1_plot(running_machine &machine, int x, int y); -void pdp1_typewriter_drawchar(running_machine &machine, int character); -void pdp1_update_lightpen_state(running_machine &machine, const lightpen_t *new_state); - - #endif /* PDP1_H_ */ diff --git a/src/mess/includes/poly88.h b/src/mess/includes/poly88.h index 155a2f3d9a8..0685f301925 100644 --- a/src/mess/includes/poly88.h +++ b/src/mess/includes/poly88.h @@ -68,6 +68,7 @@ protected: required_ioport m_line4; required_ioport m_line5; required_ioport m_line6; + UINT8 row_number(UINT8 code); }; diff --git a/src/mess/includes/pp01.h b/src/mess/includes/pp01.h index bb4b889780d..49624f0cd34 100644 --- a/src/mess/includes/pp01.h +++ b/src/mess/includes/pp01.h @@ -44,6 +44,8 @@ public: DECLARE_WRITE8_MEMBER(pp01_8255_portc_w); DECLARE_READ8_MEMBER(pp01_8255_portc_r); required_device<cpu_device> m_maincpu; + void pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part); + void pp01_set_memory(UINT8 block, UINT8 data); }; diff --git a/src/mess/includes/primo.h b/src/mess/includes/primo.h index e47e5eeae29..9eeb01a0a16 100644 --- a/src/mess/includes/primo.h +++ b/src/mess/includes/primo.h @@ -42,6 +42,12 @@ public: required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; required_device<cassette_image_device> m_cassette; + void primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline); + void primo_update_memory(); + void primo_common_driver_init (primo_state *state); + void primo_common_machine_init (); + void primo_setup_pss (UINT8* snapshot_data, UINT32 snapshot_size); + void primo_setup_pp (UINT8* quickload_data, UINT32 quickload_size); }; diff --git a/src/mess/includes/samcoupe.h b/src/mess/includes/samcoupe.h index d98fa2007a6..472cb3ba85a 100644 --- a/src/mess/includes/samcoupe.h +++ b/src/mess/includes/samcoupe.h @@ -124,17 +124,16 @@ public: required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; required_device<cassette_image_device> m_cassette; + void draw_mode4_line(int y, int hpos); + void draw_mode3_line(int y, int hpos); + void draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask); + void draw_mode2_line(int y, int hpos); + void draw_mode1_line(int y, int hpos); + void samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly); + void samcoupe_install_ext_mem(address_space &space); + void samcoupe_update_memory(address_space &space); + UINT8 samcoupe_mouse_r(); + void samcoupe_irq(UINT8 src); }; - -/*----------- defined in drivers/samcoupe.c -----------*/ - -void samcoupe_irq(device_t *device, UINT8 src); - - -/*----------- defined in machine/samcoupe.c -----------*/ - -void samcoupe_update_memory(address_space &space); -UINT8 samcoupe_mouse_r(running_machine &machine); - #endif /* SAMCOUPE_H_ */ diff --git a/src/mess/includes/sms.h b/src/mess/includes/sms.h index 090dd1fd0ea..4cc1ff2cecc 100644 --- a/src/mess/includes/sms.h +++ b/src/mess/includes/sms.h @@ -227,6 +227,11 @@ protected: void setup_banks(); void sms_get_inputs(address_space &space); required_device<cpu_device> m_maincpu; + int sms_verify_cart( UINT8 *magic, int size ); + int detect_codemasters_mapper( UINT8 *rom ); + int detect_korean_mapper( UINT8 *rom ); + int detect_tvdraw( UINT8 *rom ); + int detect_lphaser_xoffset( UINT8 *rom ); }; diff --git a/src/mess/includes/spectrum.h b/src/mess/includes/spectrum.h index a6557bbb206..53fc40903bb 100644 --- a/src/mess/includes/spectrum.h +++ b/src/mess/includes/spectrum.h @@ -212,6 +212,8 @@ protected: optional_ioport m_io_plus4; void spectrum_UpdateBorderBitmap(); + inline unsigned char get_display_color (unsigned char color, int invert); + inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); }; diff --git a/src/mess/includes/ssystem3.h b/src/mess/includes/ssystem3.h index 59f5ebe0b04..a48c390c2b5 100644 --- a/src/mess/includes/ssystem3.h +++ b/src/mess/includes/ssystem3.h @@ -54,16 +54,15 @@ public: DECLARE_READ8_MEMBER(ssystem3_via_read_b); DECLARE_WRITE8_MEMBER(ssystem3_via_write_b); required_device<cpu_device> m_maincpu; + void ssystem3_lcd_reset(); + void ssystem3_lcd_write(int clock, int data); + void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y); + void ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch); + void ssystem3_playfield_getfigure(int x, int y, int *figure, int *black); + void ssystem3_playfield_reset(); + void ssystem3_playfield_write(int reset, int signal); + void ssystem3_playfield_read(int *on, int *ready); }; -/*----------- defined in drivers/ssystem3.c -----------*/ - -void ssystem3_playfield_getfigure(running_machine &machine, int x, int y, int *figure, int *black); - -/*----------- defined in video/ssystem3.c -----------*/ - -void ssystem3_lcd_reset(running_machine &machine); -void ssystem3_lcd_write(running_machine &machine, int clock, int data); - #endif /* SSYSTEM3_H_ */ diff --git a/src/mess/includes/super80.h b/src/mess/includes/super80.h index 5f495d31ba2..8e4035bd239 100644 --- a/src/mess/includes/super80.h +++ b/src/mess/includes/super80.h @@ -111,6 +111,9 @@ public: required_ioport m_io_x6; required_ioport m_io_x7; required_ioport m_io_config; + void palette_set_colors_rgb(const UINT8 *colors); + void super80_cassette_motor( UINT8 data ); + void driver_init_common( ); }; diff --git a/src/mess/includes/svi318.h b/src/mess/includes/svi318.h index f414cc2563e..a1007d1f6cf 100644 --- a/src/mess/includes/svi318.h +++ b/src/mess/includes/svi318.h @@ -137,6 +137,8 @@ protected: required_ioport m_buttons; void svi318_set_banks(); + void svi318_80col_init(); + void svi318_vdp_interrupt(int i); }; @@ -146,8 +148,6 @@ extern const i8255_interface svi318_ppi8255_interface; extern const ins8250_interface svi318_ins8250_interface[2]; extern const wd17xx_interface svi_wd17xx_interface; -int svi318_cassette_present(running_machine &machine, int id); - MC6845_UPDATE_ROW( svi806_crtc6845_update_row ); diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h index 2f2ba78735d..b66ac6619bb 100644 --- a/src/mess/includes/thomson.h +++ b/src/mess/includes/thomson.h @@ -542,6 +542,8 @@ protected: void to7_floppy_reset(); void to9_floppy_init(void* int_base, void* ext_base); void to9_floppy_reset(); + void to7_midi_update_irq ( ); + void to7_midi_ready_to_send_cb( ); }; /*----------- defined in machine/thomson.c -----------*/ diff --git a/src/mess/includes/ti85.h b/src/mess/includes/ti85.h index 8be9fb7a9a6..1eaa364bdfe 100644 --- a/src/mess/includes/ti85.h +++ b/src/mess/includes/ti85.h @@ -103,6 +103,12 @@ public: DECLARE_MACHINE_START(ti83p); UINT32 screen_update_ti85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(ti85_timer_callback); + void update_ti85_memory (); + void update_ti83p_memory (); + void update_ti86_memory (); + void ti8x_snapshot_setup_registers (UINT8 * data); + void ti85_setup_snapshot (UINT8 * data); + void ti86_setup_snapshot (UINT8 * data); }; diff --git a/src/mess/includes/tx0.h b/src/mess/includes/tx0.h index a758f8ad49b..b3f7e3d0c68 100644 --- a/src/mess/includes/tx0.h +++ b/src/mess/includes/tx0.h @@ -162,18 +162,29 @@ public: TIMER_CALLBACK_MEMBER(dis_callback); void tx0_machine_stop(); required_device<cpu_device> m_maincpu; + inline void tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); + void tx0_plot(int x, int y); + void tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state); + void tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state); + void tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits); + void tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color); + void tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color); + void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color); + void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color); + void tx0_draw_panel_backdrop(bitmap_ind16 &bitmap); + void tx0_draw_panel(bitmap_ind16 &bitmap); + void tx0_typewriter_linefeed(); + void tx0_typewriter_drawchar(int character); + int tape_read(UINT8 *reply); + void tape_write(UINT8 data); + void begin_tape_read(int binary); + void typewriter_out(UINT8 data); + void schedule_select(); + void schedule_unselect(); + void tx0_keyboard(); }; - -/*----------- defined in video/tx0.c -----------*/ - - - - - -void tx0_plot(running_machine &machine, int x, int y); -void tx0_typewriter_drawchar(running_machine &machine, int character); - /* defines for each bit and mask in input port "CSW" */ enum { diff --git a/src/mess/includes/vc4000.h b/src/mess/includes/vc4000.h index 18f09551dbd..110d030990f 100644 --- a/src/mess/includes/vc4000.h +++ b/src/mess/includes/vc4000.h @@ -134,6 +134,11 @@ protected: required_ioport m_joys; required_ioport m_config; #endif + inline UINT8 vc4000_joystick_return_to_centre(UINT8 joy); + void vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line); + inline void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale); + void vc4000_sprite_update(bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This); + inline void vc4000_draw_grid(UINT8 *collision); }; /*----------- defined in audio/vc4000.c -----------*/ diff --git a/src/mess/includes/vtech2.h b/src/mess/includes/vtech2.h index f5f32f02e43..2262b6c64c1 100644 --- a/src/mess/includes/vtech2.h +++ b/src/mess/includes/vtech2.h @@ -77,6 +77,9 @@ public: required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; required_device<cassette_image_device> m_cassette; + void laser_machine_init(int bank_mask, int video_mask); + void laser_get_track(); + void laser_put_track(); }; diff --git a/src/mess/includes/wswan.h b/src/mess/includes/wswan.h index 98c34488ad7..5bfbcec2e8c 100644 --- a/src/mess/includes/wswan.h +++ b/src/mess/includes/wswan.h @@ -174,6 +174,15 @@ protected: void wswan_setup_bios(); void wswan_handle_irqs(); void wswan_set_irq_line(int irq); + void wswan_setup_palettes(); + void wswan_draw_background(); + void wswan_draw_foreground_0(); + void wswan_draw_foreground_2(); + void wswan_draw_foreground_3(); + void wswan_handle_sprites( int mask ); + void wswan_refresh_scanline( ); + const char* wswan_determine_sram( UINT8 data ); + const char* wswan_determine_romsize( UINT8 data ); }; diff --git a/src/mess/includes/x1.h b/src/mess/includes/x1.h index d5c39330182..eae13315e75 100644 --- a/src/mess/includes/x1.h +++ b/src/mess/includes/x1.h @@ -220,6 +220,9 @@ public: UINT8 check_prev_height(running_machine &machine,int x,int y,int x_size); UINT8 check_line_valid_height(running_machine &machine,int y,int x_size,int height); + int priority_mixer_pri(int color); + void cmt_command( UINT8 cmd ); + UINT16 jis_convert(int kanji_addr); }; /*----------- defined in machine/x1.c -----------*/ diff --git a/src/mess/includes/x68k.h b/src/mess/includes/x68k.h index 65f4713e32d..12204cb43c6 100644 --- a/src/mess/includes/x68k.h +++ b/src/mess/includes/x68k.h @@ -384,6 +384,11 @@ private: public: required_device<cpu_device> m_maincpu; required_device<okim6258_device> m_okim6258; + bitmap_ind16* x68k_get_gfx_page(int pri,int type); + attotime prescale(int val); + void mfp_trigger_irq(int irq); + void mfp_set_timer(int timer, unsigned char data); + void mfp_recv_data(int data); }; diff --git a/src/mess/machine/a2lang.c b/src/mess/machine/a2lang.c index b9c52e2c1c0..82b514a1f5e 100644 --- a/src/mess/machine/a2lang.c +++ b/src/mess/machine/a2lang.c @@ -88,7 +88,8 @@ void a2bus_lang_device::langcard_touch(offs_t offset) val |= VAR_LCRAM2; /* change the flags */ - apple2_setvar(machine(), val, mask); + apple2_state *state = machine().driver_data<apple2_state>(); + state->apple2_setvar(val, mask); } diff --git a/src/mess/machine/a7800.c b/src/mess/machine/a7800.c index 829bf67fa03..4b0baf349ce 100644 --- a/src/mess/machine/a7800.c +++ b/src/mess/machine/a7800.c @@ -189,7 +189,7 @@ void a7800_partialhash(hash_collection &dest, const unsigned char *data, } -static int a7800_verify_cart(char header[128]) +int a7800_state::a7800_verify_cart(char header[128]) { const char* tag = "ATARI7800"; @@ -226,7 +226,7 @@ static const a7800_pcb pcb_list[] = { 0 } }; -static UINT16 a7800_get_pcb_id(const char *pcb) +UINT16 a7800_state::a7800_get_pcb_id(const char *pcb) { int i; diff --git a/src/mess/machine/aim65.c b/src/mess/machine/aim65.c index 257a049a8d3..cd81ffbe08c 100644 --- a/src/mess/machine/aim65.c +++ b/src/mess/machine/aim65.c @@ -50,53 +50,53 @@ static void dl1416_update(device_t *device, int index) dl1416_data_w(device, state->generic_space(), state->m_pia_a & 0x03, state->m_pia_b & 0x7f); } -static void aim65_pia(running_machine &machine) +void aim65_state::aim65_pia() { - dl1416_update(machine.device("ds1"), 0); - dl1416_update(machine.device("ds2"), 1); - dl1416_update(machine.device("ds3"), 2); - dl1416_update(machine.device("ds4"), 3); - dl1416_update(machine.device("ds5"), 4); + dl1416_update(machine().device("ds1"), 0); + dl1416_update(machine().device("ds2"), 1); + dl1416_update(machine().device("ds3"), 2); + dl1416_update(machine().device("ds4"), 3); + dl1416_update(machine().device("ds5"), 4); } WRITE8_MEMBER( aim65_state::aim65_pia_a_w ) { m_pia_a = data; - aim65_pia(machine()); + aim65_pia(); } WRITE8_MEMBER( aim65_state::aim65_pia_b_w ) { m_pia_b = data; - aim65_pia(machine()); + aim65_pia(); } -void aim65_update_ds1(device_t *device, int digit, int data) +WRITE16_MEMBER( aim65_state::aim65_update_ds1) { - output_set_digit_value(0 + (digit ^ 3), data); + output_set_digit_value(0 + (offset ^ 3), data); } -void aim65_update_ds2(device_t *device, int digit, int data) +WRITE16_MEMBER( aim65_state::aim65_update_ds2) { - output_set_digit_value(4 + (digit ^ 3), data); + output_set_digit_value(4 + (offset ^ 3), data); } -void aim65_update_ds3(device_t *device, int digit, int data) +WRITE16_MEMBER( aim65_state::aim65_update_ds3) { - output_set_digit_value(8 + (digit ^ 3), data); + output_set_digit_value(8 + (offset ^ 3), data); } -void aim65_update_ds4(device_t *device, int digit, int data) +WRITE16_MEMBER( aim65_state::aim65_update_ds4) { - output_set_digit_value(12 + (digit ^ 3), data); + output_set_digit_value(12 + (offset ^ 3), data); } -void aim65_update_ds5(device_t *device, int digit, int data) +WRITE16_MEMBER( aim65_state::aim65_update_ds5) { - output_set_digit_value(16 + (digit ^ 3), data); + output_set_digit_value(16 + (offset ^ 3), data); } diff --git a/src/mess/machine/amstr_pc.c b/src/mess/machine/amstr_pc.c index 8e8f8709a80..c831b136fa5 100644 --- a/src/mess/machine/amstr_pc.c +++ b/src/mess/machine/amstr_pc.c @@ -148,13 +148,15 @@ static struct { WRITE8_HANDLER( pc1640_port60_w ) { + pc_state *state = space.machine().driver_data<pc_state>(); + switch (offset) { case 1: pc1640.port61=data; if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4; else if (data==0x34) pc1640.port62=pc1640.port65&0xf; pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0)); - pc_speaker_set_spkrdata( space.machine(), data & 0x02 ); + state->pc_speaker_set_spkrdata( data & 0x02 ); pc_keyb_set_clock(data&0x40); break; case 4: diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c index d0fd0f3896e..917c1f87796 100644 --- a/src/mess/machine/amstrad.c +++ b/src/mess/machine/amstrad.c @@ -252,7 +252,7 @@ Green value, Red value, Blue value: 0 = 0%, 01/10 = 50%, 11 = 100%. The 01 case is not used, it is unknown if this produces a different amount of colour. */ -static unsigned char kccomp_get_colour_element(int colour_value) +unsigned char amstrad_state::kccomp_get_colour_element(int colour_value) { switch (colour_value) { diff --git a/src/mess/machine/apple1.c b/src/mess/machine/apple1.c index 4612d96037f..df529d34b7c 100644 --- a/src/mess/machine/apple1.c +++ b/src/mess/machine/apple1.c @@ -159,14 +159,14 @@ DRIVER_INIT_MEMBER(apple1_state,apple1) void apple1_state::machine_reset() { /* Reset the display hardware. */ - apple1_vh_dsp_clr(machine()); + apple1_vh_dsp_clr(); } /***************************************************************************** ** apple1_verify_header *****************************************************************************/ -static int apple1_verify_header (UINT8 *data) +int apple1_state::apple1_verify_header (UINT8 *data) { /* Verify the format for the snapshot */ if ((data[0] == 'L') && @@ -220,7 +220,7 @@ SNAPSHOT_LOAD(apple1) return IMAGE_INIT_FAIL; /* Verify the snapshot header */ - if (apple1_verify_header(snapbuf) == IMAGE_VERIFY_FAIL) + if (state->apple1_verify_header(snapbuf) == IMAGE_VERIFY_FAIL) { logerror("apple1 - Snapshot Header is in incorrect format - needs to be LOAD:xxyyDATA:\n"); return IMAGE_INIT_FAIL; @@ -304,7 +304,7 @@ TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) { /* Ignore further video writes, and clear the screen. */ m_vh_clrscrn_pressed = 1; - apple1_vh_dsp_clr(machine()); + apple1_vh_dsp_clr(); } } else if (m_vh_clrscrn_pressed) @@ -382,7 +382,7 @@ READ8_MEMBER(apple1_state::apple1_pia0_kbdin) WRITE8_MEMBER(apple1_state::apple1_pia0_dspout) { /* Send an ASCII character to the video hardware. */ - apple1_vh_dsp_w(machine(), data); + apple1_vh_dsp_w(data); } WRITE8_MEMBER(apple1_state::apple1_pia0_dsp_write_signal) @@ -403,7 +403,7 @@ WRITE8_MEMBER(apple1_state::apple1_pia0_dsp_write_signal) write. Thus the write delay depends on the cursor position and where the display is in the refresh cycle. */ if (!data) - machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(machine()), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),this)); + machine().scheduler().timer_set(apple1_vh_dsp_time_to_ready(), timer_expired_delegate(FUNC(apple1_state::apple1_dsp_ready_start),this)); } TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_start) @@ -484,16 +484,15 @@ TIMER_CALLBACK_MEMBER(apple1_state::apple1_dsp_ready_end) flip-flop which is toggled to produce the output waveform. Any access to the cassette I/O range, whether a read or a write, toggles this flip-flop. */ -static void cassette_toggle_output(running_machine &machine) +void apple1_state::cassette_toggle_output() { - apple1_state *state = machine.driver_data<apple1_state>(); - state->m_cassette_output_flipflop = !state->m_cassette_output_flipflop; - state->m_cassette->output(state->m_cassette_output_flipflop ? 1.0 : -1.0); + m_cassette_output_flipflop = !m_cassette_output_flipflop; + m_cassette->output(m_cassette_output_flipflop ? 1.0 : -1.0); } READ8_MEMBER(apple1_state::apple1_cassette_r) { - cassette_toggle_output(machine()); + cassette_toggle_output(); if (offset <= 0x7f) { @@ -535,5 +534,5 @@ WRITE8_MEMBER(apple1_state::apple1_cassette_w) However, we still have to handle writes, since they may be done by user code. */ - cassette_toggle_output(machine()); + cassette_toggle_output(); } diff --git a/src/mess/machine/apple2.c b/src/mess/machine/apple2.c index a0503949c4b..bd4385e4229 100644 --- a/src/mess/machine/apple2.c +++ b/src/mess/machine/apple2.c @@ -41,7 +41,7 @@ READ8_MEMBER(apple2_state::read_floatingbus) { - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } @@ -85,7 +85,7 @@ void apple2_state::apple2_update_memory() { /* retrieve information on this entry */ memset(&meminfo, 0, sizeof(meminfo)); - m_mem_config.memmap[i].get_meminfo(machine(), m_mem_config.memmap[i].begin, m_mem_config.memmap[i].end, &meminfo); + m_mem_config.memmap[i].get_meminfo(machine(),m_mem_config.memmap[i].begin, m_mem_config.memmap[i].end, &meminfo); bank_disposition = m_mem_config.memmap[i].bank_disposition; @@ -381,24 +381,22 @@ WRITE8_MEMBER(apple2_state::apple2_c080_w) } /* returns default CnXX slotram for a slot space */ -INT8 apple2_slotram_r(address_space &space, int slotnum, int offset) +INT8 apple2_state::apple2_slotram_r(address_space &space, int slotnum, int offset) { - apple2_state *state = space.machine().driver_data<apple2_state>(); - - if (state->m_slot_ram) + if (m_slot_ram) { if (!space.debugger_access()) { // printf("slotram_r: taking cnxx_slot to -1\n"); - state->m_a2_cnxx_slot = -1; - state->apple2_update_memory(); + m_a2_cnxx_slot = -1; + apple2_update_memory(); } - return state->m_slot_ram[offset]; + return m_slot_ram[offset]; } // else fall through to floating bus - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } READ8_MEMBER(apple2_state::apple2_c1xx_r ) @@ -426,7 +424,7 @@ READ8_MEMBER(apple2_state::apple2_c1xx_r ) } // else fall through to floating bus - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_c1xx_w ) @@ -474,7 +472,7 @@ READ8_MEMBER(apple2_state::apple2_c3xx_r ) } // else fall through to floating bus - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_c3xx_w ) @@ -526,7 +524,7 @@ READ8_MEMBER(apple2_state::apple2_c4xx_r ) } // else fall through to floating bus - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER ( apple2_state::apple2_c4xx_w ) @@ -564,7 +562,7 @@ READ8_MEMBER(apple2_state::apple2_cfff_r) apple2_update_memory(); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_cfff_w) @@ -588,7 +586,7 @@ READ8_MEMBER(apple2_state::apple2_c800_r ) return slotdevice->read_c800(space, offset&0xfff); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_c800_w ) @@ -614,7 +612,7 @@ READ8_MEMBER(apple2_state::apple2_ce00_r ) return slotdevice->read_c800(space, (offset&0xfff) + 0x600); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_ce00_w ) @@ -640,7 +638,7 @@ READ8_MEMBER(apple2_state::apple2_inh_d000_r ) return slotdevice->read_inh_rom(space, offset & 0xfff); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_inh_d000_w ) @@ -666,7 +664,7 @@ READ8_MEMBER(apple2_state::apple2_inh_e000_r ) return slotdevice->read_inh_rom(space, (offset & 0x1fff) + 0x1000); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } WRITE8_MEMBER(apple2_state::apple2_inh_e000_w ) @@ -963,26 +961,25 @@ static const apple2_memmap_entry tk2000_memmap_entries[] = { 0 } }; -void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask) +void apple2_state::apple2_setvar(UINT32 val, UINT32 mask) { - apple2_state *state = machine.driver_data<apple2_state>(); LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, - (unsigned int) state->m_maincpu->pc())); + (unsigned int) m_maincpu->pc())); assert((val & mask) == val); /* apply mask and set */ - val &= state->m_a2_mask; - val |= state->m_a2_set; + val &= m_a2_mask; + val |= m_a2_set; /* change the softswitch */ - state->m_flags &= ~mask; - state->m_flags |= val; + m_flags &= ~mask; + m_flags |= val; // disable flags that don't apply (INTCXROM/SLOTC3ROM on II/II+ for instance) - state->m_flags &= ~state->m_flags_mask; + m_flags &= ~m_flags_mask; - state->apple2_update_memory(); + apple2_update_memory(); } @@ -994,9 +991,8 @@ void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask) * with FIX: * ----------------------------------------------------------------------- */ -UINT8 apple2_getfloatingbusvalue(running_machine &machine) +UINT8 apple2_state::apple2_getfloatingbusvalue() { - apple2_state *state = machine.driver_data<apple2_state>(); enum { // scanner types @@ -1030,14 +1026,14 @@ UINT8 apple2_getfloatingbusvalue(running_machine &machine) // video scanner data // - i = state->m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync + i = m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync // machine state switches // - Hires = (state->m_flags & VAR_HIRES) ? 1 : 0; - Mixed = (state->m_flags & VAR_MIXED) ? 1 : 0; - Page2 = (state->m_flags & VAR_PAGE2) ? 1 : 0; - _80Store = (state->m_flags & VAR_80STORE) ? 1 : 0; + Hires = (m_flags & VAR_HIRES) ? 1 : 0; + Mixed = (m_flags & VAR_MIXED) ? 1 : 0; + Page2 = (m_flags & VAR_PAGE2) ? 1 : 0; + _80Store = (m_flags & VAR_80STORE) ? 1 : 0; // calculate video parameters according to display standard // @@ -1132,7 +1128,7 @@ UINT8 apple2_getfloatingbusvalue(running_machine &machine) //CMemory::mState |= CMemory::kVBLBar; // N: VBL' is true // FIX: MESS? } - return state->m_ram->pointer()[address % machine.device<ram_device>(RAM_TAG)->size()]; // FIX: this seems to work, but is it right!? + return m_ram->pointer()[address % machine().device<ram_device>(RAM_TAG)->size()]; // FIX: this seems to work, but is it right!? } @@ -1155,12 +1151,12 @@ void apple2_state::machine_reset() || !strcmp(machine().system().name, "prav8c") || !strcmp(machine().system().name, "apple2cp") || !strncmp(machine().system().name, "apple2g", 7); - apple2_setvar(machine(), need_intcxrom ? VAR_INTCXROM : 0, ~0); + apple2_setvar(need_intcxrom ? VAR_INTCXROM : 0, ~0); // ROM 0 cannot boot unless language card bank 2 is write-enabled (but read ROM) on startup if (!strncmp(machine().system().name, "apple2g", 7)) { - apple2_setvar(machine(), VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2); + apple2_setvar(VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2); } m_a2_speaker_state = 0; @@ -1629,7 +1625,7 @@ WRITE8_MEMBER ( apple2_state::apple2_c00x_w ) UINT32 mask; mask = 1 << (offset / 2); - apple2_setvar(space.machine(), (offset & 1) ? mask : 0, mask); + apple2_setvar((offset & 1) ? mask : 0, mask); } @@ -1640,7 +1636,7 @@ WRITE8_MEMBER ( apple2_state::apple2_c00x_w ) READ8_MEMBER( apple2_state::apple2_c01x_r ) { - UINT8 result = apple2_getfloatingbusvalue(space.machine()) & 0x7F; + UINT8 result = apple2_getfloatingbusvalue() & 0x7F; if(!space.debugger_access()) { @@ -1683,7 +1679,7 @@ WRITE8_MEMBER( apple2_state::apple2_c01x_w ) { /* Clear the keyboard strobe - ignore the returned results */ g_profiler.start(PROFILER_C01X); - AY3600_anykey_clearstrobe_r(space.machine()); + AY3600_anykey_clearstrobe_r(machine()); g_profiler.stop(); } @@ -1699,7 +1695,7 @@ READ8_MEMBER( apple2_state::apple2_c02x_r ) { apple2_c02x_w(space, offset, 0, 0); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } @@ -1713,7 +1709,7 @@ WRITE8_MEMBER( apple2_state::apple2_c02x_w ) switch(offset) { case 0x08: - apple2_setvar(space.machine(), (m_flags & VAR_ROMSWITCH) ^ VAR_ROMSWITCH, VAR_ROMSWITCH); + apple2_setvar((m_flags & VAR_ROMSWITCH) ^ VAR_ROMSWITCH, VAR_ROMSWITCH); break; } } @@ -1743,7 +1739,7 @@ READ8_MEMBER ( apple2_state::apple2_c03x_r ) speaker_level_w(speaker_device, m_a2_speaker_state); } } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } @@ -1773,12 +1769,12 @@ READ8_MEMBER ( apple2_state::apple2_c05x_r ) { if (offset == 0xa) // RAM { - apple2_setvar(space.machine(), VAR_TK2000RAM, ~0); + apple2_setvar(VAR_TK2000RAM, ~0); printf("TK2000: RAM (PC %x)\n", m_maincpu->pc()); } else if (offset == 0xb) // ROM { - apple2_setvar(space.machine(), 0, ~VAR_TK2000RAM); + apple2_setvar(0, ~VAR_TK2000RAM); printf("TK2000: ROM (PC %x)\n", m_maincpu->pc()); } } @@ -1790,9 +1786,9 @@ READ8_MEMBER ( apple2_state::apple2_c05x_r ) } mask = 0x100 << (offset / 2); - apple2_setvar(space.machine(), (offset & 1) ? mask : 0, mask); + apple2_setvar((offset & 1) ? mask : 0, mask); } - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } @@ -1864,7 +1860,7 @@ READ8_MEMBER ( apple2_state::apple2_c06x_r ) /* c060 Empty Cassette head read * and any other non joystick c06 port returns this according to applewin */ - return apple2_getfloatingbusvalue(space.machine()); + return apple2_getfloatingbusvalue(); } } return result ? 0x80 : 0x00; @@ -1920,12 +1916,12 @@ WRITE8_MEMBER ( apple2_state::apple2_c07x_w ) * ----------------------------------------------------------------------- */ -static int apple2_fdc_has_35(running_machine &machine) +int apple2_state::apple2_fdc_has_35() { - return (floppy_get_count(machine)); // - apple525_get_count(machine)) > 0; + return (floppy_get_count(machine())); // - apple525_get_count(machine)) > 0; } -static int apple2_fdc_has_525(running_machine &machine) +int apple2_state::apple2_fdc_has_525() { return 1; //apple525_get_count(machine) > 0; } @@ -1935,7 +1931,7 @@ static void apple2_fdc_set_lines(device_t *device, UINT8 lines) apple2_state *state = device->machine().driver_data<apple2_state>(); if (state->m_fdc_diskreg & 0x40) { - if (apple2_fdc_has_35(device->machine())) + if (state->apple2_fdc_has_35()) { /* slot 5: 3.5" disks */ sony_set_lines(device,lines); @@ -1943,7 +1939,7 @@ static void apple2_fdc_set_lines(device_t *device, UINT8 lines) } else { - if (apple2_fdc_has_525(device->machine())) + if (state->apple2_fdc_has_525()) { /* slot 6: 5.25" disks */ apple525_set_lines(device,lines); @@ -1964,13 +1960,13 @@ static void apple2_fdc_set_enable_lines(device_t *device,int enable_mask) else slot6_enable_mask = enable_mask; - if (apple2_fdc_has_35(device->machine())) + if (state->apple2_fdc_has_35()) { /* set the 3.5" enable lines */ sony_set_enable_lines(device,slot5_enable_mask); } - if (apple2_fdc_has_525(device->machine())) + if (state->apple2_fdc_has_525()) { /* set the 5.25" enable lines */ apple525_set_enable_lines(device,slot6_enable_mask); @@ -1986,7 +1982,7 @@ static UINT8 apple2_fdc_read_data(device_t *device) if (state->m_fdc_diskreg & 0x40) { - if (apple2_fdc_has_35(device->machine())) + if (state->apple2_fdc_has_35()) { /* slot 5: 3.5" disks */ result = sony_read_data(device); @@ -1994,7 +1990,7 @@ static UINT8 apple2_fdc_read_data(device_t *device) } else { - if (apple2_fdc_has_525(device->machine())) + if (state->apple2_fdc_has_525()) { /* slot 6: 5.25" disks */ result = apple525_read_data(device); @@ -2010,7 +2006,7 @@ static void apple2_fdc_write_data(device_t *device, UINT8 data) apple2_state *state = device->machine().driver_data<apple2_state>(); if (state->m_fdc_diskreg & 0x40) { - if (apple2_fdc_has_35(device->machine())) + if (state->apple2_fdc_has_35()) { /* slot 5: 3.5" disks */ sony_write_data(device,data); @@ -2018,7 +2014,7 @@ static void apple2_fdc_write_data(device_t *device, UINT8 data) } else { - if (apple2_fdc_has_525(device->machine())) + if (state->apple2_fdc_has_525()) { /* slot 6: 5.25" disks */ apple525_write_data(device,data); @@ -2035,7 +2031,7 @@ static int apple2_fdc_read_status(device_t *device) if (state->m_fdc_diskreg & 0x40) { - if (apple2_fdc_has_35(device->machine())) + if (state->apple2_fdc_has_35()) { /* slot 5: 3.5" disks */ result = sony_read_status(device); @@ -2043,7 +2039,7 @@ static int apple2_fdc_read_status(device_t *device) } else { - if (apple2_fdc_has_525(device->machine())) + if (state->apple2_fdc_has_525()) { /* slot 6: 5.25" disks */ result = apple525_read_status(device); @@ -2053,12 +2049,11 @@ static int apple2_fdc_read_status(device_t *device) } -void apple2_iwm_setdiskreg(running_machine &machine, UINT8 data) +void apple2_state::apple2_iwm_setdiskreg(UINT8 data) { - apple2_state *state = machine.driver_data<apple2_state>(); - state->m_fdc_diskreg = data & 0xC0; - if (apple2_fdc_has_35(machine)) - sony_set_sel_line( machine.device("fdc"),state->m_fdc_diskreg & 0x80); + m_fdc_diskreg = data & 0xC0; + if (apple2_fdc_has_35()) + sony_set_sel_line( machine().device("fdc"),m_fdc_diskreg & 0x80); } @@ -2078,45 +2073,44 @@ const applefdc_interface apple2_fdc_interface = * Driver init * ----------------------------------------------------------------------- */ -void apple2_init_common(running_machine &machine) +void apple2_state::apple2_init_common() { - apple2_state *state = machine.driver_data<apple2_state>(); - state->m_inh_slot = INH_SLOT_INVALID; - state->m_flags = 0; - state->m_fdc_diskreg = 0; + m_inh_slot = INH_SLOT_INVALID; + m_flags = 0; + m_fdc_diskreg = 0; // do these lookups once at startup - state->m_rom = state->memregion("maincpu")->base(); - state->m_rom_length = state->memregion("maincpu")->bytes() & ~0xFFF; - state->m_slot_length = state->memregion("maincpu")->bytes() - state->m_rom_length; - state->m_slot_ram = (state->m_slot_length > 0) ? &state->m_rom[state->m_rom_length] : NULL; + m_rom = memregion("maincpu")->base(); + m_rom_length = memregion("maincpu")->bytes() & ~0xFFF; + m_slot_length = memregion("maincpu")->bytes() - m_rom_length; + m_slot_ram = (m_slot_length > 0) ? &m_rom[m_rom_length] : NULL; - state->m_auxslotdevice = NULL; - if (state->m_machinetype == APPLE_IIE) + m_auxslotdevice = NULL; + if (m_machinetype == APPLE_IIE) { - state->m_auxslotdevice = state->m_a2eauxslot->get_a2eauxslot_card(); + m_auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); } - AY3600_init(machine); + AY3600_init(machine()); /* state save registers */ - state->save_item(NAME(state->m_flags)); - machine.save().register_postload(save_prepost_delegate(FUNC(apple2_state::apple2_update_memory_postload), state)); + save_item(NAME(m_flags)); + machine().save().register_postload(save_prepost_delegate(FUNC(apple2_state::apple2_update_memory_postload), this)); /* --------------------------------------------- * * set up the softswitch mask/set * * --------------------------------------------- */ - state->m_a2_mask = ~0; - state->m_a2_set = 0; + m_a2_mask = ~0; + m_a2_set = 0; /* disable VAR_ROMSWITCH if the ROM is only 16k */ - if (state->memregion("maincpu")->bytes() < 0x8000) - state->m_a2_mask &= ~VAR_ROMSWITCH; + if (memregion("maincpu")->bytes() < 0x8000) + m_a2_mask &= ~VAR_ROMSWITCH; - if (machine.device<ram_device>(RAM_TAG)->size() <= 64*1024) - state->m_a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL); + if (machine().device<ram_device>(RAM_TAG)->size() <= 64*1024) + m_a2_mask &= ~(VAR_RAMRD | VAR_RAMWRT | VAR_80STORE | VAR_ALTZP | VAR_80COL); - state->apple2_refresh_delegates(); + apple2_refresh_delegates(); } @@ -2138,7 +2132,7 @@ MACHINE_START_MEMBER(apple2_state,apple2) m_machinetype = APPLE_IIEPLUS; - apple2_init_common(machine()); + apple2_init_common(); /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); @@ -2165,7 +2159,7 @@ MACHINE_START_MEMBER(apple2_state,apple2e) m_machinetype = APPLE_IIE; - apple2_init_common(machine()); + apple2_init_common(); /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); @@ -2182,7 +2176,7 @@ MACHINE_START_MEMBER(apple2_state,laser128) m_flags_mask = 0; m_machinetype = LASER128; - apple2_init_common(machine()); + apple2_init_common(); /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); @@ -2202,7 +2196,7 @@ MACHINE_START_MEMBER(apple2_state,apple2orig) m_machinetype = APPLE_II; - apple2_init_common(machine()); + apple2_init_common(); /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); @@ -2222,7 +2216,7 @@ MACHINE_START_MEMBER(apple2_state,space84) m_machinetype = SPACE84; - apple2_init_common(machine()); + apple2_init_common(); /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); @@ -2241,7 +2235,7 @@ MACHINE_START_MEMBER(apple2_state,tk2000) m_machinetype = TK2000; - apple2_init_common(machine()); + apple2_init_common(); /* setup memory */ memset(&mem_cfg, 0, sizeof(mem_cfg)); diff --git a/src/mess/machine/apple2gs.c b/src/mess/machine/apple2gs.c index 56f72d259f5..98ac15695cc 100644 --- a/src/mess/machine/apple2gs.c +++ b/src/mess/machine/apple2gs.c @@ -138,43 +138,42 @@ * Apple IIgs clock * ----------------------------------------------------------------------- */ -static void process_clock(running_machine &machine) +void apple2gs_state::process_clock() { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); UINT8 operation; seconds_t current_interval; /* update clock_curtime */ - current_interval = machine.time().seconds; - state->m_clock_curtime += current_interval - state->m_clock_curtime_interval; - state->m_clock_curtime_interval = current_interval; + current_interval = machine().time().seconds; + m_clock_curtime += current_interval - m_clock_curtime_interval; + m_clock_curtime_interval = current_interval; - switch(state->m_clock_mode) + switch(m_clock_mode) { case CLOCKMODE_IDLE: - state->m_clock_read = (state->m_clock_data >> 7); - state->m_clock_reg1 = (state->m_clock_data >> 2) & 0x03; - operation = (state->m_clock_data >> 4) & 0x07; + m_clock_read = (m_clock_data >> 7); + m_clock_reg1 = (m_clock_data >> 2) & 0x03; + operation = (m_clock_data >> 4) & 0x07; - if ((state->m_clock_data & 0x40) == 0x00) + if ((m_clock_data & 0x40) == 0x00) { switch(operation) { case 0x00: /* read/write seconds register */ - state->m_clock_mode = CLOCKMODE_TIME; + m_clock_mode = CLOCKMODE_TIME; break; case 0x03: /* internal registers */ - if (state->m_clock_reg1 & 0x02) + if (m_clock_reg1 & 0x02) { - state->m_clock_mode = CLOCKMODE_BRAM2; - state->m_clock_reg1 = (state->m_clock_data & 0x07) << 5; + m_clock_mode = CLOCKMODE_BRAM2; + m_clock_reg1 = (m_clock_data & 0x07) << 5; } else { - state->m_clock_mode = CLOCKMODE_INTERNALREGS; + m_clock_mode = CLOCKMODE_INTERNALREGS; } break; @@ -186,20 +185,20 @@ static void process_clock(running_machine &machine) break; case CLOCKMODE_BRAM1: - if (state->m_clock_read) - state->m_clock_data = state->m_clock_bram[state->m_clock_reg1]; + if (m_clock_read) + m_clock_data = m_clock_bram[m_clock_reg1]; else - state->m_clock_bram[state->m_clock_reg1] = state->m_clock_data; - state->m_clock_mode = CLOCKMODE_IDLE; + m_clock_bram[m_clock_reg1] = m_clock_data; + m_clock_mode = CLOCKMODE_IDLE; break; case CLOCKMODE_BRAM2: - state->m_clock_reg1 |= (state->m_clock_data >> 2) & 0x1F; - state->m_clock_mode = CLOCKMODE_BRAM1; + m_clock_reg1 |= (m_clock_data >> 2) & 0x1F; + m_clock_mode = CLOCKMODE_BRAM1; break; case CLOCKMODE_INTERNALREGS: - switch (state->m_clock_reg1) + switch (m_clock_reg1) { case 0x00: /* test register */ @@ -209,20 +208,20 @@ static void process_clock(running_machine &machine) /* write protect register */ break; } - state->m_clock_mode = CLOCKMODE_IDLE; + m_clock_mode = CLOCKMODE_IDLE; break; case CLOCKMODE_TIME: - if (state->m_clock_data & 0x40) + if (m_clock_data & 0x40) { - state->m_clock_data = state->m_clock_curtime >> (state->m_clock_reg1 * 8); + m_clock_data = m_clock_curtime >> (m_clock_reg1 * 8); } else { - state->m_clock_curtime &= ~(0xFF << (state->m_clock_reg1 * 8)); - state->m_clock_curtime |= state->m_clock_data << (state->m_clock_reg1 * 8); + m_clock_curtime &= ~(0xFF << (m_clock_reg1 * 8)); + m_clock_curtime |= m_clock_data << (m_clock_reg1 * 8); } - state->m_clock_mode = CLOCKMODE_IDLE; + m_clock_mode = CLOCKMODE_IDLE; break; default: @@ -235,7 +234,7 @@ static void process_clock(running_machine &machine) * Interrupts * ----------------------------------------------------------------------- */ -static const char *apple2gs_irq_name(UINT16 irq_mask) +const char *apple2gs_state::apple2gs_irq_name(UINT16 irq_mask) { switch(irq_mask) { @@ -252,43 +251,42 @@ static const char *apple2gs_irq_name(UINT16 irq_mask) return NULL; } -void apple2gs_add_irq(running_machine &machine, UINT16 irq_mask) +void apple2gs_state::apple2gs_add_irq(UINT16 irq_mask) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); - if ((state->m_pending_irqs & irq_mask) == 0x00) + if ((m_pending_irqs & irq_mask) == 0x00) { if (LOG_IRQ) logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask)); - state->m_pending_irqs |= irq_mask; - state->m_maincpu->set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); + m_pending_irqs |= irq_mask; + m_maincpu->set_input_line(G65816_LINE_IRQ, m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); } } -void apple2gs_remove_irq(running_machine &machine, UINT16 irq_mask) +void apple2gs_state::apple2gs_remove_irq(UINT16 irq_mask) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); - if (state->m_pending_irqs & irq_mask) + if (m_pending_irqs & irq_mask) { if (LOG_IRQ) logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask)); - state->m_pending_irqs &= ~irq_mask; - state->m_maincpu->set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); + m_pending_irqs &= ~irq_mask; + m_maincpu->set_input_line(G65816_LINE_IRQ, m_pending_irqs ? ASSERT_LINE : CLEAR_LINE); } } void apple2gs_doc_irq(device_t *device, int state) { + apple2gs_state *drvstate = device->machine().driver_data<apple2gs_state>(); if (state) { - apple2gs_add_irq(device->machine(), IRQ_DOC); + drvstate->apple2gs_add_irq(IRQ_DOC); } else { - apple2gs_remove_irq(device->machine(), IRQ_DOC); + drvstate->apple2gs_remove_irq(IRQ_DOC); } } @@ -299,7 +297,7 @@ TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_clock_tick) if ((m_vgcint & 0x04) && !(m_vgcint & 0x40)) { m_vgcint |= 0xc0; - apple2gs_add_irq(machine(), IRQ_VGC_SECOND); + apple2gs_add_irq(IRQ_VGC_SECOND); } } @@ -310,7 +308,7 @@ TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_qsecond_tick) if ((m_inten & 0x10) && !(m_intflag & 0x10)) { m_intflag |= 0x10; - apple2gs_add_irq(machine(), IRQ_INTEN_QSECOND); + apple2gs_add_irq(IRQ_INTEN_QSECOND); } } @@ -321,77 +319,77 @@ TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_qsecond_tick) #if !RUN_ADB_MICRO -static UINT8 adb_read_memory(apple2gs_state *state, UINT32 address) +UINT8 apple2gs_state::adb_read_memory(UINT32 address) { - if (address < ARRAY_LENGTH(state->m_adb_memory)) - return state->m_adb_memory[address]; + if (address < ARRAY_LENGTH(m_adb_memory)) + return m_adb_memory[address]; else return 0x00; } -static void adb_write_memory(apple2gs_state *state, UINT32 address, UINT8 data) +void apple2gs_state::adb_write_memory(UINT32 address, UINT8 data) { - if (address < ARRAY_LENGTH(state->m_adb_memory)) - state->m_adb_memory[address] = data; + if (address < ARRAY_LENGTH(m_adb_memory)) + m_adb_memory[address] = data; } -static void adb_set_mode(apple2gs_state *state, UINT8 mode) +void apple2gs_state::adb_set_mode(UINT8 mode) { - state->m_adb_mode = mode; + m_adb_mode = mode; } -static void adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3) +void apple2gs_state::adb_set_config(UINT8 b1, UINT8 b2, UINT8 b3) { /* ignore for now */ } -static void adb_post_response(apple2gs_state *state, const UINT8 *bytes, size_t length) +void apple2gs_state::adb_post_response(const UINT8 *bytes, size_t length) { - assert(length < ARRAY_LENGTH(state->m_adb_response_bytes)); - memcpy(state->m_adb_response_bytes, bytes, length); + assert(length < ARRAY_LENGTH(m_adb_response_bytes)); + memcpy(m_adb_response_bytes, bytes, length); - state->m_adb_state = ADBSTATE_INRESPONSE; - state->m_adb_response_length = length; - state->m_adb_response_pos = 0; + m_adb_state = ADBSTATE_INRESPONSE; + m_adb_response_length = length; + m_adb_response_pos = 0; } -static void adb_post_response_1(apple2gs_state *state, UINT8 b) +void apple2gs_state::adb_post_response_1(UINT8 b) { - adb_post_response(state, &b, 1); + adb_post_response(&b, 1); } -static void adb_post_response_2(apple2gs_state *state, UINT8 b1, UINT8 b2) +void apple2gs_state::adb_post_response_2(UINT8 b1, UINT8 b2) { UINT8 b[2]; b[0] = b1; b[1] = b2; - adb_post_response(state, b, 2); + adb_post_response(b, 2); } -static void adb_do_command(apple2gs_state *state) +void apple2gs_state::adb_do_command() { int device; UINT32 address; UINT8 val; - state->m_adb_state = ADBSTATE_IDLE; + m_adb_state = ADBSTATE_IDLE; if (LOG_ADB) - logerror("adb_do_command(): adb_command=0x%02x\n", state->m_adb_command); + logerror("adb_do_command(): adb_command=0x%02x\n", m_adb_command); - switch(state->m_adb_command) + switch(m_adb_command) { case 0x00: /* ??? */ break; @@ -400,31 +398,31 @@ static void adb_do_command(apple2gs_state *state) break; case 0x04: /* set modes */ - adb_set_mode(state, state->m_adb_mode | state->m_adb_command_bytes[0]); + adb_set_mode(m_adb_mode | m_adb_command_bytes[0]); break; case 0x05: /* clear modes */ - adb_set_mode(state, state->m_adb_mode & ~state->m_adb_command_bytes[0]); + adb_set_mode(m_adb_mode & ~m_adb_command_bytes[0]); break; case 0x06: /* set config */ - adb_set_config(state->m_adb_command_bytes[0], state->m_adb_command_bytes[1], state->m_adb_command_bytes[2]); + adb_set_config(m_adb_command_bytes[0], m_adb_command_bytes[1], m_adb_command_bytes[2]); break; case 0x07: /* synchronize */ - adb_set_mode(state, state->m_adb_command_bytes[0]); - adb_set_config(state->m_adb_command_bytes[1], state->m_adb_command_bytes[2], state->m_adb_command_bytes[3]); + adb_set_mode(m_adb_command_bytes[0]); + adb_set_config(m_adb_command_bytes[1], m_adb_command_bytes[2], m_adb_command_bytes[3]); break; case 0x08: /* write memory */ - address = state->m_adb_command_bytes[0]; - val = state->m_adb_command_bytes[1]; - adb_write_memory(state, address, val); + address = m_adb_command_bytes[0]; + val = m_adb_command_bytes[1]; + adb_write_memory(address, val); break; case 0x09: /* read memory */ - address = (state->m_adb_command_bytes[1] << 8) | state->m_adb_command_bytes[0]; - adb_post_response_1(state, adb_read_memory(state, address)); + address = (m_adb_command_bytes[1] << 8) | m_adb_command_bytes[0]; + adb_post_response_1(adb_read_memory(address)); break; case 0x0a: /* ??? */ @@ -432,15 +430,15 @@ static void adb_do_command(apple2gs_state *state) break; case 0x0d: /* get version */ - adb_post_response_1(state, 0x06); + adb_post_response_1(0x06); break; case 0x0e: /* read available charsets */ - adb_post_response_2(state, 0x01, 0x00); + adb_post_response_2(0x01, 0x00); break; case 0x0f: /* read available layouts */ - adb_post_response_2(state, 0x01, 0x00); + adb_post_response_2(0x01, 0x00); break; case 0x12: /* mystery command 0x12 */ @@ -452,11 +450,11 @@ static void adb_do_command(apple2gs_state *state) case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: /* send data to device */ - device = state->m_adb_command & 0x0f; - if (device == state->m_adb_address_keyboard) + device = m_adb_command & 0x0f; + if (device == m_adb_address_keyboard) { } - else if (device == state->m_adb_address_mouse) + else if (device == m_adb_address_mouse) { } break; @@ -465,10 +463,10 @@ static void adb_do_command(apple2gs_state *state) break; default: - fatalerror("ADB command 0x%02x unimplemented\n", state->m_adb_command); + fatalerror("ADB command 0x%02x unimplemented\n", m_adb_command); break; } - state->m_adb_kmstatus |= 0x20; + m_adb_kmstatus |= 0x20; } @@ -500,18 +498,17 @@ UINT8 apple2gs_state::adb_read_datareg() } -static void adb_write_datareg(running_machine &machine, UINT8 data) +void apple2gs_state::adb_write_datareg(UINT8 data) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); if (LOG_ADB) logerror("adb_write_datareg(): data=0x%02x\n", data); - switch(state->m_adb_state) + switch(m_adb_state) { case ADBSTATE_IDLE: - state->m_adb_command = data; - state->m_adb_command_length = 0; - state->m_adb_command_pos = 0; + m_adb_command = data; + m_adb_command_length = 0; + m_adb_command_pos = 0; // printf("ADB command %02x\n", data); switch(data) @@ -522,52 +519,52 @@ static void adb_write_datareg(running_machine &machine, UINT8 data) break; case 0x03: /* flush keyboard buffer */ - state->m_adb_command_length = 0; + m_adb_command_length = 0; break; case 0x04: /* set modes */ case 0x05: /* clear modes */ - state->m_adb_command_length = 1; + m_adb_command_length = 1; break; case 0x06: /* set config */ - state->m_adb_command_length = 3; + m_adb_command_length = 3; break; case 0x07: /* synchronize */ - if (state->m_is_rom3) - state->m_adb_command_length = 8; // ROM 3 has 8 bytes: mode byte, 3 config bytes, kbd/mouse params, disk eject options + if (m_is_rom3) + m_adb_command_length = 8; // ROM 3 has 8 bytes: mode byte, 3 config bytes, kbd/mouse params, disk eject options else - state->m_adb_command_length = 4; // ROM 0/1 has 4 bytes sync + m_adb_command_length = 4; // ROM 0/1 has 4 bytes sync break; case 0x08: /* write memory */ case 0x09: /* read memory */ - state->m_adb_command_length = 2; + m_adb_command_length = 2; break; case 0x0a: /* ??? */ case 0x0b: /* ??? */ - state->m_adb_command_length = 0; + m_adb_command_length = 0; break; case 0x0d: /* get version */ - state->m_adb_command_length = 0; + m_adb_command_length = 0; break; case 0x0e: /* read available charsets */ - state->m_adb_command_length = 0; - state->m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ + m_adb_command_length = 0; + m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ break; case 0x0f: /* read available layouts */ - state->m_adb_command_length = 0; - state->m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ + m_adb_command_length = 0; + m_adb_state = ADBSTATE_INCOMMAND; /* HACK */ break; case 0x12: /* mystery command 0x12 */ case 0x13: /* mystery command 0x13 */ - state->m_adb_command_length = 2; + m_adb_command_length = 2; break; case 0x70: /* disable SRQ device 0 */ @@ -582,7 +579,7 @@ static void adb_write_datareg(running_machine &machine, UINT8 data) case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf: /* send data to device */ - state->m_adb_command_length = 2; + m_adb_command_length = 2; break; case 0xf2: @@ -594,28 +591,28 @@ static void adb_write_datareg(running_machine &machine, UINT8 data) } - if (state->m_adb_command_length > 0) + if (m_adb_command_length > 0) { - state->m_adb_state = ADBSTATE_INCOMMAND; + m_adb_state = ADBSTATE_INCOMMAND; if (LOG_ADB) - logerror("adb_write_datareg(): in command length %u\n", (unsigned) state->m_adb_command_length); + logerror("adb_write_datareg(): in command length %u\n", (unsigned) m_adb_command_length); } break; case ADBSTATE_INCOMMAND: - assert(state->m_adb_command_pos < ARRAY_LENGTH(state->m_adb_command_bytes)); + assert(m_adb_command_pos < ARRAY_LENGTH(m_adb_command_bytes)); // printf("ADB param %02x\n", data); - state->m_adb_command_bytes[state->m_adb_command_pos++] = data; + m_adb_command_bytes[m_adb_command_pos++] = data; break; case ADBSTATE_INRESPONSE: - state->m_adb_state = ADBSTATE_IDLE; + m_adb_state = ADBSTATE_IDLE; break; } /* do command if necessary */ - if ((state->m_adb_state == ADBSTATE_INCOMMAND) && (state->m_adb_command_pos >= state->m_adb_command_length)) - adb_do_command(state); + if ((m_adb_state == ADBSTATE_INCOMMAND) && (m_adb_command_pos >= m_adb_command_length)) + adb_do_command(); } // real rom 3 h/w reads 0x90 when idle, 0x98 when key pressed @@ -626,35 +623,34 @@ UINT8 apple2gs_state::adb_read_kmstatus() } -static void adb_write_kmstatus(apple2gs_state *state, UINT8 data) +void apple2gs_state::adb_write_kmstatus(UINT8 data) { - state->m_adb_kmstatus &= ~0x54; - state->m_adb_kmstatus |= data & 0x54; + m_adb_kmstatus &= ~0x54; + m_adb_kmstatus |= data & 0x54; } -static UINT8 adb_read_mousedata(running_machine &machine) +UINT8 apple2gs_state::adb_read_mousedata() { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); UINT8 result = 0x00; UINT8 absolute; INT8 delta; - if (state->m_adb_kmstatus & 0x80) // mouse register full + if (m_adb_kmstatus & 0x80) // mouse register full { - if (state->m_adb_kmstatus & 0x02) // H/V mouse data select + if (m_adb_kmstatus & 0x02) // H/V mouse data select { - absolute = state->m_mouse_y; - delta = state->m_mouse_dy; - state->m_adb_kmstatus &= ~0x82; - apple2gs_remove_irq(machine, IRQ_ADB_MOUSE); + absolute = m_mouse_y; + delta = m_mouse_dy; + m_adb_kmstatus &= ~0x82; + apple2gs_remove_irq(IRQ_ADB_MOUSE); } else { - absolute = state->m_mouse_x; - delta = state->m_mouse_dx; - state->m_adb_kmstatus |= 0x02; + absolute = m_mouse_x; + delta = m_mouse_dx; + m_adb_kmstatus |= 0x02; } if (delta > 63) @@ -668,7 +664,7 @@ static UINT8 adb_read_mousedata(running_machine &machine) } -static INT8 seven_bit_diff(UINT8 v1, UINT8 v2) +INT8 apple2gs_state::seven_bit_diff(UINT8 v1, UINT8 v2) { v1 -= v2; if (v1 & 0x40) @@ -680,53 +676,51 @@ static INT8 seven_bit_diff(UINT8 v1, UINT8 v2) -static void adb_check_mouse(running_machine &machine) +void apple2gs_state::adb_check_mouse() { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); UINT8 new_mouse_x, new_mouse_y; /* read mouse values */ - if ((state->m_adb_kmstatus & 0x80) == 0x00) + if ((m_adb_kmstatus & 0x80) == 0x00) { - new_mouse_x = state->m_adb_mousex->read(); - new_mouse_y = state->m_adb_mousey->read(); + new_mouse_x = m_adb_mousex->read(); + new_mouse_y = m_adb_mousey->read(); - if ((state->m_mouse_x != new_mouse_x) || (state->m_mouse_y != new_mouse_y)) + if ((m_mouse_x != new_mouse_x) || (m_mouse_y != new_mouse_y)) { - state->m_mouse_dx = seven_bit_diff(new_mouse_x, state->m_mouse_x); - state->m_mouse_dy = seven_bit_diff(new_mouse_y, state->m_mouse_y); - state->m_mouse_x = new_mouse_x; - state->m_mouse_y = new_mouse_y; - - state->m_adb_kmstatus |= 0x80; - state->m_adb_kmstatus &= ~0x02; - if (state->m_adb_kmstatus & 0x40) - apple2gs_add_irq(machine, IRQ_ADB_MOUSE); + m_mouse_dx = seven_bit_diff(new_mouse_x, m_mouse_x); + m_mouse_dy = seven_bit_diff(new_mouse_y, m_mouse_y); + m_mouse_x = new_mouse_x; + m_mouse_y = new_mouse_y; + + m_adb_kmstatus |= 0x80; + m_adb_kmstatus &= ~0x02; + if (m_adb_kmstatus & 0x40) + apple2gs_add_irq(IRQ_ADB_MOUSE); } } } #endif -static void apple2gs_set_scanint(running_machine &machine, UINT8 data) +void apple2gs_state::apple2gs_set_scanint(UINT8 data) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); /* second interrupt */ - if ((state->m_vgcint & 0x40) && !(data & 0x40)) + if ((m_vgcint & 0x40) && !(data & 0x40)) { - apple2gs_remove_irq(machine, IRQ_VGC_SECOND); - state->m_vgcint &= ~0xC0; + apple2gs_remove_irq(IRQ_VGC_SECOND); + m_vgcint &= ~0xC0; } /* scanline interrupt */ - if ((state->m_vgcint & 0x20) && !(data & 0x20)) + if ((m_vgcint & 0x20) && !(data & 0x20)) { - apple2gs_remove_irq(machine, IRQ_VGC_SCANLINE); - state->m_vgcint &= ~0xA0; + apple2gs_remove_irq(IRQ_VGC_SCANLINE); + m_vgcint &= ~0xA0; } - if (state->m_pending_irqs & (IRQ_VGC_SECOND | IRQ_VGC_SCANLINE)) - state->m_vgcint |= 0x80; + if (m_pending_irqs & (IRQ_VGC_SECOND | IRQ_VGC_SCANLINE)) + m_vgcint |= 0x80; } @@ -753,7 +747,7 @@ TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_scanline_tick) if (m_vgcint & 0x02) { m_vgcint |= 0x80; - apple2gs_add_irq(machine(), IRQ_VGC_SCANLINE); + apple2gs_add_irq(IRQ_VGC_SCANLINE); } } } @@ -764,7 +758,7 @@ TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_scanline_tick) if ((m_inten & 0x08) && !(m_intflag & 0x08)) { m_intflag |= 0x08; - apple2gs_add_irq(machine(), IRQ_INTEN_VBL); + apple2gs_add_irq(IRQ_INTEN_VBL); } } @@ -772,7 +766,7 @@ TIMER_CALLBACK_MEMBER(apple2gs_state::apple2gs_scanline_tick) if ((scanline % 8) == 0) { #if !RUN_ADB_MICRO - adb_check_mouse(machine()); + adb_check_mouse(); #endif /* call Apple II interrupt handler */ @@ -881,7 +875,7 @@ static WRITE8_HANDLER( gssnd_w ) // apple2gs_get_vpos - return the correct vertical counter value for the current scanline, // keeping borders in mind. -static int apple2gs_get_vpos(running_machine &machine) +int apple2gs_state::apple2gs_get_vpos() { int result, scan; static const UINT8 top_border_vert[BORDER_TOP] = @@ -891,7 +885,7 @@ static int apple2gs_get_vpos(running_machine &machine) }; - scan = machine.primary_screen->vpos(); + scan = machine().primary_screen->vpos(); if (scan < BORDER_TOP) { @@ -945,7 +939,7 @@ READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) #if RUN_ADB_MICRO result = keyglu_816_read(GLU_MOUSEX); #else - result = adb_read_mousedata(space.machine()); + result = adb_read_mousedata(); #endif break; @@ -986,7 +980,7 @@ READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) break; case 0x2E: /* C02E - VERTCNT */ - result = apple2gs_get_vpos(space.machine()) >> 1; + result = apple2gs_get_vpos() >> 1; break; case 0x2F: /* C02F - HORIZCNT */ @@ -996,7 +990,7 @@ READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r ) result += 0x40; } - if (apple2gs_get_vpos(space.machine()) & 1) + if (apple2gs_get_vpos() & 1) { result |= 0x80; } @@ -1140,7 +1134,7 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) #if RUN_ADB_MICRO keyglu_816_write(GLU_COMMAND, data); #else - adb_write_datareg(space.machine(), data); + adb_write_datareg(data); #endif break; @@ -1148,7 +1142,7 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) #if RUN_ADB_MICRO keyglu_816_write(GLU_SYSSTAT, data); #else - adb_write_kmstatus(this, data); + adb_write_kmstatus(data); #endif break; @@ -1166,11 +1160,11 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) break; case 0x31: /* C031 - DISKREG */ - apple2_iwm_setdiskreg(space.machine(), data); + apple2_iwm_setdiskreg(data); break; case 0x32: /* C032 - SCANINT */ - apple2gs_set_scanint(space.machine(), data); + apple2gs_set_scanint(data); break; case 0x33: /* C033 - CLOCKDATA */ @@ -1181,7 +1175,7 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) m_clock_control = data & 0x7F; m_bordercolor = data & 0x0F; if (data & 0x80) - process_clock(space.machine()); + process_clock(); break; case 0x35: /* C035 - SHADOW */ @@ -1215,19 +1209,19 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w ) case 0x41: /* C041 - INTEN */ m_inten = data & 0x1F; if ((m_inten & 0x10) == 0x00) - apple2gs_remove_irq(space.machine(), IRQ_INTEN_QSECOND); + apple2gs_remove_irq(IRQ_INTEN_QSECOND); if ((m_inten & 0x08) == 0x00) - apple2gs_remove_irq(space.machine(), IRQ_INTEN_VBL); + apple2gs_remove_irq(IRQ_INTEN_VBL); break; case 0x47: /* C047 - CLRVBLINT */ m_intflag &= ~0x18; - apple2gs_remove_irq(space.machine(), IRQ_INTEN_QSECOND); - apple2gs_remove_irq(space.machine(), IRQ_INTEN_VBL); + apple2gs_remove_irq(IRQ_INTEN_QSECOND); + apple2gs_remove_irq(IRQ_INTEN_VBL); break; case 0x68: /* C068 - STATEREG */ - apple2_setvar(space.machine(), + apple2_setvar( ((data & 0x80) ? VAR_ALTZP : 0) | ((data & 0x40) ? VAR_PAGE2 : 0) | ((data & 0x20) ? VAR_RAMRD : 0) | @@ -1562,35 +1556,33 @@ static const apple2_memmap_entry apple2gs_memmap_entries[] = -static UINT8 *apple2gs_getslotmem(running_machine &machine, offs_t address) +UINT8 *apple2gs_state::apple2gs_getslotmem(offs_t address) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); UINT8 *rom; address %= 0x00FFFF; assert(address >= 0xC000); assert(address <= 0xCFFF); - rom = state->m_rom; - rom += 0x030000 % machine.root_device().memregion("maincpu")->bytes(); + rom = m_rom; + rom += 0x030000 % machine().root_device().memregion("maincpu")->bytes(); return &rom[address]; } -static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, offs_t address) +UINT8 apple2gs_state::apple2gs_xxCxxx_r(address_space &space, offs_t address) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); UINT8 result; int slot; - if ((state->m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) // shadow all banks and C0xx? + if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) // shadow all banks and C0xx? { - result = machine.device<ram_device>(RAM_TAG)->pointer()[address]; + result = machine().device<ram_device>(RAM_TAG)->pointer()[address]; } else if ((address & 0x000F00) == 0x000000) // accessing C0xx? { - result = state->apple2gs_c0xx_r(state->m_maincpu->space(AS_PROGRAM), address, 0); + result = apple2gs_c0xx_r(m_maincpu->space(AS_PROGRAM), address, 0); } else { @@ -1599,15 +1591,15 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o slot = (address & 0x000F00) / 0x100; if (slot <= 7) // slots 1-7, it's the slot { - slotdevice = state->m_a2bus->get_a2bus_card(slot); + slotdevice = m_a2bus->get_a2bus_card(slot); // is this slot internal or "Your Card"? - if ((state->m_sltromsel & (1 << slot)) == 0) + if ((m_sltromsel & (1 << slot)) == 0) { // accessing a slot mapped to internal, let's put back the internal ROM - state->m_a2_cnxx_slot = -1; - state->apple2_update_memory(); - result = *apple2gs_getslotmem(machine, address); + m_a2_cnxx_slot = -1; + apple2_update_memory(); + result = *apple2gs_getslotmem(address); } else { @@ -1616,14 +1608,14 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o { if (slotdevice->take_c800()) { - state->m_a2_cnxx_slot = slot; - state->apple2_update_memory(); + m_a2_cnxx_slot = slot; + apple2_update_memory(); } result = slotdevice->read_cnxx(space, address&0xff); } else { - result = apple2_getfloatingbusvalue(machine); + result = apple2_getfloatingbusvalue(); } } } @@ -1636,14 +1628,14 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o { if ((address & 0xfff) == 0xfff) { - state->m_a2_cnxx_slot = -1; - state->apple2_update_memory(); + m_a2_cnxx_slot = -1; + apple2_update_memory(); } } - if ( state->m_a2_cnxx_slot >= 0 && state->m_a2_cnxx_slot <= 7 ) + if ( m_a2_cnxx_slot >= 0 && m_a2_cnxx_slot <= 7 ) { - slotdevice = state->m_a2bus->get_a2bus_card(state->m_a2_cnxx_slot); + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); } if (slotdevice) @@ -1652,7 +1644,7 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o } else { - result = *apple2gs_getslotmem(machine, address); + result = *apple2gs_getslotmem(address); } } } @@ -1661,9 +1653,8 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o -static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, offs_t address, UINT8 data) +void apple2gs_state::apple2gs_xxCxxx_w(address_space &space, offs_t address, UINT8 data) { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); int slot; // if CFFF accessed, reset C800 area to internal ROM @@ -1671,18 +1662,18 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of { if ((address & 0xfff) == 0xfff) { - state->m_a2_cnxx_slot = -1; - state->apple2_update_memory(); + m_a2_cnxx_slot = -1; + apple2_update_memory(); } } - if ((state->m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) + if ((m_shadow & 0x40) && ((address & 0xF00000) == 0x000000)) { - machine.device<ram_device>(RAM_TAG)->pointer()[address] = data; + machine().device<ram_device>(RAM_TAG)->pointer()[address] = data; } else if ((address & 0x000F00) == 0x000000) { - state->apple2gs_c0xx_w(state->m_maincpu->space(AS_PROGRAM), address, data, 0); + apple2gs_c0xx_w(m_maincpu->space(AS_PROGRAM), address, data, 0); } else { @@ -1692,15 +1683,15 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of if (slot <= 7) // slots 1-7, it's the slot { - slotdevice = state->m_a2bus->get_a2bus_card(slot); + slotdevice = m_a2bus->get_a2bus_card(slot); // is this slot internal or "Your Card"? - if ((state->m_sltromsel & (1 << slot)) == 0) + if ((m_sltromsel & (1 << slot)) == 0) { // accessing a slot mapped to internal, let's put back the internal ROM - state->m_a2_cnxx_slot = -1; - state->apple2_update_memory(); - *apple2gs_getslotmem(machine, address) = data; + m_a2_cnxx_slot = -1; + apple2_update_memory(); + *apple2gs_getslotmem(address) = data; } else { @@ -1709,8 +1700,8 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of { if (slotdevice->take_c800()) { - state->m_a2_cnxx_slot = slot; - state->apple2_update_memory(); + m_a2_cnxx_slot = slot; + apple2_update_memory(); } slotdevice->write_cnxx(space, address&0xff, data); } @@ -1724,13 +1715,13 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of // if CFFF accessed, reset C800 area to internal ROM if ((address & 0xfff) == 0xfff) { - state->m_a2_cnxx_slot = -1; - state->apple2_update_memory(); + m_a2_cnxx_slot = -1; + apple2_update_memory(); } - if ( state->m_a2_cnxx_slot >= 0 && state->m_a2_cnxx_slot <= 7 ) + if ( m_a2_cnxx_slot >= 0 && m_a2_cnxx_slot <= 7 ) { - slotdevice = state->m_a2bus->get_a2bus_card(state->m_a2_cnxx_slot); + slotdevice = m_a2bus->get_a2bus_card(m_a2_cnxx_slot); } if (slotdevice) @@ -1739,7 +1730,7 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of } else { - *apple2gs_getslotmem(machine, address) = data; + *apple2gs_getslotmem(address) = data; } } } @@ -1761,14 +1752,14 @@ DIRECT_UPDATE_MEMBER(apple2gs_state::apple2gs_opbase) else if ((address & 0x000F00) == 0x000000) { if (((address & 0xFF) >= 0x71) && ((address & 0xFF) <= 0x7F)) - opptr = apple2gs_getslotmem(machine(), address); + opptr = apple2gs_getslotmem(address); } else { slot = (address & 0x000F00) / 0x100; if ((slot > 7) || ((m_sltromsel & (1 << slot)) == 0)) - opptr = apple2gs_getslotmem(machine(), address); + opptr = apple2gs_getslotmem(address); } if (opptr != NULL) @@ -1783,15 +1774,15 @@ DIRECT_UPDATE_MEMBER(apple2gs_state::apple2gs_opbase) -static READ8_HANDLER( apple2gs_00Cxxx_r ) { return apple2gs_xxCxxx_r(space, space.machine(), offset | 0x00C000); } -static READ8_HANDLER( apple2gs_01Cxxx_r ) { return apple2gs_xxCxxx_r(space, space.machine(), offset | 0x01C000); } -static READ8_HANDLER( apple2gs_E0Cxxx_r ) { return apple2gs_xxCxxx_r(space, space.machine(), offset | 0xE0C000); } -static READ8_HANDLER( apple2gs_E1Cxxx_r ) { return apple2gs_xxCxxx_r(space, space.machine(), offset | 0xE1C000); } +static READ8_HANDLER( apple2gs_00Cxxx_r ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); return state->apple2gs_xxCxxx_r(space, offset | 0x00C000); } +static READ8_HANDLER( apple2gs_01Cxxx_r ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); return state->apple2gs_xxCxxx_r(space, offset | 0x01C000); } +static READ8_HANDLER( apple2gs_E0Cxxx_r ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); return state->apple2gs_xxCxxx_r(space, offset | 0xE0C000); } +static READ8_HANDLER( apple2gs_E1Cxxx_r ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); return state->apple2gs_xxCxxx_r(space, offset | 0xE1C000); } -static WRITE8_HANDLER( apple2gs_00Cxxx_w ) { apple2gs_xxCxxx_w(space, space.machine(), offset | 0x00C000, data); } -static WRITE8_HANDLER( apple2gs_01Cxxx_w ) { apple2gs_xxCxxx_w(space, space.machine(), offset | 0x01C000, data); } -static WRITE8_HANDLER( apple2gs_E0Cxxx_w ) { apple2gs_xxCxxx_w(space, space.machine(), offset | 0xE0C000, data); } -static WRITE8_HANDLER( apple2gs_E1Cxxx_w ) { apple2gs_xxCxxx_w(space, space.machine(), offset | 0xE1C000, data); } +static WRITE8_HANDLER( apple2gs_00Cxxx_w ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); state->apple2gs_xxCxxx_w(space, offset | 0x00C000, data); } +static WRITE8_HANDLER( apple2gs_01Cxxx_w ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); state->apple2gs_xxCxxx_w(space, offset | 0x01C000, data); } +static WRITE8_HANDLER( apple2gs_E0Cxxx_w ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); state->apple2gs_xxCxxx_w(space, offset | 0xE0C000, data); } +static WRITE8_HANDLER( apple2gs_E1Cxxx_w ) { apple2gs_state *state = space.machine().driver_data<apple2gs_state>(); state->apple2gs_xxCxxx_w(space, offset | 0xE1C000, data); } static WRITE8_HANDLER( apple2gs_Exxxxx_w ) { @@ -1829,41 +1820,40 @@ static READ8_HANDLER(apple2gs_bank_echo_r) return state->m_echo_bank + (offset>>16); } -static void apple2gs_setup_memory(running_machine &machine) +void apple2gs_state::apple2gs_setup_memory() { - apple2gs_state *state = machine.driver_data<apple2gs_state>(); - address_space& space = state->m_maincpu->space(AS_PROGRAM); + address_space& space = m_maincpu->space(AS_PROGRAM); offs_t begin, end; apple2_memmap_config cfg; /* allocate memory for E00000-E1FFFF */ - state->m_slowmem = auto_alloc_array_clear(machine, UINT8, 128*1024); - state_save_register_item_pointer(machine, "APPLE2GS_SLOWMEM", NULL, 0, state->m_slowmem, 128*1024); + m_slowmem = auto_alloc_array_clear(machine(), UINT8, 128*1024); + state_save_register_item_pointer(machine(), "APPLE2GS_SLOWMEM", NULL, 0, m_slowmem, 128*1024); // install expanded memory // fair warning: other code assumes banks 0 and 1 are the first 128k of the RAM device, so you must install bank 1 at 0x10000 // otherwise nothing works :) - if (state->m_is_rom3) + if (m_is_rom3) { - int ramsize = machine.device<ram_device>(RAM_TAG)->size(); + int ramsize = machine().device<ram_device>(RAM_TAG)->size(); // ROM 03 hardware: the quoted "1 MB" for a base machine doesn't include banks e0/e1, so map accordingly space.install_readwrite_bank(0x010000, ramsize - 1, "bank1"); - state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x010000); + membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x010000); space.install_legacy_read_handler( ramsize, 0xdfffff, FUNC(apple2gs_bank_echo_r)); - state->m_echo_bank = (ramsize >> 16); + m_echo_bank = (ramsize >> 16); } else { - int ramsize = machine.device<ram_device>(RAM_TAG)->size()-0x30000; + int ramsize = machine().device<ram_device>(RAM_TAG)->size()-0x30000; // ROM 00/01 hardware: the quoted "256K" for a base machine *does* include banks e0/e1. space.install_readwrite_bank(0x010000, ramsize - 1 + 0x10000, "bank1"); - state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0x010000); + membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x010000); space.install_legacy_read_handler( ramsize + 0x10000, 0xdfffff, FUNC(apple2gs_bank_echo_r)); - state->m_echo_bank = (ramsize+0x10000) >> 16; + m_echo_bank = (ramsize+0x10000) >> 16; } /* install hi memory */ @@ -1873,13 +1863,13 @@ static void apple2gs_setup_memory(running_machine &machine) space.install_legacy_write_handler(0xe02000, 0xe03fff, FUNC(apple2gs_E02xxx_w)); space.install_legacy_write_handler(0xe10400, 0xe107ff, FUNC(apple2gs_E104xx_w)); space.install_legacy_write_handler(0xe12000, 0xe13fff, FUNC(apple2gs_E12xxx_w)); - state->membank("bank2")->set_base(state->m_slowmem); + membank("bank2")->set_base(m_slowmem); /* install alternate ROM bank */ - begin = 0x1000000 - state->memregion("maincpu")->bytes(); + begin = 0x1000000 - memregion("maincpu")->bytes(); end = 0xffffff; space.install_read_bank(begin, end, "bank3"); - state->membank("bank3")->set_base(state->m_rom); + membank("bank3")->set_base(m_rom); /* install new xxC000-xxCFFF handlers */ space.install_legacy_read_handler(0x00c000, 0x00cfff, FUNC(apple2gs_00Cxxx_r)); @@ -1890,21 +1880,21 @@ static void apple2gs_setup_memory(running_machine &machine) space.install_legacy_write_handler(0xe0c000, 0xe0cfff, FUNC(apple2gs_E0Cxxx_w)); space.install_legacy_read_handler(0xe1c000, 0xe1cfff, FUNC(apple2gs_E1Cxxx_r)); space.install_legacy_write_handler(0xe1c000, 0xe1cfff, FUNC(apple2gs_E1Cxxx_w)); - space.set_direct_update_handler(direct_update_delegate(FUNC(apple2gs_state::apple2gs_opbase), state)); + space.set_direct_update_handler(direct_update_delegate(FUNC(apple2gs_state::apple2gs_opbase), this)); /* install aux memory writes (for shadowing) */ - space.install_write_handler(0x010400, 0x0107FF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux0400_w), state)); - space.install_write_handler(0x012000, 0x013FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux2000_w), state)); - space.install_write_handler(0x014000, 0x019FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux4000_w), state)); + space.install_write_handler(0x010400, 0x0107FF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux0400_w), this)); + space.install_write_handler(0x012000, 0x013FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux2000_w), this)); + space.install_write_handler(0x014000, 0x019FFF, write8_delegate(FUNC(apple2gs_state::apple2gs_aux4000_w), this)); /* setup the Apple II memory system */ memset(&cfg, 0, sizeof(cfg)); cfg.first_bank = 4; cfg.memmap = apple2gs_memmap_entries; - cfg.auxmem = state->m_slowmem; + cfg.auxmem = m_slowmem; cfg.auxmem_length = 0x20000; - state->apple2_setup_memory(&cfg); + apple2_setup_memory(&cfg); } @@ -1976,7 +1966,7 @@ MACHINE_RESET_MEMBER(apple2gs_state,apple2gs) MACHINE_START_MEMBER(apple2gs_state,apple2gscommon) { apple2gs_refresh_delegates(); - apple2_init_common(machine()); + apple2_init_common(); /* set up Apple IIgs vectoring */ g65816_set_read_vector_callback(m_maincpu, read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this)); @@ -2051,7 +2041,7 @@ MACHINE_START_MEMBER(apple2gs_state,apple2gscommon) MACHINE_START_MEMBER(apple2gs_state,apple2gs) { MACHINE_START_CALL_MEMBER(apple2gscommon); - apple2gs_setup_memory(machine()); + apple2gs_setup_memory(); } MACHINE_START_MEMBER(apple2gs_state,apple2gsr1) @@ -2059,7 +2049,7 @@ MACHINE_START_MEMBER(apple2gs_state,apple2gsr1) MACHINE_START_CALL_MEMBER(apple2gscommon); m_is_rom3 = false; - apple2gs_setup_memory(machine()); + apple2gs_setup_memory(); } void apple2gs_state::apple2gs_refresh_delegates() diff --git a/src/mess/machine/apple3.c b/src/mess/machine/apple3.c index b2296e1a838..a8097fb9e2b 100644 --- a/src/mess/machine/apple3.c +++ b/src/mess/machine/apple3.c @@ -36,13 +36,13 @@ static void apple3_update_drives(device_t *device); /* ----------------------------------------------------------------------- */ -static void apple3_profile_init(void) +void apple3_state::apple3_profile_init(void) { } -static void apple3_profile_statemachine(void) +void apple3_state::apple3_profile_statemachine(void) { } @@ -164,7 +164,7 @@ READ8_MEMBER(apple3_state::apple3_c0xx_r) break; case 0xDB: - apple3_write_charmem(machine()); + apple3_write_charmem(); break; case 0xE0: case 0xE1: case 0xE2: case 0xE3: @@ -228,7 +228,7 @@ WRITE8_MEMBER(apple3_state::apple3_c0xx_w) break; case 0xDB: - apple3_write_charmem(machine()); + apple3_write_charmem(); break; case 0xE0: case 0xE1: case 0xE2: case 0xE3: @@ -258,35 +258,34 @@ INTERRUPT_GEN_MEMBER(apple3_state::apple3_interrupt) -static UINT8 *apple3_bankaddr(running_machine &machine,UINT16 bank, offs_t offset) +UINT8 *apple3_state::apple3_bankaddr(UINT16 bank, offs_t offset) { if (bank != (UINT16) ~0) { - bank %= machine.device<ram_device>(RAM_TAG)->size() / 0x8000; - if ((bank + 1) == (machine.device<ram_device>(RAM_TAG)->size() / 0x8000)) + bank %= machine().device<ram_device>(RAM_TAG)->size() / 0x8000; + if ((bank + 1) == (machine().device<ram_device>(RAM_TAG)->size() / 0x8000)) bank = 0x02; } offset += ((offs_t) bank) * 0x8000; - offset %= machine.device<ram_device>(RAM_TAG)->size(); - return &machine.device<ram_device>(RAM_TAG)->pointer()[offset]; + offset %= machine().device<ram_device>(RAM_TAG)->size(); + return &machine().device<ram_device>(RAM_TAG)->pointer()[offset]; } -static void apple3_setbank(running_machine &machine,const char *mame_bank, UINT16 bank, offs_t offset) +void apple3_state::apple3_setbank(const char *mame_bank, UINT16 bank, offs_t offset) { UINT8 *ptr; - apple3_state *state = machine.driver_data<apple3_state>(); - ptr = apple3_bankaddr(machine,bank, offset); - state->membank(mame_bank)->set_base(ptr); + ptr = apple3_bankaddr(bank, offset); + membank(mame_bank)->set_base(ptr); #if 0 if (LOG_MEMORY) { #ifdef PTR64 - //logerror("\tbank %s --> %02x/%04x [0x%08lx]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - machine.device<ram_device>(RAM_TAG)->pointer()); + //logerror("\tbank %s --> %02x/%04x [0x%08lx]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - machine().device<ram_device>(RAM_TAG)->pointer()); #else - logerror("\tbank %s --> %02x/%04x [0x%08lx]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - machine.device<ram_device>(RAM_TAG)->pointer()); + logerror("\tbank %s --> %02x/%04x [0x%08lx]\n", mame_bank, (unsigned) bank, (unsigned)offset, ptr - machine().device<ram_device>(RAM_TAG)->pointer()); #endif } #endif @@ -294,66 +293,64 @@ static void apple3_setbank(running_machine &machine,const char *mame_bank, UINT1 -static UINT8 *apple3_get_zpa_addr(running_machine &machine,offs_t offset) +UINT8 *apple3_state::apple3_get_zpa_addr(offs_t offset) { - apple3_state *state = machine.driver_data<apple3_state>(); - state->m_zpa = (((offs_t) state->m_via_0_b) * 0x100) + offset; + m_zpa = (((offs_t) m_via_0_b) * 0x100) + offset; - if (state->m_via_0_b < 0x20) - return apple3_bankaddr(machine,~0, state->m_zpa); - else if (state->m_via_0_b > 0x9F) - return apple3_bankaddr(machine,~0, state->m_zpa - 0x8000); + if (m_via_0_b < 0x20) + return apple3_bankaddr(~0, m_zpa); + else if (m_via_0_b > 0x9F) + return apple3_bankaddr(~0, m_zpa - 0x8000); else - return apple3_bankaddr(machine,state->m_via_1_a, state->m_zpa - 0x2000); + return apple3_bankaddr(m_via_1_a, m_zpa - 0x2000); } READ8_MEMBER(apple3_state::apple3_00xx_r) { - return *apple3_get_zpa_addr(machine(),offset); + return *apple3_get_zpa_addr(offset); } WRITE8_MEMBER(apple3_state::apple3_00xx_w) { - *apple3_get_zpa_addr(machine(),offset) = data; + *apple3_get_zpa_addr(offset) = data; } -static void apple3_update_memory(running_machine &machine) +void apple3_state::apple3_update_memory() { - apple3_state *state = machine.driver_data<apple3_state>(); UINT16 bank; UINT8 page; - address_space& space = state->m_maincpu->space(AS_PROGRAM); + address_space& space = m_maincpu->space(AS_PROGRAM); if (LOG_MEMORY) { - logerror("apple3_update_memory(): via_0_b=0x%02x via_1_a=0x0x%02x\n", state->m_via_0_b, state->m_via_1_a); + logerror("apple3_update_memory(): via_0_b=0x%02x via_1_a=0x0x%02x\n", m_via_0_b, m_via_1_a); } - machine.device("maincpu")->set_unscaled_clock((state->m_via_0_a & 0x80) ? 1000000 : 2000000); + machine().device("maincpu")->set_unscaled_clock((m_via_0_a & 0x80) ? 1000000 : 2000000); /* bank 2 (0100-01FF) */ - if (!(state->m_via_0_a & 0x04)) + if (!(m_via_0_a & 0x04)) { - if (state->m_via_0_b < 0x20) + if (m_via_0_b < 0x20) { bank = ~0; /* system bank */ - page = state->m_via_0_b ^ 0x01; + page = m_via_0_b ^ 0x01; } - else if (state->m_via_0_b >= 0xA0) + else if (m_via_0_b >= 0xA0) { bank = ~0; /* system bank */ - page = (state->m_via_0_b ^ 0x01) - 0x80; + page = (m_via_0_b ^ 0x01) - 0x80; } else { - bank = state->m_via_1_a; - page = (state->m_via_0_b ^ 0x01) - 0x20; + bank = m_via_1_a; + page = (m_via_0_b ^ 0x01) - 0x20; } } else @@ -361,94 +358,94 @@ static void apple3_update_memory(running_machine &machine) bank = ~0; page = 0x01; } - apple3_setbank(machine,"bank2", bank, ((offs_t) page) * 0x100); + apple3_setbank("bank2", bank, ((offs_t) page) * 0x100); /* bank 3 (0200-1FFF) */ - apple3_setbank(machine,"bank3", ~0, 0x0200); + apple3_setbank("bank3", ~0, 0x0200); /* bank 4 (2000-9FFF) */ - apple3_setbank(machine,"bank4", state->m_via_1_a, 0x0000); + apple3_setbank("bank4", m_via_1_a, 0x0000); /* bank 5 (A000-BFFF) */ - apple3_setbank(machine,"bank5", ~0, 0x2000); + apple3_setbank("bank5", ~0, 0x2000); /* install bank 8 (C000-CFFF) */ - if (state->m_via_0_a & 0x40) + if (m_via_0_a & 0x40) { - space.install_read_handler(0xC000, 0xC0FF, read8_delegate(FUNC(apple3_state::apple3_c0xx_r),state)); - space.install_write_handler(0xC000, 0xC0FF, write8_delegate(FUNC(apple3_state::apple3_c0xx_w),state)); + space.install_read_handler(0xC000, 0xC0FF, read8_delegate(FUNC(apple3_state::apple3_c0xx_r),this)); + space.install_write_handler(0xC000, 0xC0FF, write8_delegate(FUNC(apple3_state::apple3_c0xx_w),this)); } else { space.install_read_bank(0xC000, 0xC0FF, "bank8"); - if (state->m_via_0_a & 0x08) + if (m_via_0_a & 0x08) space.unmap_write(0xC000, 0xC0FF); else space.install_write_bank(0xC000, 0xC0FF, "bank8"); - apple3_setbank(machine,"bank8", ~0, 0x4000); + apple3_setbank("bank8", ~0, 0x4000); } /* install bank 9 (C100-C4FF) */ - if (state->m_via_0_a & 0x40) + if (m_via_0_a & 0x40) { space.nop_readwrite(0xC100, 0xC4FF); } else { space.install_read_bank(0xC100, 0xC4FF, "bank9"); - if (state->m_via_0_a & 0x08) + if (m_via_0_a & 0x08) space.unmap_write(0xC100, 0xC4FF); else space.install_write_bank(0xC100, 0xC4FF, "bank9"); - apple3_setbank(machine,"bank9", ~0, 0x4100); + apple3_setbank("bank9", ~0, 0x4100); } /* install bank 10 (C500-C7FF) */ space.install_read_bank(0xC500, 0xC7FF, "bank10"); - if (state->m_via_0_a & 0x08) + if (m_via_0_a & 0x08) space.unmap_write(0xC500, 0xC7FF); else space.install_write_bank(0xC500, 0xC7FF, "bank10"); - apple3_setbank(machine,"bank10", ~0, 0x4500); + apple3_setbank("bank10", ~0, 0x4500); /* install bank 11 (C800-CFFF) */ - if (state->m_via_0_a & 0x40) + if (m_via_0_a & 0x40) { space.nop_readwrite(0xC800, 0xCFFF); } else { space.install_read_bank(0xC800, 0xCFFF, "bank11"); - if (state->m_via_0_a & 0x08) + if (m_via_0_a & 0x08) space.unmap_write(0xC800, 0xCFFF); else space.install_write_bank(0xC800, 0xCFFF, "bank11"); - apple3_setbank(machine,"bank11", ~0, 0x4800); + apple3_setbank("bank11", ~0, 0x4800); } /* install bank 6 (D000-EFFF) */ space.install_read_bank(0xD000, 0xEFFF, "bank6"); - if (state->m_via_0_a & 0x08) + if (m_via_0_a & 0x08) space.unmap_write(0xD000, 0xEFFF); else space.install_write_bank(0xD000, 0xEFFF, "bank6"); - apple3_setbank(machine,"bank6", ~0, 0x5000); + apple3_setbank("bank6", ~0, 0x5000); /* install bank 7 (F000-FFFF) */ space.install_read_bank(0xF000, 0xFFFF, "bank7"); - if (state->m_via_0_a & 0x09) + if (m_via_0_a & 0x09) space.unmap_write(0xF000, 0xFFFF); else space.install_write_bank(0xF000, 0xFFFF, "bank7"); - if (state->m_via_0_a & 0x01) - state->membank("bank7")->set_base(machine.root_device().memregion("maincpu")->base()); + if (m_via_0_a & 0x01) + membank("bank7")->set_base(machine().root_device().memregion("maincpu")->base()); else - apple3_setbank(machine,"bank7", ~0, 0x7000); + apple3_setbank("bank7", ~0, 0x7000); /* reinstall VIA handlers */ { - via6522_device *via_0 = space.machine().device<via6522_device>("via6522_0"); - via6522_device *via_1 = space.machine().device<via6522_device>("via6522_1"); + via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); + via6522_device *via_1 = machine().device<via6522_device>("via6522_1"); space.install_readwrite_handler(0xFFD0, 0xFFDF, 0, 0, read8_delegate(FUNC(via6522_device::read),via_0), write8_delegate(FUNC(via6522_device::write),via_0)); space.install_readwrite_handler(0xFFE0, 0xFFEF, 0, 0, read8_delegate(FUNC(via6522_device::read),via_1), write8_delegate(FUNC(via6522_device::write),via_1)); @@ -457,12 +454,12 @@ static void apple3_update_memory(running_machine &machine) -static void apple3_via_out(running_machine &machine, UINT8 *var, UINT8 data) +void apple3_state::apple3_via_out(UINT8 *var, UINT8 data) { if (*var != data) { *var = data; - apple3_update_memory(machine); + apple3_update_memory(); } } @@ -473,22 +470,22 @@ READ8_MEMBER(apple3_state::apple3_via_1_in_b){ return ~0; } WRITE8_MEMBER(apple3_state::apple3_via_0_out_a) { - apple3_via_out(machine(), &m_via_0_a, data); + apple3_via_out(&m_via_0_a, data); } WRITE8_MEMBER(apple3_state::apple3_via_0_out_b) { - apple3_via_out(machine(), &m_via_0_b, data); + apple3_via_out(&m_via_0_b, data); } WRITE8_MEMBER(apple3_state::apple3_via_1_out_a) { - apple3_via_out(machine(), &m_via_1_a, data); + apple3_via_out(&m_via_1_a, data); } WRITE8_MEMBER(apple3_state::apple3_via_1_out_b) { - apple3_via_out(machine(), &m_via_1_b, data); + apple3_via_out(&m_via_1_b, data); } WRITE_LINE_MEMBER(apple3_state::apple2_via_1_irq_func) @@ -543,22 +540,21 @@ MACHINE_RESET_MEMBER(apple3_state,apple3) -static UINT8 *apple3_get_indexed_addr(running_machine &machine,offs_t offset) +UINT8 *apple3_state::apple3_get_indexed_addr(offs_t offset) { - apple3_state *state = machine.driver_data<apple3_state>(); UINT8 n; UINT8 *result = NULL; - if ((state->m_via_0_b >= 0x18) && (state->m_via_0_b <= 0x1F)) + if ((m_via_0_b >= 0x18) && (m_via_0_b <= 0x1F)) { - n = *apple3_bankaddr(machine,~0, state->m_zpa ^ 0x0C00); + n = *apple3_bankaddr(~0, m_zpa ^ 0x0C00); if (LOG_INDXADDR) { - if (state->m_last_n != n) + if (m_last_n != n) { - logerror("indxaddr: zpa=0x%04x n=0x%02x\n", state->m_zpa, n); - state->m_last_n = n; + logerror("indxaddr: zpa=0x%04x n=0x%02x\n", m_zpa, n); + m_last_n = n; } } @@ -566,42 +562,42 @@ static UINT8 *apple3_get_indexed_addr(running_machine &machine,offs_t offset) { /* get at that special ram under the VIAs */ if ((offset >= 0xFFD0) && (offset <= 0xFFEF)) - result = apple3_bankaddr(machine,~0, offset & 0x7FFF); + result = apple3_bankaddr(~0, offset & 0x7FFF); else if (offset < 0x2000) - result = apple3_bankaddr(machine,~0, offset - 0x2000); + result = apple3_bankaddr(~0, offset - 0x2000); else if (offset > 0x9FFF) - result = apple3_bankaddr(machine,~0, offset - 0x8000); + result = apple3_bankaddr(~0, offset - 0x8000); else - result = &machine.device<ram_device>(RAM_TAG)->pointer()[offset - 0x2000]; + result = &machine().device<ram_device>(RAM_TAG)->pointer()[offset - 0x2000]; } else if ((n >= 0x80) && (n <= 0x8E)) { if (offset < 0x0100) - result = apple3_bankaddr(machine,~0, ((offs_t) state->m_via_0_b) * 0x100 + offset); + result = apple3_bankaddr(~0, ((offs_t) m_via_0_b) * 0x100 + offset); else - result = apple3_bankaddr(machine,n, offset); + result = apple3_bankaddr(n, offset); } else if (n == 0xFF) { if (offset < 0x2000) - result = apple3_bankaddr(machine,~0, offset - 0x2000); + result = apple3_bankaddr(~0, offset - 0x2000); else if (offset < 0xA000) - result = apple3_bankaddr(machine,state->m_via_1_a, offset - 0x2000); + result = apple3_bankaddr(m_via_1_a, offset - 0x2000); else if (offset < 0xC000) - result = apple3_bankaddr(machine,~0, offset - 0x8000); + result = apple3_bankaddr(~0, offset - 0x8000); else if (offset < 0xD000) result = NULL; else if (offset < 0xF000) - result = apple3_bankaddr(machine,~0, offset - 0x8000); + result = apple3_bankaddr(~0, offset - 0x8000); else result = (UINT8 *) ~0; } else if (offset < 0x0100) { - result = apple3_bankaddr(machine,~0, ((offs_t) state->m_via_0_b) * 0x100 + offset); + result = apple3_bankaddr(~0, ((offs_t) m_via_0_b) * 0x100 + offset); } } - else if ((offset >= 0xF000) && (state->m_via_0_a & 0x01)) + else if ((offset >= 0xF000) && (m_via_0_a & 0x01)) { #if 0 /* The Apple /// Diagnostics seems to expect that indexed writes @@ -610,7 +606,7 @@ static UINT8 *apple3_get_indexed_addr(running_machine &machine,offs_t offset) * emulator does not have corresponding code here, though Chris * Smolinski does not rule out the possibility */ - result = apple3_bankaddr(machine,~0, offset - 0x8000); + result = apple3_bankaddr(~0, offset - 0x8000); #endif } @@ -624,7 +620,7 @@ READ8_MEMBER(apple3_state::apple3_indexed_read) UINT8 result; UINT8 *addr; address_space& prog_space = m_maincpu->space(AS_PROGRAM); - addr = apple3_get_indexed_addr(machine(),offset); + addr = apple3_get_indexed_addr(offset); if (!addr) result = prog_space.read_byte(offset); else if (addr != (UINT8 *) ~0) @@ -640,7 +636,7 @@ WRITE8_MEMBER(apple3_state::apple3_indexed_write) { UINT8 *addr; address_space& prog_space = m_maincpu->space(AS_PROGRAM); - addr = apple3_get_indexed_addr(machine(),offset); + addr = apple3_get_indexed_addr(offset); if (!addr) prog_space.write_byte(offset, data); else if (addr != (UINT8 *) ~0) @@ -655,7 +651,7 @@ DIRECT_UPDATE_MEMBER(apple3_state::apple3_opbase) if ((address & 0xFF00) == 0x0000) { - opptr = apple3_get_zpa_addr(machine(),address); + opptr = apple3_get_zpa_addr(address); direct.explicit_configure(address, address, ~0, opptr - address); address = ~0; } @@ -728,7 +724,7 @@ DRIVER_INIT_MEMBER(apple3_state,apple3) m_via_0_a = ~0; m_via_1_a = ~0; m_via_1_irq = 0; - apple3_update_memory(machine()); + apple3_update_memory(); m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(apple3_state::apple3_opbase), this)); } diff --git a/src/mess/machine/at.c b/src/mess/machine/at.c index 216db167831..dbe4da18495 100644 --- a/src/mess/machine/at.c +++ b/src/mess/machine/at.c @@ -317,37 +317,36 @@ WRITE8_MEMBER( at_state::at_portb_w ) * **********************************************************/ -static void init_at_common(running_machine &machine) +void at_state::init_at_common() { - at_state *state = machine.driver_data<at_state>(); - address_space& space = state->m_maincpu->space(AS_PROGRAM); + address_space& space = m_maincpu->space(AS_PROGRAM); // The CS4031 chipset does this itself - if (machine.device("cs4031") == NULL) + if (machine().device("cs4031") == NULL) { /* MESS managed RAM */ - state->membank("bank10")->set_base(machine.device<ram_device>(RAM_TAG)->pointer()); + membank("bank10")->set_base(machine().device<ram_device>(RAM_TAG)->pointer()); - if (machine.device<ram_device>(RAM_TAG)->size() > 0x0a0000) + if (machine().device<ram_device>(RAM_TAG)->size() > 0x0a0000) { - offs_t ram_limit = 0x100000 + machine.device<ram_device>(RAM_TAG)->size() - 0x0a0000; + offs_t ram_limit = 0x100000 + machine().device<ram_device>(RAM_TAG)->size() - 0x0a0000; space.install_read_bank(0x100000, ram_limit - 1, "bank1"); space.install_write_bank(0x100000, ram_limit - 1, "bank1"); - state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + 0xa0000); + membank("bank1")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xa0000); } } - state->m_at_offset1 = 0xff; + m_at_offset1 = 0xff; } DRIVER_INIT_MEMBER(at_state,atcga) { - init_at_common(machine()); + init_at_common(); } DRIVER_INIT_MEMBER(at_state,atvga) { - init_at_common(machine()); + init_at_common(); } IRQ_CALLBACK_MEMBER(at_state::at_irq_callback) diff --git a/src/mess/machine/b2m.c b/src/mess/machine/b2m.c index 7bdbd779aa7..65bb7c80e59 100644 --- a/src/mess/machine/b2m.c +++ b/src/mess/machine/b2m.c @@ -40,12 +40,11 @@ READ8_MEMBER(b2m_state::b2m_keyboard_r) } -static void b2m_set_bank(running_machine &machine,int bank) +void b2m_state::b2m_set_bank(int bank) { UINT8 *rom; - b2m_state *state = machine.driver_data<b2m_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); space.install_write_bank(0x0000, 0x27ff, "bank1"); space.install_write_bank(0x2800, 0x2fff, "bank2"); @@ -53,78 +52,78 @@ static void b2m_set_bank(running_machine &machine,int bank) space.install_write_bank(0x7000, 0xdfff, "bank4"); space.install_write_bank(0xe000, 0xffff, "bank5"); - rom = state->memregion("maincpu")->base(); + rom = memregion("maincpu")->base(); switch(bank) { case 0 : case 1 : space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(ram); - state->membank("bank2")->set_base(ram + 0x2800); - state->membank("bank3")->set_base(ram + 0x3000); - state->membank("bank4")->set_base(ram + 0x7000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x2800); + membank("bank3")->set_base(ram + 0x3000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); break; #if 0 case 1 : space.unmap_write(0x3000, 0x6fff); space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(ram); - state->membank("bank2")->set_base(ram + 0x2800); - state->membank("bank3")->set_base(rom + 0x12000); - state->membank("bank4")->set_base(rom + 0x16000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x2800); + membank("bank3")->set_base(rom + 0x12000); + membank("bank4")->set_base(rom + 0x16000); + membank("bank5")->set_base(rom + 0x10000); break; #endif case 2 : space.unmap_write(0x2800, 0x2fff); space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state)); - state->membank("bank3")->set_base(ram + 0x10000); - state->membank("bank4")->set_base(ram + 0x7000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x10000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); break; case 3 : space.unmap_write(0x2800, 0x2fff); space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state)); - state->membank("bank3")->set_base(ram + 0x14000); - state->membank("bank4")->set_base(ram + 0x7000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x14000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); break; case 4 : space.unmap_write(0x2800, 0x2fff); space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state)); - state->membank("bank3")->set_base(ram + 0x18000); - state->membank("bank4")->set_base(ram + 0x7000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x18000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); break; case 5 : space.unmap_write(0x2800, 0x2fff); space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(ram); - space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),state)); - state->membank("bank3")->set_base(ram + 0x1c000); - state->membank("bank4")->set_base(ram + 0x7000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(ram); + space.install_read_handler(0x2800, 0x2fff, read8_delegate(FUNC(b2m_state::b2m_keyboard_r),this)); + membank("bank3")->set_base(ram + 0x1c000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(rom + 0x10000); break; case 6 : - state->membank("bank1")->set_base(ram); - state->membank("bank2")->set_base(ram + 0x2800); - state->membank("bank3")->set_base(ram + 0x3000); - state->membank("bank4")->set_base(ram + 0x7000); - state->membank("bank5")->set_base(ram + 0xe000); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x2800); + membank("bank3")->set_base(ram + 0x3000); + membank("bank4")->set_base(ram + 0x7000); + membank("bank5")->set_base(ram + 0xe000); break; case 7 : space.unmap_write(0x0000, 0x27ff); @@ -133,11 +132,11 @@ static void b2m_set_bank(running_machine &machine,int bank) space.unmap_write(0x7000, 0xdfff); space.unmap_write(0xe000, 0xffff); - state->membank("bank1")->set_base(rom + 0x10000); - state->membank("bank2")->set_base(rom + 0x10000); - state->membank("bank3")->set_base(rom + 0x10000); - state->membank("bank4")->set_base(rom + 0x10000); - state->membank("bank5")->set_base(rom + 0x10000); + membank("bank1")->set_base(rom + 0x10000); + membank("bank2")->set_base(rom + 0x10000); + membank("bank3")->set_base(rom + 0x10000); + membank("bank4")->set_base(rom + 0x10000); + membank("bank5")->set_base(rom + 0x10000); break; } } @@ -181,7 +180,7 @@ WRITE8_MEMBER(b2m_state::b2m_8255_portb_w) WRITE8_MEMBER(b2m_state::b2m_8255_portc_w) { m_b2m_8255_portc = data; - b2m_set_bank(machine(), m_b2m_8255_portc & 7); + b2m_set_bank(m_b2m_8255_portc & 7); m_b2m_video_page = (m_b2m_8255_portc >> 7) & 1; } @@ -320,7 +319,7 @@ READ8_MEMBER(b2m_state::b2m_localmachine_r) void b2m_state::b2m_postload() { - b2m_set_bank(machine(), m_b2m_8255_portc & 7); + b2m_set_bank(m_b2m_8255_portc & 7); } void b2m_state::machine_start() @@ -371,5 +370,5 @@ void b2m_state::machine_reset() m_b2m_drive = 0; m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(b2m_state::b2m_irq_callback),this)); - b2m_set_bank(machine(), 7); + b2m_set_bank(7); } diff --git a/src/mess/machine/bbc.c b/src/mess/machine/bbc.c index 95cbf7f5090..3e1842e7722 100644 --- a/src/mess/machine/bbc.c +++ b/src/mess/machine/bbc.c @@ -117,12 +117,11 @@ WRITE8_MEMBER(bbc_state::bbc_memoryb4_w) PC is in the range c000 to dfff or if pagedRAM set and PC is in the range a000 to afff */ -static int vdudriverset(running_machine &machine) +int bbc_state::vdudriverset() { - bbc_state *state = machine.driver_data<bbc_state>(); int PC; - PC = machine.device("maincpu")->safe_pc(); // this needs to be set to the 6502 program counter - return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((state->m_pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff)))); + PC = machine().device("maincpu")->safe_pc(); // this needs to be set to the 6502 program counter + return (((PC >= 0xc000) && (PC <= 0xdfff)) || ((m_pagedRAM) && ((PC >= 0xa000) && (PC <= 0xafff)))); } @@ -190,7 +189,7 @@ DIRECT_UPDATE_MEMBER(bbc_state::bbcbp_direct_handler) } else { - if (vdudriverset(machine())) + if (vdudriverset()) { // if VDUDriver set then read from shadow ram m_bank2->set_base(ram + 0xb000); @@ -215,7 +214,7 @@ WRITE8_MEMBER(bbc_state::bbc_memorybp2_w) } else { - if (vdudriverset(machine())) + if (vdudriverset()) { // if VDUDriver set then write to shadow ram ram[offset + 0xb000] = data; @@ -395,10 +394,10 @@ WRITE8_MEMBER(bbc_state::bbcm_ACCCON_write) } -static int bbcm_vdudriverset(running_machine &machine) +int bbc_state::bbcm_vdudriverset() { int PC; - PC = machine.device("maincpu")->safe_pc(); + PC = machine().device("maincpu")->safe_pc(); return ((PC >= 0xc000) && (PC <= 0xdfff)); } @@ -436,7 +435,7 @@ DIRECT_UPDATE_MEMBER(bbc_state::bbcm_direct_handler) } else { - if (m_ACCCON_E && bbcm_vdudriverset(machine())) + if (m_ACCCON_E && bbcm_vdudriverset()) { m_bank2->set_base( m_region_maincpu->base() + 0xb000 ); } @@ -460,7 +459,7 @@ WRITE8_MEMBER(bbc_state::bbc_memorybm2_w) } else { - if (m_ACCCON_E && bbcm_vdudriverset(machine())) + if (m_ACCCON_E && bbcm_vdudriverset()) { ram[offset + 0xb000] = data; } @@ -812,9 +811,8 @@ INTERRUPT_GEN_MEMBER(bbc_state::bbcm_keyscan) -static int bbc_keyboard(address_space &space, int data) +int bbc_state::bbc_keyboard(address_space &space, int data) { - bbc_state *state = space.machine().driver_data<bbc_state>(); int bit; int row; int res; @@ -824,14 +822,14 @@ static int bbc_keyboard(address_space &space, int data) }; via6522_device *via_0 = space.machine().device<via6522_device>("via6522_0"); - state->m_column = data & 0x0f; + m_column = data & 0x0f; row = (data>>4) & 0x07; bit = 0; - if (state->m_column < 10) + if (m_column < 10) { - res = state->ioport(colnames[state->m_column])->read(); + res = ioport(colnames[m_column])->read(); } else { @@ -857,50 +855,49 @@ static int bbc_keyboard(address_space &space, int data) } -static void bbcb_IC32_initialise(bbc_state *state) +void bbc_state::bbcb_IC32_initialise(bbc_state *state) { - state->m_b0_sound=0x01; // Sound is negative edge trigered - state->m_b1_speech_read=0x01; // ???? - state->m_b2_speech_write=0x01; // ???? - state->m_b3_keyboard=0x01; // Keyboard is negative edge trigered - state->m_b4_video0=0x01; - state->m_b5_video1=0x01; - state->m_b6_caps_lock_led=0x01; - state->m_b7_shift_lock_led=0x01; + m_b0_sound=0x01; // Sound is negative edge trigered + m_b1_speech_read=0x01; // ???? + m_b2_speech_write=0x01; // ???? + m_b3_keyboard=0x01; // Keyboard is negative edge trigered + m_b4_video0=0x01; + m_b5_video1=0x01; + m_b6_caps_lock_led=0x01; + m_b7_shift_lock_led=0x01; } /* This the BBC Masters Real Time Clock and NVRam IC */ -static void MC146818_set(address_space &space) +void bbc_state::MC146818_set(address_space &space) { - bbc_state *state = space.machine().driver_data<bbc_state>(); - logerror ("146181 WR=%d DS=%d AS=%d CE=%d \n",state->m_MC146818_WR,state->m_MC146818_DS,state->m_MC146818_AS,state->m_MC146818_CE); + logerror ("146181 WR=%d DS=%d AS=%d CE=%d \n",m_MC146818_WR,m_MC146818_DS,m_MC146818_AS,m_MC146818_CE); mc146818_device *rtc = space.machine().device<mc146818_device>("rtc"); // if chip enabled - if (state->m_MC146818_CE) + if (m_MC146818_CE) { // if data select is set then access the data in the 146818 - if (state->m_MC146818_DS) + if (m_MC146818_DS) { - if (state->m_MC146818_WR) + if (m_MC146818_WR) { - state->m_via_system_porta=rtc->read(space, 1); - //logerror("read 146818 data %d \n",state->m_via_system_porta); + m_via_system_porta=rtc->read(space, 1); + //logerror("read 146818 data %d \n",m_via_system_porta); } else { - rtc->write(space, 1, state->m_via_system_porta); - //logerror("write 146818 data %d \n",state->m_via_system_porta); + rtc->write(space, 1, m_via_system_porta); + //logerror("write 146818 data %d \n",m_via_system_porta); } } // if address select is set then set the address in the 146818 - if (state->m_MC146818_AS) + if (m_MC146818_AS) { - rtc->write(space, 0, state->m_via_system_porta); - //logerror("write 146818 address %d \n",state->m_via_system_porta); + rtc->write(space, 0, m_via_system_porta); + //logerror("write 146818 address %d \n",m_via_system_porta); } } } @@ -1139,11 +1136,11 @@ static const int TMSint=1; static const int TMSrdy=1; #ifdef UNUSED_FUNCTION -void bbc_TMSint(int status) +void bbc_state::bbc_TMSint(int status) { TMSint=(!status)&1; TMSrdy=(!tms5220_readyq_r())&1; - via_0_portb_w(0,(0xf | machine.root_device().ioport("IN0")->read()|(TMSint<<6)|(TMSrdy<<7))); + via_0_portb_w(0,(0xf | machine().root_device().ioport("IN0")->read()|(TMSint<<6)|(TMSrdy<<7))); } #endif @@ -1297,15 +1294,14 @@ const uPD7002_interface bbc_uPD7002 = -static void MC6850_Receive_Clock(running_machine &machine, int new_clock) +void bbc_state::MC6850_Receive_Clock(int new_clock) { - bbc_state *state = machine.driver_data<bbc_state>(); - if (!state->m_mc6850_clock && new_clock) + if (!m_mc6850_clock && new_clock) { - acia6850_device *acia = machine.device<acia6850_device>("acia6850"); + acia6850_device *acia = machine().device<acia6850_device>("acia6850"); acia->tx_clock_in(); } - state->m_mc6850_clock = new_clock; + m_mc6850_clock = new_clock; } TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) @@ -1339,7 +1335,7 @@ TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) { /* Clock a 0 onto the serial line */ logerror("Serial value 0\n"); - MC6850_Receive_Clock(machine(), 0); + MC6850_Receive_Clock(0); m_len0=0; m_len1=0; m_len2=0; @@ -1350,7 +1346,7 @@ TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) { /* Clock a 1 onto the serial line */ logerror("Serial value 1\n"); - MC6850_Receive_Clock(machine(), 1); + MC6850_Receive_Clock(1); m_len0=0; m_len1=0; m_len2=0; @@ -1365,23 +1361,22 @@ TIMER_CALLBACK_MEMBER(bbc_state::bbc_tape_timer_cb) } -static void BBC_Cassette_motor(running_machine &machine, unsigned char status) +void bbc_state::BBC_Cassette_motor(unsigned char status) { - bbc_state *state = machine.driver_data<bbc_state>(); if (status) { - state->m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - state->m_tape_timer->adjust(attotime::zero, 0, attotime::from_hz(44100)); + m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); + m_tape_timer->adjust(attotime::zero, 0, attotime::from_hz(44100)); } else { - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); - state->m_tape_timer->reset(); - state->m_len0 = 0; - state->m_len1 = 0; - state->m_len2 = 0; - state->m_len3 = 0; - state->m_wav_len = 0; + m_cassette->change_state(CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); + m_tape_timer->reset(); + m_len0 = 0; + m_len1 = 0; + m_len2 = 0; + m_len3 = 0; + m_wav_len = 0; } } @@ -1389,7 +1384,7 @@ static void BBC_Cassette_motor(running_machine &machine, unsigned char status) WRITE8_MEMBER(bbc_state::bbc_SerialULA_w) { - BBC_Cassette_motor(machine(), (data & 0x80) >> 7); + BBC_Cassette_motor((data & 0x80) >> 7); } /************************************** @@ -1522,13 +1517,12 @@ density disc image The nmi is edge triggered, and triggers on a +ve edge. */ -static void bbc_update_fdq_int(running_machine &machine, int state) +void bbc_state::bbc_update_fdq_int(int state) { - bbc_state *drvstate = machine.driver_data<bbc_state>(); int bbc_state; /* if drq or irq is set, and interrupt is enabled */ - if ((drvstate->m_wd177x_irq_state || drvstate->m_wd177x_drq_state) && (drvstate->m_1770_IntEnabled)) + if ((m_wd177x_irq_state || m_wd177x_drq_state) && (m_1770_IntEnabled)) { /* int trigger */ bbc_state = 1; @@ -1541,29 +1535,29 @@ static void bbc_update_fdq_int(running_machine &machine, int state) /* nmi is edge triggered, and triggers when the state goes from clear->set. Here we are checking this transition before triggering the nmi */ - if (bbc_state!=drvstate->m_previous_wd177x_int_state) + if (bbc_state!=m_previous_wd177x_int_state) { if (bbc_state) { /* I'll pulse it because if I used hold-line I'm not sure it would clear - to be checked */ - drvstate->m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); } } - drvstate->m_previous_wd177x_int_state = bbc_state; + m_previous_wd177x_int_state = bbc_state; } WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_intrq_w) { m_wd177x_irq_state = state; - bbc_update_fdq_int(machine(), state); + bbc_update_fdq_int(state); } WRITE_LINE_MEMBER(bbc_state::bbc_wd177x_drq_w) { m_wd177x_drq_state = state; - bbc_update_fdq_int(machine(), state); + bbc_update_fdq_int(state); } const wd17xx_interface bbc_wd17xx_interface = diff --git a/src/mess/machine/cgenie.c b/src/mess/machine/cgenie.c index 81ca866cd03..cd446b9611e 100644 --- a/src/mess/machine/cgenie.c +++ b/src/mess/machine/cgenie.c @@ -236,7 +236,7 @@ WRITE8_HANDLER( cgenie_port_ff_w ) /* graphics mode changed ? */ if( port_ff_changed & FF_FGR ) { - cgenie_mode_select(space.machine(), data & FF_FGR); + state->cgenie_mode_select(data & FF_FGR); } state->m_port_ff = data; @@ -253,7 +253,7 @@ READ8_HANDLER( cgenie_port_ff_r ) return data; } -int cgenie_port_xx_r( int offset ) +int cgenie_state::cgenie_port_xx_r( int offset ) { return 0xff; } @@ -515,10 +515,9 @@ WRITE8_HANDLER( cgenie_motor_w ) * Video RAM * *************************************/ -int cgenie_videoram_r( running_machine &machine, int offset ) +int cgenie_state::cgenie_videoram_r( int offset ) { - cgenie_state *state = machine.driver_data<cgenie_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; return videoram[offset]; } @@ -550,7 +549,7 @@ WRITE8_HANDLER( cgenie_colorram_w ) /* set new value */ state->m_colorram[offset] = data; /* make offset relative to video frame buffer offset */ - offset = (offset + (cgenie_get_register(space.machine(), 12) << 8) + cgenie_get_register(space.machine(), 13)) & 0x3ff; + offset = (offset + (state->cgenie_get_register(12) << 8) + state->cgenie_get_register(13)) & 0x3ff; } READ8_HANDLER( cgenie_fontram_r ) diff --git a/src/mess/machine/concept.c b/src/mess/machine/concept.c index 39e80c95c79..21ed0f413c6 100644 --- a/src/mess/machine/concept.c +++ b/src/mess/machine/concept.c @@ -104,50 +104,48 @@ UINT32 concept_state::screen_update_concept(screen_device &screen, bitmap_ind16 return 0; } -static void concept_set_interrupt(running_machine &machine, int level, int state) +void concept_state::concept_set_interrupt(int level, int state) { - concept_state *drvstate = machine.driver_data<concept_state>(); int interrupt_mask; int final_level; if (state) - drvstate->m_pending_interrupts |= 1 << level; + m_pending_interrupts |= 1 << level; else - drvstate->m_pending_interrupts &= ~ (1 << level); + m_pending_interrupts &= ~ (1 << level); - for (final_level = 7, interrupt_mask = drvstate->m_pending_interrupts; (final_level > 0) && ! (interrupt_mask & 0x80); final_level--, interrupt_mask <<= 1) + for (final_level = 7, interrupt_mask = m_pending_interrupts; (final_level > 0) && ! (interrupt_mask & 0x80); final_level--, interrupt_mask <<= 1) ; if (final_level) /* assert interrupt */ - drvstate->m_maincpu->set_input_line_and_vector(M68K_IRQ_1 + final_level - 1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + m_maincpu->set_input_line_and_vector(M68K_IRQ_1 + final_level - 1, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); else /* clear all interrupts */ - drvstate->m_maincpu->set_input_line_and_vector(M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); + m_maincpu->set_input_line_and_vector(M68K_IRQ_1, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); } -INLINE void post_in_KeyQueue(concept_state *state, int keycode) +inline void concept_state::post_in_KeyQueue(int keycode) { - state->m_KeyQueue[(state->m_KeyQueueHead+state->m_KeyQueueLen) % KeyQueueSize] = keycode; - state->m_KeyQueueLen++; + m_KeyQueue[(m_KeyQueueHead+m_KeyQueueLen) % KeyQueueSize] = keycode; + m_KeyQueueLen++; } -static void poll_keyboard(running_machine &machine) +void concept_state::poll_keyboard() { - concept_state *state = machine.driver_data<concept_state>(); UINT32 keystate; UINT32 key_transitions; int i, j; int keycode; static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" }; - for(i = 0; (i < /*4*/3) && (state->m_KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); i++) + for(i = 0; (i < /*4*/3) && (m_KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); i++) { - keystate = machine.root_device().ioport(keynames[2*i])->read() | (machine.root_device().ioport(keynames[2*i + 1])->read() << 16); - key_transitions = keystate ^ state->m_KeyStateSave[i]; + keystate = machine().root_device().ioport(keynames[2*i])->read() | (machine().root_device().ioport(keynames[2*i + 1])->read() << 16); + key_transitions = keystate ^ m_KeyStateSave[i]; if(key_transitions) { - for(j = 0; (j < 32) && (state->m_KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); j++) + for(j = 0; (j < 32) && (m_KeyQueueLen <= (KeyQueueSize-MaxKeyMessageLen)); j++) { if((key_transitions >> j) & 1) { @@ -156,15 +154,15 @@ static void poll_keyboard(running_machine &machine) if (((keystate >> j) & 1)) { /* key is pressed */ - state->m_KeyStateSave[i] |= (1 << j); + m_KeyStateSave[i] |= (1 << j); keycode |= 0x80; } else /* key is released */ - state->m_KeyStateSave[i] &= ~ (1 << j); + m_KeyStateSave[i] &= ~ (1 << j); - post_in_KeyQueue(state, keycode); - concept_set_interrupt(machine, KEYINT_level, 1); + post_in_KeyQueue(keycode); + concept_set_interrupt(KEYINT_level, 1); } } } @@ -173,7 +171,7 @@ static void poll_keyboard(running_machine &machine) INTERRUPT_GEN_MEMBER(concept_state::concept_interrupt) { - poll_keyboard(machine()); + poll_keyboard(); } /* @@ -239,7 +237,8 @@ WRITE8_MEMBER(concept_state::via_out_cb2) */ static void via_irq_func(device_t *device, int state) { - concept_set_interrupt(device->machine(), TIMINT_level, state); + concept_state *drvstate = device->machine().driver_data<concept_state>(); + drvstate->concept_set_interrupt(TIMINT_level, state); } READ16_MEMBER(concept_state::concept_io_r) @@ -325,7 +324,7 @@ READ16_MEMBER(concept_state::concept_io_r) } if (!m_KeyQueueLen) - concept_set_interrupt(machine(), KEYINT_level, 0); + concept_set_interrupt(KEYINT_level, 0); return reply; diff --git a/src/mess/machine/dai.c b/src/mess/machine/dai.c index 08067357dab..3b6e10beb23 100644 --- a/src/mess/machine/dai.c +++ b/src/mess/machine/dai.c @@ -28,10 +28,9 @@ WRITE8_MEMBER(dai_state::dai_stack_interrupt_circuit_w) m_tms5501->set_sensor(0); } -static void dai_update_memory(running_machine &machine, int dai_rom_bank) +void dai_state::dai_update_memory(int dai_rom_bank) { - dai_state *state = machine.driver_data<dai_state>(); - state->membank("bank2")->set_entry(dai_rom_bank); + membank("bank2")->set_entry(dai_rom_bank); } TIMER_CALLBACK_MEMBER(dai_state::dai_bootstrap_callback) @@ -199,7 +198,7 @@ WRITE8_MEMBER(dai_state::dai_io_discrete_devices_w) m_cassette_motor[1] = (data&0x20)>>5; m_cassette->change_state(m_cassette_motor[0]?CASSETTE_MOTOR_DISABLED:CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); m_cassette->output((data & 0x01) ? -1.0 : 1.0); - dai_update_memory (machine(), (data&0xc0)>>6); + dai_update_memory ((data&0xc0)>>6); LOG_DAI_PORT_W (offset, (data&0x06)>>2, "discrete devices - paddle select"); LOG_DAI_PORT_W (offset, (data&0x08)>>3, "discrete devices - paddle enable"); LOG_DAI_PORT_W (offset, (data&0x10)>>4, "discrete devices - cassette motor 1"); diff --git a/src/mess/machine/dgn_beta.c b/src/mess/machine/dgn_beta.c index f30b7dc1550..e5fa66e9236 100644 --- a/src/mess/machine/dgn_beta.c +++ b/src/mess/machine/dgn_beta.c @@ -90,16 +90,6 @@ static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, c static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[]); static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[]); -/* Debugging variables */ - - - -static void cpu0_recalc_irq(running_machine &machine, int state); -static void cpu0_recalc_firq(running_machine &machine, int state); - -static void cpu1_recalc_firq(running_machine &machine, int state); - - //static int DMA_NMI; /* DMA cpu has received an NMI */ #define INVALID_KEYROW -1 /* no ketrow selected */ @@ -213,11 +203,10 @@ static const struct bank_info_entry bank_info[] = // this should probably be considdered a hack ! // -static void UpdateBanks(running_machine &machine, int first, int last) +void dgn_beta_state::UpdateBanks(int first, int last) { - dgn_beta_state *state = machine.driver_data<dgn_beta_state>(); - address_space &space_0 = machine.device(MAINCPU_TAG)->memory().space(AS_PROGRAM); - address_space &space_1 = machine.device(DMACPU_TAG)->memory().space(AS_PROGRAM); + address_space &space_0 = machine().device(MAINCPU_TAG)->memory().space(AS_PROGRAM); + address_space &space_1 = machine().device(DMACPU_TAG)->memory().space(AS_PROGRAM); int Page; UINT8 *readbank; int bank_start; @@ -235,28 +224,28 @@ static void UpdateBanks(running_machine &machine, int first, int last) // bank16 and bank17 are mapped to the same page with a hole for the IO memory if (!is_last_page(Page)) - MapPage = state->m_PageRegs[state->m_TaskReg][Page].value; + MapPage = m_PageRegs[m_TaskReg][Page].value; else - MapPage = state->m_PageRegs[state->m_TaskReg][LastPage].value; + MapPage = m_PageRegs[m_TaskReg][LastPage].value; // // Map block, $00-$BF are ram, $FC-$FF are Boot ROM // - if ((MapPage*4) < ((machine.device<ram_device>(RAM_TAG)->size() / 1024)-1)) // Block is ram + if ((MapPage*4) < ((machine().device<ram_device>(RAM_TAG)->size() / 1024)-1)) // Block is ram { if (!is_last_page(Page)) { - readbank = &machine.device<ram_device>(RAM_TAG)->pointer()[MapPage*RamPageSize]; - if(state->m_LogDatWrites) - debug_console_printf(machine, "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize)); + readbank = &machine().device<ram_device>(RAM_TAG)->pointer()[MapPage*RamPageSize]; + if(m_LogDatWrites) + debug_console_printf(machine(), "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize)); } else { - readbank = &machine.device<ram_device>(RAM_TAG)->pointer()[(MapPage*RamPageSize)-256]; + readbank = &machine().device<ram_device>(RAM_TAG)->pointer()[(MapPage*RamPageSize)-256]; logerror("Error RAM in Last page !\n"); } write8_delegate func = bank_info[Page].func; - if (!func.isnull()) func.late_bind(*state); + if (!func.isnull()) func.late_bind(*this); space_0.install_write_handler(bank_start, bank_end, func); space_1.install_write_handler(bank_start, bank_end, func); } @@ -265,64 +254,63 @@ static void UpdateBanks(running_machine &machine, int first, int last) if (MapPage>0xfB) { if (Page!=IOPage+1) - readbank=&state->m_system_rom[(MapPage-0xFC)*0x1000]; + readbank=&m_system_rom[(MapPage-0xFC)*0x1000]; else - readbank=&state->m_system_rom[0x3F00]; + readbank=&m_system_rom[0x3F00]; } else - readbank=state->m_system_rom; + readbank=m_system_rom; space_0.unmap_write(bank_start, bank_end); space_1.unmap_write(bank_start, bank_end); } - state->m_PageRegs[state->m_TaskReg][Page].memory=readbank; - state->membank(page_num)->set_base(readbank); + m_PageRegs[m_TaskReg][Page].memory=readbank; + membank(page_num)->set_base(readbank); LOG_BANK_UPDATE(("UpdateBanks:MapPage=$%02X readbank=$%X\n",MapPage,(int)(FPTR)readbank)); - LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",state->m_TaskReg,Page)); - //LOG_BANK_UPDATE(("%X)\n",state->membank(Page+1))); + LOG_BANK_UPDATE(("PageRegsSet Task=%X Page=%x\n",m_TaskReg,Page)); + //LOG_BANK_UPDATE(("%X)\n",membank(Page+1))); LOG_BANK_UPDATE(("memory_install_write8_handler CPU=0\n")); LOG_BANK_UPDATE(("memory_install_write8_handler CPU=1\n")); } } // -static void SetDefaultTask(running_machine &machine) +void dgn_beta_state::SetDefaultTask() { - dgn_beta_state *state = machine.driver_data<dgn_beta_state>(); -// UINT8 *videoram = state->m_videoram; +// UINT8 *videoram = m_videoram; int Idx; LOG_DEFAULT_TASK(("SetDefaultTask()\n")); - //if (VERBOSE) debug_console_printf(machine)->set_base("Set Default task\n"); + //if (VERBOSE) debug_console_printf(machine())->set_base("Set Default task\n"); - state->m_TaskReg=NoPagingTask; + m_TaskReg=NoPagingTask; /* Reset ram pages */ for(Idx=0;Idx<ROMPage-1;Idx++) { - state->m_PageRegs[state->m_TaskReg][Idx].value=NoMemPageValue; + m_PageRegs[m_TaskReg][Idx].value=NoMemPageValue; } /* Reset RAM Page */ - state->m_PageRegs[state->m_TaskReg][RAMPage].value=RAMPageValue; + m_PageRegs[m_TaskReg][RAMPage].value=RAMPageValue; /* Reset Video mem page */ - state->m_PageRegs[state->m_TaskReg][VideoPage].value=VideoPageValue; + m_PageRegs[m_TaskReg][VideoPage].value=VideoPageValue; /* Reset rom page */ - state->m_PageRegs[state->m_TaskReg][ROMPage].value=ROMPageValue; + m_PageRegs[m_TaskReg][ROMPage].value=ROMPageValue; /* Reset IO Page */ - state->m_PageRegs[state->m_TaskReg][LastPage].value=IOPageValue; - state->m_PageRegs[state->m_TaskReg][LastPage+1].value=IOPageValue; + m_PageRegs[m_TaskReg][LastPage].value=IOPageValue; + m_PageRegs[m_TaskReg][LastPage+1].value=IOPageValue; - UpdateBanks(machine, 0,LastPage+1); + UpdateBanks(0,LastPage+1); /* Map video ram to base of area it can use, that way we can take the literal RA */ /* from the 6845 without having to mask it ! */ -// videoram=&machine.device<ram_device>(RAM_TAG)->pointer()[TextVidBasePage*RamPageSize]; +// videoram=&machine().device<ram_device>(RAM_TAG)->pointer()[TextVidBasePage*RamPageSize]; } // Return the value of a page register @@ -343,103 +331,102 @@ WRITE8_MEMBER(dgn_beta_state::dgn_beta_page_w ) if (m_EnableMapRegs) { - UpdateBanks(machine(), offset,offset); + UpdateBanks(offset,offset); if (offset==15) - UpdateBanks(machine(), offset+1,offset+1); + UpdateBanks(offset+1,offset+1); } } /*********************** Memory bank write handlers ************************/ /* These actually write the data to the memory, and not to the page regs ! */ -static void dgn_beta_bank_memory(running_machine &machine, int offset, int data, int bank) +void dgn_beta_state::dgn_beta_bank_memory(int offset, int data, int bank) { - dgn_beta_state *state = machine.driver_data<dgn_beta_state>(); - state->m_PageRegs[state->m_TaskReg][bank].memory[offset]=data; + m_PageRegs[m_TaskReg][bank].memory[offset]=data; } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b0_w ) { - dgn_beta_bank_memory(machine(),offset,data,0); + dgn_beta_bank_memory(offset,data,0); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b1_w ) { - dgn_beta_bank_memory(machine(),offset,data,1); + dgn_beta_bank_memory(offset,data,1); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b2_w ) { - dgn_beta_bank_memory(machine(),offset,data,2); + dgn_beta_bank_memory(offset,data,2); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b3_w ) { - dgn_beta_bank_memory(machine(),offset,data,3); + dgn_beta_bank_memory(offset,data,3); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b4_w ) { - dgn_beta_bank_memory(machine(),offset,data,4); + dgn_beta_bank_memory(offset,data,4); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b5_w ) { - dgn_beta_bank_memory(machine(),offset,data,5); + dgn_beta_bank_memory(offset,data,5); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b6_w ) { - dgn_beta_bank_memory(machine(),offset,data,6); + dgn_beta_bank_memory(offset,data,6); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b7_w ) { - dgn_beta_bank_memory(machine(),offset,data,7); + dgn_beta_bank_memory(offset,data,7); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b8_w ) { - dgn_beta_bank_memory(machine(),offset,data,8); + dgn_beta_bank_memory(offset,data,8); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_b9_w ) { - dgn_beta_bank_memory(machine(),offset,data,9); + dgn_beta_bank_memory(offset,data,9); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bA_w ) { - dgn_beta_bank_memory(machine(),offset,data,10); + dgn_beta_bank_memory(offset,data,10); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bB_w ) { - dgn_beta_bank_memory(machine(),offset,data,11); + dgn_beta_bank_memory(offset,data,11); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bC_w ) { - dgn_beta_bank_memory(machine(),offset,data,12); + dgn_beta_bank_memory(offset,data,12); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bD_w ) { - dgn_beta_bank_memory(machine(),offset,data,13); + dgn_beta_bank_memory(offset,data,13); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bE_w ) { - dgn_beta_bank_memory(machine(),offset,data,14); + dgn_beta_bank_memory(offset,data,14); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bF_w ) { - dgn_beta_bank_memory(machine(),offset,data,15); + dgn_beta_bank_memory(offset,data,15); } WRITE8_MEMBER(dgn_beta_state::dgnbeta_ram_bG_w ) { - dgn_beta_bank_memory(machine(),offset,data,16); + dgn_beta_bank_memory(offset,data,16); } /* @@ -462,7 +449,7 @@ than using a walking zero as the OS-9 driver does. This meant that SelectKeyrow never moved past the first row, by scanning for the last active row the beta_test rom works, and it does not break the OS-9 driver :) */ -static int SelectedKeyrow(dgn_beta_state *state, int Rows) +int dgn_beta_state::SelectedKeyrow(dgn_beta_state *state, int Rows) { int Idx; int Row; /* Row selected */ @@ -490,12 +477,12 @@ static int SelectedKeyrow(dgn_beta_state *state, int Rows) /* GetKeyRow, returns the value of a keyrow, checking for invalid rows */ /* and returning no key pressed if row is invalid */ -static int GetKeyRow(dgn_beta_state *state, int RowNo) +int dgn_beta_state::GetKeyRow(dgn_beta_state *state, int RowNo) { if(RowNo==INVALID_KEYROW) return NO_KEY_PRESSED; /* row is invalid, so return no key down */ else - return state->m_Keyboard[RowNo]; /* Else return keyboard data */ + return m_Keyboard[RowNo]; /* Else return keyboard data */ } /*********************************** PIA Handlers ************************/ @@ -616,12 +603,12 @@ WRITE8_MEMBER(dgn_beta_state::d_pia0_cb2_w) WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_a) { - cpu0_recalc_irq(machine(), state); + cpu0_recalc_irq(state); } WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_irq_b) { - cpu0_recalc_firq(machine(), state); + cpu0_recalc_firq(state); } /* PIA #1 at $FC24-$FC27 I63 @@ -702,12 +689,12 @@ WRITE8_MEMBER(dgn_beta_state::d_pia1_pb_w) WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_a) { - cpu0_recalc_irq(machine(), state); + cpu0_recalc_irq(state); } WRITE_LINE_MEMBER(dgn_beta_state::d_pia1_irq_b) { - cpu0_recalc_irq(machine(), state); + cpu0_recalc_irq(state); } /* PIA #2 at FCC0-FCC3 I28 @@ -775,7 +762,7 @@ WRITE8_MEMBER(dgn_beta_state::d_pia2_pa_w) else m_TaskReg = NoPagingTask; - UpdateBanks(machine(), 0, IOPage + 1); + UpdateBanks(0, IOPage + 1); } else { @@ -783,7 +770,7 @@ WRITE8_MEMBER(dgn_beta_state::d_pia2_pa_w) if ((m_PIATaskReg != OldTask) && (m_EnableMapRegs)) { m_TaskReg = m_PIATaskReg; - UpdateBanks(machine(), 0, IOPage + 1); + UpdateBanks(0, IOPage + 1); } } LOG_TASK(("TaskReg=$%02X PIATaskReg=$%02X\n", m_TaskReg, m_PIATaskReg)); @@ -797,26 +784,26 @@ READ8_MEMBER(dgn_beta_state::d_pia2_pb_r) WRITE8_MEMBER(dgn_beta_state::d_pia2_pb_w) { /* Update top video address lines */ - dgnbeta_vid_set_gctrl(machine(), data); + dgnbeta_vid_set_gctrl(data); } WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_a) { - cpu0_recalc_irq(machine(), state); + cpu0_recalc_irq(state); } WRITE_LINE_MEMBER(dgn_beta_state::d_pia2_irq_b) { - cpu0_recalc_irq(machine(), state); + cpu0_recalc_irq(state); } /************************************ Recalculate CPU inturrupts ****************************/ /* CPU 0 */ -static void cpu0_recalc_irq(running_machine &machine, int state) +void dgn_beta_state::cpu0_recalc_irq(int state) { - pia6821_device *pia_0 = machine.device<pia6821_device>( PIA_0_TAG ); - pia6821_device *pia_1 = machine.device<pia6821_device>( PIA_1_TAG ); - pia6821_device *pia_2 = machine.device<pia6821_device>( PIA_2_TAG ); + pia6821_device *pia_0 = machine().device<pia6821_device>( PIA_0_TAG ); + pia6821_device *pia_1 = machine().device<pia6821_device>( PIA_1_TAG ); + pia6821_device *pia_2 = machine().device<pia6821_device>( PIA_2_TAG ); UINT8 pia0_irq_a = pia_0->irq_a_state(); UINT8 pia1_irq_a = pia_1->irq_a_state(); UINT8 pia1_irq_b = pia_1->irq_b_state(); @@ -829,13 +816,13 @@ static void cpu0_recalc_irq(running_machine &machine, int state) else IRQ = CLEAR_LINE; - machine.device(MAINCPU_TAG)->execute().set_input_line(M6809_IRQ_LINE, IRQ); + machine().device(MAINCPU_TAG)->execute().set_input_line(M6809_IRQ_LINE, IRQ); LOG_INTS(("cpu0 IRQ : %d\n", IRQ)); } -static void cpu0_recalc_firq(running_machine &machine, int state) +void dgn_beta_state::cpu0_recalc_firq(int state) { - pia6821_device *pia_0 = machine.device<pia6821_device>( PIA_0_TAG ); + pia6821_device *pia_0 = machine().device<pia6821_device>( PIA_0_TAG ); UINT8 pia0_irq_b = pia_0->irq_b_state(); UINT8 FIRQ; @@ -844,16 +831,16 @@ static void cpu0_recalc_firq(running_machine &machine, int state) else FIRQ = CLEAR_LINE; - machine.device(MAINCPU_TAG)->execute().set_input_line(M6809_FIRQ_LINE, FIRQ); + machine().device(MAINCPU_TAG)->execute().set_input_line(M6809_FIRQ_LINE, FIRQ); LOG_INTS(("cpu0 FIRQ : %d\n", FIRQ)); } /* CPU 1 */ -static void cpu1_recalc_firq(running_machine &machine, int state) +void dgn_beta_state::cpu1_recalc_firq(int state) { - machine.device(DMACPU_TAG)->execute().set_input_line(M6809_FIRQ_LINE, state); + machine().device(DMACPU_TAG)->execute().set_input_line(M6809_FIRQ_LINE, state); LOG_INTS(("cpu1 FIRQ : %d\n",state)); } @@ -874,7 +861,7 @@ WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_fdc_intrq_w) WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_fdc_drq_w) { LOG_DISK(("dgnbeta_fdc_drq_w(%d)\n", state)); - cpu1_recalc_firq(machine(), state); + cpu1_recalc_firq(state); } const wd17xx_interface dgnbeta_wd17xx_interface = @@ -942,10 +929,9 @@ WRITE8_MEMBER(dgn_beta_state::dgnbeta_wd2797_w) /* Scan physical keyboard into Keyboard array */ /* gonna try and sync this more closely with hardware as keyboard being scanned */ /* on *EVERY* vblank ! */ -static void ScanInKeyboard(void) +void dgn_beta_state::ScanInKeyboard(void) { #if 0 - dgn_beta_state *state = machine.driver_data<dgn_beta_state>(); int Idx; int Row; static const char *const keynames[] = { @@ -958,12 +944,12 @@ static void ScanInKeyboard(void) for(Idx=0; Idx<NoKeyrows; Idx++) { if (Idx < 10) - Row = machine.root_device().ioport(keynames[Idx])->read(); + Row = machine().root_device().ioport(keynames[Idx])->read(); else Row = 0x7f; - state->m_Keyboard[Idx]=Row; + m_Keyboard[Idx]=Row; LOG_KEYBOARD(("Keyboard[%d]=$%02X\n",Idx,Row)); if (Row != 0x7F) @@ -975,9 +961,9 @@ static void ScanInKeyboard(void) } /* VBlank inturrupt */ -void dgn_beta_frame_interrupt (running_machine &machine, int data) +void dgn_beta_state::dgn_beta_frame_interrupt (int data) { - pia6821_device *pia_2 = machine.device<pia6821_device>( PIA_2_TAG ); + pia6821_device *pia_2 = machine().device<pia6821_device>( PIA_2_TAG ); /* Set PIA line, so it recognises inturrupt */ if (!data) @@ -990,7 +976,7 @@ void dgn_beta_frame_interrupt (running_machine &machine, int data) } #ifdef UNUSED_FUNCTION -void dgn_beta_line_interrupt (int data) +void dgn_beta_state::dgn_beta_line_interrupt (int data) { // /* Set PIA line, so it recognises inturrupt */ // if (data) @@ -1027,7 +1013,7 @@ void dgn_beta_state::machine_reset() m_PIATaskReg = 0; m_EnableMapRegs = 0; memset(m_PageRegs, 0, sizeof(m_PageRegs)); /* Reset page registers to 0 */ - SetDefaultTask(machine()); + SetDefaultTask(); /* Set pullups on all PIA port A, to match what hardware does */ pia_0->set_port_a_z_mask(0xFF); diff --git a/src/mess/machine/electron.c b/src/mess/machine/electron.c index 472e83134a7..65da18a5e3b 100644 --- a/src/mess/machine/electron.c +++ b/src/mess/machine/electron.c @@ -88,13 +88,13 @@ TIMER_CALLBACK_MEMBER(electron_state::electron_tape_timer_handler) //logerror( "++ Read stop bit: %d\n", m_ula.stop_bit ); if ( m_ula.start_bit && m_ula.stop_bit && m_ula.tape_byte == 0xFF && ! m_ula.high_tone_set ) { - electron_interrupt_handler( machine(), INT_SET, INT_HIGH_TONE ); + electron_interrupt_handler( INT_SET, INT_HIGH_TONE ); m_ula.high_tone_set = 1; } else if ( ! m_ula.start_bit && m_ula.stop_bit ) { //logerror( "-- Byte read from tape: %02x\n", m_ula.tape_byte ); - electron_interrupt_handler( machine(), INT_SET, INT_RECEIVE_FULL ); + electron_interrupt_handler( INT_SET, INT_RECEIVE_FULL ); } else { @@ -158,7 +158,7 @@ READ8_MEMBER(electron_state::electron_ula_r) case 0x01: /* Unknown */ break; case 0x04: /* Casette data shift register */ - electron_interrupt_handler(machine(), INT_CLEAR, INT_RECEIVE_FULL ); + electron_interrupt_handler(INT_CLEAR, INT_RECEIVE_FULL ); data = m_ula.tape_byte; break; } @@ -214,15 +214,15 @@ WRITE8_MEMBER(electron_state::electron_ula_w) } if ( data & 0x10 ) { - electron_interrupt_handler( machine(), INT_CLEAR, INT_DISPLAY_END ); + electron_interrupt_handler( INT_CLEAR, INT_DISPLAY_END ); } if ( data & 0x20 ) { - electron_interrupt_handler( machine(), INT_CLEAR, INT_RTC ); + electron_interrupt_handler( INT_CLEAR, INT_RTC ); } if ( data & 0x40 ) { - electron_interrupt_handler( machine(), INT_CLEAR, INT_HIGH_TONE ); + electron_interrupt_handler( INT_CLEAR, INT_HIGH_TONE ); } if ( data & 0x80 ) { @@ -281,26 +281,25 @@ WRITE8_MEMBER(electron_state::electron_ula_w) } } -void electron_interrupt_handler(running_machine &machine, int mode, int interrupt) +void electron_state::electron_interrupt_handler(int mode, int interrupt) { - electron_state *state = machine.driver_data<electron_state>(); if ( mode == INT_SET ) { - state->m_ula.interrupt_status |= interrupt; + m_ula.interrupt_status |= interrupt; } else { - state->m_ula.interrupt_status &= ~interrupt; + m_ula.interrupt_status &= ~interrupt; } - if ( state->m_ula.interrupt_status & state->m_ula.interrupt_control & ~0x83 ) + if ( m_ula.interrupt_status & m_ula.interrupt_control & ~0x83 ) { - state->m_ula.interrupt_status |= 0x01; - state->m_maincpu->set_input_line(0, ASSERT_LINE ); + m_ula.interrupt_status |= 0x01; + m_maincpu->set_input_line(0, ASSERT_LINE ); } else { - state->m_ula.interrupt_status &= ~0x01; - state->m_maincpu->set_input_line(0, CLEAR_LINE ); + m_ula.interrupt_status &= ~0x01; + m_maincpu->set_input_line(0, CLEAR_LINE ); } } diff --git a/src/mess/machine/europc.c b/src/mess/machine/europc.c index 803debdc92a..3b94080dc5a 100644 --- a/src/mess/machine/europc.c +++ b/src/mess/machine/europc.c @@ -172,6 +172,7 @@ static struct { WRITE8_HANDLER( europc_pio_w ) { + pc_state *state = space.machine().driver_data<pc_state>(); switch (offset) { case 1: @@ -179,7 +180,7 @@ WRITE8_HANDLER( europc_pio_w ) // if (data == 0x30) pc1640.port62 = (pc1640.port65 & 0x10) >> 4; // else if (data == 0x34) pc1640.port62 = pc1640.port65 & 0xf; pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0)); - pc_speaker_set_spkrdata(space.machine(), BIT(data, 1)); + state->pc_speaker_set_spkrdata(BIT(data, 1)); pc_keyb_set_clock(BIT(data, 6)); break; } diff --git a/src/mess/machine/galaxy.c b/src/mess/machine/galaxy.c index 6cc548c37df..a4fc34546c9 100644 --- a/src/mess/machine/galaxy.c +++ b/src/mess/machine/galaxy.c @@ -60,72 +60,72 @@ IRQ_CALLBACK_MEMBER(galaxy_state::galaxy_irq_callback) #define GALAXY_SNAPSHOT_V1_SIZE 8268 #define GALAXY_SNAPSHOT_V2_SIZE 8244 -static void galaxy_setup_snapshot (running_machine &machine, const UINT8 * data, UINT32 size) +void galaxy_state::galaxy_setup_snapshot (const UINT8 * data, UINT32 size) { - galaxy_state *state = machine.driver_data<galaxy_state>(); switch (size) { case GALAXY_SNAPSHOT_V1_SIZE: - state->m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); - state->m_maincpu->set_state_int(Z80_BC, data[0x04] | data[0x05] << 8); - state->m_maincpu->set_state_int(Z80_DE, data[0x08] | data[0x09] << 8); - state->m_maincpu->set_state_int(Z80_HL, data[0x0c] | data[0x0d] << 8); - state->m_maincpu->set_state_int(Z80_IX, data[0x10] | data[0x11] << 8); - state->m_maincpu->set_state_int(Z80_IY, data[0x14] | data[0x15] << 8); - state->m_maincpu->set_state_int(Z80_PC, data[0x18] | data[0x19] << 8); - state->m_maincpu->set_state_int(Z80_SP, data[0x1c] | data[0x1d] << 8); - state->m_maincpu->set_state_int(Z80_AF2, data[0x20] | data[0x21] << 8); - state->m_maincpu->set_state_int(Z80_BC2, data[0x24] | data[0x25] << 8); - state->m_maincpu->set_state_int(Z80_DE2, data[0x28] | data[0x29] << 8); - state->m_maincpu->set_state_int(Z80_HL2, data[0x2c] | data[0x2d] << 8); - state->m_maincpu->set_state_int(Z80_IFF1, data[0x30]); - state->m_maincpu->set_state_int(Z80_IFF2, data[0x34]); - state->m_maincpu->set_state_int(Z80_HALT, data[0x38]); - state->m_maincpu->set_state_int(Z80_IM, data[0x3c]); - state->m_maincpu->set_state_int(Z80_I, data[0x40]); - state->m_maincpu->set_state_int(Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); - - memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data + 0x084c, (machine.device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine.device<ram_device>(RAM_TAG)->size() : 0x1800); + m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); + m_maincpu->set_state_int(Z80_BC, data[0x04] | data[0x05] << 8); + m_maincpu->set_state_int(Z80_DE, data[0x08] | data[0x09] << 8); + m_maincpu->set_state_int(Z80_HL, data[0x0c] | data[0x0d] << 8); + m_maincpu->set_state_int(Z80_IX, data[0x10] | data[0x11] << 8); + m_maincpu->set_state_int(Z80_IY, data[0x14] | data[0x15] << 8); + m_maincpu->set_state_int(Z80_PC, data[0x18] | data[0x19] << 8); + m_maincpu->set_state_int(Z80_SP, data[0x1c] | data[0x1d] << 8); + m_maincpu->set_state_int(Z80_AF2, data[0x20] | data[0x21] << 8); + m_maincpu->set_state_int(Z80_BC2, data[0x24] | data[0x25] << 8); + m_maincpu->set_state_int(Z80_DE2, data[0x28] | data[0x29] << 8); + m_maincpu->set_state_int(Z80_HL2, data[0x2c] | data[0x2d] << 8); + m_maincpu->set_state_int(Z80_IFF1, data[0x30]); + m_maincpu->set_state_int(Z80_IFF2, data[0x34]); + m_maincpu->set_state_int(Z80_HALT, data[0x38]); + m_maincpu->set_state_int(Z80_IM, data[0x3c]); + m_maincpu->set_state_int(Z80_I, data[0x40]); + m_maincpu->set_state_int(Z80_R, (data[0x44] & 0x7f) | (data[0x48] & 0x80)); + + memcpy (machine().device<ram_device>(RAM_TAG)->pointer(), data + 0x084c, (machine().device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine().device<ram_device>(RAM_TAG)->size() : 0x1800); break; case GALAXY_SNAPSHOT_V2_SIZE: - state->m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); - state->m_maincpu->set_state_int(Z80_BC, data[0x02] | data[0x03] << 8); - state->m_maincpu->set_state_int(Z80_DE, data[0x04] | data[0x05] << 8); - state->m_maincpu->set_state_int(Z80_HL, data[0x06] | data[0x07] << 8); - state->m_maincpu->set_state_int(Z80_IX, data[0x08] | data[0x09] << 8); - state->m_maincpu->set_state_int(Z80_IY, data[0x0a] | data[0x0b] << 8); - state->m_maincpu->set_state_int(Z80_PC, data[0x0c] | data[0x0d] << 8); - state->m_maincpu->set_state_int(Z80_SP, data[0x0e] | data[0x0f] << 8); - state->m_maincpu->set_state_int(Z80_AF2, data[0x10] | data[0x11] << 8); - state->m_maincpu->set_state_int(Z80_BC2, data[0x12] | data[0x13] << 8); - state->m_maincpu->set_state_int(Z80_DE2, data[0x14] | data[0x15] << 8); - state->m_maincpu->set_state_int(Z80_HL2, data[0x16] | data[0x17] << 8); + m_maincpu->set_state_int(Z80_AF, data[0x00] | data[0x01] << 8); + m_maincpu->set_state_int(Z80_BC, data[0x02] | data[0x03] << 8); + m_maincpu->set_state_int(Z80_DE, data[0x04] | data[0x05] << 8); + m_maincpu->set_state_int(Z80_HL, data[0x06] | data[0x07] << 8); + m_maincpu->set_state_int(Z80_IX, data[0x08] | data[0x09] << 8); + m_maincpu->set_state_int(Z80_IY, data[0x0a] | data[0x0b] << 8); + m_maincpu->set_state_int(Z80_PC, data[0x0c] | data[0x0d] << 8); + m_maincpu->set_state_int(Z80_SP, data[0x0e] | data[0x0f] << 8); + m_maincpu->set_state_int(Z80_AF2, data[0x10] | data[0x11] << 8); + m_maincpu->set_state_int(Z80_BC2, data[0x12] | data[0x13] << 8); + m_maincpu->set_state_int(Z80_DE2, data[0x14] | data[0x15] << 8); + m_maincpu->set_state_int(Z80_HL2, data[0x16] | data[0x17] << 8); - state->m_maincpu->set_state_int(Z80_IFF1, data[0x18] & 0x01); - state->m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); + m_maincpu->set_state_int(Z80_IFF1, data[0x18] & 0x01); + m_maincpu->set_state_int(Z80_IFF2, (UINT64)0); - state->m_maincpu->set_state_int(Z80_HALT, (UINT64)0); + m_maincpu->set_state_int(Z80_HALT, (UINT64)0); - state->m_maincpu->set_state_int(Z80_IM, (data[0x18] >> 1) & 0x03); + m_maincpu->set_state_int(Z80_IM, (data[0x18] >> 1) & 0x03); - state->m_maincpu->set_state_int(Z80_I, data[0x19]); - state->m_maincpu->set_state_int(Z80_R, data[0x1a]); + m_maincpu->set_state_int(Z80_I, data[0x19]); + m_maincpu->set_state_int(Z80_R, data[0x1a]); - memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data + 0x0834, (machine.device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine.device<ram_device>(RAM_TAG)->size() : 0x1800); + memcpy (machine().device<ram_device>(RAM_TAG)->pointer(), data + 0x0834, (machine().device<ram_device>(RAM_TAG)->size() < 0x1800) ? machine().device<ram_device>(RAM_TAG)->size() : 0x1800); break; } - state->m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); } SNAPSHOT_LOAD( galaxy ) { UINT8* snapshot_data; + galaxy_state *state = image.device().machine().driver_data<galaxy_state>(); switch (snapshot_size) { case GALAXY_SNAPSHOT_V1_SIZE: @@ -138,7 +138,7 @@ SNAPSHOT_LOAD( galaxy ) image.fread( snapshot_data, snapshot_size); - galaxy_setup_snapshot(image.device().machine(), snapshot_data, snapshot_size); + state->galaxy_setup_snapshot(snapshot_data, snapshot_size); return IMAGE_INIT_PASS; } diff --git a/src/mess/machine/hec2hrp.c b/src/mess/machine/hec2hrp.c index c8cfbb2e802..5040742d3ad 100644 --- a/src/mess/machine/hec2hrp.c +++ b/src/mess/machine/hec2hrp.c @@ -53,8 +53,6 @@ //#define DEBUG_TRACE_COM_HECTOR 1 #endif -static void Mise_A_Jour_Etat(running_machine &machine, int Adresse, int Value ); -static void Update_Sound(address_space &space, UINT8 data); /* machine List hec2hrp @@ -67,33 +65,33 @@ hec2mx40 */ /* Helper function*/ -static int isHectorWithDisc2(running_machine &machine) +int hec2hrp_state::isHectorWithDisc2() { -return ((strncmp(machine.system().name , "hec2hrx" , 7)==0) || - (strncmp(machine.system().name , "hec2mx40" , 8)==0) || - (strncmp(machine.system().name , "hec2mx80" , 8)==0)); +return ((strncmp(machine().system().name , "hec2hrx" , 7)==0) || + (strncmp(machine().system().name , "hec2mx40" , 8)==0) || + (strncmp(machine().system().name , "hec2mx80" , 8)==0)); } -static int isHectorWithMiniDisc(running_machine &machine) +int hec2hrp_state::isHectorWithMiniDisc() { -return ((strncmp(machine.system().name , "hec2mdhrx", 9)==0)); +return ((strncmp(machine().system().name , "hec2mdhrx", 9)==0)); } -static int isHectorHR(running_machine &machine) +int hec2hrp_state::isHectorHR() { -return ((strncmp(machine.system().name , "hec2hr" , 6)==0) || //Aviable for hr & hrp - (strncmp(machine.system().name , "hec2mdhrx", 9)==0) || - (strncmp(machine.system().name , "victor" , 6)==0) || - (strncmp(machine.system().name , "hec2mx40" , 8)==0) || - (strncmp(machine.system().name , "hec2mx80" , 8)==0)); +return ((strncmp(machine().system().name , "hec2hr" , 6)==0) || //Aviable for hr & hrp + (strncmp(machine().system().name , "hec2mdhrx", 9)==0) || + (strncmp(machine().system().name , "victor" , 6)==0) || + (strncmp(machine().system().name , "hec2mx40" , 8)==0) || + (strncmp(machine().system().name , "hec2mx80" , 8)==0)); } -static int isHectoreXtend(running_machine &machine) +int hec2hrp_state::isHectoreXtend() { -return ((strncmp(machine.system().name , "hec2mdhrx", 9)==0) || - (strncmp(machine.system().name , "hec2hrx" , 7)==0) || - (strncmp(machine.system().name , "hec2mx40" , 8)==0) || - (strncmp(machine.system().name , "hec2mx80" , 8)==0)); +return ((strncmp(machine().system().name , "hec2mdhrx", 9)==0) || + (strncmp(machine().system().name , "hec2hrx" , 7)==0) || + (strncmp(machine().system().name , "hec2mx40" , 8)==0) || + (strncmp(machine().system().name , "hec2mx80" , 8)==0)); } /* Cassette timer*/ @@ -103,18 +101,18 @@ TIMER_CALLBACK_MEMBER(hec2hrp_state::Callback_CK) m_CK_signal++; } -void hector_minidisc_init(running_machine &machine) +void hec2hrp_state::hector_minidisc_init() { - device_t *fdc = machine.device("wd179x"); + device_t *fdc = machine().device("wd179x"); //set density wd17xx_dden_w(fdc, 1);// density select => always 1 (0 ?a plante !) /* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */ - floppy_mon_w(floppy_get_device(machine, 0), 0); // Moteur floppy A: + floppy_mon_w(floppy_get_device(machine(), 0), 0); // Moteur floppy A: //floppy_mon_w(floppy_get_device(space.machine(), 1), BIT(data, 7)); // Moteur floppy B:, not implanted on the real machine //Set the drive ready ! - floppy_drive_set_ready_state(floppy_get_device(machine, 0), FLOPPY_DRIVE_READY, 0);// Disc 0 ready ! + floppy_drive_set_ready_state(floppy_get_device(machine(), 0), FLOPPY_DRIVE_READY, 0);// Disc 0 ready ! } @@ -185,7 +183,7 @@ switch (offset) WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) { if (offset==0x00) { /* 0x800 et 0x000=> video page, HR*/ - if (isHectoreXtend(machine())) + if (isHectoreXtend()) membank("bank1")->set_entry(HECTOR_BANK_VIDEO); if (m_flag_clk ==1) { @@ -195,7 +193,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) } if (offset==0x04) { /* 0x804 => video page, BR*/ m_hector_flag_hr=0; - if (isHectoreXtend(machine())) + if (isHectoreXtend()) membank("bank1")->set_entry(HECTOR_BANK_VIDEO); if (m_flag_clk ==0) { @@ -204,7 +202,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) } } if (offset==0x08) { /* 0x808 => base page, HR*/ - if (isHectoreXtend(machine())) + if (isHectoreXtend()) membank("bank1")->set_entry(HECTOR_BANK_PROG); if (m_flag_clk ==1) { @@ -215,7 +213,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) } if (offset==0x0c) { /* 0x80c => base page, BR*/ m_hector_flag_hr=0; - if (isHectoreXtend(machine())) + if (isHectoreXtend()) membank("bank1")->set_entry(HECTOR_BANK_PROG); if (m_flag_clk ==0) { @@ -243,20 +241,20 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r) if (data & 0x01) /* Reset machine ! (on ESC key)*/ { m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); - if (isHectorHR(machine())) /* aviable for HR and up */ + if (isHectorHR()) /* aviable for HR and up */ { m_hector_flag_hr=1; - if (isHectoreXtend(machine())) + if (isHectoreXtend()) { membank("bank1")->set_entry(HECTOR_BANK_PROG); membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); } //RESET DISC II unit - if (isHectorWithDisc2(machine()) ) + if (isHectorWithDisc2() ) hector_disc2_reset(machine()); /* floppy md master reset */ - if (isHectorWithMiniDisc(machine())) + if (isHectorWithMiniDisc()) wd17xx_mr_w(machine().device("wd179x"), 1); } @@ -302,12 +300,12 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r) WRITE8_MEMBER(hec2hrp_state::hector_sn_2000_w) { - Mise_A_Jour_Etat(machine(), 0x2000+ offset, data); + Mise_A_Jour_Etat(0x2000+ offset, data); Update_Sound(space, data); } WRITE8_MEMBER(hec2hrp_state::hector_sn_2800_w) { - Mise_A_Jour_Etat(machine(), 0x2800+ offset, data); + Mise_A_Jour_Etat(0x2800+ offset, data); Update_Sound(space, data); } READ8_MEMBER(hec2hrp_state::hector_cassette_r) @@ -359,7 +357,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_sn_3000_w) if ((data & 7) != m_oldstate3000 ) { /* Update sn76477 only when necessary!*/ - Mise_A_Jour_Etat( machine(), 0x3000, data & 7 ); + Mise_A_Jour_Etat(0x3000, data & 7 ); Update_Sound(space, data & 7); } m_oldstate3000 = data & 7; @@ -583,80 +581,79 @@ WRITE8_MEMBER(hec2hrp_state::hector_mx80_io_port_w) sound managment ********************************************************************************/ -static void Mise_A_Jour_Etat(running_machine &machine, int Adresse, int Value ) +void hec2hrp_state::Mise_A_Jour_Etat(int Adresse, int Value ) { - hec2hrp_state *state = machine.driver_data<hec2hrp_state>(); /* Adjust value depending on I/O main CPU request*/ switch(Adresse ) { case 0x2000: /* Modification AU0 / AU8*/ { /* AU0*/ - state->m_AU[ 0] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 0] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU8 : 0*/ - state->m_AU[ 8] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[ 8] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2001: /* Modification AU1 / AU9*/ { /* AU1*/ - state->m_AU[ 1] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 1] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU9*/ - state->m_AU[ 9] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[ 9] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2002: /* Modification AU2 / AU10*/ { /* AU2*/ - state->m_AU[ 2] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 2] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU10*/ - state->m_AU[10] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[10] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2003: /* Modification AU3 / AU11*/ { /* AU3*/ - state->m_AU[ 3] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 3] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU11*/ - state->m_AU[11] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[11] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2800: /* Modification AU4 / AU12*/ { /* AU4*/ - state->m_AU[ 4] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 4] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU8*/ - state->m_AU[12] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[12] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2801: /* Modification AU5 / AU13*/ { /* AU5*/ - state->m_AU[ 5] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 5] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU13*/ - state->m_AU[13] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[13] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2802: { /* Modification AU6 / AU14*/ /* AU6*/ - state->m_AU[ 6] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 6] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU14*/ - state->m_AU[14] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[14] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x2803: /* Modification AU7 / AU15*/ { /* AU7*/ - state->m_AU[ 7] = ((Value & 0x080 )==0) ? 0 : 1 ; + m_AU[ 7] = ((Value & 0x080 )==0) ? 0 : 1 ; /* AU15*/ - state->m_AU[15] = ((Value & 0x040 )==0) ? 0 : 1 ; + m_AU[15] = ((Value & 0x040 )==0) ? 0 : 1 ; break; } case 0x3000: /* Mixer modification*/ { - state->m_ValMixer = (Value & 7) ; + m_ValMixer = (Value & 7) ; break; } default: break; @@ -664,22 +661,21 @@ switch(Adresse ) } -static void Init_Value_SN76477_Hector(running_machine &machine) +void hec2hrp_state::Init_Value_SN76477_Hector() { - hec2hrp_state *state = machine.driver_data<hec2hrp_state>(); /* Remplissage des valeurs de resistance et capacite d'Hector*/ /* Decay R*/ - state->m_Pin_Value[7][1] = RES_K(680.0); /*680K */ - state->m_Pin_Value[7][0] = RES_K(252.325); /* 142.325 (680 // 180KOhm)*/ + m_Pin_Value[7][1] = RES_K(680.0); /*680K */ + m_Pin_Value[7][0] = RES_K(252.325); /* 142.325 (680 // 180KOhm)*/ /* Capa A/D*/ - state->m_Pin_Value[8][0] = CAP_U(0.47); /* 0.47uf*/ - state->m_Pin_Value[8][1] = CAP_U(1.47); /* 1.47*/ + m_Pin_Value[8][0] = CAP_U(0.47); /* 0.47uf*/ + m_Pin_Value[8][1] = CAP_U(1.47); /* 1.47*/ /* ATTACK R*/ - state->m_Pin_Value[10][1]= RES_K(180.0); /* 180*/ - state->m_Pin_Value[10][0]= RES_K(32.054); /* 32.054 (180 // 39 KOhm)*/ + m_Pin_Value[10][1]= RES_K(180.0); /* 180*/ + m_Pin_Value[10][0]= RES_K(32.054); /* 32.054 (180 // 39 KOhm)*/ /* Version 3 : Ajuste pour les frequences mesurees : // 4 0 SOUND 255 Hz => ajuste a l'oreille @@ -687,12 +683,12 @@ static void Init_Value_SN76477_Hector(running_machine &machine) // 4 8 SOUND 17 Hz => ajuste a l'oreille // 4 12 SOUND 4,3 Hz => ajuste a l'oreille*/ /* SLF C Version 3*/ - state->m_Pin_Value[21][0]= CAP_U(0.1); /*CAPU(0.1) */ - state->m_Pin_Value[21][1]= CAP_U(1.1); /*1.1*/ + m_Pin_Value[21][0]= CAP_U(0.1); /*CAPU(0.1) */ + m_Pin_Value[21][1]= CAP_U(1.1); /*1.1*/ /*SLF R Version 3*/ - state->m_Pin_Value[20][1]= RES_K(180); //180 vu - state->m_Pin_Value[20][0]= RES_K(37.268); //37.268 (47//180 KOhms) + m_Pin_Value[20][1]= RES_K(180); //180 vu + m_Pin_Value[20][0]= RES_K(37.268); //37.268 (47//180 KOhms) /* Capa VCO*/ /* Version 3 : Ajust?? pour les frequences mesur??es : @@ -700,132 +696,131 @@ static void Init_Value_SN76477_Hector(running_machine &machine) // 0 16 SOUND 1,3KHz => 1,2KHz // 0 32 SOUND 580Hz => 570Hz // 0 48 SOUND 132Hz => 120Hz*/ - state->m_Pin_Value[17][0] = CAP_N(47.0) ; /*47,0 mesure ok */ - state->m_Pin_Value[17][1] = CAP_N(580.0) ; /*580 mesure ok */ + m_Pin_Value[17][0] = CAP_N(47.0) ; /*47,0 mesure ok */ + m_Pin_Value[17][1] = CAP_N(580.0) ; /*580 mesure ok */ /* R VCO Version 3*/ - state->m_Pin_Value[18][1] = RES_K(1400.0 );/*1300 mesure ok // au lieu de 1Mohm*/ - state->m_Pin_Value[18][0] = RES_K( 203.548 );/*223 mesure ok // au lieu de 193.548 (1000 // 240KOhm)*/ + m_Pin_Value[18][1] = RES_K(1400.0 );/*1300 mesure ok // au lieu de 1Mohm*/ + m_Pin_Value[18][0] = RES_K( 203.548 );/*223 mesure ok // au lieu de 193.548 (1000 // 240KOhm)*/ /* VCO Controle*/ - state->m_Pin_Value[16][0] = 0.0; /* Volts */ - state->m_Pin_Value[16][1] = 1.41; /* 2 = 10/15eme de 5V*/ + m_Pin_Value[16][0] = 0.0; /* Volts */ + m_Pin_Value[16][1] = 1.41; /* 2 = 10/15eme de 5V*/ /* Pitch*/ - state->m_Pin_Value[19][0] = 0.0; /*Volts */ - state->m_Pin_Value[19][1] = 1.41; + m_Pin_Value[19][0] = 0.0; /*Volts */ + m_Pin_Value[19][1] = 1.41; - state->m_Pin_Value[22][0] = 0; /* TOR */ - state->m_Pin_Value[22][1] = 1; + m_Pin_Value[22][0] = 0; /* TOR */ + m_Pin_Value[22][1] = 1; /* R OneShot*/ - state->m_Pin_Value[24][1] = RES_K(100); - state->m_Pin_Value[24][0] = RES_K(1000); /*RES_M(1) infini sur Hector car non connectee*/ + m_Pin_Value[24][1] = RES_K(100); + m_Pin_Value[24][0] = RES_K(1000); /*RES_M(1) infini sur Hector car non connectee*/ /* Capa OneShot*/ - state->m_Pin_Value[23][0] = 1.0; - state->m_Pin_Value[23][1] = 0.0; /* Valeur Bidon sur Hector car mise au 5Volts sans capa*/ + m_Pin_Value[23][0] = 1.0; + m_Pin_Value[23][1] = 0.0; /* Valeur Bidon sur Hector car mise au 5Volts sans capa*/ /* Enabled*/ - state->m_Pin_Value[9][0] = 0; - state->m_Pin_Value[9][1] = 1; + m_Pin_Value[9][0] = 0; + m_Pin_Value[9][1] = 1; /* Volume*/ - state->m_Pin_Value[11][0] = 128; /* Rapport 50% et 100% 128*/ - state->m_Pin_Value[11][1] = 255; /* 255*/ + m_Pin_Value[11][0] = 128; /* Rapport 50% et 100% 128*/ + m_Pin_Value[11][1] = 255; /* 255*/ /* Noise filter*/ - state->m_Pin_Value[6][0] = CAP_U(0.390); /* 0.390*/ - state->m_Pin_Value[6][1] = CAP_U(08.60); /* 0.48*/ + m_Pin_Value[6][0] = CAP_U(0.390); /* 0.390*/ + m_Pin_Value[6][1] = CAP_U(08.60); /* 0.48*/ /* Valeur corrige par rapport au schema :*/ - state->m_Pin_Value[5][1] = RES_K(3.30 ) ; /* 330Kohm*/ - state->m_Pin_Value[5][0] = RES_K(1.76 ) ; /* 76 Kohm*/ + m_Pin_Value[5][1] = RES_K(3.30 ) ; /* 330Kohm*/ + m_Pin_Value[5][0] = RES_K(1.76 ) ; /* 76 Kohm*/ /* Noise pas commande par le bus audio !*/ /* Seule la valeur [0] est documentee !*/ - state->m_Pin_Value[4][0] = RES_K(47) ; /* 47 K ohm*/ - state->m_Pin_Value[12][0] = RES_K(100); /* 100K ohm*/ - state->m_Pin_Value[3][0] = 0 ; /* NC*/ + m_Pin_Value[4][0] = RES_K(47) ; /* 47 K ohm*/ + m_Pin_Value[12][0] = RES_K(100); /* 100K ohm*/ + m_Pin_Value[3][0] = 0 ; /* NC*/ /* Gestion du type d'enveloppe*/ - state->m_Pin_Value[ 1][0] = 0; - state->m_Pin_Value[ 1][1] = 1; + m_Pin_Value[ 1][0] = 0; + m_Pin_Value[ 1][1] = 1; - state->m_Pin_Value[28][0] = 0; - state->m_Pin_Value[28][1] = 1; + m_Pin_Value[28][0] = 0; + m_Pin_Value[28][1] = 1; /* Initialisation a 0 des pin du SN*/ - state->m_AU[0]=0; - state->m_AU[1]=0; - state->m_AU[2]=0; - state->m_AU[3]=0; - state->m_AU[4]=0; - state->m_AU[5]=0; - state->m_AU[6]=0; - state->m_AU[7]=0; - state->m_AU[8]=0; - state->m_AU[9]=0; - state->m_AU[10]=0; - state->m_AU[11]=0; - state->m_AU[12]=0; - state->m_AU[13]=0; - state->m_AU[14]=0; - state->m_AU[15]=0; - state->m_ValMixer = 0; + m_AU[0]=0; + m_AU[1]=0; + m_AU[2]=0; + m_AU[3]=0; + m_AU[4]=0; + m_AU[5]=0; + m_AU[6]=0; + m_AU[7]=0; + m_AU[8]=0; + m_AU[9]=0; + m_AU[10]=0; + m_AU[11]=0; + m_AU[12]=0; + m_AU[13]=0; + m_AU[14]=0; + m_AU[15]=0; + m_ValMixer = 0; } -static void Update_Sound(address_space &space, UINT8 data) +void hec2hrp_state::Update_Sound(address_space &space, UINT8 data) { - hec2hrp_state *state = space.machine().driver_data<hec2hrp_state>(); /* keep device*/ device_t *sn76477 = space.machine().device("sn76477"); /* MIXER*/ - sn76477_mixer_a_w(sn76477, ((state->m_ValMixer & 0x04)==4) ? 1 : 0); - sn76477_mixer_b_w(sn76477, ((state->m_ValMixer & 0x01)==1) ? 1 : 0); - sn76477_mixer_c_w(sn76477, ((state->m_ValMixer & 0x02)==2) ? 1 : 0);/* Revu selon mesure electronique sur HRX*/ + sn76477_mixer_a_w(sn76477, ((m_ValMixer & 0x04)==4) ? 1 : 0); + sn76477_mixer_b_w(sn76477, ((m_ValMixer & 0x01)==1) ? 1 : 0); + sn76477_mixer_c_w(sn76477, ((m_ValMixer & 0x02)==2) ? 1 : 0);/* Revu selon mesure electronique sur HRX*/ /* VCO oscillateur*/ - if (state->m_AU[12]==1) - sn76477_vco_res_w( sn76477, state->m_Pin_Value[18][state->m_AU[10]]/12.0); /* en non AU11*/ + if (m_AU[12]==1) + sn76477_vco_res_w( sn76477, m_Pin_Value[18][m_AU[10]]/12.0); /* en non AU11*/ else - sn76477_vco_res_w( sn76477, state->m_Pin_Value[18][state->m_AU[10]]); /* en non AU11*/ + sn76477_vco_res_w( sn76477, m_Pin_Value[18][m_AU[10]]); /* en non AU11*/ - sn76477_vco_cap_w( sn76477, state->m_Pin_Value[17][state->m_AU[2 ]]); - sn76477_pitch_voltage_w(sn76477, state->m_Pin_Value[19][state->m_AU[15]]); - sn76477_vco_voltage_w( sn76477, state->m_Pin_Value[16][state->m_AU[15]]); - sn76477_vco_w( sn76477, state->m_Pin_Value[22][state->m_AU[12]]); /* VCO Select Ext/SLF*/ + sn76477_vco_cap_w( sn76477, m_Pin_Value[17][m_AU[2 ]]); + sn76477_pitch_voltage_w(sn76477, m_Pin_Value[19][m_AU[15]]); + sn76477_vco_voltage_w( sn76477, m_Pin_Value[16][m_AU[15]]); + sn76477_vco_w( sn76477, m_Pin_Value[22][m_AU[12]]); /* VCO Select Ext/SLF*/ /* SLF*/ - sn76477_slf_res_w( sn76477, state->m_Pin_Value[20][state->m_AU[ 9]]);/*AU10*/ - sn76477_slf_cap_w( sn76477, state->m_Pin_Value[21][state->m_AU[1 ]]); + sn76477_slf_res_w( sn76477, m_Pin_Value[20][m_AU[ 9]]);/*AU10*/ + sn76477_slf_cap_w( sn76477, m_Pin_Value[21][m_AU[1 ]]); /* One Shot*/ - sn76477_one_shot_res_w(sn76477, state->m_Pin_Value[24][ 0]); /* NC*/ - sn76477_one_shot_cap_w(sn76477, state->m_Pin_Value[23][state->m_AU[13]]); + sn76477_one_shot_res_w(sn76477, m_Pin_Value[24][ 0]); /* NC*/ + sn76477_one_shot_cap_w(sn76477, m_Pin_Value[23][m_AU[13]]); /* Ampli value*/ - sn76477_amplitude_res_w(sn76477, state->m_Pin_Value[11][state->m_AU[5]]); + sn76477_amplitude_res_w(sn76477, m_Pin_Value[11][m_AU[5]]); /* Attack / Decay*/ - sn76477_attack_res_w(sn76477, state->m_Pin_Value[10][state->m_AU[ 8]]); - sn76477_decay_res_w( sn76477, state->m_Pin_Value[7 ][state->m_AU[11]]);/*AU9*/ - sn76477_attack_decay_cap_w(sn76477, state->m_Pin_Value[8][state->m_AU[0]]); + sn76477_attack_res_w(sn76477, m_Pin_Value[10][m_AU[ 8]]); + sn76477_decay_res_w( sn76477, m_Pin_Value[7 ][m_AU[11]]);/*AU9*/ + sn76477_attack_decay_cap_w(sn76477, m_Pin_Value[8][m_AU[0]]); /* Filtre*/ - sn76477_noise_filter_res_w(sn76477, state->m_Pin_Value[5][state->m_AU[4]]); - sn76477_noise_filter_cap_w(sn76477, state->m_Pin_Value[6][state->m_AU[3]]); + sn76477_noise_filter_res_w(sn76477, m_Pin_Value[5][m_AU[4]]); + sn76477_noise_filter_cap_w(sn76477, m_Pin_Value[6][m_AU[3]]); /* Clock Extern Noise*/ - sn76477_noise_clock_res_w(sn76477, state->m_Pin_Value[4][0]); /* fix*/ - sn76477_feedback_res_w(sn76477, state->m_Pin_Value[12][0]); /*fix*/ + sn76477_noise_clock_res_w(sn76477, m_Pin_Value[4][0]); /* fix*/ + sn76477_feedback_res_w(sn76477, m_Pin_Value[12][0]); /*fix*/ /* Envelope*/ - sn76477_envelope_1_w(sn76477, state->m_Pin_Value[1 ][state->m_AU[6]]); - sn76477_envelope_2_w(sn76477, state->m_Pin_Value[28][state->m_AU[7]]); + sn76477_envelope_1_w(sn76477, m_Pin_Value[1 ][m_AU[6]]); + sn76477_envelope_2_w(sn76477, m_Pin_Value[28][m_AU[7]]); /* En dernier on lance (ou pas !)*/ - sn76477_enable_w(sn76477, state->m_Pin_Value[9][state->m_AU[14]]); + sn76477_enable_w(sn76477, m_Pin_Value[9][m_AU[14]]); } const sn76477_interface hector_sn76477_interface = @@ -848,34 +843,32 @@ const sn76477_interface hector_sn76477_interface = RES_K(10000) /* 24 oneshot_res*/ }; -void hector_reset(running_machine &machine, int hr, int with_D2 ) +void hec2hrp_state::hector_reset(int hr, int with_D2 ) { - hec2hrp_state *state = machine.driver_data<hec2hrp_state>(); // Initialization Hector - state->m_hector_flag_hr = hr; - state->m_flag_clk = 0; - state->m_write_cassette = 0; - state->m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + m_hector_flag_hr = hr; + m_flag_clk = 0; + m_write_cassette = 0; + m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); // Initialization Disc II if (with_D2==1) { - upd765a_device *fdc = machine.device<upd765a_device>("upd765"); - state->m_disc2cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); + upd765a_device *fdc = machine().device<upd765a_device>("upd765"); + m_disc2cpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); fdc->reset(); } } -void hector_init(running_machine &machine) +void hec2hrp_state::hector_init() { - hec2hrp_state *state = machine.driver_data<hec2hrp_state>(); - state->m_pot0 = state->m_pot1 = 0x40; + m_pot0 = m_pot1 = 0x40; /* For Cassette synchro*/ - state->m_Cassette_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(hec2hrp_state::Callback_CK),state)); - state->m_Cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/ + m_Cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hec2hrp_state::Callback_CK),this)); + m_Cassette_timer->adjust(attotime::from_msec(100), 0, attotime::from_usec(64));/* => real synchro scan speed for 15,624Khz*/ /* Sound sn76477*/ - Init_Value_SN76477_Hector(machine); /*init R/C value*/ + Init_Value_SN76477_Hector(); /*init R/C value*/ } diff --git a/src/mess/machine/hp48.c b/src/mess/machine/hp48.c index 9d318eb4a60..ab5e85e2180 100644 --- a/src/mess/machine/hp48.c +++ b/src/mess/machine/hp48.c @@ -80,11 +80,10 @@ static const UINT8 hp48_module_addr_id[6] = { 0x19, 0xf4, 0xf6, 0xf8, 0xf2, 0x00 FUNCTIONS ***************************************************************************/ -static void hp48_pulse_irq( running_machine &machine, int irq_line) +void hp48_state::hp48_pulse_irq( int irq_line) { - hp48_state *state = machine.driver_data<hp48_state>(); - state->m_maincpu->set_input_line(irq_line, ASSERT_LINE ); - state->m_maincpu->set_input_line(irq_line, CLEAR_LINE ); + m_maincpu->set_input_line(irq_line, ASSERT_LINE ); + m_maincpu->set_input_line(irq_line, CLEAR_LINE ); } @@ -106,27 +105,26 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_recv_cb) /* interrupt */ if ( m_io[0x10] & 2 ) { - hp48_pulse_irq( machine(), SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } } /* outside world initiates a receive event */ -void hp48_rs232_start_recv_byte( running_machine &machine, UINT8 data ) +void hp48_state::hp48_rs232_start_recv_byte( UINT8 data ) { - hp48_state *state = machine.driver_data<hp48_state>(); LOG_SERIAL(( "%f hp48_rs232_start_recv_byte: start receiving, data=%02x\n", - machine.time().as_double(), data )); + machine().time().as_double(), data )); - state->m_io[0x11] |= 2; /* set byte receiving */ + m_io[0x11] |= 2; /* set byte receiving */ /* interrupt */ - if ( state->m_io[0x10] & 1 ) + if ( m_io[0x10] & 1 ) { - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } /* schedule end of reception */ - machine.scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_recv_cb),state), data); + machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_recv_cb),this), data); } @@ -144,7 +142,7 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_sent_cb) /* interrupt */ if ( m_io[0x10] & 4 ) { - hp48_pulse_irq( machine(), SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } /* protocol action */ @@ -156,19 +154,18 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_rs232_byte_sent_cb) } /* CPU initiates a send event */ -static void hp48_rs232_send_byte( running_machine &machine ) +void hp48_state::hp48_rs232_send_byte( ) { - hp48_state *state = machine.driver_data<hp48_state>(); UINT8 data = HP48_IO_8(0x16); /* byte to send */ LOG_SERIAL(( "%s %f hp48_rs232_send_byte: start sending, data=%02x\n", - machine.describe_context(), machine.time().as_double(), data )); + machine().describe_context(), machine().time().as_double(), data )); /* set byte sending and send buffer full */ - state->m_io[0x12] |= 3; + m_io[0x12] |= 3; /* schedule transmission */ - machine.scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_sent_cb),state), data); + machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_rs232_byte_sent_cb),this), data); } @@ -189,39 +186,37 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_chardev_byte_recv_cb) /* interrupt */ if ( m_io[0x10] & 2 ) { - hp48_pulse_irq( machine(), SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } } -static void hp48_chardev_start_recv_byte( running_machine &machine, chardev_err status ) +void hp48_state::hp48_chardev_start_recv_byte( chardev_err status ) { - hp48_state *state = machine.driver_data<hp48_state>(); if ( status != CHARDEV_OK ) return; LOG_SERIAL(( "%f hp48_chardev_start_recv_byte: start receiving\n", - machine.time().as_double() )); + machine().time().as_double() )); - state->m_io[0x11] |= 2; /* set byte receiving */ + m_io[0x11] |= 2; /* set byte receiving */ /* interrupt */ - if ( state->m_io[0x10] & 1 ) + if ( m_io[0x10] & 1 ) { - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } /* schedule end of reception */ - machine.scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_chardev_byte_recv_cb),this)); + machine().scheduler().timer_set( RS232_DELAY, timer_expired_delegate(FUNC(hp48_state::hp48_chardev_byte_recv_cb),this)); } -static void hp48_chardev_ready_to_send( running_machine &machine ) +void hp48_state::hp48_chardev_ready_to_send( ) { - hp48_state *state = machine.driver_data<hp48_state>(); - state->m_io[0x12] &= ~3; + m_io[0x12] &= ~3; /* interrupt */ - if ( state->m_io[0x10] & 4 ) + if ( m_io[0x10] & 4 ) { - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } } @@ -250,24 +245,23 @@ void hp48_reg_out( device_t *device, int out ) state->m_dac->write_unsigned8((out & 0x800) ? 0x80 : 00 ); } -static int hp48_get_in( running_machine &machine ) +int hp48_state::hp48_get_in( ) { - hp48_state *state = machine.driver_data<hp48_state>(); int in = 0; /* regular keys */ - if ( (state->m_out >> 0) & 1 ) in |= machine.root_device().ioport( "LINE0" )->read(); - if ( (state->m_out >> 1) & 1 ) in |= machine.root_device().ioport( "LINE1" )->read(); - if ( (state->m_out >> 2) & 1 ) in |= machine.root_device().ioport( "LINE2" )->read(); - if ( (state->m_out >> 3) & 1 ) in |= machine.root_device().ioport( "LINE3" )->read(); - if ( (state->m_out >> 4) & 1 ) in |= machine.root_device().ioport( "LINE4" )->read(); - if ( (state->m_out >> 5) & 1 ) in |= machine.root_device().ioport( "LINE5" )->read(); - if ( (state->m_out >> 6) & 1 ) in |= machine.root_device().ioport( "LINE6" )->read(); - if ( (state->m_out >> 7) & 1 ) in |= machine.root_device().ioport( "LINE7" )->read(); - if ( (state->m_out >> 8) & 1 ) in |= machine.root_device().ioport( "LINE8" )->read(); + if ( (m_out >> 0) & 1 ) in |= machine().root_device().ioport( "LINE0" )->read(); + if ( (m_out >> 1) & 1 ) in |= machine().root_device().ioport( "LINE1" )->read(); + if ( (m_out >> 2) & 1 ) in |= machine().root_device().ioport( "LINE2" )->read(); + if ( (m_out >> 3) & 1 ) in |= machine().root_device().ioport( "LINE3" )->read(); + if ( (m_out >> 4) & 1 ) in |= machine().root_device().ioport( "LINE4" )->read(); + if ( (m_out >> 5) & 1 ) in |= machine().root_device().ioport( "LINE5" )->read(); + if ( (m_out >> 6) & 1 ) in |= machine().root_device().ioport( "LINE6" )->read(); + if ( (m_out >> 7) & 1 ) in |= machine().root_device().ioport( "LINE7" )->read(); + if ( (m_out >> 8) & 1 ) in |= machine().root_device().ioport( "LINE8" )->read(); /* on key */ - in |= machine.root_device().ioport( "ON" )->read(); + in |= machine().root_device().ioport( "ON" )->read(); return in; } @@ -275,28 +269,28 @@ static int hp48_get_in( running_machine &machine ) /* CPU reads IN register (keyboard) */ int hp48_reg_in( device_t *device ) { - int in = hp48_get_in(device->machine()); + hp48_state *state = device->machine().driver_data<hp48_state>(); + int in = state->hp48_get_in(); LOG(( "%s %f hp48_reg_in: %04x\n", device->machine().describe_context(), device->machine().time().as_double(), in )); return in; } /* key detect */ -static void hp48_update_kdn( running_machine &machine ) +void hp48_state::hp48_update_kdn( ) { - hp48_state *state = machine.driver_data<hp48_state>(); - int in = hp48_get_in( machine ); + int in = hp48_get_in(); /* interrupt on raising edge */ - if ( in && !state->m_kdn ) + if ( in && !m_kdn ) { - LOG(( "%f hp48_update_kdn: interrupt\n", machine.time().as_double() )); - state->m_io[0x19] |= 8; /* service request */ - hp48_pulse_irq( machine, SATURN_WAKEUP_LINE ); - hp48_pulse_irq( machine, SATURN_IRQ_LINE ); + LOG(( "%f hp48_update_kdn: interrupt\n", machine().time().as_double() )); + m_io[0x19] |= 8; /* service request */ + hp48_pulse_irq( SATURN_WAKEUP_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); } - state->m_kdn = (in!=0); + m_kdn = (in!=0); } /* periodic keyboard polling, generates an interrupt */ @@ -308,13 +302,13 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_kbd_cb) LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", machine().time().as_double() )); m_io[0x19] |= 8; /* set service request */ - hp48_pulse_irq( machine(), SATURN_WAKEUP_LINE ); - hp48_pulse_irq( machine(), SATURN_NMI_LINE ); + hp48_pulse_irq( SATURN_WAKEUP_LINE ); + hp48_pulse_irq( SATURN_NMI_LINE ); return; } /* regular keys */ - hp48_update_kdn( machine() ); + hp48_update_kdn(); } /* RSI opcode */ @@ -342,7 +336,6 @@ void hp48_state::hp48_update_annunciators() bit 5: transmit bit 7: master enable */ - hp48_state *state = machine().driver_data<hp48_state>(); int markers = HP48_IO_8(0xb); output_set_value( "lshift0", (markers & 0x81) == 0x81 ); output_set_value( "rshift0", (markers & 0x82) == 0x82 ); @@ -413,7 +406,7 @@ WRITE8_MEMBER(hp48_state::hp48_io_w) { LOG(( "%f hp48_io_w: software interrupt requested\n", space.machine().time().as_double() )); - hp48_pulse_irq( space.machine(), SATURN_IRQ_LINE ); + hp48_pulse_irq( SATURN_IRQ_LINE ); data &= ~1; } @@ -440,7 +433,7 @@ WRITE8_MEMBER(hp48_state::hp48_io_w) case 0x17: /* second nibble of sent data */ m_io[offset] = data; - hp48_rs232_send_byte(space.machine()); + hp48_rs232_send_byte(); break; /* XXX not implemented: @@ -616,7 +609,7 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer1_cb) LOG(( "wake-up on timer1\n" )); m_io[0x2e] |= 8; /* set service request */ m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine(), SATURN_WAKEUP_LINE ); + hp48_pulse_irq( SATURN_WAKEUP_LINE ); } /* interrupt on carry */ if ( (m_io[0x2e] & 2) && (m_timer1 == 0xf) ) @@ -624,7 +617,7 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer1_cb) LOG(( "generate timer1 interrupt\n" )); m_io[0x2e] |= 8; /* set service request */ m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine(), SATURN_NMI_LINE ); + hp48_pulse_irq( SATURN_NMI_LINE ); } } @@ -640,7 +633,7 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer2_cb) LOG(( "wake-up on timer2\n" )); m_io[0x2f] |= 8; /* set service request */ m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine(), SATURN_WAKEUP_LINE ); + hp48_pulse_irq( SATURN_WAKEUP_LINE ); } /* interrupt on carry */ if ( (m_io[0x2f] & 2) && (m_timer2 == 0xffffffff) ) @@ -648,7 +641,7 @@ TIMER_CALLBACK_MEMBER(hp48_state::hp48_timer2_cb) LOG(( "generate timer2 interrupt\n" )); m_io[0x2f] |= 8; /* set service request */ m_io[0x18] |= 4; /* set service request */ - hp48_pulse_irq( machine(), SATURN_NMI_LINE ); + hp48_pulse_irq( SATURN_NMI_LINE ); } } @@ -799,33 +792,33 @@ void hp48_state::hp48_apply_modules() /* reset the configuration */ -static void hp48_reset_modules( running_machine &machine ) +void hp48_state::hp48_reset_modules( ) { - hp48_state *state = machine.driver_data<hp48_state>(); int i; /* fixed size for HDW */ - state->m_modules[0].state = HP48_MODULE_MASK_KNOWN; - state->m_modules[0].mask = 0xfffc0; + m_modules[0].state = HP48_MODULE_MASK_KNOWN; + m_modules[0].mask = 0xfffc0; /* unconfigure NCE2, CE1, CE2, NCE3 */ for ( i = 1; i < 5; i++ ) { - state->m_modules[i].state = HP48_MODULE_UNCONFIGURED; + m_modules[i].state = HP48_MODULE_UNCONFIGURED; } /* fixed configuration for NCE1 */ - state->m_modules[5].state = HP48_MODULE_CONFIGURED; - state->m_modules[5].base = 0; - state->m_modules[5].mask = 0; + m_modules[5].state = HP48_MODULE_CONFIGURED; + m_modules[5].base = 0; + m_modules[5].mask = 0; - state->hp48_apply_modules(); + hp48_apply_modules(); } /* RESET opcode */ void hp48_mem_reset( device_t *device ) { + hp48_state *state = device->machine().driver_data<hp48_state>(); LOG(( "%s %f hp48_mem_reset\n", device->machine().describe_context(), device->machine().time().as_double() )); - hp48_reset_modules(device->machine()); + state->hp48_reset_modules(); } @@ -936,7 +929,7 @@ void hp48_mem_crc( device_t *device, int addr, int data ) /* decodes size bytes into 2*size nibbles (least significant first) */ -static void hp48_decode_nibble( UINT8* dst, UINT8* src, int size ) +void hp48_state::hp48_decode_nibble( UINT8* dst, UINT8* src, int size ) { int i; for ( i=size-1; i >= 0; i-- ) @@ -947,7 +940,7 @@ static void hp48_decode_nibble( UINT8* dst, UINT8* src, int size ) } /* inverse of hp48_decode_nibble */ -static void hp48_encode_nibble( UINT8* dst, UINT8* src, int size ) +void hp48_state::hp48_encode_nibble( UINT8* dst, UINT8* src, int size ) { int i; for ( i=0; i < size; i++ ) @@ -1018,7 +1011,7 @@ bool hp48_port_image_device::call_load() state->m_port_write[conf->port] = !is_readonly(); hp48_fill_port( ); fread(state->m_port_data[conf->port], state->m_port_size[conf->port] ); - hp48_decode_nibble( state->m_port_data[conf->port], state->m_port_data[conf->port], state->m_port_size[conf->port] ); + state->hp48_decode_nibble( state->m_port_data[conf->port], state->m_port_data[conf->port], state->m_port_size[conf->port] ); return IMAGE_INIT_PASS; } @@ -1051,7 +1044,7 @@ void hp48_port_image_device::call_unload() tag(), state->m_port_size[conf->port] ,state->m_port_write[conf->port] )); if ( state->m_port_write[conf->port] ) { - hp48_encode_nibble( state->m_port_data[conf->port], state->m_port_data[conf->port], state->m_port_size[conf->port] ); + state->hp48_encode_nibble( state->m_port_data[conf->port], state->m_port_data[conf->port], state->m_port_size[conf->port] ); fseek( 0, SEEK_SET ); fwrite( state->m_port_data[conf->port], state->m_port_size[conf->port] ); } @@ -1098,7 +1091,7 @@ DRIVER_INIT_MEMBER(hp48_state,hp48) void hp48_state::machine_reset() { LOG(( "hp48: machine reset called\n" )); - hp48_reset_modules( machine() ); + hp48_reset_modules(); hp48_update_annunciators(); } diff --git a/src/mess/machine/lisa.c b/src/mess/machine/lisa.c index e974de5cc8e..4bcc4a0ff82 100644 --- a/src/mess/machine/lisa.c +++ b/src/mess/machine/lisa.c @@ -940,9 +940,8 @@ NVRAM_HANDLER(lisa) } #ifdef UNUSED_FUNCTION -void init_lisa1(void) +void lisa_state::init_lisa1(void) { - lisa_state *state = machine.driver_data<lisa_state>(); m_model = lisa1; m_features.has_fast_timers = 0; m_features.floppy_hardware = twiggy; diff --git a/src/mess/machine/lviv.c b/src/mess/machine/lviv.c index 478be330915..a23d3f23c69 100644 --- a/src/mess/machine/lviv.c +++ b/src/mess/machine/lviv.c @@ -24,20 +24,19 @@ -static void lviv_update_memory (running_machine &machine) +void lviv_state::lviv_update_memory () { - lviv_state *state = machine.driver_data<lviv_state>(); - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); - if (state->m_ppi_port_outputs[0][2] & 0x02) + if (m_ppi_port_outputs[0][2] & 0x02) { - state->membank("bank1")->set_base(ram); - state->membank("bank2")->set_base(ram + 0x4000); + membank("bank1")->set_base(ram); + membank("bank2")->set_base(ram + 0x4000); } else { - state->membank("bank1")->set_base(ram + 0x8000); - state->membank("bank2")->set_base(ram + 0xc000); + membank("bank1")->set_base(ram + 0x8000); + membank("bank2")->set_base(ram + 0xc000); } } @@ -81,7 +80,7 @@ WRITE8_MEMBER(lviv_state::lviv_ppi_0_porta_w) WRITE8_MEMBER(lviv_state::lviv_ppi_0_portb_w) { m_ppi_port_outputs[0][1] = data; - lviv_update_palette(machine(), data&0x7f); + lviv_update_palette(data&0x7f); } WRITE8_MEMBER(lviv_state::lviv_ppi_0_portc_w)/* tape in/out, video memory on/off */ @@ -90,7 +89,7 @@ WRITE8_MEMBER(lviv_state::lviv_ppi_0_portc_w)/* tape in/out, video memory on/off if (m_ppi_port_outputs[0][1]&0x80) speaker_level_w(m_speaker, data&0x01); m_cassette->output((data & 0x01) ? -1.0 : 1.0); - lviv_update_memory(machine()); + lviv_update_memory(); } READ8_MEMBER(lviv_state::lviv_ppi_1_porta_r) @@ -263,55 +262,53 @@ Lviv snapshot files (SAV) 1411D - 1412A: ??? (something additional) *******************************************************************************/ -static void lviv_setup_snapshot (running_machine &machine,UINT8 * data) +void lviv_state::lviv_setup_snapshot (UINT8 * data) { - lviv_state *state = machine.driver_data<lviv_state>(); unsigned char lo,hi; /* Set registers */ lo = data[0x14112] & 0x0ff; hi = data[0x14111] & 0x0ff; - state->m_maincpu->set_state_int(I8085_BC, (hi << 8) | lo); + m_maincpu->set_state_int(I8085_BC, (hi << 8) | lo); lo = data[0x14114] & 0x0ff; hi = data[0x14113] & 0x0ff; - state->m_maincpu->set_state_int(I8085_DE, (hi << 8) | lo); + m_maincpu->set_state_int(I8085_DE, (hi << 8) | lo); lo = data[0x14116] & 0x0ff; hi = data[0x14115] & 0x0ff; - state->m_maincpu->set_state_int(I8085_HL, (hi << 8) | lo); + m_maincpu->set_state_int(I8085_HL, (hi << 8) | lo); lo = data[0x14118] & 0x0ff; hi = data[0x14117] & 0x0ff; - state->m_maincpu->set_state_int(I8085_AF, (hi << 8) | lo); + m_maincpu->set_state_int(I8085_AF, (hi << 8) | lo); lo = data[0x14119] & 0x0ff; hi = data[0x1411a] & 0x0ff; - state->m_maincpu->set_state_int(I8085_SP, (hi << 8) | lo); + m_maincpu->set_state_int(I8085_SP, (hi << 8) | lo); lo = data[0x1411b] & 0x0ff; hi = data[0x1411c] & 0x0ff; - state->m_maincpu->set_state_int(I8085_PC, (hi << 8) | lo); + m_maincpu->set_state_int(I8085_PC, (hi << 8) | lo); /* Memory dump */ - memcpy (machine.device<ram_device>(RAM_TAG)->pointer(), data+0x0011, 0xc000); - memcpy (machine.device<ram_device>(RAM_TAG)->pointer()+0xc000, data+0x10011, 0x4000); + memcpy (machine().device<ram_device>(RAM_TAG)->pointer(), data+0x0011, 0xc000); + memcpy (machine().device<ram_device>(RAM_TAG)->pointer()+0xc000, data+0x10011, 0x4000); /* Ports */ - state->m_ppi_port_outputs[0][0] = data[0x14011+0xc0]; - state->m_ppi_port_outputs[0][1] = data[0x14011+0xc1]; - lviv_update_palette(machine, state->m_ppi_port_outputs[0][1]&0x7f); - state->m_ppi_port_outputs[0][2] = data[0x14011+0xc2]; - lviv_update_memory(machine); + m_ppi_port_outputs[0][0] = data[0x14011+0xc0]; + m_ppi_port_outputs[0][1] = data[0x14011+0xc1]; + lviv_update_palette(m_ppi_port_outputs[0][1]&0x7f); + m_ppi_port_outputs[0][2] = data[0x14011+0xc2]; + lviv_update_memory(); } -static void dump_registers(running_machine &machine) +void lviv_state::dump_registers() { - lviv_state *state = machine.driver_data<lviv_state>(); - logerror("PC = %04x\n", (unsigned) state->m_maincpu->state_int(I8085_PC)); - logerror("SP = %04x\n", (unsigned) state->m_maincpu->state_int(I8085_SP)); - logerror("AF = %04x\n", (unsigned) state->m_maincpu->state_int(I8085_AF)); - logerror("BC = %04x\n", (unsigned) state->m_maincpu->state_int(I8085_BC)); - logerror("DE = %04x\n", (unsigned) state->m_maincpu->state_int(I8085_DE)); - logerror("HL = %04x\n", (unsigned) state->m_maincpu->state_int(I8085_HL)); + logerror("PC = %04x\n", (unsigned) m_maincpu->state_int(I8085_PC)); + logerror("SP = %04x\n", (unsigned) m_maincpu->state_int(I8085_SP)); + logerror("AF = %04x\n", (unsigned) m_maincpu->state_int(I8085_AF)); + logerror("BC = %04x\n", (unsigned) m_maincpu->state_int(I8085_BC)); + logerror("DE = %04x\n", (unsigned) m_maincpu->state_int(I8085_DE)); + logerror("HL = %04x\n", (unsigned) m_maincpu->state_int(I8085_HL)); } -static int lviv_verify_snapshot (UINT8 * data, UINT32 size) +int lviv_state::lviv_verify_snapshot (UINT8 * data, UINT32 size) { const char* tag = "LVOV/DUMP/2.0/"; @@ -334,6 +331,7 @@ static int lviv_verify_snapshot (UINT8 * data, UINT32 size) SNAPSHOT_LOAD( lviv ) { UINT8 *lviv_snapshot_data; + lviv_state *state = image.device().machine().driver_data<lviv_state>(); lviv_snapshot_data = (UINT8*)malloc(LVIV_SNAPSHOT_SIZE); if (!lviv_snapshot_data) @@ -344,15 +342,15 @@ SNAPSHOT_LOAD( lviv ) image.fread( lviv_snapshot_data, LVIV_SNAPSHOT_SIZE); - if( lviv_verify_snapshot(lviv_snapshot_data, snapshot_size) == IMAGE_VERIFY_FAIL) + if(state->lviv_verify_snapshot(lviv_snapshot_data, snapshot_size) == IMAGE_VERIFY_FAIL) { free(lviv_snapshot_data); return IMAGE_INIT_FAIL; } - lviv_setup_snapshot (image.device().machine(),lviv_snapshot_data); + state->lviv_setup_snapshot (lviv_snapshot_data); - dump_registers(image.device().machine()); + state->dump_registers(); free(lviv_snapshot_data); diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c index 096e1061967..ff10ec82ce8 100644 --- a/src/mess/machine/mac.c +++ b/src/mess/machine/mac.c @@ -128,11 +128,6 @@ extern TIMER_CALLBACK(mac_adb_tick); // macadb.c extern TIMER_CALLBACK(mac_pmu_tick); // macadb.c - -static int scan_keyboard(running_machine &machine); - -static void keyboard_receive(running_machine &machine, int val); - static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options); const via6522_interface mac_via6522_intf = @@ -196,11 +191,10 @@ void mac_fdc_set_enable_lines(device_t *device, int enable_mask) } } -static void mac_install_memory(running_machine &machine, offs_t memory_begin, offs_t memory_end, +void mac_state::mac_install_memory(offs_t memory_begin, offs_t memory_end, offs_t memory_size, void *memory_data, int is_rom, const char *bank) { - mac_state *state = machine.driver_data<mac_state>(); - address_space& space = state->m_maincpu->space(AS_PROGRAM); + address_space& space = m_maincpu->space(AS_PROGRAM); offs_t memory_mask; memory_size = MIN(memory_size, (memory_end + 1 - memory_begin)); @@ -216,7 +210,7 @@ static void mac_install_memory(running_machine &machine, offs_t memory_begin, of space.install_read_bank(memory_begin, memory_end, memory_mask, 0, bank); } - state->membank(bank)->set_base(memory_data); + membank(bank)->set_base(memory_data); if (LOG_MEMORY) { @@ -358,7 +352,7 @@ READ16_MEMBER ( mac_state::mac_autovector_r ) return 0; } -static void set_scc_waitrequest(int waitrequest) +void mac_state::set_scc_waitrequest(int waitrequest) { if (LOG_GENERAL) logerror("set_scc_waitrequest: waitrequest=%i\n", waitrequest); @@ -394,7 +388,7 @@ void mac_state::v8_resize() if (is_rom) { - mac_install_memory(machine(), 0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); } else { @@ -419,25 +413,25 @@ void mac_state::v8_resize() if ((simm_amt > 0) && (simm_size > 0)) { -// mac_install_memory(machine(), 0x000000, simm_sizes[simm_amt]-1, simm_sizes[simm_amt], memory_data + onboard_amt, is_rom, "bank1"); - mac_install_memory(machine(), 0x000000, simm_size-1, simm_size, memory_data + onboard_amt, is_rom, "bank1"); +// mac_install_memory(0x000000, simm_sizes[simm_amt]-1, simm_sizes[simm_amt], memory_data + onboard_amt, is_rom, "bank1"); + mac_install_memory(0x000000, simm_size-1, simm_size, memory_data + onboard_amt, is_rom, "bank1"); } // onboard RAM sits immediately above the SIMM, if any if (simm_sizes[simm_amt] + onboard_amt <= 0x800000) { - mac_install_memory(machine(), simm_sizes[simm_amt], simm_sizes[simm_amt] + onboard_amt - 1, onboard_amt, memory_data, is_rom, "bank2"); + mac_install_memory(simm_sizes[simm_amt], simm_sizes[simm_amt] + onboard_amt - 1, onboard_amt, memory_data, is_rom, "bank2"); } // a mirror of the first 2 MB of on board RAM always lives at 0x800000 - mac_install_memory(machine(), 0x800000, 0x9fffff, 0x200000, memory_data, is_rom, "bank3"); + mac_install_memory(0x800000, 0x9fffff, 0x200000, memory_data, is_rom, "bank3"); } else { // printf("mac_v8_resize: SIMM off, mobo RAM at 0 and top\n"); - mac_install_memory(machine(), 0x000000, onboard_amt-1, onboard_amt, memory_data, is_rom, "bank1"); - mac_install_memory(machine(), 0x900000, 0x9fffff, 0x200000, memory_data+0x100000, is_rom, "bank3"); + mac_install_memory(0x000000, onboard_amt-1, onboard_amt, memory_data, is_rom, "bank1"); + mac_install_memory(0x900000, 0x9fffff, 0x200000, memory_data+0x100000, is_rom, "bank3"); } } } @@ -480,40 +474,40 @@ void mac_state::set_memory_overlay(int overlay) // ROM is OK to flood to 3fffffff if (is_rom) { - mac_install_memory(machine(), 0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); } else // RAM: be careful not to populate ram B with a mirror or the ROM will get confused { - mac_install_memory(machine(), 0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); } } else if ((m_model == MODEL_MAC_PORTABLE) || (m_model == MODEL_MAC_PB100) || (m_model == MODEL_MAC_IIVX) || (m_model == MODEL_MAC_IIFX)) { address_space& space = m_maincpu->space(AS_PROGRAM); space.unmap_write(0x000000, 0x9fffff, 0x9fffff, 0); - mac_install_memory(machine(), 0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); } else if ((m_model == MODEL_MAC_PB140) || (m_model == MODEL_MAC_PB160) || ((m_model >= MODEL_MAC_PBDUO_210) && (m_model <= MODEL_MAC_PBDUO_270c))) { address_space& space = m_maincpu->space(AS_PROGRAM); space.unmap_write(0x000000, 0xffffff, 0xffffff, 0); - mac_install_memory(machine(), 0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); } else if ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) { - mac_install_memory(machine(), 0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, 0x3fffffff, memory_size, memory_data, is_rom, "bank1"); } else if ((m_model == MODEL_MAC_LC_III) || (m_model == MODEL_MAC_LC_III_PLUS) || (m_model >= MODEL_MAC_LC_475 && m_model <= MODEL_MAC_LC_580)) // up to 36 MB { - mac_install_memory(machine(), 0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); } else if (m_model == MODEL_MAC_QUADRA_700) { - mac_install_memory(machine(), 0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, memory_size-1, memory_size, memory_data, is_rom, "bank1"); } else { - mac_install_memory(machine(), 0x00000000, 0x003fffff, memory_size, memory_data, is_rom, "bank1"); + mac_install_memory(0x00000000, 0x003fffff, memory_size, memory_data, is_rom, "bank1"); } m_overlay = overlay; @@ -554,24 +548,23 @@ void mac_state::set_memory_overlay(int overlay) scan the keyboard, and returns key transition code (or NULL ($7B) if none) */ -static int scan_keyboard(running_machine &machine) +int mac_state::scan_keyboard() { int i, j; int keybuf = 0; int keycode; - mac_state *mac = machine.driver_data<mac_state>(); - ioport_port *ports[7] = { mac->m_key0, mac->m_key1, mac->m_key2, mac->m_key3, mac->m_key4, mac->m_key5, mac->m_key6 }; + ioport_port *ports[7] = { m_key0, m_key1, m_key2, m_key3, m_key4, m_key5, m_key6 }; - if (mac->m_keycode_buf_index) + if (m_keycode_buf_index) { - return mac->m_keycode_buf[--mac->m_keycode_buf_index]; + return m_keycode_buf[--m_keycode_buf_index]; } for (i=0; i<7; i++) { keybuf = ports[i]->read(); - if (keybuf != mac->m_key_matrix[i]) + if (keybuf != m_key_matrix[i]) { /* if state has changed, find first bit which has changed */ if (LOG_KEYBOARD) @@ -579,10 +572,10 @@ static int scan_keyboard(running_machine &machine) for (j=0; j<16; j++) { - if (((keybuf ^ mac->m_key_matrix[i]) >> j) & 1) + if (((keybuf ^ m_key_matrix[i]) >> j) & 1) { - /* update mac->m_key_matrix */ - mac->m_key_matrix[i] = (mac->m_key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j)); + /* update m_key_matrix */ + m_key_matrix[i] = (m_key_matrix[i] & ~ (1 << j)) | (keybuf & (1 << j)); if (i < 4) { @@ -606,23 +599,23 @@ static int scan_keyboard(running_machine &machine) if (keybuf & (1 << j)) { /* key down */ - if (! (mac->m_key_matrix[3] & 0x0100)) + if (! (m_key_matrix[3] & 0x0100)) { /* shift key is really up */ - mac->m_keycode_buf[0] = keycode; - mac->m_keycode_buf[1] = 0x79; - mac->m_keycode_buf_index = 2; + m_keycode_buf[0] = keycode; + m_keycode_buf[1] = 0x79; + m_keycode_buf_index = 2; return 0x71; /* "presses" shift down */ } } else { /* key up */ - if (! (mac->m_key_matrix[3] & 0x0100)) + if (! (m_key_matrix[3] & 0x0100)) { /* shift key is really up */ - mac->m_keycode_buf[0] = keycode | 0x80; - mac->m_keycode_buf[1] = 0x79; - mac->m_keycode_buf_index = 2; + m_keycode_buf[0] = keycode | 0x80; + m_keycode_buf[1] = 0x79; + m_keycode_buf_index = 2; return 0xF1; /* "releases" shift */ } } @@ -633,8 +626,8 @@ static int scan_keyboard(running_machine &machine) /* key up */ keycode |= 0x80; } - mac->m_keycode_buf[0] = keycode; - mac->m_keycode_buf_index = 1; + m_keycode_buf[0] = keycode; + m_keycode_buf_index = 1; return 0x79; } else /* i == 6 */ @@ -646,8 +639,8 @@ static int scan_keyboard(running_machine &machine) /* key up */ keycode |= 0x80; } - mac->m_keycode_buf[0] = keycode; - mac->m_keycode_buf_index = 1; + m_keycode_buf[0] = keycode; + m_keycode_buf_index = 1; return 0x79; } } @@ -661,24 +654,24 @@ static int scan_keyboard(running_machine &machine) /* power-up init */ -static void keyboard_init(mac_state *mac) +void mac_state::keyboard_init() { int i; /* init flag */ - mac->m_kbd_comm = FALSE; - mac->m_kbd_receive = FALSE; - mac->m_kbd_shift_reg=0; - mac->m_kbd_shift_count=0; + m_kbd_comm = FALSE; + m_kbd_receive = FALSE; + m_kbd_shift_reg=0; + m_kbd_shift_count=0; /* clear key matrix */ for (i=0; i<7; i++) { - mac->m_key_matrix[i] = 0; + m_key_matrix[i] = 0; } /* purge transmission buffer */ - mac->m_keycode_buf_index = 0; + m_keycode_buf_index = 0; } /******************* Keyboard <-> VIA communication ***********************/ @@ -702,7 +695,7 @@ TIMER_CALLBACK_MEMBER(mac_state::kbd_clock) { m_kbd_receive = FALSE; /* Process the command received from mac */ - keyboard_receive(machine(), m_kbd_shift_reg & 0xff); + keyboard_receive(m_kbd_shift_reg & 0xff); } else { @@ -712,14 +705,13 @@ TIMER_CALLBACK_MEMBER(mac_state::kbd_clock) } } -static void kbd_shift_out(running_machine &machine, int data) +void mac_state::kbd_shift_out(int data) { - mac_state *mac = machine.driver_data<mac_state>(); - if (mac->m_kbd_comm == TRUE) + if (m_kbd_comm == TRUE) { - mac->m_kbd_shift_reg = data; - machine.scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(mac_state::kbd_clock),mac)); + m_kbd_shift_reg = data; + machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(mac_state::kbd_clock),this)); } } @@ -746,15 +738,14 @@ TIMER_CALLBACK_MEMBER(mac_state::inquiry_timeout_func) { if (LOG_KEYBOARD) logerror("keyboard enquiry timeout\n"); - kbd_shift_out(machine(), 0x7B); /* always send NULL */ + kbd_shift_out(0x7B); /* always send NULL */ } /* called when a command is received from the mac */ -static void keyboard_receive(running_machine &machine, int val) +void mac_state::keyboard_receive(int val) { - mac_state *mac = machine.driver_data<mac_state>(); switch (val) { @@ -763,11 +754,11 @@ static void keyboard_receive(running_machine &machine, int val) if (LOG_KEYBOARD) logerror("keyboard command : inquiry\n"); - mac->m_keyboard_reply = scan_keyboard(machine); - if (mac->m_keyboard_reply == 0x7B) + m_keyboard_reply = scan_keyboard(); + if (m_keyboard_reply == 0x7B) { /* if NULL, wait until key pressed or timeout */ - mac->m_inquiry_timeout->adjust( + m_inquiry_timeout->adjust( attotime(0, DOUBLE_TO_ATTOSECONDS(0.25)), 0); } break; @@ -777,7 +768,7 @@ static void keyboard_receive(running_machine &machine, int val) if (LOG_KEYBOARD) logerror("keyboard command : instant\n"); - kbd_shift_out(machine, scan_keyboard(machine)); + kbd_shift_out(scan_keyboard()); break; case 0x16: @@ -791,11 +782,11 @@ static void keyboard_receive(running_machine &machine, int val) /* clear key matrix */ for (i=0; i<7; i++) { - mac->m_key_matrix[i] = 0; + m_key_matrix[i] = 0; } /* purge transmission buffer */ - mac->m_keycode_buf_index = 0; + m_keycode_buf_index = 0; } /* format : 1 if another device (-> keypad ?) connected | next device (-> keypad ?) number 1-8 @@ -807,7 +798,7 @@ static void keyboard_receive(running_machine &machine, int val) /* keypads : ??? : standard keypad (always available on Mac Plus) ??? */ - kbd_shift_out(machine, 0x17); /* probably wrong */ + kbd_shift_out(0x17); /* probably wrong */ break; case 0x36: @@ -815,14 +806,14 @@ static void keyboard_receive(running_machine &machine, int val) if (LOG_KEYBOARD) logerror("keyboard command : test\n"); - kbd_shift_out(machine, 0x7D); /* ACK */ + kbd_shift_out(0x7D); /* ACK */ break; default: if (LOG_KEYBOARD) logerror("unknown keyboard command 0x%X\n", val); - kbd_shift_out(machine, 0); + kbd_shift_out(0); break; } } @@ -835,7 +826,6 @@ void mac_state::mouse_callback() { int new_mx, new_my; int x_needs_update = 0, y_needs_update = 0; - mac_state *mac = machine().driver_data<mac_state>(); new_mx = m_mouse1->read(); new_my = m_mouse2->read(); @@ -877,12 +867,12 @@ void mac_state::mouse_callback() if (count_x < 0) { count_x++; - mac->m_mouse_bit_x = 0; + m_mouse_bit_x = 0; } else { count_x--; - mac->m_mouse_bit_x = 1; + m_mouse_bit_x = 1; } x_needs_update = 1; } @@ -891,19 +881,19 @@ void mac_state::mouse_callback() if (count_y < 0) { count_y++; - mac->m_mouse_bit_y = 1; + m_mouse_bit_y = 1; } else { count_y--; - mac->m_mouse_bit_y = 0; + m_mouse_bit_y = 0; } y_needs_update = 1; } if (x_needs_update || y_needs_update) /* assert Port B External Interrupt on the SCC */ - mac->scc_mouse_irq(x_needs_update, y_needs_update ); + scc_mouse_irq(x_needs_update, y_needs_update ); } /* ************************************************************************* @@ -2033,52 +2023,51 @@ READ32_MEMBER(mac_state::mac_read_id) } } -static void mac_driver_init(running_machine &machine, model_t model) +void mac_state::mac_driver_init(model_t model) { - mac_state *mac = machine.driver_data<mac_state>(); - mac->m_overlay = 1; - mac->m_scsi_interrupt = 0; - mac->m_model = model; + m_overlay = 1; + m_scsi_interrupt = 0; + m_model = model; if (model < MODEL_MAC_PORTABLE) { /* set up RAM mirror at 0x600000-0x6fffff (0x7fffff ???) */ - mac_install_memory(machine, 0x600000, 0x6fffff, mac->m_ram->size(), mac->m_ram->pointer(), FALSE, "bank2"); + mac_install_memory(0x600000, 0x6fffff, m_ram->size(), m_ram->pointer(), FALSE, "bank2"); /* set up ROM at 0x400000-0x43ffff (-0x5fffff for mac 128k/512k/512ke) */ - mac_install_memory(machine, 0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff, - machine.root_device().memregion("bootrom")->bytes(), machine.root_device().memregion("bootrom")->base(), TRUE, "bank3"); + mac_install_memory(0x400000, (model >= MODEL_MAC_PLUS) ? 0x43ffff : 0x5fffff, + machine().root_device().memregion("bootrom")->bytes(), machine().root_device().memregion("bootrom")->base(), TRUE, "bank3"); } - mac->m_overlay = -1; - if (mac->m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC + m_overlay = -1; + if (m_model < MODEL_MAC_POWERMAC_6100) // no overlay for PowerPC { - mac->set_memory_overlay(1); + set_memory_overlay(1); } - memset(mac->m_ram->pointer(), 0, mac->m_ram->size()); + memset(m_ram->pointer(), 0, m_ram->size()); if ((model == MODEL_MAC_SE) || (model == MODEL_MAC_CLASSIC) || (model == MODEL_MAC_CLASSIC_II) || (model == MODEL_MAC_LC) || (model == MODEL_MAC_COLOR_CLASSIC) || (model >= MODEL_MAC_LC_475 && model <= MODEL_MAC_LC_580) || - (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((mac->m_model >= MODEL_MAC_II) && (mac->m_model <= MODEL_MAC_SE30)) || + (model == MODEL_MAC_LC_II) || (model == MODEL_MAC_LC_III) || (model == MODEL_MAC_LC_III_PLUS) || ((m_model >= MODEL_MAC_II) && (m_model <= MODEL_MAC_SE30)) || (model == MODEL_MAC_PORTABLE) || (model == MODEL_MAC_PB100) || (model == MODEL_MAC_PB140) || (model == MODEL_MAC_PB160) || (model == MODEL_MAC_PBDUO_210) || (model >= MODEL_MAC_QUADRA_700 && model <= MODEL_MAC_QUADRA_800)) { - mac->m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mac_state::overlay_opbaseoverride), mac)); + m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(mac_state::overlay_opbaseoverride), this)); } /* setup keyboard */ - keyboard_init(mac); + keyboard_init(); - mac->m_inquiry_timeout = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::inquiry_timeout_func),mac)); + m_inquiry_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mac_state::inquiry_timeout_func),this)); /* save state stuff */ - machine.save().register_postload(save_prepost_delegate(FUNC(mac_state::mac_state_load), mac)); + machine().save().register_postload(save_prepost_delegate(FUNC(mac_state::mac_state_load), this)); } #define MAC_DRIVER_INIT(label, model) \ DRIVER_INIT_MEMBER(mac_state,label) \ { \ - mac_driver_init(machine(), model ); \ + mac_driver_init(model); \ } MAC_DRIVER_INIT(mac128k512k, MODEL_MAC_128K512K) @@ -2115,11 +2104,10 @@ MAC_DRIVER_INIT(maclc520, MODEL_MAC_LC_520) void mac_state::nubus_slot_interrupt(UINT8 slot, UINT32 state) { static const UINT8 masks[8] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80 }; - mac_state *mac = machine().driver_data<mac_state>(); UINT8 mask = 0x3f; // quadra 700/900/950 use the top 2 bits of the interrupt register for ethernet and video - if ((mac->m_model == MODEL_MAC_QUADRA_700) || (mac->m_model == MODEL_MAC_QUADRA_900) || (mac->m_model == MODEL_MAC_QUADRA_950)) + if ((m_model == MODEL_MAC_QUADRA_700) || (m_model == MODEL_MAC_QUADRA_900) || (m_model == MODEL_MAC_QUADRA_950)) { mask = 0xff; } @@ -2128,16 +2116,16 @@ void mac_state::nubus_slot_interrupt(UINT8 slot, UINT32 state) if (state) { - mac->m_nubus_irq_state &= ~masks[slot]; + m_nubus_irq_state &= ~masks[slot]; } else { - mac->m_nubus_irq_state |= masks[slot]; + m_nubus_irq_state |= masks[slot]; } - if ((mac->m_model != MODEL_MAC_IIFX) && (mac->m_model != MODEL_MAC_IICI) && (mac->m_model != MODEL_MAC_IISI)) + if ((m_model != MODEL_MAC_IIFX) && (m_model != MODEL_MAC_IICI) && (m_model != MODEL_MAC_IISI)) { - if ((mac->m_nubus_irq_state & mask) != mask) + if ((m_nubus_irq_state & mask) != mask) { // HACK: sometimes we miss an ack (possible misbehavior in the VIA?) if (m_via2->read_ca1() == 0) @@ -2152,11 +2140,11 @@ void mac_state::nubus_slot_interrupt(UINT8 slot, UINT32 state) } } - if ((mac->m_model == MODEL_MAC_IICI) || (mac->m_model == MODEL_MAC_IISI) || (mac->m_model == MODEL_MAC_IIVX) || (mac->m_model == MODEL_MAC_IIVI)) + if ((m_model == MODEL_MAC_IICI) || (m_model == MODEL_MAC_IISI) || (m_model == MODEL_MAC_IIVX) || (m_model == MODEL_MAC_IIVI)) { - mac->m_rbv_regs[2] &= ~0x38; - mac->m_rbv_regs[2] |= (mac->m_nubus_irq_state & 0x38); - mac->rbv_recalc_irqs(); + m_rbv_regs[2] &= ~0x38; + m_rbv_regs[2] |= (m_nubus_irq_state & 0x38); + rbv_recalc_irqs(); } } @@ -2171,7 +2159,7 @@ void mac_state::vblank_irq() /* handle keyboard */ if (m_kbd_comm == TRUE) { - int keycode = scan_keyboard(machine()); + int keycode = scan_keyboard(); if (keycode != 0x7B) { @@ -2180,7 +2168,7 @@ void mac_state::vblank_irq() logerror("keyboard enquiry successful, keycode %X\n", keycode); m_inquiry_timeout->reset(); - kbd_shift_out(machine(), keycode); + kbd_shift_out(keycode); } } @@ -2284,7 +2272,7 @@ WRITE_LINE_MEMBER(mac_state::nubus_irq_e_w) * This is debug code that will output diagnostics regarding OS traps called * *************************************************************************/ -static const char *lookup_trap(UINT16 opcode) +const char *lookup_trap(UINT16 opcode) { static const struct { @@ -3126,7 +3114,7 @@ static offs_t mac_dasm_override(device_t &device, char *buffer, offs_t pc, const #ifdef MAC_TRACETRAP -static void mac_tracetrap(const char *cpu_name_local, int addr, int trap) +void mac_state::mac_tracetrap(const char *cpu_name_local, int addr, int trap) { struct sonycscodeentry { diff --git a/src/mess/machine/macpci.c b/src/mess/machine/macpci.c index a43e0c1794a..86f92024bac 100644 --- a/src/mess/machine/macpci.c +++ b/src/mess/machine/macpci.c @@ -146,19 +146,17 @@ WRITE_LINE_MEMBER(macpci_state::cuda_adb_linechange_w) { } -static void mac_driver_init(running_machine &machine, model_t model) +void macpci_state::mac_driver_init(model_t model) { - macpci_state *mac = machine.driver_data<macpci_state>(); + m_model = model; - mac->m_model = model; - - memset(mac->m_ram->pointer(), 0, mac->m_ram->size()); + memset(m_ram->pointer(), 0, m_ram->size()); } #define MAC_DRIVER_INIT(label, model) \ DRIVER_INIT_MEMBER(macpci_state,label) \ { \ - mac_driver_init(machine(), model ); \ + mac_driver_init(model ); \ } MAC_DRIVER_INIT(pippin, PCIMODEL_MAC_PIPPIN) diff --git a/src/mess/machine/mbc55x.c b/src/mess/machine/mbc55x.c index 599c1cab668..df26867358b 100644 --- a/src/mess/machine/mbc55x.c +++ b/src/mess/machine/mbc55x.c @@ -207,21 +207,19 @@ WRITE_LINE_MEMBER( mbc55x_state::mbc55x_fdc_drq_w ) */ -static void keyboard_reset(running_machine &machine) +void mbc55x_state::keyboard_reset() { - mbc55x_state *state = machine.driver_data<mbc55x_state>(); logerror("keyboard_reset()\n"); - memset(state->m_keyboard.keyrows,0xFF,MBC55X_KEYROWS); - state->m_keyboard.key_special=0; + memset(m_keyboard.keyrows,0xFF,MBC55X_KEYROWS); + m_keyboard.key_special=0; // Setup timer to scan keyboard. - state->m_keyboard.keyscan_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); + m_keyboard.keyscan_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); } -static void scan_keyboard(running_machine &machine) +void mbc55x_state::scan_keyboard() { - mbc55x_state *state = machine.driver_data<mbc55x_state>(); UINT8 keyrow; UINT8 row; UINT8 bitno; @@ -260,33 +258,33 @@ static void scan_keyboard(running_machine &machine) // First read shift, control and graph - state->m_keyboard.key_special = machine.root_device().ioport(KEY_SPECIAL_TAG)->read(); + m_keyboard.key_special = machine().root_device().ioport(KEY_SPECIAL_TAG)->read(); for(row=0; row<MBC55X_KEYROWS; row++) { - keyrow = machine.root_device().ioport(keynames[row])->read(); + keyrow = machine().root_device().ioport(keynames[row])->read(); for(mask=0x80, bitno=7;mask>0;mask=mask>>1, bitno-=1) { - if(!(keyrow & mask) && (state->m_keyboard.keyrows[row] & mask)) + if(!(keyrow & mask) && (m_keyboard.keyrows[row] & mask)) { - if(state->m_keyboard.key_special & (KEY_BIT_LSHIFT | KEY_BIT_RSHIFT)) + if(m_keyboard.key_special & (KEY_BIT_LSHIFT | KEY_BIT_RSHIFT)) key=keyvalues_shift[row][bitno]; else key=keyvalues_normal[row][bitno]; if (LOG_KEYBOARD) logerror("keypress %c\n",key); - state->m_kb_uart->receive_character(key); + m_kb_uart->receive_character(key); } } - state->m_keyboard.keyrows[row]=keyrow; + m_keyboard.keyrows[row]=keyrow; } } TIMER_CALLBACK_MEMBER(mbc55x_state::keyscan_callback) { - scan_keyboard(machine()); + scan_keyboard(); } /* i8251 serial */ @@ -335,15 +333,14 @@ WRITE8_MEMBER(mbc55x_state::mbc55x_kb_usart_w) } } -static void set_ram_size(running_machine &machine) +void mbc55x_state::set_ram_size() { - mbc55x_state *state = machine.driver_data<mbc55x_state>(); - address_space &space = state->m_maincpu->space( AS_PROGRAM ); - int ramsize = state->m_ram->size(); + address_space &space = m_maincpu->space( AS_PROGRAM ); + int ramsize = m_ram->size(); int nobanks = ramsize / RAM_BANK_SIZE; char bank[10]; int bankno; - UINT8 *ram = &state->m_ram->pointer()[0]; + UINT8 *ram = &m_ram->pointer()[0]; UINT8 *map_base; int bank_base; @@ -361,7 +358,7 @@ static void set_ram_size(running_machine &machine) if(bankno<nobanks) { - state->membank(bank)->set_base(map_base); + membank(bank)->set_base(map_base); space.install_readwrite_bank(bank_base, bank_base+(RAM_BANK_SIZE-1), bank); logerror("Mapping bank %d at %05X to RAM\n",bankno,bank_base); } @@ -373,9 +370,9 @@ static void set_ram_size(running_machine &machine) } // Graphics red and blue plane memory mapping, green is in main memory - state->membank(RED_PLANE_TAG)->set_base(&state->m_video_mem[RED_PLANE_OFFSET]); + membank(RED_PLANE_TAG)->set_base(&m_video_mem[RED_PLANE_OFFSET]); space.install_readwrite_bank(RED_PLANE_MEMBASE, RED_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), RED_PLANE_TAG); - state->membank(BLUE_PLANE_TAG)->set_base(&state->m_video_mem[BLUE_PLANE_OFFSET]); + membank(BLUE_PLANE_TAG)->set_base(&m_video_mem[BLUE_PLANE_OFFSET]); space.install_readwrite_bank(BLUE_PLANE_MEMBASE, BLUE_PLANE_MEMBASE+(COLOUR_PLANE_SIZE-1), BLUE_PLANE_TAG); } @@ -385,15 +382,15 @@ DRIVER_INIT_MEMBER(mbc55x_state,mbc55x) void mbc55x_state::machine_reset() { - set_ram_size(machine()); - keyboard_reset(machine()); + set_ram_size(); + keyboard_reset(); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(mbc55x_state::mbc55x_irq_callback),this)); } void mbc55x_state::machine_start() { /* init cpu */ -// mbc55x_cpu_init(machine()); +// mbc55x_cpu_init(); /* setup debug commands */ diff --git a/src/mess/machine/microtan.c b/src/mess/machine/microtan.c index 18e719118f7..c1f7948ea25 100644 --- a/src/mess/machine/microtan.c +++ b/src/mess/machine/microtan.c @@ -127,14 +127,14 @@ static const char keyboard[8][9][8] = { }, }; -static UINT8 read_dsw(running_machine &machine) +UINT8 microtan_state::read_dsw() { UINT8 result; - switch(machine.phase()) + switch(machine().phase()) { case MACHINE_PHASE_RESET: case MACHINE_PHASE_RUNNING: - result = machine.root_device().ioport("DSW")->read(); + result = machine().root_device().ioport("DSW")->read(); break; default: @@ -144,13 +144,12 @@ static UINT8 read_dsw(running_machine &machine) return result; } -static void microtan_set_irq_line(running_machine &machine) +void microtan_state::microtan_set_irq_line() { - microtan_state *state = machine.driver_data<microtan_state>(); /* The 6502 IRQ line is active low and probably driven by open collector outputs (guess). Since MAME/MESS use a non-0 value for ASSERT_LINE we OR the signals here */ - state->m_maincpu->set_input_line(0, state->m_via_0_irq_line | state->m_via_1_irq_line | state->m_kbd_irq_line); + m_maincpu->set_input_line(0, m_via_0_irq_line | m_via_1_irq_line | m_kbd_irq_line); } /************************************************************** @@ -224,7 +223,7 @@ WRITE_LINE_MEMBER(microtan_state::via_0_irq) { LOG(("microtan_via_0_irq %d\n", state)); m_via_0_irq_line = state; - microtan_set_irq_line(machine()); + microtan_set_irq_line(); } /************************************************************** @@ -296,7 +295,7 @@ WRITE_LINE_MEMBER(microtan_state::via_1_irq) { LOG(("microtan_via_1_irq %d\n", state)); m_via_1_irq_line = state; - microtan_set_irq_line(machine()); + microtan_set_irq_line(); } /************************************************************** @@ -389,7 +388,7 @@ WRITE8_MEMBER(microtan_state::microtan_bffx_w) LOG(("microtan_bff0_w: %d <- %02x (keyboard IRQ clear )\n", offset, data)); m_keyboard_ascii &= ~0x80; m_kbd_irq_line = CLEAR_LINE; - microtan_set_irq_line(machine()); + microtan_set_irq_line(); break; case 1: /* BFF1: write delayed NMI */ LOG(("microtan_bff1_w: %d <- %02x (delayed NMI)\n", offset, data)); @@ -405,13 +404,12 @@ WRITE8_MEMBER(microtan_state::microtan_bffx_w) } } -static void store_key(running_machine &machine, int key) +void microtan_state::store_key(int key) { - microtan_state *state = machine.driver_data<microtan_state>(); LOG(("microtan: store key '%c'\n", key)); - state->m_keyboard_ascii = key | 0x80; - state->m_kbd_irq_line = ASSERT_LINE; - microtan_set_irq_line(machine); + m_keyboard_ascii = key | 0x80; + m_kbd_irq_line = ASSERT_LINE; + microtan_set_irq_line(); } INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) @@ -483,11 +481,11 @@ INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) if( m_key ) /* normal key */ { m_repeater = 30; - store_key(machine(), m_key); + store_key(m_key); } else if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */ - store_key(machine(), 0); + store_key(0); m_keyrows[row] |= newvar; } else @@ -499,7 +497,7 @@ INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) else if ( m_key && (m_keyrows[m_lastrow] & m_mask) && m_repeat == 0 ) { - store_key(machine(), m_key); + store_key(m_key); } } @@ -545,7 +543,7 @@ DRIVER_INIT_MEMBER(microtan_state,microtan) dst += 4; } - switch (read_dsw(machine()) & 3) + switch (read_dsw() & 3) { case 0: // 1K only :) space.nop_readwrite(0x0400, 0xbbff); @@ -574,7 +572,7 @@ void microtan_state::machine_reset() set_led_status(machine(), 1, (m_keyrows[3] & 0x80) ? 0 : 1); } -static int microtan_verify_snapshot(UINT8 *data, int size) +int microtan_state::microtan_verify_snapshot(UINT8 *data, int size) { if (size == 8263) { @@ -593,7 +591,7 @@ static int microtan_verify_snapshot(UINT8 *data, int size) return IMAGE_VERIFY_FAIL; } -static int parse_intel_hex(UINT8 *snapshot_buff, char *src) +int microtan_state::parse_intel_hex(UINT8 *snapshot_buff, char *src) { char line[128]; int /*row = 0,*/ column = 0, last_addr = 0, last_size = 0; @@ -674,7 +672,7 @@ static int parse_intel_hex(UINT8 *snapshot_buff, char *src) return IMAGE_INIT_PASS; } -static int parse_zillion_hex(UINT8 *snapshot_buff, char *src) +int microtan_state::parse_zillion_hex(UINT8 *snapshot_buff, char *src) { char line[128]; int parsing = 0, /*row = 0,*/ column = 0; @@ -757,28 +755,26 @@ static int parse_zillion_hex(UINT8 *snapshot_buff, char *src) return IMAGE_INIT_PASS; } -static void microtan_set_cpu_regs(running_machine &machine,const UINT8 *snapshot_buff, int base) +void microtan_state::microtan_set_cpu_regs(const UINT8 *snapshot_buff, int base) { - microtan_state *state = machine.driver_data<microtan_state>(); logerror("microtan_snapshot_copy: PC:%02X%02X P:%02X A:%02X X:%02X Y:%02X SP:1%02X", snapshot_buff[base+1], snapshot_buff[base+0], snapshot_buff[base+2], snapshot_buff[base+3], snapshot_buff[base+4], snapshot_buff[base+5], snapshot_buff[base+6]); - state->m_maincpu->set_state_int(M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]); - state->m_maincpu->set_state_int(M6502_P, snapshot_buff[base+2]); - state->m_maincpu->set_state_int(M6502_A, snapshot_buff[base+3]); - state->m_maincpu->set_state_int(M6502_X, snapshot_buff[base+4]); - state->m_maincpu->set_state_int(M6502_Y, snapshot_buff[base+5]); - state->m_maincpu->set_state_int(M6502_S, snapshot_buff[base+6]); + m_maincpu->set_state_int(M6502_PC, snapshot_buff[base+0] + 256 * snapshot_buff[base+1]); + m_maincpu->set_state_int(M6502_P, snapshot_buff[base+2]); + m_maincpu->set_state_int(M6502_A, snapshot_buff[base+3]); + m_maincpu->set_state_int(M6502_X, snapshot_buff[base+4]); + m_maincpu->set_state_int(M6502_Y, snapshot_buff[base+5]); + m_maincpu->set_state_int(M6502_S, snapshot_buff[base+6]); } -static void microtan_snapshot_copy(running_machine &machine, UINT8 *snapshot_buff, int snapshot_size) +void microtan_state::microtan_snapshot_copy(UINT8 *snapshot_buff, int snapshot_size) { - microtan_state *state = machine.driver_data<microtan_state>(); - UINT8 *RAM = state->memregion("maincpu")->base(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - via6522_device *via_0 = machine.device<via6522_device>("via6522_0"); - via6522_device *via_1 = machine.device<via6522_device>("via6522_1"); - device_t *ay8910 = machine.device("ay8910.1"); + UINT8 *RAM = memregion("maincpu")->base(); + address_space &space = m_maincpu->space(AS_PROGRAM); + via6522_device *via_0 = machine().device<via6522_device>("via6522_0"); + via6522_device *via_1 = machine().device<via6522_device>("via6522_1"); + device_t *ay8910 = machine().device("ay8910.1"); /* check for .DMP file format */ if (snapshot_size == 8263) @@ -798,10 +794,10 @@ static void microtan_snapshot_copy(running_machine &machine, UINT8 *snapshot_buf /* 64 bytes of chunky graphics info */ for (i = 0; i < 32*16; i++) { - state->m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; + m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; } base += 64; - microtan_set_cpu_regs(machine, snapshot_buff, base); + microtan_set_cpu_regs(snapshot_buff, base); } else { @@ -845,53 +841,55 @@ static void microtan_snapshot_copy(running_machine &machine, UINT8 *snapshot_buf { RAM[0xbff0+i] = snapshot_buff[base++]; if (i < 4) - state->microtan_bffx_w(space, i, RAM[0xbff0+i]); + microtan_bffx_w(space, i, RAM[0xbff0+i]); } - state->microtan_sound_w(space, 0, snapshot_buff[base++]); - state->m_chunky_graphics = snapshot_buff[base++]; + microtan_sound_w(space, 0, snapshot_buff[base++]); + m_chunky_graphics = snapshot_buff[base++]; /* first set of AY8910 registers */ for (i = 0; i < 16; i++ ) { - ay8910_address_w(ay8910, state->generic_space(), 0, i); - ay8910_data_w(ay8910, state->generic_space(), 0, snapshot_buff[base++]); + ay8910_address_w(ay8910, generic_space(), 0, i); + ay8910_data_w(ay8910, generic_space(), 0, snapshot_buff[base++]); } /* second set of AY8910 registers */ for (i = 0; i < 16; i++ ) { - ay8910_address_w(ay8910, state->generic_space(), 0, i); - ay8910_data_w(ay8910, state->generic_space(), 0, snapshot_buff[base++]); + ay8910_address_w(ay8910, generic_space(), 0, i); + ay8910_data_w(ay8910, generic_space(), 0, snapshot_buff[base++]); } for (i = 0; i < 32*16; i++) { - state->m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; + m_chunky_buffer[i] = (snapshot_buff[base+i/8] >> (i&7)) & 1; } base += 64; - microtan_set_cpu_regs(machine, snapshot_buff, base); + microtan_set_cpu_regs(snapshot_buff, base); } } SNAPSHOT_LOAD( microtan ) { + microtan_state *state = image.device().machine().driver_data<microtan_state>(); UINT8 *snapshot_buff; snapshot_buff = (UINT8*)image.ptr(); if (!snapshot_buff) return IMAGE_INIT_FAIL; - if (microtan_verify_snapshot(snapshot_buff, snapshot_size)==IMAGE_VERIFY_FAIL) + if (state->microtan_verify_snapshot(snapshot_buff, snapshot_size)==IMAGE_VERIFY_FAIL) return IMAGE_INIT_FAIL; - microtan_snapshot_copy(image.device().machine(), snapshot_buff, snapshot_size); + state->microtan_snapshot_copy(snapshot_buff, snapshot_size); return IMAGE_INIT_PASS; } QUICKLOAD_LOAD( microtan ) { + microtan_state *state = image.device().machine().driver_data<microtan_state>(); int snapshot_size; UINT8 *snapshot_buff; char *buff; @@ -918,11 +916,11 @@ QUICKLOAD_LOAD( microtan ) buff[quickload_size] = '\0'; if (buff[0] == ':') - rc = parse_intel_hex(snapshot_buff, buff); + rc = state->parse_intel_hex(snapshot_buff, buff); else - rc = parse_zillion_hex(snapshot_buff, buff); + rc = state->parse_zillion_hex(snapshot_buff, buff); if (rc == IMAGE_INIT_PASS) - microtan_snapshot_copy(image.device().machine(), snapshot_buff, snapshot_size); + state->microtan_snapshot_copy(snapshot_buff, snapshot_size); free(snapshot_buff); return rc; } diff --git a/src/mess/machine/mtx.c b/src/mess/machine/mtx.c index f06b98242e9..0485d7506de 100644 --- a/src/mess/machine/mtx.c +++ b/src/mess/machine/mtx.c @@ -57,7 +57,7 @@ READ8_MEMBER(mtx_state::mtx_strobe_r) by RAM in this mode. */ -static void bankswitch(running_machine &machine, UINT8 data) +void mtx_state::bankswitch(UINT8 data) { /* @@ -73,16 +73,15 @@ static void bankswitch(running_machine &machine, UINT8 data) 7 RELCPMH */ - mtx_state *state = machine.driver_data<mtx_state>(); - address_space &program = state->m_maincpu->space(AS_PROGRAM); - ram_device *messram = machine.device<ram_device>(RAM_TAG); + address_space &program = m_maincpu->space(AS_PROGRAM); + ram_device *messram = machine().device<ram_device>(RAM_TAG); // UINT8 cbm_mode = data >> 7 & 0x01; UINT8 rom_page = data >> 4 & 0x07; UINT8 ram_page = data >> 0 & 0x0f; /* set rom bank (switches between basic and assembler rom or cartridges) */ - state->membank("bank2")->set_entry(rom_page); + membank("bank2")->set_entry(rom_page); /* set ram bank, for invalid pages a nop-handler will be installed */ if (ram_page >= messram->size()/0x8000) @@ -94,20 +93,20 @@ static void bankswitch(running_machine &machine, UINT8 data) { program.nop_readwrite(0x4000, 0x7fff); program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - state->membank("bank4")->set_entry(ram_page); + membank("bank4")->set_entry(ram_page); } else { program.install_readwrite_bank(0x4000, 0x7fff, "bank3"); program.install_readwrite_bank(0x8000, 0xbfff, "bank4"); - state->membank("bank3")->set_entry(ram_page); - state->membank("bank4")->set_entry(ram_page); + membank("bank3")->set_entry(ram_page); + membank("bank4")->set_entry(ram_page); } } WRITE8_MEMBER(mtx_state::mtx_bankswitch_w) { - bankswitch(machine(), data); + bankswitch(data); } /*------------------------------------------------- @@ -387,5 +386,5 @@ MACHINE_START_MEMBER(mtx_state,mtx512) MACHINE_RESET_MEMBER(mtx_state,mtx512) { /* bank switching */ - bankswitch(machine(), 0); + bankswitch(0); } diff --git a/src/mess/machine/nc.c b/src/mess/machine/nc.c index 8c85d3892d0..7933259b453 100644 --- a/src/mess/machine/nc.c +++ b/src/mess/machine/nc.c @@ -16,23 +16,22 @@ /* stores size of actual file on filesystem */ /* save card data back */ -static void nc_card_save(device_image_interface &image) +void nc_state::nc_card_save(device_image_interface &image) { - nc_state *state = image.device().machine().driver_data<nc_state>(); /* if there is no data to write, quit */ - if (!state->m_card_ram || !state->m_card_size) + if (!m_card_ram || !m_card_size) return; logerror("attempting card save\n"); /* write data */ - image.fwrite(state->m_card_ram, state->m_card_size); + image.fwrite(m_card_ram, m_card_size); logerror("write succeeded!\r\n"); } /* this mask will prevent overwrites from end of data */ -static int nc_card_calculate_mask(int size) +int nc_state::nc_card_calculate_mask(int size) { int i; @@ -52,9 +51,8 @@ static int nc_card_calculate_mask(int size) /* load card image */ -static int nc_card_load(device_image_interface &image, unsigned char **ptr) +int nc_state::nc_card_load(device_image_interface &image, unsigned char **ptr) { - nc_state *state = image.device().machine().driver_data<nc_state>(); int datasize; unsigned char *data; @@ -68,7 +66,7 @@ static int nc_card_load(device_image_interface &image, unsigned char **ptr) if (data!=NULL) { - state->m_card_size = datasize; + m_card_size = datasize; /* read whole file */ image.fread(data, datasize); @@ -77,9 +75,9 @@ static int nc_card_load(device_image_interface &image, unsigned char **ptr) logerror("File loaded!\r\n"); - state->m_membank_card_ram_mask = nc_card_calculate_mask(datasize); + m_membank_card_ram_mask = nc_card_calculate_mask(datasize); - logerror("Mask: %02x\n",state->m_membank_card_ram_mask); + logerror("Mask: %02x\n",m_membank_card_ram_mask); /* ok! */ return 1; @@ -93,7 +91,7 @@ static int nc_card_load(device_image_interface &image, unsigned char **ptr) DRIVER_INIT_MEMBER( nc_state, nc ) { /* card not present */ - nc_set_card_present_state(machine(), 0); + nc_set_card_present_state(0); /* card ram NULL */ m_card_ram = NULL; m_card_size = 0; @@ -113,7 +111,7 @@ DEVICE_IMAGE_LOAD_MEMBER( nc_state, nc_pcmcia_card ) /* card present! */ if (m_membank_card_ram_mask!=0) { - nc_set_card_present_state(machine(), 1); + nc_set_card_present_state(1); } return IMAGE_INIT_PASS; } @@ -138,5 +136,5 @@ DEVICE_IMAGE_UNLOAD_MEMBER( nc_state, nc_pcmcia_card ) m_card_size = 0; /* set card not present state */ - nc_set_card_present_state(machine(), 0); + nc_set_card_present_state(0); } diff --git a/src/mess/machine/oric.c b/src/mess/machine/oric.c index ce5c4fde484..9481df67533 100644 --- a/src/mess/machine/oric.c +++ b/src/mess/machine/oric.c @@ -1342,14 +1342,13 @@ const via6522_interface telestrat_via2_interface= #if 0 /* interrupt state from acia6551 */ -static void telestrat_acia_callback(running_machine &machine, int irq_state) +void oric_state::telestrat_acia_callback(int irq_state) { - oric_state *state = machine.driver_data<oric_state>(); - state->m_irqs&=~(1<<3); + m_irqs&=~(1<<3); if (irq_state) { - state->m_irqs |= (1<<3); + m_irqs |= (1<<3); } oric_refresh_ints(); diff --git a/src/mess/machine/partner.c b/src/mess/machine/partner.c index 632f13a27d6..0a1edd6aa76 100644 --- a/src/mess/machine/partner.c +++ b/src/mess/machine/partner.c @@ -47,35 +47,33 @@ MACHINE_START_MEMBER(partner_state,partner) wd17xx_set_pause_time(fdc, 10); } -static void partner_window_1(running_machine &machine, UINT8 bank_num, UINT16 offset,UINT8 *rom) +void partner_state::partner_window_1(UINT8 bank_num, UINT16 offset,UINT8 *rom) { - partner_state *state = machine.driver_data<partner_state>(); char bank[10]; sprintf(bank,"bank%d",bank_num); - switch(state->m_win_mem_page) { + switch(m_win_mem_page) { case 2 : // FDD BIOS - state->membank(bank)->set_base(rom + 0x16000 + offset); + membank(bank)->set_base(rom + 0x16000 + offset); break; case 4 : // MCPG BIOS - state->membank(bank)->set_base(rom + 0x14000 + offset); + membank(bank)->set_base(rom + 0x14000 + offset); break; default : // BIOS - state->membank(bank)->set_base(rom + 0x10000 + offset); + membank(bank)->set_base(rom + 0x10000 + offset); break; } } -static void partner_window_2(running_machine &machine, UINT8 bank_num, UINT16 offset,UINT8 *rom) +void partner_state::partner_window_2(UINT8 bank_num, UINT16 offset,UINT8 *rom) { - partner_state *state = machine.driver_data<partner_state>(); char bank[10]; sprintf(bank,"bank%d",bank_num); - switch(state->m_win_mem_page) { + switch(m_win_mem_page) { case 4 : // MCPG FONT - state->membank(bank)->set_base(rom + 0x18000 + offset); + membank(bank)->set_base(rom + 0x18000 + offset); break; default : // BIOS - state->membank(bank)->set_base(rom + 0x10000 + offset); + membank(bank)->set_base(rom + 0x10000 + offset); break; } } @@ -123,30 +121,28 @@ WRITE8_MEMBER(partner_state::partner_floppy_w){ } } -static void partner_iomap_bank(running_machine &machine,UINT8 *rom) +void partner_state::partner_iomap_bank(UINT8 *rom) { - partner_state *state = machine.driver_data<partner_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - switch(state->m_win_mem_page) { + address_space &space = m_maincpu->space(AS_PROGRAM); + switch(m_win_mem_page) { case 2 : // FDD - space.install_write_handler(0xdc00, 0xddff, write8_delegate(FUNC(partner_state::partner_floppy_w),state)); - space.install_read_handler (0xdc00, 0xddff, read8_delegate(FUNC(partner_state::partner_floppy_r),state)); + space.install_write_handler(0xdc00, 0xddff, write8_delegate(FUNC(partner_state::partner_floppy_w),this)); + space.install_read_handler (0xdc00, 0xddff, read8_delegate(FUNC(partner_state::partner_floppy_r),this)); break; case 4 : // Timer break; default : // BIOS - state->membank("bank11")->set_base(rom + 0x10000); + membank("bank11")->set_base(rom + 0x10000); break; } } -static void partner_bank_switch(running_machine &machine) +void partner_state::partner_bank_switch() { - partner_state *state = machine.driver_data<partner_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); - UINT8 *rom = state->memregion("maincpu")->base(); - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + address_space &space = m_maincpu->space(AS_PROGRAM); + UINT8 *rom = memregion("maincpu")->base(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); space.install_write_bank(0x0000, 0x07ff, "bank1"); space.install_write_bank(0x0800, 0x3fff, "bank2"); @@ -164,184 +160,184 @@ static void partner_bank_switch(running_machine &machine) space.unmap_write(0xe800, 0xffff); // BANK 1 (0x0000 - 0x07ff) - if (state->m_mem_page==0) { + if (m_mem_page==0) { space.unmap_write(0x0000, 0x07ff); - state->membank("bank1")->set_base(rom + 0x10000); + membank("bank1")->set_base(rom + 0x10000); } else { - if (state->m_mem_page==7) { - state->membank("bank1")->set_base(ram + 0x8000); + if (m_mem_page==7) { + membank("bank1")->set_base(ram + 0x8000); } else { - state->membank("bank1")->set_base(ram + 0x0000); + membank("bank1")->set_base(ram + 0x0000); } } // BANK 2 (0x0800 - 0x3fff) - if (state->m_mem_page==7) { - state->membank("bank2")->set_base(ram + 0x8800); + if (m_mem_page==7) { + membank("bank2")->set_base(ram + 0x8800); } else { - state->membank("bank2")->set_base(ram + 0x0800); + membank("bank2")->set_base(ram + 0x0800); } // BANK 3 (0x4000 - 0x5fff) - if (state->m_mem_page==7) { - state->membank("bank3")->set_base(ram + 0xC000); + if (m_mem_page==7) { + membank("bank3")->set_base(ram + 0xC000); } else { - if (state->m_mem_page==10) { + if (m_mem_page==10) { //window 1 space.unmap_write(0x4000, 0x5fff); - partner_window_1(machine, 3, 0, rom); + partner_window_1(3, 0, rom); } else { - state->membank("bank3")->set_base(ram + 0x4000); + membank("bank3")->set_base(ram + 0x4000); } } // BANK 4 (0x6000 - 0x7fff) - if (state->m_mem_page==7) { - state->membank("bank4")->set_base(ram + 0xe000); + if (m_mem_page==7) { + membank("bank4")->set_base(ram + 0xe000); } else { - state->membank("bank4")->set_base(ram + 0x6000); + membank("bank4")->set_base(ram + 0x6000); } // BANK 5 (0x8000 - 0x9fff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 5: case 10: //window 2 space.unmap_write(0x8000, 0x9fff); - partner_window_2(machine, 5, 0, rom); + partner_window_2(5, 0, rom); break; case 8: case 9: //window 1 space.unmap_write(0x8000, 0x9fff); - partner_window_1(machine, 5, 0, rom); + partner_window_1(5, 0, rom); break; case 7: - state->membank("bank5")->set_base(ram + 0x0000); + membank("bank5")->set_base(ram + 0x0000); break; default: - state->membank("bank5")->set_base(ram + 0x8000); + membank("bank5")->set_base(ram + 0x8000); break; } // BANK 6 (0xa000 - 0xb7ff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 5: case 10: //window 2 space.unmap_write(0xa000, 0xb7ff); - partner_window_2(machine, 6, 0, rom); + partner_window_2(6, 0, rom); break; case 6: case 8: //BASIC space.unmap_write(0xa000, 0xb7ff); - state->membank("bank6")->set_base(rom + 0x12000); // BASIC + membank("bank6")->set_base(rom + 0x12000); // BASIC break; case 7: - state->membank("bank6")->set_base(ram + 0x2000); + membank("bank6")->set_base(ram + 0x2000); break; default: - state->membank("bank6")->set_base(ram + 0xa000); + membank("bank6")->set_base(ram + 0xa000); break; } // BANK 7 (0xb800 - 0xbfff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 4: case 5: case 10: //window 2 space.unmap_write(0xb800, 0xbfff); - partner_window_2(machine, 7, 0x1800, rom); + partner_window_2(7, 0x1800, rom); break; case 6: case 8: //BASIC space.unmap_write(0xb800, 0xbfff); - state->membank("bank7")->set_base(rom + 0x13800); // BASIC + membank("bank7")->set_base(rom + 0x13800); // BASIC break; case 7: - state->membank("bank7")->set_base(ram + 0x3800); + membank("bank7")->set_base(ram + 0x3800); break; default: - state->membank("bank7")->set_base(ram + 0xb800); + membank("bank7")->set_base(ram + 0xb800); break; } // BANK 8 (0xc000 - 0xc7ff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 7: - state->membank("bank8")->set_base(ram + 0x4000); + membank("bank8")->set_base(ram + 0x4000); break; case 8: case 10: space.unmap_write(0xc000, 0xc7ff); - state->membank("bank8")->set_base(rom + 0x10000); + membank("bank8")->set_base(rom + 0x10000); break; default: - state->membank("bank8")->set_base(ram + 0xc000); + membank("bank8")->set_base(ram + 0xc000); break; } // BANK 9 (0xc800 - 0xcfff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 7: - state->membank("bank9")->set_base(ram + 0x4800); + membank("bank9")->set_base(ram + 0x4800); break; case 8: case 9: // window 2 space.unmap_write(0xc800, 0xcfff); - partner_window_2(machine, 9, 0, rom); + partner_window_2(9, 0, rom); break; case 10: space.unmap_write(0xc800, 0xcfff); - state->membank("bank9")->set_base(rom + 0x10800); + membank("bank9")->set_base(rom + 0x10800); break; default: - state->membank("bank9")->set_base(ram + 0xc800); + membank("bank9")->set_base(ram + 0xc800); break; } // BANK 10 (0xd000 - 0xd7ff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 7: - state->membank("bank10")->set_base(ram + 0x5000); + membank("bank10")->set_base(ram + 0x5000); break; case 8: case 9: // window 2 space.unmap_write(0xd000, 0xd7ff); - partner_window_2(machine, 10, 0x0800, rom); + partner_window_2(10, 0x0800, rom); break; default: - state->membank("bank10")->set_base(ram + 0xd000); + membank("bank10")->set_base(ram + 0xd000); break; } // BANK 11 (0xdc00 - 0xddff) - partner_iomap_bank(machine,rom); + partner_iomap_bank(rom); // BANK 12 (0xe000 - 0xe7ff) - if (state->m_mem_page==1) { - state->membank("bank12")->set_base(rom + 0x10000); + if (m_mem_page==1) { + membank("bank12")->set_base(rom + 0x10000); } else { //window 1 - partner_window_1(machine, 12, 0, rom); + partner_window_1(12, 0, rom); } // BANK 13 (0xe800 - 0xffff) - switch (state->m_mem_page) { + switch (m_mem_page) { case 3: case 4: case 5: // window 1 - partner_window_1(machine, 13, 0x800, rom); + partner_window_1(13, 0x800, rom); break; default: // BIOS - state->membank("bank13")->set_base(rom + 0x10800); + membank("bank13")->set_base(rom + 0x10800); break; } } @@ -349,13 +345,13 @@ static void partner_bank_switch(running_machine &machine) WRITE8_MEMBER(partner_state::partner_win_memory_page_w) { m_win_mem_page = ~data; - partner_bank_switch(machine()); + partner_bank_switch(); } WRITE8_MEMBER(partner_state::partner_mem_page_w) { m_mem_page = (data >> 4) & 0x0f; - partner_bank_switch(machine()); + partner_bank_switch(); } WRITE_LINE_MEMBER(partner_state::hrq_w) @@ -386,5 +382,5 @@ MACHINE_RESET_MEMBER(partner_state,partner) { m_mem_page = 0; m_win_mem_page = 0; - partner_bank_switch(machine()); + partner_bank_switch(); } diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c index a89a8a4bb3d..620ad58f8b0 100644 --- a/src/mess/machine/pc.c +++ b/src/mess/machine/pc.c @@ -342,26 +342,23 @@ const struct pic8259_interface pcjr_pic8259_config = * PC Speaker related * *************************************************************************/ -UINT8 pc_speaker_get_spk(running_machine &machine) +UINT8 pc_state::pc_speaker_get_spk() { - pc_state *st = machine.driver_data<pc_state>(); - return st->m_pc_spkrdata & st->m_pc_input; + return m_pc_spkrdata & m_pc_input; } -void pc_speaker_set_spkrdata(running_machine &machine, UINT8 data) +void pc_state::pc_speaker_set_spkrdata(UINT8 data) { - pc_state *st = machine.driver_data<pc_state>(); - st->m_pc_spkrdata = data ? 1 : 0; - speaker_level_w( st->m_speaker, pc_speaker_get_spk(machine) ); + m_pc_spkrdata = data ? 1 : 0; + speaker_level_w( m_speaker, pc_speaker_get_spk() ); } -void pc_speaker_set_input(running_machine &machine, UINT8 data) +void pc_state::pc_speaker_set_input(UINT8 data) { - pc_state *st = machine.driver_data<pc_state>(); - st->m_pc_input = data ? 1 : 0; - speaker_level_w( st->m_speaker, pc_speaker_get_spk(machine) ); + m_pc_input = data ? 1 : 0; + speaker_level_w( m_speaker, pc_speaker_get_spk() ); } @@ -385,7 +382,7 @@ WRITE_LINE_MEMBER(pc_state::ibm5150_pit8253_out1_changed) WRITE_LINE_MEMBER(pc_state::ibm5150_pit8253_out2_changed) { - pc_speaker_set_input( machine(), state ); + pc_speaker_set_input( state ); } @@ -662,7 +659,7 @@ static void pcjr_set_keyb_int(running_machine &machine, int state) } -static void pcjr_keyb_init(running_machine &machine) +void pc_state::pcjr_keyb_init() { pcjr_keyb.transferring = 0; pcjr_keyb.latch = 0; @@ -830,7 +827,7 @@ WRITE8_MEMBER(pc_state::ibm5160_ppi_portb_w) m_ppi_keyboard_clear = data & 0x80; m_ppi_keyb_clock = data & 0x40; pit8253_gate2_w(m_pit8253, BIT(data, 0)); - pc_speaker_set_spkrdata( machine(), data & 0x02 ); + pc_speaker_set_spkrdata( data & 0x02 ); m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); @@ -891,7 +888,7 @@ WRITE8_MEMBER(pc_state::pc_ppi_portb_w) m_ppi_keyboard_clear = data & 0x80; m_ppi_keyb_clock = data & 0x40; pit8253_gate2_w(m_pit8253, BIT(data, 0)); - pc_speaker_set_spkrdata( machine(), data & 0x02 ); + pc_speaker_set_spkrdata( data & 0x02 ); pc_keyb_set_clock( m_ppi_keyb_clock ); if ( m_ppi_keyboard_clear ) @@ -976,7 +973,7 @@ WRITE8_MEMBER(pc_state::mc1502_ppi_portb_w) // DBG_LOG(2,"mc1502_ppi_portb_w",("( %02X )\n", data)); m_ppi_portb = data; pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0)); - pc_speaker_set_spkrdata( machine(), data & 0x02 ); + pc_speaker_set_spkrdata( data & 0x02 ); } READ8_MEMBER(pc_state::mc1502_ppi_portc_r) @@ -1044,7 +1041,7 @@ WRITE8_MEMBER(pc_state::pcjr_ppi_portb_w) m_ppi_portb = data; m_ppi_portc_switch_high = data & 0x08; pit8253_gate2_w(machine().device("pit8253"), BIT(data, 0)); - pc_speaker_set_spkrdata( machine(), data & 0x02 ); + pc_speaker_set_spkrdata( data & 0x02 ); m_cassette->change_state(( data & 0x08 ) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); } @@ -1335,41 +1332,40 @@ READ8_MEMBER(pc_state::mc1502_wd17xx_motor_r) * **********************************************************/ -void mess_init_pc_common(running_machine &machine, UINT32 flags, void (*set_keyb_int_func)(running_machine &, int), void (*set_hdc_int_func)(running_machine &,int,int)) +void pc_state::mess_init_pc_common(UINT32 flags, void (*set_keyb_int_func)(running_machine &, int), void (*set_hdc_int_func)(running_machine &,int,int)) { - pc_state *state = machine.driver_data<pc_state>(); if ( set_keyb_int_func != NULL ) - init_pc_common(machine, flags, set_keyb_int_func); + init_pc_common(machine(), flags, set_keyb_int_func); /* MESS managed RAM */ - if ( machine.device<ram_device>(RAM_TAG)->pointer() ) - state->membank( "bank10" )->set_base( machine.device<ram_device>(RAM_TAG)->pointer() ); + if ( machine().device<ram_device>(RAM_TAG)->pointer() ) + membank( "bank10" )->set_base( machine().device<ram_device>(RAM_TAG)->pointer() ); } DRIVER_INIT_MEMBER(pc_state,ibm5150) { - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, NULL, pc_set_irq_line); - pc_rtc_init(machine()); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, NULL, pc_set_irq_line); + pc_rtc_init(); } DRIVER_INIT_MEMBER(pc_state,pccga) { - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, NULL, pc_set_irq_line); - pc_rtc_init(machine()); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, NULL, pc_set_irq_line); + pc_rtc_init(); } DRIVER_INIT_MEMBER(pc_state,bondwell) { - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, NULL, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, NULL, pc_set_irq_line); pc_turbo_setup(machine(), machine().firstcpu, "DSW2", 0x02, 4.77/12, 1); } DRIVER_INIT_MEMBER(pc_state,pcmda) { - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); } DRIVER_INIT_MEMBER(pc_state,europc) @@ -1393,7 +1389,7 @@ DRIVER_INIT_MEMBER(pc_state,europc) rom[0xfffff]=256-a; } - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); europc_rtc_init(machine()); // europc_rtc_set_time(machine()); @@ -1401,7 +1397,7 @@ DRIVER_INIT_MEMBER(pc_state,europc) DRIVER_INIT_MEMBER(pc_state,t1000hx) { - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); pc_turbo_setup(machine(), machine().firstcpu, "DSW2", 0x02, 4.77/12, 1); } @@ -1414,7 +1410,7 @@ DRIVER_INIT_MEMBER(pc_state,pc200) for (i = 0; i < 256; i++) gfx[i] = i; - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); } DRIVER_INIT_MEMBER(pc_state,ppc512) @@ -1426,7 +1422,7 @@ DRIVER_INIT_MEMBER(pc_state,ppc512) for (i = 0; i < 256; i++) gfx[i] = i; - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); } DRIVER_INIT_MEMBER(pc_state,pc1512) { @@ -1437,18 +1433,18 @@ DRIVER_INIT_MEMBER(pc_state,pc1512) for (i = 0; i < 256; i++) gfx[i] = i; - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); } DRIVER_INIT_MEMBER(pc_state,pcjr) { - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pcjr_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pcjr_set_keyb_int, pc_set_irq_line); } DRIVER_INIT_MEMBER(pc_state,mc1502) { - mess_init_pc_common(machine(), 0, NULL, pc_set_irq_line); + mess_init_pc_common(0, NULL, pc_set_irq_line); } DRIVER_INIT_MEMBER(pc_state,pc1640) @@ -1458,7 +1454,7 @@ DRIVER_INIT_MEMBER(pc_state,pc1640) io_space.install_legacy_read_handler(0x278, 0x27b, FUNC(pc1640_port278_r), 0xffff); io_space.install_legacy_read_handler(0x4278, 0x427b, FUNC(pc1640_port4278_r), 0xffff); - mess_init_pc_common(machine(), PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); + mess_init_pc_common(PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); } IRQ_CALLBACK_MEMBER(pc_state::pc_irq_callback) @@ -1566,7 +1562,7 @@ MACHINE_RESET_MEMBER(pc_state,pcjr) m_pcjx_1ff_bankval = 0; memset(m_pcjx_1ff_bank, 0, sizeof(m_pcjx_1ff_bank)); - pcjr_keyb_init(machine()); + pcjr_keyb_init(); } @@ -1742,11 +1738,10 @@ TIMER_CALLBACK_MEMBER(pc_state::pc_rtc_timer) } } -void pc_rtc_init(running_machine &machine) +void pc_state::pc_rtc_init() { - pc_state *state = machine.driver_data<pc_state>(); memset(&pc_rtc,0,sizeof(pc_rtc)); - pc_rtc.timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pc_rtc_timer),state)); + pc_rtc.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc_state::pc_rtc_timer),this)); pc_rtc.timer->adjust(attotime::zero, 0, attotime(1,0)); } diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c index cdacca5a0db..ea7de3da342 100644 --- a/src/mess/machine/poly88.c +++ b/src/mess/machine/poly88.c @@ -26,7 +26,7 @@ WRITE8_MEMBER(poly88_state::poly88_baud_rate_w) } -static UINT8 row_number(UINT8 code) { +UINT8 poly88_state::row_number(UINT8 code) { if BIT(code,0) return 0; if BIT(code,1) return 1; if BIT(code,2) return 2; diff --git a/src/mess/machine/pp01.c b/src/mess/machine/pp01.c index 81c85951f4f..ba52ff3b7f1 100644 --- a/src/mess/machine/pp01.c +++ b/src/mess/machine/pp01.c @@ -18,25 +18,24 @@ WRITE8_MEMBER(pp01_state::pp01_video_write_mode_w) m_video_write_mode = data & 0x0f; } -static void pp01_video_w(running_machine &machine,UINT8 block,UINT16 offset,UINT8 data,UINT8 part) +void pp01_state::pp01_video_w(UINT8 block,UINT16 offset,UINT8 data,UINT8 part) { - pp01_state *state = machine.driver_data<pp01_state>(); UINT16 addroffset = part ? 0x1000 : 0x0000; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); - if (BIT(state->m_video_write_mode,3)) { + if (BIT(m_video_write_mode,3)) { // Copy mode - if(BIT(state->m_video_write_mode,0)) { + if(BIT(m_video_write_mode,0)) { ram[0x6000+offset+addroffset] = data; } else { ram[0x6000+offset+addroffset] = 0; } - if(BIT(state->m_video_write_mode,1)) { + if(BIT(m_video_write_mode,1)) { ram[0xa000+offset+addroffset] = data; } else { ram[0xa000+offset+addroffset] = 0; } - if(BIT(state->m_video_write_mode,2)) { + if(BIT(m_video_write_mode,2)) { ram[0xe000+offset+addroffset] = data; } else { ram[0xe000+offset+addroffset] = 0; @@ -56,36 +55,35 @@ static void pp01_video_w(running_machine &machine,UINT8 block,UINT16 offset,UINT WRITE8_MEMBER(pp01_state::pp01_video_r_1_w) { - pp01_video_w(machine(),0,offset,data,0); + pp01_video_w(0,offset,data,0); } WRITE8_MEMBER(pp01_state::pp01_video_g_1_w) { - pp01_video_w(machine(),1,offset,data,0); + pp01_video_w(1,offset,data,0); } WRITE8_MEMBER(pp01_state::pp01_video_b_1_w) { - pp01_video_w(machine(),2,offset,data,0); + pp01_video_w(2,offset,data,0); } WRITE8_MEMBER(pp01_state::pp01_video_r_2_w) { - pp01_video_w(machine(),0,offset,data,1); + pp01_video_w(0,offset,data,1); } WRITE8_MEMBER(pp01_state::pp01_video_g_2_w) { - pp01_video_w(machine(),1,offset,data,1); + pp01_video_w(1,offset,data,1); } WRITE8_MEMBER(pp01_state::pp01_video_b_2_w) { - pp01_video_w(machine(),2,offset,data,1); + pp01_video_w(2,offset,data,1); } -static void pp01_set_memory(running_machine &machine,UINT8 block, UINT8 data) +void pp01_state::pp01_set_memory(UINT8 block, UINT8 data) { - pp01_state *state = machine.driver_data<pp01_state>(); - UINT8 *mem = state->memregion("maincpu")->base(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + UINT8 *mem = memregion("maincpu")->base(); + address_space &space = m_maincpu->space(AS_PROGRAM); UINT16 startaddr = block*0x1000; UINT16 endaddr = ((block+1)*0x1000)-1; UINT8 blocknum = block + 1; @@ -96,22 +94,22 @@ static void pp01_set_memory(running_machine &machine,UINT8 block, UINT8 data) space.install_read_bank (startaddr, endaddr, bank); switch(data) { case 0xe6 : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_1_w),state)); + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_1_w),this)); break; case 0xe7 : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_2_w),state)); + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_r_2_w),this)); break; case 0xea : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_1_w),state)); + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_1_w),this)); break; case 0xeb : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_2_w),state)); + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_g_2_w),this)); break; case 0xee : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_1_w),state)); + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_1_w),this)); break; case 0xef : - space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_2_w),state)); + space.install_write_handler(startaddr, endaddr, write8_delegate(FUNC(pp01_state::pp01_video_b_2_w),this)); break; default : @@ -119,11 +117,11 @@ static void pp01_set_memory(running_machine &machine,UINT8 block, UINT8 data) break; } - state->membank(bank)->set_base(machine.device<ram_device>(RAM_TAG)->pointer() + (data & 0x0F)* 0x1000); + membank(bank)->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + (data & 0x0F)* 0x1000); } else if (data>=0xF8) { space.install_read_bank (startaddr, endaddr, bank); space.unmap_write(startaddr, endaddr); - state->membank(bank)->set_base(mem + ((data & 0x0F)-8)* 0x1000+0x10000); + membank(bank)->set_base(mem + ((data & 0x0F)-8)* 0x1000+0x10000); } else { logerror("%02x %02x\n",block,data); space.unmap_readwrite (startaddr, endaddr); @@ -136,14 +134,14 @@ void pp01_state::machine_reset() memset(m_memory_block,0xff,16); for(i=0;i<16;i++) { m_memory_block[i] = 0xff; - pp01_set_memory(machine(), i, 0xff); + pp01_set_memory(i, 0xff); } } WRITE8_MEMBER(pp01_state::pp01_mem_block_w) { m_memory_block[offset] = data; - pp01_set_memory(machine(), offset, data); + pp01_set_memory(offset, data); } READ8_MEMBER(pp01_state::pp01_mem_block_r) diff --git a/src/mess/machine/primo.c b/src/mess/machine/primo.c index 74d3e6c6f41..4590aa3ae03 100644 --- a/src/mess/machine/primo.c +++ b/src/mess/machine/primo.c @@ -43,30 +43,29 @@ INTERRUPT_GEN_MEMBER(primo_state::primo_vblank_interrupt) *******************************************************************************/ -static void primo_update_memory(running_machine &machine) +void primo_state::primo_update_memory() { - primo_state *state = machine.driver_data<primo_state>(); - address_space& space = state->m_maincpu->space(AS_PROGRAM); - switch (state->m_port_FD & 0x03) + address_space& space = m_maincpu->space(AS_PROGRAM); + switch (m_port_FD & 0x03) { case 0x00: /* Original ROM */ space.unmap_write(0x0000, 0x3fff); - state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()+0x10000); + membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()+0x10000); break; case 0x01: /* EPROM extension 1 */ space.unmap_write(0x0000, 0x3fff); - state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()+0x14000); + membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()+0x14000); break; case 0x02: /* RAM */ space.install_write_bank(0x0000, 0x3fff, "bank1"); - state->membank("bank1")->set_base(machine.root_device().memregion("maincpu")->base()); + membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); break; case 0x03: /* EPROM extension 2 */ space.unmap_write(0x0000, 0x3fff); - state->membank("bank1")->set_base(state->memregion("maincpu")->base()+0x18000); + membank("bank1")->set_base(memregion("maincpu")->base()+0x18000); break; } - logerror ("Memory update: %02x\n", state->m_port_FD); + logerror ("Memory update: %02x\n", m_port_FD); } /******************************************************************************* @@ -195,7 +194,7 @@ WRITE8_MEMBER(primo_state::primo_FD_w) if (!ioport("MEMORY_EXPANSION")->read()) { m_port_FD = data; - primo_update_memory(machine()); + primo_update_memory(); } } @@ -205,9 +204,9 @@ WRITE8_MEMBER(primo_state::primo_FD_w) *******************************************************************************/ -static void primo_common_driver_init (primo_state *state) +void primo_state::primo_common_driver_init (primo_state *state) { - state->m_port_FD = 0x00; + m_port_FD = 0x00; } DRIVER_INIT_MEMBER(primo_state,primo32) @@ -234,23 +233,22 @@ DRIVER_INIT_MEMBER(primo_state,primo64) *******************************************************************************/ -static void primo_common_machine_init (running_machine &machine) +void primo_state::primo_common_machine_init () { - primo_state *state = machine.driver_data<primo_state>(); - if (machine.root_device().ioport("MEMORY_EXPANSION")->read()) - state->m_port_FD = 0x00; - primo_update_memory(machine); - machine.device("maincpu")->set_clock_scale(machine.root_device().ioport("CPU_CLOCK")->read() ? 1.5 : 1.0); + if (machine().root_device().ioport("MEMORY_EXPANSION")->read()) + m_port_FD = 0x00; + primo_update_memory(); + machine().device("maincpu")->set_clock_scale(machine().root_device().ioport("CPU_CLOCK")->read() ? 1.5 : 1.0); } void primo_state::machine_reset() { - primo_common_machine_init(machine()); + primo_common_machine_init(); } MACHINE_RESET_MEMBER(primo_state,primob) { - primo_common_machine_init(machine()); + primo_common_machine_init(); //removed cbm_drive_0_config(SERIAL, 8); //removed cbm_drive_1_config(SERIAL, 9); @@ -262,47 +260,47 @@ MACHINE_RESET_MEMBER(primo_state,primob) *******************************************************************************/ -static void primo_setup_pss (running_machine &machine, UINT8* snapshot_data, UINT32 snapshot_size) +void primo_state::primo_setup_pss (UINT8* snapshot_data, UINT32 snapshot_size) { - primo_state *state = machine.driver_data<primo_state>(); int i; /* Z80 registers */ - state->m_maincpu->set_state_int(Z80_BC, snapshot_data[4] + snapshot_data[5]*256); - state->m_maincpu->set_state_int(Z80_DE, snapshot_data[6] + snapshot_data[7]*256); - state->m_maincpu->set_state_int(Z80_HL, snapshot_data[8] + snapshot_data[9]*256); - state->m_maincpu->set_state_int(Z80_AF, snapshot_data[10] + snapshot_data[11]*256); - state->m_maincpu->set_state_int(Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); - state->m_maincpu->set_state_int(Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); - state->m_maincpu->set_state_int(Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); - state->m_maincpu->set_state_int(Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); - state->m_maincpu->set_state_int(Z80_PC, snapshot_data[20] + snapshot_data[21]*256); - state->m_maincpu->set_state_int(Z80_SP, snapshot_data[22] + snapshot_data[23]*256); - state->m_maincpu->set_state_int(Z80_I, snapshot_data[24]); - state->m_maincpu->set_state_int(Z80_R, snapshot_data[25]); - state->m_maincpu->set_state_int(Z80_IX, snapshot_data[26] + snapshot_data[27]*256); - state->m_maincpu->set_state_int(Z80_IY, snapshot_data[28] + snapshot_data[29]*256); + m_maincpu->set_state_int(Z80_BC, snapshot_data[4] + snapshot_data[5]*256); + m_maincpu->set_state_int(Z80_DE, snapshot_data[6] + snapshot_data[7]*256); + m_maincpu->set_state_int(Z80_HL, snapshot_data[8] + snapshot_data[9]*256); + m_maincpu->set_state_int(Z80_AF, snapshot_data[10] + snapshot_data[11]*256); + m_maincpu->set_state_int(Z80_BC2, snapshot_data[12] + snapshot_data[13]*256); + m_maincpu->set_state_int(Z80_DE2, snapshot_data[14] + snapshot_data[15]*256); + m_maincpu->set_state_int(Z80_HL2, snapshot_data[16] + snapshot_data[17]*256); + m_maincpu->set_state_int(Z80_AF2, snapshot_data[18] + snapshot_data[19]*256); + m_maincpu->set_state_int(Z80_PC, snapshot_data[20] + snapshot_data[21]*256); + m_maincpu->set_state_int(Z80_SP, snapshot_data[22] + snapshot_data[23]*256); + m_maincpu->set_state_int(Z80_I, snapshot_data[24]); + m_maincpu->set_state_int(Z80_R, snapshot_data[25]); + m_maincpu->set_state_int(Z80_IX, snapshot_data[26] + snapshot_data[27]*256); + m_maincpu->set_state_int(Z80_IY, snapshot_data[28] + snapshot_data[29]*256); /* IO ports */ // KI-1 bit 7 - NMI generator enable/disable - state->m_nmi = (snapshot_data[30] & 0x80) ? 1 : 0; + m_nmi = (snapshot_data[30] & 0x80) ? 1 : 0; // KI-1 bit 4 - speaker - speaker_level_w(state->m_speaker, (snapshot_data[30]&0x10)>>4); + speaker_level_w(m_speaker, (snapshot_data[30]&0x10)>>4); /* memory */ for (i=0; i<0xc000; i++) - state->m_maincpu->space(AS_PROGRAM).write_byte( i+0x4000, snapshot_data[i+38]); + m_maincpu->space(AS_PROGRAM).write_byte( i+0x4000, snapshot_data[i+38]); } SNAPSHOT_LOAD( primo ) { UINT8 *snapshot_data; + primo_state *state = image.device().machine().driver_data<primo_state>(); if (!(snapshot_data = (UINT8*) malloc(snapshot_size))) return IMAGE_INIT_FAIL; @@ -319,7 +317,7 @@ SNAPSHOT_LOAD( primo ) return IMAGE_INIT_FAIL; } - primo_setup_pss(image.device().machine(),snapshot_data, snapshot_size); + state->primo_setup_pss(snapshot_data, snapshot_size); free(snapshot_data); return IMAGE_INIT_PASS; @@ -332,11 +330,10 @@ SNAPSHOT_LOAD( primo ) *******************************************************************************/ -static void primo_setup_pp (running_machine &machine,UINT8* quickload_data, UINT32 quickload_size) +void primo_state::primo_setup_pp (UINT8* quickload_data, UINT32 quickload_size) { int i; - primo_state *state = machine.driver_data<primo_state>(); UINT16 load_addr; UINT16 start_addr; @@ -345,9 +342,9 @@ static void primo_setup_pp (running_machine &machine,UINT8* quickload_data, UINT start_addr = quickload_data[2] + quickload_data[3]*256; for (i=4; i<quickload_size; i++) - state->m_maincpu->space(AS_PROGRAM).write_byte(start_addr+i-4, quickload_data[i]); + m_maincpu->space(AS_PROGRAM).write_byte(start_addr+i-4, quickload_data[i]); - state->m_maincpu->set_state_int(Z80_PC, start_addr); + m_maincpu->set_state_int(Z80_PC, start_addr); logerror ("Quickload .pp l: %04x r: %04x s: %04x\n", load_addr, start_addr, quickload_size-4); } @@ -355,6 +352,7 @@ static void primo_setup_pp (running_machine &machine,UINT8* quickload_data, UINT QUICKLOAD_LOAD( primo ) { UINT8 *quickload_data; + primo_state *state = image.device().machine().driver_data<primo_state>(); if (!(quickload_data = (UINT8*) malloc(quickload_size))) return IMAGE_INIT_FAIL; @@ -365,7 +363,7 @@ QUICKLOAD_LOAD( primo ) return IMAGE_INIT_FAIL; } - primo_setup_pp(image.device().machine(), quickload_data, quickload_size); + state->primo_setup_pp(quickload_data, quickload_size); free(quickload_data); return IMAGE_INIT_PASS; diff --git a/src/mess/machine/samcoupe.c b/src/mess/machine/samcoupe.c index 65e1fd37d2f..b8f9eff327f 100644 --- a/src/mess/machine/samcoupe.c +++ b/src/mess/machine/samcoupe.c @@ -81,15 +81,13 @@ WRITE8_MEMBER(samcoupe_state::sam_bank4_w) sam_bank_write_ptr[3][offset] = data; } -static void samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly) +void samcoupe_state::samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memory, int is_readonly) { - samcoupe_state *state = space.machine().driver_data<samcoupe_state>(); - - state->sam_bank_read_ptr[bank_num-1] = memory; + sam_bank_read_ptr[bank_num-1] = memory; if (!is_readonly) - state->sam_bank_write_ptr[bank_num-1] = memory; + sam_bank_write_ptr[bank_num-1] = memory; else - state->sam_bank_write_ptr[bank_num-1] = NULL; + sam_bank_write_ptr[bank_num-1] = NULL; // installing banks on the fly is too slow (20% speed in Manic Miner gameplay vs 300% speed) #if 0 @@ -97,7 +95,7 @@ static void samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memo sprintf(bank,"bank%d",bank_num); if (memory) { - state->membank(bank)->set_base(memory); + membank(bank)->set_base(memory); space.install_read_bank (((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF, bank); if (is_readonly) { space.unmap_write(((bank_num-1) * 0x4000), ((bank_num-1) * 0x4000) + 0x3FFF); @@ -111,22 +109,21 @@ static void samcoupe_update_bank(address_space &space, int bank_num, UINT8 *memo } -static void samcoupe_install_ext_mem(address_space &space) +void samcoupe_state::samcoupe_install_ext_mem(address_space &space) { - samcoupe_state *state = space.machine().driver_data<samcoupe_state>(); UINT8 *mem; /* bank 3 */ - if (state->m_lext >> 6 < space.machine().device<ram_device>(RAM_TAG)->size() >> 20) - mem = &space.machine().device<ram_device>(RAM_TAG)->pointer()[(space.machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) + (state->m_lext >> 6) * 0x100000 + (state->m_lext & 0x3f) * 0x4000]; + if (m_lext >> 6 < space.machine().device<ram_device>(RAM_TAG)->size() >> 20) + mem = &space.machine().device<ram_device>(RAM_TAG)->pointer()[(space.machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) + (m_lext >> 6) * 0x100000 + (m_lext & 0x3f) * 0x4000]; else mem = NULL; samcoupe_update_bank(space, 3, mem, FALSE); /* bank 4 */ - if (state->m_hext >> 6 < space.machine().device<ram_device>(RAM_TAG)->size() >> 20) - mem = &space.machine().device<ram_device>(RAM_TAG)->pointer()[(space.machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) + (state->m_hext >> 6) * 0x100000 + (state->m_hext & 0x3f) * 0x4000]; + if (m_hext >> 6 < space.machine().device<ram_device>(RAM_TAG)->size() >> 20) + mem = &space.machine().device<ram_device>(RAM_TAG)->pointer()[(space.machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) + (m_hext >> 6) * 0x100000 + (m_hext & 0x3f) * 0x4000]; else mem = NULL; @@ -134,19 +131,18 @@ static void samcoupe_install_ext_mem(address_space &space) } -void samcoupe_update_memory(address_space &space) +void samcoupe_state::samcoupe_update_memory(address_space &space) { - samcoupe_state *state = space.machine().driver_data<samcoupe_state>(); - const int PAGE_MASK = ((space.machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) / 0x4000) - 1; - UINT8 *rom = state->memregion("maincpu")->base(); + const int PAGE_MASK = ((machine().device<ram_device>(RAM_TAG)->size() & 0xfffff) / 0x4000) - 1; + UINT8 *rom = memregion("maincpu")->base(); UINT8 *memory; int is_readonly; /* BANK1 */ - if (state->m_lmpr & LMPR_RAM0) /* Is ram paged in at bank 1 */ + if (m_lmpr & LMPR_RAM0) /* Is ram paged in at bank 1 */ { - if ((state->m_lmpr & 0x1F) <= PAGE_MASK) - memory = &space.machine().device<ram_device>(RAM_TAG)->pointer()[(state->m_lmpr & PAGE_MASK) * 0x4000]; + if ((m_lmpr & 0x1F) <= PAGE_MASK) + memory = &machine().device<ram_device>(RAM_TAG)->pointer()[(m_lmpr & PAGE_MASK) * 0x4000]; else memory = NULL; /* Attempt to page in non existant ram region */ is_readonly = FALSE; @@ -160,37 +156,37 @@ void samcoupe_update_memory(address_space &space) /* BANK2 */ - if (((state->m_lmpr + 1) & 0x1f) <= PAGE_MASK) - memory = &space.machine().device<ram_device>(RAM_TAG)->pointer()[((state->m_lmpr + 1) & PAGE_MASK) * 0x4000]; + if (((m_lmpr + 1) & 0x1f) <= PAGE_MASK) + memory = &machine().device<ram_device>(RAM_TAG)->pointer()[((m_lmpr + 1) & PAGE_MASK) * 0x4000]; else memory = NULL; /* Attempt to page in non existant ram region */ samcoupe_update_bank(space, 2, memory, FALSE); /* only update bank 3 and 4 when external memory is not enabled */ - if (state->m_hmpr & HMPR_MCNTRL) + if (m_hmpr & HMPR_MCNTRL) { samcoupe_install_ext_mem(space); } else { /* BANK3 */ - if ((state->m_hmpr & 0x1F) <= PAGE_MASK ) - memory = &space.machine().device<ram_device>(RAM_TAG)->pointer()[(state->m_hmpr & PAGE_MASK)*0x4000]; + if ((m_hmpr & 0x1F) <= PAGE_MASK ) + memory = &machine().device<ram_device>(RAM_TAG)->pointer()[(m_hmpr & PAGE_MASK)*0x4000]; else memory = NULL; /* Attempt to page in non existant ram region */ samcoupe_update_bank(space, 3, memory, FALSE); /* BANK4 */ - if (state->m_lmpr & LMPR_ROM1) /* Is Rom1 paged in at bank 4 */ + if (m_lmpr & LMPR_ROM1) /* Is Rom1 paged in at bank 4 */ { memory = rom + 0x4000; is_readonly = TRUE; } else { - if (((state->m_hmpr + 1) & 0x1f) <= PAGE_MASK) - memory = &space.machine().device<ram_device>(RAM_TAG)->pointer()[((state->m_hmpr + 1) & PAGE_MASK) * 0x4000]; + if (((m_hmpr + 1) & 0x1f) <= PAGE_MASK) + memory = &space.machine().device<ram_device>(RAM_TAG)->pointer()[((m_hmpr + 1) & PAGE_MASK) * 0x4000]; else memory = NULL; /* Attempt to page in non existant ram region */ is_readonly = FALSE; @@ -199,10 +195,10 @@ void samcoupe_update_memory(address_space &space) } /* video memory location */ - if (state->m_vmpr & 0x40) /* if bit set in 2 bank screen mode */ - state->m_videoram = &space.machine().device<ram_device>(RAM_TAG)->pointer()[((state->m_vmpr & 0x1e) & PAGE_MASK) * 0x4000]; + if (m_vmpr & 0x40) /* if bit set in 2 bank screen mode */ + m_videoram = &machine().device<ram_device>(RAM_TAG)->pointer()[((m_vmpr & 0x1e) & PAGE_MASK) * 0x4000]; else - state->m_videoram = &space.machine().device<ram_device>(RAM_TAG)->pointer()[((state->m_vmpr & 0x1f) & PAGE_MASK) * 0x4000]; + m_videoram = &machine().device<ram_device>(RAM_TAG)->pointer()[((m_vmpr & 0x1f) & PAGE_MASK) * 0x4000]; } @@ -252,47 +248,46 @@ TIMER_CALLBACK_MEMBER(samcoupe_state::samcoupe_mouse_reset) m_mouse_index = 0; } -UINT8 samcoupe_mouse_r(running_machine &machine) +UINT8 samcoupe_state::samcoupe_mouse_r() { - samcoupe_state *state = machine.driver_data<samcoupe_state>(); UINT8 result; /* on a read, reset the timer */ - state->m_mouse_reset->adjust(attotime::from_usec(50)); + m_mouse_reset->adjust(attotime::from_usec(50)); /* update when we are about to read the first real values */ - if (state->m_mouse_index == 2) + if (m_mouse_index == 2) { /* update values */ - int mouse_x = machine.root_device().ioport("mouse_x")->read(); - int mouse_y = machine.root_device().ioport("mouse_y")->read(); + int mouse_x = machine().root_device().ioport("mouse_x")->read(); + int mouse_y = machine().root_device().ioport("mouse_y")->read(); - int mouse_dx = state->m_mouse_x - mouse_x; - int mouse_dy = state->m_mouse_y - mouse_y; + int mouse_dx = m_mouse_x - mouse_x; + int mouse_dy = m_mouse_y - mouse_y; - state->m_mouse_x = mouse_x; - state->m_mouse_y = mouse_y; + m_mouse_x = mouse_x; + m_mouse_y = mouse_y; /* button state */ - state->m_mouse_data[2] = machine.root_device().ioport("mouse_buttons")->read(); + m_mouse_data[2] = machine().root_device().ioport("mouse_buttons")->read(); /* y-axis */ - state->m_mouse_data[3] = (mouse_dy & 0xf00) >> 8; - state->m_mouse_data[4] = (mouse_dy & 0x0f0) >> 4; - state->m_mouse_data[5] = (mouse_dy & 0x00f) >> 0; + m_mouse_data[3] = (mouse_dy & 0xf00) >> 8; + m_mouse_data[4] = (mouse_dy & 0x0f0) >> 4; + m_mouse_data[5] = (mouse_dy & 0x00f) >> 0; /* x-axis */ - state->m_mouse_data[6] = (mouse_dx & 0xf00) >> 8; - state->m_mouse_data[7] = (mouse_dx & 0x0f0) >> 4; - state->m_mouse_data[8] = (mouse_dx & 0x00f) >> 0; + m_mouse_data[6] = (mouse_dx & 0xf00) >> 8; + m_mouse_data[7] = (mouse_dx & 0x0f0) >> 4; + m_mouse_data[8] = (mouse_dx & 0x00f) >> 0; } /* get current value */ - result = state->m_mouse_data[state->m_mouse_index++]; + result = m_mouse_data[m_mouse_index++]; /* reset if we are at the end */ - if (state->m_mouse_index == sizeof(state->m_mouse_data)) - state->m_mouse_index = 1; + if (m_mouse_index == sizeof(m_mouse_data)) + m_mouse_index = 1; return result; } diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c index ce838e3f47c..f941bc534db 100644 --- a/src/mess/machine/sms.c +++ b/src/mess/machine/sms.c @@ -1422,7 +1422,7 @@ void sms_state::setup_rom() } -static int sms_verify_cart( UINT8 *magic, int size ) +int sms_state::sms_verify_cart( UINT8 *magic, int size ) { int retval; @@ -1464,7 +1464,7 @@ static int sms_verify_cart( UINT8 *magic, int size ) The Korean game Jang Pung II also seems to use a codemasters style mapper. */ -static int detect_codemasters_mapper( UINT8 *rom ) +int sms_state::detect_codemasters_mapper( UINT8 *rom ) { static const UINT8 jang_pung2[16] = { 0x00, 0xba, 0x38, 0x0d, 0x00, 0xb8, 0x38, 0x0c, 0x00, 0xb6, 0x38, 0x0b, 0x00, 0xb4, 0x38, 0x0a }; @@ -1478,7 +1478,7 @@ static int detect_codemasters_mapper( UINT8 *rom ) } -static int detect_korean_mapper( UINT8 *rom ) +int sms_state::detect_korean_mapper( UINT8 *rom ) { static const UINT8 signatures[2][16] = { @@ -1499,7 +1499,7 @@ static int detect_korean_mapper( UINT8 *rom ) #endif -static int detect_tvdraw( UINT8 *rom ) +int sms_state::detect_tvdraw( UINT8 *rom ) { static const UINT8 terebi_oekaki[7] = { 0x61, 0x6e, 0x6e, 0x61, 0x6b, 0x6d, 0x6e }; // "annakmn" @@ -1510,9 +1510,8 @@ static int detect_tvdraw( UINT8 *rom ) } -static int detect_lphaser_xoffset( running_machine &machine, UINT8 *rom ) +int sms_state::detect_lphaser_xoffset( UINT8 *rom ) { - sms_state *state = machine.driver_data<sms_state>(); static const UINT8 signatures[6][16] = { @@ -1530,7 +1529,7 @@ static int detect_lphaser_xoffset( running_machine &machine, UINT8 *rom ) { 0x54, 0x4d, 0x52, 0x20, 0x53, 0x45, 0x47, 0x41, 0xff, 0xff, 0x9f, 0x74, 0x34, 0x70, 0x00, 0x40 }, }; - if (!(state->m_bios_port & IO_CARTRIDGE) && state->m_cartridge[state->m_current_cartridge].size >= 0x8000) + if (!(m_bios_port & IO_CARTRIDGE) && m_cartridge[m_current_cartridge].size >= 0x8000) { if (!memcmp(&rom[0x7ff0], signatures[0], 16) || !memcmp(&rom[0x7ff0], signatures[1], 16)) return 40; @@ -1789,7 +1788,7 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) } /* For Light Phaser games, we have to detect the x offset */ - m_lphaser_x_offs = detect_lphaser_xoffset(machine(), m_cartridge[index].ROM); + m_lphaser_x_offs = detect_lphaser_xoffset(m_cartridge[index].ROM); /* Terebi Oekaki (TV Draw) is a SG1000 game with special input device which is compatible with SG1000 Mark III */ if ((detect_tvdraw(m_cartridge[index].ROM)) && m_is_region_japan) diff --git a/src/mess/machine/super80.c b/src/mess/machine/super80.c index 73c5649985b..dae9af12f21 100644 --- a/src/mess/machine/super80.c +++ b/src/mess/machine/super80.c @@ -49,19 +49,18 @@ Z80PIO_INTERFACE( super80_pio_intf ) /**************************** CASSETTE ROUTINES *****************************************************************/ -static void super80_cassette_motor( running_machine &machine, UINT8 data ) +void super80_state::super80_cassette_motor( UINT8 data ) { - super80_state *state = machine.driver_data<super80_state>(); if (data) - state->m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR); else - state->m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); + m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR); /* does user want to hear the sound? */ - if BIT(state->m_io_config->read(), 3) - state->m_cassette->change_state(CASSETTE_SPEAKER_ENABLED,CASSETTE_MASK_SPEAKER); + if BIT(m_io_config->read(), 3) + m_cassette->change_state(CASSETTE_SPEAKER_ENABLED,CASSETTE_MASK_SPEAKER); else - state->m_cassette->change_state(CASSETTE_SPEAKER_MUTED,CASSETTE_MASK_SPEAKER); + m_cassette->change_state(CASSETTE_SPEAKER_MUTED,CASSETTE_MASK_SPEAKER); } /********************************************* TIMER ************************************************/ @@ -184,7 +183,7 @@ WRITE8_MEMBER( super80_state::super80_f0_w ) UINT8 bits = data ^ m_last_data; m_shared = data; speaker_level_w(m_speaker, BIT(data, 3)); /* bit 3 - speaker */ - if (BIT(bits, 1)) super80_cassette_motor(machine(), BIT(data, 1)); /* bit 1 - cassette motor */ + if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ m_last_data = data; @@ -195,7 +194,7 @@ WRITE8_MEMBER( super80_state::super80r_f0_w ) UINT8 bits = data ^ m_last_data; m_shared = data | 0x14; speaker_level_w(m_speaker, BIT(data, 3)); /* bit 3 - speaker */ - if (BIT(bits, 1)) super80_cassette_motor(machine(), BIT(data, 1)); /* bit 1 - cassette motor */ + if (BIT(bits, 1)) super80_cassette_motor(BIT(data, 1)); /* bit 1 - cassette motor */ m_cassette->output( BIT(data, 0) ? -1.0 : +1.0); /* bit 0 - cass out */ m_last_data = data; @@ -210,23 +209,22 @@ void super80_state::machine_reset() membank("boot")->set_entry(1); } -static void driver_init_common( running_machine &machine ) +void super80_state::driver_init_common( ) { - super80_state *state = machine.driver_data<super80_state>(); - UINT8 *RAM = state->memregion("maincpu")->base(); - state->membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); - machine.scheduler().timer_pulse(attotime::from_hz(200000), timer_expired_delegate(FUNC(super80_state::super80_timer),state)); /* timer for keyboard and cassette */ + UINT8 *RAM = memregion("maincpu")->base(); + membank("boot")->configure_entries(0, 2, &RAM[0x0000], 0xc000); + machine().scheduler().timer_pulse(attotime::from_hz(200000), timer_expired_delegate(FUNC(super80_state::super80_timer),this)); /* timer for keyboard and cassette */ } DRIVER_INIT_MEMBER(super80_state,super80) { machine().scheduler().timer_pulse(attotime::from_hz(100), timer_expired_delegate(FUNC(super80_state::super80_halfspeed),this)); /* timer for 1MHz slowdown */ - driver_init_common(machine()); + driver_init_common(); } DRIVER_INIT_MEMBER(super80_state,super80v) { - driver_init_common(machine()); + driver_init_common(); } /*------------------------------------------------- diff --git a/src/mess/machine/svi318.c b/src/mess/machine/svi318.c index 5f7ed920fad..8e83243d459 100644 --- a/src/mess/machine/svi318.c +++ b/src/mess/machine/svi318.c @@ -349,15 +349,14 @@ MC6845_UPDATE_ROW( svi806_crtc6845_update_row ) /* 80 column card init */ -static void svi318_80col_init(running_machine &machine) +void svi318_state::svi318_80col_init() { - svi318_state *state = machine.driver_data<svi318_state>(); /* 2K RAM, but allocating 4KB to make banking easier */ /* The upper 2KB will be set to FFs and will never be written to */ - state->m_svi.svi806_ram = machine.memory().region_alloc("gfx2", 0x1000, 1, ENDIANNESS_LITTLE ); - memset( state->m_svi.svi806_ram->base(), 0x00, 0x800 ); - memset( state->m_svi.svi806_ram->base() + 0x800, 0xFF, 0x800 ); - state->m_svi.svi806_gfx = state->memregion("gfx1")->base(); + m_svi.svi806_ram = machine().memory().region_alloc("gfx2", 0x1000, 1, ENDIANNESS_LITTLE ); + memset( m_svi.svi806_ram->base(), 0x00, 0x800 ); + memset( m_svi.svi806_ram->base() + 0x800, 0xFF, 0x800 ); + m_svi.svi806_gfx = memregion("gfx1")->base(); } @@ -375,7 +374,7 @@ MACHINE_RESET_MEMBER(svi318_state,svi328_806) { MACHINE_RESET_CALL_MEMBER(svi318); - svi318_80col_init(machine()); + svi318_80col_init(); m_svi.svi806_present = 1; svi318_set_banks(); @@ -386,10 +385,9 @@ MACHINE_RESET_MEMBER(svi318_state,svi328_806) /* Init functions */ -void svi318_vdp_interrupt(running_machine &machine, int i) +void svi318_state::svi318_vdp_interrupt(int i) { - svi318_state *drvstate = machine.driver_data<svi318_state>(); - drvstate->m_maincpu->set_input_line(0, (i ? HOLD_LINE : CLEAR_LINE)); + m_maincpu->set_input_line(0, (i ? HOLD_LINE : CLEAR_LINE)); } diff --git a/src/mess/machine/tandy1t.c b/src/mess/machine/tandy1t.c index cfd5b923df0..380f4ccbcca 100644 --- a/src/mess/machine/tandy1t.c +++ b/src/mess/machine/tandy1t.c @@ -199,12 +199,13 @@ static struct WRITE8_HANDLER ( tandy1000_pio_w ) { + pc_state *state = space.machine().driver_data<pc_state>(); switch (offset) { case 1: tandy_ppi.portb = data; pit8253_gate2_w(space.machine().device("pit8253"), BIT(data, 0)); - pc_speaker_set_spkrdata( space.machine(), data & 0x02 ); + state->pc_speaker_set_spkrdata( data & 0x02 ); // sx enables keyboard from bit 3, others bit 6, hopefully theres no conflict pc_keyb_set_clock(data&0x48); if ( data & 0x80 ) diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index fcd8e2c0b4a..dd3d27b916a 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -1155,7 +1155,7 @@ static chardev* to7_midi_chardev; -static void to7_midi_update_irq ( running_machine &machine ) +void thomson_state::to7_midi_update_irq ( ) { if ( (to7_midi_intr & 4) && (to7_midi_status & ACIA_6850_RDRF) ) to7_midi_status |= ACIA_6850_irq; /* byte received interrupt */ @@ -1171,7 +1171,7 @@ static void to7_midi_update_irq ( running_machine &machine ) -static void to7_midi_byte_received_cb( running_machine &machine, chardev_err s ) +void thomson_state::to7_midi_byte_received_cb( chardev_err s ) { to7_midi_status |= ACIA_6850_RDRF; if ( s == CHARDEV_OVERFLOW ) @@ -1181,7 +1181,7 @@ static void to7_midi_byte_received_cb( running_machine &machine, chardev_err s ) -static void to7_midi_ready_to_send_cb( running_machine &machine ) +void thomson_state::to7_midi_ready_to_send_cb( ) { to7_midi_status |= ACIA_6850_TDRE; to7_midi_update_irq( machine ); @@ -1311,7 +1311,7 @@ static const chardev_interface to7_midi_interface = -static void to7_midi_reset( running_machine &machine ) +void thomson_state::to7_midi_reset( ) { LOG (( "to7_midi_reset called\n" )); to7_midi_overrun = 0; @@ -1322,7 +1322,7 @@ static void to7_midi_reset( running_machine &machine ) -static void to7_midi_init( running_machine &machine ) +void thomson_state::to7_midi_init( ) { LOG (( "to7_midi_init\n" )); to7_midi_chardev = chardev_open( &machine, "/dev/snd/midiC0D0", "/dev/snd/midiC0D1", &to7_midi_interface ); diff --git a/src/mess/machine/ti85.c b/src/mess/machine/ti85.c index ea03f530ff8..0c16679e0f3 100644 --- a/src/mess/machine/ti85.c +++ b/src/mess/machine/ti85.c @@ -50,57 +50,54 @@ inline void ti8x_update_bank(address_space &space, UINT8 bank, UINT8 *base, UINT space.nop_write(bank * 0x4000, bank * 0x4000 + 0x3fff); } -static void update_ti85_memory (running_machine &machine) +void ti85_state::update_ti85_memory () { - ti85_state *state = machine.driver_data<ti85_state>(); - state->membank("bank2")->set_base(state->m_bios + 0x004000*state->m_ti8x_memory_page_1); + membank("bank2")->set_base(m_bios + 0x004000*m_ti8x_memory_page_1); } -static void update_ti83p_memory (running_machine &machine) +void ti85_state::update_ti83p_memory () { - ti85_state *state = machine.driver_data<ti85_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); - if (state->m_ti8x_memory_page_1 & 0x40) + if (m_ti8x_memory_page_1 & 0x40) { - ti8x_update_bank(space, (state->m_ti83p_port4 & 1) ? 2 : 1, state->m_ti8x_ram, state->m_ti8x_memory_page_1 & 0x01, true); + ti8x_update_bank(space, (m_ti83p_port4 & 1) ? 2 : 1, m_ti8x_ram, m_ti8x_memory_page_1 & 0x01, true); } else { - ti8x_update_bank(space, (state->m_ti83p_port4 & 1) ? 2 : 1, state->m_bios, state->m_ti8x_memory_page_1 & 0x1f, false); + ti8x_update_bank(space, (m_ti83p_port4 & 1) ? 2 : 1, m_bios, m_ti8x_memory_page_1 & 0x1f, false); } - if (state->m_ti8x_memory_page_2 & 0x40) + if (m_ti8x_memory_page_2 & 0x40) { - ti8x_update_bank(space, (state->m_ti83p_port4 & 1) ? 3 : 2, state->m_ti8x_ram, state->m_ti8x_memory_page_2 & 0x01, true); + ti8x_update_bank(space, (m_ti83p_port4 & 1) ? 3 : 2, m_ti8x_ram, m_ti8x_memory_page_2 & 0x01, true); } else { - ti8x_update_bank(space, (state->m_ti83p_port4 & 1) ? 3 : 2, state->m_bios, state->m_ti8x_memory_page_2 & 0x1f, false); + ti8x_update_bank(space, (m_ti83p_port4 & 1) ? 3 : 2, m_bios, m_ti8x_memory_page_2 & 0x1f, false); } } -static void update_ti86_memory (running_machine &machine) +void ti85_state::update_ti86_memory () { - ti85_state *state = machine.driver_data<ti85_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); - if (state->m_ti8x_memory_page_1 & 0x40) + if (m_ti8x_memory_page_1 & 0x40) { - ti8x_update_bank(space, 1, state->m_ti8x_ram, state->m_ti8x_memory_page_1 & 0x07, true); + ti8x_update_bank(space, 1, m_ti8x_ram, m_ti8x_memory_page_1 & 0x07, true); } else { - ti8x_update_bank(space, 1, state->m_bios, state->m_ti8x_memory_page_1 & 0x0f, false); + ti8x_update_bank(space, 1, m_bios, m_ti8x_memory_page_1 & 0x0f, false); } - if (state->m_ti8x_memory_page_2 & 0x40) + if (m_ti8x_memory_page_2 & 0x40) { - ti8x_update_bank(space, 2, state->m_ti8x_ram, state->m_ti8x_memory_page_2 & 0x07, true); + ti8x_update_bank(space, 2, m_ti8x_ram, m_ti8x_memory_page_2 & 0x07, true); } else { - ti8x_update_bank(space, 2, state->m_bios, state->m_ti8x_memory_page_2 & 0x0f, false); + ti8x_update_bank(space, 2, m_bios, m_ti8x_memory_page_2 & 0x0f, false); } } @@ -391,7 +388,7 @@ WRITE8_MEMBER(ti85_state::ti85_port_0004_w) WRITE8_MEMBER(ti85_state::ti85_port_0005_w) { m_ti8x_memory_page_1 = data; - update_ti85_memory(machine()); + update_ti85_memory(); } WRITE8_MEMBER(ti85_state::ti85_port_0006_w) @@ -413,32 +410,32 @@ WRITE8_MEMBER(ti85_state::ti8x_serial_w) WRITE8_MEMBER(ti85_state::ti86_port_0005_w) { m_ti8x_memory_page_1 = data&((data&0x40)?0x47:0x4f); - update_ti86_memory(machine()); + update_ti86_memory(); } WRITE8_MEMBER(ti85_state::ti86_port_0006_w) { m_ti8x_memory_page_2 = data&((data&0x40)?0x47:0x4f); - update_ti86_memory(machine()); + update_ti86_memory(); } WRITE8_MEMBER(ti85_state::ti82_port_0002_w) { m_ti8x_memory_page_1 = (data & 0x07); - update_ti85_memory(machine()); + update_ti85_memory(); m_ti8x_port2 = data; } WRITE8_MEMBER(ti85_state::ti83_port_0000_w) { m_ti8x_memory_page_1 = (m_ti8x_memory_page_1 & 7) | ((data & 16) >> 1); - update_ti85_memory(machine()); + update_ti85_memory(); } WRITE8_MEMBER(ti85_state::ti83_port_0002_w) { m_ti8x_memory_page_1 = (m_ti8x_memory_page_1 & 8) | (data & 7); - update_ti85_memory(machine()); + update_ti85_memory(); m_ti8x_port2 = data; } @@ -485,20 +482,20 @@ WRITE8_MEMBER(ti85_state::ti83p_port_0004_w) m_ti8x_memory_page_1 = 0x1f; m_ti8x_memory_page_2 = 0x40; } - update_ti83p_memory(machine()); + update_ti83p_memory(); m_ti83p_port4 = data; } WRITE8_MEMBER(ti85_state::ti83p_port_0006_w) { m_ti8x_memory_page_1 = data & ((data&0x40) ? 0x41 : 0x5f); - update_ti83p_memory(machine()); + update_ti83p_memory(); } WRITE8_MEMBER(ti85_state::ti83p_port_0007_w) { m_ti8x_memory_page_2 = data & ((data&0x40) ? 0x41 : 0x5f); - update_ti83p_memory(machine()); + update_ti83p_memory(); } /* NVRAM functions */ @@ -544,149 +541,147 @@ NVRAM_HANDLER( ti86 ) TI calculators snapshot files (SAV) ***************************************************************************/ -static void ti8x_snapshot_setup_registers (running_machine &machine, UINT8 * data) +void ti85_state::ti8x_snapshot_setup_registers (UINT8 * data) { - ti85_state *state = machine.driver_data<ti85_state>(); unsigned char lo,hi; unsigned char * reg = data + 0x40; /* Set registers */ lo = reg[0x00] & 0x0ff; hi = reg[0x01] & 0x0ff; - state->m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_AF, (hi << 8) | lo); lo = reg[0x04] & 0x0ff; hi = reg[0x05] & 0x0ff; - state->m_maincpu->set_state_int(Z80_BC, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_BC, (hi << 8) | lo); lo = reg[0x08] & 0x0ff; hi = reg[0x09] & 0x0ff; - state->m_maincpu->set_state_int(Z80_DE, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_DE, (hi << 8) | lo); lo = reg[0x0c] & 0x0ff; hi = reg[0x0d] & 0x0ff; - state->m_maincpu->set_state_int(Z80_HL, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_HL, (hi << 8) | lo); lo = reg[0x10] & 0x0ff; hi = reg[0x11] & 0x0ff; - state->m_maincpu->set_state_int(Z80_IX, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_IX, (hi << 8) | lo); lo = reg[0x14] & 0x0ff; hi = reg[0x15] & 0x0ff; - state->m_maincpu->set_state_int(Z80_IY, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_IY, (hi << 8) | lo); lo = reg[0x18] & 0x0ff; hi = reg[0x19] & 0x0ff; - state->m_maincpu->set_state_int(Z80_PC, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_PC, (hi << 8) | lo); lo = reg[0x1c] & 0x0ff; hi = reg[0x1d] & 0x0ff; - state->m_maincpu->set_state_int(Z80_SP, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_SP, (hi << 8) | lo); lo = reg[0x20] & 0x0ff; hi = reg[0x21] & 0x0ff; - state->m_maincpu->set_state_int(Z80_AF2, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_AF2, (hi << 8) | lo); lo = reg[0x24] & 0x0ff; hi = reg[0x25] & 0x0ff; - state->m_maincpu->set_state_int(Z80_BC2, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_BC2, (hi << 8) | lo); lo = reg[0x28] & 0x0ff; hi = reg[0x29] & 0x0ff; - state->m_maincpu->set_state_int(Z80_DE2, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_DE2, (hi << 8) | lo); lo = reg[0x2c] & 0x0ff; hi = reg[0x2d] & 0x0ff; - state->m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo); - state->m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff); - state->m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff); - state->m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff); - state->m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff); - state->m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff); + m_maincpu->set_state_int(Z80_HL2, (hi << 8) | lo); + m_maincpu->set_state_int(Z80_IFF1, reg[0x30]&0x0ff); + m_maincpu->set_state_int(Z80_IFF2, reg[0x34]&0x0ff); + m_maincpu->set_state_int(Z80_HALT, reg[0x38]&0x0ff); + m_maincpu->set_state_int(Z80_IM, reg[0x3c]&0x0ff); + m_maincpu->set_state_int(Z80_I, reg[0x40]&0x0ff); - state->m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); + m_maincpu->set_state_int(Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); - state->m_maincpu->set_input_line(0, 0); - state->m_maincpu->set_input_line(INPUT_LINE_NMI, 0); - state->m_maincpu->set_input_line(INPUT_LINE_HALT, 0); + m_maincpu->set_input_line(0, 0); + m_maincpu->set_input_line(INPUT_LINE_NMI, 0); + m_maincpu->set_input_line(INPUT_LINE_HALT, 0); } -static void ti85_setup_snapshot (running_machine &machine, UINT8 * data) +void ti85_state::ti85_setup_snapshot (UINT8 * data) { - ti85_state *state = machine.driver_data<ti85_state>(); - address_space &space = state->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); int i; unsigned char lo,hi; unsigned char * hdw = data + 0x8000 + 0x94; - ti8x_snapshot_setup_registers (machine, data); + ti8x_snapshot_setup_registers (data); /* Memory dump */ for (i = 0; i < 0x8000; i++) space.write_byte(i + 0x8000, data[i+0x94]); - state->m_keypad_mask = hdw[0x00]&0x7f; + m_keypad_mask = hdw[0x00]&0x7f; - state->m_ti8x_memory_page_1 = hdw[0x08]&0xff; - update_ti85_memory(machine); + m_ti8x_memory_page_1 = hdw[0x08]&0xff; + update_ti85_memory(); - state->m_power_mode = hdw[0x14]&0xff; + m_power_mode = hdw[0x14]&0xff; lo = hdw[0x28] & 0x0ff; hi = hdw[0x29] & 0x0ff; - state->m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; + m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; - state->m_LCD_status = hdw[0x2c]&0xff ? 0 : 0x08; - if (state->m_LCD_status) state->m_LCD_mask = 0x02; + m_LCD_status = hdw[0x2c]&0xff ? 0 : 0x08; + if (m_LCD_status) m_LCD_mask = 0x02; - state->m_LCD_contrast = hdw[0x30]&0xff; + m_LCD_contrast = hdw[0x30]&0xff; - state->m_timer_interrupt_mask = !hdw[0x38]; - state->m_timer_interrupt_status = 0; + m_timer_interrupt_mask = !hdw[0x38]; + m_timer_interrupt_status = 0; - state->m_ON_interrupt_mask = !state->m_LCD_status && state->m_timer_interrupt_status; - state->m_ON_interrupt_status = 0; - state->m_ON_pressed = 0; + m_ON_interrupt_mask = !m_LCD_status && m_timer_interrupt_status; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; - state->m_video_buffer_width = 0x02; - state->m_interrupt_speed = 0x03; + m_video_buffer_width = 0x02; + m_interrupt_speed = 0x03; } -static void ti86_setup_snapshot (running_machine &machine, UINT8 * data) +void ti85_state::ti86_setup_snapshot (UINT8 * data) { - ti85_state *state = machine.driver_data<ti85_state>(); unsigned char lo,hi; unsigned char * hdw = data + 0x20000 + 0x94; - ti8x_snapshot_setup_registers (machine, data); + ti8x_snapshot_setup_registers ( data); /* Memory dump */ - memcpy(state->m_ti8x_ram, data+0x94, 0x20000); + memcpy(m_ti8x_ram, data+0x94, 0x20000); - state->m_keypad_mask = hdw[0x00]&0x7f; + m_keypad_mask = hdw[0x00]&0x7f; - state->m_ti8x_memory_page_1 = hdw[0x04]&0xff ? 0x40 : 0x00; - state->m_ti8x_memory_page_1 |= hdw[0x08]&0x0f; + m_ti8x_memory_page_1 = hdw[0x04]&0xff ? 0x40 : 0x00; + m_ti8x_memory_page_1 |= hdw[0x08]&0x0f; - state->m_ti8x_memory_page_2 = hdw[0x0c]&0xff ? 0x40 : 0x00; - state->m_ti8x_memory_page_2 |= hdw[0x10]&0x0f; + m_ti8x_memory_page_2 = hdw[0x0c]&0xff ? 0x40 : 0x00; + m_ti8x_memory_page_2 |= hdw[0x10]&0x0f; - update_ti86_memory(machine); + update_ti86_memory(); lo = hdw[0x2c] & 0x0ff; hi = hdw[0x2d] & 0x0ff; - state->m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; + m_LCD_memory_base = (((hi << 8) | lo)-0xc000)>>8; - state->m_LCD_status = hdw[0x30]&0xff ? 0 : 0x08; - if (state->m_LCD_status) state->m_LCD_mask = 0x02; + m_LCD_status = hdw[0x30]&0xff ? 0 : 0x08; + if (m_LCD_status) m_LCD_mask = 0x02; - state->m_LCD_contrast = hdw[0x34]&0xff; + m_LCD_contrast = hdw[0x34]&0xff; - state->m_timer_interrupt_mask = !hdw[0x3c]; - state->m_timer_interrupt_status = 0; + m_timer_interrupt_mask = !hdw[0x3c]; + m_timer_interrupt_status = 0; - state->m_ON_interrupt_mask = !state->m_LCD_status && state->m_timer_interrupt_status; - state->m_ON_interrupt_status = 0; - state->m_ON_pressed = 0; + m_ON_interrupt_mask = !m_LCD_status && m_timer_interrupt_status; + m_ON_interrupt_status = 0; + m_ON_pressed = 0; - state->m_video_buffer_width = 0x02; - state->m_interrupt_speed = 0x03; + m_video_buffer_width = 0x02; + m_interrupt_speed = 0x03; } SNAPSHOT_LOAD( ti8x ) { int expected_snapshot_size = 0; UINT8 *ti8x_snapshot_data; - + ti85_state *state = image.device().machine().driver_data<ti85_state>(); + if (!strncmp(image.device().machine().system().name, "ti85", 4)) expected_snapshot_size = TI85_SNAPSHOT_SIZE; else if (!strncmp(image.device().machine().system().name, "ti86", 4)) @@ -706,9 +701,9 @@ SNAPSHOT_LOAD( ti8x ) image.fread( ti8x_snapshot_data, snapshot_size); if (!strncmp(image.device().machine().system().name, "ti85", 4)) - ti85_setup_snapshot(image.device().machine(), ti8x_snapshot_data); + state->ti85_setup_snapshot(ti8x_snapshot_data); else if (!strncmp(image.device().machine().system().name, "ti86", 4)) - ti86_setup_snapshot(image.device().machine(), ti8x_snapshot_data); + state->ti86_setup_snapshot(ti8x_snapshot_data); free(ti8x_snapshot_data); return IMAGE_INIT_PASS; diff --git a/src/mess/machine/upd71071.c b/src/mess/machine/upd71071.c index 79d689fac15..ca7be166cfd 100644 --- a/src/mess/machine/upd71071.c +++ b/src/mess/machine/upd71071.c @@ -110,6 +110,8 @@ struct upd71071_t const upd71071_intf* intf; devcb_resolved_write_line m_out_hreq_func; devcb_resolved_write_line m_out_eop_func; + devcb_resolved_read16 m_dma_read[4]; + devcb_resolved_write16 m_dma_write[4]; devcb_resolved_write_line m_out_dack_func[4]; int m_hreq; int m_eop; @@ -137,8 +139,8 @@ static TIMER_CALLBACK(dma_transfer_timer) case 0x00: // Verify break; case 0x04: // I/O -> memory - if(dmac->intf->dma_read[channel]) - data = dmac->intf->dma_read[channel](device->machine()); + if(!dmac->m_dma_read[channel].isnull()) + data = dmac->m_dma_read[channel](0); space.write_byte(dmac->reg.address_current[channel],data & 0xff); if(dmac->reg.mode_control[channel] & 0x20) // Address direction dmac->reg.address_current[channel]--; @@ -159,8 +161,8 @@ static TIMER_CALLBACK(dma_transfer_timer) break; case 0x08: // memory -> I/O data = space.read_byte(dmac->reg.address_current[channel]); - if(dmac->intf->dma_read[channel]) - dmac->intf->dma_write[channel](device->machine(),data); + if(!dmac->m_dma_write[channel].isnull()) + dmac->m_dma_write[channel](0,data); if(dmac->reg.mode_control[channel] & 0x20) // Address direction dmac->reg.address_current[channel]--; else @@ -256,6 +258,8 @@ static DEVICE_START(upd71071) for(x=0;x<4;x++) { dmac->timer[x] = device->machine().scheduler().timer_alloc(FUNC(dma_transfer_timer), (void*)device); + dmac->m_dma_read[x].resolve(dmac->intf->m_dma_read[x], *device); + dmac->m_dma_write[x].resolve(dmac->intf->m_dma_write[x], *device); dmac->m_out_dack_func[x].resolve(dmac->intf->m_out_dack_cb[x], *device); } dmac->selected_channel = 0; diff --git a/src/mess/machine/upd71071.h b/src/mess/machine/upd71071.h index 364410e9e92..1e87a41fcac 100644 --- a/src/mess/machine/upd71071.h +++ b/src/mess/machine/upd71071.h @@ -9,8 +9,8 @@ struct upd71071_intf int clock; devcb_write_line m_out_hreq_cb; devcb_write_line m_out_eop_cb; - UINT16 (*dma_read[4])(running_machine &machine); - void (*dma_write[4])(running_machine &machine, UINT16 data); + devcb_read16 m_dma_read[4]; + devcb_write16 m_dma_write[4]; devcb_write_line m_out_dack_cb[4]; }; diff --git a/src/mess/machine/vtech2.c b/src/mess/machine/vtech2.c index 45d9248c97e..ff2ab5fc283 100644 --- a/src/mess/machine/vtech2.c +++ b/src/mess/machine/vtech2.c @@ -78,36 +78,35 @@ DRIVER_INIT_MEMBER(vtech2_state,laser) -static void laser_machine_init(running_machine &machine, int bank_mask, int video_mask) +void vtech2_state::laser_machine_init(int bank_mask, int video_mask) { - vtech2_state *state = machine.driver_data<vtech2_state>(); int i; - state->m_laser_bank_mask = bank_mask; - state->m_laser_video_bank = video_mask; - state->m_videoram = state->m_mem + state->m_laser_video_bank * 0x04000; - logerror("laser_machine_init(): bank mask $%04X, video %d [$%05X]\n", state->m_laser_bank_mask, state->m_laser_video_bank, state->m_laser_video_bank * 0x04000); + m_laser_bank_mask = bank_mask; + m_laser_video_bank = video_mask; + m_videoram = m_mem + m_laser_video_bank * 0x04000; + logerror("laser_machine_init(): bank mask $%04X, video %d [$%05X]\n", m_laser_bank_mask, m_laser_video_bank, m_laser_video_bank * 0x04000); - for (i = 0; i < ARRAY_LENGTH(state->m_laser_bank); i++) - state->laser_bank_select_w(state->m_maincpu->space(AS_PROGRAM), i, 0); + for (i = 0; i < ARRAY_LENGTH(m_laser_bank); i++) + laser_bank_select_w(m_maincpu->space(AS_PROGRAM), i, 0); } void vtech2_state::machine_reset() { /* banks 0 to 3 only, optional ROM extension */ - laser_machine_init(machine(), 0xf00f, 3); + laser_machine_init(0xf00f, 3); } MACHINE_RESET_MEMBER(vtech2_state,laser500) { /* banks 0 to 2, and 4-7 only , optional ROM extension */ - laser_machine_init(machine(), 0xf0f7, 7); + laser_machine_init(0xf0f7, 7); } MACHINE_RESET_MEMBER(vtech2_state,laser700) { /* all banks except #3 */ - laser_machine_init(machine(), 0xfff7, 7); + laser_machine_init(0xfff7, 7); } @@ -338,38 +337,36 @@ static device_t *laser_file(running_machine &machine) return machine.device( state->m_laser_drive ? FLOPPY_1 : FLOPPY_0 ); } -static void laser_get_track(running_machine &machine) +void vtech2_state::laser_get_track() { - vtech2_state *state = machine.driver_data<vtech2_state>(); - sprintf(state->m_laser_frame_message, "#%d get track %02d", state->m_laser_drive, state->m_laser_track_x2[state->m_laser_drive]/2); - state->m_laser_frame_time = 30; + sprintf(m_laser_frame_message, "#%d get track %02d", m_laser_drive, m_laser_track_x2[m_laser_drive]/2); + m_laser_frame_time = 30; /* drive selected or and image file ok? */ - if( state->m_laser_drive >= 0 && laser_file(machine) != NULL ) + if( m_laser_drive >= 0 && laser_file(machine()) != NULL ) { int size, offs; - device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file(machine)); + device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file(machine())); size = TRKSIZE_VZ; - offs = TRKSIZE_VZ * state->m_laser_track_x2[state->m_laser_drive]/2; + offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; image->fseek(offs, SEEK_SET); - size = image->fread(state->m_laser_fdc_data, size); + size = image->fread(m_laser_fdc_data, size); logerror("get track @$%05x $%04x bytes\n", offs, size); } - state->m_laser_fdc_offs = 0; - state->m_laser_fdc_write = 0; + m_laser_fdc_offs = 0; + m_laser_fdc_write = 0; } -static void laser_put_track(running_machine &machine) +void vtech2_state::laser_put_track() { - vtech2_state *state = machine.driver_data<vtech2_state>(); - device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file(machine)); + device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file(machine())); /* drive selected and image file ok? */ - if( state->m_laser_drive >= 0 && laser_file(machine) != NULL ) + if( m_laser_drive >= 0 && laser_file(machine()) != NULL ) { int size, offs; - offs = TRKSIZE_VZ * state->m_laser_track_x2[state->m_laser_drive]/2; - image->fseek(offs + state->m_laser_fdc_start, SEEK_SET); - size = image->fwrite(&state->m_laser_fdc_data[state->m_laser_fdc_start], state->m_laser_fdc_write); - logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, state->m_laser_fdc_start, size, state->m_laser_fdc_write); + offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; + image->fseek(offs + m_laser_fdc_start, SEEK_SET); + size = image->fwrite(&m_laser_fdc_data[m_laser_fdc_start], m_laser_fdc_write); + logerror("put track @$%05X+$%X $%04X/$%04X bytes\n", offs, m_laser_fdc_start, size, m_laser_fdc_write); } } @@ -434,7 +431,7 @@ WRITE8_MEMBER(vtech2_state::laser_fdc_w) { m_laser_drive = drive; if( m_laser_drive >= 0 ) - laser_get_track(machine()); + laser_get_track(); } if( m_laser_drive >= 0 ) { @@ -447,7 +444,7 @@ WRITE8_MEMBER(vtech2_state::laser_fdc_w) m_laser_track_x2[m_laser_drive]--; logerror("laser_fdc_w(%d) $%02X drive %d: stepout track #%2d.%d\n", offset, data, m_laser_drive, m_laser_track_x2[m_laser_drive]/2,5*(m_laser_track_x2[m_laser_drive]&1)); if( (m_laser_track_x2[m_laser_drive] & 1) == 0 ) - laser_get_track(machine()); + laser_get_track(); } else if( (PHI0(data) && !(PHI1(data) || PHI2(data) || PHI3(data)) && PHI3(m_laser_fdc_latch)) || @@ -459,7 +456,7 @@ WRITE8_MEMBER(vtech2_state::laser_fdc_w) m_laser_track_x2[m_laser_drive]++; logerror("laser_fdc_w(%d) $%02X drive %d: stepin track #%2d.%d\n", offset, data, m_laser_drive, m_laser_track_x2[m_laser_drive]/2,5*(m_laser_track_x2[m_laser_drive]&1)); if( (m_laser_track_x2[m_laser_drive] & 1) == 0 ) - laser_get_track(machine()); + laser_get_track(); } if( (data & 0x40) == 0 ) { @@ -503,7 +500,7 @@ WRITE8_MEMBER(vtech2_state::laser_fdc_w) { /* data written to track before? */ if( m_laser_fdc_write ) - laser_put_track(machine()); + laser_put_track(); } m_laser_fdc_bits = 8; m_laser_fdc_write = 0; diff --git a/src/mess/machine/wswan.c b/src/mess/machine/wswan.c index 27c2ce09c11..3614db15d68 100644 --- a/src/mess/machine/wswan.c +++ b/src/mess/machine/wswan.c @@ -1290,24 +1290,24 @@ WRITE8_MEMBER( wswan_state::wswan_port_w ) m_ws_portram[offset] = data; } -static const char* wswan_determine_sram( wswan_state *state, UINT8 data ) +const char* wswan_state::wswan_determine_sram(UINT8 data ) { - state->m_eeprom.write_enabled = 0; - state->m_eeprom.mode = SRAM_UNKNOWN; + m_eeprom.write_enabled = 0; + m_eeprom.mode = SRAM_UNKNOWN; switch( data ) { - case 0x00: state->m_eeprom.mode = SRAM_NONE; break; - case 0x01: state->m_eeprom.mode = SRAM_64K; break; - case 0x02: state->m_eeprom.mode = SRAM_256K; break; - case 0x03: state->m_eeprom.mode = SRAM_1M; break; - case 0x04: state->m_eeprom.mode = SRAM_2M; break; - case 0x05: state->m_eeprom.mode = SRAM_512K; break; - case 0x10: state->m_eeprom.mode = EEPROM_1K; break; - case 0x20: state->m_eeprom.mode = EEPROM_16K; break; - case 0x50: state->m_eeprom.mode = EEPROM_8K; break; + case 0x00: m_eeprom.mode = SRAM_NONE; break; + case 0x01: m_eeprom.mode = SRAM_64K; break; + case 0x02: m_eeprom.mode = SRAM_256K; break; + case 0x03: m_eeprom.mode = SRAM_1M; break; + case 0x04: m_eeprom.mode = SRAM_2M; break; + case 0x05: m_eeprom.mode = SRAM_512K; break; + case 0x10: m_eeprom.mode = EEPROM_1K; break; + case 0x20: m_eeprom.mode = EEPROM_16K; break; + case 0x50: m_eeprom.mode = EEPROM_8K; break; } - state->m_eeprom.size = wswan_sram_size[ state->m_eeprom.mode ]; - return wswan_sram_str[ state->m_eeprom.mode ]; + m_eeprom.size = wswan_sram_size[ m_eeprom.mode ]; + return wswan_sram_str[ m_eeprom.mode ]; } enum enum_romsize { ROM_4M=0, ROM_8M, ROM_16M, ROM_32M, ROM_64M, ROM_128M, ROM_UNKNOWN }; @@ -1315,7 +1315,7 @@ static const char *const wswan_romsize_str[] = { "4Mbit", "8Mbit", "16Mbit", "32Mbit", "64Mbit", "128Mbit", "Unknown" }; -static const char* wswan_determine_romsize( UINT8 data ) +const char* wswan_state::wswan_determine_romsize( UINT8 data ) { switch( data ) { @@ -1391,7 +1391,7 @@ DEVICE_IMAGE_LOAD_MEMBER(wswan_state,wswan_cart) } } - sram_str = wswan_determine_sram(this, m_ROMMap[m_ROMBanks - 1][0xfffb]); + sram_str = wswan_determine_sram(m_ROMMap[m_ROMBanks - 1][0xfffb]); m_rtc.present = m_ROMMap[m_ROMBanks - 1][0xfffd] ? 1 : 0; m_rotate = m_ROMMap[m_ROMBanks-1][0xfffc] & 0x01; @@ -1443,7 +1443,7 @@ TIMER_CALLBACK_MEMBER(wswan_state::wswan_scanline_interrupt) { if( m_vdp.current_line < 144 ) { - wswan_refresh_scanline(machine()); + wswan_refresh_scanline(); } /* Decrement 12kHz (HBlank) counter */ diff --git a/src/mess/video/apple1.c b/src/mess/video/apple1.c index e98746d1fca..e0430c3ee49 100644 --- a/src/mess/video/apple1.c +++ b/src/mess/video/apple1.c @@ -89,15 +89,14 @@ TILE_GET_INFO_MEMBER(apple1_state::terminal_gettileinfo) 0); /* flags */ } -static void terminal_draw(running_machine &machine, bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal) +void apple1_state::terminal_draw(bitmap_ind16 &dest, const rectangle &cliprect, terminal_t *terminal) { - apple1_state *state = machine.driver_data<apple1_state>(); - state->m_current_terminal = terminal; + m_current_terminal = terminal; terminal->tm->draw(dest, cliprect, 0, 0); - state->m_current_terminal = NULL; + m_current_terminal = NULL; } -static void verify_coords(terminal_t *terminal, int x, int y) +void apple1_state::verify_coords(terminal_t *terminal, int x, int y) { assert(x >= 0); assert(y >= 0); @@ -105,7 +104,7 @@ static void verify_coords(terminal_t *terminal, int x, int y) assert(y < terminal->num_rows); } -static void terminal_putchar(terminal_t *terminal, int x, int y, int ch) +void apple1_state::terminal_putchar(terminal_t *terminal, int x, int y, int ch) { int offs; @@ -119,7 +118,7 @@ static void terminal_putchar(terminal_t *terminal, int x, int y, int ch) } } -static int terminal_getchar(terminal_t *terminal, int x, int y) +int apple1_state::terminal_getchar(terminal_t *terminal, int x, int y) { int offs; @@ -128,43 +127,43 @@ static int terminal_getchar(terminal_t *terminal, int x, int y) return terminal->mem[offs]; } -static void terminal_putblank(terminal_t *terminal, int x, int y) +void apple1_state::terminal_putblank(terminal_t *terminal, int x, int y) { terminal_putchar(terminal, x, y, terminal->blank_char); } -static void terminal_dirtycursor(terminal_t *terminal) +void apple1_state::terminal_dirtycursor(terminal_t *terminal) { if (terminal->cur_offset >= 0) terminal->tm->mark_tile_dirty(terminal->cur_offset); } -static void terminal_setcursor(terminal_t *terminal, int x, int y) +void apple1_state::terminal_setcursor(terminal_t *terminal, int x, int y) { terminal_dirtycursor(terminal); terminal->cur_offset = y * terminal->num_cols + x; terminal_dirtycursor(terminal); } -static void terminal_hidecursor(terminal_t *terminal) +void apple1_state::terminal_hidecursor(terminal_t *terminal) { terminal->cur_hidden = 1; terminal_dirtycursor(terminal); } -static void terminal_showcursor(terminal_t *terminal) +void apple1_state::terminal_showcursor(terminal_t *terminal) { terminal->cur_hidden = 0; terminal_dirtycursor(terminal); } -static void terminal_getcursor(terminal_t *terminal, int *x, int *y) +void apple1_state::terminal_getcursor(terminal_t *terminal, int *x, int *y) { *x = terminal->cur_offset % terminal->num_cols; *y = terminal->cur_offset / terminal->num_cols; } -static void terminal_fill(terminal_t *terminal, int val) +void apple1_state::terminal_fill(terminal_t *terminal, int val) { int i; for (i = 0; i < terminal->num_cols * terminal->num_rows; i++) @@ -172,28 +171,26 @@ static void terminal_fill(terminal_t *terminal, int val) terminal->tm->mark_all_dirty(); } -static void terminal_clear(terminal_t *terminal) +void apple1_state::terminal_clear(terminal_t *terminal) { terminal_fill(terminal, terminal->blank_char); } -static terminal_t *terminal_create( - running_machine &machine, +terminal_t *apple1_state::terminal_create( int gfx, int blank_char, int char_bits, int (*getcursorcode)(int original_code), int num_cols, int num_rows) { terminal_t *term; int char_width, char_height; - apple1_state *state = machine.driver_data<apple1_state>(); - char_width = machine.gfx[gfx]->width(); - char_height = machine.gfx[gfx]->height(); + char_width = machine().gfx[gfx]->width(); + char_height = machine().gfx[gfx]->height(); - term = (terminal_t *) auto_alloc_array(machine, char, sizeof(terminal_t) - sizeof(term->mem) + term = (terminal_t *) auto_alloc_array(machine(), char, sizeof(terminal_t) - sizeof(term->mem) + (num_cols * num_rows * sizeof(termchar_t))); - term->tm = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),state), TILEMAP_SCAN_ROWS, + term->tm = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(apple1_state::terminal_gettileinfo),this), TILEMAP_SCAN_ROWS, char_width, char_height, num_cols, num_rows); term->gfx = gfx; @@ -232,7 +229,6 @@ void apple1_state::video_start() { m_blink_on = 1; /* cursor is visible initially */ m_terminal = terminal_create( - machine(), 0, /* graphics font 0 (the only one we have) */ 32, /* Blank character is symbol 32 in the ROM */ 8, /* use 8 bits for the character code */ @@ -243,21 +239,20 @@ void apple1_state::video_start() } /* This function handles all writes to the video display. */ -void apple1_vh_dsp_w (running_machine &machine, int data) +void apple1_state::apple1_vh_dsp_w (int data) { - apple1_state *state = machine.driver_data<apple1_state>(); int x, y; int cursor_x, cursor_y; /* While CLEAR SCREEN is being held down, the hardware is forced to clear the video memory, so video writes have no effect. */ - if (state->m_vh_clrscrn_pressed) + if (m_vh_clrscrn_pressed) return; /* The video display port only accepts the 7 lowest bits of the char. */ data &= 0x7f; - terminal_getcursor(state->m_terminal, &cursor_x, &cursor_y); + terminal_getcursor(m_terminal, &cursor_x, &cursor_y); if (data == '\r') { /* Carriage-return moves the cursor to the start of the next @@ -282,7 +277,7 @@ void apple1_vh_dsp_w (running_machine &machine, int data) int romindx = (data & 0x1f) | (((data ^ 0x40) & 0x40) >> 1); - terminal_putchar(state->m_terminal, cursor_x, cursor_y, romindx); + terminal_putchar(m_terminal, cursor_x, cursor_y, romindx); if (cursor_x < 39) { cursor_x++; @@ -299,37 +294,35 @@ void apple1_vh_dsp_w (running_machine &machine, int data) { for (y = 1; y < 24; y++) for (x = 0; x < 40; x++) - terminal_putchar(state->m_terminal, x, y-1, - terminal_getchar(state->m_terminal, x, y)); + terminal_putchar(m_terminal, x, y-1, + terminal_getchar(m_terminal, x, y)); for (x = 0; x < 40; x++) - terminal_putblank(state->m_terminal, x, 23); + terminal_putblank(m_terminal, x, 23); cursor_y--; } - terminal_setcursor(state->m_terminal, cursor_x, cursor_y); + terminal_setcursor(m_terminal, cursor_x, cursor_y); } /* This function handles clearing the video display on cold-boot or in response to a press of the CLEAR SCREEN switch. */ -void apple1_vh_dsp_clr (running_machine &machine) +void apple1_state::apple1_vh_dsp_clr () { - apple1_state *state = machine.driver_data<apple1_state>(); - terminal_setcursor(state->m_terminal, 0, 0); - terminal_clear(state->m_terminal); + terminal_setcursor(m_terminal, 0, 0); + terminal_clear(m_terminal); } /* Calculate how long it will take for the display to assert the RDA signal in response to a video display write. This signal indicates the display has completed the write and is ready to accept another write. */ -attotime apple1_vh_dsp_time_to_ready (running_machine &machine) +attotime apple1_state::apple1_vh_dsp_time_to_ready () { - apple1_state *state = machine.driver_data<apple1_state>(); int cursor_x, cursor_y; int cursor_scanline; - double scanline_period = machine.primary_screen->scan_period().as_double(); + double scanline_period = machine().primary_screen->scan_period().as_double(); double cursor_hfrac; /* The video hardware refreshes the screen by reading the @@ -340,7 +333,7 @@ attotime apple1_vh_dsp_time_to_ready (running_machine &machine) the cursor's character line, when the beam reaches the cursor's horizontal position. */ - terminal_getcursor(state->m_terminal, &cursor_x, &cursor_y); + terminal_getcursor(m_terminal, &cursor_x, &cursor_y); cursor_scanline = cursor_y * apple1_charlayout.height; /* Each scanline is composed of 455 pixel times. The first 175 of @@ -348,27 +341,26 @@ attotime apple1_vh_dsp_time_to_ready (running_machine &machine) for the visible part of the scanline. */ cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455; - if (machine.primary_screen->vpos() == cursor_scanline) { + if (machine().primary_screen->vpos() == cursor_scanline) { /* video_screen_get_hpos() doesn't account for the horizontal blanking interval; it acts as if the scanline period is entirely composed of visible pixel times. However, we can still use it to find what fraction of the current scanline period has elapsed. */ - double current_hfrac = machine.primary_screen->hpos() / - machine.first_screen()->width(); + double current_hfrac = machine().primary_screen->hpos() / + machine().first_screen()->width(); if (current_hfrac < cursor_hfrac) return attotime::from_double(scanline_period * (cursor_hfrac - current_hfrac)); } return attotime::from_double( - machine.primary_screen->time_until_pos(cursor_scanline, 0).as_double() + + machine().primary_screen->time_until_pos(cursor_scanline, 0).as_double() + scanline_period * cursor_hfrac); } /* Blink the cursor on or off, as appropriate. */ -static void apple1_vh_cursor_blink (running_machine &machine) +void apple1_state::apple1_vh_cursor_blink () { - apple1_state *state = machine.driver_data<apple1_state>(); int new_blink_on; /* The cursor is on for 2/3 of its blink period and off for 1/3. @@ -377,23 +369,23 @@ static void apple1_vh_cursor_blink (running_machine &machine) number of one-third-cycles elapsed, then checking the result modulo 3. */ - if (((int) (machine.time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2) + if (((int) (machine().time().as_double() / CURSOR_OFF_LENGTH)) % 3 < 2) new_blink_on = 1; else new_blink_on = 0; - if (new_blink_on != state->m_blink_on) { /* have we changed state? */ + if (new_blink_on != m_blink_on) { /* have we changed state? */ if (new_blink_on) - terminal_showcursor(state->m_terminal); + terminal_showcursor(m_terminal); else - terminal_hidecursor(state->m_terminal); - state->m_blink_on = new_blink_on; + terminal_hidecursor(m_terminal); + m_blink_on = new_blink_on; } } UINT32 apple1_state::screen_update_apple1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - apple1_vh_cursor_blink(machine()); - terminal_draw(machine(), bitmap, cliprect, m_terminal); + apple1_vh_cursor_blink(); + terminal_draw(bitmap, cliprect, m_terminal); return 0; } diff --git a/src/mess/video/apple2.c b/src/mess/video/apple2.c index d2dca0fcc35..c8b543dad2c 100644 --- a/src/mess/video/apple2.c +++ b/src/mess/video/apple2.c @@ -40,9 +40,9 @@ register -------------------------------------------------*/ -INLINE UINT32 effective_a2(apple2_state *state) +inline UINT32 apple2_state::effective_a2() { - return state->m_flags & state->m_a2_videomask; + return m_flags & m_a2_videomask; } @@ -51,7 +51,7 @@ INLINE UINT32 effective_a2(apple2_state *state) video address lookup -------------------------------------------------*/ -static UINT32 compute_video_address(int col, int row) +UINT32 apple2_state::compute_video_address(int col, int row) { /* special Apple II addressing - gotta love it */ return (((row & 0x07) << 7) | ((row & 0x18) * 5 + col)); @@ -63,7 +63,7 @@ static UINT32 compute_video_address(int col, int row) adjust_begin_and_end_row - processes the cliprect -------------------------------------------------*/ -static void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow) +void apple2_state::adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, int *endrow) { /* assumptions of the code */ assert((*beginrow % 8) == 0); @@ -88,22 +88,21 @@ static void adjust_begin_and_end_row(const rectangle &cliprect, int *beginrow, i textual character -------------------------------------------------*/ -INLINE void apple2_plot_text_character(running_machine &machine, bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, +inline void apple2_state::apple2_plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, UINT32 code, const UINT8 *textgfx_data, UINT32 textgfx_datalen, UINT32 my_a2) { - apple2_state *state = machine.driver_data<apple2_state>(); int x, y, i; - int fg = state->m_fgcolor; - int bg = state->m_bgcolor; + int fg = m_fgcolor; + int bg = m_bgcolor; const UINT8 *chardata; UINT16 color; if (my_a2 & VAR_ALTCHARSET) { /* we're using an alternate charset */ - code |= state->m_alt_charset_value; + code |= m_alt_charset_value; } - else if (state->m_flash && (code >= 0x40) && (code <= 0x7f)) + else if (m_flash && (code >= 0x40) && (code <= 0x7f)) { /* we're flashing; swap */ i = fg; @@ -115,7 +114,7 @@ INLINE void apple2_plot_text_character(running_machine &machine, bitmap_ind16 &b chardata = &textgfx_data[(code * 8) % textgfx_datalen]; /* and finally, plot the character itself */ - if (state->m_machinetype == SPACE84) + if (m_machinetype == SPACE84) { for (y = 0; y < 8; y++) { @@ -154,13 +153,12 @@ INLINE void apple2_plot_text_character(running_machine &machine, bitmap_ind16 &b column or 80 column) -------------------------------------------------*/ -static void apple2_text_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) +void apple2_state::apple2_text_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) { - apple2_state *state = machine.driver_data<apple2_state>(); int row, col; UINT32 start_address = (page ? 0x0800 : 0x0400); UINT32 address; - UINT32 my_a2 = effective_a2(state); + UINT32 my_a2 = effective_a2(); /* perform adjustments */ adjust_begin_and_end_row(cliprect, &beginrow, &endrow); @@ -174,15 +172,15 @@ static void apple2_text_draw(running_machine &machine, bitmap_ind16 &bitmap, con if (my_a2 & VAR_80COL) { - apple2_plot_text_character(machine, bitmap, col * 14 + 0, row, 1, state->m_a2_videoaux[address], - state->m_textgfx_data, state->m_textgfx_datalen, my_a2); - apple2_plot_text_character(machine, bitmap, col * 14 + 7, row, 1, state->m_a2_videoram[address], - state->m_textgfx_data, state->m_textgfx_datalen, my_a2); + apple2_plot_text_character(bitmap, col * 14 + 0, row, 1, m_a2_videoaux[address], + m_textgfx_data, m_textgfx_datalen, my_a2); + apple2_plot_text_character(bitmap, col * 14 + 7, row, 1, m_a2_videoram[address], + m_textgfx_data, m_textgfx_datalen, my_a2); } else { - apple2_plot_text_character(machine, bitmap, col * 14, row, 2, state->m_a2_videoram[address], - state->m_textgfx_data, state->m_textgfx_datalen, my_a2); + apple2_plot_text_character(bitmap, col * 14, row, 2, m_a2_videoram[address], + m_textgfx_data, m_textgfx_datalen, my_a2); } } } @@ -193,9 +191,8 @@ static void apple2_text_draw(running_machine &machine, bitmap_ind16 &bitmap, con apple2_lores_draw - renders lo-res text -------------------------------------------------*/ -static void apple2_lores_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) +void apple2_state::apple2_lores_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) { - apple2_state *state = machine.driver_data<apple2_state>(); int row, col, y, x; UINT8 code; UINT32 start_address = (page ? 0x0800 : 0x0400); @@ -212,7 +209,7 @@ static void apple2_lores_draw(running_machine &machine, bitmap_ind16 &bitmap, co address = start_address + compute_video_address(col, row / 8); /* perform the lookup */ - code = state->m_a2_videoram[address]; + code = m_a2_videoram[address]; /* and now draw */ for (y = 0; y < 4; y++) @@ -234,9 +231,8 @@ static void apple2_lores_draw(running_machine &machine, bitmap_ind16 &bitmap, co HIGH RESOLUTION GRAPHICS ***************************************************************************/ -static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) +void apple2_state::apple2_hires_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int beginrow, int endrow) { - apple2_state *state = machine.driver_data<apple2_state>(); const UINT8 *vram, *vaux; int row, col, b; int offset; @@ -255,17 +251,17 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co if (endrow < beginrow) return; - if (state->m_machinetype == TK2000) + if (m_machinetype == TK2000) { - vram = state->m_a2_videoram + (page ? 0xa000 : 0x2000); - vaux = state->m_a2_videoaux + (page ? 0xa000 : 0x2000); + vram = m_a2_videoram + (page ? 0xa000 : 0x2000); + vaux = m_a2_videoaux + (page ? 0xa000 : 0x2000); } else { - vram = state->m_a2_videoram + (page ? 0x4000 : 0x2000); - vaux = state->m_a2_videoaux + (page ? 0x4000 : 0x2000); + vram = m_a2_videoram + (page ? 0x4000 : 0x2000); + vaux = m_a2_videoaux + (page ? 0x4000 : 0x2000); } - columns = ((effective_a2(state) & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40; + columns = ((effective_a2() & (VAR_DHIRES|VAR_80COL)) == (VAR_DHIRES|VAR_80COL)) ? 80 : 40; vram_row[0] = 0; vram_row[columns + 1] = 0; @@ -304,7 +300,7 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co switch(columns) { case 40: - artifact_map_ptr = &state->m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; + artifact_map_ptr = &m_hires_artifact_map[((vram_row[col+1] & 0x80) >> 7) * 16]; for (b = 0; b < 7; b++) { v = artifact_map_ptr[((w >> (b + 7-1)) & 0x07) | (((b ^ col) & 0x01) << 3)]; @@ -314,7 +310,7 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co break; case 80: - if (state->m_monochrome_dhr) + if (m_monochrome_dhr) { for (b = 0; b < 7; b++) { @@ -327,7 +323,7 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co { for (b = 0; b < 7; b++) { - v = state->m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; + v = m_dhires_artifact_map[((((w >> (b + 7-1)) & 0x0F) * 0x11) >> (((2-(col*7+b))) & 0x03)) & 0x0F]; *(p++) = v; } } @@ -347,9 +343,8 @@ static void apple2_hires_draw(running_machine &machine, bitmap_ind16 &bitmap, co VIDEO CORE ***************************************************************************/ -void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo) +void apple2_state::apple2_video_start(const UINT8 *vram, const UINT8 *aux_vram, UINT32 ignored_softswitches, int hires_modulo) { - apple2_state *state = machine.driver_data<apple2_state>(); int i, j; UINT16 c; UINT8 *apple2_font; @@ -368,22 +363,22 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 PURPLE, LTBLUE, PINK, WHITE }; - state->m_fgcolor = 15; - state->m_bgcolor = 0; - state->m_flash = 0; - apple2_font = machine.root_device().memregion("gfx1")->base(); - state->m_alt_charset_value = machine.root_device().memregion("gfx1")->bytes() / 16; - state->m_a2_videoram = vram; - state->m_a2_videoaux = aux_vram; + m_fgcolor = 15; + m_bgcolor = 0; + m_flash = 0; + apple2_font = machine().root_device().memregion("gfx1")->base(); + m_alt_charset_value = machine().root_device().memregion("gfx1")->bytes() / 16; + m_a2_videoram = vram; + m_a2_videoaux = aux_vram; - state->m_textgfx_data = machine.root_device().memregion("gfx1")->base(); - state->m_textgfx_datalen = state->memregion("gfx1")->bytes(); + m_textgfx_data = machine().root_device().memregion("gfx1")->base(); + m_textgfx_datalen = memregion("gfx1")->bytes(); /* 2^3 dependent pixels * 2 color sets * 2 offsets */ - state->m_hires_artifact_map = auto_alloc_array(machine, UINT16, 8 * 2 * 2); + m_hires_artifact_map = auto_alloc_array(machine(), UINT16, 8 * 2 * 2); /* 2^4 dependent pixels */ - state->m_dhires_artifact_map = auto_alloc_array(machine, UINT16, 16); + m_dhires_artifact_map = auto_alloc_array(machine(), UINT16, 16); /* build hires artifact map */ for (i = 0; i < 8; i++) @@ -404,14 +399,14 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 else c = 0; } - state->m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo]; - state->m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo]; + m_hires_artifact_map[ 0 + j*8 + i] = hires_artifact_color_table[(c + 0) % hires_modulo]; + m_hires_artifact_map[16 + j*8 + i] = hires_artifact_color_table[(c + 4) % hires_modulo]; } } /* Fix for Ivel Ultra */ - if (!strcmp(machine.system().name, "ivelultr")) { - int len = machine.root_device().memregion("gfx1")->bytes(); + if (!strcmp(machine().system().name, "ivelultr")) { + int len = machine().root_device().memregion("gfx1")->bytes(); for (i = 0; i < len; i++) { apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1); @@ -419,14 +414,14 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 } /* do we need to flip the gfx? */ - if (!strcmp(machine.system().name, "apple2") - || !strcmp(machine.system().name, "apple2p") - || !strcmp(machine.system().name, "prav82") - || !strcmp(machine.system().name, "prav8m") - || !strcmp(machine.system().name, "ace100") - || !strcmp(machine.system().name, "apple2jp")) + if (!strcmp(machine().system().name, "apple2") + || !strcmp(machine().system().name, "apple2p") + || !strcmp(machine().system().name, "prav82") + || !strcmp(machine().system().name, "prav8m") + || !strcmp(machine().system().name, "ace100") + || !strcmp(machine().system().name, "apple2jp")) { - int len = machine.root_device().memregion("gfx1")->bytes(); + int len = machine().root_device().memregion("gfx1")->bytes(); for (i = 0; i < len; i++) { apple2_font[i] = BITSWAP8(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6); @@ -437,18 +432,18 @@ void apple2_video_start(running_machine &machine, const UINT8 *vram, const UINT8 /* build double hires artifact map */ for (i = 0; i < 16; i++) { - state->m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; + m_dhires_artifact_map[i] = dhires_artifact_color_table[i]; } - memset(&state->m_old_a2, 0, sizeof(state->m_old_a2)); - state->m_a2_videomask = ~ignored_softswitches; + memset(&m_old_a2, 0, sizeof(m_old_a2)); + m_a2_videomask = ~ignored_softswitches; } VIDEO_START_MEMBER(apple2_state,apple2) { - apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer()+0x10000, VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4); + apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 4); /* hack to fix the colors on apple2/apple2p */ m_fgcolor = 0; @@ -460,7 +455,7 @@ VIDEO_START_MEMBER(apple2_state,apple2) VIDEO_START_MEMBER(apple2_state,apple2p) { - apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8); + apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_ALTCHARSET | VAR_DHIRES, 8); /* hack to fix the colors on apple2/apple2p */ m_fgcolor = 0; @@ -475,18 +470,18 @@ VIDEO_START_MEMBER(apple2_state,apple2e) device_a2eauxslot_card_interface *auxslotdevice = m_a2eauxslot->get_a2eauxslot_card(); if (auxslotdevice) { - apple2_video_start(machine(), m_ram->pointer(), auxslotdevice->get_vram_ptr(), auxslotdevice->allow_dhr() ? 0 : VAR_DHIRES, 8); + apple2_video_start(m_ram->pointer(), auxslotdevice->get_vram_ptr(), auxslotdevice->allow_dhr() ? 0 : VAR_DHIRES, 8); } else { - apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_DHIRES, 8); + apple2_video_start(m_ram->pointer(), m_ram->pointer(), VAR_80COL | VAR_DHIRES, 8); } } VIDEO_START_MEMBER(apple2_state,apple2c) { - apple2_video_start(machine(), m_ram->pointer(), m_ram->pointer()+0x10000, 0, 8); + apple2_video_start(m_ram->pointer(), m_ram->pointer()+0x10000, 0, 8); } UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -498,7 +493,7 @@ UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &b m_flash = ((machine().time() * 4).seconds & 1) ? 1 : 0; /* read out relevant softswitch variables; to see what has changed */ - new_a2 = effective_a2(this); + new_a2 = effective_a2(); if (new_a2 & VAR_80STORE) new_a2 &= ~VAR_PAGE2; new_a2 &= VAR_TEXT | VAR_MIXED | VAR_HIRES | VAR_DHIRES | VAR_80COL | VAR_PAGE2 | VAR_ALTCHARSET; @@ -512,39 +507,39 @@ UINT32 apple2_state::screen_update_apple2(screen_device &screen, bitmap_ind16 &b page = (new_a2 & VAR_PAGE2) ? 1 : 0; /* choose the video mode to draw */ - if (effective_a2(this) & VAR_TEXT) + if (effective_a2() & VAR_TEXT) { /* text screen - TK2000 uses HGR for text */ if (m_machinetype == TK2000) { - apple2_hires_draw(machine(), bitmap, cliprect, page, 0, 191); + apple2_hires_draw(bitmap, cliprect, page, 0, 191); } else { - apple2_text_draw(machine(), bitmap, cliprect, page, 0, 191); + apple2_text_draw(bitmap, cliprect, page, 0, 191); } } - else if ((effective_a2(this) & VAR_HIRES) && (effective_a2(this) & VAR_MIXED)) + else if ((effective_a2() & VAR_HIRES) && (effective_a2() & VAR_MIXED)) { /* hi-res on top; text at bottom */ - apple2_hires_draw(machine(), bitmap, cliprect, page, 0, 159); - apple2_text_draw(machine(), bitmap, cliprect, page, 160, 191); + apple2_hires_draw(bitmap, cliprect, page, 0, 159); + apple2_text_draw(bitmap, cliprect, page, 160, 191); } - else if (effective_a2(this) & VAR_HIRES) + else if (effective_a2() & VAR_HIRES) { /* hi-res screen */ - apple2_hires_draw(machine(), bitmap, cliprect, page, 0, 191); + apple2_hires_draw(bitmap, cliprect, page, 0, 191); } - else if (effective_a2(this) & VAR_MIXED) + else if (effective_a2() & VAR_MIXED) { /* lo-res on top; text at bottom */ - apple2_lores_draw(machine(), bitmap, cliprect, page, 0, 159); - apple2_text_draw(machine(), bitmap, cliprect, page, 160, 191); + apple2_lores_draw(bitmap, cliprect, page, 0, 159); + apple2_text_draw(bitmap, cliprect, page, 160, 191); } else { /* lo-res screen */ - apple2_lores_draw(machine(), bitmap, cliprect, page, 0, 191); + apple2_lores_draw(bitmap, cliprect, page, 0, 191); } return 0; } diff --git a/src/mess/video/apple2gs.c b/src/mess/video/apple2gs.c index d80f28a07e4..f9d35936c3c 100644 --- a/src/mess/video/apple2gs.c +++ b/src/mess/video/apple2gs.c @@ -16,7 +16,7 @@ VIDEO_START_MEMBER(apple2gs_state,apple2gs) { m_bordercolor = 0; - apple2_video_start(machine(), m_slowmem, m_slowmem+0x10000, 0, 8); + apple2_video_start(m_slowmem, m_slowmem+0x10000, 0, 8); m_legacy_gfx = auto_bitmap_ind16_alloc(machine(), 560, 192); state_save_register_item(machine(), "BORDERCLR", NULL, 0, m_bordercolor); diff --git a/src/mess/video/apple3.c b/src/mess/video/apple3.c index c7813168599..53f7319ad9a 100644 --- a/src/mess/video/apple3.c +++ b/src/mess/video/apple3.c @@ -37,10 +37,9 @@ static const UINT32 text_map[] = }; -void apple3_write_charmem(running_machine &machine) +void apple3_state::apple3_write_charmem() { - apple3_state *state = machine.driver_data<apple3_state>(); - address_space& space = state->m_maincpu->space(AS_PROGRAM); + address_space& space = m_maincpu->space(AS_PROGRAM); static const UINT32 screen_hole_map[] = { 0x478, 0x4f8, 0x578, 0x5f8, 0x678, 0x6f8, 0x778, 0x7f8 @@ -54,11 +53,11 @@ void apple3_write_charmem(running_machine &machine) { addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 0); val = space.read_byte(screen_hole_map[i] + j + 0); - state->m_char_mem[((addr * 8) + ((i & 3) * 2) + 0) & 0x3ff] = val; + m_char_mem[((addr * 8) + ((i & 3) * 2) + 0) & 0x3ff] = val; addr = 0x7f & space.read_byte(screen_hole_map[i] + 0x400 + j + 4); val = space.read_byte(screen_hole_map[i] + j + 4); - state->m_char_mem[((addr * 8) + ((i & 3) * 2) + 1) & 0x3ff] = val; + m_char_mem[((addr * 8) + ((i & 3) * 2) + 1) & 0x3ff] = val; } } } @@ -86,29 +85,28 @@ VIDEO_START_MEMBER(apple3_state,apple3) -static void apple3_video_text40(running_machine &machine,bitmap_ind16 &bitmap) +void apple3_state::apple3_video_text40(bitmap_ind16 &bitmap) { - apple3_state *state = machine.driver_data<apple3_state>(); int x, y, col, row; offs_t offset; UINT8 ch; const UINT8 *char_data; pen_t fg, bg, temp; UINT16 *dest; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); - UINT32 ram_size = machine.device<ram_device>(RAM_TAG)->size(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); + UINT32 ram_size = machine().device<ram_device>(RAM_TAG)->size(); for (y = 0; y < 24; y++) { for (x = 0; x < 40; x++) { - offset = ram_size - 0x8000 + text_map[y] + x + (state->m_flags & VAR_VM2 ? 0x0400 : 0x0000); + offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0400 : 0x0000); ch = ram[offset]; - if (state->m_flags & VAR_VM0) + if (m_flags & VAR_VM0) { /* color text */ - offset = ram_size - 0x8000 + text_map[y] + x + (state->m_flags & VAR_VM2 ? 0x0000 : 0x0400); + offset = ram_size - 0x8000 + text_map[y] + x + (m_flags & VAR_VM2 ? 0x0000 : 0x0400); bg = (ram[offset] >> 0) & 0x0F; fg = (ram[offset] >> 4) & 0x0F; } @@ -127,7 +125,7 @@ static void apple3_video_text40(running_machine &machine,bitmap_ind16 &bitmap) bg = temp; } - char_data = &state->m_char_mem[(ch & 0x7F) * 8]; + char_data = &m_char_mem[(ch & 0x7F) * 8]; for (row = 0; row < 8; row++) { @@ -144,17 +142,16 @@ static void apple3_video_text40(running_machine &machine,bitmap_ind16 &bitmap) -static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap) +void apple3_state::apple3_video_text80(bitmap_ind16 &bitmap) { - apple3_state *state = machine.driver_data<apple3_state>(); int x, y, col, row; offs_t offset; UINT8 ch; const UINT8 *char_data; pen_t fg, bg; UINT16 *dest; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); - UINT32 ram_size = machine.device<ram_device>(RAM_TAG)->size(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); + UINT32 ram_size = machine().device<ram_device>(RAM_TAG)->size(); for (y = 0; y < 24; y++) { @@ -164,7 +161,7 @@ static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap) /* first character */ ch = ram[offset + 0x0000]; - char_data = &state->m_char_mem[(ch & 0x7F) * 8]; + char_data = &m_char_mem[(ch & 0x7F) * 8]; fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; @@ -179,7 +176,7 @@ static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap) /* second character */ ch = ram[offset + 0x0400]; - char_data = &state->m_char_mem[(ch & 0x7F) * 8]; + char_data = &m_char_mem[(ch & 0x7F) * 8]; fg = (ch & 0x80) ? GREEN : BLACK; bg = (ch & 0x80) ? BLACK : GREEN; @@ -197,22 +194,21 @@ static void apple3_video_text80(running_machine &machine,bitmap_ind16 &bitmap) -static void apple3_video_graphics_hgr(running_machine &machine,bitmap_ind16 &bitmap) +void apple3_state::apple3_video_graphics_hgr(bitmap_ind16 &bitmap) { - apple3_state *state = machine.driver_data<apple3_state>(); /* hi-res mode: 280x192x2 */ int y, i, x; const UINT8 *pix_info; UINT16 *ptr; UINT8 b; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); for (y = 0; y < 192; y++) { - if (state->m_flags & VAR_VM2) - pix_info = &ram[state->m_hgr_map[y]]; + if (m_flags & VAR_VM2) + pix_info = &ram[m_hgr_map[y]]; else - pix_info = &ram[state->m_hgr_map[y] - 0x2000]; + pix_info = &ram[m_hgr_map[y] - 0x2000]; ptr = &bitmap.pix16(y); for (i = 0; i < 40; i++) @@ -231,7 +227,7 @@ static void apple3_video_graphics_hgr(running_machine &machine,bitmap_ind16 &bit -static UINT8 swap_bits(UINT8 b) +UINT8 apple3_state::swap_bits(UINT8 b) { return (b & 0x08 ? 0x01 : 0x00) | (b & 0x04 ? 0x02 : 0x00) @@ -241,9 +237,8 @@ static UINT8 swap_bits(UINT8 b) -static void apple3_video_graphics_chgr(running_machine &machine,bitmap_ind16 &bitmap) +void apple3_state::apple3_video_graphics_chgr(bitmap_ind16 &bitmap) { - apple3_state *state = machine.driver_data<apple3_state>(); /* color hi-res mode: 280x192x16 */ int y, i, x; const UINT8 *pix_info; @@ -251,19 +246,19 @@ static void apple3_video_graphics_chgr(running_machine &machine,bitmap_ind16 &bi UINT16 *ptr; UINT8 b; UINT16 fgcolor, bgcolor; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); for (y = 0; y < 192; y++) { - if (state->m_flags & VAR_VM2) + if (m_flags & VAR_VM2) { - pix_info = &ram[state->m_hgr_map[y]]; - col_info = &ram[state->m_hgr_map[y] - 0x2000]; + pix_info = &ram[m_hgr_map[y]]; + col_info = &ram[m_hgr_map[y] - 0x2000]; } else { - pix_info = &ram[state->m_hgr_map[y] - 0x2000]; - col_info = &ram[state->m_hgr_map[y]]; + pix_info = &ram[m_hgr_map[y] - 0x2000]; + col_info = &ram[m_hgr_map[y]]; } ptr = &bitmap.pix16(y); @@ -288,28 +283,27 @@ static void apple3_video_graphics_chgr(running_machine &machine,bitmap_ind16 &bi -static void apple3_video_graphics_shgr(running_machine &machine,bitmap_ind16 &bitmap) +void apple3_state::apple3_video_graphics_shgr(bitmap_ind16 &bitmap) { - apple3_state *state = machine.driver_data<apple3_state>(); /* super hi-res mode: 560x192x2 */ int y, i, x; const UINT8 *pix_info1; const UINT8 *pix_info2; UINT16 *ptr; UINT8 b1, b2; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); for (y = 0; y < 192; y++) { - if (state->m_flags & VAR_VM2) + if (m_flags & VAR_VM2) { - pix_info1 = &ram[state->m_hgr_map[y]]; - pix_info2 = &ram[state->m_hgr_map[y] + 0x2000]; + pix_info1 = &ram[m_hgr_map[y]]; + pix_info2 = &ram[m_hgr_map[y] + 0x2000]; } else { - pix_info1 = &ram[state->m_hgr_map[y] - 0x2000]; - pix_info2 = &ram[state->m_hgr_map[y]]; + pix_info1 = &ram[m_hgr_map[y] - 0x2000]; + pix_info2 = &ram[m_hgr_map[y]]; } ptr = &bitmap.pix16(y); @@ -331,23 +325,22 @@ static void apple3_video_graphics_shgr(running_machine &machine,bitmap_ind16 &bi -static void apple3_video_graphics_chires(running_machine &machine,bitmap_ind16 &bitmap) +void apple3_state::apple3_video_graphics_chires(bitmap_ind16 &bitmap) { - apple3_state *state = machine.driver_data<apple3_state>(); UINT16 *pen; PAIR pix; int y, i; - UINT8 *ram = machine.device<ram_device>(RAM_TAG)->pointer(); + UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); for (y = 0; y < 192; y++) { pen = &bitmap.pix16(y); for (i = 0; i < 20; i++) { - pix.b.l = ram[state->m_hgr_map[y] - 0x2000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 0]; - pix.b.h = ram[state->m_hgr_map[y] - 0x0000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 0]; - pix.b.h2 = ram[state->m_hgr_map[y] - 0x2000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 1]; - pix.b.h3 = ram[state->m_hgr_map[y] - 0x0000 + (i * 2) + (state->m_flags & VAR_VM2 ? 1 : 0) + 1]; + pix.b.l = ram[m_hgr_map[y] - 0x2000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 0]; + pix.b.h = ram[m_hgr_map[y] - 0x0000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 0]; + pix.b.h2 = ram[m_hgr_map[y] - 0x2000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 1]; + pix.b.h3 = ram[m_hgr_map[y] - 0x0000 + (i * 2) + (m_flags & VAR_VM2 ? 1 : 0) + 1]; pen[ 0] = pen[ 1] = pen[ 2] = pen[ 3] = ((pix.d >> 0) & 0x0F); pen[ 4] = pen[ 5] = pen[ 6] = pen[ 7] = ((pix.d >> 4) & 0x07) | ((pix.d >> 1) & 0x08); @@ -369,28 +362,28 @@ UINT32 apple3_state::screen_update_apple3(screen_device &screen, bitmap_ind16 &b { case 0: case VAR_VM0: - apple3_video_text40(machine(),bitmap); + apple3_video_text40(bitmap); break; case VAR_VM1: case VAR_VM1|VAR_VM0: - apple3_video_text80(machine(),bitmap); + apple3_video_text80(bitmap); break; case VAR_VM3: - apple3_video_graphics_hgr(machine(),bitmap); /* hgr mode */ + apple3_video_graphics_hgr(bitmap); /* hgr mode */ break; case VAR_VM3|VAR_VM0: - apple3_video_graphics_chgr(machine(),bitmap); + apple3_video_graphics_chgr(bitmap); break; case VAR_VM3|VAR_VM1: - apple3_video_graphics_shgr(machine(),bitmap); + apple3_video_graphics_shgr(bitmap); break; case VAR_VM3|VAR_VM1|VAR_VM0: - apple3_video_graphics_chires(machine(),bitmap); + apple3_video_graphics_chires(bitmap); break; } return 0; diff --git a/src/mess/video/bbc.c b/src/mess/video/bbc.c index 10779db8bbb..9b13c799a07 100644 --- a/src/mess/video/bbc.c +++ b/src/mess/video/bbc.c @@ -163,18 +163,18 @@ WRITE8_MEMBER(bbc_state::bbc_videoULA_w) // VideoULA Internal Cursor controls /* -static void set_cursor(bbc_state *state) +void bbc_state::set_cursor(bbc_state *state) { - state->m_cursor_state=state->m_VideoULA_CR?0:7; + m_cursor_state=m_VideoULA_CR?0:7; } -static void BBC_Clock_CR(bbc_state *state) +void bbc_state::BBC_Clock_CR(bbc_state *state) { - if (state->m_VideoULA_CR) + if (m_VideoULA_CR) { - state->m_VideoULA_CR_counter-=1; - if (state->m_VideoULA_CR_counter<=0) { - state->m_VideoULA_CR=0; + m_VideoULA_CR_counter-=1; + if (m_VideoULA_CR_counter<=0) { + m_VideoULA_CR=0; set_cursor(state); } } @@ -395,27 +395,26 @@ static void BBC_draw_teletext(running_machine &machine); -static void BBC_draw_teletext(running_machine &machine) +void bbc_state::BBC_draw_teletext() { - bbc_state *state = machine.driver_data<bbc_state>(); //Teletext Latch bits 0 to 5 go to bits 0 to 5 on the Teletext chip //Teletext Latch bit 6 is only passed onto bits 6 on the Teletext chip if DE is true //Teletext Latch bit 7 goes to LOSE on the Teletext chip - teletext_LOSE_w(state->m_saa505x, 0, (state->m_Teletext_Latch>>7)&1); + teletext_LOSE_w(m_saa505x, 0, (m_Teletext_Latch>>7)&1); - teletext_F1(state->m_saa505x); + teletext_F1(m_saa505x); - teletext_data_w(state->m_saa505x, 0, (state->m_Teletext_Latch&0x3f)|((state->m_Teletext_Latch&0x40)|(m6845_display_enabled_r(0)?0:0x40))); + teletext_data_w(m_saa505x, 0, (m_Teletext_Latch&0x3f)|((m_Teletext_Latch&0x40)|(m6845_display_enabled_r(0)?0:0x40))); int meml=m6845_memory_address_r(0); if (((meml>>13)&1)==0) { - state->m_Teletext_Latch=0; + m_Teletext_Latch=0; } else { - state->m_Teletext_Latch=(state->m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|(m6845_display_enabled_r(0)?0x80:0); + m_Teletext_Latch=(m_BBC_Video_RAM[calculate_video_address(state,meml)]&0x7f)|(m6845_display_enabled_r(0)?0x80:0); } } @@ -426,20 +425,20 @@ static void BBC_draw_teletext(running_machine &machine) // This is the actual output of the Video ULA this fuction does all the output to the screen in the BBC emulator -static void BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels) +void bbc_state::BBC_ula_drawpixel(bbc_state *state, int col, int number_of_pixels) { int pixel_count; int pixel_temp; - if ((state->m_BBC_display>=state->m_BBC_display_left) && ((state->m_BBC_display+number_of_pixels)<state->m_BBC_display_right)) + if ((m_BBC_display>=m_BBC_display_left) && ((m_BBC_display+number_of_pixels)<m_BBC_display_right)) { - pixel_temp=col^state->m_cursor_state; + pixel_temp=col^m_cursor_state; for(pixel_count=0;pixel_count<number_of_pixels;pixel_count++) { - *(state->m_BBC_display++) = pixel_temp; + *(m_BBC_display++) = pixel_temp; } } else { - state->m_BBC_display += number_of_pixels; + m_BBC_display += number_of_pixels; } } @@ -463,9 +462,8 @@ static const struct m6845_interface BBC6845 = -static void BBC_draw_hi_res(running_machine &machine) +void bbc_state::BBC_draw_hi_res() { - bbc_state *state = machine.driver_data<bbc_state>(); int meml; unsigned char i=0; int sc1; @@ -478,17 +476,17 @@ static void BBC_draw_hi_res(running_machine &machine) // read the memory location for the next screen location. meml=calculate_video_address(state,m6845_memory_address_r(0)); - i=state->m_BBC_Video_RAM[meml]; + i=m_BBC_Video_RAM[meml]; - for(sc1=0;sc1<state->m_pixels_per_byte;sc1++) + for(sc1=0;sc1<m_pixels_per_byte;sc1++) { - BBC_ula_drawpixel(state, state->m_videoULA_pallet_lookup[state->m_pixel_bits[i]], state->m_emulation_pixels_per_real_pixel); + BBC_ula_drawpixel(state, m_videoULA_pallet_lookup[m_pixel_bits[i]], m_emulation_pixels_per_real_pixel); i=(i<<1)|1; } } else { // if the display is not enable, just draw a blank area. - BBC_ula_drawpixel(state, 0, state->m_emulation_pixels_per_byte); + BBC_ula_drawpixel(state, 0, m_emulation_pixels_per_byte); } } @@ -507,64 +505,61 @@ void bbc_draw_RGB_in(device_t *device, int offset,int data) // called when the 6845 changes the HSync -static void BBC_Set_HSync(running_machine &machine, int offset, int data) +void bbc_state::BBC_Set_HSync(int offset, int data) { - bbc_state *state = machine.driver_data<bbc_state>(); // catch the falling edge - if((!data)&&(state->m_BBC_HSync)) + if((!data)&&(m_BBC_HSync)) { - state->m_y_screen_pos+=1; + m_y_screen_pos+=1; - if ((state->m_y_screen_pos>=0) && (state->m_y_screen_pos<300)) + if ((m_y_screen_pos>=0) && (m_y_screen_pos<300)) { - state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(state->m_y_screen_pos); - state->m_BBC_display_right = state->m_BBC_display_left + 800; + m_BBC_display_left = &m_BBC_bitmap->pix16(m_y_screen_pos); + m_BBC_display_right = m_BBC_display_left + 800; } else { - state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(0); - state->m_BBC_display_right = state->m_BBC_display_left; + m_BBC_display_left = &m_BBC_bitmap->pix16(0); + m_BBC_display_right = m_BBC_display_left; } - state->m_BBC_display = state->m_BBC_display_left + state->m_x_screen_offset; + m_BBC_display = m_BBC_display_left + m_x_screen_offset; } - state->m_BBC_HSync=data; + m_BBC_HSync=data; } // called when the 6845 changes the VSync -static void BBC_Set_VSync(running_machine &machine, int offset, int data) +void bbc_state::BBC_Set_VSync(int offset, int data) { - bbc_state *state = machine.driver_data<bbc_state>(); // catch the falling edge - if ((!data)&&(state->m_BBC_VSync)) + if ((!data)&&(m_BBC_VSync)) { - state->m_y_screen_pos=state->m_y_screen_offset; + m_y_screen_pos=m_y_screen_offset; - if ((state->m_y_screen_pos>=0) && (state->m_y_screen_pos<300)) + if ((m_y_screen_pos>=0) && (m_y_screen_pos<300)) { - state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(state->m_y_screen_pos); - state->m_BBC_display_right = state->m_BBC_display_left + 800; + m_BBC_display_left = &m_BBC_bitmap->pix16(m_y_screen_pos); + m_BBC_display_right = m_BBC_display_left + 800; } else { - state->m_BBC_display_left = &state->m_BBC_bitmap->pix16(0); - state->m_BBC_display_right = state->m_BBC_display_left; + m_BBC_display_left = &m_BBC_bitmap->pix16(0); + m_BBC_display_right = m_BBC_display_left; } - state->m_BBC_display = state->m_BBC_display_left + state->m_x_screen_offset; + m_BBC_display = m_BBC_display_left + m_x_screen_offset; - teletext_DEW(state->m_saa505x); + teletext_DEW(m_saa505x); } - state->m_BBC_VSync=data; + m_BBC_VSync=data; } // called when the 6845 changes the Cursor Enabled -static void BBC_Set_CRE(running_machine &machine, int offset, int data) +void bbc_state::BBC_Set_CRE(int offset, int data) { - bbc_state *state = machine.driver_data<bbc_state>(); if (data&2) { - state->m_VideoULA_CR_counter=state->m_emulation_cursor_size; - state->m_VideoULA_CR=1; + m_VideoULA_CR_counter=m_emulation_cursor_size; + m_VideoULA_CR=1; // set the pallet on if (data&1) set_cursor(state); } @@ -651,7 +646,7 @@ UINT32 bbc_state::screen_update_bbc(screen_device &screen, bitmap_ind16 &bitmap, return 0; } -void bbc_frameclock(running_machine &machine) +void bbc_state::bbc_frameclock() { m6845_frameclock(); } diff --git a/src/mess/video/cgenie.c b/src/mess/video/cgenie.c index 14cb56f36ea..2147e477d19 100644 --- a/src/mess/video/cgenie.c +++ b/src/mess/video/cgenie.c @@ -32,24 +32,24 @@ void cgenie_state::video_start() current register settings of the 6845 CRTC ***************************************************************************/ -static void cgenie_offset_xy(cgenie_state *state) +void cgenie_state::cgenie_offset_xy() { - if( state->m_crt.horizontal_sync_pos ) - state->m_off_x = state->m_crt.horizontal_total - state->m_crt.horizontal_sync_pos - 14; + if( m_crt.horizontal_sync_pos ) + m_off_x = m_crt.horizontal_total - m_crt.horizontal_sync_pos - 14; else - state->m_off_x = -15; + m_off_x = -15; - state->m_off_y = (state->m_crt.vertical_total - state->m_crt.vertical_sync_pos) * - (state->m_crt.scan_lines + 1) + state->m_crt.vertical_adjust + m_off_y = (m_crt.vertical_total - m_crt.vertical_sync_pos) * + (m_crt.scan_lines + 1) + m_crt.vertical_adjust - 32; - if( state->m_off_y < 0 ) - state->m_off_y = 0; + if( m_off_y < 0 ) + m_off_y = 0; - if( state->m_off_y > 128 ) - state->m_off_y = 128; + if( m_off_y > 128 ) + m_off_y = 128; -// logerror("cgenie offset x:%d y:%d\n", state->m_off_x, state->m_off_y); +// logerror("cgenie offset x:%d y:%d\n", m_off_x, m_off_y); } @@ -67,7 +67,7 @@ WRITE8_HANDLER ( cgenie_register_w ) if( state->m_crt.horizontal_total == data ) break; state->m_crt.horizontal_total = data; - cgenie_offset_xy(state); + state->cgenie_offset_xy(); break; case 1: if( state->m_crt.horizontal_displayed == data ) @@ -78,7 +78,7 @@ WRITE8_HANDLER ( cgenie_register_w ) if( state->m_crt.horizontal_sync_pos == data ) break; state->m_crt.horizontal_sync_pos = data; - cgenie_offset_xy(state); + state->cgenie_offset_xy(); break; case 3: state->m_crt.horizontal_length = data; @@ -87,13 +87,13 @@ WRITE8_HANDLER ( cgenie_register_w ) if( state->m_crt.vertical_total == data ) break; state->m_crt.vertical_total = data; - cgenie_offset_xy(state); + state->cgenie_offset_xy(); break; case 5: if( state->m_crt.vertical_adjust == data ) break; state->m_crt.vertical_adjust = data; - cgenie_offset_xy(state); + state->cgenie_offset_xy(); break; case 6: if( state->m_crt.vertical_displayed == data ) @@ -104,7 +104,7 @@ WRITE8_HANDLER ( cgenie_register_w ) if( state->m_crt.vertical_sync_pos == data ) break; state->m_crt.vertical_sync_pos = data; - cgenie_offset_xy(state); + state->cgenie_offset_xy(); break; case 8: state->m_crt.crt_mode = data; @@ -114,7 +114,7 @@ WRITE8_HANDLER ( cgenie_register_w ) if( state->m_crt.scan_lines == data ) break; state->m_crt.scan_lines = data; - cgenie_offset_xy(state); + state->cgenie_offset_xy(); break; case 10: if( state->m_crt.cursor_top == data ) @@ -167,52 +167,51 @@ WRITE8_HANDLER ( cgenie_index_w ) /*************************************************************************** Read from an indexed register of the 6845 CRTC ***************************************************************************/ - READ8_HANDLER ( cgenie_register_r ) +READ8_HANDLER ( cgenie_register_r ) { cgenie_state *state = space.machine().driver_data<cgenie_state>(); - return cgenie_get_register(space.machine(), state->m_crt.idx); + return state->cgenie_get_register(state->m_crt.idx); } /*************************************************************************** Read from a register of the 6845 CRTC ***************************************************************************/ -int cgenie_get_register(running_machine &machine, int indx) +int cgenie_state::cgenie_get_register(int indx) { - cgenie_state *state = machine.driver_data<cgenie_state>(); switch (indx) { case 0: - return state->m_crt.horizontal_total; + return m_crt.horizontal_total; case 1: - return state->m_crt.horizontal_displayed; + return m_crt.horizontal_displayed; case 2: - return state->m_crt.horizontal_sync_pos; + return m_crt.horizontal_sync_pos; case 3: - return state->m_crt.horizontal_length; + return m_crt.horizontal_length; case 4: - return state->m_crt.vertical_total; + return m_crt.vertical_total; case 5: - return state->m_crt.vertical_adjust; + return m_crt.vertical_adjust; case 6: - return state->m_crt.vertical_displayed; + return m_crt.vertical_displayed; case 7: - return state->m_crt.vertical_sync_pos; + return m_crt.vertical_sync_pos; case 8: - return state->m_crt.crt_mode; + return m_crt.crt_mode; case 9: - return state->m_crt.scan_lines; + return m_crt.scan_lines; case 10: - return state->m_crt.cursor_top; + return m_crt.cursor_top; case 11: - return state->m_crt.cursor_bottom; + return m_crt.cursor_bottom; case 12: - return state->m_crt.screen_address_hi; + return m_crt.screen_address_hi; case 13: - return state->m_crt.screen_address_lo; + return m_crt.screen_address_lo; case 14: - return state->m_crt.cursor_address_hi; + return m_crt.cursor_address_hi; case 15: - return state->m_crt.cursor_address_lo; + return m_crt.cursor_address_lo; } return 0; } @@ -229,27 +228,25 @@ int cgenie_get_register(running_machine &machine, int indx) /*************************************************************************** Switch mode between character generator and graphics ***************************************************************************/ -void cgenie_mode_select(running_machine &machine, int mode) +void cgenie_state::cgenie_mode_select(int mode) { - cgenie_state *state = machine.driver_data<cgenie_state>(); - state->m_graphics = (mode) ? 1 : 0; + m_graphics = (mode) ? 1 : 0; } -static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void cgenie_state::cgenie_refresh_monitor(bitmap_ind16 &bitmap, const rectangle &cliprect) { - cgenie_state *state = machine.driver_data<cgenie_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; int i, address, offset, cursor, size, code, x, y; rectangle r; - bitmap.fill(get_black_pen(machine), cliprect); + bitmap.fill(get_black_pen(machine()), cliprect); - if(state->m_crt.vertical_displayed || state->m_crt.horizontal_displayed) + if(m_crt.vertical_displayed || m_crt.horizontal_displayed) { - offset = 256 * state->m_crt.screen_address_hi + state->m_crt.screen_address_lo; - size = state->m_crt.horizontal_displayed * state->m_crt.vertical_displayed; - cursor = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo; + offset = 256 * m_crt.screen_address_hi + m_crt.screen_address_lo; + size = m_crt.horizontal_displayed * m_crt.vertical_displayed; + cursor = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo; /* * for every character in the Video RAM, check if it has been modified since @@ -258,19 +255,19 @@ static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitma for( address = 0; address < size; address++ ) { i = (offset + address) & 0x3fff; - x = address % state->m_crt.horizontal_displayed + state->m_off_x; - y = address / state->m_crt.horizontal_displayed; + x = address % m_crt.horizontal_displayed + m_off_x; + y = address / m_crt.horizontal_displayed; r.min_x = x * 8; r.max_x = r.min_x + 7; - r.min_y = y * (state->m_crt.scan_lines + 1) + state->m_off_y; - r.max_y = r.min_y + state->m_crt.scan_lines; + r.min_y = y * (m_crt.scan_lines + 1) + m_off_y; + r.max_y = r.min_y + m_crt.scan_lines; - if( state->m_graphics ) + if( m_graphics ) { /* get graphics code */ code = videoram[i]; - drawgfx_opaque(bitmap, r, machine.gfx[1], code, 0, + drawgfx_opaque(bitmap, r, machine().gfx[1], code, 0, 0, 0, r.min_x, r.min_y); } else @@ -279,8 +276,8 @@ static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitma code = videoram[i]; /* translate defined character sets */ - code += state->m_font_offset[(code >> 6) & 3]; - drawgfx_opaque(bitmap, r, machine.gfx[0], code, state->m_colorram[i&0x3ff], + code += m_font_offset[(code >> 6) & 3]; + drawgfx_opaque(bitmap, r, machine().gfx[0], code, m_colorram[i&0x3ff], 0, 0, r.min_x, r.min_y); } @@ -289,48 +286,47 @@ static void cgenie_refresh_monitor(running_machine &machine, bitmap_ind16 &bitma rectangle rc; /* check if cursor turned off */ - if( (state->m_crt.cursor_top & 0x60) == 0x20 ) + if( (m_crt.cursor_top & 0x60) == 0x20 ) continue; - if( (state->m_crt.cursor_top & 0x60) == 0x60 ) + if( (m_crt.cursor_top & 0x60) == 0x60 ) { - state->m_crt.cursor_visible = 1; + m_crt.cursor_visible = 1; } else { - state->m_crt.cursor_phase++; - state->m_crt.cursor_visible = (state->m_crt.cursor_phase >> 3) & 1; + m_crt.cursor_phase++; + m_crt.cursor_visible = (m_crt.cursor_phase >> 3) & 1; } - if( !state->m_crt.cursor_visible ) + if( !m_crt.cursor_visible ) continue; rc.min_x = r.min_x; rc.max_x = r.max_x; - rc.min_y = r.min_y + (state->m_crt.cursor_top & 15); - rc.max_y = r.min_y + (state->m_crt.cursor_bottom & 15); - drawgfx_opaque(bitmap, rc, machine.gfx[0], 0x7f, state->m_colorram[i&0x3ff], + rc.min_y = r.min_y + (m_crt.cursor_top & 15); + rc.max_y = r.min_y + (m_crt.cursor_bottom & 15); + drawgfx_opaque(bitmap, rc, machine().gfx[0], 0x7f, m_colorram[i&0x3ff], 0, 0, rc.min_x, rc.min_y); } } } } -static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void cgenie_state::cgenie_refresh_tv_set(bitmap_ind16 &bitmap, const rectangle &cliprect) { - cgenie_state *state = machine.driver_data<cgenie_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; int i, address, offset, cursor, size, code, x, y; rectangle r; - state->m_bitmap.fill(get_black_pen(machine), cliprect); - state->m_dlybitmap.fill(get_black_pen(machine), cliprect); + m_bitmap.fill(get_black_pen(machine()), cliprect); + m_dlybitmap.fill(get_black_pen(machine()), cliprect); - if(state->m_crt.vertical_displayed || state->m_crt.horizontal_displayed) + if(m_crt.vertical_displayed || m_crt.horizontal_displayed) { - offset = 256 * state->m_crt.screen_address_hi + state->m_crt.screen_address_lo; - size = state->m_crt.horizontal_displayed * state->m_crt.vertical_displayed; - cursor = 256 * state->m_crt.cursor_address_hi + state->m_crt.cursor_address_lo; + offset = 256 * m_crt.screen_address_hi + m_crt.screen_address_lo; + size = m_crt.horizontal_displayed * m_crt.vertical_displayed; + cursor = 256 * m_crt.cursor_address_hi + m_crt.cursor_address_lo; /* * for every character in the Video RAM, check if it has been modified since @@ -339,21 +335,21 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap for( address = 0; address < size; address++ ) { i = (offset + address) & 0x3fff; - x = address % state->m_crt.horizontal_displayed + state->m_off_x; - y = address / state->m_crt.horizontal_displayed; + x = address % m_crt.horizontal_displayed + m_off_x; + y = address / m_crt.horizontal_displayed; r.min_x = x * 8; r.max_x = r.min_x + 7; - r.min_y = y * (state->m_crt.scan_lines + 1) + state->m_off_y; - r.max_y = r.min_y + state->m_crt.scan_lines; + r.min_y = y * (m_crt.scan_lines + 1) + m_off_y; + r.max_y = r.min_y + m_crt.scan_lines; - if( state->m_graphics ) + if( m_graphics ) { /* get graphics code */ code = videoram[i]; - drawgfx_opaque(state->m_bitmap, r, machine.gfx[1], code, 1, + drawgfx_opaque(m_bitmap, r, machine().gfx[1], code, 1, 0, 0, r.min_x, r.min_y); - drawgfx_opaque(state->m_dlybitmap, r, machine.gfx[1], code, 2, + drawgfx_opaque(m_dlybitmap, r, machine().gfx[1], code, 2, 0, 0, r.min_x, r.min_y); } else @@ -362,10 +358,10 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap code = videoram[i]; /* translate defined character sets */ - code += state->m_font_offset[(code >> 6) & 3]; - drawgfx_opaque(state->m_bitmap, r, machine.gfx[0], code, state->m_colorram[i&0x3ff] + 16, + code += m_font_offset[(code >> 6) & 3]; + drawgfx_opaque(m_bitmap, r, machine().gfx[0], code, m_colorram[i&0x3ff] + 16, 0, 0, r.min_x, r.min_y); - drawgfx_opaque(state->m_dlybitmap, r, machine.gfx[0], code, state->m_colorram[i&0x3ff] + 32, + drawgfx_opaque(m_dlybitmap, r, machine().gfx[0], code, m_colorram[i&0x3ff] + 32, 0, 0, r.min_x, r.min_y); } @@ -374,37 +370,37 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap rectangle rc; /* check if cursor turned off */ - if( (state->m_crt.cursor_top & 0x60) == 0x20 ) + if( (m_crt.cursor_top & 0x60) == 0x20 ) continue; - if( (state->m_crt.cursor_top & 0x60) == 0x60 ) + if( (m_crt.cursor_top & 0x60) == 0x60 ) { - state->m_crt.cursor_visible = 1; + m_crt.cursor_visible = 1; } else { - state->m_crt.cursor_phase++; - state->m_crt.cursor_visible = (state->m_crt.cursor_phase >> 3) & 1; + m_crt.cursor_phase++; + m_crt.cursor_visible = (m_crt.cursor_phase >> 3) & 1; } - if( !state->m_crt.cursor_visible ) + if( !m_crt.cursor_visible ) continue; rc.min_x = r.min_x; rc.max_x = r.max_x; - rc.min_y = r.min_y + (state->m_crt.cursor_top & 15); - rc.max_y = r.min_y + (state->m_crt.cursor_bottom & 15); + rc.min_y = r.min_y + (m_crt.cursor_top & 15); + rc.max_y = r.min_y + (m_crt.cursor_bottom & 15); - drawgfx_opaque(state->m_bitmap, rc, machine.gfx[0], 0x7f, state->m_colorram[i&0x3ff] + 16, + drawgfx_opaque(m_bitmap, rc, machine().gfx[0], 0x7f, m_colorram[i&0x3ff] + 16, 0, 0, rc.min_x, rc.min_y); - drawgfx_opaque(state->m_dlybitmap, rc, machine.gfx[0], 0x7f, state->m_colorram[i&0x3ff] + 32, + drawgfx_opaque(m_dlybitmap, rc, machine().gfx[0], 0x7f, m_colorram[i&0x3ff] + 32, 0, 0, rc.min_x, rc.min_y); } } } - copybitmap(bitmap, state->m_bitmap, 0, 0, 0, 0, cliprect); - copybitmap_trans(bitmap, state->m_dlybitmap, 0, 0, 1, 0, cliprect, 0); + copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); + copybitmap_trans(bitmap, m_dlybitmap, 0, 0, 1, 0, cliprect, 0); } /*************************************************************************** @@ -413,8 +409,8 @@ static void cgenie_refresh_tv_set(running_machine &machine, bitmap_ind16 &bitmap UINT32 cgenie_state::screen_update_cgenie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { if( m_tv_mode ) - cgenie_refresh_tv_set(machine(), bitmap, cliprect); + cgenie_refresh_tv_set(bitmap, cliprect); else - cgenie_refresh_monitor(machine(), bitmap, cliprect); + cgenie_refresh_monitor(bitmap, cliprect); return 0; } diff --git a/src/mess/video/channelf.c b/src/mess/video/channelf.c index 20c181b33a9..7f83190ade4 100644 --- a/src/mess/video/channelf.c +++ b/src/mess/video/channelf.c @@ -39,7 +39,7 @@ void channelf_state::video_start() m_p_videoram = memregion("vram")->base(); } -static int recalc_palette_offset(int reg1, int reg2) +int channelf_state::recalc_palette_offset(int reg1, int reg2) { /* Note: This is based on the decoding they used to */ /* determine which palette this line is using */ diff --git a/src/mess/video/dgn_beta.c b/src/mess/video/dgn_beta.c index 6929f958a18..a93ee936855 100644 --- a/src/mess/video/dgn_beta.c +++ b/src/mess/video/dgn_beta.c @@ -253,7 +253,7 @@ WRITE_LINE_MEMBER(dgn_beta_state::dgnbeta_vsync_changed) } } - dgn_beta_frame_interrupt(machine(), state); + dgn_beta_frame_interrupt(state); } MC6845_INTERFACE( dgnbeta_crtc6845_interface ) @@ -287,10 +287,9 @@ MC6845_INTERFACE( dgnbeta_crtc6845_interface ) /* 6821-I28, this allows the 6845 to access the full 64K address range, however */ /* since the ram data is addressed as a 16bit wide unit, this allows the 6845 */ /* access to the first 128K or ram. */ -void dgnbeta_vid_set_gctrl(running_machine &machine, int data) +void dgn_beta_state::dgnbeta_vid_set_gctrl(int data) { - dgn_beta_state *state = machine.driver_data<dgn_beta_state>(); - state->m_GCtrl=data; + m_GCtrl=data; } diff --git a/src/mess/video/electron.c b/src/mess/video/electron.c index 00f367e1d33..3d854a6e709 100644 --- a/src/mess/video/electron.c +++ b/src/mess/video/electron.c @@ -49,12 +49,12 @@ void electron_state::video_start() m_scanline_timer->adjust( machine().primary_screen->time_until_pos(0), 0, machine().primary_screen->scan_period() ); } -INLINE UINT8 read_vram( electron_state *state, UINT16 addr ) +inline UINT8 electron_state::read_vram( UINT16 addr ) { - return state->m_ula.vram[ addr % state->m_ula.screen_size ]; + return m_ula.vram[ addr % m_ula.screen_size ]; } -INLINE void electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = (UINT16)color; } @@ -92,7 +92,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 case 0: for( i = 0; i < 80; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + (i << 3) ); + UINT8 pattern = read_vram( m_ula.screen_addr + (i << 3) ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)& 1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)& 1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)& 1] ); @@ -110,7 +110,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 case 1: for( i = 0; i < 80; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 ); + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>2]] ); @@ -128,7 +128,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 case 2: for( i = 0; i < 80; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 ); + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map16[pattern>>1]] ); @@ -150,7 +150,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 { for( i = 0; i < 80; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 ); + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>5)&1] ); @@ -170,7 +170,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 case 7: for( i = 0; i < 40; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 ); + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); @@ -196,7 +196,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 case 5: for( i = 0; i < 40; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 ); + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); electron_plot_pixel( bitmap, x++, scanline, pal[m_map4[pattern>>3]] ); @@ -226,7 +226,7 @@ UINT32 electron_state::screen_update_electron(screen_device &screen, bitmap_ind1 { for( i = 0; i < 40; i++ ) { - UINT8 pattern = read_vram( this, m_ula.screen_addr + i * 8 ); + UINT8 pattern = read_vram( m_ula.screen_addr + i * 8 ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>7)&1] ); electron_plot_pixel( bitmap, x++, scanline, pal[(pattern>>6)&1] ); @@ -259,10 +259,10 @@ TIMER_CALLBACK_MEMBER(electron_state::electron_scanline_interrupt) switch (machine().primary_screen->vpos()) { case 43: - electron_interrupt_handler( machine(), INT_SET, INT_RTC ); + electron_interrupt_handler( INT_SET, INT_RTC ); break; case 199: - electron_interrupt_handler( machine(), INT_SET, INT_DISPLAY_END ); + electron_interrupt_handler( INT_SET, INT_DISPLAY_END ); break; case 0: m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base; diff --git a/src/mess/video/fm7.c b/src/mess/video/fm7.c index 6279710ce90..126623ecb53 100644 --- a/src/mess/video/fm7.c +++ b/src/mess/video/fm7.c @@ -99,7 +99,7 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm77av_alu_task_end) m_alu.busy = 0; } -static void fm7_alu_mask_write(fm7_state *state, UINT32 offset, int bank, UINT8 dat) +void fm7_state::fm7_alu_mask_write(UINT32 offset, int bank, UINT8 dat) { UINT8 temp; int page = 0; @@ -107,28 +107,28 @@ static void fm7_alu_mask_write(fm7_state *state, UINT32 offset, int bank, UINT8 if(offset >= 0xc000) page = 1; - if((state->m_alu.command & 0x40) == 0) + if((m_alu.command & 0x40) == 0) { // "always" write mode - state->m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat; + m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = dat; return; } - temp = state->m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)]; - if(state->m_alu.command & 0x20) + temp = m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)]; + if(m_alu.command & 0x20) { // "not equal" write mode - temp &= state->m_alu.compare_data; - dat &= ~state->m_alu.compare_data; + temp &= m_alu.compare_data; + dat &= ~m_alu.compare_data; } else { // "equal" write mode - temp &= ~state->m_alu.compare_data; - dat &= state->m_alu.compare_data; + temp &= ~m_alu.compare_data; + dat &= m_alu.compare_data; } - state->m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat; + m_video_ram[(offset & 0x3fff) + (bank * 0x4000) + (page * 0xc000)] = temp | dat; } -static void fm7_alu_function_compare(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_compare(UINT32 offset) { // COMPARE - compares which colors match those in the compare registers // can be used on its own, or when bit 6 of the command register is high. @@ -145,16 +145,16 @@ static void fm7_alu_function_compare(fm7_state *state, UINT32 offset) if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; - blue = state->m_video_ram[(offset & 0x3fff) + (page * 0xc000)]; - red = state->m_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)]; - green = state->m_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)]; + blue = m_video_ram[(offset & 0x3fff) + (page * 0xc000)]; + red = m_video_ram[(offset & 0x3fff) + 0x4000 + (page * 0xc000)]; + green = m_video_ram[(offset & 0x3fff) + 0x8000 + (page * 0xc000)]; - banks = (~state->m_alu.bank_disable) & 0x07; + banks = (~m_alu.bank_disable) & 0x07; for(x=0;x<8;x++) // loop through each pixel { @@ -169,9 +169,9 @@ static void fm7_alu_function_compare(fm7_state *state, UINT32 offset) match = 0; for(y=0;y<8;y++) // loop through each compare register { - if(!(state->m_alu.compare[y] & 0x80)) // don't compare if register is masked + if(!(m_alu.compare[y] & 0x80)) // don't compare if register is masked { - if((state->m_alu.compare[y] & banks) == (colour & banks)) + if((m_alu.compare[y] & banks) == (colour & banks)) match = 1; } } @@ -180,10 +180,10 @@ static void fm7_alu_function_compare(fm7_state *state, UINT32 offset) bit >>= 1; } - state->m_alu.compare_data = dat; + m_alu.compare_data = dat; } -static void fm7_alu_function_pset(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_pset(UINT32 offset) { // PSET - simply sets the pixels to the selected logical colour int x; @@ -191,192 +191,192 @@ static void fm7_alu_function_pset(fm7_state *state, UINT32 offset) int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { - if(state->m_alu.lcolour & (1 << x)) + if(m_alu.lcolour & (1 << x)) dat = 0xff; else dat = 0; - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & state->m_alu.mask; - dat &= ~state->m_alu.mask; + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask; + dat &= ~m_alu.mask; dat |= mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function_or(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_or(UINT32 offset) { int x; UINT8 dat; int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { - if(state->m_alu.lcolour & (1 << x)) + if(m_alu.lcolour & (1 << x)) dat = 0xff; else dat = 0; - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); dat |= mask; - mask &= state->m_alu.mask; - dat &= ~state->m_alu.mask; + mask &= m_alu.mask; + dat &= ~m_alu.mask; dat |= mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function_and(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_and(UINT32 offset) { int x; UINT8 dat; int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { - if(state->m_alu.lcolour & (1 << x)) + if(m_alu.lcolour & (1 << x)) dat = 0xff; else dat = 0; - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); dat &= mask; - mask &= state->m_alu.mask; - dat &= ~state->m_alu.mask; + mask &= m_alu.mask; + dat &= ~m_alu.mask; dat |= mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function_xor(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_xor(UINT32 offset) { int x; UINT8 dat; int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { - if(state->m_alu.lcolour & (1 << x)) + if(m_alu.lcolour & (1 << x)) dat = 0xff; else dat = 0; - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); dat ^= mask; - mask &= state->m_alu.mask; - dat &= ~state->m_alu.mask; + mask &= m_alu.mask; + dat &= ~m_alu.mask; dat |= mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function_not(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_not(UINT32 offset) { int x; UINT8 dat; int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { - if(state->m_alu.lcolour & (1 << x)) + if(m_alu.lcolour & (1 << x)) dat = 0xff; else dat = 0; - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); dat = ~mask; - mask &= state->m_alu.mask; - dat &= ~state->m_alu.mask; + mask &= m_alu.mask; + dat &= ~m_alu.mask; dat |= mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function_invalid(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_invalid(UINT32 offset) { // Invalid function, still does something though (used by Laydock) int x; @@ -384,31 +384,31 @@ static void fm7_alu_function_invalid(fm7_state *state, UINT32 offset) int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]); - dat = mask & state->m_alu.mask; + dat = mask & m_alu.mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function_tilepaint(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function_tilepaint(UINT32 offset) { // TILEPAINT - writes to VRAM based on the tilepaint colour registers int x; @@ -416,80 +416,80 @@ static void fm7_alu_function_tilepaint(fm7_state *state, UINT32 offset) int page = 0; UINT8 mask; - if(state->m_alu.command & 0x40) - fm7_alu_function_compare(state, offset); + if(m_alu.command & 0x40) + fm7_alu_function_compare(offset); if(offset >= 0xc000) { page = 1; - offset += state->m_video.vram_offset2; + offset += m_video.vram_offset2; } else - offset += state->m_video.vram_offset; + offset += m_video.vram_offset; for(x=0;x<3;x++) // cycle through banks { - if(!(state->m_alu.bank_disable & (1 << x))) + if(!(m_alu.bank_disable & (1 << x))) { switch(x) { case 0: - dat = state->m_alu.tilepaint_b; + dat = m_alu.tilepaint_b; break; case 1: - dat = state->m_alu.tilepaint_r; + dat = m_alu.tilepaint_r; break; case 2: - dat = state->m_alu.tilepaint_g; + dat = m_alu.tilepaint_g; break; } - dat &= ~state->m_alu.mask; - mask = (state->m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & state->m_alu.mask; + dat &= ~m_alu.mask; + mask = (m_video_ram[(offset & 0x3fff) + (x * 0x4000) + (page * 0xc000)]) & m_alu.mask; dat |= mask; - fm7_alu_mask_write(state, offset,x,dat); + fm7_alu_mask_write(offset,x,dat); } } } -static void fm7_alu_function(fm7_state *state, UINT32 offset) +void fm7_state::fm7_alu_function(UINT32 offset) { - switch(state->m_alu.command & 0x07) + switch(m_alu.command & 0x07) { case 0x00: // PSET - fm7_alu_function_pset(state, offset); + fm7_alu_function_pset(offset); break; case 0x02: // OR - fm7_alu_function_or(state, offset); + fm7_alu_function_or(offset); break; case 0x03: // AND - fm7_alu_function_and(state, offset); + fm7_alu_function_and(offset); break; case 0x04: // XOR - fm7_alu_function_xor(state, offset); + fm7_alu_function_xor(offset); break; case 0x05: // NOT - fm7_alu_function_not(state, offset); + fm7_alu_function_not(offset); break; case 0x06: // TILEPAINT - fm7_alu_function_tilepaint(state, offset); + fm7_alu_function_tilepaint(offset); break; case 0x07: // COMPARE - fm7_alu_function_compare(state, offset); + fm7_alu_function_compare(offset); break; case 0x01: default: - fm7_alu_function_invalid(state, offset); + fm7_alu_function_invalid(offset); } } -static UINT32 fm7_line_set_pixel(fm7_state *state, int x, int y) +UINT32 fm7_state::fm7_line_set_pixel(int x, int y) { UINT32 addr; static const UINT8 pixel_mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe }; - if(state->m_video.modestatus & 0x40) // 320 pixels wide + if(m_video.modestatus & 0x40) // 320 pixels wide { addr = (x >> 3) + (y * 40); } @@ -497,27 +497,26 @@ static UINT32 fm7_line_set_pixel(fm7_state *state, int x, int y) { addr = (x >> 3) + (y * 80); } - addr += (state->m_alu.addr_offset << 1); + addr += (m_alu.addr_offset << 1); addr &= 0x3fff; - if(state->m_video.active_video_page != 0) + if(m_video.active_video_page != 0) addr += 0xc000; - if(state->m_alu.command & 0x80) // ALU must be active + if(m_alu.command & 0x80) // ALU must be active { - state->m_alu.mask = pixel_mask[x & 0x07]; - fm7_alu_function(state, addr); + m_alu.mask = pixel_mask[x & 0x07]; + fm7_alu_function(addr); } return addr; } -static void fm77av_line_draw(running_machine &machine) +void fm7_state::fm77av_line_draw() { - fm7_state *state = machine.driver_data<fm7_state>(); - int x1 = state->m_alu.x0; - int x2 = state->m_alu.x1; - int y1 = state->m_alu.y0; - int y2 = state->m_alu.y1; + int x1 = m_alu.x0; + int x2 = m_alu.x1; + int y1 = m_alu.y0; + int y2 = m_alu.y1; int horiz,vert; int dirx,diry; int rep; @@ -525,7 +524,7 @@ static void fm77av_line_draw(running_machine &machine) UINT16 old_addr = 0xffff; UINT16 addr; - state->m_alu.busy = 1; + m_alu.busy = 1; horiz = x2 - x1; vert = y2 - y1; @@ -547,14 +546,14 @@ static void fm77av_line_draw(running_machine &machine) if(horiz == 0 && vert == 0) { - fm7_line_set_pixel(state, x1, y1); + fm7_line_set_pixel(x1, y1); byte_count = 1; } else if(horiz == 0) { for(;;) { - addr = fm7_line_set_pixel(state, x1, y1); + addr = fm7_line_set_pixel(x1, y1); if(addr != old_addr) { byte_count++; @@ -569,7 +568,7 @@ static void fm77av_line_draw(running_machine &machine) { for(;;) { - addr = fm7_line_set_pixel(state, x1, y1); + addr = fm7_line_set_pixel(x1, y1); if(addr != old_addr) { byte_count++; @@ -585,7 +584,7 @@ static void fm77av_line_draw(running_machine &machine) rep = horiz >> 1; for(;;) { - addr = fm7_line_set_pixel(state, x1, y1); + addr = fm7_line_set_pixel(x1, y1); if(addr != old_addr) { byte_count++; @@ -607,7 +606,7 @@ static void fm77av_line_draw(running_machine &machine) rep = vert >> 1; for(;;) { - addr = fm7_line_set_pixel(state, x1, y1); + addr = fm7_line_set_pixel(x1, y1); if(addr != old_addr) { byte_count++; @@ -627,7 +626,7 @@ static void fm77av_line_draw(running_machine &machine) // set timer to disable busy flag // 1/16 us for each byte changed - machine.scheduler().timer_set(attotime::from_usec(byte_count/16), timer_expired_delegate(FUNC(fm7_state::fm77av_alu_task_end),state)); + machine().scheduler().timer_set(attotime::from_usec(byte_count/16), timer_expired_delegate(FUNC(fm7_state::fm77av_alu_task_end),this)); } READ8_MEMBER(fm7_state::fm7_vram_r) @@ -646,9 +645,8 @@ READ8_MEMBER(fm7_state::fm7_vram_r) return 0xff; if(m_alu.command & 0x80) // ALU active, writes to VRAM even when reading it (go figure) - { - fm7_state *state = machine().driver_data<fm7_state>(); - fm7_alu_function(state, offset+page); + { + fm7_alu_function(offset+page); } if(m_video.modestatus & 0x40) @@ -685,8 +683,7 @@ WRITE8_MEMBER(fm7_state::fm7_vram_w) if(m_alu.command & 0x80) // ALU active { - fm7_state *state = machine().driver_data<fm7_state>(); - fm7_alu_function(state, offset+page); + fm7_alu_function(offset+page); return; } @@ -729,8 +726,7 @@ WRITE8_MEMBER(fm7_state::fm7_vram_banked_w) if(m_alu.command & 0x80) // ALU active { - fm7_state *state = machine().driver_data<fm7_state>(); - fm7_alu_function(state, offset+page); + fm7_alu_function(offset+page); return; } @@ -1341,7 +1337,7 @@ WRITE8_MEMBER(fm7_state::fm77av_alu_w) dat = (m_alu.y1 & 0xff00) | data; m_alu.y1 = dat; // draw line - fm77av_line_draw(machine()); + fm77av_line_draw(); // logerror("ALU: write to Y1 (low) register - %02x (%04x)\n",data,m_alu.y1); break; default: diff --git a/src/mess/video/fmtowns.c b/src/mess/video/fmtowns.c index 4fdcbd6e1af..d23d34b3d8d 100644 --- a/src/mess/video/fmtowns.c +++ b/src/mess/video/fmtowns.c @@ -94,30 +94,27 @@ //static UINT32 pshift; // for debugging -static void draw_sprites(running_machine &machine, const rectangle* rect); - -static void towns_crtc_refresh_mode(running_machine &machine) +void towns_state::towns_crtc_refresh_mode() { - towns_state* state = machine.driver_data<towns_state>(); unsigned int width,height; - rectangle scr(0, state->m_video.towns_crtc_reg[4], 0, state->m_video.towns_crtc_reg[8] / 2); + rectangle scr(0, m_video.towns_crtc_reg[4], 0, m_video.towns_crtc_reg[8] / 2); // layer 0 - width = state->m_video.towns_crtc_reg[10] - state->m_video.towns_crtc_reg[9]; - height = (state->m_video.towns_crtc_reg[14] - state->m_video.towns_crtc_reg[13]) / 2; - state->m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2); - state->m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2); - state->m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2); - state->m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2); + width = m_video.towns_crtc_reg[10] - m_video.towns_crtc_reg[9]; + height = (m_video.towns_crtc_reg[14] - m_video.towns_crtc_reg[13]) / 2; + m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2); + m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2); + m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2); + m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2); // layer 1 - width = state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11]; - height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / 2; - state->m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2); - state->m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2); - state->m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2); - state->m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2); + width = m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]; + height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / 2; + m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2); + m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2); + m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2); + m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2); // sanity checks if(scr.max_x == 0 || scr.max_y == 0) @@ -125,7 +122,7 @@ static void towns_crtc_refresh_mode(running_machine &machine) if(scr.max_x <= scr.min_x || scr.max_y <= scr.min_y) return; - machine.primary_screen->configure(scr.max_x+1,scr.max_y+1,scr,HZ_TO_ATTOSECONDS(60)); + machine().primary_screen->configure(scr.max_x+1,scr.max_y+1,scr,HZ_TO_ATTOSECONDS(60)); } READ8_MEMBER( towns_state::towns_gfx_high_r ) @@ -218,31 +215,30 @@ WRITE8_MEMBER( towns_state::towns_gfx_w ) } } -static void towns_update_kanji_offset(running_machine &machine) +void towns_state::towns_update_kanji_offset() { - towns_state* state = machine.driver_data<towns_state>(); // this is a little over the top... - if(state->m_video.towns_kanji_code_h < 0x30) + if(m_video.towns_kanji_code_h < 0x30) { - state->m_video.towns_kanji_offset = ((state->m_video.towns_kanji_code_l & 0x1f) << 4) - | (((state->m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) - | (((state->m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) - | ((state->m_video.towns_kanji_code_h & 0x07) << 9); + m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) + | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) + | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) + | ((m_video.towns_kanji_code_h & 0x07) << 9); } - else if(state->m_video.towns_kanji_code_h < 0x70) + else if(m_video.towns_kanji_code_h < 0x70) { - state->m_video.towns_kanji_offset = ((state->m_video.towns_kanji_code_l & 0x1f) << 4) - + (((state->m_video.towns_kanji_code_l - 0x20) & 0x60) << 8) - + ((state->m_video.towns_kanji_code_h & 0x0f) << 9) - + (((state->m_video.towns_kanji_code_h - 0x30) & 0x70) * 0xc00) + m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) + + (((m_video.towns_kanji_code_l - 0x20) & 0x60) << 8) + + ((m_video.towns_kanji_code_h & 0x0f) << 9) + + (((m_video.towns_kanji_code_h - 0x30) & 0x70) * 0xc00) + 0x8000; } else { - state->m_video.towns_kanji_offset = ((state->m_video.towns_kanji_code_l & 0x1f) << 4) - | (((state->m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) - | (((state->m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) - | ((state->m_video.towns_kanji_code_h & 0x07) << 9) + m_video.towns_kanji_offset = ((m_video.towns_kanji_code_l & 0x1f) << 4) + | (((m_video.towns_kanji_code_l - 0x20) & 0x20) << 8) + | (((m_video.towns_kanji_code_l - 0x20) & 0x40) << 6) + | ((m_video.towns_kanji_code_h & 0x07) << 9) | 0x38000; } } @@ -307,12 +303,12 @@ WRITE8_MEMBER( towns_state::towns_video_cff80_w ) break; case 0x14: // Kanji offset (high) m_video.towns_kanji_code_h = data & 0x7f; - towns_update_kanji_offset(space.machine()); + towns_update_kanji_offset(); //logerror("VID: Kanji code set (high) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l); break; case 0x15: // Kanji offset (low) m_video.towns_kanji_code_l = data & 0x7f; - towns_update_kanji_offset(space.machine()); + towns_update_kanji_offset(); //logerror("VID: Kanji code set (low) = %02x %02x\n",towns_kanji_code_h,towns_kanji_code_l); break; case 0x19: // ANK CG ROM @@ -424,13 +420,13 @@ WRITE8_MEMBER(towns_state::towns_video_440_w) // logerror("CRTC: writing register %i (0x442) [%02x]\n",towns_crtc_sel,data); m_video.towns_crtc_reg[m_video.towns_crtc_sel] = (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0xff00) | data; - towns_crtc_refresh_mode(space.machine()); + towns_crtc_refresh_mode(); break; case 0x03: // logerror("CRTC: writing register %i (0x443) [%02x]\n",towns_crtc_sel,data); m_video.towns_crtc_reg[m_video.towns_crtc_sel] = (m_video.towns_crtc_reg[m_video.towns_crtc_sel] & 0x00ff) | (data << 8); - towns_crtc_refresh_mode(space.machine()); + towns_crtc_refresh_mode(); break; case 0x08: m_video.towns_video_sel = data & 0x01; @@ -682,16 +678,15 @@ WRITE8_MEMBER( towns_state::towns_spriteram_w ) * +6: Sprite Colour * bit 15: use colour data in located in sprite RAM offset in bits 11-0 (x32) */ -static void render_sprite_4(running_machine &machine, UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) +void towns_state::render_sprite_4(UINT32 poffset, UINT32 coffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) { - towns_state* state = machine.driver_data<towns_state>(); UINT16 xpos,ypos; UINT16 col,pixel; UINT32 voffset; UINT16 xstart,xend,ystart,yend; int xdir,ydir; - int width = (state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11]) / (((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); - int height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / (((state->m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); + int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); + int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); if(xflip) { @@ -727,36 +722,36 @@ static void render_sprite_4(running_machine &machine, UINT32 poffset, UINT32 cof { for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff) { - if(state->m_video.towns_sprite_page != 0) + if(m_video.towns_sprite_page != 0) voffset = 0x20000; else voffset = 0x00000; - pixel = (state->m_towns_txtvram[poffset] & 0xf0) >> 4; - col = state->m_towns_txtvram[coffset+(pixel*2)] | (state->m_towns_txtvram[coffset+(pixel*2)+1] << 8); - voffset += (state->m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos + pixel = (m_towns_txtvram[poffset] & 0xf0) >> 4; + col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8); + voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos voffset += (xpos & 0x1ff) * 2; - if((state->m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) - || (state->m_video.towns_sprite_page == 0 && voffset < 0x20000)) + if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) + || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) { if(xpos < width && ypos < height && pixel != 0) { - state->m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; - state->m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; + m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; + m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; } } if(xflip) voffset+=2; else voffset-=2; - pixel = state->m_towns_txtvram[poffset] & 0x0f; - col = state->m_towns_txtvram[coffset+(pixel*2)] | (state->m_towns_txtvram[coffset+(pixel*2)+1] << 8); - if((state->m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) - || (state->m_video.towns_sprite_page == 0 && voffset < 0x20000)) + pixel = m_towns_txtvram[poffset] & 0x0f; + col = m_towns_txtvram[coffset+(pixel*2)] | (m_towns_txtvram[coffset+(pixel*2)+1] << 8); + if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) + || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) { if(xpos < width && ypos < height && pixel != 0) { - state->m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; - state->m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; + m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; + m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; } } poffset++; @@ -765,16 +760,15 @@ static void render_sprite_4(running_machine &machine, UINT32 poffset, UINT32 cof } } -static void render_sprite_16(running_machine &machine, UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) +void towns_state::render_sprite_16(UINT32 poffset, UINT16 x, UINT16 y, UINT16 xflip, UINT16 yflip, const rectangle* rect) { - towns_state* state = machine.driver_data<towns_state>(); UINT16 xpos,ypos; UINT16 col; UINT32 voffset; UINT16 xstart,ystart,xend,yend; int xdir,ydir; - int width = (state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11]) / (((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); - int height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / (((state->m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); + int width = (m_video.towns_crtc_reg[12] - m_video.towns_crtc_reg[11]) / (((m_video.towns_crtc_reg[27] & 0x0f00) >> 8)+1); + int height = (m_video.towns_crtc_reg[16] - m_video.towns_crtc_reg[15]) / (((m_video.towns_crtc_reg[27] & 0xf000) >> 12)+2); if(xflip) { @@ -810,20 +804,20 @@ static void render_sprite_16(running_machine &machine, UINT32 poffset, UINT16 x, { for(xpos=xstart;xpos!=xend;xpos+=xdir,xpos&=0x1ff) { - if(state->m_video.towns_sprite_page != 0) + if(m_video.towns_sprite_page != 0) voffset = 0x20000; else voffset = 0x00000; - col = state->m_towns_txtvram[poffset] | (state->m_towns_txtvram[poffset+1] << 8); - voffset += (state->m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos + col = m_towns_txtvram[poffset] | (m_towns_txtvram[poffset+1] << 8); + voffset += (m_video.towns_crtc_reg[24] * 4) * (ypos & 0x1ff); // scanline size in bytes * y pos voffset += (xpos & 0x1ff) * 2; - if((state->m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) - || (state->m_video.towns_sprite_page == 0 && voffset < 0x20000)) + if((m_video.towns_sprite_page != 0 && voffset > 0x1ffff && voffset < 0x40000) + || (m_video.towns_sprite_page == 0 && voffset < 0x20000)) { if(xpos < width && ypos < height && col < 0x8000) { - state->m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; - state->m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; + m_towns_gfxvram[0x40000+voffset+1] = (col & 0xff00) >> 8; + m_towns_gfxvram[0x40000+voffset] = col & 0x00ff; } } poffset+=2; @@ -832,31 +826,30 @@ static void render_sprite_16(running_machine &machine, UINT32 poffset, UINT16 x, } } -static void draw_sprites(running_machine &machine, const rectangle* rect) +void towns_state::draw_sprites(const rectangle* rect) { - towns_state* state = machine.driver_data<towns_state>(); - UINT16 sprite_limit = (state->m_video.towns_sprite_reg[0] | (state->m_video.towns_sprite_reg[1] << 8)) & 0x3ff; + UINT16 sprite_limit = (m_video.towns_sprite_reg[0] | (m_video.towns_sprite_reg[1] << 8)) & 0x3ff; int n; UINT16 x,y,attr,colour; - UINT16 xoff = (state->m_video.towns_sprite_reg[2] | (state->m_video.towns_sprite_reg[3] << 8)) & 0x1ff; - UINT16 yoff = (state->m_video.towns_sprite_reg[4] | (state->m_video.towns_sprite_reg[5] << 8)) & 0x1ff; + UINT16 xoff = (m_video.towns_sprite_reg[2] | (m_video.towns_sprite_reg[3] << 8)) & 0x1ff; + UINT16 yoff = (m_video.towns_sprite_reg[4] | (m_video.towns_sprite_reg[5] << 8)) & 0x1ff; UINT32 poffset,coffset; - if(!(state->m_video.towns_sprite_reg[1] & 0x80)) + if(!(m_video.towns_sprite_reg[1] & 0x80)) return; // clears VRAM for each frame? - if(state->m_video.towns_sprite_page == 0) - memset(state->m_towns_gfxvram+0x40000,0x80,0x20000); + if(m_video.towns_sprite_page == 0) + memset(m_towns_gfxvram+0x40000,0x80,0x20000); else - memset(state->m_towns_gfxvram+0x60000,0x80,0x20000); + memset(m_towns_gfxvram+0x60000,0x80,0x20000); for(n=sprite_limit;n<1024;n++) { - x = state->m_towns_txtvram[8*n] | (state->m_towns_txtvram[8*n+1] << 8); - y = state->m_towns_txtvram[8*n+2] | (state->m_towns_txtvram[8*n+3] << 8); - attr = state->m_towns_txtvram[8*n+4] | (state->m_towns_txtvram[8*n+5] << 8); - colour = state->m_towns_txtvram[8*n+6] | (state->m_towns_txtvram[8*n+7] << 8); + x = m_towns_txtvram[8*n] | (m_towns_txtvram[8*n+1] << 8); + y = m_towns_txtvram[8*n+2] | (m_towns_txtvram[8*n+3] << 8); + attr = m_towns_txtvram[8*n+4] | (m_towns_txtvram[8*n+5] << 8); + colour = m_towns_txtvram[8*n+6] | (m_towns_txtvram[8*n+7] << 8); if(attr & 0x8000) { x += xoff; @@ -874,7 +867,7 @@ static void draw_sprites(running_machine &machine, const rectangle* rect) n,x,y,attr,colour,poffset,coffset); #endif if(!(colour & 0x2000)) - render_sprite_4(machine,(poffset)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect); + render_sprite_4((poffset)&0x1ffff,coffset,x,y,attr&0x2000,attr&0x1000,rect); } else { @@ -884,22 +877,21 @@ static void draw_sprites(running_machine &machine, const rectangle* rect) n,x,y,attr,colour,poffset); #endif if(!(colour & 0x2000)) - render_sprite_16(machine,(poffset)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect); + render_sprite_16((poffset)&0x1ffff,x,y,attr&0x2000,attr&0x1000,rect); } } - if(state->m_video.towns_sprite_page == 0) // flip VRAM page - state->m_video.towns_sprite_page = 1; + if(m_video.towns_sprite_page == 0) // flip VRAM page + m_video.towns_sprite_page = 1; else - state->m_video.towns_sprite_page = 0; + m_video.towns_sprite_page = 0; - state->m_video.towns_sprite_flag = 1; // we are now drawing - state->m_video.sprite_timer->adjust(state->m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit))); + m_video.towns_sprite_flag = 1; // we are now drawing + m_video.sprite_timer->adjust(m_maincpu->cycles_to_attotime(128 * (1025-sprite_limit))); } -static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { - towns_state* state = machine.driver_data<towns_state>(); UINT32 off = 0; int x; UINT16 colour; @@ -908,41 +900,41 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap UINT32 scroll; if(layer == 0) - linesize = state->m_video.towns_crtc_reg[20] * 4; + linesize = m_video.towns_crtc_reg[20] * 4; else - linesize = state->m_video.towns_crtc_reg[24] * 4; + linesize = m_video.towns_crtc_reg[24] * 4; - if(state->m_video.towns_display_page_sel != 0) + if(m_video.towns_display_page_sel != 0) off = 0x20000; -// if((layer == 1) && (state->m_video.towns_sprite_reg[1] & 0x80) && (state->m_video.towns_sprite_page == 1)) +// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) // off = 0x20000; if(layer != 0) { - if(!(state->m_video.towns_video_reg[0] & 0x10)) + if(!(m_video.towns_video_reg[0] & 0x10)) return; - if(!(state->m_video.towns_crtc_reg[28] & 0x10)) - off += (state->m_video.towns_crtc_reg[21]) << 2; // initial offset + if(!(m_video.towns_crtc_reg[28] & 0x10)) + off += (m_video.towns_crtc_reg[21]) << 2; // initial offset else { - scroll = ((state->m_video.towns_crtc_reg[21] & 0xfc00) << 2) | (((state->m_video.towns_crtc_reg[21] & 0x3ff) << 2)); + scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 2)); off += scroll; } - off += (state->m_video.towns_crtc_reg[11] - state->m_video.towns_crtc_reg[22]); - hzoom = ((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; + off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); + hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; } else { - if(!(state->m_video.towns_crtc_reg[28] & 0x20)) - off += (state->m_video.towns_crtc_reg[17]) << 2; // initial offset + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += (m_video.towns_crtc_reg[17]) << 2; // initial offset else { - scroll = ((state->m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((state->m_video.towns_crtc_reg[17] & 0x3ff) << 2)); + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 2)); off += scroll; } - off += (state->m_video.towns_crtc_reg[9] - state->m_video.towns_crtc_reg[18]); - hzoom = (state->m_video.towns_crtc_reg[27] & 0x000f) + 1; + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; } off += line * linesize; @@ -952,12 +944,12 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap { for(x=rect->min_x;x<rect->max_x;x++) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)]; + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; if(colour < 0x8000) { bitmap.pix32(scanline, x) = @@ -973,11 +965,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap { // x2 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=2) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)]; + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; if(colour < 0x8000) { bitmap.pix32(scanline, x) = @@ -997,11 +989,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap { // x3 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=3) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)]; + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; if(colour < 0x8000) { bitmap.pix32(scanline, x) = @@ -1025,11 +1017,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap { // x4 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=4) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)]; + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; if(colour < 0x8000) { bitmap.pix32(scanline, x) = @@ -1057,11 +1049,11 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap { // x5 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=5) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = (state->m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | state->m_towns_gfxvram[off+(layer*0x40000)]; + colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; if(colour < 0x8000) { bitmap.pix32(scanline, x) = @@ -1090,9 +1082,8 @@ static void towns_crtc_draw_scan_layer_hicolour(running_machine &machine, bitmap } } -static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { - towns_state* state = machine.driver_data<towns_state>(); int off = 0; int x; UINT8 colour; @@ -1100,42 +1091,42 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3 int linesize; UINT32 scroll; - if(state->m_video.towns_display_page_sel != 0) + if(m_video.towns_display_page_sel != 0) off = 0x20000; -// if((layer == 1) && (state->m_video.towns_sprite_reg[1] & 0x80) && (state->m_video.towns_sprite_page == 1)) +// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) // off = 0x20000; if(layer == 0) - linesize = state->m_video.towns_crtc_reg[20] * 8; + linesize = m_video.towns_crtc_reg[20] * 8; else - linesize = state->m_video.towns_crtc_reg[24] * 8; + linesize = m_video.towns_crtc_reg[24] * 8; if(layer != 0) { - if(!(state->m_video.towns_video_reg[0] & 0x10)) + if(!(m_video.towns_video_reg[0] & 0x10)) return; - if(!(state->m_video.towns_crtc_reg[28] & 0x10)) - off += state->m_video.towns_crtc_reg[21] << 3; // initial offset + if(!(m_video.towns_crtc_reg[28] & 0x10)) + off += m_video.towns_crtc_reg[21] << 3; // initial offset else { - scroll = ((state->m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((state->m_video.towns_crtc_reg[21] & 0x3ff) << 3)); + scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 3)); off += scroll; } - off += (state->m_video.towns_crtc_reg[11] - state->m_video.towns_crtc_reg[22]); - hzoom = ((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; + off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); + hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; } else { - if(!(state->m_video.towns_crtc_reg[28] & 0x20)) - off += state->m_video.towns_crtc_reg[17] << 3; // initial offset + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += m_video.towns_crtc_reg[17] << 3; // initial offset else { - scroll = ((state->m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((state->m_video.towns_crtc_reg[17] & 0x3ff) << 3)); + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3)); off += scroll; } - off += (state->m_video.towns_crtc_reg[9] - state->m_video.towns_crtc_reg[18]); - hzoom = (state->m_video.towns_crtc_reg[27] & 0x000f) + 1; + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; } off += line * linesize; @@ -1144,17 +1135,17 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3 { for(x=rect->min_x;x<rect->max_x;x++) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)]; + colour = m_towns_gfxvram[off+(layer*0x40000)]; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1164,21 +1155,21 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3 { // x2 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=2) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)+1]; + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1188,25 +1179,25 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3 { // x3 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=3) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)+1]; + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1216,29 +1207,29 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3 { // x4 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=4) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)+1]; + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+3) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1248,42 +1239,41 @@ static void towns_crtc_draw_scan_layer_256(running_machine &machine, bitmap_rgb3 { // x5 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=5) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)+1]; + colour = m_towns_gfxvram[off+(layer*0x40000)+1]; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+3) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+4) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } } } -static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +void towns_state::towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) { - towns_state* state = machine.driver_data<towns_state>(); int off = 0; int x; UINT8 colour; @@ -1291,42 +1281,42 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 int linesize; UINT32 scroll; - if(state->m_video.towns_display_page_sel != 0) + if(m_video.towns_display_page_sel != 0) off = 0x20000; -// if((layer == 1) && (state->m_video.towns_sprite_reg[1] & 0x80) && (state->m_video.towns_sprite_page == 1)) +// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) // off = 0x20000; if(layer == 0) - linesize = state->m_video.towns_crtc_reg[20] * 4; + linesize = m_video.towns_crtc_reg[20] * 4; else - linesize = state->m_video.towns_crtc_reg[24] * 4; + linesize = m_video.towns_crtc_reg[24] * 4; if(layer != 0) { - if(!(state->m_video.towns_video_reg[0] & 0x10)) + if(!(m_video.towns_video_reg[0] & 0x10)) return; - if(!(state->m_video.towns_crtc_reg[28] & 0x10)) - off += state->m_video.towns_crtc_reg[21]; // initial offset + if(!(m_video.towns_crtc_reg[28] & 0x10)) + off += m_video.towns_crtc_reg[21]; // initial offset else { - scroll = ((state->m_video.towns_crtc_reg[21] & 0xfc00)<<2) | (((state->m_video.towns_crtc_reg[21] & 0x3ff)<<2)); + scroll = ((m_video.towns_crtc_reg[21] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[21] & 0x3ff)<<2)); off += scroll; } - off += (state->m_video.towns_crtc_reg[11] - state->m_video.towns_crtc_reg[22]); - hzoom = ((state->m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; + off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]); + hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; } else { - if(!(state->m_video.towns_crtc_reg[28] & 0x20)) - off += state->m_video.towns_crtc_reg[17]; // initial offset + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += m_video.towns_crtc_reg[17]; // initial offset else { - scroll = ((state->m_video.towns_crtc_reg[17] & 0xfc00)<<2) | (((state->m_video.towns_crtc_reg[17] & 0x3ff)<<2)); + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00)<<2) | (((m_video.towns_crtc_reg[17] & 0x3ff)<<2)); off += scroll; } - off += (state->m_video.towns_crtc_reg[9] - state->m_video.towns_crtc_reg[18]); - hzoom = (state->m_video.towns_crtc_reg[27] & 0x000f) + 1; + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]); + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; } off += line * linesize; @@ -1335,25 +1325,25 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 { for(x=rect->min_x;x<rect->max_x;x+=2) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4; + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0) { bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } - colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1363,33 +1353,33 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 { // x2 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=4) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4; + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0) { bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+3) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } - colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1399,41 +1389,41 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 { // x3 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=6) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4; + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0) { bitmap.pix32(scanline, x+3) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+4) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+5) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } - colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1443,49 +1433,49 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 { // x4 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=8) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4; + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0) { bitmap.pix32(scanline, x+4) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+5) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+6) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+7) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } - colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+3) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } @@ -1495,66 +1485,65 @@ static void towns_crtc_draw_scan_layer_16(running_machine &machine, bitmap_rgb32 { // x5 horizontal zoom for(x=rect->min_x;x<rect->max_x;x+=10) { - if(state->m_video.towns_video_reg[0] & 0x10) + if(m_video.towns_video_reg[0] & 0x10) off &= 0x3ffff; // 2 layers else off &= 0x7ffff; // 1 layer - colour = state->m_towns_gfxvram[off+(layer*0x40000)] >> 4; + colour = m_towns_gfxvram[off+(layer*0x40000)] >> 4; if(colour != 0) { bitmap.pix32(scanline, x+5) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+6) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+7) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+8) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+9) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } - colour = state->m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; + colour = m_towns_gfxvram[off+(layer*0x40000)] & 0x0f; if(colour != 0) { bitmap.pix32(scanline, x) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+1) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+2) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+3) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); bitmap.pix32(scanline, x+4) = - (state->m_video.towns_palette_r[colour] << 16) - | (state->m_video.towns_palette_g[colour] << 8) - | (state->m_video.towns_palette_b[colour]); + (m_video.towns_palette_r[colour] << 16) + | (m_video.towns_palette_g[colour] << 8) + | (m_video.towns_palette_b[colour]); } off++; } } } -static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap,const rectangle* rect,int layer) +void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer) { - towns_state* state = machine.driver_data<towns_state>(); int line; int scanline; int height; @@ -1563,18 +1552,18 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, { scanline = rect->min_y; height = (rect->max_y - rect->min_y); - if(state->m_video.towns_crtc_reg[27] & 0x0010) + if(m_video.towns_crtc_reg[27] & 0x0010) height /= 2; - switch(state->m_video.towns_video_reg[0] & 0x03) + switch(m_video.towns_video_reg[0] & 0x03) { case 0x01: for(line=0;line<height;line++) { - towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline); scanline++; - if(state->m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom + if(m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom { - towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline); scanline++; } } @@ -1582,11 +1571,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, case 0x02: for(line=0;line<height;line++) { - towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); scanline++; - if(state->m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom + if(m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom { - towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); scanline++; } } @@ -1594,11 +1583,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, case 0x03: for(line=0;line<height;line++) { - towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); scanline++; - if(state->m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom + if(m_video.towns_crtc_reg[27] & 0x0010) // vertical zoom { - towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); scanline++; } } @@ -1609,18 +1598,18 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, { scanline = rect->min_y; height = (rect->max_y - rect->min_y); - if(state->m_video.towns_crtc_reg[27] & 0x1000) + if(m_video.towns_crtc_reg[27] & 0x1000) height /= 2; - switch(state->m_video.towns_video_reg[0] & 0x0c) + switch(m_video.towns_video_reg[0] & 0x0c) { case 0x04: for(line=0;line<height;line++) { - towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline); scanline++; - if(state->m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom + if(m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom { - towns_crtc_draw_scan_layer_16(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline); scanline++; } } @@ -1628,11 +1617,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, case 0x08: for(line=0;line<height;line++) { - towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); scanline++; - if(state->m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom + if(m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom { - towns_crtc_draw_scan_layer_256(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); scanline++; } } @@ -1640,11 +1629,11 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, case 0x0c: for(line=0;line<height;line++) { - towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); scanline++; - if(state->m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom + if(m_video.towns_crtc_reg[27] & 0x1000) // vertical zoom { - towns_crtc_draw_scan_layer_hicolour(machine,bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); scanline++; } } @@ -1653,17 +1642,16 @@ static void towns_crtc_draw_layer(running_machine &machine,bitmap_rgb32 &bitmap, } } -static void render_text_char(running_machine &machine, UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr) +void towns_state::render_text_char(UINT8 x, UINT8 y, UINT8 ascii, UINT16 jis, UINT8 attr) { - towns_state* state = machine.driver_data<towns_state>(); UINT32 rom_addr; UINT32 vram_addr; - UINT16 linesize = state->m_video.towns_crtc_reg[24] * 4; + UINT16 linesize = m_video.towns_crtc_reg[24] * 4; UINT8 code_h,code_l; UINT8 colour; UINT8 data; UINT8 temp; - UINT8* font_rom = state->memregion("user")->base(); + UINT8* font_rom = memregion("user")->base(); int a,b; // all characters are 16 pixels high @@ -1726,7 +1714,7 @@ static void render_text_char(running_machine &machine, UINT8 x, UINT8 y, UINT8 a temp |= ((colour & 0x0f) << 4); if(data & (1<<(b+1))) temp |= (colour & 0x0f); - //state->m_towns_gfxvram[0x40000+vram_addr+(b/2)] = temp; + //m_towns_gfxvram[0x40000+vram_addr+(b/2)] = temp; } vram_addr += linesize; @@ -1734,7 +1722,7 @@ static void render_text_char(running_machine &machine, UINT8 x, UINT8 y, UINT8 a } } -static void draw_text_layer(running_machine &machine) +void towns_state::draw_text_layer() { /* * Text format @@ -1753,14 +1741,13 @@ static void draw_text_layer(running_machine &machine) * * The video hardware renders text to VRAM layer 1, there is no separate text layer */ - towns_state* state = machine.driver_data<towns_state>(); int x,y,c = 0; for(y=0;y<40;y++) { for(x=0;x<80;x++) { - render_text_char(machine,x,y,state->m_towns_txtvram[c],((state->m_towns_txtvram[c+0x2000] << 8)|(state->m_towns_txtvram[c+0x2001])),state->m_towns_txtvram[c+1]); + render_text_char(x,y,m_towns_txtvram[c],((m_towns_txtvram[c+0x2000] << 8)|(m_towns_txtvram[c+0x2001])),m_towns_txtvram[c+1]); c+=2; } } @@ -1793,9 +1780,9 @@ INTERRUPT_GEN_MEMBER(towns_state::towns_vsync_irq) m_video.towns_vblank_flag = 1; machine().scheduler().timer_set(machine().primary_screen->time_until_vblank_end(), timer_expired_delegate(FUNC(towns_state::towns_vblank_end),this), 0, (void*)dev); if(m_video.towns_tvram_enable) - draw_text_layer(dev->machine()); + draw_text_layer(); if(m_video.towns_sprite_reg[1] & 0x80) - draw_sprites(dev->machine(),&m_video.towns_crtc_layerscr[1]); + draw_sprites(&m_video.towns_crtc_layerscr[1]); } void towns_state::video_start() @@ -1814,12 +1801,12 @@ UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c if(!machine().input().code_pressed(KEYCODE_Q)) { if((m_video.towns_layer_ctrl & 0x03) != 0) - towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[1],1); + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1); } if(!machine().input().code_pressed(KEYCODE_W)) { if((m_video.towns_layer_ctrl & 0x0c) != 0) - towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[0],0); + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0); } } else @@ -1827,12 +1814,12 @@ UINT32 towns_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c if(!machine().input().code_pressed(KEYCODE_Q)) { if((m_video.towns_layer_ctrl & 0x0c) != 0) - towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[0],0); + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[0],0); } if(!machine().input().code_pressed(KEYCODE_W)) { if((m_video.towns_layer_ctrl & 0x03) != 0) - towns_crtc_draw_layer(machine(),bitmap,&m_video.towns_crtc_layerscr[1],1); + towns_crtc_draw_layer(bitmap,&m_video.towns_crtc_layerscr[1],1); } } diff --git a/src/mess/video/gb.c b/src/mess/video/gb.c index a4eea04d8ff..d8b6e83d3c1 100644 --- a/src/mess/video/gb.c +++ b/src/mess/video/gb.c @@ -142,7 +142,7 @@ PALETTE_INIT_MEMBER(megaduck_state,megaduck) } -INLINE void gb_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void gb_state::gb_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = (UINT16)color; } diff --git a/src/mess/video/hec2video.c b/src/mess/video/hec2video.c index 628656bd003..4706450717d 100644 --- a/src/mess/video/hec2video.c +++ b/src/mess/video/hec2video.c @@ -37,10 +37,9 @@ #include "includes/hec2hrp.h" -static void Init_Hector_Palette( running_machine &machine) +void hec2hrp_state::Init_Hector_Palette() { - hec2hrp_state *state = machine.driver_data<hec2hrp_state>(); - UINT8 *hector_color = state->m_hector_color; + UINT8 *hector_color = m_hector_color; // basic colors ! hector_color[0] = 0; // fond (noir) hector_color[1] = 1; // HECTOR HRX (rouge) @@ -48,30 +47,29 @@ static void Init_Hector_Palette( running_machine &machine) hector_color[3] = 3; // Ecriture de choix (jaune) // Color initialisation : full lightning - palette_set_color( machine, 0,MAKE_RGB(000,000,000));//Noir - palette_set_color( machine, 1,MAKE_RGB(255,000,000));//Rouge - palette_set_color( machine, 2,MAKE_RGB(000,255,000));//Vert - palette_set_color( machine, 3,MAKE_RGB(255,255,000));//Jaune - palette_set_color( machine, 4,MAKE_RGB(000,000,255));//Bleu - palette_set_color( machine, 5,MAKE_RGB(255,000,255));//Magneta - palette_set_color( machine, 6,MAKE_RGB(000,255,255));//Cyan - palette_set_color( machine, 7,MAKE_RGB(255,255,255));//Blanc + palette_set_color( machine(), 0,MAKE_RGB(000,000,000));//Noir + palette_set_color( machine(), 1,MAKE_RGB(255,000,000));//Rouge + palette_set_color( machine(), 2,MAKE_RGB(000,255,000));//Vert + palette_set_color( machine(), 3,MAKE_RGB(255,255,000));//Jaune + palette_set_color( machine(), 4,MAKE_RGB(000,000,255));//Bleu + palette_set_color( machine(), 5,MAKE_RGB(255,000,255));//Magneta + palette_set_color( machine(), 6,MAKE_RGB(000,255,255));//Cyan + palette_set_color( machine(), 7,MAKE_RGB(255,255,255));//Blanc // 1/2 lightning - palette_set_color( machine, 8,MAKE_RGB(000,000,000));//Noir - palette_set_color( machine, 9,MAKE_RGB(128,000,000));//Rouge - palette_set_color( machine,10,MAKE_RGB(000,128,000));//Vert - palette_set_color( machine,11,MAKE_RGB(128,128,000));//Jaune - palette_set_color( machine,12,MAKE_RGB(000,000,128));//Bleu - palette_set_color( machine,13,MAKE_RGB(128,000,128));//Magneta - palette_set_color( machine,14,MAKE_RGB(000,128,128));//Cyan - palette_set_color( machine,15,MAKE_RGB(128,128,128));//Blanc + palette_set_color( machine(), 8,MAKE_RGB(000,000,000));//Noir + palette_set_color( machine(), 9,MAKE_RGB(128,000,000));//Rouge + palette_set_color( machine(),10,MAKE_RGB(000,128,000));//Vert + palette_set_color( machine(),11,MAKE_RGB(128,128,000));//Jaune + palette_set_color( machine(),12,MAKE_RGB(000,000,128));//Bleu + palette_set_color( machine(),13,MAKE_RGB(128,000,128));//Magneta + palette_set_color( machine(),14,MAKE_RGB(000,128,128));//Cyan + palette_set_color( machine(),15,MAKE_RGB(128,128,128));//Blanc } -void hector_hr(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) +void hec2hrp_state::hector_hr(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) { - hec2hrp_state *state = machine.driver_data<hec2hrp_state>(); - UINT8 *hector_color = state->m_hector_color; + UINT8 *hector_color = m_hector_color; UINT8 gfx,y; UINT16 sy=0,ma=0,x; for (y = 0; y <= ymax; y++) { //224 @@ -88,7 +86,7 @@ void hector_hr(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int } } -void hector_80c(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) +void hec2hrp_state::hector_80c(bitmap_ind16 &bitmap, UINT8 *page, int ymax, int yram) { UINT8 gfx,y; UINT16 sy=0,ma=0,x; @@ -113,7 +111,7 @@ void hector_80c(running_machine &machine, bitmap_ind16 &bitmap, UINT8 *page, int VIDEO_START_MEMBER(hec2hrp_state,hec2hrp) { - Init_Hector_Palette(machine()); + Init_Hector_Palette(); } UINT32 hec2hrp_state::screen_update_hec2hrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -125,18 +123,18 @@ UINT32 hec2hrp_state::screen_update_hec2hrp(screen_device &screen, bitmap_ind16 if (m_hector_flag_80c==0) { screen.set_visible_area(0, 243, 0, 227); - hector_hr( machine(), bitmap , &videoram_HR[0], 227, 64); + hector_hr(bitmap , &videoram_HR[0], 227, 64); } else { screen.set_visible_area(0, 243*2, 0, 227); - hector_80c( machine(), bitmap , &videoram_HR[0], 227, 64); + hector_80c(bitmap , &videoram_HR[0], 227, 64); } } else { screen.set_visible_area(0, 113, 0, 75); - hector_hr( machine(), bitmap, videoram, 77, 32); + hector_hr(bitmap, videoram, 77, 32); } return 0; } diff --git a/src/mess/video/intv.c b/src/mess/video/intv.c index 75d607cdf62..f688ff6a17f 100644 --- a/src/mess/video/intv.c +++ b/src/mess/video/intv.c @@ -423,9 +423,8 @@ void intv_state::render_background(bitmap_ind16 &bitmap) } #ifdef UNUSED_CODE -static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int transparency) +void intv_state::draw_background(bitmap_ind16 &bitmap, int transparency) { - intv_state *state = machine.driver_data<intv_state>(); // First, draw the background int offs = 0; int value = 0; @@ -441,17 +440,17 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int int j; - int x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay; - int y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay; + int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay; + int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay; - if (state->m_color_stack_mode == 1) + if (m_color_stack_mode == 1) { - state->m_color_stack_offset = 0; + m_color_stack_offset = 0; for(row = 0; row < STIC_BACKTAB_HEIGHT; row++) { for(col = 0; col < STIC_BACKTAB_WIDTH; col++) { - value = state->m_ram16[offs]; + value = m_ram16[offs]; n_bit = value & STIC_CSTM_ADV; p_bit = value & STIC_CSTM_FG3; @@ -464,10 +463,10 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int colorc = (value & STIC_CSQM_C) >> 6; colord = ((n_bit & STIC_CSQM_D2) >> 11) + ((value & STIC_CSQM_D10) >> 9); // color 7 if the top of the color stack in this mode - if (colora == 7) colora = state->m_stic_registers[STIC_CSR + STIC_CSR3]; - if (colorb == 7) colorb = state->m_stic_registers[STIC_CSR + STIC_CSR3]; - if (colorc == 7) colorc = state->m_stic_registers[STIC_CSR + STIC_CSR3]; - if (colord == 7) colord = state->m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colora == 7) colora = m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colorb == 7) colorb = m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colorc == 7) colorc = m_stic_registers[STIC_CSR + STIC_CSR3]; + if (colord == 7) colord = m_stic_registers[STIC_CSR + STIC_CSR3]; intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora); intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb); intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc); @@ -477,8 +476,8 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int { if (n_bit) // next color { - state->m_color_stack_offset += 1; - state->m_color_stack_offset &= (STIC_CSRS - 1); + m_color_stack_offset += 1; + m_color_stack_offset &= (STIC_CSRS - 1); } if (p_bit) // pastel color set @@ -486,22 +485,22 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int else fgcolor = value & STIC_CSTM_FG20; - bgcolor = state->m_stic_registers[STIC_CSR + state->m_color_stack_offset]; + bgcolor = m_stic_registers[STIC_CSR + m_color_stack_offset]; code = (value & STIC_CSTM_C)>>3; if (g_bit) // read from gram { code &= (STIC_CSTM_C50 >> 3); // keep from going outside the array - //if (state->m_gramdirtybytes[code] == 1) + //if (m_gramdirtybytes[code] == 1) { - decodechar(machine.gfx[1], + decodechar(machine().gfx[1], code, - state->m_gram, - machine.config()->gfxdecodeinfo[1].gfxlayout); - state->m_gramdirtybytes[code] = 0; + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; } // Draw GRAM char - drawgfx(bitmap,machine.gfx[1], + drawgfx(bitmap,machine().gfx[1], code, bgcolor*16+fgcolor, 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, @@ -515,7 +514,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int } else // read from grom { - drawgfx(bitmap,machine.gfx[0], + drawgfx(bitmap,machine().gfx[0], code, bgcolor*16+fgcolor, 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, @@ -538,23 +537,23 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int { for(col = 0; col < STIC_BACKTAB_WIDTH; col++) { - value = state->m_ram16[offs]; + value = m_ram16[offs]; fgcolor = value & STIC_FBM_FG; bgcolor = ((value & STIC_FBM_BG2) >> 11) + ((value & STIC_FBM_BG310) >> 9); code = (value & STIC_FBM_C) >> 3; if (value & STIC_FBM_SEL) // read for GRAM { - //if (state->m_gramdirtybytes[code] == 1) + //if (m_gramdirtybytes[code] == 1) { - decodechar(machine.gfx[1], + decodechar(machine().gfx[1], code, - state->m_gram, - machine.config()->gfxdecodeinfo[1].gfxlayout); - state->m_gramdirtybytes[code] = 0; + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; } // Draw GRAM char - drawgfx(bitmap,machine.gfx[1], + drawgfx(bitmap,machine().gfx[1], code, bgcolor*16+fgcolor, 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, @@ -562,7 +561,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int } else // read from GROM { - drawgfx(bitmap,machine.gfx[0], + drawgfx(bitmap,machine().gfx[0], code, bgcolor*16+fgcolor, 0,0, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, @@ -577,17 +576,16 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int /* TBD: need to handle sprites behind foreground? */ #ifdef UNUSED_FUNCTION -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int behind_foreground) +void intv_state::draw_sprites(bitmap_ind16 &bitmap, int behind_foreground) { - intv_state *state = machine.driver_data<intv_state>(); int i; int code; - int x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay - STIC_CARD_WIDTH; - int y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay - STIC_CARD_HEIGHT; + int x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH; + int y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT; for(i = STIC_MOBS - 1; i >= 0; --i) { - intv_sprite_type *s = &state->m_sprite[i]; + intv_sprite_type *s = &m_sprite[i]; if (s->visible && (s->behind_foreground == behind_foreground)) { code = s->card; @@ -596,16 +594,16 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh code %= 64; // keep from going outside the array if (s->yres == 1) { - //if (state->m_gramdirtybytes[code] == 1) + //if (m_gramdirtybytes[code] == 1) { - decodechar(machine.gfx[1], + decodechar(machine().gfx[1], code, - state->m_gram, - machine.config()->gfxdecodeinfo[1].gfxlayout); - state->m_gramdirtybytes[code] = 0; + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; } // Draw GRAM char - drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], + drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1], code, s->color, s->xflip,s->yflip, @@ -614,27 +612,27 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh } else { - //if ((state->m_gramdirtybytes[code] == 1) || (state->m_gramdirtybytes[code+1] == 1)) + //if ((m_gramdirtybytes[code] == 1) || (m_gramdirtybytes[code+1] == 1)) { - decodechar(machine.gfx[1], + decodechar(machine().gfx[1], code, - state->m_gram, - machine.config()->gfxdecodeinfo[1].gfxlayout); - decodechar(machine.gfx[1], + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + decodechar(machine().gfx[1], code+1, - state->m_gram, - machine.config()->gfxdecodeinfo[1].gfxlayout); - state->m_gramdirtybytes[code] = 0; - state->m_gramdirtybytes[code+1] = 0; + m_gram, + machine().config()->gfxdecodeinfo[1].gfxlayout); + m_gramdirtybytes[code] = 0; + m_gramdirtybytes[code+1] = 0; } // Draw GRAM char - drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], + drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1], code, s->color, s->xflip,s->yflip, (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, 0x8000*s->xsize, 0x8000*s->ysize,0); - drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[1], + drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[1], code+1, s->color, s->xflip,s->yflip, @@ -647,7 +645,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh if (s->yres == 1) { // Draw GROM char - drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], + drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0], code, s->color, s->xflip,s->yflip, @@ -656,13 +654,13 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh } else { - drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], + drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0], code, s->color, s->xflip,s->yflip, (s->xpos + x0) * STIC_X_SCALE, (s->ypos + y0) * STIC_Y_SCALE + s->yflip * s->ysize * STIC_CARD_HEIGHT, 0x8000*s->xsize, 0x8000*s->ysize,0); - drawgfxzoom_transpen(bitmap,&machine.screen[0].visarea,machine.gfx[0], + drawgfxzoom_transpen(bitmap,&machine().screen[0].visarea,machine().gfx[0], code+1, s->color, s->xflip,s->yflip, diff --git a/src/mess/video/lviv.c b/src/mess/video/lviv.c index 711daa4c599..c9e770e0277 100644 --- a/src/mess/video/lviv.c +++ b/src/mess/video/lviv.c @@ -34,29 +34,28 @@ void lviv_state::palette_init() } -void lviv_update_palette(running_machine &machine, UINT8 pal) +void lviv_state::lviv_update_palette(UINT8 pal) { - lviv_state *state = machine.driver_data<lviv_state>(); - state->m_colortable[0][0] = 0; - state->m_colortable[0][1] = 0; - state->m_colortable[0][2] = 0; - state->m_colortable[0][3] = 0; - - state->m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; - state->m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00; - state->m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00; - - state->m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; - state->m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00; - state->m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01; - - state->m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00; - state->m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02; - state->m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00; - - state->m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04; - state->m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00; - state->m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00; + m_colortable[0][0] = 0; + m_colortable[0][1] = 0; + m_colortable[0][2] = 0; + m_colortable[0][3] = 0; + + m_colortable[0][0] |= (((pal>>3)&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; + m_colortable[0][0] |= ((pal>>5)&0x01) ? 0x02 : 0x00; + m_colortable[0][0] |= (((pal>>2)&0x01) == ((pal>>6)&0x01)) ? 0x01 : 0x00; + + m_colortable[0][1] |= ((pal&0x01) == ((pal>>4)&0x01)) ? 0x04 : 0x00; + m_colortable[0][1] |= ((pal>>5)&0x01) ? 0x02 : 0x00; + m_colortable[0][1] |= ((pal>>6)&0x01) ? 0x00 : 0x01; + + m_colortable[0][2] |= ((pal>>4)&0x01) ? 0x04 : 0x00; + m_colortable[0][2] |= ((pal>>5)&0x01) ? 0x00 : 0x02; + m_colortable[0][2] |= ((pal>>6)&0x01) ? 0x01 : 0x00; + + m_colortable[0][3] |= ((pal>>4)&0x01) ? 0x00 : 0x04; + m_colortable[0][3] |= (((pal>>1)&0x01) == ((pal>>5)&0x01)) ? 0x02 : 0x00; + m_colortable[0][3] |= ((pal>>6)&0x01) ? 0x01 : 0x00; } void lviv_state::video_start() diff --git a/src/mess/video/mac.c b/src/mess/video/mac.c index 3fe0bbc5d8b..8057d8c49b4 100644 --- a/src/mess/video/mac.c +++ b/src/mess/video/mac.c @@ -860,22 +860,22 @@ UINT32 mac_state::screen_update_macsonora(screen_device &screen, bitmap_rgb32 &b // DAFB: video for Quadra 700/900 -static void dafb_recalc_ints(mac_state *mac) +void mac_state::dafb_recalc_ints() { - if (mac->m_dafb_int_status != 0) + if (m_dafb_int_status != 0) { - mac->nubus_slot_interrupt(0xf, ASSERT_LINE); + nubus_slot_interrupt(0xf, ASSERT_LINE); } else { - mac->nubus_slot_interrupt(0xf, CLEAR_LINE); + nubus_slot_interrupt(0xf, CLEAR_LINE); } } TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick) { m_dafb_int_status |= 1; - dafb_recalc_ints(this); + dafb_recalc_ints(); m_vbl_timer->adjust(m_screen->time_until_pos(480, 0), 0); } @@ -883,7 +883,7 @@ TIMER_CALLBACK_MEMBER(mac_state::dafb_vbl_tick) TIMER_CALLBACK_MEMBER(mac_state::dafb_cursor_tick) { m_dafb_int_status |= 4; - dafb_recalc_ints(this); + dafb_recalc_ints(); m_cursor_timer->adjust(m_screen->time_until_pos(m_cursor_line, 0), 0); } @@ -932,12 +932,12 @@ READ32_MEMBER(mac_state::dafb_r) case 0x10c: // clear cursor scanline int m_dafb_int_status &= ~4; - dafb_recalc_ints(this); + dafb_recalc_ints(); break; case 0x114: // clear VBL int m_dafb_int_status &= ~1; - dafb_recalc_ints(this); + dafb_recalc_ints(); break; } return 0; @@ -975,7 +975,7 @@ WRITE32_MEMBER(mac_state::dafb_w) { m_vbl_timer->adjust(attotime::never); m_dafb_int_status &= ~1; - dafb_recalc_ints(this); + dafb_recalc_ints(); } if (data & 2) // aux scanline interrupt enable @@ -991,18 +991,18 @@ WRITE32_MEMBER(mac_state::dafb_w) { m_cursor_timer->adjust(attotime::never); m_dafb_int_status &= ~4; - dafb_recalc_ints(this); + dafb_recalc_ints(); } break; case 0x10c: // clear cursor scanline int m_dafb_int_status &= ~4; - dafb_recalc_ints(this); + dafb_recalc_ints(); break; case 0x114: // clear VBL int m_dafb_int_status &= ~1; - dafb_recalc_ints(this); + dafb_recalc_ints(); break; } } diff --git a/src/mess/video/nc.c b/src/mess/video/nc.c index 706ce99597c..5bbcca01bdd 100644 --- a/src/mess/video/nc.c +++ b/src/mess/video/nc.c @@ -41,10 +41,9 @@ void nc_state::palette_init() } -void nc200_video_set_backlight(running_machine &machine, int state) +void nc_state::nc200_video_set_backlight(int state) { - nc_state *drvstate = machine.driver_data<nc_state>(); - drvstate->m_nc200_backlight = state; + m_nc200_backlight = state; } diff --git a/src/mess/video/oric.c b/src/mess/video/oric.c index 007c7f3e5eb..054515d1e92 100644 --- a/src/mess/video/oric.c +++ b/src/mess/video/oric.c @@ -137,7 +137,7 @@ void oric_state::oric_vh_update_attribute(UINT8 c) /* render 6-pixels using foreground and background colours specified */ /* used in hires and text mode */ -static void oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag) +void oric_state::oric_vh_render_6pixels(bitmap_ind16 &bitmap, int x, UINT8 y, UINT8 fg, UINT8 bg, UINT8 data, bool invert_flag) { /* invert? */ if (invert_flag) diff --git a/src/mess/video/pcw.c b/src/mess/video/pcw.c index ff4ef0c02f7..d8e18d7973f 100644 --- a/src/mess/video/pcw.c +++ b/src/mess/video/pcw.c @@ -10,7 +10,7 @@ #include "includes/pcw.h" #include "machine/ram.h" -INLINE void pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void pcw_state::pcw_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = (UINT16)color; } diff --git a/src/mess/video/pcw16.c b/src/mess/video/pcw16.c index 6c9c1aac058..e7bba7267c5 100644 --- a/src/mess/video/pcw16.c +++ b/src/mess/video/pcw16.c @@ -48,7 +48,7 @@ static const rgb_t pcw16_palette[PCW16_NUM_COLOURS] = }; -INLINE void pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = (UINT16)color; } @@ -64,7 +64,7 @@ void pcw16_state::video_start() } /* 640, 1 bit per pixel */ -static void pcw16_vh_decode_mode0(pcw16_state *state, bitmap_ind16 &bitmap, int x, int y, unsigned char byte) +void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) { int b; int local_byte; @@ -73,8 +73,8 @@ static void pcw16_vh_decode_mode0(pcw16_state *state, bitmap_ind16 &bitmap, int local_byte = byte; - cols[0] = state->m_colour_palette[0]; - cols[1] = state->m_colour_palette[1]; + cols[0] = m_colour_palette[0]; + cols[1] = m_colour_palette[1]; px = x; for (b=0; b<8; b++) @@ -87,7 +87,7 @@ static void pcw16_vh_decode_mode0(pcw16_state *state, bitmap_ind16 &bitmap, int } /* 320, 2 bits per pixel */ -static void pcw16_vh_decode_mode1(pcw16_state *state, bitmap_ind16 &bitmap, int x, int y, unsigned char byte) +void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) { int b; int px; @@ -96,7 +96,7 @@ static void pcw16_vh_decode_mode1(pcw16_state *state, bitmap_ind16 &bitmap, int for (b=0; b<3; b++) { - cols[b] = state->m_colour_palette[b]; + cols[b] = m_colour_palette[b]; } local_byte = byte; @@ -118,15 +118,15 @@ static void pcw16_vh_decode_mode1(pcw16_state *state, bitmap_ind16 &bitmap, int } /* 160, 4 bits per pixel */ -static void pcw16_vh_decode_mode2(pcw16_state *state, bitmap_ind16 &bitmap, int x, int y, unsigned char byte) +void pcw16_state::pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte) { int px; int b; int local_byte; int cols[2]; - cols[0] = state->m_colour_palette[0]; - cols[1] = state->m_colour_palette[1]; + cols[0] = m_colour_palette[0]; + cols[1] = m_colour_palette[1]; local_byte = byte; px = x; @@ -233,20 +233,20 @@ UINT32 pcw16_state::screen_update_pcw16(screen_device &screen, bitmap_ind16 &bit { case 0: { - pcw16_vh_decode_mode0(this, bitmap, x, y+PCW16_BORDER_HEIGHT, byte); + pcw16_vh_decode_mode0(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); } break; case 1: { - pcw16_vh_decode_mode1(this, bitmap, x, y+PCW16_BORDER_HEIGHT, byte); + pcw16_vh_decode_mode1(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); } break; case 3: case 2: { - pcw16_vh_decode_mode2(this, bitmap, x, y+PCW16_BORDER_HEIGHT, byte); + pcw16_vh_decode_mode2(bitmap, x, y+PCW16_BORDER_HEIGHT, byte); } break; } diff --git a/src/mess/video/pdp1.c b/src/mess/video/pdp1.c index b7064d984af..509950077b5 100644 --- a/src/mess/video/pdp1.c +++ b/src/mess/video/pdp1.c @@ -25,15 +25,7 @@ - - -static void pdp1_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap); -static void pdp1_draw_panel(running_machine &machine, bitmap_ind16 &bitmap); - -static void pdp1_erase_lightpen(pdp1_state *state, bitmap_ind16 &bitmap); -static void pdp1_draw_lightpen(pdp1_state *state, bitmap_ind16 &bitmap); - -INLINE void pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void pdp1_state::pdp1_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = color; } @@ -50,7 +42,7 @@ void pdp1_state::video_start() m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16); /* set up out bitmaps */ - pdp1_draw_panel_backdrop(machine(), m_panel_bitmap); + pdp1_draw_panel_backdrop(m_panel_bitmap); const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); @@ -71,13 +63,12 @@ void pdp1_state::screen_eof_pdp1(screen_device &screen, bool state) /* schedule a pixel to be plotted */ -void pdp1_plot(running_machine &machine, int x, int y) +void pdp1_state::pdp1_plot(int x, int y) { - pdp1_state *state = machine.driver_data<pdp1_state>(); /* compute pixel coordinates and plot */ x = x*crt_window_width/01777; y = y*crt_window_height/01777; - state->m_crt->plot(x, y); + m_crt->plot(x, y); } @@ -86,11 +77,11 @@ void pdp1_plot(running_machine &machine, int x, int y) */ UINT32 pdp1_state::screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - pdp1_erase_lightpen(this, bitmap); + pdp1_erase_lightpen(bitmap); m_crt->update(bitmap); - pdp1_draw_lightpen(this, bitmap); + pdp1_draw_lightpen(bitmap); - pdp1_draw_panel(machine(), m_panel_bitmap); + pdp1_draw_panel(m_panel_bitmap); copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); @@ -148,7 +139,7 @@ enum }; /* draw a small 8*8 LED (or is this a lamp? ) */ -static void pdp1_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state) +void pdp1_state::pdp1_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) { int xx, yy; @@ -158,13 +149,13 @@ static void pdp1_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x, } /* draw nb_bits leds which represent nb_bits bits in value */ -static void pdp1_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +void pdp1_state::pdp1_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) { while (nb_bits) { nb_bits--; - pdp1_draw_led(machine, bitmap, x, y, (value >> nb_bits) & 1); + pdp1_draw_led(bitmap, x, y, (value >> nb_bits) & 1); x += 8; } @@ -172,7 +163,7 @@ static void pdp1_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap /* draw a small 8*8 switch */ -static void pdp1_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state) +void pdp1_state::pdp1_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state) { int xx, yy; int i; @@ -213,13 +204,13 @@ static void pdp1_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int /* draw nb_bits switches which represent nb_bits bits in value */ -static void pdp1_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +void pdp1_state::pdp1_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) { while (nb_bits) { nb_bits--; - pdp1_draw_switch(machine, bitmap, x, y, (value >> nb_bits) & 1); + pdp1_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); x += 8; } @@ -227,18 +218,18 @@ static void pdp1_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bit /* write a single char on screen */ -static void pdp1_draw_char(running_machine &machine, bitmap_ind16 &bitmap, char character, int x, int y, int color) +void pdp1_state::pdp1_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) { - drawgfx_transpen(bitmap, bitmap.cliprect(), machine.gfx[0], character-32, color, 0, 0, + drawgfx_transpen(bitmap, bitmap.cliprect(), machine().gfx[0], character-32, color, 0, 0, x+1, y, 0); } /* write a string on screen */ -static void pdp1_draw_string(running_machine &machine, bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) +void pdp1_state::pdp1_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) { while (* buf) { - pdp1_draw_char(machine, bitmap, *buf, x, y, color); + pdp1_draw_char(bitmap, *buf, x, y, color); x += 8; buf++; @@ -249,98 +240,96 @@ static void pdp1_draw_string(running_machine &machine, bitmap_ind16 &bitmap, con /* draw the operator control panel (fixed backdrop) */ -static void pdp1_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap) +void pdp1_state::pdp1_draw_panel_backdrop(bitmap_ind16 &bitmap) { - pdp1_state *state = machine.driver_data<pdp1_state>(); /* fill with black */ const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1); - state->m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); + m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); /* column 1: registers, test word, test address */ - pdp1_draw_string(machine, bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); + pdp1_draw_string(bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption); + pdp1_draw_string(bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); + pdp1_draw_string(bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); + pdp1_draw_string(bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption); + pdp1_draw_string(bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption); + pdp1_draw_string(bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); /* column separator */ bitmap.plot_box(x_panel_col2_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); /* column 2: 1-bit indicators */ - pdp1_draw_string(machine, bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); + pdp1_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); + pdp1_draw_string(bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption); + pdp1_draw_string(bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption); + pdp1_draw_string(bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption); + pdp1_draw_string(bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption); + pdp1_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); + pdp1_draw_string(bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption); + pdp1_draw_string(bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption); + pdp1_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); + pdp1_draw_string(bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption); + pdp1_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); /* column separator */ bitmap.plot_box(x_panel_col3_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); /* column 3: power, single step, single inst, sense, flags, instr... */ - pdp1_draw_string(machine, bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption); + pdp1_draw_string(bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption); + pdp1_draw_string(bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption); + pdp1_draw_string(bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption); /* separator */ bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep1_offset+4, 96, 1, pen_panel_caption); - pdp1_draw_string(machine, bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption); + pdp1_draw_string(bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption); /* separator */ bitmap.plot_box(x_panel_col3_offset+8, y_panel_sep2_offset+4, 96, 1, pen_panel_caption); - pdp1_draw_string(machine, bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption); - pdp1_draw_string(machine, bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption); + pdp1_draw_string(bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption); + pdp1_draw_string(bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption); } /* draw the operator control panel (dynamic elements) */ -static void pdp1_draw_panel(running_machine &machine, bitmap_ind16 &bitmap) +void pdp1_state::pdp1_draw_panel(bitmap_ind16 &bitmap) { - pdp1_state *state = machine.driver_data<pdp1_state>(); /* column 1: registers, test word, test address */ - pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8,state->m_maincpu->state_int(PDP1_PC), 16); - pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8,state->m_maincpu->state_int(PDP1_MA), 16); - pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8,state->m_maincpu->state_int(PDP1_MB), 18); - pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8,state->m_maincpu->state_int(PDP1_AC), 18); - pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8,state->m_maincpu->state_int(PDP1_IO), 18); - pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8,state->m_maincpu->state_int(PDP1_EXTEND_SW)); - pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8,state->m_maincpu->state_int(PDP1_TA), 16); - pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8,state->m_maincpu->state_int(PDP1_TW), 18); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_pc_offset+8,m_maincpu->state_int(PDP1_PC), 16); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset+16, y_panel_ma_offset+8,m_maincpu->state_int(PDP1_MA), 16); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_mb_offset+8,m_maincpu->state_int(PDP1_MB), 18); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_ac_offset+8,m_maincpu->state_int(PDP1_AC), 18); + pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_io_offset+8,m_maincpu->state_int(PDP1_IO), 18); + pdp1_draw_switch(bitmap, x_panel_col1_offset, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_EXTEND_SW)); + pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset+16, y_panel_ta_offset+8,m_maincpu->state_int(PDP1_TA), 16); + pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset, y_panel_tw_offset+8,m_maincpu->state_int(PDP1_TW), 18); /* column 2: 1-bit indicators */ - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset,state->m_maincpu->state_int(PDP1_RUN)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset,state->m_maincpu->state_int(PDP1_CYC)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset,state->m_maincpu->state_int(PDP1_DEFER)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset,state->m_maincpu->state_int(PDP1_BRK_CTR) & 1); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset,state->m_maincpu->state_int(PDP1_BRK_CTR) & 2); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset,state->m_maincpu->state_int(PDP1_OV)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset,state->m_maincpu->state_int(PDP1_RIM)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset,state->m_maincpu->state_int(PDP1_SBM)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset,state->m_maincpu->state_int(PDP1_EXD)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset,state->m_maincpu->state_int(PDP1_IOH)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset,state->m_maincpu->state_int(PDP1_IOC)); - pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset,state->m_maincpu->state_int(PDP1_IOS)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset,m_maincpu->state_int(PDP1_RUN)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_cyc_offset,m_maincpu->state_int(PDP1_CYC)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_defer_offset,m_maincpu->state_int(PDP1_DEFER)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 1); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset,m_maincpu->state_int(PDP1_BRK_CTR) & 2); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ov_offset,m_maincpu->state_int(PDP1_OV)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset,m_maincpu->state_int(PDP1_RIM)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_sbm_offset,m_maincpu->state_int(PDP1_SBM)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_exd_offset,m_maincpu->state_int(PDP1_EXD)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset,m_maincpu->state_int(PDP1_IOH)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioc_offset,m_maincpu->state_int(PDP1_IOC)); + pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset,m_maincpu->state_int(PDP1_IOS)); /* column 3: power, single step, single inst, sense, flags, instr... */ - pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ - pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ - pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset,state->m_maincpu->state_int(PDP1_SNGL_STEP)); - pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset,state->m_maincpu->state_int(PDP1_SNGL_STEP)); - pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset,state->m_maincpu->state_int(PDP1_SNGL_INST)); - pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset,state->m_maincpu->state_int(PDP1_SNGL_INST)); - pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8,state->m_maincpu->state_int(PDP1_SS), 6); - pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+16,state->m_maincpu->state_int(PDP1_SS), 6); - pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8,state->m_maincpu->state_int(PDP1_PF), 6); - pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8,state->m_maincpu->state_int(PDP1_IR), 5); + pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ + pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ + pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP)); + pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset,m_maincpu->state_int(PDP1_SNGL_STEP)); + pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST)); + pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset,m_maincpu->state_int(PDP1_SNGL_INST)); + pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ss_offset+8,m_maincpu->state_int(PDP1_SS), 6); + pdp1_draw_multipleswitch(bitmap, x_panel_col3_offset, y_panel_ss_offset+16,m_maincpu->state_int(PDP1_SS), 6); + pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_pf_offset+8,m_maincpu->state_int(PDP1_PF), 6); + pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ir_offset+8,m_maincpu->state_int(PDP1_IR), 5); } @@ -364,25 +353,23 @@ enum }; -static void pdp1_typewriter_linefeed(running_machine &machine) +void pdp1_state::pdp1_typewriter_linefeed() { - pdp1_state *state = machine.driver_data<pdp1_state>(); UINT8 buf[typewriter_window_width]; int y; for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - extract_scanline8(state->m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); - draw_scanline8(state->m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine.pens); + extract_scanline8(m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); + draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine().pens); } const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1); - state->m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); + m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); } -void pdp1_typewriter_drawchar(running_machine &machine, int character) +void pdp1_state::pdp1_typewriter_drawchar(int character) { - pdp1_state *state = machine.driver_data<pdp1_state>(); static const char ascii_table[2][64] = { /* n-s = non-spacing */ { /* lower case */ @@ -431,57 +418,57 @@ void pdp1_typewriter_drawchar(running_machine &machine, int character) { case 034: /* Black */ - state->m_typewriter_color = color_typewriter_black; + m_typewriter_color = color_typewriter_black; break; case 035: /* Red */ - state->m_typewriter_color = color_typewriter_red; + m_typewriter_color = color_typewriter_red; break; case 036: /* Tab */ - state->m_pos = state->m_pos + tab_step - (state->m_pos % tab_step); + m_pos = m_pos + tab_step - (m_pos % tab_step); break; case 072: /* Lower case */ - state->m_case_shift = 0; + m_case_shift = 0; break; case 074: /* Upper case */ - state->m_case_shift = 1; + m_case_shift = 1; break; case 075: /* Backspace */ - if (state->m_pos) - state->m_pos--; + if (m_pos) + m_pos--; break; case 077: /* Carriage Return */ - state->m_pos = 0; - pdp1_typewriter_linefeed(machine); + m_pos = 0; + pdp1_typewriter_linefeed(); break; default: /* Any printable character... */ - if (state->m_pos >= 80) + if (m_pos >= 80) { /* if past right border, wrap around. (Right???) */ - pdp1_typewriter_linefeed(machine); /* next line */ - state->m_pos = 0; /* return to start of line */ + pdp1_typewriter_linefeed(); /* next line */ + m_pos = 0; /* return to start of line */ } /* print character (lookup ASCII equivalent in table) */ - pdp1_draw_char(machine, state->m_typewriter_bitmap, ascii_table[state->m_case_shift][character], - 8*state->m_pos, typewriter_write_offset_y, - state->m_typewriter_color); /* print char */ + pdp1_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character], + 8*m_pos, typewriter_write_offset_y, + m_typewriter_color); /* print char */ if ((character!= 040) && (character!= 056)) /* 040 and 056 are non-spacing characters */ - state->m_pos++; /* step carriage forward */ + m_pos++; /* step carriage forward */ break; } @@ -493,14 +480,13 @@ void pdp1_typewriter_drawchar(running_machine &machine, int character) lightpen code */ -void pdp1_update_lightpen_state(running_machine &machine, const lightpen_t *new_state) +void pdp1_state::pdp1_update_lightpen_state(const lightpen_t *new_state) { - pdp1_state *state = machine.driver_data<pdp1_state>(); - state->m_lightpen_state = *new_state; + m_lightpen_state = *new_state; } #if 1 -static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_) +void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color_) { int interval; int a; @@ -535,7 +521,7 @@ static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int } } #else -static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color) +void pdp1_state::pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int color) { float fx, fy; float interval; @@ -567,40 +553,40 @@ static void pdp1_draw_circle(bitmap_ind16 &bitmap, int x, int y, int radius, int } #endif -static void pdp1_erase_lightpen(pdp1_state *state, bitmap_ind16 &bitmap) +void pdp1_state::pdp1_erase_lightpen(bitmap_ind16 &bitmap) { - if (state->m_previous_lightpen_state.active) + if (m_previous_lightpen_state.active) { #if 0 - if (state->m_previous_lightpen_state.x>0) - pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2-1, state->m_previous_lightpen_state.y/2, pen_black); - if (state->m_previous_lightpen_state.x<1023) - pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2+1, state->m_previous_lightpen_state.y/2, pen_black); - if (state->m_previous_lightpen_state.y>0) - pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2, state->m_previous_lightpen_state.y/2-1, pen_black); - if (state->m_previous_lightpen_state.y<1023) - pdp1_plot_pixel(bitmap, state->m_previous_lightpen_state.x/2, state->m_previous_lightpen_state.y/2+1, pen_black); + if (m_previous_lightpen_state.x>0) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2-1, m_previous_lightpen_state.y/2, pen_black); + if (m_previous_lightpen_state.x<1023) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2+1, m_previous_lightpen_state.y/2, pen_black); + if (m_previous_lightpen_state.y>0) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2-1, pen_black); + if (m_previous_lightpen_state.y<1023) + pdp1_plot_pixel(bitmap, m_previous_lightpen_state.x/2, m_previous_lightpen_state.y/2+1, pen_black); #endif - pdp1_draw_circle(bitmap, state->m_previous_lightpen_state.x, state->m_previous_lightpen_state.y, state->m_previous_lightpen_state.radius, pen_black); + pdp1_draw_circle(bitmap, m_previous_lightpen_state.x, m_previous_lightpen_state.y, m_previous_lightpen_state.radius, pen_black); } } -static void pdp1_draw_lightpen(pdp1_state *state, bitmap_ind16 &bitmap) +void pdp1_state::pdp1_draw_lightpen(bitmap_ind16 &bitmap) { - if (state->m_lightpen_state.active) + if (m_lightpen_state.active) { - int color_ = state->m_lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed; + int color_ = m_lightpen_state.down ? pen_lightpen_pressed : pen_lightpen_nonpressed; #if 0 - if (state->m_lightpen_state.x>0) - pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2-1, state->m_lightpen_state.y/2, color); - if (state->m_lightpen_state.x<1023) - pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2+1, state->m_lightpen_state.y/2, color); - if (state->m_lightpen_state.y>0) - pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2, state->m_lightpen_state.y/2-1, color); - if (state->m_lightpen_state.y<1023) - pdp1_plot_pixel(bitmap, state->m_lightpen_state.x/2, state->m_lightpen_state.y/2+1, color); + if (m_lightpen_state.x>0) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2-1, m_lightpen_state.y/2, color); + if (m_lightpen_state.x<1023) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2+1, m_lightpen_state.y/2, color); + if (m_lightpen_state.y>0) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2-1, color); + if (m_lightpen_state.y<1023) + pdp1_plot_pixel(bitmap, m_lightpen_state.x/2, m_lightpen_state.y/2+1, color); #endif - pdp1_draw_circle(bitmap, state->m_lightpen_state.x, state->m_lightpen_state.y, state->m_lightpen_state.radius, color_); + pdp1_draw_circle(bitmap, m_lightpen_state.x, m_lightpen_state.y, m_lightpen_state.radius, color_); } - state->m_previous_lightpen_state = state->m_lightpen_state; + m_previous_lightpen_state = m_lightpen_state; } diff --git a/src/mess/video/primo.c b/src/mess/video/primo.c index 4e03c447253..4fa834f0c7a 100644 --- a/src/mess/video/primo.c +++ b/src/mess/video/primo.c @@ -13,9 +13,8 @@ -static void primo_draw_scanline(running_machine &machine,bitmap_ind16 &bitmap, int primo_scanline) +void primo_state::primo_draw_scanline(bitmap_ind16 &bitmap, int primo_scanline) { - primo_state *state = machine.driver_data<primo_state>(); int x, i; UINT8 data; @@ -23,7 +22,7 @@ static void primo_draw_scanline(running_machine &machine,bitmap_ind16 &bitmap, i UINT16 *scanline = &bitmap.pix16(primo_scanline); /* address of current line in Primo video memory */ - const UINT8* primo_video_ram_line = (const UINT8*)state->m_maincpu->space(AS_PROGRAM).get_read_ptr(state->m_video_memory_base + 32 * primo_scanline); + const UINT8* primo_video_ram_line = (const UINT8*)m_maincpu->space(AS_PROGRAM).get_read_ptr(m_video_memory_base + 32 * primo_scanline); for (x=0; x<256; x+=8) { @@ -41,6 +40,6 @@ UINT32 primo_state::screen_update_primo(screen_device &screen, bitmap_ind16 &bit int primo_scanline; for (primo_scanline=0; primo_scanline<192; primo_scanline++) - primo_draw_scanline(machine(), bitmap, primo_scanline); + primo_draw_scanline( bitmap, primo_scanline); return 0; } diff --git a/src/mess/video/samcoupe.c b/src/mess/video/samcoupe.c index 47d3c1e40a0..abb9091274d 100644 --- a/src/mess/video/samcoupe.c +++ b/src/mess/video/samcoupe.c @@ -37,10 +37,9 @@ UINT32 samcoupe_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap return 0; } -static void draw_mode4_line(running_machine &machine, int y, int hpos) +void samcoupe_state::draw_mode4_line(int y, int hpos) { - samcoupe_state *state = machine.driver_data<samcoupe_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; /* get start address */ UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); @@ -48,24 +47,23 @@ static void draw_mode4_line(running_machine &machine, int y, int hpos) for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 2 pixels (doublewidth) */ - state->m_bitmap.pix16(y, hpos + i * 4 + 0) = state->m_clut[(*vram >> 4) & 0x0f]; - state->m_bitmap.pix16(y, hpos + i * 4 + 1) = state->m_clut[(*vram >> 4) & 0x0f]; - state->m_bitmap.pix16(y, hpos + i * 4 + 2) = state->m_clut[(*vram >> 0) & 0x0f]; - state->m_bitmap.pix16(y, hpos + i * 4 + 3) = state->m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 0) & 0x0f]; + m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x0f]; /* move to next address */ vram++; /* attribute register contains the third displayed byte */ if (i == 2) - state->m_attribute = *vram; + m_attribute = *vram; } } -static void draw_mode3_line(running_machine &machine, int y, int hpos) +void samcoupe_state::draw_mode3_line(int y, int hpos) { - samcoupe_state *state = machine.driver_data<samcoupe_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; /* get start address */ UINT8 *vram = videoram + ((y - SAM_BORDER_TOP) * 128) + ((hpos - SAM_BORDER_LEFT) / 4); @@ -73,25 +71,25 @@ static void draw_mode3_line(running_machine &machine, int y, int hpos) for (int i = 0; i < (SAM_BLOCK*2)/4; i++) { /* draw 4 pixels */ - state->m_bitmap.pix16(y, hpos + i * 4 + 0) = state->m_clut[(*vram >> 6) & 0x03]; - state->m_bitmap.pix16(y, hpos + i * 4 + 1) = state->m_clut[(*vram >> 4) & 0x03]; - state->m_bitmap.pix16(y, hpos + i * 4 + 2) = state->m_clut[(*vram >> 2) & 0x03]; - state->m_bitmap.pix16(y, hpos + i * 4 + 3) = state->m_clut[(*vram >> 0) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 0) = m_clut[(*vram >> 6) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 1) = m_clut[(*vram >> 4) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 2) = m_clut[(*vram >> 2) & 0x03]; + m_bitmap.pix16(y, hpos + i * 4 + 3) = m_clut[(*vram >> 0) & 0x03]; /* move to next address */ vram++; /* attribute register contains the third displayed byte */ if (i == 2) - state->m_attribute = *vram; + m_attribute = *vram; } } -static void draw_mode12_block(samcoupe_state *state, bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask) +void samcoupe_state::draw_mode12_block(bitmap_ind16 &bitmap, int vpos, int hpos, UINT8 mask) { /* extract colors from attribute */ - UINT8 ink = state->m_clut[ATTR_FG(state->m_attribute)]; - UINT8 pap = state->m_clut[ATTR_BG(state->m_attribute)]; + UINT8 ink = m_clut[ATTR_FG(m_attribute)]; + UINT8 pap = m_clut[ATTR_BG(m_attribute)]; /* draw block of 8 pixels (doubled to 16) */ for (int i = 0; i < SAM_BLOCK; i++) @@ -101,28 +99,26 @@ static void draw_mode12_block(samcoupe_state *state, bitmap_ind16 &bitmap, int v } } -static void draw_mode2_line(running_machine &machine, int y, int hpos) +void samcoupe_state::draw_mode2_line(int y, int hpos) { - samcoupe_state *state = machine.driver_data<samcoupe_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; int cell = (y - SAM_BORDER_TOP) * 32 + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2; UINT8 mask = videoram[cell]; - state->m_attribute = videoram[cell + 0x2000]; + m_attribute = videoram[cell + 0x2000]; - draw_mode12_block(state, state->m_bitmap, y, hpos, mask); + draw_mode12_block(m_bitmap, y, hpos, mask); } -static void draw_mode1_line(running_machine &machine, int y, int hpos) +void samcoupe_state::draw_mode1_line(int y, int hpos) { - samcoupe_state *state = machine.driver_data<samcoupe_state>(); - UINT8 *videoram = state->m_videoram; + UINT8 *videoram = m_videoram; UINT8 mask = videoram[((((y - SAM_BORDER_TOP) & 0xc0) << 5) | (((y - SAM_BORDER_TOP) & 0x07) << 8) | (((y - SAM_BORDER_TOP) & 0x38) << 2)) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; - state->m_attribute = videoram[32*192 + (((y - SAM_BORDER_TOP) & 0xf8) << 2) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; + m_attribute = videoram[32*192 + (((y - SAM_BORDER_TOP) & 0xf8) << 2) + (hpos - SAM_BORDER_LEFT) / SAM_BLOCK / 2]; - draw_mode12_block(state, state->m_bitmap, y, hpos, mask); + draw_mode12_block(m_bitmap, y, hpos, mask); } TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback) @@ -158,17 +154,17 @@ TIMER_CALLBACK_MEMBER(samcoupe_state::sam_video_update_callback) /* main screen area */ switch ((m_vmpr & 0x60) >> 5) { - case 0: draw_mode1_line(machine(), vpos, hpos); break; - case 1: draw_mode2_line(machine(), vpos, hpos); break; - case 2: draw_mode3_line(machine(), vpos, hpos); break; - case 3: draw_mode4_line(machine(), vpos, hpos); break; + case 0: draw_mode1_line(vpos, hpos); break; + case 1: draw_mode2_line(vpos, hpos); break; + case 2: draw_mode3_line(vpos, hpos); break; + case 3: draw_mode4_line(vpos, hpos); break; } } } /* do we need to trigger the scanline interrupt (interrupt happens at the start of the right border before the specified line)? */ if (m_line_int < SAM_SCREEN_HEIGHT && hpos == SAM_BORDER_LEFT + SAM_SCREEN_WIDTH && vpos == (m_line_int + SAM_BORDER_TOP - 1)) - samcoupe_irq(machine().firstcpu, SAM_LINE_INT); + samcoupe_irq(SAM_LINE_INT); /* schedule next update */ m_video_update_timer->adjust(machine().primary_screen->time_until_pos(next_vpos, next_hpos)); diff --git a/src/mess/video/spectrum.c b/src/mess/video/spectrum.c index eda83ca07bb..8524e3a2c7c 100644 --- a/src/mess/video/spectrum.c +++ b/src/mess/video/spectrum.c @@ -43,7 +43,7 @@ VIDEO_START_MEMBER(spectrum_state,spectrum_128) /* return the color to be used inverting FLASHing colors if necessary */ -INLINE unsigned char get_display_color (unsigned char color, int invert) +inline unsigned char spectrum_state::get_display_color (unsigned char color, int invert) { if (invert && (color & 0x80)) return (color & 0xc0) + ((color & 0x38) >> 3) + ((color & 0x07) << 3); @@ -96,7 +96,7 @@ void spectrum_state::screen_eof_spectrum(screen_device &screen, bool state) ***************************************************************************/ -INLINE void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void spectrum_state::spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = (UINT16)color; } diff --git a/src/mess/video/ssystem3.c b/src/mess/video/ssystem3.c index dec974f6bf4..e0066573f2a 100644 --- a/src/mess/video/ssystem3.c +++ b/src/mess/video/ssystem3.c @@ -5,25 +5,23 @@ #include "emu.h" #include "includes/ssystem3.h" -void ssystem3_lcd_reset(running_machine &machine) +void ssystem3_state::ssystem3_lcd_reset() { - ssystem3_state *state = machine.driver_data<ssystem3_state>(); - state->m_lcd.count=0; state->m_lcd.clock=1; + m_lcd.count=0; m_lcd.clock=1; } -void ssystem3_lcd_write(running_machine &machine, int clock, int data) +void ssystem3_state::ssystem3_lcd_write(int clock, int data) { - ssystem3_state *state = machine.driver_data<ssystem3_state>(); - if (clock&&!state->m_lcd.clock) { - state->m_lcd.data[state->m_lcd.count/8]&=~(1<<(state->m_lcd.count&7)); - if (data) state->m_lcd.data[state->m_lcd.count/8]|=1<<(state->m_lcd.count&7); - if (state->m_lcd.count+1==40) { - logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine.device("maincpu")->safe_pc(), - state->m_lcd.data[0], state->m_lcd.data[1], state->m_lcd.data[2], state->m_lcd.data[3], state->m_lcd.data[4]); + if (clock&&!m_lcd.clock) { + m_lcd.data[m_lcd.count/8]&=~(1<<(m_lcd.count&7)); + if (data) m_lcd.data[m_lcd.count/8]|=1<<(m_lcd.count&7); + if (m_lcd.count+1==40) { + logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)machine().device("maincpu")->safe_pc(), + m_lcd.data[0], m_lcd.data[1], m_lcd.data[2], m_lcd.data[3], m_lcd.data[4]); } - state->m_lcd.count=(state->m_lcd.count+1)%40; + m_lcd.count=(m_lcd.count+1)%40; } - state->m_lcd.clock=clock; + m_lcd.clock=clock; } @@ -82,7 +80,7 @@ static const char led[]={ " dddddddddddd" }; -static void ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y) +void ssystem3_state::ssystem3_draw_7segment(bitmap_ind16 &bitmap,int value, int x, int y) { int i, xi, yi, mask, color; @@ -161,7 +159,7 @@ static const char single_led[]= " 55555555 55555555 000000 000000 00 00 00 00 000000 00 00 00 00 0000000" ; -static void ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch) +void ssystem3_state::ssystem3_draw_led(bitmap_ind16 &bitmap,INT16 color, int x, int y, int ch) { int j, xi=0; for (j=0; single_led[j]; j++) { @@ -221,7 +219,7 @@ UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind1 int figure, black; int xp=263+x*22; int yp=55+(y^7)*28; - ssystem3_playfield_getfigure(machine(), x, y, &figure, &black); + ssystem3_playfield_getfigure(x, y, &figure, &black); ssystem3_draw_led(bitmap, lcd_signs_on[figure]&1?1:0, xp, yp, '6'); ssystem3_draw_led(bitmap, lcd_signs_on[figure]&2?1:0, xp, yp, '8'); ssystem3_draw_led(bitmap, lcd_signs_on[figure]&4?1:0, xp, yp, '9'); diff --git a/src/mess/video/super80.c b/src/mess/video/super80.c index b23e35d0bf9..54aefacf773 100644 --- a/src/mess/video/super80.c +++ b/src/mess/video/super80.c @@ -51,20 +51,20 @@ static const UINT8 super80_comp_palette[16*3] = 0x00, 0x00, 0x00, /* 15 Black */ }; -static void palette_set_colors_rgb(running_machine &machine, const UINT8 *colors) +void super80_state::palette_set_colors_rgb(const UINT8 *colors) { UINT8 r, b, g, color_count = 16; while (color_count--) { r = *colors++; g = *colors++; b = *colors++; - palette_set_color(machine, 15-color_count, MAKE_RGB(r, g, b)); + palette_set_color(machine(), 15-color_count, MAKE_RGB(r, g, b)); } } PALETTE_INIT_MEMBER(super80_state,super80m) { - palette_set_colors_rgb(machine(), super80_rgb_palette); + palette_set_colors_rgb(super80_rgb_palette); } @@ -81,9 +81,9 @@ void super80_state::screen_eof_super80m(screen_device &screen, bool state) { m_current_palette = chosen_palette; // save new palette if (!m_current_palette) - palette_set_colors_rgb(machine(), super80_comp_palette); // composite colour + palette_set_colors_rgb(super80_comp_palette); // composite colour else - palette_set_colors_rgb(machine(), super80_rgb_palette); // rgb and b&w + palette_set_colors_rgb(super80_rgb_palette); // rgb and b&w } } } diff --git a/src/mess/video/tx0.c b/src/mess/video/tx0.c index e8cfe96531b..31b495d8313 100644 --- a/src/mess/video/tx0.c +++ b/src/mess/video/tx0.c @@ -13,17 +13,11 @@ -INLINE void tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) +inline void tx0_state::tx0_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) { bitmap.pix16(y, x) = color; } - -static void tx0_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap); -static void tx0_draw_panel(running_machine &machine, bitmap_ind16 &bitmap); - - - /* video init */ @@ -36,7 +30,7 @@ void tx0_state::video_start() m_typewriter_bitmap.allocate(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_IND16); /* set up out bitmaps */ - tx0_draw_panel_backdrop(machine(), m_panel_bitmap); + tx0_draw_panel_backdrop(m_panel_bitmap); const rectangle typewriter_bitmap_bounds(0, typewriter_window_width-1, 0, typewriter_window_height-1); m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_bitmap_bounds); @@ -58,14 +52,13 @@ void tx0_state::screen_eof_tx0(screen_device &screen, bool state) /* schedule a pixel to be plotted */ -void tx0_plot(running_machine &machine, int x, int y) +void tx0_state::tx0_plot(int x, int y) { - tx0_state *state = machine.driver_data<tx0_state>(); /* compute pixel coordinates and plot */ x = x*crt_window_width/0777; y = y*crt_window_height/0777; - state->m_crt->plot(x, y); + m_crt->plot(x, y); } @@ -76,7 +69,7 @@ UINT32 tx0_state::screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, { m_crt->update(bitmap); - tx0_draw_panel(machine(), m_panel_bitmap); + tx0_draw_panel(m_panel_bitmap); copybitmap(bitmap, m_panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); copybitmap(bitmap, m_typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); @@ -124,7 +117,7 @@ enum }; /* draw a small 8*8 LED (or is this a lamp? ) */ -static void tx0_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state) +void tx0_state::tx0_draw_led(bitmap_ind16 &bitmap, int x, int y, int state) { int xx, yy; @@ -134,13 +127,13 @@ static void tx0_draw_led(running_machine &machine, bitmap_ind16 &bitmap, int x, } /* draw nb_bits leds which represent nb_bits bits in value */ -static void tx0_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +void tx0_state::tx0_draw_multipleled(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) { while (nb_bits) { nb_bits--; - tx0_draw_led(machine, bitmap, x, y, (value >> nb_bits) & 1); + tx0_draw_led(bitmap, x, y, (value >> nb_bits) & 1); x += 8; } @@ -148,7 +141,7 @@ static void tx0_draw_multipleled(running_machine &machine, bitmap_ind16 &bitmap, /* draw a small 8*8 switch */ -static void tx0_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int state) +void tx0_state::tx0_draw_switch(bitmap_ind16 &bitmap, int x, int y, int state) { int xx, yy; int i; @@ -189,13 +182,13 @@ static void tx0_draw_switch(running_machine &machine, bitmap_ind16 &bitmap, int /* draw nb_bits switches which represent nb_bits bits in value */ -static void tx0_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) +void tx0_state::tx0_draw_multipleswitch(bitmap_ind16 &bitmap, int x, int y, int value, int nb_bits) { while (nb_bits) { nb_bits--; - tx0_draw_switch(machine, bitmap, x, y, (value >> nb_bits) & 1); + tx0_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); x += 8; } @@ -203,18 +196,18 @@ static void tx0_draw_multipleswitch(running_machine &machine, bitmap_ind16 &bitm /* write a single char on screen */ -static void tx0_draw_char(running_machine &machine, bitmap_ind16 &bitmap, char character, int x, int y, int color) +void tx0_state::tx0_draw_char(bitmap_ind16 &bitmap, char character, int x, int y, int color) { - drawgfx_transpen(bitmap, bitmap.cliprect(), machine.gfx[0], character-32, color, 0, 0, + drawgfx_transpen(bitmap, bitmap.cliprect(), machine().gfx[0], character-32, color, 0, 0, x+1, y, 0); } /* write a string on screen */ -static void tx0_draw_string(running_machine &machine, bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) +void tx0_state::tx0_draw_string(bitmap_ind16 &bitmap, const char *buf, int x, int y, int color) { while (* buf) { - tx0_draw_char(machine, bitmap, *buf, x, y, color); + tx0_draw_char(bitmap, *buf, x, y, color); x += 8; buf++; @@ -223,7 +216,7 @@ static void tx0_draw_string(running_machine &machine, bitmap_ind16 &bitmap, cons /* draw a vertical line */ -static void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color) +void tx0_state::tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int color) { while (height--) tx0_plot_pixel(bitmap, x, y++, color); @@ -231,7 +224,7 @@ static void tx0_draw_vline(bitmap_ind16 &bitmap, int x, int y, int height, int c #ifdef UNUSED_FUNCTION /* draw a horizontal line */ -static void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color) +void tx0_state::tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int color) { while (width--) tx0_plot_pixel(bitmap, x++, y, color); @@ -241,91 +234,89 @@ static void tx0_draw_hline(bitmap_ind16 &bitmap, int x, int y, int width, int co /* draw the operator control panel (fixed backdrop) */ -static void tx0_draw_panel_backdrop(running_machine &machine, bitmap_ind16 &bitmap) +void tx0_state::tx0_draw_panel_backdrop(bitmap_ind16 &bitmap) { - tx0_state *state = machine.driver_data<tx0_state>(); int i; char buf[3]; /* fill with black */ const rectangle panel_bitmap_bounds(0, panel_window_width-1, 0, panel_window_height-1); - state->m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); + m_panel_bitmap.fill(pen_panel_bg, panel_bitmap_bounds); /* column 1: registers, test accumulator, test buffer, toggle switch storage */ - tx0_draw_string(machine, bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption); + tx0_draw_string(bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption); + tx0_draw_string(bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption); + tx0_draw_string(bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption); + tx0_draw_string(bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption); + tx0_draw_string(bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption); + tx0_draw_string(bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption); + tx0_draw_string(bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption); + tx0_draw_string(bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption); + tx0_draw_string(bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption); + tx0_draw_string(bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption); + tx0_draw_string(bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption); for (i=0; i<16; i++) { sprintf(buf, "%2o", i); - tx0_draw_string(machine, bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption); + tx0_draw_string(bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption); } /* column separator */ tx0_draw_vline(bitmap, x_panel_col2_offset-4, 8, 248, pen_panel_caption); /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ - tx0_draw_string(machine, bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption); - tx0_draw_string(machine, bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption); + tx0_draw_string(bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption); + tx0_draw_string(bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption); + tx0_draw_string(bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption); + tx0_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); + tx0_draw_string(bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption); + tx0_draw_string(bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption); + tx0_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); + tx0_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); + tx0_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); + tx0_draw_string(bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption); + tx0_draw_string(bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption); } /* draw the operator control panel (dynamic elements) */ -static void tx0_draw_panel(running_machine &machine, bitmap_ind16 &bitmap) +void tx0_state::tx0_draw_panel(bitmap_ind16 &bitmap) { int cm_sel, lr_sel; int i; - tx0_state *state = machine.driver_data<tx0_state>(); /* column 1: registers, test accumulator, test buffer, toggle switch storage */ - tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, state->m_maincpu->state_int(TX0_PC), 16); - tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, state->m_maincpu->state_int(TX0_MAR), 16); - tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, state->m_maincpu->state_int(TX0_MBR), 18); - tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, state->m_maincpu->state_int(TX0_AC), 18); - tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, state->m_maincpu->state_int(TX0_LR), 18); - tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, state->m_maincpu->state_int(TX0_XR), 14); - tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, state->m_maincpu->state_int(TX0_TBR), 18); - tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, state->m_maincpu->state_int(TX0_TAC), 18); - cm_sel = state->m_maincpu->state_int(TX0_CM_SEL); - lr_sel = state->m_maincpu->state_int(TX0_LR_SEL); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, m_maincpu->state_int(TX0_PC), 16); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, m_maincpu->state_int(TX0_MAR), 16); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, m_maincpu->state_int(TX0_MBR), 18); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, m_maincpu->state_int(TX0_AC), 18); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, m_maincpu->state_int(TX0_LR), 18); + tx0_draw_multipleled(bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, m_maincpu->state_int(TX0_XR), 14); + tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, m_maincpu->state_int(TX0_TBR), 18); + tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, m_maincpu->state_int(TX0_TAC), 18); + cm_sel = m_maincpu->state_int(TX0_CM_SEL); + lr_sel = m_maincpu->state_int(TX0_LR_SEL); for (i=0; i<16; i++) { - tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); - tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, state->m_maincpu->state_int(TX0_TSS00+i), 18); - tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); + tx0_draw_switch(bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); + tx0_draw_multipleswitch(bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, m_maincpu->state_int(TX0_TSS00+i), 18); + tx0_draw_switch(bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); } /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ - tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, state->m_maincpu->state_int(TX0_STOP_CYC0)); - tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, state->m_maincpu->state_int(TX0_STOP_CYC1)); - tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, state->m_maincpu->state_int(TX0_GBL_CM_SEL)); - tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, state->m_maincpu->state_int(TX0_RUN)); - tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, state->m_maincpu->state_int(TX0_CYCLE) & 1); - tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, state->m_maincpu->state_int(TX0_CYCLE) & 2); - tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, state->m_maincpu->state_int(TX0_RIM)); - tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, state->m_maincpu->state_int(TX0_IOH)); - tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, state->m_maincpu->state_int(TX0_IOS)); - tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, state->m_maincpu->state_int(TX0_IR), 5); - tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, state->m_maincpu->state_int(TX0_PF), 6); + tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, m_maincpu->state_int(TX0_STOP_CYC0)); + tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, m_maincpu->state_int(TX0_STOP_CYC1)); + tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, m_maincpu->state_int(TX0_GBL_CM_SEL)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset, m_maincpu->state_int(TX0_RUN)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle1_offset, m_maincpu->state_int(TX0_CYCLE) & 1); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle2_offset, m_maincpu->state_int(TX0_CYCLE) & 2); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset, m_maincpu->state_int(TX0_RIM)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset, m_maincpu->state_int(TX0_IOH)); + tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset, m_maincpu->state_int(TX0_IOS)); + tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_ir_offset+8, m_maincpu->state_int(TX0_IR), 5); + tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_pf_offset+8, m_maincpu->state_int(TX0_PF), 6); } @@ -351,25 +342,23 @@ enum }; -static void tx0_typewriter_linefeed(running_machine &machine) +void tx0_state::tx0_typewriter_linefeed() { - tx0_state *state = machine.driver_data<tx0_state>(); UINT8 buf[typewriter_window_width]; int y; for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) { - extract_scanline8(state->m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); - draw_scanline8(state->m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine.pens); + extract_scanline8(m_typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); + draw_scanline8(m_typewriter_bitmap, 0, y, typewriter_window_width, buf, machine().pens); } const rectangle typewriter_scroll_clear_window(0, typewriter_window_width-1, typewriter_window_height-typewriter_scroll_step, typewriter_window_height-1); - state->m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); + m_typewriter_bitmap.fill(pen_typewriter_bg, typewriter_scroll_clear_window); } -void tx0_typewriter_drawchar(running_machine &machine, int character) +void tx0_state::tx0_typewriter_drawchar(int character) { - tx0_state *state = machine.driver_data<tx0_state>(); static const char ascii_table[2][64] = { { /* lower case */ @@ -419,26 +408,26 @@ void tx0_typewriter_drawchar(running_machine &machine, int character) case 020: #if 0 /* color shift */ - state->m_typewriter_color = color_typewriter_black; - state->m_typewriter_color = color_typewriter_red; + m_typewriter_color = color_typewriter_black; + m_typewriter_color = color_typewriter_red; #endif break; case 043: /* Backspace */ - if (state->m_pos) - state->m_pos--; + if (m_pos) + m_pos--; break; case 045: /* Tab */ - state->m_pos = state->m_pos + tab_step - (state->m_pos % tab_step); + m_pos = m_pos + tab_step - (m_pos % tab_step); break; case 051: /* Carriage Return */ - state->m_pos = 0; - tx0_typewriter_linefeed( machine ); + m_pos = 0; + tx0_typewriter_linefeed(); break; case 061: @@ -448,12 +437,12 @@ void tx0_typewriter_drawchar(running_machine &machine, int character) case 071: /* Upper case */ - state->m_case_shift = 1; + m_case_shift = 1; break; case 075: /* Lower case */ - state->m_case_shift = 0; + m_case_shift = 0; break; case 077: @@ -464,18 +453,18 @@ void tx0_typewriter_drawchar(running_machine &machine, int character) default: /* Any printable character... */ - if (state->m_pos >= 80) + if (m_pos >= 80) { /* if past right border, wrap around. (Right???) */ - tx0_typewriter_linefeed( machine ); /* next line */ - state->m_pos = 0; /* return to start of line */ + tx0_typewriter_linefeed(); /* next line */ + m_pos = 0; /* return to start of line */ } /* print character (lookup ASCII equivalent in table) */ - tx0_draw_char(machine, state->m_typewriter_bitmap, ascii_table[state->m_case_shift][character], - 8*state->m_pos, typewriter_write_offset_y, - state->m_typewriter_color); /* print char */ + tx0_draw_char(m_typewriter_bitmap, ascii_table[m_case_shift][character], + 8*m_pos, typewriter_write_offset_y, + m_typewriter_color); /* print char */ - state->m_pos++; /* step carriage forward */ + m_pos++; /* step carriage forward */ break; } } diff --git a/src/mess/video/vc4000.c b/src/mess/video/vc4000.c index 165c1fc66b4..9a175e66548 100644 --- a/src/mess/video/vc4000.c +++ b/src/mess/video/vc4000.c @@ -60,7 +60,7 @@ void vc4000_state::video_start() m_bitmap = auto_bitmap_ind16_alloc(machine(), screen->width(), screen->height()); } -INLINE UINT8 vc4000_joystick_return_to_centre(UINT8 joy) +inline UINT8 vc4000_state::vc4000_joystick_return_to_centre(UINT8 joy) { UINT8 data; @@ -377,7 +377,7 @@ static const char led[20][12+1] = }; -static void vc4000_draw_digit(vc4000_state *state, bitmap_ind16 &bitmap, int x, int y, int d, int line) +void vc4000_state::vc4000_draw_digit(bitmap_ind16 &bitmap, int x, int y, int d, int line) { static const int digit_to_segment[0x10]={ 0x0fff, 0x007c, 0x17df, 0x15ff, 0x1c7d, 0x1df7, 0x1ff7, 0x007f, 0x1fff, 0x1dff @@ -388,11 +388,11 @@ static void vc4000_draw_digit(vc4000_state *state, bitmap_ind16 &bitmap, int x, for (j=0; j<sizeof(led[0])-1; j++) { if (led[i][j] != ' ' && digit_to_segment[d]&(1<<(led[i][j]-'a')) ) - bitmap.pix16(y+i, x+j) = ((state->m_video.reg.d.background>>4)&7)^7; + bitmap.pix16(y+i, x+j) = ((m_video.reg.d.background>>4)&7)^7; } } -INLINE void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale) +inline void vc4000_state::vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int scale) { int i,j,m; @@ -406,11 +406,11 @@ INLINE void vc4000_collision_plot(UINT8 *collision, UINT8 data, UINT8 color, int } -static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This) +void vc4000_state::vc4000_sprite_update(bitmap_ind16 &bitmap, UINT8 *collision, SPRITE *This) { int i,j,m; - if (state->m_video.line==0) + if (m_video.line==0) { This->y=This->data->y1; This->state=0; @@ -420,12 +420,12 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT This->finished_now=FALSE; - if (state->m_video.line>VC4000_END_LINE) return; + if (m_video.line>VC4000_END_LINE) return; switch (This->state) { case 0: - if (state->m_video.line != This->y + 2) break; + if (m_video.line != This->y + 2) break; This->state++; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:case 9:case 10: @@ -438,8 +438,8 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT { for (i=0; i<This->size; i++) { - state->m_objects[This->data->x1 + i + j*This->size] |= This->scolor; - state->m_objects[This->data->x1 + i + j*This->size] &= 7; + m_objects[This->data->x1 + i + j*This->size] |= This->scolor; + m_objects[This->data->x1 + i + j*This->size] &= 7; } } } @@ -497,8 +497,8 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT // it properly. if (offset < 256) { - state->m_objects[offset] |= This->scolor; - state->m_objects[offset] &= 7; + m_objects[offset] |= This->scolor; + m_objects[offset] &= 7; } } } @@ -515,26 +515,25 @@ static void vc4000_sprite_update(vc4000_state *state, bitmap_ind16 &bitmap, UINT } } -INLINE void vc4000_draw_grid(running_machine &machine, UINT8 *collision) +inline void vc4000_state::vc4000_draw_grid(UINT8 *collision) { - vc4000_state *state = machine.driver_data<vc4000_state>(); - screen_device *screen = machine.first_screen(); + screen_device *screen = machine().first_screen(); int width = screen->width(); int height = screen->height(); - int i, j, m, x, line=state->m_video.line-20; + int i, j, m, x, line=m_video.line-20; int w, k; - if (state->m_video.line>=height) return; + if (m_video.line>=height) return; - state->m_bitmap->plot_box(0, state->m_video.line, width, 1, (state->m_video.reg.d.background)&7); + m_bitmap->plot_box(0, m_video.line, width, 1, (m_video.reg.d.background)&7); if (line<0 || line>=200) return; - if (~state->m_video.reg.d.background & 8) return; + if (~m_video.reg.d.background & 8) return; i=(line/20)*2; if (line%20>=2) i++; - k=state->m_video.reg.d.grid_control[i>>2]; + k=m_video.reg.d.grid_control[i>>2]; switch (k>>6) { default: case 0:case 2: w=1;break; @@ -562,11 +561,11 @@ INLINE void vc4000_draw_grid(running_machine &machine, UINT8 *collision) } for (x=30, j=0, m=0x80; j<16; j++, x+=8, m>>=1) { - if (state->m_video.reg.d.grid[i][j>>3]&m) + if (m_video.reg.d.grid[i][j>>3]&m) { int l; for (l=0; l<w; l++) collision[x+l]|=0x10; - state->m_bitmap->plot_box(x, state->m_video.line, w, 1, (state->m_video.reg.d.background>>4)&7); + m_bitmap->plot_box(x, m_video.line, w, 1, (m_video.reg.d.background>>4)&7); } if (j==7) m=0x100; } @@ -599,16 +598,16 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) if (m_video.line <= VC4000_END_LINE) { - vc4000_draw_grid(machine(), collision); + vc4000_draw_grid(collision); /* init object colours */ for (i=visarea.min_x; i<visarea.max_x; i++) m_objects[i]=8; /* calculate object colours and OR overlapping object colours */ - vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[0]); - vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[1]); - vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[2]); - vc4000_sprite_update(this, *m_bitmap, collision, &m_video.sprites[3]); + vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[0]); + vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[1]); + vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[2]); + vc4000_sprite_update(*m_bitmap, collision, &m_video.sprites[3]); for (i=visarea.min_x; i<visarea.max_x; i++) { @@ -624,11 +623,11 @@ INTERRUPT_GEN_MEMBER(vc4000_state::vc4000_video_line) if ((m_video.line>=y)&&(m_video.line<y+20)) { x = 60; - vc4000_draw_digit(this, *m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y); - vc4000_draw_digit(this, *m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); + vc4000_draw_digit(*m_bitmap, x, y, m_video.reg.d.bcd[0]>>4, m_video.line-y); + vc4000_draw_digit(*m_bitmap, x+16, y, m_video.reg.d.bcd[0]&0xf, m_video.line-y); if (m_video.reg.d.score_control&2) x -= 16; - vc4000_draw_digit(this, *m_bitmap, x+48, y, m_video.reg.d.bcd[1]>>4, m_video.line-y); - vc4000_draw_digit(this, *m_bitmap, x+64, y, m_video.reg.d.bcd[1]&0xf, m_video.line-y); + vc4000_draw_digit(*m_bitmap, x+48, y, m_video.reg.d.bcd[1]>>4, m_video.line-y); + vc4000_draw_digit(*m_bitmap, x+64, y, m_video.reg.d.bcd[1]&0xf, m_video.line-y); } } if (m_video.line==VC4000_END_LINE) m_video.reg.d.sprite_collision |=0x40; diff --git a/src/mess/video/wswan.c b/src/mess/video/wswan.c index 12897c6cbfa..21fad625b06 100644 --- a/src/mess/video/wswan.c +++ b/src/mess/video/wswan.c @@ -11,65 +11,66 @@ #include "includes/wswan.h" -static void wswan_setup_palettes(wswan_state *state) { +void wswan_state::wswan_setup_palettes() +{ int i,j; - if ( state->m_vdp.color_mode ) { + if ( m_vdp.color_mode ) { for( i = 0; i < 16; i++ ) { for( j = 0; j < 16; j++ ) { - state->m_pal[i][j] = ( ( state->m_vdp.palette_vram[ ( i << 5 ) + j*2 + 1 ] << 8 ) | state->m_vdp.palette_vram[ ( i << 5 ) + j*2 ] ) & 0x0FFF; + m_pal[i][j] = ( ( m_vdp.palette_vram[ ( i << 5 ) + j*2 + 1 ] << 8 ) | m_vdp.palette_vram[ ( i << 5 ) + j*2 ] ) & 0x0FFF; } } } else { for( i = 0; i < 16; i++ ) { - state->m_pal[i][0] = state->m_ws_portram[ 0x20 + ( i << 1 ) ] & 0x07; - state->m_pal[i][1] = ( state->m_ws_portram[ 0x20 + ( i << 1 ) ] >> 4 ) & 0x07; - state->m_pal[i][2] = state->m_ws_portram[ 0x21 + ( i << 1 ) ] & 0x07; - state->m_pal[i][3] = ( state->m_ws_portram[ 0x21 + ( i << 1 ) ] >> 4 ) & 0x07; + m_pal[i][0] = m_ws_portram[ 0x20 + ( i << 1 ) ] & 0x07; + m_pal[i][1] = ( m_ws_portram[ 0x20 + ( i << 1 ) ] >> 4 ) & 0x07; + m_pal[i][2] = m_ws_portram[ 0x21 + ( i << 1 ) ] & 0x07; + m_pal[i][3] = ( m_ws_portram[ 0x21 + ( i << 1 ) ] >> 4 ) & 0x07; } } } -static void wswan_draw_background( running_machine &machine ) { - wswan_state *state = machine.driver_data<wswan_state>(); +void wswan_state::wswan_draw_background() +{ UINT16 map_addr; UINT8 start_column; int column; - map_addr = state->m_vdp.layer_bg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_bg_scroll_y ) & 0xF8 ) << 3 ); - start_column = ( state->m_vdp.layer_bg_scroll_x >> 3 ); + map_addr = m_vdp.layer_bg_address + ( ( ( m_vdp.current_line + m_vdp.layer_bg_scroll_y ) & 0xF8 ) << 3 ); + start_column = ( m_vdp.layer_bg_scroll_x >> 3 ); for( column = 0; column < 29; column++ ) { int tile_data, tile_number, tile_palette, tile_line, tile_address; UINT32 plane0=0, plane1=0, plane2=0, plane3=0; int x, x_offset; - tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) - | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; + tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) + | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; tile_number = tile_data & 0x01FF; tile_palette = ( tile_data >> 9 ) & 0x0F; - tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_bg_scroll_y ) & 0x07; + tile_line = ( m_vdp.current_line + m_vdp.layer_bg_scroll_y ) & 0x07; if ( tile_data & 0x8000 ) { tile_line = 7 - tile_line; } - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; - plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2; - plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; + plane2 = m_vdp.vram[ tile_address + 2 ] << 2; + plane3 = m_vdp.vram[ tile_address + 3 ] << 3; } } else { tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; plane2 = 0; plane3 = 0; } @@ -77,8 +78,8 @@ static void wswan_draw_background( running_machine &machine ) { for( x = 0; x < 8; x++ ) { int col; - if ( state->m_vdp.tile_packed ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.tile_packed ) { + if ( m_vdp.colors_16 ) { col = plane0 & 0x0F; plane0 = plane0 >> 4; } else { @@ -93,26 +94,26 @@ static void wswan_draw_background( running_machine &machine ) { plane0 = plane0 >> 1; } if ( tile_data & 0x4000 ) { - x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_bg_scroll_x & 0x07 ); + x_offset = x + ( column << 3 ) - ( m_vdp.layer_bg_scroll_x & 0x07 ); } else { - x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_bg_scroll_x & 0x07 ); + x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_bg_scroll_x & 0x07 ); } if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { if ( col ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { /* Hmmmm, what should we do here... Is this correct?? */ - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } } } else { if ( col || !(tile_palette & 4 ) ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]]; } } } @@ -121,43 +122,43 @@ static void wswan_draw_background( running_machine &machine ) { } } -static void wswan_draw_foreground_0( running_machine &machine ) { - wswan_state *state = machine.driver_data<wswan_state>(); +void wswan_state::wswan_draw_foreground_0() +{ UINT16 map_addr; UINT8 start_column; int column; - map_addr = state->m_vdp.layer_fg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 ); - start_column = ( state->m_vdp.layer_fg_scroll_x >> 3 ); + map_addr = m_vdp.layer_fg_address + ( ( ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 ); + start_column = ( m_vdp.layer_fg_scroll_x >> 3 ); for( column = 0; column < 29; column++ ) { UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; int x, x_offset, tile_line, tile_address; - int tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) - | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; + int tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) + | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; int tile_number = tile_data & 0x01FF; int tile_palette = ( tile_data >> 9 ) & 0x0F; - tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0x07; + tile_line = ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0x07; if ( tile_data & 0x8000 ) { tile_line = 7 - tile_line; } - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; - plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2; - plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; + plane2 = m_vdp.vram[ tile_address + 2 ] << 2; + plane3 = m_vdp.vram[ tile_address + 3 ] << 3; } } else { tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; plane2 = 0; plane3 = 0; } @@ -165,8 +166,8 @@ static void wswan_draw_foreground_0( running_machine &machine ) { for( x = 0; x < 8; x++ ) { int col; - if ( state->m_vdp.tile_packed ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.tile_packed ) { + if ( m_vdp.colors_16 ) { col = plane0 & 0x0F; plane0 = plane0 >> 4; } else { @@ -181,26 +182,26 @@ static void wswan_draw_foreground_0( running_machine &machine ) { plane0 = plane0 >> 1; } if ( tile_data & 0x4000 ) { - x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 ); + x_offset = x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 ); } else { - x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 ); + x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 ); } if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { if ( col ) { -// if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; +// if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; // } else { // /* Hmmmm, what should we do here... Is this correct?? */ -// state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; +// m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; // } } } else { if ( col || !(tile_palette & 4 ) ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]]; } } } @@ -209,43 +210,43 @@ static void wswan_draw_foreground_0( running_machine &machine ) { } } -static void wswan_draw_foreground_2( running_machine &machine ) { - wswan_state *state = machine.driver_data<wswan_state>(); +void wswan_state::wswan_draw_foreground_2() +{ UINT16 map_addr; UINT8 start_column; int column; - map_addr = state->m_vdp.layer_fg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 ); - start_column = ( state->m_vdp.layer_fg_scroll_x >> 3 ); + map_addr = m_vdp.layer_fg_address + ( ( ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 ); + start_column = ( m_vdp.layer_fg_scroll_x >> 3 ); for( column = 0; column < 29; column++ ) { UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; int x, x_offset, tile_line, tile_address; - int tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) - | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; + int tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) + | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; int tile_number = tile_data & 0x01FF; int tile_palette = ( tile_data >> 9 ) & 0x0F; - tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0x07; + tile_line = ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0x07; if ( tile_data & 0x8000 ) { tile_line = 7 - tile_line; } - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; - plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2; - plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; + plane2 = m_vdp.vram[ tile_address + 2 ] << 2; + plane3 = m_vdp.vram[ tile_address + 3 ] << 3; } } else { tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; plane2 = 0; plane3 = 0; } @@ -253,8 +254,8 @@ static void wswan_draw_foreground_2( running_machine &machine ) { for( x = 0; x < 8; x++ ) { int col; - if ( state->m_vdp.tile_packed ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.tile_packed ) { + if ( m_vdp.colors_16 ) { col = plane0 & 0x0F; plane0 = plane0 >> 4; } else { @@ -269,26 +270,26 @@ static void wswan_draw_foreground_2( running_machine &machine ) { plane0 = plane0 >> 1; } if ( tile_data & 0x4000 ) { - x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 ); + x_offset = x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 ); } else { - x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 ); + x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 ); } - if ( x_offset >= 0 && x_offset >= state->m_vdp.window_fg_left && x_offset < state->m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) { - if ( state->m_vdp.colors_16 ) { + if ( x_offset >= 0 && x_offset >= m_vdp.window_fg_left && x_offset < m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) { + if ( m_vdp.colors_16 ) { if ( col ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { /* Hmmmm, what should we do here... Is this correct?? */ - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } } } else { if ( col || !(tile_palette & 4 ) ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]]; } } } @@ -297,43 +298,43 @@ static void wswan_draw_foreground_2( running_machine &machine ) { } } -static void wswan_draw_foreground_3( running_machine &machine ) { - wswan_state *state = machine.driver_data<wswan_state>(); +void wswan_state::wswan_draw_foreground_3() +{ UINT16 map_addr; UINT8 start_column; int column; - map_addr = state->m_vdp.layer_fg_address + ( ( ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 ); - start_column = ( state->m_vdp.layer_fg_scroll_x >> 3 ); + map_addr = m_vdp.layer_fg_address + ( ( ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0xF8 ) << 3 ); + start_column = ( m_vdp.layer_fg_scroll_x >> 3 ); for( column = 0; column < 29; column++ ) { UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; int x, x_offset, tile_line, tile_address; - int tile_data = ( state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) - | state->m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; + int tile_data = ( m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) + 1 ] << 8 ) + | m_vdp.vram[ map_addr + ( ( ( start_column + column ) & 0x1F ) << 1 ) ]; int tile_number = tile_data & 0x01FF; int tile_palette = ( tile_data >> 9 ) & 0x0F; - tile_line = ( state->m_vdp.current_line + state->m_vdp.layer_fg_scroll_y ) & 0x07; + tile_line = ( m_vdp.current_line + m_vdp.layer_fg_scroll_y ) & 0x07; if ( tile_data & 0x8000 ) { // vflip tile_line = 7 - tile_line; } - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { tile_address = ( ( tile_data & 0x2000 ) ? 0x8000 : 0x4000 ) + ( tile_number * 32 ) + ( tile_line << 2 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; - plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2; - plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; + plane2 = m_vdp.vram[ tile_address + 2 ] << 2; + plane3 = m_vdp.vram[ tile_address + 3 ] << 3; } } else { tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; plane2 = 0; plane3 = 0; } @@ -341,8 +342,8 @@ static void wswan_draw_foreground_3( running_machine &machine ) { for( x = 0; x < 8; x++ ) { int col; - if ( state->m_vdp.tile_packed ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.tile_packed ) { + if ( m_vdp.colors_16 ) { col = plane0 & 0x0F; plane0 = plane0 >> 4; } else { @@ -357,26 +358,26 @@ static void wswan_draw_foreground_3( running_machine &machine ) { plane0 = plane0 >> 1; } if ( tile_data & 0x4000 ) { - x_offset = x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 ); + x_offset = x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 ); } else { - x_offset = 7 - x + ( column << 3 ) - ( state->m_vdp.layer_fg_scroll_x & 0x07 ); + x_offset = 7 - x + ( column << 3 ) - ( m_vdp.layer_fg_scroll_x & 0x07 ); } - if ( ( x_offset >= 0 && x_offset < state->m_vdp.window_fg_left ) || ( x_offset >= state->m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) ) { - if ( state->m_vdp.colors_16 ) { + if ( ( x_offset >= 0 && x_offset < m_vdp.window_fg_left ) || ( x_offset >= m_vdp.window_fg_right && x_offset < WSWAN_X_PIXELS ) ) { + if ( m_vdp.colors_16 ) { if ( col ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { /* Hmmmm, what should we do here... Is this correct?? */ - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } } } else { if ( col || !(tile_palette & 4 ) ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]]; } } } @@ -385,20 +386,20 @@ static void wswan_draw_foreground_3( running_machine &machine ) { } } -static void wswan_handle_sprites( running_machine &machine, int mask ) { - wswan_state *state = machine.driver_data<wswan_state>(); +void wswan_state::wswan_handle_sprites(int mask ) +{ int i; - if ( state->m_vdp.sprite_count == 0 ) + if ( m_vdp.sprite_count == 0 ) return; - for( i = state->m_vdp.sprite_first + state->m_vdp.sprite_count - 1; i >= state->m_vdp.sprite_first; i-- ) { + for( i = m_vdp.sprite_first + m_vdp.sprite_count - 1; i >= m_vdp.sprite_first; i-- ) { UINT8 x, y; UINT16 tile_data; int tile_line; - tile_data = ( state->m_vdp.sprite_table_buffer[ i * 4 + 1 ] << 8 ) | state->m_vdp.sprite_table_buffer[ i * 4 ]; - y = state->m_vdp.sprite_table_buffer[ i * 4 + 2 ]; - x = state->m_vdp.sprite_table_buffer[ i * 4 + 3 ]; - tile_line = state->m_vdp.current_line - y; + tile_data = ( m_vdp.sprite_table_buffer[ i * 4 + 1 ] << 8 ) | m_vdp.sprite_table_buffer[ i * 4 ]; + y = m_vdp.sprite_table_buffer[ i * 4 + 2 ]; + x = m_vdp.sprite_table_buffer[ i * 4 + 3 ]; + tile_line = m_vdp.current_line - y; tile_line = tile_line & 0xFF; if ( ( tile_line >= 0 ) && ( tile_line < 8 ) && ( ( tile_data & 0x2000 ) == mask ) ) { UINT32 plane0 = 0, plane1 = 0, plane2 = 0, plane3 = 0; @@ -410,35 +411,35 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) { tile_line = 7 - tile_line; } - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { tile_address = 0x4000 + ( tile_number * 32 ) + ( tile_line << 2 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 24 ) | ( state->m_vdp.vram[ tile_address + 1 ] << 16 ) | ( state->m_vdp.vram[ tile_address + 2 ] << 8 ) | state->m_vdp.vram[ tile_address + 3 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 24 ) | ( m_vdp.vram[ tile_address + 1 ] << 16 ) | ( m_vdp.vram[ tile_address + 2 ] << 8 ) | m_vdp.vram[ tile_address + 3 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; - plane2 = state->m_vdp.vram[ tile_address + 2 ] << 2; - plane3 = state->m_vdp.vram[ tile_address + 3 ] << 3; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; + plane2 = m_vdp.vram[ tile_address + 2 ] << 2; + plane3 = m_vdp.vram[ tile_address + 3 ] << 3; } } else { tile_address = 0x2000 + ( tile_number * 16 ) + ( tile_line << 1 ); - if ( state->m_vdp.tile_packed ) { - plane0 = ( state->m_vdp.vram[ tile_address + 0 ] << 8 ) | state->m_vdp.vram[ tile_address + 1 ]; + if ( m_vdp.tile_packed ) { + plane0 = ( m_vdp.vram[ tile_address + 0 ] << 8 ) | m_vdp.vram[ tile_address + 1 ]; } else { - plane0 = state->m_vdp.vram[ tile_address + 0 ]; - plane1 = state->m_vdp.vram[ tile_address + 1 ] << 1; + plane0 = m_vdp.vram[ tile_address + 0 ]; + plane1 = m_vdp.vram[ tile_address + 1 ] << 1; plane2 = 0; plane3 = 0; } } - if ( state->m_vdp.window_sprites_enable ) { + if ( m_vdp.window_sprites_enable ) { if ( tile_data & 0x1000 ) { - if ( state->m_vdp.current_line >= state->m_vdp.window_sprites_top && state->m_vdp.current_line <= state->m_vdp.window_sprites_bottom ) { + if ( m_vdp.current_line >= m_vdp.window_sprites_top && m_vdp.current_line <= m_vdp.window_sprites_bottom ) { check_clip = 1; } } else { - if ( state->m_vdp.current_line < state->m_vdp.window_sprites_top || state->m_vdp.current_line > state->m_vdp.window_sprites_bottom ) { + if ( m_vdp.current_line < m_vdp.window_sprites_top || m_vdp.current_line > m_vdp.window_sprites_bottom ) { continue; } } @@ -446,8 +447,8 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) { for ( j = 0; j < 8; j++ ) { int col; - if ( state->m_vdp.tile_packed ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.tile_packed ) { + if ( m_vdp.colors_16 ) { col = plane0 & 0x0F; plane0 = plane0 >> 4; } else { @@ -467,33 +468,33 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) { x_offset = x + 7 - j; } x_offset = x_offset & 0xFF; - if ( state->m_vdp.window_sprites_enable ) { + if ( m_vdp.window_sprites_enable ) { if ( tile_data & 0x1000 && check_clip ) { - if ( x_offset >= state->m_vdp.window_sprites_left && x_offset <= state->m_vdp.window_sprites_right ) { + if ( x_offset >= m_vdp.window_sprites_left && x_offset <= m_vdp.window_sprites_right ) { continue; } } else { - if ( x_offset < state->m_vdp.window_sprites_left || x_offset > state->m_vdp.window_sprites_right ) { + if ( x_offset < m_vdp.window_sprites_left || x_offset > m_vdp.window_sprites_right ) { // continue; } } } if ( x_offset >= 0 && x_offset < WSWAN_X_PIXELS ) { - if ( state->m_vdp.colors_16 ) { + if ( m_vdp.colors_16 ) { if ( col ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { /* Hmmmm, what should we do here... Is this correct?? */ - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } } } else { if ( col || !(tile_palette & 4 ) ) { - if ( state->m_vdp.color_mode ) { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_pal[tile_palette][col]; + if ( m_vdp.color_mode ) { + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_pal[tile_palette][col]; } else { - state->m_bitmap.pix16(state->m_vdp.current_line, x_offset) = state->m_vdp.main_palette[state->m_pal[tile_palette][col]]; + m_bitmap.pix16(m_vdp.current_line, x_offset) = m_vdp.main_palette[m_pal[tile_palette][col]]; } } } @@ -503,60 +504,58 @@ static void wswan_handle_sprites( running_machine &machine, int mask ) { } } -void wswan_refresh_scanline( running_machine &machine ) +void wswan_state::wswan_refresh_scanline() { - wswan_state *state = machine.driver_data<wswan_state>(); - - wswan_setup_palettes(state); + wswan_setup_palettes(); - rectangle rec(0, WSWAN_X_PIXELS, state->m_vdp.current_line, state->m_vdp.current_line); - if ( state->m_ws_portram[0x14] ) { + rectangle rec(0, WSWAN_X_PIXELS, m_vdp.current_line, m_vdp.current_line); + if ( m_ws_portram[0x14] ) { /* Not sure if these background color checks and settings are correct */ - if ( state->m_vdp.color_mode && state->m_vdp.colors_16 ) { - state->m_bitmap.fill( state->m_pal[state->m_ws_portram[0x01]>>4][state->m_ws_portram[0x01]&0x0F], rec ); + if ( m_vdp.color_mode && m_vdp.colors_16 ) { + m_bitmap.fill( m_pal[m_ws_portram[0x01]>>4][m_ws_portram[0x01]&0x0F], rec ); } else { - state->m_bitmap.fill( state->m_vdp.main_palette[state->m_ws_portram[0x01]&0x07], rec ); + m_bitmap.fill( m_vdp.main_palette[m_ws_portram[0x01]&0x07], rec ); } } else { - state->m_bitmap.fill( 0, rec ); + m_bitmap.fill( 0, rec ); return; } /* * Draw background layer */ - if ( state->m_vdp.layer_bg_enable ) { - wswan_draw_background(machine); + if ( m_vdp.layer_bg_enable ) { + wswan_draw_background(); } /* * Draw sprites between background and foreground layers */ - if ( state->m_vdp.sprites_enable ) { - wswan_handle_sprites( machine, 0 ); + if ( m_vdp.sprites_enable ) { + wswan_handle_sprites(0); } /* * Draw foreground layer, taking window settings into account */ - if ( state->m_vdp.layer_fg_enable ) { - switch( state->m_vdp.window_fg_mode ) { + if ( m_vdp.layer_fg_enable ) { + switch( m_vdp.window_fg_mode ) { case 0: /* FG inside & outside window area */ - wswan_draw_foreground_0(machine); + wswan_draw_foreground_0(); break; case 1: /* ??? */ logerror( "Unknown foreground mode 1 set\n" ); break; case 2: /* FG only inside window area */ - if ( state->m_vdp.current_line >= state->m_vdp.window_fg_top && state->m_vdp.current_line <= state->m_vdp.window_fg_bottom ) { - wswan_draw_foreground_2(machine); + if ( m_vdp.current_line >= m_vdp.window_fg_top && m_vdp.current_line <= m_vdp.window_fg_bottom ) { + wswan_draw_foreground_2(); } break; case 3: /* FG only outside window area */ - if ( state->m_vdp.current_line < state->m_vdp.window_fg_top || state->m_vdp.current_line > state->m_vdp.window_fg_bottom ) { - wswan_draw_foreground_0(machine); + if ( m_vdp.current_line < m_vdp.window_fg_top || m_vdp.current_line > m_vdp.window_fg_bottom ) { + wswan_draw_foreground_0(); } else { - wswan_draw_foreground_3(machine); + wswan_draw_foreground_3(); } break; } @@ -565,8 +564,8 @@ void wswan_refresh_scanline( running_machine &machine ) /* * Draw sprites in front of foreground layer */ - if ( state->m_vdp.sprites_enable ) { - wswan_handle_sprites( machine, 0x2000 ); + if ( m_vdp.sprites_enable ) { + wswan_handle_sprites(0x2000 ); } } diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c index 31e8eba2217..ce78f4c9252 100644 --- a/src/mess/video/x68k.c +++ b/src/mess/video/x68k.c @@ -38,7 +38,7 @@ inline void x68k_state::x68k_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT bitmap.pix16(y, x) = (UINT16)color; } /* -static bitmap_ind16* x68k_get_gfx_page(int pri,int type) +bitmap_ind16* ::x68k_get_gfx_page(int pri,int type) { if(type == GFX16) { |