diff options
| author | 2013-04-19 07:20:14 +0000 | |
|---|---|---|
| committer | 2013-04-19 07:20:14 +0000 | |
| commit | abedd24d6eb3826843e57f74efa722b48da4cf66 (patch) | |
| tree | 0fa1027d2d37f7aa59bbf06adc42981542c2a2f0 /src/mess | |
| parent | 2b291b19f21da4e12502c4d3277229ec030b3910 (diff) | |
more state cleanup and some modernization (nw)
Diffstat (limited to 'src/mess')
| -rw-r--r-- | src/mess/drivers/gp32.c | 144 | ||||
| -rw-r--r-- | src/mess/drivers/ip20.c | 5 | ||||
| -rw-r--r-- | src/mess/drivers/ip22.c | 138 | ||||
| -rw-r--r-- | src/mess/drivers/mac.c | 2 | ||||
| -rw-r--r-- | src/mess/includes/compis.h | 6 | ||||
| -rw-r--r-- | src/mess/includes/gp32.h | 12 | ||||
| -rw-r--r-- | src/mess/includes/mac.h | 3 | ||||
| -rw-r--r-- | src/mess/includes/spectrum.h | 3 | ||||
| -rw-r--r-- | src/mess/includes/vtech2.h | 1 | ||||
| -rw-r--r-- | src/mess/machine/compis.c | 123 | ||||
| -rw-r--r-- | src/mess/machine/mac.c | 2 | ||||
| -rw-r--r-- | src/mess/machine/ncr5380.c | 3 | ||||
| -rw-r--r-- | src/mess/machine/ncr5380.h | 3 | ||||
| -rw-r--r-- | src/mess/machine/vtech2.c | 15 | ||||
| -rw-r--r-- | src/mess/video/timex.c | 38 |
15 files changed, 255 insertions, 243 deletions
diff --git a/src/mess/drivers/gp32.c b/src/mess/drivers/gp32.c index 07e4813d386..4303ef3a0a6 100644 --- a/src/mess/drivers/gp32.c +++ b/src/mess/drivers/gp32.c @@ -53,7 +53,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, #define BPPMODE_TFT_08 0x0B #define BPPMODE_TFT_16 0x0C -static rgb_t s3c240x_get_color_5551( UINT16 data) +inline rgb_t gp32_state::s3c240x_get_color_5551( UINT16 data) { UINT8 r, g, b, i; r = BITS( data, 15, 11) << 3; @@ -83,27 +83,26 @@ void gp32_state::s3c240x_lcd_dma_init() m_s3c240x_lcd.hozval = BITS( m_s3c240x_lcd_regs[2], 18, 8); } -static UINT32 s3c240x_lcd_dma_read( running_machine &machine) +UINT32 gp32_state::s3c240x_lcd_dma_read( ) { - gp32_state *state = machine.driver_data<gp32_state>(); UINT8 *vram, data[4]; int i; for (i = 0; i < 2; i++) { - vram = (UINT8 *)state->m_s3c240x_ram.target() + state->m_s3c240x_lcd.vramaddr_cur - 0x0C000000; + vram = (UINT8 *)m_s3c240x_ram.target() + m_s3c240x_lcd.vramaddr_cur - 0x0C000000; data[i*2+0] = vram[0]; data[i*2+1] = vram[1]; - state->m_s3c240x_lcd.vramaddr_cur += 2; - state->m_s3c240x_lcd.pagewidth_cur++; - if (state->m_s3c240x_lcd.pagewidth_cur >= state->m_s3c240x_lcd.pagewidth_max) + m_s3c240x_lcd.vramaddr_cur += 2; + m_s3c240x_lcd.pagewidth_cur++; + if (m_s3c240x_lcd.pagewidth_cur >= m_s3c240x_lcd.pagewidth_max) { - state->m_s3c240x_lcd.vramaddr_cur += state->m_s3c240x_lcd.offsize << 1; - state->m_s3c240x_lcd.pagewidth_cur = 0; + m_s3c240x_lcd.vramaddr_cur += m_s3c240x_lcd.offsize << 1; + m_s3c240x_lcd.pagewidth_cur = 0; } } - if (state->m_s3c240x_lcd.hwswp == 0) + if (m_s3c240x_lcd.hwswp == 0) { - if (state->m_s3c240x_lcd.bswp == 0) + if (m_s3c240x_lcd.bswp == 0) { return (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | (data[0] << 0); } @@ -114,7 +113,7 @@ static UINT32 s3c240x_lcd_dma_read( running_machine &machine) } else { - if (state->m_s3c240x_lcd.bswp == 0) + if (m_s3c240x_lcd.bswp == 0) { return (data[1] << 24) | (data[0] << 16) | (data[3] << 8) | (data[2] << 0); } @@ -125,121 +124,116 @@ static UINT32 s3c240x_lcd_dma_read( running_machine &machine) } } -static void s3c240x_lcd_render_01( running_machine &machine) +void gp32_state::s3c240x_lcd_render_01( ) { - gp32_state *state = machine.driver_data<gp32_state>(); - bitmap_rgb32 &bitmap = state->m_bitmap; - UINT32 *scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); int i, j; for (i = 0; i < 4; i++) { - UINT32 data = s3c240x_lcd_dma_read( machine); + UINT32 data = s3c240x_lcd_dma_read(); for (j = 0; j < 32; j++) { - *scanline++ = palette_get_color( machine, (data >> 31) & 0x01); + *scanline++ = palette_get_color( machine(), (data >> 31) & 0x01); data = data << 1; - state->m_s3c240x_lcd.hpos++; - if (state->m_s3c240x_lcd.hpos >= (state->m_s3c240x_lcd.pagewidth_max << 4)) + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 4)) { - state->m_s3c240x_lcd.vpos = (state->m_s3c240x_lcd.vpos + 1) % (state->m_s3c240x_lcd.lineval + 1); - state->m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } } -static void s3c240x_lcd_render_02( running_machine &machine) +void gp32_state::s3c240x_lcd_render_02( ) { - gp32_state *state = machine.driver_data<gp32_state>(); - bitmap_rgb32 &bitmap = state->m_bitmap; - UINT32 *scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); int i, j; for (i = 0; i < 4; i++) { - UINT32 data = s3c240x_lcd_dma_read( machine); + UINT32 data = s3c240x_lcd_dma_read(); for (j = 0; j < 16; j++) { - *scanline++ = palette_get_color( machine, (data >> 30) & 0x03); + *scanline++ = palette_get_color( machine(), (data >> 30) & 0x03); data = data << 2; - state->m_s3c240x_lcd.hpos++; - if (state->m_s3c240x_lcd.hpos >= (state->m_s3c240x_lcd.pagewidth_max << 3)) + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 3)) { - state->m_s3c240x_lcd.vpos = (state->m_s3c240x_lcd.vpos + 1) % (state->m_s3c240x_lcd.lineval + 1); - state->m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } } -static void s3c240x_lcd_render_04( running_machine &machine) +void gp32_state::s3c240x_lcd_render_04( ) { - gp32_state *state = machine.driver_data<gp32_state>(); - bitmap_rgb32 &bitmap = state->m_bitmap; - UINT32 *scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); int i, j; for (i = 0; i < 4; i++) { - UINT32 data = s3c240x_lcd_dma_read( machine); + UINT32 data = s3c240x_lcd_dma_read( ); for (j = 0; j < 8; j++) { - *scanline++ = palette_get_color( machine, (data >> 28) & 0x0F); + *scanline++ = palette_get_color( machine(), (data >> 28) & 0x0F); data = data << 4; - state->m_s3c240x_lcd.hpos++; - if (state->m_s3c240x_lcd.hpos >= (state->m_s3c240x_lcd.pagewidth_max << 2)) + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 2)) { - state->m_s3c240x_lcd.vpos = (state->m_s3c240x_lcd.vpos + 1) % (state->m_s3c240x_lcd.lineval + 1); - state->m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } } -static void s3c240x_lcd_render_08( running_machine &machine) +void gp32_state::s3c240x_lcd_render_08( ) { - gp32_state *state = machine.driver_data<gp32_state>(); - bitmap_rgb32 &bitmap = state->m_bitmap; - UINT32 *scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); int i, j; for (i = 0; i < 4; i++) { - UINT32 data = s3c240x_lcd_dma_read( machine); + UINT32 data = s3c240x_lcd_dma_read(); for (j = 0; j < 4; j++) { - *scanline++ = palette_get_color( machine, (data >> 24) & 0xFF); + *scanline++ = palette_get_color( machine(), (data >> 24) & 0xFF); data = data << 8; - state->m_s3c240x_lcd.hpos++; - if (state->m_s3c240x_lcd.hpos >= (state->m_s3c240x_lcd.pagewidth_max << 1)) + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 1)) { - state->m_s3c240x_lcd.vpos = (state->m_s3c240x_lcd.vpos + 1) % (state->m_s3c240x_lcd.lineval + 1); - state->m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } } -static void s3c240x_lcd_render_16( running_machine &machine) +void gp32_state::s3c240x_lcd_render_16( ) { - gp32_state *state = machine.driver_data<gp32_state>(); - bitmap_rgb32 &bitmap = state->m_bitmap; - UINT32 *scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + bitmap_rgb32 &bitmap = m_bitmap; + UINT32 *scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); int i, j; for (i = 0; i < 4; i++) { - UINT32 data = s3c240x_lcd_dma_read( machine); + UINT32 data = s3c240x_lcd_dma_read(); for (j = 0; j < 2; j++) { *scanline++ = s3c240x_get_color_5551( (data >> 16) & 0xFFFF); data = data << 16; - state->m_s3c240x_lcd.hpos++; - if (state->m_s3c240x_lcd.hpos >= (state->m_s3c240x_lcd.pagewidth_max << 0)) + m_s3c240x_lcd.hpos++; + if (m_s3c240x_lcd.hpos >= (m_s3c240x_lcd.pagewidth_max << 0)) { - state->m_s3c240x_lcd.vpos = (state->m_s3c240x_lcd.vpos + 1) % (state->m_s3c240x_lcd.lineval + 1); - state->m_s3c240x_lcd.hpos = 0; - scanline = &bitmap.pix32(state->m_s3c240x_lcd.vpos, state->m_s3c240x_lcd.hpos); + m_s3c240x_lcd.vpos = (m_s3c240x_lcd.vpos + 1) % (m_s3c240x_lcd.lineval + 1); + m_s3c240x_lcd.hpos = 0; + scanline = &bitmap.pix32(m_s3c240x_lcd.vpos, m_s3c240x_lcd.hpos); } } } @@ -261,11 +255,11 @@ TIMER_CALLBACK_MEMBER(gp32_state::s3c240x_lcd_timer_exp) { switch (m_s3c240x_lcd.bppmode) { - case BPPMODE_TFT_01 : s3c240x_lcd_render_01( machine()); break; - case BPPMODE_TFT_02 : s3c240x_lcd_render_02( machine()); break; - case BPPMODE_TFT_04 : s3c240x_lcd_render_04( machine()); break; - case BPPMODE_TFT_08 : s3c240x_lcd_render_08( machine()); break; - case BPPMODE_TFT_16 : s3c240x_lcd_render_16( machine()); break; + case BPPMODE_TFT_01 : s3c240x_lcd_render_01(); break; + case BPPMODE_TFT_02 : s3c240x_lcd_render_02(); break; + case BPPMODE_TFT_04 : s3c240x_lcd_render_04(); break; + case BPPMODE_TFT_08 : s3c240x_lcd_render_08(); break; + case BPPMODE_TFT_16 : s3c240x_lcd_render_16(); break; default : verboselog( machine(), 0, "s3c240x_lcd_timer_exp: bppmode %d not supported\n", m_s3c240x_lcd.bppmode); break; } if ((m_s3c240x_lcd.vpos == 0) && (m_s3c240x_lcd.hpos == 0)) break; @@ -1256,7 +1250,7 @@ void gp32_state::eeprom_write(UINT16 address, UINT8 data) // IIC #if 0 -static UINT8 i2cmem_read_byte( running_machine &machine, int last) +UINT8 gp32_state::i2cmem_read_byte( int last) { UINT8 data = 0; int i; @@ -1275,7 +1269,7 @@ static UINT8 i2cmem_read_byte( running_machine &machine, int last) #endif #if 0 -static void i2cmem_write_byte( running_machine &machine, UINT8 data) +void gp32_state::i2cmem_write_byte( UINT8 data) { int i; for (i = 0; i < 8; i++) @@ -1292,7 +1286,7 @@ static void i2cmem_write_byte( running_machine &machine, UINT8 data) #endif #if 0 -static void i2cmem_start( running_machine &machine) +void gp32_state::i2cmem_start( ) { i2cmem_write( machine, 0, I2CMEM_SDA, 1); i2cmem_write( machine, 0, I2CMEM_SCL, 1); @@ -1302,7 +1296,7 @@ static void i2cmem_start( running_machine &machine) #endif #if 0 -static void i2cmem_stop( running_machine &machine) +void gp32_state::i2cmem_stop( ) { i2cmem_write( machine, 0, I2CMEM_SDA, 0); i2cmem_write( machine, 0, I2CMEM_SCL, 1); diff --git a/src/mess/drivers/ip20.c b/src/mess/drivers/ip20.c index d5f1f48cb80..c7d8680d19e 100644 --- a/src/mess/drivers/ip20.c +++ b/src/mess/drivers/ip20.c @@ -60,6 +60,7 @@ public: DECLARE_WRITE32_MEMBER(hpc_w); DECLARE_READ32_MEMBER(int_r); DECLARE_WRITE32_MEMBER(int_w); + DECLARE_WRITE_LINE_MEMBER(scsi_irq); DECLARE_DRIVER_INIT(ip204415); virtual void machine_start(); virtual void video_start(); @@ -479,13 +480,13 @@ static ADDRESS_MAP_START( ip204415_map, AS_PROGRAM, 32, ip20_state ) AM_RANGE( 0xbfc00000, 0xbfc7ffff ) AM_ROM AM_SHARE("share2") /* BIOS Mirror */ ADDRESS_MAP_END -static void scsi_irq(running_machine &machine, int state) +WRITE_LINE_MEMBER(ip20_state::scsi_irq) { } static const struct WD33C93interface wd33c93_intf = { - &scsi_irq, /* command completion IRQ */ + DEVCB_DRIVER_LINE_MEMBER(ip20_state,scsi_irq) /* command completion IRQ */ }; DRIVER_INIT_MEMBER(ip20_state,ip204415) diff --git a/src/mess/drivers/ip22.c b/src/mess/drivers/ip22.c index 3a81f25065e..db5ed27bc11 100644 --- a/src/mess/drivers/ip22.c +++ b/src/mess/drivers/ip22.c @@ -129,6 +129,7 @@ public: DECLARE_WRITE32_MEMBER(hpc3_pbusdma_w); DECLARE_READ32_MEMBER(hpc3_unkpbus0_r); DECLARE_WRITE32_MEMBER(hpc3_unkpbus0_w); + DECLARE_WRITE_LINE_MEMBER(scsi_irq); DECLARE_DRIVER_INIT(ip225015); virtual void machine_start(); virtual void machine_reset(); @@ -1229,60 +1230,59 @@ void ip22_state::dump_chain(address_space &space, UINT32 ch_base) #define HPC3_DMACTRL_ENABLE (0x10) -static void scsi_irq(running_machine &machine, int state) +WRITE_LINE_MEMBER(ip22_state::scsi_irq) { - ip22_state *drvstate = machine.driver_data<ip22_state>(); - address_space &space = drvstate->m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); if (state) { - if (drvstate->m_wd33c93->get_dma_count()) + if (m_wd33c93->get_dma_count()) { - printf("drvstate->m_wd33c93->get_dma_count() is %d\n", drvstate->m_wd33c93->get_dma_count() ); - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) + printf("m_wd33c93->get_dma_count() is %d\n", m_wd33c93->get_dma_count() ); + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) { - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_IRQ) logerror("IP22: Unhandled SCSI DMA IRQ\n"); + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_IRQ) logerror("IP22: Unhandled SCSI DMA IRQ\n"); } // HPC3 DMA: host to device - if ((drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) + if ((m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) { UINT32 wptr, tmpword; int words, dptr, twords; - words = drvstate->m_wd33c93->get_dma_count(); + words = m_wd33c93->get_dma_count(); words /= 4; - wptr = space.read_dword(drvstate->m_HPC3.nSCSI0Descriptor); - drvstate->m_HPC3.nSCSI0Descriptor += words*4; + wptr = space.read_dword(m_HPC3.nSCSI0Descriptor); + m_HPC3.nSCSI0Descriptor += words*4; dptr = 0; printf("DMA to device: %d words @ %x\n", words, wptr); - drvstate->dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor); + dump_chain(space, m_HPC3.nSCSI0Descriptor); if (words <= (512/4)) { // one-shot - //drvstate->m_wd33c93->get_dma_data(drvstate->m_wd33c93->get_dma_count(), drvstate->m_dma_buffer); + //m_wd33c93->get_dma_data(m_wd33c93->get_dma_count(), m_dma_buffer); while (words) { tmpword = space.read_dword(wptr); - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) { - drvstate->m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; - drvstate->m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; - drvstate->m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; - drvstate->m_dma_buffer[dptr] = tmpword&0xff; + m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; + m_dma_buffer[dptr] = tmpword&0xff; } else { - drvstate->m_dma_buffer[dptr] = (tmpword>>24)&0xff; - drvstate->m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; - drvstate->m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; - drvstate->m_dma_buffer[dptr+3] = tmpword&0xff; + m_dma_buffer[dptr] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; + m_dma_buffer[dptr+3] = tmpword&0xff; } wptr += 4; @@ -1290,35 +1290,35 @@ static void scsi_irq(running_machine &machine, int state) words--; } - words = drvstate->m_wd33c93->get_dma_count(); - drvstate->m_wd33c93->write_data(words, drvstate->m_dma_buffer); + words = m_wd33c93->get_dma_count(); + m_wd33c93->write_data(words, m_dma_buffer); } else { while (words) { - //drvstate->m_wd33c93->get_dma_data(512, drvstate->m_dma_buffer); + //m_wd33c93->get_dma_data(512, m_dma_buffer); twords = 512/4; - drvstate->m_HPC3.nSCSI0Descriptor += 512; + m_HPC3.nSCSI0Descriptor += 512; dptr = 0; while (twords) { tmpword = space.read_dword(wptr); - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) { - drvstate->m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; - drvstate->m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; - drvstate->m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; - drvstate->m_dma_buffer[dptr] = tmpword&0xff; + m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; + m_dma_buffer[dptr] = tmpword&0xff; } else { - drvstate->m_dma_buffer[dptr] = (tmpword>>24)&0xff; - drvstate->m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; - drvstate->m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; - drvstate->m_dma_buffer[dptr+3] = tmpword&0xff; + m_dma_buffer[dptr] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; + m_dma_buffer[dptr+3] = tmpword&0xff; } wptr += 4; @@ -1326,23 +1326,23 @@ static void scsi_irq(running_machine &machine, int state) twords--; } - drvstate->m_wd33c93->write_data(512, drvstate->m_dma_buffer); + m_wd33c93->write_data(512, m_dma_buffer); words -= (512/4); } } // clear DMA on the controller too - drvstate->m_wd33c93->clear_dma(); + m_wd33c93->clear_dma(); #if 0 UINT32 dptr, tmpword; - UINT32 bc = space.read_dword(drvstate->m_HPC3.nSCSI0Descriptor + 4); - UINT32 rptr = space.read_dword(drvstate->m_HPC3.nSCSI0Descriptor); + UINT32 bc = space.read_dword(m_HPC3.nSCSI0Descriptor + 4); + UINT32 rptr = space.read_dword(m_HPC3.nSCSI0Descriptor); int length = bc & 0x3fff; int xie = (bc & 0x20000000) ? 1 : 0; int eox = (bc & 0x80000000) ? 1 : 0; - dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor); + dump_chain(space, m_HPC3.nSCSI0Descriptor); printf("PC is %08x\n", machine.device("maincpu")->safe_pc()); printf("DMA to device: length %x xie %d eox %d\n", length, xie, eox); @@ -1353,19 +1353,19 @@ static void scsi_irq(running_machine &machine, int state) while (length > 0) { tmpword = space.read_dword(rptr); - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) { - drvstate->m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; - drvstate->m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; - drvstate->m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; - drvstate->m_dma_buffer[dptr] = tmpword&0xff; + m_dma_buffer[dptr+3] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>8)&0xff; + m_dma_buffer[dptr] = tmpword&0xff; } else { - drvstate->m_dma_buffer[dptr] = (tmpword>>24)&0xff; - drvstate->m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; - drvstate->m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; - drvstate->m_dma_buffer[dptr+3] = tmpword&0xff; + m_dma_buffer[dptr] = (tmpword>>24)&0xff; + m_dma_buffer[dptr+1] = (tmpword>>16)&0xff; + m_dma_buffer[dptr+2] = (tmpword>>8)&0xff; + m_dma_buffer[dptr+3] = tmpword&0xff; } dptr += 4; @@ -1373,11 +1373,11 @@ static void scsi_irq(running_machine &machine, int state) length -= 4; } - length = space.read_dword(drvstate->m_HPC3.nSCSI0Descriptor+4) & 0x3fff; - drvstate->m_wd33c93->write_data(length, drvstate->m_dma_buffer); + length = space.read_dword(m_HPC3.nSCSI0Descriptor+4) & 0x3fff; + m_wd33c93->write_data(length, m_dma_buffer); // clear DMA on the controller too - drvstate->m_wd33c93->clear_dma(); + m_wd33c93->clear_dma(); } else { @@ -1387,35 +1387,35 @@ static void scsi_irq(running_machine &machine, int state) } // HPC3 DMA: device to host - if ((drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && !(drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) + if ((m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENABLE) && !(m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_DIR)) { UINT32 wptr, tmpword; int words, sptr, twords; - words = drvstate->m_wd33c93->get_dma_count(); + words = m_wd33c93->get_dma_count(); words /= 4; - wptr = space.read_dword(drvstate->m_HPC3.nSCSI0Descriptor); + wptr = space.read_dword(m_HPC3.nSCSI0Descriptor); sptr = 0; // mame_printf_info("DMA from device: %d words @ %x\n", words, wptr); - drvstate->dump_chain(space, drvstate->m_HPC3.nSCSI0Descriptor); + dump_chain(space, m_HPC3.nSCSI0Descriptor); if (words <= (1024/4)) { // one-shot - drvstate->m_wd33c93->get_dma_data(drvstate->m_wd33c93->get_dma_count(), drvstate->m_dma_buffer); + m_wd33c93->get_dma_data(m_wd33c93->get_dma_count(), m_dma_buffer); while (words) { - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) { - tmpword = drvstate->m_dma_buffer[sptr+3]<<24 | drvstate->m_dma_buffer[sptr+2]<<16 | drvstate->m_dma_buffer[sptr+1]<<8 | drvstate->m_dma_buffer[sptr]; + tmpword = m_dma_buffer[sptr+3]<<24 | m_dma_buffer[sptr+2]<<16 | m_dma_buffer[sptr+1]<<8 | m_dma_buffer[sptr]; } else { - tmpword = drvstate->m_dma_buffer[sptr]<<24 | drvstate->m_dma_buffer[sptr+1]<<16 | drvstate->m_dma_buffer[sptr+2]<<8 | drvstate->m_dma_buffer[sptr+3]; + tmpword = m_dma_buffer[sptr]<<24 | m_dma_buffer[sptr+1]<<16 | m_dma_buffer[sptr+2]<<8 | m_dma_buffer[sptr+3]; } space.write_dword(wptr, tmpword); @@ -1428,19 +1428,19 @@ static void scsi_irq(running_machine &machine, int state) { while (words) { - drvstate->m_wd33c93->get_dma_data(512, drvstate->m_dma_buffer); + m_wd33c93->get_dma_data(512, m_dma_buffer); twords = 512/4; sptr = 0; while (twords) { - if (drvstate->m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) + if (m_HPC3.nSCSI0DMACtrl & HPC3_DMACTRL_ENDIAN) { - tmpword = drvstate->m_dma_buffer[sptr+3]<<24 | drvstate->m_dma_buffer[sptr+2]<<16 | drvstate->m_dma_buffer[sptr+1]<<8 | drvstate->m_dma_buffer[sptr]; + tmpword = m_dma_buffer[sptr+3]<<24 | m_dma_buffer[sptr+2]<<16 | m_dma_buffer[sptr+1]<<8 | m_dma_buffer[sptr]; } else { - tmpword = drvstate->m_dma_buffer[sptr]<<24 | drvstate->m_dma_buffer[sptr+1]<<16 | drvstate->m_dma_buffer[sptr+2]<<8 | drvstate->m_dma_buffer[sptr+3]; + tmpword = m_dma_buffer[sptr]<<24 | m_dma_buffer[sptr+1]<<16 | m_dma_buffer[sptr+2]<<8 | m_dma_buffer[sptr+3]; } space.write_dword(wptr, tmpword); @@ -1454,25 +1454,25 @@ static void scsi_irq(running_machine &machine, int state) } // clear DMA on the controller too - drvstate->m_wd33c93->clear_dma(); + m_wd33c93->clear_dma(); } } // clear HPC3 DMA active flag - drvstate->m_HPC3.nSCSI0DMACtrl &= ~HPC3_DMACTRL_ENABLE; + m_HPC3.nSCSI0DMACtrl &= ~HPC3_DMACTRL_ENABLE; // set the interrupt - drvstate->int3_raise_local0_irq(INT3_LOCAL0_SCSI0); + int3_raise_local0_irq(INT3_LOCAL0_SCSI0); } else { - drvstate->int3_lower_local0_irq(INT3_LOCAL0_SCSI0); + int3_lower_local0_irq(INT3_LOCAL0_SCSI0); } } static const struct WD33C93interface wd33c93_intf = { - &scsi_irq, /* command completion IRQ */ + DEVCB_DRIVER_LINE_MEMBER(ip22_state,scsi_irq) /* command completion IRQ */ }; static int ip22_get_out2(running_machine &machine) diff --git a/src/mess/drivers/mac.c b/src/mess/drivers/mac.c index 1c8af822b25..9bf05d58c52 100644 --- a/src/mess/drivers/mac.c +++ b/src/mess/drivers/mac.c @@ -828,7 +828,7 @@ static const applefdc_interface mac_iwm_interface = static const struct NCR5380interface macplus_5380intf = { - mac_scsi_irq // IRQ (unconnected on the Mac Plus) + DEVCB_DRIVER_LINE_MEMBER(mac_state,mac_scsi_irq) // IRQ (unconnected on the Mac Plus) }; static const struct NCR539Xinterface mac_539x_intf = diff --git a/src/mess/includes/compis.h b/src/mess/includes/compis.h index 2ae2e7cea0a..fcb9b4c2b75 100644 --- a/src/mess/includes/compis.h +++ b/src/mess/includes/compis.h @@ -189,6 +189,12 @@ public: TIMER_CALLBACK_MEMBER(dma_timer_callback); IRQ_CALLBACK_MEMBER(int_callback); IRQ_CALLBACK_MEMBER(compis_irq_callback); + void compis_irq_set(UINT8 irq); + void compis_keyb_update(); + void compis_keyb_init(); + void compis_fdc_reset(); + void update_interrupt_state(); + void compis_cpu_init(); }; diff --git a/src/mess/includes/gp32.h b/src/mess/includes/gp32.h index 46c7dc240db..f84e685da49 100644 --- a/src/mess/includes/gp32.h +++ b/src/mess/includes/gp32.h @@ -181,7 +181,6 @@ public: TIMER_CALLBACK_MEMBER(s3c240x_dma_timer_exp); TIMER_CALLBACK_MEMBER(s3c240x_iic_timer_exp); TIMER_CALLBACK_MEMBER(s3c240x_iis_timer_exp); - protected: required_device<cpu_device> m_maincpu; required_device<smartmedia_image_device> m_smartmedia; @@ -230,6 +229,17 @@ protected: void iic_resume(); void s3c240x_machine_start(); void s3c240x_machine_reset(); + inline rgb_t s3c240x_get_color_5551( UINT16 data); + UINT32 s3c240x_lcd_dma_read( ); + void s3c240x_lcd_render_01( ); + void s3c240x_lcd_render_02( ); + void s3c240x_lcd_render_04( ); + void s3c240x_lcd_render_08( ); + void s3c240x_lcd_render_16( ); + UINT8 i2cmem_read_byte( int last); + void i2cmem_write_byte( UINT8 data); + void i2cmem_start( ); + void i2cmem_stop( ); }; diff --git a/src/mess/includes/mac.h b/src/mess/includes/mac.h index b2d4f4a5f9b..33a1d726f53 100644 --- a/src/mess/includes/mac.h +++ b/src/mess/includes/mac.h @@ -141,7 +141,6 @@ extern const via6522_interface mac_via6522_intf; extern const via6522_interface mac_via6522_2_intf; extern const via6522_interface mac_via6522_adb_intf; -void mac_scsi_irq(running_machine &machine, int state); void mac_asc_irq(device_t *device, int state); void mac_fdc_set_enable_lines(device_t *device, int enable_mask); @@ -399,6 +398,8 @@ public: DECLARE_WRITE_LINE_MEMBER(cuda_reset_w); DECLARE_WRITE_LINE_MEMBER(adb_linechange_w); + + DECLARE_WRITE_LINE_MEMBER(mac_scsi_irq); DECLARE_DIRECT_UPDATE_MEMBER(overlay_opbaseoverride); private: diff --git a/src/mess/includes/spectrum.h b/src/mess/includes/spectrum.h index 53fc40903bb..856a1b59c06 100644 --- a/src/mess/includes/spectrum.h +++ b/src/mess/includes/spectrum.h @@ -214,6 +214,9 @@ protected: 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); + void ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines); + void ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor); + void ts2068_lores_scanline(bitmap_ind16 &bitmap, int y, int borderlines, int screen); }; diff --git a/src/mess/includes/vtech2.h b/src/mess/includes/vtech2.h index 2262b6c64c1..948af1f2d2d 100644 --- a/src/mess/includes/vtech2.h +++ b/src/mess/includes/vtech2.h @@ -80,6 +80,7 @@ public: void laser_machine_init(int bank_mask, int video_mask); void laser_get_track(); void laser_put_track(); + device_t *laser_file(); }; diff --git a/src/mess/machine/compis.c b/src/mess/machine/compis.c index a06d50e440c..088fe8e7926 100644 --- a/src/mess/machine/compis.c +++ b/src/mess/machine/compis.c @@ -80,7 +80,7 @@ enum COMPIS_INTERRUPT_REQUESTS /* Desc: IRQ - Issue an interrupt request */ /*-------------------------------------------------------------------------*/ #ifdef UNUSED_FUNCTION -void compis_irq_set(UINT8 irq) +void compis_state::compis_irq_set(UINT8 irq) { m_maincpu->set_input_line_and_vector(0, HOLD_LINE, irq); } @@ -90,9 +90,8 @@ void compis_irq_set(UINT8 irq) /*-------------------------------------------------------------------------*/ /* Keyboard */ /*-------------------------------------------------------------------------*/ -static void compis_keyb_update(running_machine &machine) +void compis_state::compis_keyb_update() { - compis_state *state = machine.driver_data<compis_state>(); UINT8 key_code; UINT8 key_status; UINT8 irow; @@ -106,7 +105,7 @@ static void compis_keyb_update(running_machine &machine) for (irow = 0; irow < 6; irow++) { - data = machine.root_device().ioport(rownames[irow])->read(); + data = machine().root_device().ioport(rownames[irow])->read(); if (data != 0) { ibit = 1; @@ -138,28 +137,28 @@ static void compis_keyb_update(running_machine &machine) } if (key_code != 0) { - state->m_compis.keyboard.key_code = key_code; - state->m_compis.keyboard.key_status = key_status; - state->m_compis.usart.status |= COMPIS_USART_STATUS_RX_READY; - state->m_compis.usart.bytes_sent = 0; + m_compis.keyboard.key_code = key_code; + m_compis.keyboard.key_status = key_status; + m_compis.usart.status |= COMPIS_USART_STATUS_RX_READY; + m_compis.usart.bytes_sent = 0; // compis_osp_pic_irq(COMPIS_IRQ_8251_RXRDY); } } -static void compis_keyb_init(compis_state *state) +void compis_state::compis_keyb_init() { - state->m_compis.keyboard.key_code = 0; - state->m_compis.keyboard.key_status = 0x80; - state->m_compis.usart.status = 0; - state->m_compis.usart.bytes_sent = 0; + m_compis.keyboard.key_code = 0; + m_compis.keyboard.key_status = 0x80; + m_compis.usart.status = 0; + m_compis.usart.bytes_sent = 0; } /*-------------------------------------------------------------------------*/ /* FDC iSBX-218A */ /*-------------------------------------------------------------------------*/ -static void compis_fdc_reset(running_machine &machine) +void compis_state::compis_fdc_reset() { - machine.device("i8272a")->reset(); + machine().device("i8272a")->reset(); } void compis_state::compis_fdc_tc(int state) @@ -235,7 +234,7 @@ WRITE8_MEMBER( compis_state::compis_ppi_port_c_w ) /* FDC Reset */ if (BIT(data, 6)) - compis_fdc_reset(machine()); + compis_fdc_reset(); /* FDC Terminal count */ compis_fdc_tc(BIT(data, 7)); @@ -380,76 +379,75 @@ IRQ_CALLBACK_MEMBER(compis_state::int_callback) } -static void update_interrupt_state(running_machine &machine) +void compis_state::update_interrupt_state() { - compis_state *state = machine.driver_data<compis_state>(); int i, j, new_vector = 0; - if (LOG_INTERRUPTS) logerror("update_interrupt_status: req=%02X stat=%02X serv=%02X\n", state->m_i186.intr.request, state->m_i186.intr.status, state->m_i186.intr.in_service); + if (LOG_INTERRUPTS) logerror("update_interrupt_status: req=%02X stat=%02X serv=%02X\n", m_i186.intr.request, m_i186.intr.status, m_i186.intr.in_service); /* loop over priorities */ - for (i = 0; i <= state->m_i186.intr.priority_mask; i++) + for (i = 0; i <= m_i186.intr.priority_mask; i++) { /* note: by checking 4 bits, we also verify that the mask is off */ - if ((state->m_i186.intr.timer & 15) == i) + if ((m_i186.intr.timer & 15) == i) { /* if we're already servicing something at this level, don't generate anything new */ - if (state->m_i186.intr.in_service & 0x01) + if (m_i186.intr.in_service & 0x01) return; /* if there's something pending, generate an interrupt */ - if (state->m_i186.intr.status & 0x07) + if (m_i186.intr.status & 0x07) { - if (state->m_i186.intr.status & 1) + if (m_i186.intr.status & 1) new_vector = 0x08; - else if (state->m_i186.intr.status & 2) + else if (m_i186.intr.status & 2) new_vector = 0x12; - else if (state->m_i186.intr.status & 4) + else if (m_i186.intr.status & 4) new_vector = 0x13; else popmessage("Invalid timer interrupt!"); /* set the clear mask and generate the int */ - state->m_i186.intr.ack_mask = 0x0001; + m_i186.intr.ack_mask = 0x0001; goto generate_int; } } /* check DMA interrupts */ for (j = 0; j < 2; j++) - if ((state->m_i186.intr.dma[j] & 15) == i) + if ((m_i186.intr.dma[j] & 15) == i) { /* if we're already servicing something at this level, don't generate anything new */ - if (state->m_i186.intr.in_service & (0x04 << j)) + if (m_i186.intr.in_service & (0x04 << j)) return; /* if there's something pending, generate an interrupt */ - if (state->m_i186.intr.request & (0x04 << j)) + if (m_i186.intr.request & (0x04 << j)) { new_vector = 0x0a + j; /* set the clear mask and generate the int */ - state->m_i186.intr.ack_mask = 0x0004 << j; + m_i186.intr.ack_mask = 0x0004 << j; goto generate_int; } } /* check external interrupts */ for (j = 0; j < 4; j++) - if ((state->m_i186.intr.ext[j] & 15) == i) + if ((m_i186.intr.ext[j] & 15) == i) { /* if we're already servicing something at this level, don't generate anything new */ - if (state->m_i186.intr.in_service & (0x10 << j)) + if (m_i186.intr.in_service & (0x10 << j)) return; /* if there's something pending, generate an interrupt */ - if (state->m_i186.intr.request & (0x10 << j)) + if (m_i186.intr.request & (0x10 << j)) { /* otherwise, generate an interrupt for this request */ new_vector = 0x0c + j; /* set the clear mask and generate the int */ - state->m_i186.intr.ack_mask = 0x0010 << j; + m_i186.intr.ack_mask = 0x0010 << j; goto generate_int; } } @@ -458,13 +456,13 @@ static void update_interrupt_state(running_machine &machine) generate_int: /* generate the appropriate interrupt */ - state->m_i186.intr.poll_status = 0x8000 | new_vector; - if (!state->m_i186.intr.pending) - state->m_maincpu->set_input_line(0, ASSERT_LINE); - state->m_i186.intr.pending = 1; - machine.scheduler().trigger(CPU_RESUME_TRIGGER); + m_i186.intr.poll_status = 0x8000 | new_vector; + if (!m_i186.intr.pending) + m_maincpu->set_input_line(0, ASSERT_LINE); + m_i186.intr.pending = 1; + machine().scheduler().trigger(CPU_RESUME_TRIGGER); if (LOG_OPTIMIZATION) logerror(" - trigger due to interrupt pending\n"); - if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine.time().as_double(), new_vector); + if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", machine().time().as_double(), new_vector); } @@ -548,7 +546,7 @@ TIMER_CALLBACK_MEMBER(compis_state::internal_timer_int) if (t->control & 0x2000) { m_i186.intr.status |= 0x01 << which; - update_interrupt_state(machine()); + update_interrupt_state(); if (LOG_TIMER) logerror(" Generating timer interrupt\n"); } @@ -736,7 +734,7 @@ TIMER_CALLBACK_MEMBER(compis_state::dma_timer_callback) { if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source); m_i186.intr.request |= 0x04 << which; - update_interrupt_state(machine()); + update_interrupt_state(); } } @@ -998,7 +996,7 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) case 0x11: if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", m_maincpu->pc(), data16); handle_eoi(0x8000); - update_interrupt_state(machine()); + update_interrupt_state(); break; case 0x12: @@ -1018,31 +1016,31 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) m_i186.intr.ext[1] = (m_i186.intr.ext[1] & ~0x08) | ((data16 >> 2) & 0x08); m_i186.intr.ext[2] = (m_i186.intr.ext[2] & ~0x08) | ((data16 >> 3) & 0x08); m_i186.intr.ext[3] = (m_i186.intr.ext[3] & ~0x08) | ((data16 >> 4) & 0x08); - update_interrupt_state(machine()); + update_interrupt_state(); break; case 0x15: if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", m_maincpu->pc(), data16); m_i186.intr.priority_mask = data16 & 0x0007; - update_interrupt_state(machine()); + update_interrupt_state(); break; case 0x16: if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", m_maincpu->pc(), data16); m_i186.intr.in_service = data16 & 0x00ff; - update_interrupt_state(machine()); + update_interrupt_state(); break; case 0x17: if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", m_maincpu->pc(), data16); m_i186.intr.request = (m_i186.intr.request & ~0x00c0) | (data16 & 0x00c0); - update_interrupt_state(machine()); + update_interrupt_state(); break; case 0x18: if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", m_maincpu->pc(), data16); m_i186.intr.status = (m_i186.intr.status & ~0x8007) | (data16 & 0x8007); - update_interrupt_state(machine()); + update_interrupt_state(); break; case 0x19: @@ -1233,18 +1231,17 @@ WRITE16_MEMBER( compis_state::compis_i186_internal_port_w ) /* Name: compis */ /* Desc: CPU - Initialize the 80186 CPU */ /*-------------------------------------------------------------------------*/ -static void compis_cpu_init(running_machine &machine) +void compis_state::compis_cpu_init() { - compis_state *state = machine.driver_data<compis_state>(); /* create timers here so they stick around */ - state->m_i186.timer[0].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),state)); - state->m_i186.timer[1].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),state)); - state->m_i186.timer[2].int_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),state)); - state->m_i186.timer[0].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.timer[1].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.timer[2].time_timer = machine.scheduler().timer_alloc(FUNC_NULL); - state->m_i186.dma[0].finish_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::dma_timer_callback),state)); - state->m_i186.dma[1].finish_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::dma_timer_callback),state)); + m_i186.timer[0].int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),this)); + m_i186.timer[1].int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),this)); + m_i186.timer[2].int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::internal_timer_int),this)); + m_i186.timer[0].time_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_i186.timer[1].time_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_i186.timer[2].time_timer = machine().scheduler().timer_alloc(FUNC_NULL); + m_i186.dma[0].finish_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::dma_timer_callback),this)); + m_i186.dma[1].finish_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(compis_state::dma_timer_callback),this)); } /*-------------------------------------------------------------------------*/ @@ -1307,7 +1304,7 @@ DRIVER_INIT_MEMBER(compis_state,compis) void compis_state::machine_start() { /* CPU */ - compis_cpu_init(machine()); + compis_cpu_init(); } /*-------------------------------------------------------------------------*/ /* Name: compis */ @@ -1316,10 +1313,10 @@ void compis_state::machine_start() void compis_state::machine_reset() { /* FDC */ - compis_fdc_reset(machine()); + compis_fdc_reset(); /* Keyboard */ - compis_keyb_init(this); + compis_keyb_init(); /* OSP PIC 8259 */ m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(compis_state::compis_irq_callback),this)); @@ -1332,5 +1329,5 @@ void compis_state::machine_reset() INTERRUPT_GEN_MEMBER(compis_state::compis_vblank_int) { // compis_gdc_vblank_int(); - compis_keyb_update(machine()); + compis_keyb_update(); } diff --git a/src/mess/machine/mac.c b/src/mess/machine/mac.c index 3daea6a39a9..dca53b8110b 100644 --- a/src/mess/machine/mac.c +++ b/src/mess/machine/mac.c @@ -1034,7 +1034,7 @@ WRITE16_MEMBER ( mac_state::macii_scsi_w ) m_ncr5380->ncr5380_write_reg(reg, data>>8); } -void mac_scsi_irq(running_machine &machine, int state) +WRITE_LINE_MEMBER(mac_state::mac_scsi_irq) { /* mac_state *mac = machine.driver_data<mac_state>(); diff --git a/src/mess/machine/ncr5380.c b/src/mess/machine/ncr5380.c index 102ed931f0d..e748576b78c 100644 --- a/src/mess/machine/ncr5380.c +++ b/src/mess/machine/ncr5380.c @@ -80,7 +80,7 @@ void ncr5380_device::device_config_complete() // or initialize to defaults if none provided else { - irq_callback = NULL; + memset(&m_irq_cb, 0, sizeof(m_irq_cb)); } } @@ -110,6 +110,7 @@ void ncr5380_device::device_start() memset(m_scsi_devices, 0, sizeof(m_scsi_devices)); m_next_req_flag = 0; + m_irq_func.resolve(m_irq_cb, *this); save_item(NAME(m_5380_Registers)); save_item(NAME(m_5380_Command)); diff --git a/src/mess/machine/ncr5380.h b/src/mess/machine/ncr5380.h index 3fe742e37bb..24f33f9334f 100644 --- a/src/mess/machine/ncr5380.h +++ b/src/mess/machine/ncr5380.h @@ -10,7 +10,7 @@ struct NCR5380interface { - void (*irq_callback)(running_machine &machine, int state); /* irq callback */ + devcb_write_line m_irq_cb; /* irq callback */ }; // 5380 registers @@ -69,6 +69,7 @@ private: UINT8 m_5380_Command[32]; INT32 m_cmd_ptr, m_d_ptr, m_d_limit, m_next_req_flag; UINT8 m_5380_Data[512]; + devcb_resolved_write_line m_irq_func; }; // device type definition diff --git a/src/mess/machine/vtech2.c b/src/mess/machine/vtech2.c index ff2ab5fc283..62a90d126b3 100644 --- a/src/mess/machine/vtech2.c +++ b/src/mess/machine/vtech2.c @@ -331,10 +331,9 @@ DEVICE_IMAGE_UNLOAD_MEMBER( vtech2_state, laser_cart ) memset(&m_mem[0x30000], 0xff, 0x10000); } -static device_t *laser_file(running_machine &machine) -{ - vtech2_state *state = machine.driver_data<vtech2_state>(); - return machine.device( state->m_laser_drive ? FLOPPY_1 : FLOPPY_0 ); +device_t *vtech2_state::laser_file() +{ + return machine().device(m_laser_drive ? FLOPPY_1 : FLOPPY_0); } void vtech2_state::laser_get_track() @@ -342,10 +341,10 @@ void vtech2_state::laser_get_track() 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( m_laser_drive >= 0 && laser_file(machine()) != NULL ) + if( m_laser_drive >= 0 && laser_file() != 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()); size = TRKSIZE_VZ; offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; image->fseek(offs, SEEK_SET); @@ -358,9 +357,9 @@ void vtech2_state::laser_get_track() void vtech2_state::laser_put_track() { - device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file(machine())); + device_image_interface *image = dynamic_cast<device_image_interface *>(laser_file()); /* drive selected and image file ok? */ - if( m_laser_drive >= 0 && laser_file(machine()) != NULL ) + if( m_laser_drive >= 0 && laser_file() != NULL ) { int size, offs; offs = TRKSIZE_VZ * m_laser_track_x2[m_laser_drive]/2; diff --git a/src/mess/video/timex.c b/src/mess/video/timex.c index 75c5ef95869..c83236cbb55 100644 --- a/src/mess/video/timex.c +++ b/src/mess/video/timex.c @@ -17,7 +17,7 @@ #include "includes/spectrum.h" #include "machine/ram.h" -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; } @@ -53,9 +53,8 @@ VIDEO_START_MEMBER(spectrum_state,ts2068) *******************************************************************/ /* Draw a scanline in TS2068/TC2048 hires mode (code modified from COUPE.C) */ -static void ts2068_hires_scanline(running_machine &machine,bitmap_ind16 &bitmap, int y, int borderlines) +void spectrum_state::ts2068_hires_scanline(bitmap_ind16 &bitmap, int y, int borderlines) { - spectrum_state *state = machine.driver_data<spectrum_state>(); int x,b,scrx,scry; unsigned short ink,pap; unsigned char *attr, *scr; @@ -63,13 +62,13 @@ static void ts2068_hires_scanline(running_machine &machine,bitmap_ind16 &bitmap, scrx=TS2068_LEFT_BORDER; scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - scr=machine.device<ram_device>(RAM_TAG)->pointer() + y*32; + scr=machine().device<ram_device>(RAM_TAG)->pointer() + y*32; attr=scr + 0x2000; for (x=0;x<32;x++) { /* Get ink and paper colour with bright */ - if (state->m_flash_invert && (*attr & 0x80)) + if (m_flash_invert && (*attr & 0x80)) { ink=((*attr)>>3) & 0x0f; pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); @@ -99,7 +98,7 @@ static void ts2068_hires_scanline(running_machine &machine,bitmap_ind16 &bitmap, } /* Draw a scanline in TS2068/TC2048 64-column mode */ -static void ts2068_64col_scanline(running_machine &machine,bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor) +void spectrum_state::ts2068_64col_scanline(bitmap_ind16 &bitmap, int y, int borderlines, unsigned short inkcolor) { int x,b,scrx,scry; unsigned char *scr1, *scr2; @@ -107,7 +106,7 @@ static void ts2068_64col_scanline(running_machine &machine,bitmap_ind16 &bitmap, scrx=TS2068_LEFT_BORDER; scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - scr1=machine.device<ram_device>(RAM_TAG)->pointer() + y*32; + scr1=machine().device<ram_device>(RAM_TAG)->pointer() + y*32; scr2=scr1 + 0x2000; for (x=0;x<32;x++) @@ -133,9 +132,8 @@ static void ts2068_64col_scanline(running_machine &machine,bitmap_ind16 &bitmap, } /* Draw a scanline in TS2068/TC2048 lores (normal Spectrum) mode */ -static void ts2068_lores_scanline(running_machine &machine,bitmap_ind16 &bitmap, int y, int borderlines, int screen) +void spectrum_state::ts2068_lores_scanline(bitmap_ind16 &bitmap, int y, int borderlines, int screen) { - spectrum_state *state = machine.driver_data<spectrum_state>(); int x,b,scrx,scry; unsigned short ink,pap; unsigned char *attr, *scr; @@ -143,13 +141,13 @@ static void ts2068_lores_scanline(running_machine &machine,bitmap_ind16 &bitmap, scrx=TS2068_LEFT_BORDER; scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); - scr = machine.device<ram_device>(RAM_TAG)->pointer() + y*32 + screen*0x2000; - attr = machine.device<ram_device>(RAM_TAG)->pointer() + ((scry>>3)*32) + screen*0x2000 + 0x1800; + scr = machine().device<ram_device>(RAM_TAG)->pointer() + y*32 + screen*0x2000; + attr = machine().device<ram_device>(RAM_TAG)->pointer() + ((scry>>3)*32) + screen*0x2000 + 0x1800; for (x=0;x<32;x++) { /* Get ink and paper colour with bright */ - if (state->m_flash_invert && (*attr & 0x80)) + if (m_flash_invert && (*attr & 0x80)) { ink=((*attr)>>3) & 0x0f; pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); @@ -191,25 +189,25 @@ UINT32 spectrum_state::screen_update_ts2068(screen_device &screen, bitmap_ind16 /* 64 Column mode */ unsigned short inkcolor = (m_port_ff_data & 0x38) >> 3; for (count = 0; count < 192; count++) - ts2068_64col_scanline(machine(),bitmap, count, TS2068_TOP_BORDER, inkcolor); + ts2068_64col_scanline(bitmap, count, TS2068_TOP_BORDER, inkcolor); } else if ((m_port_ff_data & 7) == 2) { /* Extended Color mode */ for (count = 0; count < 192; count++) - ts2068_hires_scanline(machine(),bitmap, count, TS2068_TOP_BORDER); + ts2068_hires_scanline(bitmap, count, TS2068_TOP_BORDER); } else if ((m_port_ff_data & 7) == 1) { /* Screen 6000-7aff */ for (count = 0; count < 192; count++) - ts2068_lores_scanline(machine(),bitmap, count, TS2068_TOP_BORDER, 1); + ts2068_lores_scanline(bitmap, count, TS2068_TOP_BORDER, 1); } else { /* Screen 4000-5aff */ for (count = 0; count < 192; count++) - ts2068_lores_scanline(machine(),bitmap, count, TS2068_TOP_BORDER, 0); + ts2068_lores_scanline(bitmap, count, TS2068_TOP_BORDER, 0); } return 0; @@ -228,25 +226,25 @@ UINT32 spectrum_state::screen_update_tc2048(screen_device &screen, bitmap_ind16 /* 64 Column mode */ unsigned short inkcolor = (m_port_ff_data & 0x38) >> 3; for (count = 0; count < 192; count++) - ts2068_64col_scanline(machine(),bitmap, count, SPEC_TOP_BORDER, inkcolor); + ts2068_64col_scanline(bitmap, count, SPEC_TOP_BORDER, inkcolor); } else if ((m_port_ff_data & 7) == 2) { /* Extended Color mode */ for (count = 0; count < 192; count++) - ts2068_hires_scanline(machine(),bitmap, count, SPEC_TOP_BORDER); + ts2068_hires_scanline(bitmap, count, SPEC_TOP_BORDER); } else if ((m_port_ff_data & 7) == 1) { /* Screen 6000-7aff */ for (count = 0; count < 192; count++) - ts2068_lores_scanline(machine(),bitmap, count, SPEC_TOP_BORDER, 1); + ts2068_lores_scanline(bitmap, count, SPEC_TOP_BORDER, 1); } else { /* Screen 4000-5aff */ for (count = 0; count < 192; count++) - ts2068_lores_scanline(machine(),bitmap, count, SPEC_TOP_BORDER, 0); + ts2068_lores_scanline(bitmap, count, SPEC_TOP_BORDER, 0); } return 0; |
