From 0e089286c1f66c2085b833546f3de466666f7c29 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 1 Apr 2013 09:18:07 +0000 Subject: [PATCH] modernized pocketc driver (nw) --- src/emu/cpu/sc61860/sc61860.c | 18 +++++ src/emu/cpu/sc61860/sc61860.h | 16 ++-- src/emu/cpu/sc61860/scops.c | 26 +++---- src/mess/drivers/pocketc.c | 98 ++++++++++-------------- src/mess/includes/pc1251.h | 36 ++++----- src/mess/includes/pc1350.h | 38 ++++------ src/mess/includes/pc1401.h | 34 +++------ src/mess/includes/pc1403.h | 40 ++++------ src/mess/machine/pc1251.c | 98 ++++++++++++------------ src/mess/machine/pc1350.c | 95 +++++++++++------------ src/mess/machine/pc1401.c | 99 ++++++++++++------------ src/mess/machine/pc1403.c | 138 ++++++++++++++++------------------ src/mess/video/pc1251.c | 12 +-- src/mess/video/pc1350.c | 18 ++--- src/mess/video/pc1401.c | 13 +--- src/mess/video/pc1403.c | 25 +++--- 16 files changed, 363 insertions(+), 441 deletions(-) diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c index b15f4498f37..46b98c7c8e5 100644 --- a/src/emu/cpu/sc61860/sc61860.c +++ b/src/emu/cpu/sc61860/sc61860.c @@ -58,6 +58,16 @@ struct sc61860_state direct_read_data *direct; int icount; UINT8 ram[0x100]; // internal special ram, should be 0x60, 0x100 to avoid memory corruption for now + + devcb_resolved_read_line reset; + devcb_resolved_read_line brk; + devcb_resolved_read_line x; + devcb_resolved_read8 ina; + devcb_resolved_write8 outa; + devcb_resolved_read8 inb; + devcb_resolved_write8 outb; + devcb_resolved_write8 outc; + }; INLINE sc61860_state *get_safe_token(device_t *device) @@ -107,6 +117,14 @@ static CPU_INIT( sc61860 ) cpustate->device = device; cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); + cpustate->reset.resolve(cpustate->config->reset,*device); + cpustate->brk.resolve( cpustate->config->brk,*device); + cpustate->x.resolve( cpustate->config->x,*device); + cpustate->ina.resolve( cpustate->config->ina,*device); + cpustate->outa.resolve( cpustate->config->outa,*device); + cpustate->inb.resolve( cpustate->config->inb,*device); + cpustate->outb.resolve( cpustate->config->outb,*device); + cpustate->outc.resolve( cpustate->config->outc,*device); } static CPU_EXECUTE( sc61860 ) diff --git a/src/emu/cpu/sc61860/sc61860.h b/src/emu/cpu/sc61860/sc61860.h index 83cd6ded146..079f9fd9153 100644 --- a/src/emu/cpu/sc61860/sc61860.h +++ b/src/emu/cpu/sc61860/sc61860.h @@ -39,14 +39,14 @@ struct sc61860_cpu_core { - int (*reset)(device_t *device); - int (*brk)(device_t *device); - int (*x)(device_t *device); - int (*ina)(device_t *device); - void (*outa)(device_t *device, int); - int (*inb)(device_t *device); - void (*outb)(device_t *device, int); - void (*outc)(device_t *device, int); + devcb_read_line reset; + devcb_read_line brk; + devcb_read_line x; + devcb_read8 ina; + devcb_write8 outa; + devcb_read8 inb; + devcb_write8 outb; + devcb_write8 outc; }; CPU_DISASSEMBLE( sc61860 ); diff --git a/src/emu/cpu/sc61860/scops.c b/src/emu/cpu/sc61860/scops.c index 84fed01c3ea..074792e02f1 100644 --- a/src/emu/cpu/sc61860/scops.c +++ b/src/emu/cpu/sc61860/scops.c @@ -419,15 +419,15 @@ INLINE void sc61860_reset_carry(sc61860_state *cpustate) INLINE void sc61860_out_a(sc61860_state *cpustate) { cpustate->q=IA; - if (cpustate->config&&cpustate->config->outa) - cpustate->config->outa(cpustate->device, READ_RAM(cpustate, IA)); + if (!cpustate->outa.isnull()) + cpustate->outa(0,READ_RAM(cpustate, IA)); } INLINE void sc61860_out_b(sc61860_state *cpustate) { cpustate->q=IB; - if (cpustate->config&&cpustate->config->outb) - cpustate->config->outb(cpustate->device, READ_RAM(cpustate, IB)); + if (!cpustate->outb.isnull()) + cpustate->outb(0, READ_RAM(cpustate, IB)); } INLINE void sc61860_out_f(sc61860_state *cpustate) @@ -447,15 +447,15 @@ INLINE void sc61860_out_f(sc61860_state *cpustate) INLINE void sc61860_out_c(sc61860_state *cpustate) { cpustate->q=C; - if (cpustate->config&&cpustate->config->outc) - cpustate->config->outc(cpustate->device, READ_RAM(cpustate, C)); + if (!cpustate->outc.isnull()) + cpustate->outc(0, READ_RAM(cpustate, C)); cpustate->c = READ_RAM(cpustate, C); } INLINE void sc61860_in_a(sc61860_state *cpustate) { int data=0; - if (cpustate->config&&cpustate->config->ina) data=cpustate->config->ina(cpustate->device); + if (!cpustate->ina.isnull()) data=cpustate->ina(0); WRITE_RAM(cpustate, A, data); cpustate->zero=data==0; } @@ -463,7 +463,7 @@ INLINE void sc61860_in_a(sc61860_state *cpustate) INLINE void sc61860_in_b(sc61860_state *cpustate) { int data=0; - if (cpustate->config&&cpustate->config->inb) data=cpustate->config->inb(cpustate->device); + if (!cpustate->inb.isnull()) data=cpustate->inb(0); WRITE_RAM(cpustate, A, data); cpustate->zero=data==0; } @@ -481,9 +481,9 @@ INLINE void sc61860_test_special(sc61860_state *cpustate) int t=0; if (cpustate->timer.t512ms) t|=1; if (cpustate->timer.t2ms) t|=2; - if (cpustate->config&&cpustate->config->brk&&cpustate->config->brk(cpustate->device)) t|=8; - if (cpustate->config&&cpustate->config->reset&&cpustate->config->reset(cpustate->device)) t|=0x40; - if (cpustate->config&&cpustate->config->x&&cpustate->config->x(cpustate->device)) t|=0x80; + if (!cpustate->brk.isnull()&&cpustate->brk()) t|=8; + if (!cpustate->reset.isnull()&&cpustate->reset()) t|=0x40; + if (!cpustate->x.isnull()&&cpustate->x()) t|=0x80; cpustate->zero=(t&READ_OP(cpustate))==0; } @@ -761,11 +761,11 @@ INLINE void sc61860_wait_x(sc61860_state *cpustate, int level) int c; cpustate->zero=level; - if (cpustate->config&&cpustate->config->x) { + if (!cpustate->x.isnull()) { for (c=READ_RAM(cpustate, I); c>=0; c--) { UINT8 t = (READ_RAM(cpustate, cpustate->p)+1)&0x7f; WRITE_RAM(cpustate, cpustate->p, t); - cpustate->zero=cpustate->config->x(cpustate->device); + cpustate->zero=cpustate->x(); cpustate->icount-=4; if (level != cpustate->zero) break; } diff --git a/src/mess/drivers/pocketc.c b/src/mess/drivers/pocketc.c index b12ab853172..36bfe9aefa2 100644 --- a/src/mess/drivers/pocketc.c +++ b/src/mess/drivers/pocketc.c @@ -80,76 +80,76 @@ /* special keys red c-ce and reset; warm boot, program NOT lost*/ -static ADDRESS_MAP_START( pc1401_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1401_mem , AS_PROGRAM, 8, pc1401_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM AM_RANGE( 0x3800, 0x47ff) AM_RAM - AM_RANGE( 0x6000, 0x67ff) AM_READWRITE_LEGACY(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) + AM_RANGE( 0x6000, 0x67ff) AM_READWRITE(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) AM_RANGE( 0x8000, 0xffff) AM_ROM ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1402_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1402_mem , AS_PROGRAM, 8, pc1401_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM AM_RANGE( 0x2000, 0x47ff) AM_RAM - AM_RANGE( 0x6000, 0x67ff) AM_READWRITE_LEGACY(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) + AM_RANGE( 0x6000, 0x67ff) AM_READWRITE(pc1401_lcd_read, pc1401_lcd_write ) AM_MIRROR(0x1000) AM_RANGE( 0x8000, 0xffff) AM_ROM ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1250_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1250_mem , AS_PROGRAM, 8, pc1251_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM AM_RANGE( 0x4000, 0x7fff) AM_ROM AM_RANGE( 0xc000, 0xc7ff) AM_RAM // 2KB RAM - AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1251_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1251_mem , AS_PROGRAM, 8, pc1251_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM AM_RANGE( 0x4000, 0x7fff) AM_ROM AM_RANGE( 0xb800, 0xc7ff) AM_RAM // 4KB RAM - AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1255_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1255_mem , AS_PROGRAM, 8, pc1251_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM AM_RANGE( 0x4000, 0x7fff) AM_ROM AM_RANGE( 0xa000, 0xc7ff) AM_RAM // 10KB RAM - AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0xf800, 0xf8ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1260_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1260_mem , AS_PROGRAM, 8, pc1251_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x2000, 0x20ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) - //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0x2000, 0x20ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) + //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) AM_RANGE( 0x5800, 0x67ff) AM_RAM // 4KB RAM AM_RANGE( 0x8000, 0xffff) AM_ROM ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1261_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1261_mem , AS_PROGRAM, 8, pc1251_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x2000, 0x20ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) - //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE_LEGACY(pc1251_lcd_read, pc1251_lcd_write) + AM_RANGE( 0x2000, 0x20ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) + //AM_RANGE( 0x2800, 0x28ff) AM_READWRITE(pc1251_lcd_read, pc1251_lcd_write) AM_RANGE( 0x4000, 0x67ff) AM_RAM // 10KB RAM AM_RANGE( 0x8000, 0xffff) AM_ROM ADDRESS_MAP_END -static ADDRESS_MAP_START( pc1350_mem , AS_PROGRAM, 8, pc1403_state ) +static ADDRESS_MAP_START( pc1350_mem , AS_PROGRAM, 8, pc1350_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x7000, 0x7eff) AM_READWRITE_LEGACY(pc1350_lcd_read, pc1350_lcd_write ) + AM_RANGE( 0x7000, 0x7eff) AM_READWRITE(pc1350_lcd_read, pc1350_lcd_write ) AM_RANGE( 0x8000, 0xffff) AM_ROM ADDRESS_MAP_END static ADDRESS_MAP_START( pc1403_mem , AS_PROGRAM, 8, pc1403_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x3000, 0x30bf) AM_READWRITE_LEGACY(pc1403_lcd_read, pc1403_lcd_write ) - AM_RANGE( 0x3800, 0x3fff) AM_READWRITE_LEGACY(pc1403_asic_read, pc1403_asic_write ) + AM_RANGE( 0x3000, 0x30bf) AM_READWRITE(pc1403_lcd_read, pc1403_lcd_write ) + AM_RANGE( 0x3800, 0x3fff) AM_READWRITE(pc1403_asic_read, pc1403_asic_write ) AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK("bank1") AM_RANGE( 0xe000, 0xffff) AM_RAM ADDRESS_MAP_END static ADDRESS_MAP_START( pc1403h_mem , AS_PROGRAM, 8, pc1403_state ) AM_RANGE( 0x0000, 0x1fff) AM_ROM - AM_RANGE( 0x3000, 0x30bf) AM_READWRITE_LEGACY(pc1403_lcd_read, pc1403_lcd_write ) - AM_RANGE( 0x3800, 0x3fff) AM_READWRITE_LEGACY(pc1403_asic_read, pc1403_asic_write ) + AM_RANGE( 0x3000, 0x30bf) AM_READWRITE(pc1403_lcd_read, pc1403_lcd_write ) + AM_RANGE( 0x3800, 0x3fff) AM_READWRITE(pc1403_asic_read, pc1403_asic_write ) AM_RANGE( 0x4000, 0x7fff) AM_ROMBANK("bank1") AM_RANGE( 0x8000, 0xffff) AM_RAM ADDRESS_MAP_END @@ -709,10 +709,10 @@ GFXDECODE_END static const sc61860_cpu_core pc1401_config = { - pc1401_reset, pc1401_brk, NULL, - pc1401_ina, pc1401_outa, - pc1401_inb, pc1401_outb, - pc1401_outc + DEVCB_DRIVER_LINE_MEMBER(pc1401_state,pc1401_reset), DEVCB_DRIVER_LINE_MEMBER(pc1401_state,pc1401_brk), DEVCB_NULL, + DEVCB_DRIVER_MEMBER(pc1401_state,pc1401_ina), DEVCB_DRIVER_MEMBER(pc1401_state,pc1401_outa), + DEVCB_DRIVER_MEMBER(pc1401_state,pc1401_inb), DEVCB_DRIVER_MEMBER(pc1401_state,pc1401_outb), + DEVCB_DRIVER_MEMBER(pc1401_state,pc1401_outc) }; static MACHINE_CONFIG_FRAGMENT( pocketc ) @@ -747,8 +747,6 @@ static MACHINE_CONFIG_START( pc1401, pc1401_state ) MCFG_CPU_PROGRAM_MAP(pc1401_mem) MCFG_CPU_CONFIG(pc1401_config) - MCFG_MACHINE_START( pc1401 ) - MCFG_FRAGMENT_ADD(pocketc) MCFG_SCREEN_MODIFY("screen") @@ -762,10 +760,10 @@ MACHINE_CONFIG_END static const sc61860_cpu_core pc1251_config = { - NULL, pc1251_brk, NULL, - pc1251_ina, pc1251_outa, - pc1251_inb, pc1251_outb, - pc1251_outc + DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(pc1251_state,pc1251_brk), DEVCB_NULL, + DEVCB_DRIVER_MEMBER(pc1251_state,pc1251_ina), DEVCB_DRIVER_MEMBER(pc1251_state,pc1251_outa), + DEVCB_DRIVER_MEMBER(pc1251_state,pc1251_inb), DEVCB_DRIVER_MEMBER(pc1251_state,pc1251_outb), + DEVCB_DRIVER_MEMBER(pc1251_state,pc1251_outc) }; static MACHINE_CONFIG_START( pc1250, pc1251_state ) @@ -775,8 +773,6 @@ static MACHINE_CONFIG_START( pc1250, pc1251_state ) MCFG_FRAGMENT_ADD(pocketc) - MCFG_MACHINE_START( pc1251 ) - /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_SIZE(608, 300) @@ -795,21 +791,11 @@ static MACHINE_CONFIG_DERIVED( pc1255, pc1250 ) MCFG_CPU_PROGRAM_MAP( pc1255_mem) MACHINE_CONFIG_END -static MACHINE_START( pc1260 ) -{ - device_t *main_cpu = machine.device("maincpu"); - UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x4000; - UINT8 *cpu = sc61860_internal_ram(main_cpu); - - machine.device("cpu_nvram")->set_base(cpu, 96); - machine.device("ram_nvram")->set_base(ram, 0x2800); -} - static MACHINE_CONFIG_DERIVED( pc1260, pc1250 ) MCFG_CPU_MODIFY( "maincpu" ) MCFG_CPU_PROGRAM_MAP( pc1260_mem) - MCFG_MACHINE_START( pc1260 ) + MCFG_MACHINE_START_OVERRIDE(pc1251_state, pc1260 ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pc1261, pc1260 ) @@ -819,10 +805,10 @@ MACHINE_CONFIG_END static const sc61860_cpu_core pc1350_config = { - NULL, pc1350_brk,NULL, - pc1350_ina, pc1350_outa, - pc1350_inb, pc1350_outb, - pc1350_outc + DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(pc1350_state,pc1350_brk), DEVCB_NULL, + DEVCB_DRIVER_MEMBER(pc1350_state,pc1350_ina), DEVCB_DRIVER_MEMBER(pc1350_state,pc1350_outa), + DEVCB_DRIVER_MEMBER(pc1350_state,pc1350_inb), DEVCB_DRIVER_MEMBER(pc1350_state,pc1350_outb), + DEVCB_DRIVER_MEMBER(pc1350_state,pc1350_outc) }; static MACHINE_CONFIG_START( pc1350, pc1350_state ) @@ -832,8 +818,6 @@ static MACHINE_CONFIG_START( pc1350, pc1350_state ) MCFG_FRAGMENT_ADD( pocketc ) - MCFG_MACHINE_START( pc1350 ) - /* aim: show sharp with keyboard resolution depends on the dots of the lcd @@ -852,10 +836,10 @@ MACHINE_CONFIG_END static const sc61860_cpu_core pc1403_config = { - NULL, pc1403_brk, NULL, - pc1403_ina, pc1403_outa, - NULL,NULL, - pc1403_outc + DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(pc1403_state,pc1403_brk), DEVCB_NULL, + DEVCB_DRIVER_MEMBER(pc1403_state,pc1403_ina), DEVCB_DRIVER_MEMBER(pc1403_state,pc1403_outa), + DEVCB_NULL, DEVCB_NULL, + DEVCB_DRIVER_MEMBER(pc1403_state,pc1403_outc) }; static MACHINE_CONFIG_START( pc1403, pc1403_state ) @@ -869,8 +853,6 @@ static MACHINE_CONFIG_START( pc1403, pc1403_state ) MCFG_CPU_PROGRAM_MAP( pc1403_mem) MCFG_CPU_CONFIG( pc1403_config ) - MCFG_MACHINE_START( pc1403 ) - /* aim: show sharp with keyboard resolution depends on the dots of the lcd @@ -882,8 +864,6 @@ static MACHINE_CONFIG_START( pc1403, pc1403_state ) // MCFG_SCREEN_SIZE(848, 361) // MCFG_SCREEN_VISIBLE_AREA(0, 848-1, 0, 361-1) MCFG_SCREEN_UPDATE_DRIVER(pc1403_state, screen_update_pc1403) - - MCFG_VIDEO_START( pc1403 ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( pc1403h, pc1403 ) diff --git a/src/mess/includes/pc1251.h b/src/mess/includes/pc1251.h index 3bd20c84ebf..067b7206ff1 100644 --- a/src/mess/includes/pc1251.h +++ b/src/mess/includes/pc1251.h @@ -11,7 +11,7 @@ #include "machine/nvram.h" -#define PC1251_CONTRAST (machine.root_device().ioport("DSW0")->read() & 0x07) +#define PC1251_CONTRAST (ioport("DSW0")->read() & 0x07) class pc1251_state : public driver_device @@ -28,28 +28,18 @@ public: DECLARE_DRIVER_INIT(pc1251); UINT32 screen_update_pc1251(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(pc1251_power_up); + DECLARE_WRITE8_MEMBER(pc1251_outa); + DECLARE_WRITE8_MEMBER(pc1251_outb); + DECLARE_WRITE8_MEMBER(pc1251_outc); + + DECLARE_READ_LINE_MEMBER(pc1251_reset); + DECLARE_READ_LINE_MEMBER(pc1251_brk); + DECLARE_READ8_MEMBER(pc1251_ina); + DECLARE_READ8_MEMBER(pc1251_inb); + DECLARE_READ8_MEMBER(pc1251_lcd_read); + DECLARE_WRITE8_MEMBER(pc1251_lcd_write); + virtual void machine_start(); + DECLARE_MACHINE_START(pc1260); }; - -/*----------- defined in machine/pc1251.c -----------*/ - -void pc1251_outa(device_t *device, int data); -void pc1251_outb(device_t *device, int data); -void pc1251_outc(device_t *device, int data); - -int pc1251_reset(device_t *device); -int pc1251_brk(device_t *device); -int pc1251_ina(device_t *device); -int pc1251_inb(device_t *device); - -MACHINE_START( pc1251 ); - - -/*----------- defined in video/pc1251.c -----------*/ - -DECLARE_READ8_HANDLER(pc1251_lcd_read); -DECLARE_WRITE8_HANDLER(pc1251_lcd_write); - - - #endif /* PC1251_H_ */ diff --git a/src/mess/includes/pc1350.h b/src/mess/includes/pc1350.h index acf981affbf..335517c7baf 100644 --- a/src/mess/includes/pc1350.h +++ b/src/mess/includes/pc1350.h @@ -11,7 +11,7 @@ #include "machine/nvram.h" -#define PC1350_CONTRAST (machine.root_device().ioport("DSW0")->read() & 0x07) +#define PC1350_CONTRAST (ioport("DSW0")->read() & 0x07) class pc1350_state : public driver_device @@ -26,29 +26,19 @@ public: UINT8 m_reg[0x1000]; UINT32 screen_update_pc1350(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(pc1350_power_up); + + DECLARE_WRITE8_MEMBER(pc1350_outa); + DECLARE_WRITE8_MEMBER(pc1350_outb); + DECLARE_WRITE8_MEMBER(pc1350_outc); + + DECLARE_READ_LINE_MEMBER(pc1350_brk); + DECLARE_READ8_MEMBER(pc1350_ina); + DECLARE_READ8_MEMBER(pc1350_inb); + DECLARE_READ8_MEMBER(pc1350_lcd_read); + DECLARE_WRITE8_MEMBER(pc1350_lcd_write); + DECLARE_READ8_MEMBER(pc1350_keyboard_line_r); + + virtual void machine_start(); }; - -/*----------- defined in machine/pc1350.c -----------*/ - -void pc1350_outa(device_t *device, int data); -void pc1350_outb(device_t *device, int data); -void pc1350_outc(device_t *device, int data); - -int pc1350_brk(device_t *device); -int pc1350_ina(device_t *device); -int pc1350_inb(device_t *device); - -MACHINE_START( pc1350 ); - - -/*----------- defined in video/pc1350.c -----------*/ - -DECLARE_READ8_HANDLER(pc1350_lcd_read); -DECLARE_WRITE8_HANDLER(pc1350_lcd_write); - - -int pc1350_keyboard_line_r(running_machine &machine); - - #endif /* PC1350_H_ */ diff --git a/src/mess/includes/pc1401.h b/src/mess/includes/pc1401.h index e0e66d6c202..84b9ab718c7 100644 --- a/src/mess/includes/pc1401.h +++ b/src/mess/includes/pc1401.h @@ -11,7 +11,7 @@ #include "machine/nvram.h" -#define CONTRAST (machine.root_device().ioport("DSW0")->read() & 0x07) +#define CONTRAST (ioport("DSW0")->read() & 0x07) class pc1401_state : public driver_device @@ -28,27 +28,17 @@ public: DECLARE_DRIVER_INIT(pc1401); UINT32 screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(pc1401_power_up); + DECLARE_READ_LINE_MEMBER(pc1401_reset); + DECLARE_READ_LINE_MEMBER(pc1401_brk); + DECLARE_WRITE8_MEMBER(pc1401_outa); + DECLARE_WRITE8_MEMBER(pc1401_outb); + DECLARE_WRITE8_MEMBER(pc1401_outc); + DECLARE_READ8_MEMBER(pc1401_ina); + DECLARE_READ8_MEMBER(pc1401_inb); + DECLARE_READ8_MEMBER(pc1401_lcd_read); + DECLARE_WRITE8_MEMBER(pc1401_lcd_write); + + virtual void machine_start(); }; - -/*----------- defined in machine/pc1401.c -----------*/ - -int pc1401_reset(device_t *device); -int pc1401_brk(device_t *device); -void pc1401_outa(device_t *device, int data); -void pc1401_outb(device_t *device, int data); -void pc1401_outc(device_t *device, int data); -int pc1401_ina(device_t *device); -int pc1401_inb(device_t *device); - -MACHINE_START( pc1401 ); - - -/*----------- defined in video/pc1401.c -----------*/ - -DECLARE_READ8_HANDLER(pc1401_lcd_read); -DECLARE_WRITE8_HANDLER(pc1401_lcd_write); - - - #endif /* PC1401_H_ */ diff --git a/src/mess/includes/pc1403.h b/src/mess/includes/pc1403.h index a7b88c10408..dd7c61e5093 100644 --- a/src/mess/includes/pc1403.h +++ b/src/mess/includes/pc1403.h @@ -11,7 +11,7 @@ #include "machine/nvram.h" -#define CONTRAST (machine.root_device().ioport("DSW0")->read() & 0x07) +#define CONTRAST (ioport("DSW0")->read() & 0x07) class pc1403_state : public driver_device @@ -31,32 +31,18 @@ public: DECLARE_DRIVER_INIT(pc1403); UINT32 screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(pc1403_power_up); + DECLARE_READ_LINE_MEMBER(pc1403_reset); + DECLARE_READ_LINE_MEMBER(pc1403_brk); + DECLARE_WRITE8_MEMBER(pc1403_outa); + DECLARE_WRITE8_MEMBER(pc1403_outc); + DECLARE_READ8_MEMBER(pc1403_ina); + + DECLARE_READ8_MEMBER(pc1403_asic_read); + DECLARE_WRITE8_MEMBER(pc1403_asic_write); + DECLARE_READ8_MEMBER(pc1403_lcd_read); + DECLARE_WRITE8_MEMBER(pc1403_lcd_write); + virtual void video_start(); + virtual void machine_start(); }; - -/*----------- defined in machine/pc1403.c -----------*/ - -int pc1403_reset(device_t *device); -int pc1403_brk(device_t *device); -void pc1403_outa(device_t *device, int data); -//void pc1403_outb(device_t *device, int data); -void pc1403_outc(device_t *device, int data); -int pc1403_ina(device_t *device); -//int pc1403_inb(device_t *device); - -MACHINE_START( pc1403 ); - -DECLARE_READ8_HANDLER(pc1403_asic_read); -DECLARE_WRITE8_HANDLER(pc1403_asic_write); - - -/*----------- defined in video/pc1403.c -----------*/ - -VIDEO_START( pc1403 ); - - -DECLARE_READ8_HANDLER(pc1403_lcd_read); -DECLARE_WRITE8_HANDLER(pc1403_lcd_write); - - #endif /* PC1403_H_ */ diff --git a/src/mess/machine/pc1251.c b/src/mess/machine/pc1251.c index 546e109afd4..71fc1487a8f 100644 --- a/src/mess/machine/pc1251.c +++ b/src/mess/machine/pc1251.c @@ -8,98 +8,104 @@ -void pc1251_outa(device_t *device, int data) +WRITE8_MEMBER(pc1251_state::pc1251_outa) { - pc1251_state *state = device->machine().driver_data(); - state->m_outa = data; + m_outa = data; } -void pc1251_outb(device_t *device, int data) +WRITE8_MEMBER(pc1251_state::pc1251_outb) { - pc1251_state *state = device->machine().driver_data(); - state->m_outb = data; + m_outb = data; } -void pc1251_outc(device_t *device, int data) +WRITE8_MEMBER(pc1251_state::pc1251_outc) { } -int pc1251_ina(device_t *device) +READ8_MEMBER(pc1251_state::pc1251_ina) { - pc1251_state *state = device->machine().driver_data(); - int data = state->m_outa; - running_machine &machine = device->machine(); + int data = m_outa; - if (state->m_outb & 0x01) + if (m_outb & 0x01) { - data |= machine.root_device().ioport("KEY0")->read(); + data |= ioport("KEY0")->read(); /* At Power Up we fake a 'CL' pressure */ - if (state->m_power) + if (m_power) data |= 0x02; // problem with the deg lcd } - if (state->m_outb & 0x02) - data |= machine.root_device().ioport("KEY1")->read(); + if (m_outb & 0x02) + data |= ioport("KEY1")->read(); - if (state->m_outb & 0x04) - data |= machine.root_device().ioport("KEY2")->read(); + if (m_outb & 0x04) + data |= ioport("KEY2")->read(); - if (state->m_outa & 0x01) - data |= machine.root_device().ioport("KEY3")->read(); + if (m_outa & 0x01) + data |= ioport("KEY3")->read(); - if (state->m_outa & 0x02) - data |= machine.root_device().ioport("KEY4")->read(); + if (m_outa & 0x02) + data |= ioport("KEY4")->read(); - if (state->m_outa & 0x04) - data |= machine.root_device().ioport("KEY5")->read(); + if (m_outa & 0x04) + data |= ioport("KEY5")->read(); - if (state->m_outa & 0x08) - data |= machine.root_device().ioport("KEY6")->read(); + if (m_outa & 0x08) + data |= ioport("KEY6")->read(); - if (state->m_outa & 0x10) - data |= machine.root_device().ioport("KEY7")->read(); + if (m_outa & 0x10) + data |= ioport("KEY7")->read(); - if (state->m_outa & 0x20) - data |= machine.root_device().ioport("KEY8")->read(); + if (m_outa & 0x20) + data |= ioport("KEY8")->read(); - if (state->m_outa & 0x40) - data |= machine.root_device().ioport("KEY9")->read(); + if (m_outa & 0x40) + data |= ioport("KEY9")->read(); return data; } -int pc1251_inb(device_t *device) +READ8_MEMBER(pc1251_state::pc1251_inb) { - pc1251_state *state = device->machine().driver_data(); - int data = state->m_outb; + int data = m_outb; - if (state->m_outb & 0x08) - data |= (state->ioport("MODE")->read() & 0x07); + if (m_outb & 0x08) + data |= (ioport("MODE")->read() & 0x07); return data; } -int pc1251_brk(device_t *device) +READ_LINE_MEMBER(pc1251_state::pc1251_brk) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x01); + return (ioport("EXTRA")->read() & 0x01); } -int pc1251_reset(device_t *device) +READ_LINE_MEMBER(pc1251_state::pc1251_reset) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x02); + return (ioport("EXTRA")->read() & 0x02); } -MACHINE_START( pc1251 ) +void pc1251_state::machine_start() { - device_t *main_cpu = machine.device("maincpu"); - UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x8000; + device_t *main_cpu = machine().device("maincpu"); + UINT8 *ram = memregion("maincpu")->base() + 0x8000; UINT8 *cpu = sc61860_internal_ram(main_cpu); - machine.device("cpu_nvram")->set_base(cpu, 96); - machine.device("ram_nvram")->set_base(ram, 0x4800); + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x4800); } +MACHINE_START_MEMBER(pc1251_state,pc1260 ) +{ + device_t *main_cpu = machine().device("maincpu"); + UINT8 *ram = memregion("maincpu")->base() + 0x4000; + UINT8 *cpu = sc61860_internal_ram(main_cpu); + + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x2800); +} + + TIMER_CALLBACK_MEMBER(pc1251_state::pc1251_power_up) { m_power = 0; diff --git a/src/mess/machine/pc1350.c b/src/mess/machine/pc1350.c index 3227381a7f7..391f3d3590f 100644 --- a/src/mess/machine/pc1350.c +++ b/src/mess/machine/pc1350.c @@ -7,86 +7,80 @@ -void pc1350_outa(device_t *device, int data) +WRITE8_MEMBER(pc1350_state::pc1350_outa) { - pc1350_state *state = device->machine().driver_data(); - state->m_outa=data; + m_outa=data; } -void pc1350_outb(device_t *device, int data) +WRITE8_MEMBER(pc1350_state::pc1350_outb) { - pc1350_state *state = device->machine().driver_data(); - state->m_outb=data; + m_outb=data; } -void pc1350_outc(device_t *device, int data) +WRITE8_MEMBER(pc1350_state::pc1350_outc) { } -int pc1350_ina(device_t *device) +READ8_MEMBER(pc1350_state::pc1350_ina) { - pc1350_state *state = device->machine().driver_data(); - running_machine &machine = device->machine(); - int data = state->m_outa; - int t = pc1350_keyboard_line_r(machine); + int data = m_outa; + int t = pc1350_keyboard_line_r(space,0); if (t & 0x01) - data |= machine.root_device().ioport("KEY0")->read(); + data |= ioport("KEY0")->read(); if (t & 0x02) - data |= machine.root_device().ioport("KEY1")->read(); + data |= ioport("KEY1")->read(); if (t & 0x04) - data |= machine.root_device().ioport("KEY2")->read(); + data |= ioport("KEY2")->read(); if (t & 0x08) - data |= machine.root_device().ioport("KEY3")->read(); + data |= ioport("KEY3")->read(); if (t & 0x10) - data |= machine.root_device().ioport("KEY4")->read(); + data |= ioport("KEY4")->read(); if (t & 0x20) - data |= machine.root_device().ioport("KEY5")->read(); + data |= ioport("KEY5")->read(); - if (state->m_outa & 0x01) - data |= machine.root_device().ioport("KEY6")->read(); + if (m_outa & 0x01) + data |= ioport("KEY6")->read(); - if (state->m_outa & 0x02) - data |= machine.root_device().ioport("KEY7")->read(); + if (m_outa & 0x02) + data |= ioport("KEY7")->read(); - if (state->m_outa & 0x04) + if (m_outa & 0x04) { - data |= machine.root_device().ioport("KEY8")->read(); + data |= ioport("KEY8")->read(); /* At Power Up we fake a 'CLS' pressure */ - if (state->m_power) + if (m_power) data |= 0x08; } - if (state->m_outa & 0x08) - data |= machine.root_device().ioport("KEY9")->read(); + if (m_outa & 0x08) + data |= ioport("KEY9")->read(); - if (state->m_outa & 0x10) - data |= machine.root_device().ioport("KEY10")->read(); + if (m_outa & 0x10) + data |= ioport("KEY10")->read(); - if (state->m_outa & 0xc0) - data |= machine.root_device().ioport("KEY11")->read(); + if (m_outa & 0xc0) + data |= ioport("KEY11")->read(); // missing lshift return data; } -int pc1350_inb(device_t *device) +READ8_MEMBER(pc1350_state::pc1350_inb) { - pc1350_state *state = device->machine().driver_data(); - int data=state->m_outb; - return data; + return m_outb; } -int pc1350_brk(device_t *device) +READ_LINE_MEMBER(pc1350_state::pc1350_brk) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x01); + return (ioport("EXTRA")->read() & 0x01); } TIMER_CALLBACK_MEMBER(pc1350_state::pc1350_power_up) @@ -94,41 +88,40 @@ TIMER_CALLBACK_MEMBER(pc1350_state::pc1350_power_up) m_power=0; } -MACHINE_START( pc1350 ) +void pc1350_state::machine_start() { - pc1350_state *state = machine.driver_data(); - address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); - state->m_power = 1; - machine.scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1350_state::pc1350_power_up),state)); + m_power = 1; + machine().scheduler().timer_set(attotime::from_seconds(1), timer_expired_delegate(FUNC(pc1350_state::pc1350_power_up),this)); space.install_readwrite_bank(0x6000, 0x6fff, "bank1"); - state->membank("bank1")->set_base(&machine.device(RAM_TAG)->pointer()[0x0000]); + membank("bank1")->set_base(&machine().device(RAM_TAG)->pointer()[0x0000]); - if (machine.device(RAM_TAG)->size() >= 0x3000) + if (machine().device(RAM_TAG)->size() >= 0x3000) { space.install_readwrite_bank(0x4000, 0x5fff, "bank2"); - state->membank("bank2")->set_base(&machine.device(RAM_TAG)->pointer()[0x1000]); + membank("bank2")->set_base(&machine().device(RAM_TAG)->pointer()[0x1000]); } else { space.nop_readwrite(0x4000, 0x5fff); } - if (machine.device(RAM_TAG)->size() >= 0x5000) + if (machine().device(RAM_TAG)->size() >= 0x5000) { space.install_readwrite_bank(0x2000, 0x3fff, "bank3"); - state->membank("bank3")->set_base(&machine.device(RAM_TAG)->pointer()[0x3000]); + membank("bank3")->set_base(&machine().device(RAM_TAG)->pointer()[0x3000]); } else { space.nop_readwrite(0x2000, 0x3fff); } - device_t *main_cpu = machine.device("maincpu"); - UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x2000; + device_t *main_cpu = machine().device("maincpu"); + UINT8 *ram = machine().root_device().memregion("maincpu")->base() + 0x2000; UINT8 *cpu = sc61860_internal_ram(main_cpu); - machine.device("cpu_nvram")->set_base(cpu, 96); - machine.device("ram_nvram")->set_base(ram, 0x5000); + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x5000); } diff --git a/src/mess/machine/pc1401.c b/src/mess/machine/pc1401.c index ecbe26beebc..84ea72ec45f 100644 --- a/src/mess/machine/pc1401.c +++ b/src/mess/machine/pc1401.c @@ -21,107 +21,102 @@ -void pc1401_outa(device_t *device, int data) +WRITE8_MEMBER(pc1401_state::pc1401_outa) { - pc1401_state *state = device->machine().driver_data(); - state->m_outa = data; + m_outa = data; } -void pc1401_outb(device_t *device, int data) +WRITE8_MEMBER(pc1401_state::pc1401_outb) { - pc1401_state *state = device->machine().driver_data(); - state->m_outb = data; + m_outb = data; } -void pc1401_outc(device_t *device, int data) +WRITE8_MEMBER(pc1401_state::pc1401_outc) { - pc1401_state *state = device->machine().driver_data(); //logerror("%g outc %.2x\n", machine.time().as_double(), data); - state->m_portc = data; + m_portc = data; } -int pc1401_ina(device_t *device) +READ8_MEMBER(pc1401_state::pc1401_ina) { - pc1401_state *state = device->machine().driver_data(); - int data = state->m_outa; + int data = m_outa; - if (state->m_outb & 0x01) - data |= device->machine().root_device().ioport("KEY0")->read(); + if (m_outb & 0x01) + data |= ioport("KEY0")->read(); - if (state->m_outb & 0x02) - data |= device->machine().root_device().ioport("KEY1")->read(); + if (m_outb & 0x02) + data |= ioport("KEY1")->read(); - if (state->m_outb & 0x04) - data |= device->machine().root_device().ioport("KEY2")->read(); + if (m_outb & 0x04) + data |= ioport("KEY2")->read(); - if (state->m_outb & 0x08) - data |= device->machine().root_device().ioport("KEY3")->read(); + if (m_outb & 0x08) + data |= ioport("KEY3")->read(); - if (state->m_outb & 0x10) - data |= device->machine().root_device().ioport("KEY4")->read(); + if (m_outb & 0x10) + data |= ioport("KEY4")->read(); - if (state->m_outb & 0x20) + if (m_outb & 0x20) { - data |= state->ioport("KEY5")->read(); + data |= ioport("KEY5")->read(); /* At Power Up we fake a 'C-CE' pressure */ - if (state->m_power) + if (m_power) data |= 0x01; } - if (state->m_outa & 0x01) - data |= device->machine().root_device().ioport("KEY6")->read(); + if (m_outa & 0x01) + data |= ioport("KEY6")->read(); - if (state->m_outa & 0x02) - data |= device->machine().root_device().ioport("KEY7")->read(); + if (m_outa & 0x02) + data |= ioport("KEY7")->read(); - if (state->m_outa & 0x04) - data |= device->machine().root_device().ioport("KEY8")->read(); + if (m_outa & 0x04) + data |= ioport("KEY8")->read(); - if (state->m_outa & 0x08) - data |= device->machine().root_device().ioport("KEY9")->read(); + if (m_outa & 0x08) + data |= ioport("KEY9")->read(); - if (state->m_outa & 0x10) - data |= device->machine().root_device().ioport("KEY10")->read(); + if (m_outa & 0x10) + data |= ioport("KEY10")->read(); - if (state->m_outa & 0x20) - data |= device->machine().root_device().ioport("KEY11")->read(); + if (m_outa & 0x20) + data |= ioport("KEY11")->read(); - if (state->m_outa & 0x40) - data |= device->machine().root_device().ioport("KEY12")->read(); + if (m_outa & 0x40) + data |= ioport("KEY12")->read(); return data; } -int pc1401_inb(device_t *device) +READ8_MEMBER(pc1401_state::pc1401_inb) { - pc1401_state *state = device->machine().driver_data(); - int data=state->m_outb; + int data=m_outb; - if (state->ioport("EXTRA")->read() & 0x04) + if (ioport("EXTRA")->read() & 0x04) data |= 0x01; return data; } -int pc1401_brk(device_t *device) +READ_LINE_MEMBER(pc1401_state::pc1401_brk) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x01); + return (ioport("EXTRA")->read() & 0x01); } -int pc1401_reset(device_t *device) +READ_LINE_MEMBER(pc1401_state::pc1401_reset) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x02); + return (ioport("EXTRA")->read() & 0x02); } -MACHINE_START( pc1401 ) +void pc1401_state::machine_start() { - device_t *main_cpu = machine.device("maincpu"); - UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x2000; + device_t *main_cpu = machine().device("maincpu"); + UINT8 *ram = memregion("maincpu")->base() + 0x2000; UINT8 *cpu = sc61860_internal_ram(main_cpu); - machine.device("cpu_nvram")->set_base(cpu, 96); - machine.device("ram_nvram")->set_base(ram, 0x2800); + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x2800); } TIMER_CALLBACK_MEMBER(pc1401_state::pc1401_power_up) diff --git a/src/mess/machine/pc1403.c b/src/mess/machine/pc1403.c index c184c713753..c80b8ba819f 100644 --- a/src/mess/machine/pc1403.c +++ b/src/mess/machine/pc1403.c @@ -17,139 +17,133 @@ bits 0..6 keyboard output select matrix line */ -WRITE8_HANDLER(pc1403_asic_write) +WRITE8_MEMBER(pc1403_state::pc1403_asic_write) { - pc1403_state *state = space.machine().driver_data(); - state->m_asic[offset>>9]=data; + m_asic[offset>>9]=data; switch( (offset>>9) ){ - case 0/*0x3800*/: - // output - logerror ("asic write %.4x %.2x\n",offset, data); - break; - case 1/*0x3a00*/: - logerror ("asic write %.4x %.2x\n",offset, data); - break; - case 2/*0x3c00*/: - state->membank("bank1")->set_base(state->memregion("user1")->base()+((data&7)<<14)); - logerror ("asic write %.4x %.2x\n",offset, data); - break; - case 3/*0x3e00*/: break; + case 0/*0x3800*/: + // output + logerror ("asic write %.4x %.2x\n",offset, data); + break; + case 1/*0x3a00*/: + logerror ("asic write %.4x %.2x\n",offset, data); + break; + case 2/*0x3c00*/: + membank("bank1")->set_base(memregion("user1")->base()+((data&7)<<14)); + logerror ("asic write %.4x %.2x\n",offset, data); + break; + case 3/*0x3e00*/: break; } } -READ8_HANDLER(pc1403_asic_read) +READ8_MEMBER(pc1403_state::pc1403_asic_read) { - pc1403_state *state = space.machine().driver_data(); - UINT8 data=state->m_asic[offset>>9]; + UINT8 data=m_asic[offset>>9]; switch( (offset>>9) ){ - case 0: case 1: case 2: - logerror ("asic read %.4x %.2x\n",offset, data); - break; + case 0: case 1: case 2: + logerror ("asic read %.4x %.2x\n",offset, data); + break; } return data; } -void pc1403_outa(device_t *device, int data) +WRITE8_MEMBER(pc1403_state::pc1403_outa) { - pc1403_state *state = device->machine().driver_data(); - state->m_outa=data; + m_outa=data; } -int pc1403_ina(device_t *device) +READ8_MEMBER(pc1403_state::pc1403_ina) { - pc1403_state *state = device->machine().driver_data(); - UINT8 data=state->m_outa; + UINT8 data=m_outa; - if (state->m_asic[3] & 0x01) - data |= device->machine().root_device().ioport("KEY0")->read(); + if (m_asic[3] & 0x01) + data |= ioport("KEY0")->read(); - if (state->m_asic[3] & 0x02) - data |= device->machine().root_device().ioport("KEY1")->read(); + if (m_asic[3] & 0x02) + data |= ioport("KEY1")->read(); - if (state->m_asic[3] & 0x04) - data |= device->machine().root_device().ioport("KEY2")->read(); + if (m_asic[3] & 0x04) + data |= ioport("KEY2")->read(); - if (state->m_asic[3] & 0x08) - data |= device->machine().root_device().ioport("KEY3")->read(); + if (m_asic[3] & 0x08) + data |= ioport("KEY3")->read(); - if (state->m_asic[3] & 0x10) - data |= device->machine().root_device().ioport("KEY4")->read(); + if (m_asic[3] & 0x10) + data |= ioport("KEY4")->read(); - if (state->m_asic[3] & 0x20) - data |= device->machine().root_device().ioport("KEY5")->read(); + if (m_asic[3] & 0x20) + data |= ioport("KEY5")->read(); - if (state->m_asic[3] & 0x40) - data |= device->machine().root_device().ioport("KEY6")->read(); + if (m_asic[3] & 0x40) + data |= ioport("KEY6")->read(); - if (state->m_outa & 0x01) + if (m_outa & 0x01) { - data |= state->ioport("KEY7")->read(); + data |= ioport("KEY7")->read(); /* At Power Up we fake a 'C-CE' pressure */ - if (state->m_power) + if (m_power) data |= 0x02; } - if (state->m_outa & 0x02) - data |= device->machine().root_device().ioport("KEY8")->read(); + if (m_outa & 0x02) + data |= ioport("KEY8")->read(); - if (state->m_outa & 0x04) - data |= device->machine().root_device().ioport("KEY9")->read(); + if (m_outa & 0x04) + data |= ioport("KEY9")->read(); - if (state->m_outa & 0x08) - data |= device->machine().root_device().ioport("KEY10")->read(); + if (m_outa & 0x08) + data |= ioport("KEY10")->read(); - if (state->m_outa & 0x10) - data |= device->machine().root_device().ioport("KEY11")->read(); + if (m_outa & 0x10) + data |= ioport("KEY11")->read(); - if (state->m_outa & 0x20) - data |= device->machine().root_device().ioport("KEY12")->read(); + if (m_outa & 0x20) + data |= ioport("KEY12")->read(); - if (state->m_outa & 0x40) - data |= device->machine().root_device().ioport("KEY13")->read(); + if (m_outa & 0x40) + data |= ioport("KEY13")->read(); return data; } #if 0 -int pc1403_inb(void) +READ8_MEMBER(pc1403_state::pc1403_inb) { - pc1403_state *state = machine.driver_data(); - int data = state->m_outb; + int data = m_outb; - if (machine.root_device().ioport("KEY13")->read()) + if (ioport("KEY13")->read()) data |= 1; return data; } #endif -void pc1403_outc(device_t *device, int data) +WRITE8_MEMBER(pc1403_state::pc1403_outc) { - pc1403_state *state = device->machine().driver_data(); - state->m_portc = data; + m_portc = data; // logerror("%g pc %.4x outc %.2x\n", device->machine().time().as_double(), device->machine().device("maincpu")->safe_pc(), data); } -int pc1403_brk(device_t *device) +READ_LINE_MEMBER(pc1403_state::pc1403_brk) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x01); + return (ioport("EXTRA")->read() & 0x01); } -int pc1403_reset(device_t *device) +READ_LINE_MEMBER(pc1403_state::pc1403_reset) { - return (device->machine().root_device().ioport("EXTRA")->read() & 0x02); + return (ioport("EXTRA")->read() & 0x02); } -MACHINE_START( pc1403 ) +void pc1403_state::machine_start() { - device_t *main_cpu = machine.device("maincpu"); - UINT8 *ram = machine.root_device().memregion("maincpu")->base() + 0x8000; + device_t *main_cpu = machine().device("maincpu"); + UINT8 *ram = memregion("maincpu")->base() + 0x8000; UINT8 *cpu = sc61860_internal_ram(main_cpu); - machine.device("cpu_nvram")->set_base(cpu, 96); - machine.device("ram_nvram")->set_base(ram, 0x8000); + machine().device("cpu_nvram")->set_base(cpu, 96); + machine().device("ram_nvram")->set_base(ram, 0x8000); } TIMER_CALLBACK_MEMBER(pc1403_state::pc1403_power_up) diff --git a/src/mess/video/pc1251.c b/src/mess/video/pc1251.c index 3b9659e30f9..ecf4a6aed5f 100644 --- a/src/mess/video/pc1251.c +++ b/src/mess/video/pc1251.c @@ -95,20 +95,17 @@ static const POCKETC_FIGURE busy={ "1 1 11 1e" }; - READ8_HANDLER(pc1251_lcd_read) +READ8_MEMBER(pc1251_state::pc1251_lcd_read) { - pc1251_state *state = space.machine().driver_data(); - int data; - data = state->m_reg[offset&0xff]; + UINT8 data = m_reg[offset&0xff]; logerror("pc1251 read %.3x %.2x\n",offset,data); return data; } -WRITE8_HANDLER(pc1251_lcd_write) +WRITE8_MEMBER(pc1251_state::pc1251_lcd_write) { - pc1251_state *state = space.machine().driver_data(); logerror("pc1251 write %.3x %.2x\n",offset,data); - state->m_reg[offset&0xff] = data; + m_reg[offset&0xff] = data; } #define DOWN 62 @@ -118,7 +115,6 @@ UINT32 pc1251_state::screen_update_pc1251(screen_device &screen, bitmap_ind16 &b { int x, y, i, j; int color[2]; - running_machine &machine = screen.machine(); bitmap.fill(11, cliprect); diff --git a/src/mess/video/pc1350.c b/src/mess/video/pc1350.c index 1aaa213eaa4..174451dd344 100644 --- a/src/mess/video/pc1350.c +++ b/src/mess/video/pc1350.c @@ -95,26 +95,22 @@ static const POCKETC_FIGURE busy={ "1 1 11 1e" }; - READ8_HANDLER(pc1350_lcd_read) +READ8_MEMBER(pc1350_state::pc1350_lcd_read) { - pc1350_state *state = space.machine().driver_data(); - int data; - data = state->m_reg[offset&0xfff]; + UINT8 data = m_reg[offset&0xfff]; logerror("pc1350 read %.3x %.2x\n",offset,data); return data; } -WRITE8_HANDLER(pc1350_lcd_write) +WRITE8_MEMBER(pc1350_state::pc1350_lcd_write) { - pc1350_state *state = space.machine().driver_data(); logerror("pc1350 write %.3x %.2x\n",offset,data); - state->m_reg[offset&0xfff] = data; + m_reg[offset&0xfff] = data; } -int pc1350_keyboard_line_r(running_machine &machine) +READ8_MEMBER(pc1350_state::pc1350_keyboard_line_r) { - pc1350_state *state = machine.driver_data(); - return state->m_reg[0xe00]; + return m_reg[0xe00]; } /* pc1350 @@ -133,8 +129,6 @@ UINT32 pc1350_state::screen_update_pc1350(screen_device &screen, bitmap_ind16 &b { int x, y=DOWN, i, j, k=0, b; int color[4]; - running_machine &machine = screen.machine(); - bitmap.fill(11, cliprect); /* HJB: we cannot initialize array with values from other arrays, thus... */ diff --git a/src/mess/video/pc1401.c b/src/mess/video/pc1401.c index 74f469aa88b..e2b9ab36f9b 100644 --- a/src/mess/video/pc1401.c +++ b/src/mess/video/pc1401.c @@ -17,18 +17,14 @@ 603d: 0 BUSY, 1 DEF, 2 SHIFT, 3 BGN, 4 STAT, 5 FIN, 6 PRINT 607c: 0 E, 1 M, 2 BAL, 3 INT, 4 PRN, 5 Sum-Sign, 6 PRO */ - READ8_HANDLER(pc1401_lcd_read) +READ8_MEMBER(pc1401_state::pc1401_lcd_read) { - pc1401_state *state = space.machine().driver_data(); - offset&=0xff; - return state->m_reg[offset]; + return m_reg[offset & 0xff]; } -WRITE8_HANDLER(pc1401_lcd_write) +WRITE8_MEMBER(pc1401_state::pc1401_lcd_write) { - pc1401_state *state = space.machine().driver_data(); - offset&=0xff; - state->m_reg[offset]=data; + m_reg[offset & 0xff]=data; } static const POCKETC_FIGURE line={ /* simple line */ @@ -133,7 +129,6 @@ static const POCKETC_FIGURE busy={ UINT32 pc1401_state::screen_update_pc1401(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - running_machine &machine = screen.machine(); int x, y, i, j; int color[2]; diff --git a/src/mess/video/pc1403.c b/src/mess/video/pc1403.c index 0d786dc9ce4..7378a0e35c7 100644 --- a/src/mess/video/pc1403.c +++ b/src/mess/video/pc1403.c @@ -34,32 +34,28 @@ #include "includes/pc1403.h" -VIDEO_START( pc1403 ) +void pc1403_state::video_start() { - pc1403_state *state = machine.driver_data(); - if (strcmp(machine.system().name, "pc1403h") == 0) + if (strcmp(machine().system().name, "pc1403h") == 0) { - state->m_DOWN = 69; - state->m_RIGHT = 155; + m_DOWN = 69; + m_RIGHT = 155; } else { - state->m_DOWN = 67; - state->m_RIGHT = 152; + m_DOWN = 67; + m_RIGHT = 152; } } - -READ8_HANDLER(pc1403_lcd_read) +READ8_MEMBER(pc1403_state::pc1403_lcd_read) { - pc1403_state *state = space.machine().driver_data(); - return state->m_reg[offset]; + return m_reg[offset]; } -WRITE8_HANDLER(pc1403_lcd_write) +WRITE8_MEMBER(pc1403_state::pc1403_lcd_write) { - pc1403_state *state = space.machine().driver_data(); - state->m_reg[offset]=data; + m_reg[offset]=data; } static const POCKETC_FIGURE line={ /* simple line */ @@ -149,7 +145,6 @@ static const POCKETC_FIGURE busy={ UINT32 pc1403_state::screen_update_pc1403(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - running_machine &machine = screen.machine(); int x, y, i, j; int color[3];