diff --git a/src/emu/video/pc_vga.c b/src/emu/video/pc_vga.c index 23e55b732a3..41ea3df2686 100644 --- a/src/emu/video/pc_vga.c +++ b/src/emu/video/pc_vga.c @@ -333,27 +333,116 @@ static struct #define LOG_8514 0 -static VIDEO_RESET( vga ); - /*************************************************************************** - MachineDriver stuff + Generic VGA ***************************************************************************/ +// device type definition +const device_type VGA = &device_creator; +const device_type TSENG_VGA = &device_creator; +const device_type TRIDENT_VGA = &device_creator; +const device_type S3_VGA = &device_creator; +const device_type GAMTOR_VGA = &device_creator; +const device_type ATI_VGA = &device_creator; +const device_type CIRRUS_VGA = &device_creator; -void pc_video_start(running_machine &machine) +vga_device::vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, type, name, tag, owner, clock) { - // ... - - // Avoid an infinite loop when displaying. 0 is not possible anyway. - vga.crtc.maximum_scan_line = 1; } -void s3_video_start(running_machine &machine) +vga_device::vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, VGA, "VGA", tag, owner, clock) { - int x; +} + +svga_device::svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : vga_device(mconfig, type, name, tag, owner, clock) +{ +} + +tseng_vga_device::tseng_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : svga_device(mconfig, TSENG_VGA, "TSENG_VGA", tag, owner, clock) +{ +} + +trident_vga_device::trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : svga_device(mconfig, TRIDENT_VGA, "TRIDENT_VGA", tag, owner, clock) +{ +} + +s3_vga_device::s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) + : svga_device(mconfig, type, name, tag, owner, clock) +{ +} + +s3_vga_device::s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : svga_device(mconfig, S3_VGA, "S3_VGA", tag, owner, clock) +{ +} + +gamtor_vga_device::gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : svga_device(mconfig, GAMTOR_VGA, "GAMTOR_VGA", tag, owner, clock) +{ +} + +ati_vga_device::ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : s3_vga_device(mconfig, ATI_VGA, "ATI_VGA", tag, owner, clock) +{ +} +cirrus_vga_device::cirrus_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : svga_device(mconfig, CIRRUS_VGA, "CIRRUS_VGA", tag, owner, clock) +{ +} + + +void vga_device::device_start() +{ + memset(&vga, 0, sizeof(vga)); + + int i; + for (i = 0; i < 0x100; i++) + palette_set_color_rgb(machine(), i, 0, 0, 0); + // Avoid an infinite loop when displaying. 0 is not possible anyway. vga.crtc.maximum_scan_line = 1; + + + // copy over interfaces + vga.read_dipswitch = read8_delegate(); //read_dipswitch; + vga.svga_intf.vram_size = 0x100000; + vga.svga_intf.seq_regcount = 0x05; + vga.svga_intf.crtc_regcount = 0x19; + + vga.memory = auto_alloc_array_clear(machine(), UINT8, vga.svga_intf.vram_size); +} + +void cirrus_vga_device::device_start() +{ + memset(&vga, 0, sizeof(vga)); + + int i; + for (i = 0; i < 0x100; i++) + palette_set_color_rgb(machine(), i, 0, 0, 0); + + // Avoid an infinite loop when displaying. 0 is not possible anyway. + vga.crtc.maximum_scan_line = 1; + + + // copy over interfaces + vga.read_dipswitch = read8_delegate(); //read_dipswitch; + vga.svga_intf.vram_size = 0x200000; + vga.svga_intf.seq_regcount = 0x08; + vga.svga_intf.crtc_regcount = 0x19; + + vga.memory = auto_alloc_array_clear(machine(), UINT8, vga.svga_intf.vram_size); +} + +void s3_vga_device::device_start() +{ + vga_device::device_start(); + int x; // Initialise hardware graphics cursor colours, Windows 95 doesn't touch the registers for some reason for(x=0;x<4;x++) { @@ -362,7 +451,7 @@ void s3_video_start(running_machine &machine) } } -static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { UINT8 ch, attr; UINT8 bits; @@ -374,7 +463,7 @@ static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const re pen_t pen; if(vga.crtc.cursor_enable) - vga.cursor.visible = machine.primary_screen->frame_number() & 0x10; + vga.cursor.visible = machine().primary_screen->frame_number() & 0x10; else vga.cursor.visible = 0; @@ -387,7 +476,7 @@ static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const re attr = vga.memory[(pos<<1) + 1]; font_base = 0x20000+(ch<<5); font_base += ((attr & 8) ? vga.sequencer.char_sel.B : vga.sequencer.char_sel.A)*0x2000; - blink_en = (vga.attribute.data[0x10]&8&&machine.primary_screen->frame_number() & 0x20) ? attr & 0x80 : 0; + blink_en = (vga.attribute.data[0x10]&8&&machine().primary_screen->frame_number() & 0x20) ? attr & 0x80 : 0; fore_col = attr & 0xf; back_col = (attr & 0x70) >> 4; @@ -405,7 +494,7 @@ static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const re else pen = vga.pens[back_col]; - if(!machine.primary_screen->visible_area().contains(column*width+w, line+h)) + if(!machine().primary_screen->visible_area().contains(column*width+w, line+h)) continue; bitmapline[column*width+w] = pen; @@ -418,7 +507,7 @@ static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const re else pen = vga.pens[back_col]; - if(!machine.primary_screen->visible_area().contains(column*width+w, line+h)) + if(!machine().primary_screen->visible_area().contains(column*width+w, line+h)) continue; bitmapline[column*width+w] = pen; } @@ -429,7 +518,7 @@ static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const re (h<=vga.crtc.cursor_scan_end)&&(hvisible_area().contains(column*width, line+h)) + if(!machine().primary_screen->visible_area().contains(column*width, line+h)) continue; bitmap.plot_box(column*width, line+h, width, 1, vga.pens[attr&0xf]); } @@ -438,7 +527,7 @@ static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const re } } -static void vga_vh_ega(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void vga_device::vga_vh_ega(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int pos, line, column, c, addr, i, yi; int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1); @@ -465,7 +554,7 @@ static void vga_vh_ega(running_machine &machine, bitmap_rgb32 &bitmap, const re for (i = 7; i >= 0; i--) { pen = vga.pens[(data[0]&1) | (data[1]&2) | (data[2]&4) | (data[3]&8)]; - if(!machine.primary_screen->visible_area().contains(c+i, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+i, line + yi)) continue; bitmapline[c+i] = pen; @@ -480,7 +569,7 @@ static void vga_vh_ega(running_machine &machine, bitmap_rgb32 &bitmap, const re } /* TODO: I'm guessing that in 256 colors mode every pixel actually outputs two pixels. Is it right? */ -static void vga_vh_vga(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int pos, line, column, c, addr, curr_addr; UINT32 *bitmapline; @@ -512,9 +601,9 @@ static void vga_vh_vga(running_machine &machine, bitmap_rgb32 &bitmap, const rec for(xi=0;xi<8;xi++) { - if(!machine.primary_screen->visible_area().contains(c+xi-pel_shift, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi-pel_shift, line + yi)) continue; - bitmapline[c+xi-pel_shift] = machine.pens[vga.memory[(pos & 0xffff)+((xi >> 1)*0x10000)]]; + bitmapline[c+xi-pel_shift] = machine().pens[vga.memory[(pos & 0xffff)+((xi >> 1)*0x10000)]]; } } } @@ -539,9 +628,9 @@ static void vga_vh_vga(running_machine &machine, bitmap_rgb32 &bitmap, const rec for(xi=0;xi<0x10;xi++) { - if(!machine.primary_screen->visible_area().contains(c+xi-pel_shift, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi-pel_shift, line + yi)) continue; - bitmapline[c+xi-pel_shift] = machine.pens[vga.memory[(pos+(xi >> 1)) & 0xffff]]; + bitmapline[c+xi-pel_shift] = machine().pens[vga.memory[(pos+(xi >> 1)) & 0xffff]]; } } } @@ -549,7 +638,7 @@ static void vga_vh_vga(running_machine &machine, bitmap_rgb32 &bitmap, const rec } } -static void vga_vh_cga(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void vga_device::vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect) { UINT32 *bitmapline; int height = (vga.crtc.scan_doubling + 1); @@ -573,7 +662,7 @@ static void vga_vh_cga(running_machine &machine, bitmap_rgb32 &bitmap, const rec for(xi=0;xi<4;xi++) { pen = vga.pens[(vga.memory[addr] >> (6-xi*2)) & 3]; - if(!machine.primary_screen->visible_area().contains(x+xi, y * height + yi)) + if(!machine().primary_screen->visible_area().contains(x+xi, y * height + yi)) continue; bitmapline[x+xi] = pen; } @@ -584,7 +673,7 @@ static void vga_vh_cga(running_machine &machine, bitmap_rgb32 &bitmap, const rec } } -static void vga_vh_mono(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void vga_device::vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect) { UINT32 *bitmapline; int height = (vga.crtc.scan_doubling + 1); @@ -608,7 +697,7 @@ static void vga_vh_mono(running_machine &machine, bitmap_rgb32 &bitmap, const re for(xi=0;xi<8;xi++) { pen = vga.pens[(vga.memory[addr] >> (7-xi)) & 1]; - if(!machine.primary_screen->visible_area().contains(x+xi, y * height + yi)) + if(!machine().primary_screen->visible_area().contains(x+xi, y * height + yi)) continue; bitmapline[x+xi] = pen; } @@ -619,7 +708,7 @@ static void vga_vh_mono(running_machine &machine, bitmap_rgb32 &bitmap, const re } } -static void svga_vh_rgb8(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect) { int pos, line, column, c, addr, curr_addr; UINT32 *bitmapline; @@ -661,9 +750,9 @@ static void svga_vh_rgb8(running_machine &machine, bitmap_rgb32 &bitmap, const r for(xi=0;xi<8;xi++) { - if(!machine.primary_screen->visible_area().contains(c+xi, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi, line + yi)) continue; - bitmapline[c+xi] = machine.pens[vga.memory[(pos+(xi))]]; + bitmapline[c+xi] = machine().pens[vga.memory[(pos+(xi))]]; } } } @@ -671,7 +760,7 @@ static void svga_vh_rgb8(running_machine &machine, bitmap_rgb32 &bitmap, const r } } -static void svga_vh_rgb15(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void svga_device::svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8)) #define IV 0xff000000 @@ -700,7 +789,7 @@ static void svga_vh_rgb15(running_machine &machine, bitmap_rgb32 &bitmap, const { int r,g,b; - if(!machine.primary_screen->visible_area().contains(c+xi, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi, line + yi)) continue; r = (MV(pos+xm)&0x7c00)>>10; @@ -715,7 +804,7 @@ static void svga_vh_rgb15(running_machine &machine, bitmap_rgb32 &bitmap, const } } -static void svga_vh_rgb16(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void svga_device::svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8)) #define IV 0xff000000 @@ -744,7 +833,7 @@ static void svga_vh_rgb16(running_machine &machine, bitmap_rgb32 &bitmap, const { int r,g,b; - if(!machine.primary_screen->visible_area().contains(c+xi, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi, line + yi)) continue; r = (MV(pos+xm)&0xf800)>>11; @@ -759,7 +848,7 @@ static void svga_vh_rgb16(running_machine &machine, bitmap_rgb32 &bitmap, const } } -static void svga_vh_rgb24(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void svga_device::svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16)) #define ID 0xff000000 @@ -788,7 +877,7 @@ static void svga_vh_rgb24(running_machine &machine, bitmap_rgb32 &bitmap, const { int r,g,b; - if(!machine.primary_screen->visible_area().contains(c+xi, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi, line + yi)) continue; r = (MD(pos+xm)&0xff0000)>>16; @@ -800,7 +889,7 @@ static void svga_vh_rgb24(running_machine &machine, bitmap_rgb32 &bitmap, const } } -static void svga_vh_rgb32(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) +void svga_device::svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect) { #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16)) #define ID 0xff000000 @@ -829,7 +918,7 @@ static void svga_vh_rgb32(running_machine &machine, bitmap_rgb32 &bitmap, const { int r,g,b; - if(!machine.primary_screen->visible_area().contains(c+xi, line + yi)) + if(!machine().primary_screen->visible_area().contains(c+xi, line + yi)) continue; r = (MD(pos+xm)&0xff0000)>>16; @@ -853,12 +942,10 @@ enum RGB15_MODE, RGB16_MODE, RGB24_MODE, - RGB32_MODE, - SVGA_HACK + RGB32_MODE }; - -static UINT8 pc_vga_choosevideomode(running_machine &machine) +UINT8 vga_device::pc_vga_choosevideomode() { int i; @@ -869,7 +956,7 @@ static UINT8 pc_vga_choosevideomode(running_machine &machine) for (i=0; i<256;i++) { /* TODO: color shifters? */ - palette_set_color_rgb(machine, i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2, + palette_set_color_rgb(machine(), i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2, (vga.dac.color[i & vga.dac.mask].green & 0x3f) << 2, (vga.dac.color[i & vga.dac.mask].blue & 0x3f) << 2); } @@ -880,7 +967,7 @@ static UINT8 pc_vga_choosevideomode(running_machine &machine) { for (i=0; i<16;i++) { - vga.pens[i] = machine.pens[(vga.attribute.data[i]&0x0f) + vga.pens[i] = machine().pens[(vga.attribute.data[i]&0x0f) |((vga.attribute.data[0x14]&0xf)<<4)]; } } @@ -888,7 +975,68 @@ static UINT8 pc_vga_choosevideomode(running_machine &machine) { for (i=0; i<16;i++) { - vga.pens[i]=machine.pens[(vga.attribute.data[i]&0x3f) + vga.pens[i]=machine().pens[(vga.attribute.data[i]&0x3f) + |((vga.attribute.data[0x14]&0xc)<<4)]; + } + } + + if (!GRAPHIC_MODE) + { + return TEXT_MODE; + } + else if (vga.gc.shift256) + { + return VGA_MODE; + } + else if (vga.gc.shift_reg) + { + return CGA_MODE; + } + else if (vga.gc.memory_map_sel == 0x03) + { + return MONO_MODE; + } + else + { + return EGA_MODE; + } + } + + return SCREEN_OFF; +} + + +UINT8 svga_device::pc_vga_choosevideomode() +{ + int i; + + if (vga.crtc.sync_en) + { + if (vga.dac.dirty) + { + for (i=0; i<256;i++) + { + /* TODO: color shifters? */ + palette_set_color_rgb(machine(), i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2, + (vga.dac.color[i & vga.dac.mask].green & 0x3f) << 2, + (vga.dac.color[i & vga.dac.mask].blue & 0x3f) << 2); + } + vga.dac.dirty = 0; + } + + if (vga.attribute.data[0x10] & 0x80) + { + for (i=0; i<16;i++) + { + vga.pens[i] = machine().pens[(vga.attribute.data[i]&0x0f) + |((vga.attribute.data[0x14]&0xf)<<4)]; + } + } + else + { + for (i=0; i<16;i++) + { + vga.pens[i]=machine().pens[(vga.attribute.data[i]&0x3f) |((vga.attribute.data[0x14]&0xc)<<4)]; } } @@ -915,34 +1063,22 @@ static UINT8 pc_vga_choosevideomode(running_machine &machine) } else if (!GRAPHIC_MODE) { - //proc = vga_vh_text; - //*height = TEXT_LINES; - //*width = TEXT_COLUMNS * CHAR_WIDTH; - return TEXT_MODE; } else if (vga.gc.shift256) { - //proc = vga_vh_vga; - //*height = LINES; - //*width = VGA_COLUMNS * 8; return VGA_MODE; } else if (vga.gc.shift_reg) { - // cga return CGA_MODE; } else if (vga.gc.memory_map_sel == 0x03) { - // mono return MONO_MODE; } else { - //proc = vga_vh_ega; - //*height = LINES; - //*width = EGA_COLUMNS * 8; return EGA_MODE; } } @@ -950,39 +1086,50 @@ static UINT8 pc_vga_choosevideomode(running_machine &machine) return SCREEN_OFF; } -SCREEN_UPDATE_RGB32( pc_video ) + +UINT32 vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - UINT8 cur_mode = pc_vga_choosevideomode(screen.machine()); - - //popmessage("%02x %02x",cur_mode,vga.attribute.data[0x13]); - //popmessage("%d",vga.attribute.pel_shift); - //popmessage("%d %d %d",vga.crtc.vert_blank_start,vga.crtc.vert_blank_end,vga.crtc.vert_total); - + UINT8 cur_mode = pc_vga_choosevideomode(); switch(cur_mode) { - case SCREEN_OFF: bitmap.fill (get_black_pen(screen.machine()), cliprect);break; - case TEXT_MODE: vga_vh_text (screen.machine(), bitmap, cliprect); break; - case VGA_MODE: vga_vh_vga (screen.machine(), bitmap, cliprect); break; - case EGA_MODE: vga_vh_ega (screen.machine(), bitmap, cliprect); break; - case CGA_MODE: vga_vh_cga (screen.machine(), bitmap, cliprect); break; - case MONO_MODE: vga_vh_mono (screen.machine(), bitmap, cliprect); break; - case RGB8_MODE: svga_vh_rgb8 (screen.machine(), bitmap, cliprect); break; - case RGB15_MODE: svga_vh_rgb15(screen.machine(), bitmap, cliprect); break; - case RGB16_MODE: svga_vh_rgb16(screen.machine(), bitmap, cliprect); break; - case RGB24_MODE: svga_vh_rgb24(screen.machine(), bitmap, cliprect); break; - case RGB32_MODE: svga_vh_rgb32(screen.machine(), bitmap, cliprect); break; + case SCREEN_OFF: bitmap.fill (get_black_pen(machine()), cliprect);break; + case TEXT_MODE: vga_vh_text (bitmap, cliprect); break; + case VGA_MODE: vga_vh_vga (bitmap, cliprect); break; + case EGA_MODE: vga_vh_ega (bitmap, cliprect); break; + case CGA_MODE: vga_vh_cga (bitmap, cliprect); break; + case MONO_MODE: vga_vh_mono (bitmap, cliprect); break; + } + + return 0; +} +UINT32 svga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + UINT8 cur_mode = pc_vga_choosevideomode(); + switch(cur_mode) + { + case SCREEN_OFF: bitmap.fill (get_black_pen(machine()), cliprect);break; + case TEXT_MODE: vga_vh_text (bitmap, cliprect); break; + case VGA_MODE: vga_vh_vga (bitmap, cliprect); break; + case EGA_MODE: vga_vh_ega (bitmap, cliprect); break; + case CGA_MODE: vga_vh_cga (bitmap, cliprect); break; + case MONO_MODE: vga_vh_mono (bitmap, cliprect); break; + case RGB8_MODE: svga_vh_rgb8 (bitmap, cliprect); break; + case RGB15_MODE: svga_vh_rgb15(bitmap, cliprect); break; + case RGB16_MODE: svga_vh_rgb16(bitmap, cliprect); break; + case RGB24_MODE: svga_vh_rgb24(bitmap, cliprect); break; + case RGB32_MODE: svga_vh_rgb32(bitmap, cliprect); break; } return 0; } -SCREEN_UPDATE_RGB32( pc_video_s3 ) +UINT32 s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { UINT8 cur_mode = 0; - SCREEN_UPDATE32_CALL( pc_video ); + svga_device::screen_update(screen, bitmap, cliprect); - cur_mode = pc_vga_choosevideomode(screen.machine()); + cur_mode = pc_vga_choosevideomode(); // draw hardware graphics cursor // TODO: support 16 bit and greater video modes @@ -1055,12 +1202,12 @@ SCREEN_UPDATE_RGB32( pc_video_s3 ) /***************************************************************************/ -INLINE UINT8 rotate_right(UINT8 val) +inline UINT8 vga_device::rotate_right(UINT8 val) { return (val >> vga.gc.rotate_count) | (val << (8 - vga.gc.rotate_count)); } -INLINE UINT8 vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask) +inline UINT8 vga_device::vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask) { UINT8 res = 0; @@ -1083,7 +1230,7 @@ INLINE UINT8 vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask) return res; } -INLINE UINT8 vga_latch_write(int offs, UINT8 data) +inline UINT8 vga_device::vga_latch_write(int offs, UINT8 data) { UINT8 res = 0; @@ -1110,7 +1257,7 @@ INLINE UINT8 vga_latch_write(int offs, UINT8 data) return res; } -static UINT8 crtc_reg_read(UINT8 index) +UINT8 vga_device::crtc_reg_read(UINT8 index) { UINT8 res; @@ -1224,7 +1371,7 @@ static UINT8 crtc_reg_read(UINT8 index) return res; } -static void recompute_params_clock(running_machine &machine, int divisor, int xtal) +void vga_device::recompute_params_clock(int divisor, int xtal) { int vblank_period,hblank_period; attoseconds_t refresh; @@ -1245,18 +1392,18 @@ static void recompute_params_clock(running_machine &machine, int divisor, int xt refresh = HZ_TO_ATTOSECONDS(pixel_clock) * (hblank_period) * vblank_period; - machine.primary_screen->configure((hblank_period), (vblank_period), visarea, refresh ); + machine().primary_screen->configure((hblank_period), (vblank_period), visarea, refresh ); // popmessage("%d %d\n",vga.crtc.horz_total * 8,vga.crtc.vert_total); } -static void recompute_params(running_machine &machine) +void vga_device::recompute_params() { - recompute_params_clock(machine, 1, (vga.miscellaneous_output & 0xc) ? XTAL_28_63636MHz : XTAL_25_1748MHz); + recompute_params_clock(1, (vga.miscellaneous_output & 0xc) ? XTAL_28_63636MHz : XTAL_25_1748MHz); if(vga.miscellaneous_output & 8) logerror("Warning: VGA external clock latch selected\n"); } -static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void vga_device::crtc_reg_write(UINT8 index, UINT8 data) { /* Doom does this */ // if(vga.crtc.protect_enable && index <= 0x07) @@ -1268,13 +1415,13 @@ static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) if(vga.crtc.protect_enable) break; vga.crtc.horz_total = (vga.crtc.horz_total & ~0xff) | (data & 0xff); - recompute_params(machine); + recompute_params(); break; case 0x01: if(vga.crtc.protect_enable) break; vga.crtc.horz_disp_end = (data & 0xff); - recompute_params(machine); + recompute_params(); break; case 0x02: if(vga.crtc.protect_enable) @@ -1307,7 +1454,7 @@ static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) break; vga.crtc.vert_total &= ~0xff; vga.crtc.vert_total |= data & 0xff; - recompute_params(machine); + recompute_params(); break; case 0x07: // Overflow Register vga.crtc.line_compare &= ~0x100; @@ -1325,7 +1472,7 @@ static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) vga.crtc.vert_retrace_start |= ((data & 0x04) << (8-2)); vga.crtc.vert_disp_end |= ((data & 0x02) << (8-1)); vga.crtc.vert_total |= ((data & 0x01) << (8-0)); - recompute_params(machine); + recompute_params(); break; case 0x08: // Preset Row Scan Register vga.crtc.byte_panning = (data & 0x60) >> 5; @@ -1369,7 +1516,7 @@ static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) case 0x12: vga.crtc.vert_disp_end &= ~0xff; vga.crtc.vert_disp_end |= data & 0xff; - recompute_params(machine); + recompute_params(); break; case 0x13: vga.crtc.offset = data & 0xff; @@ -1405,7 +1552,7 @@ static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) } } -static void seq_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void vga_device::seq_reg_write(UINT8 index, UINT8 data) { switch(index) { @@ -1423,7 +1570,7 @@ static void seq_reg_write(running_machine &machine, UINT8 index, UINT8 data) } } -static UINT8 vga_vblank(running_machine &machine) +UINT8 vga_device::vga_vblank() { UINT8 res; UINT16 vblank_start,vblank_end,vpos; @@ -1432,7 +1579,7 @@ static UINT8 vga_vblank(running_machine &machine) res = 0; vblank_start = vga.crtc.vert_blank_start; vblank_end = vga.crtc.vert_blank_start + vga.crtc.vert_blank_end; - vpos = machine.primary_screen->vpos(); + vpos = machine().primary_screen->vpos(); /* check if we are under vblank period */ if(vblank_end > vga.crtc.vert_total) @@ -1452,7 +1599,7 @@ static UINT8 vga_vblank(running_machine &machine) return res; } -static READ8_HANDLER(vga_crtc_r) +READ8_MEMBER(vga_device::vga_crtc_r) { UINT8 data = 0xff; @@ -1469,7 +1616,7 @@ static READ8_HANDLER(vga_crtc_r) data = 0; hsync = space.machine().primary_screen->hblank() & 1; - vsync = vga_vblank(space.machine()); //space.machine().primary_screen->vblank() & 1; + vsync = vga_vblank(); //space.machine().primary_screen->vblank() & 1; data |= (hsync | vsync) & 1; // DD - display disable register data |= (vsync & 1) << 3; // VRetrace register @@ -1502,7 +1649,7 @@ static READ8_HANDLER(vga_crtc_r) return data; } -static WRITE8_HANDLER(vga_crtc_w) +WRITE8_MEMBER(vga_device::vga_crtc_w) { switch (offset) { @@ -1519,7 +1666,7 @@ static WRITE8_HANDLER(vga_crtc_w) data); } - crtc_reg_write(space.machine(),vga.crtc.index,data); + crtc_reg_write(vga.crtc.index,data); //space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos()); #if 0 if((vga.crtc.index & 0xfe) != 0x0e) @@ -1535,7 +1682,7 @@ static WRITE8_HANDLER(vga_crtc_w) -READ8_HANDLER( vga_port_03b0_r ) +READ8_MEMBER(vga_device::port_03b0_r) { UINT8 data = 0xff; if (CRTC_PORT_ADDR==0x3b0) @@ -1543,7 +1690,7 @@ READ8_HANDLER( vga_port_03b0_r ) return data; } -static UINT8 gc_reg_read(running_machine &machine,UINT8 index) +UINT8 vga_device::gc_reg_read(UINT8 index) { UINT8 res; @@ -1591,7 +1738,7 @@ static UINT8 gc_reg_read(running_machine &machine,UINT8 index) return res; } -READ8_HANDLER( vga_port_03c0_r ) +READ8_MEMBER(vga_device::port_03c0_r) { UINT8 data = 0xff; @@ -1615,18 +1762,26 @@ READ8_HANDLER( vga_port_03c0_r ) case 3: if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x01) data |= 0x10; + else + data |= 0x10; break; case 2: if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x02) data |= 0x10; + else + data |= 0x10; break; case 1: if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x04) data |= 0x10; + else + data |= 0x10; break; case 0: if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x08) data |= 0x10; + else + data |= 0x10; break; } break; @@ -1693,13 +1848,13 @@ READ8_HANDLER( vga_port_03c0_r ) break; case 0xf: - data = gc_reg_read(space.machine(),vga.gc.index); + data = gc_reg_read(vga.gc.index); break; } return data; } -READ8_HANDLER(vga_port_03d0_r) +READ8_MEMBER(vga_device::port_03d0_r) { UINT8 data = 0xff; if (CRTC_PORT_ADDR == 0x3d0) @@ -1713,7 +1868,7 @@ READ8_HANDLER(vga_port_03d0_r) return data; } -WRITE8_HANDLER( vga_port_03b0_w ) +WRITE8_MEMBER(vga_device::port_03b0_w) { if (LOG_ACCESSES) logerror("vga_port_03b0_w(): port=0x%04x data=0x%02x\n", offset + 0x3b0, data); @@ -1722,7 +1877,7 @@ WRITE8_HANDLER( vga_port_03b0_w ) vga_crtc_w(space, offset, data, mem_mask); } -static void attribute_reg_write(UINT8 index, UINT8 data) +void vga_device::attribute_reg_write(UINT8 index, UINT8 data) { if((index & 0x30) == 0) { @@ -1743,7 +1898,7 @@ static void attribute_reg_write(UINT8 index, UINT8 data) } } -static void gc_reg_write(running_machine &machine,UINT8 index,UINT8 data) +void vga_device::gc_reg_write(UINT8 index,UINT8 data) { switch(index) { @@ -1788,7 +1943,7 @@ static void gc_reg_write(running_machine &machine,UINT8 index,UINT8 data) } } -WRITE8_HANDLER(vga_port_03c0_w) +WRITE8_MEMBER(vga_device::port_03c0_w) { if (LOG_ACCESSES) logerror("vga_port_03c0_w(): port=0x%04x data=0x%02x\n", offset + 0x3c0, data); @@ -1807,7 +1962,7 @@ WRITE8_HANDLER(vga_port_03c0_w) break; case 2: vga.miscellaneous_output=data; - recompute_params(space.machine()); + recompute_params(); break; case 3: vga.oak.reg = data; @@ -1828,8 +1983,8 @@ WRITE8_HANDLER(vga_port_03c0_w) vga.sequencer.data[vga.sequencer.index] = data; } - seq_reg_write(space.machine(),vga.sequencer.index,data); - recompute_params(space.machine()); + seq_reg_write(vga.sequencer.index,data); + recompute_params(); break; case 6: vga.dac.mask=data; @@ -1869,14 +2024,14 @@ WRITE8_HANDLER(vga_port_03c0_w) vga.gc.index=data; break; case 0xf: - gc_reg_write(space.machine(),vga.gc.index,data); + gc_reg_write(vga.gc.index,data); break; } } -WRITE8_HANDLER(vga_port_03d0_w) +WRITE8_MEMBER(vga_device::port_03d0_w) { if (LOG_ACCESSES) logerror("vga_port_03d0_w(): port=0x%04x data=0x%02x\n", offset + 0x3d0, data); @@ -1885,7 +2040,7 @@ WRITE8_HANDLER(vga_port_03d0_w) vga_crtc_w(space, offset, data, mem_mask); } -void pc_vga_reset(running_machine &machine) +void vga_device::device_reset() { /* clear out the VGA structure */ memset(vga.pens, 0, sizeof(vga.pens)); @@ -1912,7 +2067,7 @@ void pc_vga_reset(running_machine &machine) vga.crtc.line_compare = 0x3ff; } -READ8_HANDLER(vga_mem_r) +READ8_MEMBER(vga_device::mem_r) { /* TODO: check me */ switch(vga.gc.memory_map_sel & 0x03) @@ -1978,7 +2133,7 @@ READ8_HANDLER(vga_mem_r) return 0; } -WRITE8_HANDLER(vga_mem_w) +WRITE8_MEMBER(vga_device::mem_w) { //Inside each case must prevent writes to non-mapped VGA memory regions, not only mask the offset. switch(vga.gc.memory_map_sel & 0x03) @@ -2016,56 +2171,12 @@ WRITE8_HANDLER(vga_mem_w) } } -void pc_vga_init(running_machine &machine, read8_delegate read_dipswitch) -{ - memset(&vga, 0, sizeof(vga)); - - /* copy over interfaces */ - vga.read_dipswitch = read_dipswitch; - vga.svga_intf.vram_size = 0x100000; - vga.svga_intf.seq_regcount = 0x05; - vga.svga_intf.crtc_regcount = 0x19; - - vga.memory = auto_alloc_array_clear(machine, UINT8, vga.svga_intf.vram_size); - pc_vga_reset(machine); - -} - -void pc_vga_cirrus_init(running_machine &machine, read8_delegate read_dipswitch) -{ - memset(&vga, 0, sizeof(vga)); - - /* copy over interfaces */ - vga.read_dipswitch = read_dipswitch; - vga.svga_intf.vram_size = 0x200000; - vga.svga_intf.seq_regcount = 0x08; - vga.svga_intf.crtc_regcount = 0x19; - - vga.memory = auto_alloc_array_clear(machine, UINT8, vga.svga_intf.vram_size); - - pc_vga_reset(machine); - -} - -VIDEO_START( vga ) -{ - int i; - for (i = 0; i < 0x100; i++) - palette_set_color_rgb(machine, i, 0, 0, 0); - pc_video_start(machine); -} - -static VIDEO_RESET( vga ) -{ - pc_vga_reset(machine); -} - -READ8_HANDLER(vga_mem_linear_r) +READ8_MEMBER(vga_device::mem_linear_r) { return vga.memory[offset]; } -WRITE8_HANDLER(vga_mem_linear_w) +WRITE8_MEMBER(vga_device::mem_linear_w) { vga.memory[offset] = data; } @@ -2085,47 +2196,71 @@ static struct eeprom_interface ati_eeprom_interface = MACHINE_CONFIG_FRAGMENT( pcvideo_vga ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) - MCFG_SCREEN_UPDATE_STATIC(pc_video) + MCFG_SCREEN_UPDATE_DEVICE("vga", vga_device, screen_update) MCFG_PALETTE_LENGTH(0x100) - - MCFG_VIDEO_START(vga) - MCFG_VIDEO_RESET(vga) + MCFG_DEVICE_ADD("vga", VGA, 0) MACHINE_CONFIG_END -MACHINE_CONFIG_FRAGMENT( pcvideo_vga_isa ) +MACHINE_CONFIG_FRAGMENT( pcvideo_trident_vga ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) - MCFG_SCREEN_UPDATE_STATIC(pc_video) + MCFG_SCREEN_UPDATE_DEVICE("vga", trident_vga_device, screen_update) MCFG_PALETTE_LENGTH(0x100) + + MCFG_DEVICE_ADD("vga", TRIDENT_VGA, 0) MACHINE_CONFIG_END +MACHINE_CONFIG_FRAGMENT( pcvideo_cirrus_vga ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_vga_device, screen_update) + + MCFG_PALETTE_LENGTH(0x100) + + MCFG_DEVICE_ADD("vga", CIRRUS_VGA, 0) +MACHINE_CONFIG_END + +MACHINE_CONFIG_FRAGMENT( pcvideo_gamtor_vga ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", gamtor_vga_device, screen_update) + + MCFG_PALETTE_LENGTH(0x100) + MCFG_DEVICE_ADD("vga", GAMTOR_VGA, 0) +MACHINE_CONFIG_END + + MACHINE_CONFIG_FRAGMENT( pcvideo_s3_isa ) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) - MCFG_SCREEN_UPDATE_STATIC(pc_video_s3) + //MCFG_SCREEN_UPDATE_STATIC(pc_video_s3) MCFG_PALETTE_LENGTH(0x100) MACHINE_CONFIG_END -MACHINE_CONFIG_FRAGMENT( pcvideo_ati_isa ) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) - MCFG_SCREEN_UPDATE_STATIC(pc_video) - - MCFG_PALETTE_LENGTH(0x100) - +static MACHINE_CONFIG_FRAGMENT( ati_vga ) MCFG_EEPROM_ADD("ati_eeprom",ati_eeprom_interface) MACHINE_CONFIG_END +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor ati_vga_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( ati_vga ); +} + /****************************************** Tseng ET4000k implementation ******************************************/ -static void tseng_define_video_mode(running_machine &machine) +void tseng_vga_device::tseng_define_video_mode() { int divisor; int xtal = 0; @@ -2180,10 +2315,10 @@ static void tseng_define_video_mode(running_machine &machine) divisor = 1; break; } - recompute_params_clock(machine, divisor, xtal); + recompute_params_clock(divisor, xtal); } -static UINT8 tseng_crtc_reg_read(running_machine &machine, UINT8 index) +UINT8 tseng_vga_device::tseng_crtc_reg_read(UINT8 index) { UINT8 res; @@ -2209,10 +2344,10 @@ static UINT8 tseng_crtc_reg_read(running_machine &machine, UINT8 index) return res; } -static void tseng_crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void tseng_vga_device::tseng_crtc_reg_write(UINT8 index, UINT8 data) { if(index <= 0x18) - crtc_reg_write(machine,index,data); + crtc_reg_write(index,data); else { switch(index) @@ -2231,7 +2366,7 @@ static void tseng_crtc_reg_write(running_machine &machine, UINT8 index, UINT8 da } } -static UINT8 tseng_seq_reg_read(running_machine &machine, UINT8 index) +UINT8 tseng_vga_device::tseng_seq_reg_read(UINT8 index) { UINT8 res; @@ -2253,12 +2388,12 @@ static UINT8 tseng_seq_reg_read(running_machine &machine, UINT8 index) return res; } -static void tseng_seq_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void tseng_vga_device::tseng_seq_reg_write(UINT8 index, UINT8 data) { if(index <= 0x04) { vga.sequencer.data[vga.sequencer.index] = data; - seq_reg_write(machine,vga.sequencer.index,data); + seq_reg_write(vga.sequencer.index,data); } else { @@ -2272,7 +2407,7 @@ static void tseng_seq_reg_write(running_machine &machine, UINT8 index, UINT8 dat } } -READ8_HANDLER(tseng_et4k_03b0_r) +READ8_MEMBER(tseng_vga_device::port_03b0_r) { UINT8 res = 0xff; @@ -2281,13 +2416,13 @@ READ8_HANDLER(tseng_et4k_03b0_r) switch(offset) { case 5: - res = tseng_crtc_reg_read(space.machine(),vga.crtc.index); + res = tseng_crtc_reg_read(vga.crtc.index); break; case 8: res = et4k.reg_3d8; break; default: - res = vga_port_03b0_r(space,offset); + res = vga_device::port_03b0_r(space,offset,mem_mask); break; } } @@ -2295,7 +2430,7 @@ READ8_HANDLER(tseng_et4k_03b0_r) return res; } -WRITE8_HANDLER(tseng_et4k_03b0_w) +WRITE8_MEMBER(tseng_vga_device::port_03b0_w) { if (CRTC_PORT_ADDR == 0x3b0) { @@ -2303,7 +2438,7 @@ WRITE8_HANDLER(tseng_et4k_03b0_w) { case 5: vga.crtc.data[vga.crtc.index] = data; - tseng_crtc_reg_write(space.machine(),vga.crtc.index,data); + tseng_crtc_reg_write(vga.crtc.index,data); break; case 8: et4k.reg_3d8 = data; @@ -2313,22 +2448,22 @@ WRITE8_HANDLER(tseng_et4k_03b0_w) et4k.ext_reg_ena = false; break; default: - vga_port_03b0_w(space,offset,data); + vga_device::port_03b0_w(space,offset,data,mem_mask); break; } } - tseng_define_video_mode(space.machine()); + tseng_define_video_mode(); } -READ8_HANDLER(tseng_et4k_03c0_r) +READ8_MEMBER(tseng_vga_device::port_03c0_r) { UINT8 res; switch(offset) { case 0x05: - res = tseng_seq_reg_read(space.machine(),vga.sequencer.index); + res = tseng_seq_reg_read(vga.sequencer.index); break; case 0x0d: res = svga.bank_w & 0xf; @@ -2343,24 +2478,24 @@ READ8_HANDLER(tseng_et4k_03c0_r) break; } et4k.dac_state++; - res = vga_port_03c0_r(space,offset); + res = vga_device::port_03c0_r(space,offset,mem_mask); break; case 0x08: et4k.dac_state = 0; default: - res = vga_port_03c0_r(space,offset); + res = vga_device::port_03c0_r(space,offset,mem_mask); break; } return res; } -WRITE8_HANDLER(tseng_et4k_03c0_w) +WRITE8_MEMBER(tseng_vga_device::port_03c0_w) { switch(offset) { case 0x05: - tseng_seq_reg_write(space.machine(),vga.sequencer.index,data); + tseng_seq_reg_write(vga.sequencer.index,data); break; case 0x0d: svga.bank_w = data & 0xf; @@ -2373,13 +2508,13 @@ WRITE8_HANDLER(tseng_et4k_03c0_w) break; } default: - vga_port_03c0_w(space,offset,data); + vga_device::port_03c0_w(space,offset,data,mem_mask); break; } - tseng_define_video_mode(space.machine()); + tseng_define_video_mode(); } -READ8_HANDLER(tseng_et4k_03d0_r) +READ8_MEMBER(tseng_vga_device::port_03d0_r) { UINT8 res = 0xff; @@ -2388,13 +2523,13 @@ READ8_HANDLER(tseng_et4k_03d0_r) switch(offset) { case 5: - res = tseng_crtc_reg_read(space.machine(),vga.crtc.index); + res = tseng_crtc_reg_read(vga.crtc.index); break; case 8: res = et4k.reg_3d8; break; default: - res = vga_port_03d0_r(space,offset); + res = vga_device::port_03d0_r(space,offset,mem_mask); break; } } @@ -2402,7 +2537,7 @@ READ8_HANDLER(tseng_et4k_03d0_r) return res; } -WRITE8_HANDLER(tseng_et4k_03d0_w) +WRITE8_MEMBER(tseng_vga_device::port_03d0_w) { if (CRTC_PORT_ADDR == 0x3d0) { @@ -2410,7 +2545,7 @@ WRITE8_HANDLER(tseng_et4k_03d0_w) { case 5: vga.crtc.data[vga.crtc.index] = data; - tseng_crtc_reg_write(space.machine(),vga.crtc.index,data); + tseng_crtc_reg_write(vga.crtc.index,data); //if((vga.crtc.index & 0xfe) != 0x0e) // printf("%02x %02x %d\n",vga.crtc.index,data,space.machine().primary_screen->vpos()); break; @@ -2422,14 +2557,14 @@ WRITE8_HANDLER(tseng_et4k_03d0_w) et4k.ext_reg_ena = false; break; default: - vga_port_03d0_w(space,offset,data); + vga_device::port_03d0_w(space,offset,data,mem_mask); break; } } - tseng_define_video_mode(space.machine()); + tseng_define_video_mode(); } -READ8_HANDLER( tseng_mem_r ) +READ8_MEMBER(tseng_vga_device::mem_r) { if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en) { @@ -2437,10 +2572,10 @@ READ8_HANDLER( tseng_mem_r ) return vga.memory[(offset+svga.bank_r*0x10000)]; } - return vga_mem_r(space,offset); + return vga_device::mem_r(space,offset,mem_mask); } -WRITE8_HANDLER( tseng_mem_w ) +WRITE8_MEMBER(tseng_vga_device::mem_w) { if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en) { @@ -2448,7 +2583,7 @@ WRITE8_HANDLER( tseng_mem_w ) vga.memory[(offset+svga.bank_w*0x10000)] = data; } else - vga_mem_w(space,offset,data); + vga_device::mem_w(space,offset,data,mem_mask); } /****************************************** @@ -2456,7 +2591,7 @@ WRITE8_HANDLER( tseng_mem_w ) Trident implementation ******************************************/ -static UINT8 trident_seq_reg_read(running_machine &machine, UINT8 index) +UINT8 trident_vga_device::trident_seq_reg_read(UINT8 index) { UINT8 res; @@ -2481,13 +2616,13 @@ static UINT8 trident_seq_reg_read(running_machine &machine, UINT8 index) return res; } -static void trident_seq_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void trident_vga_device::trident_seq_reg_write(UINT8 index, UINT8 data) { if(index <= 0x04) { vga.sequencer.data[vga.sequencer.index] = data; - seq_reg_write(machine,vga.sequencer.index,data); - recompute_params(machine); + seq_reg_write(vga.sequencer.index,data); + recompute_params(); } else { @@ -2504,38 +2639,38 @@ static void trident_seq_reg_write(running_machine &machine, UINT8 index, UINT8 d } -READ8_HANDLER(trident_03c0_r) +READ8_MEMBER(trident_vga_device::port_03c0_r) { UINT8 res; switch(offset) { case 0x05: - res = trident_seq_reg_read(space.machine(),vga.sequencer.index); + res = trident_seq_reg_read(vga.sequencer.index); break; default: - res = vga_port_03c0_r(space,offset); + res = vga_device::port_03c0_r(space,offset,mem_mask); break; } return res; } -WRITE8_HANDLER(trident_03c0_w) +WRITE8_MEMBER(trident_vga_device::port_03c0_w) { switch(offset) { case 0x05: - trident_seq_reg_write(space.machine(),vga.sequencer.index,data); + trident_seq_reg_write(vga.sequencer.index,data); break; default: - vga_port_03c0_w(space,offset,data); + vga_device::port_03c0_w(space,offset,data,mem_mask); break; } } -READ8_HANDLER(trident_03d0_r) +READ8_MEMBER(trident_vga_device::port_03d0_r) { UINT8 res = 0xff; @@ -2547,7 +2682,7 @@ READ8_HANDLER(trident_03d0_r) res = svga.bank_w & 0x1f; // TODO: a lot more complex than this break; default: - res = vga_port_03d0_r(space,offset); + res = vga_device::port_03d0_r(space,offset,mem_mask); break; } } @@ -2555,7 +2690,7 @@ READ8_HANDLER(trident_03d0_r) return res; } -WRITE8_HANDLER(trident_03d0_w) +WRITE8_MEMBER(trident_vga_device::port_03d0_w) { if (CRTC_PORT_ADDR == 0x3d0) { @@ -2565,13 +2700,13 @@ WRITE8_HANDLER(trident_03d0_w) svga.bank_w = data & 0x1f; // TODO: a lot more complex than this break; default: - vga_port_03d0_w(space,offset,data); + vga_device::port_03d0_w(space,offset,data,mem_mask); break; } } } -READ8_HANDLER( trident_mem_r ) +READ8_MEMBER(trident_vga_device::mem_r ) { if (svga.rgb15_en & 0x30) { @@ -2582,10 +2717,10 @@ READ8_HANDLER( trident_mem_r ) return data; } - return vga_mem_r(space,offset); + return vga_device::mem_r(space,offset,mem_mask); } -WRITE8_HANDLER( trident_mem_w ) +WRITE8_MEMBER(trident_vga_device::mem_w) { if (svga.rgb15_en & 0x30) { @@ -2595,7 +2730,7 @@ WRITE8_HANDLER( trident_mem_w ) return; } - vga_mem_w(space,offset,data); + vga_device::mem_w(space,offset,data,mem_mask); } /****************************************** @@ -2604,7 +2739,7 @@ S3 implementation ******************************************/ -static UINT8 s3_crtc_reg_read(running_machine &machine, UINT8 index) +UINT8 s3_vga_device::s3_crtc_reg_read(UINT8 index) { UINT8 res; @@ -2703,7 +2838,7 @@ static UINT8 s3_crtc_reg_read(running_machine &machine, UINT8 index) return res; } -static void s3_define_video_mode(void) +void s3_vga_device::s3_define_video_mode() { if((s3.ext_misc_ctrl_2) >> 4) { @@ -2728,10 +2863,10 @@ static void s3_define_video_mode(void) } } -static void s3_crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void s3_vga_device::s3_crtc_reg_write(UINT8 index, UINT8 data) { if(index <= 0x18) - crtc_reg_write(machine,index,data); + crtc_reg_write(index,data); else { switch(index) @@ -2947,7 +3082,7 @@ bit 0-1 DAC Register Select Bits. Passed to the RS2 and RS3 pins on the } -READ8_HANDLER(s3_port_03b0_r) +READ8_MEMBER(s3_vga_device::port_03b0_r) { UINT8 res = 0xff; @@ -2956,10 +3091,10 @@ READ8_HANDLER(s3_port_03b0_r) switch(offset) { case 5: - res = s3_crtc_reg_read(space.machine(),vga.crtc.index); + res = s3_crtc_reg_read(vga.crtc.index); break; default: - res = vga_port_03b0_r(space,offset); + res = vga_device::port_03b0_r(space,offset,mem_mask); break; } } @@ -2967,7 +3102,7 @@ READ8_HANDLER(s3_port_03b0_r) return res; } -WRITE8_HANDLER(s3_port_03b0_w) +WRITE8_MEMBER(s3_vga_device::port_03b0_w) { if (CRTC_PORT_ADDR == 0x3b0) { @@ -2975,40 +3110,40 @@ WRITE8_HANDLER(s3_port_03b0_w) { case 5: vga.crtc.data[vga.crtc.index] = data; - s3_crtc_reg_write(space.machine(),vga.crtc.index,data); + s3_crtc_reg_write(vga.crtc.index,data); break; default: - vga_port_03b0_w(space,offset,data); + vga_device::port_03b0_w(space,offset,data,mem_mask); break; } } } -READ8_HANDLER(s3_port_03c0_r) +READ8_MEMBER(s3_vga_device::port_03c0_r) { UINT8 res; switch(offset) { default: - res = vga_port_03c0_r(space,offset); + res = vga_device::port_03c0_r(space,offset,mem_mask); break; } return res; } -WRITE8_HANDLER(s3_port_03c0_w) +WRITE8_MEMBER(s3_vga_device::port_03c0_w) { switch(offset) { default: - vga_port_03c0_w(space,offset,data); + vga_device::port_03c0_w(space,offset,data,mem_mask); break; } } -READ8_HANDLER(s3_port_03d0_r) +READ8_MEMBER(s3_vga_device::port_03d0_r) { UINT8 res = 0xff; @@ -3017,10 +3152,10 @@ READ8_HANDLER(s3_port_03d0_r) switch(offset) { case 5: - res = s3_crtc_reg_read(space.machine(),vga.crtc.index); + res = s3_crtc_reg_read(vga.crtc.index); break; default: - res = vga_port_03d0_r(space,offset); + res = vga_device::port_03d0_r(space,offset,mem_mask); break; } } @@ -3028,7 +3163,7 @@ READ8_HANDLER(s3_port_03d0_r) return res; } -WRITE8_HANDLER(s3_port_03d0_w) +WRITE8_MEMBER(s3_vga_device::port_03d0_w) { if (CRTC_PORT_ADDR == 0x3d0) { @@ -3036,16 +3171,16 @@ WRITE8_HANDLER(s3_port_03d0_w) { case 5: vga.crtc.data[vga.crtc.index] = data; - s3_crtc_reg_write(space.machine(),vga.crtc.index,data); + s3_crtc_reg_write(vga.crtc.index,data); break; default: - vga_port_03d0_w(space,offset,data); + vga_device::port_03d0_w(space,offset,data,mem_mask); break; } } } -READ8_HANDLER( ati_port_03c0_r ) +READ8_MEMBER(ati_vga_device::port_03c0_r) { UINT8 data = 0xff; @@ -3056,7 +3191,7 @@ READ8_HANDLER( ati_port_03c0_r ) data = vga.attribute.data[vga.attribute.index&0x1f]; break; default: - data = vga_port_03c0_r(space,offset); + data = vga_device::port_03c0_r(space,offset,mem_mask); break; } return data; @@ -3065,7 +3200,7 @@ READ8_HANDLER( ati_port_03c0_r ) /* accelerated ports, TBD ... */ -static void s3_write_fg(UINT32 offset) +void s3_vga_device::s3_write_fg(UINT32 offset) { UINT8 dst = vga.memory[offset]; UINT8 src = 0; @@ -3146,7 +3281,7 @@ static void s3_write_fg(UINT32 offset) } } -static void s3_write_bg(UINT32 offset) +void s3_vga_device::s3_write_bg(UINT32 offset) { UINT8 dst = vga.memory[offset]; UINT8 src = 0; @@ -3227,7 +3362,7 @@ static void s3_write_bg(UINT32 offset) } } -void s3_write(UINT32 offset, UINT32 src) +void s3_vga_device::s3_write(UINT32 offset, UINT32 src) { int data_size = 8; UINT32 xfer = 0; @@ -3291,12 +3426,12 @@ bit 0-12 (911/924) LINE PARAMETER/ERROR TERM. For Line Drawing this is the the major or independent axis). 0-13 (80x +) LINE PARAMETER/ERROR TERM. See above. */ -READ16_HANDLER(s3_line_error_r) +READ16_MEMBER(s3_vga_device::s3_line_error_r) { return ibm8514.line_errorterm; } -WRITE16_HANDLER(s3_line_error_w) +WRITE16_MEMBER(s3_vga_device::s3_line_error_w) { ibm8514.line_errorterm = data; if(LOG_8514) logerror("S3: Line Parameter/Error Term write %04x\n",data); @@ -3323,7 +3458,7 @@ bit 0-7 Queue State. available, Fh for 9 words, 7 for 10 words, 3 for 11 words, 1 for 12 words and 0 for 13 words available. */ -READ16_HANDLER(ibm8514_gpstatus_r) +READ16_MEMBER(s3_vga_device::ibm8514_gpstatus_r) { UINT16 ret = 0x0000; @@ -3335,7 +3470,7 @@ READ16_HANDLER(ibm8514_gpstatus_r) return ret; } -static void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw) +void s3_vga_device::ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw) { UINT32 offset; int x = 0; @@ -3380,7 +3515,7 @@ static void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw) } } -READ16_HANDLER(s3_gpstatus_r) +READ16_MEMBER(s3_vga_device::s3_gpstatus_r) { UINT16 ret = 0x0000; @@ -3480,7 +3615,7 @@ bit 0 (911-928) ~RD/WT. Read/Write Data. If set VRAM write operations are rectangle, which is copied repeatably to the destination rectangle. */ -WRITE16_HANDLER(ibm8514_cmd_w) +WRITE16_MEMBER(s3_vga_device::ibm8514_cmd_w) { int x,y; int pattern_x,pattern_y; @@ -3743,7 +3878,7 @@ WRITE16_HANDLER(ibm8514_cmd_w) } } -WRITE16_HANDLER(s3_cmd_w) +WRITE16_MEMBER(s3_vga_device::s3_cmd_w) { if(s3.enable_8514 != 0) ibm8514_cmd_w(space,offset,data,mem_mask); @@ -3760,12 +3895,12 @@ bit 0-11 DESTINATION Y-POSITION. During BITBLT operations this is the Y 0-13 (80 x+) LINE PARAMETER AXIAL STEP CONSTANT. Se above */ -READ16_HANDLER( ibm8514_desty_r ) +READ16_MEMBER(s3_vga_device::ibm8514_desty_r) { return ibm8514.line_axial_step; } -WRITE16_HANDLER( ibm8514_desty_w ) +WRITE16_MEMBER(s3_vga_device::ibm8514_desty_w) { ibm8514.line_axial_step = data; ibm8514.dest_y = data; @@ -3785,12 +3920,12 @@ bit 0-11 DESTINATION X-POSITION. During BITBLT operations this is the X 0-13 (80x +) LINE PARAMETER DIAGONAL STEP CONSTANT. Se above */ -READ16_HANDLER( ibm8514_destx_r ) +READ16_MEMBER(s3_vga_device::ibm8514_destx_r) { return ibm8514.line_diagonal_step; } -WRITE16_HANDLER( ibm8514_destx_w ) +WRITE16_MEMBER(s3_vga_device::ibm8514_destx_w) { ibm8514.line_diagonal_step = data; ibm8514.dest_x = data; @@ -3819,7 +3954,7 @@ Note: The upper byte must be written for the SSV command to be executed. 9EE9h before execution starts. A single 16bit write will do. If only one SSV is desired the other byte can be set to 0. */ -static void ibm8514_wait_draw_ssv() +void s3_vga_device::ibm8514_wait_draw_ssv() { UINT8 len = ibm8514.wait_vector_len; UINT8 dir = ibm8514.wait_vector_dir; @@ -3907,7 +4042,7 @@ static void ibm8514_wait_draw_ssv() } } -static void ibm8514_draw_ssv(UINT8 data) +void s3_vga_device::ibm8514_draw_ssv(UINT8 data) { UINT8 len = data & 0x0f; UINT8 dir = (data & 0xe0) >> 5; @@ -3916,12 +4051,12 @@ static void ibm8514_draw_ssv(UINT8 data) ibm8514_draw_vector(len,dir,draw); } -READ16_HANDLER(ibm8514_ssv_r) +READ16_MEMBER(s3_vga_device::ibm8514_ssv_r) { return ibm8514.ssv; } -WRITE16_HANDLER(ibm8514_ssv_w) +WRITE16_MEMBER(s3_vga_device::ibm8514_ssv_w) { ibm8514.ssv = data; @@ -3949,7 +4084,7 @@ WRITE16_HANDLER(ibm8514_ssv_w) if(LOG_8514) logerror("8514/A: Short Stroke Vector write %04x\n",data); } -static void ibm8514_wait_draw_vector() +void s3_vga_device::ibm8514_wait_draw_vector() { UINT8 len = ibm8514.wait_vector_len; UINT8 dir = ibm8514.wait_vector_dir; @@ -4028,64 +4163,64 @@ bit 0-10 (911/924) RECTANGLE WIDTH/LINE PARAMETER MAX. For BITBLT and independent axis). Must be positive. 0-11 (80x +) RECTANGLE WIDTH/LINE PARAMETER MAX. See above */ -READ16_HANDLER( s3_width_r ) +READ16_MEMBER(s3_vga_device::s3_width_r) { return s3.rect_width; } -WRITE16_HANDLER( s3_width_w ) +WRITE16_MEMBER(s3_vga_device::s3_width_w) { s3.rect_width = data & 0x1fff; if(LOG_8514) logerror("S3: Major Axis Pixel Count / Rectangle Width write %04x\n",data); } -READ16_HANDLER(ibm8514_currentx_r) +READ16_MEMBER(s3_vga_device::ibm8514_currentx_r) { return ibm8514.curr_x; } -WRITE16_HANDLER(ibm8514_currentx_w) +WRITE16_MEMBER(s3_vga_device::ibm8514_currentx_w) { ibm8514.curr_x = data; ibm8514.prev_x = data; if(LOG_8514) logerror("8514/A: Current X set to %04x (%i)\n",data,ibm8514.curr_x); } -READ16_HANDLER(ibm8514_currenty_r) +READ16_MEMBER(s3_vga_device::ibm8514_currenty_r) { return ibm8514.curr_y; } -WRITE16_HANDLER(ibm8514_currenty_w) +WRITE16_MEMBER(s3_vga_device::ibm8514_currenty_w) { ibm8514.curr_y = data; ibm8514.prev_y = data; if(LOG_8514) logerror("8514/A: Current Y set to %04x (%i)\n",data,ibm8514.curr_y); } -READ16_HANDLER(s3_fgcolour_r) +READ16_MEMBER(s3_vga_device::s3_fgcolour_r) { return s3.fgcolour; } -WRITE16_HANDLER(s3_fgcolour_w) +WRITE16_MEMBER(s3_vga_device::s3_fgcolour_w) { s3.fgcolour = data; if(LOG_8514) logerror("S3: Foreground Colour write %04x\n",data); } -READ16_HANDLER(s3_bgcolour_r) +READ16_MEMBER(s3_vga_device::s3_bgcolour_r) { return s3.bgcolour; } -WRITE16_HANDLER(s3_bgcolour_w) +WRITE16_MEMBER(s3_vga_device::s3_bgcolour_w) { s3.bgcolour = data; if(LOG_8514) logerror("S3: Background Colour write %04x\n",data); } -READ16_HANDLER( s3_multifunc_r ) +READ16_MEMBER(s3_vga_device::s3_multifunc_r ) { switch(s3.multifunc_sel) { @@ -4106,7 +4241,7 @@ READ16_HANDLER( s3_multifunc_r ) } } -WRITE16_HANDLER( s3_multifunc_w ) +WRITE16_MEMBER(s3_vga_device::s3_multifunc_w ) { switch(data & 0xf000) { @@ -4197,7 +4332,7 @@ bit 0-2 (911-928) READ-REG-SEL. Read Register Select. Selects the register } } -static void s3_wait_draw() +void s3_vga_device::s3_wait_draw() { int x, data_size = 8; UINT32 off; @@ -4381,29 +4516,29 @@ bit 0-3 Background MIX (BACKMIX). 2 BSS is Pixel Data from the PIX_TRANS register (E2E8h) 3 BSS is Bitmap Data (Source data from display buffer). */ -READ16_HANDLER(s3_backmix_r) +READ16_MEMBER(s3_vga_device::s3_backmix_r) { return s3.bgmix; } -WRITE16_HANDLER(s3_backmix_w) +WRITE16_MEMBER(s3_vga_device::s3_backmix_w) { s3.bgmix = data; if(LOG_8514) logerror("S3: BG Mix write %04x\n",data); } -READ16_HANDLER(s3_foremix_r) +READ16_MEMBER(s3_vga_device::s3_foremix_r) { return s3.fgmix; } -WRITE16_HANDLER(s3_foremix_w) +WRITE16_MEMBER(s3_vga_device::s3_foremix_w) { s3.fgmix = data; if(LOG_8514) logerror("S3: FG Mix write %04x\n",data); } -READ16_HANDLER(s3_pixel_xfer_r) +READ16_MEMBER(s3_vga_device::s3_pixel_xfer_r) { if(offset == 1) return (s3.pixel_xfer & 0xffff0000) >> 16; @@ -4411,7 +4546,7 @@ READ16_HANDLER(s3_pixel_xfer_r) return s3.pixel_xfer & 0x0000ffff; } -WRITE16_HANDLER(s3_pixel_xfer_w) +WRITE16_MEMBER(s3_vga_device::s3_pixel_xfer_w) { if(offset == 1) s3.pixel_xfer = (s3.pixel_xfer & 0x0000ffff) | (data << 16); @@ -4430,7 +4565,7 @@ WRITE16_HANDLER(s3_pixel_xfer_w) if(LOG_8514) logerror("S3: Pixel Transfer = %08x\n",s3.pixel_xfer); } -READ8_HANDLER( s3_mem_r ) +READ8_MEMBER(s3_vga_device::mem_r) { if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb32_en) { @@ -4452,10 +4587,10 @@ READ8_HANDLER( s3_mem_r ) } return data; } - return vga_mem_r(space,offset); + return vga_device::mem_r(space,offset,mem_mask); } -WRITE8_HANDLER( s3_mem_w ) +WRITE8_MEMBER(s3_vga_device::mem_w) { // bit 4 of CR53 enables memory-mapped I/O // 0xA0000-0xA7ffff maps to port 0xE2E8 (pixel transfer) @@ -4685,7 +4820,7 @@ WRITE8_HANDLER( s3_mem_w ) return; } - vga_mem_w(space,offset,data); + vga_device::mem_w(space,offset,data,mem_mask); } /****************************************** @@ -4694,91 +4829,91 @@ gamtor.c implementation (TODO: identify the video card) ******************************************/ -READ8_HANDLER(vga_gamtor_mem_r) +READ8_MEMBER(gamtor_vga_device::mem_r) { return vga.memory[offset]; } -WRITE8_HANDLER(vga_gamtor_mem_w) +WRITE8_MEMBER(gamtor_vga_device::mem_w) { vga.memory[offset] = data; } -READ8_HANDLER(vga_port_gamtor_03b0_r) +READ8_MEMBER(gamtor_vga_device::port_03b0_r) { UINT8 res; switch(offset) { default: - res = vga_port_03b0_r(space,offset ^ 3); + res = vga_device::port_03b0_r(space,offset ^ 3,mem_mask); break; } return res; } -WRITE8_HANDLER(vga_port_gamtor_03b0_w) +WRITE8_MEMBER(gamtor_vga_device::port_03b0_w) { switch(offset) { default: - vga_port_03b0_w(space,offset ^ 3,data); + vga_device::port_03b0_w(space,offset ^ 3,data,mem_mask); break; } } -READ8_HANDLER(vga_port_gamtor_03c0_r) +READ8_MEMBER(gamtor_vga_device::port_03c0_r) { UINT8 res; switch(offset) { default: - res = vga_port_03c0_r(space,offset ^ 3); + res = vga_device::port_03c0_r(space,offset ^ 3,mem_mask); break; } return res; } -WRITE8_HANDLER(vga_port_gamtor_03c0_w) +WRITE8_MEMBER(gamtor_vga_device::port_03c0_w) { switch(offset) { default: - vga_port_03c0_w(space,offset ^ 3,data); + vga_device::port_03c0_w(space,offset ^ 3,data,mem_mask); break; } } -READ8_HANDLER(vga_port_gamtor_03d0_r) +READ8_MEMBER(gamtor_vga_device::port_03d0_r) { UINT8 res; switch(offset) { default: - res = vga_port_03d0_r(space,offset ^ 3); + res = vga_device::port_03d0_r(space,offset ^ 3,mem_mask); break; } return res; } -WRITE8_HANDLER(vga_port_gamtor_03d0_w) +WRITE8_MEMBER(gamtor_vga_device::port_03d0_w) { switch(offset) { default: - vga_port_03d0_w(space,offset ^ 3,data); + vga_device::port_03d0_w(space,offset ^ 3,data,mem_mask); break; } } -static void ati_define_video_mode(running_machine &machine) +void ati_vga_device::ati_define_video_mode() { int clock; UINT8 clock_type; @@ -4849,10 +4984,10 @@ static void ati_define_video_mode(running_machine &machine) logerror("Invalid dot clock %i selected.\n",clock_type); } // logerror("ATI: Clock select type %i (%iHz / %i)\n",clock_type,clock,div); - recompute_params_clock(machine,divisor,clock / div); + recompute_params_clock(divisor,clock / div); } -READ8_HANDLER( ati_mem_r ) +READ8_MEMBER(ati_vga_device::mem_r) { if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en) { @@ -4860,10 +4995,10 @@ READ8_HANDLER( ati_mem_r ) return vga.memory[(offset+svga.bank_r*0x10000)]; } - return vga_mem_r(space,offset); + return vga_device::mem_r(space,offset,mem_mask); } -WRITE8_HANDLER( ati_mem_w ) +WRITE8_MEMBER(ati_vga_device::mem_w) { if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en) { @@ -4871,11 +5006,11 @@ WRITE8_HANDLER( ati_mem_w ) vga.memory[(offset+svga.bank_w*0x10000)] = data; } else - vga_mem_w(space,offset,data); + vga_device::mem_w(space,offset,data,mem_mask); } -READ8_DEVICE_HANDLER(ati_port_ext_r) +READ8_MEMBER(ati_vga_device::ati_port_ext_r) { UINT8 ret = 0xff; @@ -4894,7 +5029,7 @@ READ8_DEVICE_HANDLER(ati_port_ext_r) break; case 0x37: { - eeprom_device* eep = device->subdevice("ati_eeprom"); + eeprom_device* eep = subdevice("ati_eeprom"); ret = 0x00; ret |= eep->read_bit() << 3; } @@ -4907,7 +5042,7 @@ READ8_DEVICE_HANDLER(ati_port_ext_r) return ret; } -WRITE8_DEVICE_HANDLER(ati_port_ext_w) +WRITE8_MEMBER(ati_vga_device::ati_port_ext_w) { switch(offset) { @@ -4953,7 +5088,7 @@ WRITE8_DEVICE_HANDLER(ati_port_ext_w) case 0x33: // EEPROM if(data & 0x04) { - eeprom_device* eep = device->subdevice("ati_eeprom"); + eeprom_device* eep = subdevice("ati_eeprom"); if(eep != NULL) { eep->write_bit((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); @@ -4969,7 +5104,7 @@ WRITE8_DEVICE_HANDLER(ati_port_ext_w) } break; } - ati_define_video_mode(device->machine()); + ati_define_video_mode(); } /* @@ -4985,12 +5120,12 @@ bit 0 SENSE is the result of a wired-OR of 3 comparators, one This bit toggles every time a HSYNC pulse starts 3-15 Reserved(0) */ -READ16_HANDLER(ibm8514_status_r) +READ16_MEMBER(ati_vga_device::ibm8514_status_r) { - return vga_vblank(space.machine()) << 1; + return vga_vblank() << 1; } -WRITE16_HANDLER(ibm8514_htotal_w) +WRITE16_MEMBER(ati_vga_device::ibm8514_htotal_w) { ibm8514.htotal = data & 0x01ff; //vga.crtc.horz_total = data & 0x01ff; @@ -5017,10 +5152,10 @@ bit 0-3 Interrupt requests. These bits show the state of internal interrupt 8-11 CHIP_REV. Chip revision number. 12-15 (CT82c480) CHIP_ID. 0=CT 82c480. */ -READ16_HANDLER(ibm8514_substatus_r) +READ16_MEMBER(ati_vga_device::ibm8514_substatus_r) { // TODO: - if(vga_vblank(space.machine()) != 0) // not correct, but will do for now + if(vga_vblank() != 0) // not correct, but will do for now ibm8514.substatus |= 0x01; return ibm8514.substatus; } @@ -5042,125 +5177,125 @@ bit 0-3 Interrupt Reset. Write 1 to a bit to reset the interrupt. 12-13 CHPTEST. Used for chip testing. 14-15 Graphics Processor Control (GPCTRL). */ -WRITE16_HANDLER(ibm8514_subcontrol_w) +WRITE16_MEMBER(ati_vga_device::ibm8514_subcontrol_w) { ibm8514.subctrl = data; ibm8514.substatus &= ~(data & 0x0f); // reset interrupts // if(LOG_8514) logerror("8514/A: Subsystem control write %04x\n",data); } -READ16_HANDLER(ibm8514_subcontrol_r) +READ16_MEMBER(ati_vga_device::ibm8514_subcontrol_r) { return ibm8514.subctrl; } -READ16_HANDLER(ibm8514_htotal_r) +READ16_MEMBER(ati_vga_device::ibm8514_htotal_r) { return ibm8514.htotal; } -READ16_HANDLER(ibm8514_vtotal_r) +READ16_MEMBER(ati_vga_device::ibm8514_vtotal_r) { return ibm8514.vtotal; } -WRITE16_HANDLER(ibm8514_vtotal_w) +WRITE16_MEMBER(ati_vga_device::ibm8514_vtotal_w) { ibm8514.vtotal = data; // vga.crtc.vert_total = data; if(LOG_8514) logerror("8514/A: Vertical total write %04x\n",data); } -READ16_HANDLER(ibm8514_vdisp_r) +READ16_MEMBER(ati_vga_device::ibm8514_vdisp_r) { return ibm8514.vdisp; } -WRITE16_HANDLER(ibm8514_vdisp_w) +WRITE16_MEMBER(ati_vga_device::ibm8514_vdisp_w) { ibm8514.vdisp = data; // vga.crtc.vert_disp_end = data >> 3; if(LOG_8514) logerror("8514/A: Vertical Displayed write %04x\n",data); } -READ16_HANDLER(ibm8514_vsync_r) +READ16_MEMBER(ati_vga_device::ibm8514_vsync_r) { return ibm8514.vsync; } -WRITE16_HANDLER(ibm8514_vsync_w) +WRITE16_MEMBER(ati_vga_device::ibm8514_vsync_w) { ibm8514.vsync = data; if(LOG_8514) logerror("8514/A: Vertical Sync write %04x\n",data); } -READ16_HANDLER(mach8_ec0_r) +READ16_MEMBER(ati_vga_device::mach8_ec0_r) { return ibm8514.ec0; } -WRITE16_HANDLER(mach8_ec0_w) +WRITE16_MEMBER(ati_vga_device::mach8_ec0_w) { ibm8514.ec0 = data; if(LOG_8514) logerror("8514/A: Extended configuration 0 write %04x\n",data); } -READ16_HANDLER(mach8_ec1_r) +READ16_MEMBER(ati_vga_device::mach8_ec1_r) { return ibm8514.ec1; } -WRITE16_HANDLER(mach8_ec1_w) +WRITE16_MEMBER(ati_vga_device::mach8_ec1_w) { ibm8514.ec1 = data; if(LOG_8514) logerror("8514/A: Extended configuration 1 write %04x\n",data); } -READ16_HANDLER(mach8_ec2_r) +READ16_MEMBER(ati_vga_device::mach8_ec2_r) { return ibm8514.ec2; } -WRITE16_HANDLER(mach8_ec2_w) +WRITE16_MEMBER(ati_vga_device::mach8_ec2_w) { ibm8514.ec2 = data; if(LOG_8514) logerror("8514/A: Extended configuration 2 write %04x\n",data); } -READ16_HANDLER(mach8_ec3_r) +READ16_MEMBER(ati_vga_device::mach8_ec3_r) { return ibm8514.ec3; } -WRITE16_HANDLER(mach8_ec3_w) +WRITE16_MEMBER(ati_vga_device::mach8_ec3_w) { ibm8514.ec3 = data; if(LOG_8514) logerror("8514/A: Extended configuration 3 write %04x\n",data); } -READ16_HANDLER(mach8_ext_fifo_r) +READ16_MEMBER(ati_vga_device::mach8_ext_fifo_r) { return 0x00; // for now, report all FIFO slots at free } -WRITE16_HANDLER(mach8_linedraw_index_w) +WRITE16_MEMBER(ati_vga_device::mach8_linedraw_index_w) { ati.linedraw = data & 0x07; if(LOG_8514) logerror("Mach8: Line Draw Index write %04x\n",data); } -READ16_HANDLER(mach8_bresenham_count_r) +READ16_MEMBER(ati_vga_device::mach8_bresenham_count_r) { return s3.rect_width & 0x1fff; } -WRITE16_HANDLER(mach8_bresenham_count_w) +WRITE16_MEMBER(ati_vga_device::mach8_bresenham_count_w) { s3.rect_width = data & 0x1fff; if(LOG_8514) logerror("Mach8: Bresenham count write %04x\n",data); } -WRITE16_HANDLER(mach8_linedraw_w) +WRITE16_MEMBER(ati_vga_device::mach8_linedraw_w) { // TODO: actually draw the lines switch(ati.linedraw) @@ -5193,23 +5328,23 @@ WRITE16_HANDLER(mach8_linedraw_w) logerror("ATI: Linedraw register write %04x, mode %i\n",data,ati.linedraw); } -READ16_HANDLER(mach8_scratch0_r) +READ16_MEMBER(ati_vga_device::mach8_scratch0_r) { return ati.scratch0; } -WRITE16_HANDLER(mach8_scratch0_w) +WRITE16_MEMBER(ati_vga_device::mach8_scratch0_w) { ati.scratch0 = data; if(LOG_8514) logerror("Mach8: Scratch Pad 0 write %04x\n",data); } -READ16_HANDLER(mach8_scratch1_r) +READ16_MEMBER(ati_vga_device::mach8_scratch1_r) { return ati.scratch1; } -WRITE16_HANDLER(mach8_scratch1_w) +WRITE16_MEMBER(ati_vga_device::mach8_scratch1_w) { ati.scratch1 = data; if(LOG_8514) logerror("Mach8: Scratch Pad 1 write %04x\n",data); @@ -5228,7 +5363,7 @@ bit 0 CLK_MODE. Set to use clock chip, clear to use crystals. 9-15 ROM_LOCATION. If bit 2 and 3 are 0 the ROM will be at this location: 0: C000h, 1: C080h, 2: C100h, .. 127: FF80h (unlikely) */ -READ16_HANDLER(mach8_config1_r) +READ16_MEMBER(ati_vga_device::mach8_config1_r) { return 0x0082; } @@ -5241,7 +5376,7 @@ bit 0 SHARE_CLOCK. If set the Mach8 shares clock with the VGA 3 WRITE_PER_BIT. Write masked VRAM operations supported if set 4 FLASH_ENA. Flash page writes supported if set */ -READ16_HANDLER(mach8_config2_r) +READ16_MEMBER(ati_vga_device::mach8_config2_r) { return 0x0002; } @@ -5252,7 +5387,7 @@ Cirrus SVGA card implementation ******************************************/ -static void cirrus_define_video_mode(running_machine &machine) +void cirrus_vga_device::cirrus_define_video_mode() { svga.rgb8_en = 0; svga.rgb15_en = 0; @@ -5272,7 +5407,7 @@ static void cirrus_define_video_mode(running_machine &machine) } } -static UINT8 cirrus_seq_reg_read(running_machine &machine, UINT8 index) + UINT8 cirrus_vga_device::cirrus_seq_reg_read(UINT8 index) { UINT8 res; @@ -5295,12 +5430,12 @@ static UINT8 cirrus_seq_reg_read(running_machine &machine, UINT8 index) return res; } -static void cirrus_seq_reg_write(running_machine &machine, UINT8 index, UINT8 data) +void cirrus_vga_device::cirrus_seq_reg_write(UINT8 index, UINT8 data) { if(index <= 0x04) { vga.sequencer.data[vga.sequencer.index] = data; - seq_reg_write(machine,vga.sequencer.index,data); + seq_reg_write(vga.sequencer.index,data); } else { @@ -5314,33 +5449,33 @@ static void cirrus_seq_reg_write(running_machine &machine, UINT8 index, UINT8 da } } } -READ8_HANDLER(cirrus_03c0_r) +READ8_MEMBER(cirrus_vga_device::port_03c0_r) { UINT8 res; switch(offset) { case 0x05: - res = cirrus_seq_reg_read(space.machine(),vga.sequencer.index); + res = cirrus_seq_reg_read(vga.sequencer.index); break; default: - res = vga_port_03c0_r(space,offset); + res = vga_device::port_03c0_r(space,offset,mem_mask); break; } return res; } -WRITE8_HANDLER(cirrus_03c0_w) +WRITE8_MEMBER(cirrus_vga_device::port_03c0_w) { switch(offset) { case 0x05: - cirrus_seq_reg_write(space.machine(),vga.sequencer.index,data); + cirrus_seq_reg_write(vga.sequencer.index,data); break; default: - vga_port_03c0_w(space,offset,data); + vga_device::port_03c0_w(space,offset,data,mem_mask); break; } - cirrus_define_video_mode(space.machine()); + cirrus_define_video_mode(); } diff --git a/src/emu/video/pc_vga.h b/src/emu/video/pc_vga.h index 1da412a0468..65c44f52a71 100644 --- a/src/emu/video/pc_vga.h +++ b/src/emu/video/pc_vga.h @@ -10,132 +10,319 @@ #define PC_VGA_H MACHINE_CONFIG_EXTERN( pcvideo_vga ); -MACHINE_CONFIG_EXTERN( pcvideo_vga_isa ); -MACHINE_CONFIG_EXTERN( pcvideo_s3_isa ); -MACHINE_CONFIG_EXTERN( pcvideo_ati_isa ); +MACHINE_CONFIG_EXTERN( pcvideo_trident_vga ); +MACHINE_CONFIG_EXTERN( pcvideo_gamtor_vga ); +MACHINE_CONFIG_EXTERN( pcvideo_cirrus_vga ); -VIDEO_START( vga ); -void pc_vga_init(running_machine &machine, read8_delegate read_dipswitch); -void pc_vga_cirrus_init(running_machine &machine, read8_delegate read_dipswitch); -void pc_vga_reset(running_machine &machine); -void pc_video_start(running_machine &machine); -void s3_video_start(running_machine &machine); +// ======================> vga_device -DECLARE_READ8_HANDLER(vga_port_03b0_r); -DECLARE_READ8_HANDLER(vga_port_03c0_r); -DECLARE_READ8_HANDLER(vga_port_03d0_r); -DECLARE_READ8_HANDLER(vga_mem_r); -DECLARE_READ8_HANDLER(vga_mem_linear_r); -DECLARE_WRITE8_HANDLER(vga_port_03b0_w); -DECLARE_WRITE8_HANDLER(vga_port_03c0_w); -DECLARE_WRITE8_HANDLER(vga_port_03d0_w); -DECLARE_WRITE8_HANDLER(vga_mem_w); -DECLARE_WRITE8_HANDLER(vga_mem_linear_w); +class vga_device : public device_t +{ +public: + // construction/destruction + vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); -/* per-device implementations */ -DECLARE_READ8_HANDLER(tseng_et4k_03b0_r); -DECLARE_WRITE8_HANDLER(tseng_et4k_03b0_w); -DECLARE_READ8_HANDLER(tseng_et4k_03c0_r); -DECLARE_WRITE8_HANDLER(tseng_et4k_03c0_w); -DECLARE_READ8_HANDLER(tseng_et4k_03d0_r); -DECLARE_WRITE8_HANDLER(tseng_et4k_03d0_w); -DECLARE_READ8_HANDLER(tseng_mem_r); -DECLARE_WRITE8_HANDLER(tseng_mem_w); -DECLARE_READ8_HANDLER(trident_03c0_r); -DECLARE_WRITE8_HANDLER(trident_03c0_w); -DECLARE_READ8_HANDLER(trident_03d0_r); -DECLARE_WRITE8_HANDLER(trident_03d0_w); -DECLARE_READ8_HANDLER(trident_mem_r); -DECLARE_WRITE8_HANDLER(trident_mem_w); + virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + virtual READ8_MEMBER(port_03b0_r); + virtual WRITE8_MEMBER(port_03b0_w); + virtual READ8_MEMBER(port_03c0_r); + virtual WRITE8_MEMBER(port_03c0_w); + virtual READ8_MEMBER(port_03d0_r); + virtual WRITE8_MEMBER(port_03d0_w); + virtual READ8_MEMBER(mem_r); + virtual WRITE8_MEMBER(mem_w); + virtual READ8_MEMBER(mem_linear_r); + virtual WRITE8_MEMBER(mem_linear_w); +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); -DECLARE_READ8_HANDLER(s3_port_03b0_r); -DECLARE_WRITE8_HANDLER(s3_port_03b0_w); -DECLARE_READ8_HANDLER(s3_port_03c0_r); -DECLARE_WRITE8_HANDLER(s3_port_03c0_w); -DECLARE_READ8_HANDLER(s3_port_03d0_r); -DECLARE_WRITE8_HANDLER(s3_port_03d0_w); -DECLARE_READ16_HANDLER(s3_gpstatus_r); -DECLARE_WRITE16_HANDLER(s3_cmd_w); -DECLARE_READ16_HANDLER(ibm8514_ssv_r); -DECLARE_WRITE16_HANDLER(ibm8514_ssv_w); -DECLARE_READ16_HANDLER(ibm8514_desty_r); -DECLARE_WRITE16_HANDLER(ibm8514_desty_w); -DECLARE_READ16_HANDLER(ibm8514_destx_r); -DECLARE_WRITE16_HANDLER(ibm8514_destx_w); -DECLARE_READ16_HANDLER(ibm8514_currentx_r); -DECLARE_WRITE16_HANDLER(ibm8514_currentx_w); -DECLARE_READ16_HANDLER(ibm8514_currenty_r); -DECLARE_WRITE16_HANDLER(ibm8514_currenty_w); -DECLARE_READ16_HANDLER(s3_line_error_r); -DECLARE_WRITE16_HANDLER(s3_line_error_w); -DECLARE_READ16_HANDLER(s3_width_r); -DECLARE_WRITE16_HANDLER(s3_width_w); -DECLARE_READ16_HANDLER(s3_multifunc_r); -DECLARE_WRITE16_HANDLER(s3_multifunc_w); -DECLARE_READ16_HANDLER(s3_fgcolour_r); -DECLARE_WRITE16_HANDLER(s3_fgcolour_w); -DECLARE_READ16_HANDLER(s3_bgcolour_r); -DECLARE_WRITE16_HANDLER(s3_bgcolour_w); -DECLARE_READ16_HANDLER(s3_backmix_r); -DECLARE_WRITE16_HANDLER(s3_backmix_w); -DECLARE_READ16_HANDLER(s3_foremix_r); -DECLARE_WRITE16_HANDLER(s3_foremix_w); -DECLARE_READ16_HANDLER(s3_pixel_xfer_r); -DECLARE_WRITE16_HANDLER(s3_pixel_xfer_w); -DECLARE_READ8_HANDLER(s3_mem_r); -DECLARE_WRITE8_HANDLER(s3_mem_w); + void vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vga_vh_ega(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect); + virtual UINT8 pc_vga_choosevideomode(); + void recompute_params_clock(int divisor, int xtal); + UINT8 crtc_reg_read(UINT8 index); + void recompute_params(); + void crtc_reg_write(UINT8 index, UINT8 data); + void seq_reg_write(UINT8 index, UINT8 data); + UINT8 vga_vblank(); + READ8_MEMBER(vga_crtc_r); + WRITE8_MEMBER(vga_crtc_w); + UINT8 gc_reg_read(UINT8 index); + void attribute_reg_write(UINT8 index, UINT8 data); + void gc_reg_write(UINT8 index,UINT8 data); +private: + inline UINT8 rotate_right(UINT8 val); + inline UINT8 vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask); + inline UINT8 vga_latch_write(int offs, UINT8 data); +}; -DECLARE_READ8_HANDLER( ati_port_03c0_r ); -DECLARE_READ8_DEVICE_HANDLER(ati_port_ext_r); -DECLARE_WRITE8_DEVICE_HANDLER(ati_port_ext_w); -DECLARE_READ16_HANDLER(ibm8514_gpstatus_r); -DECLARE_WRITE16_HANDLER(ibm8514_cmd_w); -DECLARE_READ16_HANDLER(mach8_ext_fifo_r); -DECLARE_WRITE16_HANDLER(mach8_linedraw_index_w); -DECLARE_READ16_HANDLER(mach8_bresenham_count_r); -DECLARE_WRITE16_HANDLER(mach8_bresenham_count_w); -DECLARE_READ16_HANDLER(mach8_scratch0_r); -DECLARE_WRITE16_HANDLER(mach8_scratch0_w); -DECLARE_READ16_HANDLER(mach8_scratch1_r); -DECLARE_WRITE16_HANDLER(mach8_scratch1_w); -DECLARE_READ16_HANDLER(mach8_config1_r); -DECLARE_READ16_HANDLER(mach8_config2_r); -DECLARE_READ16_HANDLER(ibm8514_status_r); -DECLARE_READ16_HANDLER(ibm8514_substatus_r); -DECLARE_WRITE16_HANDLER(ibm8514_subcontrol_w); -DECLARE_READ16_HANDLER(ibm8514_subcontrol_r); -DECLARE_READ16_HANDLER(ibm8514_htotal_r); -DECLARE_WRITE16_HANDLER(ibm8514_htotal_w); -DECLARE_READ16_HANDLER(ibm8514_vtotal_r); -DECLARE_WRITE16_HANDLER(ibm8514_vtotal_w); -DECLARE_READ16_HANDLER(ibm8514_vdisp_r); -DECLARE_WRITE16_HANDLER(ibm8514_vdisp_w); -DECLARE_READ16_HANDLER(ibm8514_vsync_r); -DECLARE_WRITE16_HANDLER(ibm8514_vsync_w); -DECLARE_WRITE16_HANDLER(mach8_linedraw_w); -DECLARE_READ16_HANDLER(mach8_ec0_r); -DECLARE_WRITE16_HANDLER(mach8_ec0_w); -DECLARE_READ16_HANDLER(mach8_ec1_r); -DECLARE_WRITE16_HANDLER(mach8_ec1_w); -DECLARE_READ16_HANDLER(mach8_ec2_r); -DECLARE_WRITE16_HANDLER(mach8_ec2_w); -DECLARE_READ16_HANDLER(mach8_ec3_r); -DECLARE_WRITE16_HANDLER(mach8_ec3_w); -DECLARE_READ8_HANDLER(ati_mem_r); -DECLARE_WRITE8_HANDLER(ati_mem_w); -DECLARE_READ8_HANDLER(cirrus_03c0_r); -DECLARE_WRITE8_HANDLER(cirrus_03c0_w); +// device type definition +extern const device_type VGA; -DECLARE_READ8_HANDLER(vga_gamtor_mem_r); -DECLARE_WRITE8_HANDLER(vga_gamtor_mem_w); -DECLARE_READ8_HANDLER(vga_port_gamtor_03b0_r); -DECLARE_WRITE8_HANDLER(vga_port_gamtor_03b0_w); -DECLARE_READ8_HANDLER(vga_port_gamtor_03c0_r); -DECLARE_WRITE8_HANDLER(vga_port_gamtor_03c0_w); -DECLARE_READ8_HANDLER(vga_port_gamtor_03d0_r); -DECLARE_WRITE8_HANDLER(vga_port_gamtor_03d0_w); +// ======================> svga_device + +class svga_device : public vga_device +{ +public: + // construction/destruction + svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + + virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + void svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect); + virtual UINT8 pc_vga_choosevideomode(); +private: +}; + +// ======================> tseng_vga_device + +class tseng_vga_device : public svga_device +{ +public: + // construction/destruction + tseng_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual READ8_MEMBER(port_03b0_r); + virtual WRITE8_MEMBER(port_03b0_w); + virtual READ8_MEMBER(port_03c0_r); + virtual WRITE8_MEMBER(port_03c0_w); + virtual READ8_MEMBER(port_03d0_r); + virtual WRITE8_MEMBER(port_03d0_w); + virtual READ8_MEMBER(mem_r); + virtual WRITE8_MEMBER(mem_w); + +protected: + +private: + void tseng_define_video_mode(); + UINT8 tseng_crtc_reg_read(UINT8 index); + void tseng_crtc_reg_write(UINT8 index, UINT8 data); + UINT8 tseng_seq_reg_read(UINT8 index); + void tseng_seq_reg_write(UINT8 index, UINT8 data); + +}; + + +// device type definition +extern const device_type TSENG_VGA; + +// ======================> trident_vga_device + +class trident_vga_device : public svga_device +{ +public: + // construction/destruction + trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual READ8_MEMBER(port_03c0_r); + virtual WRITE8_MEMBER(port_03c0_w); + virtual READ8_MEMBER(port_03d0_r); + virtual WRITE8_MEMBER(port_03d0_w); + virtual READ8_MEMBER(mem_r); + virtual WRITE8_MEMBER(mem_w); + +protected: + +private: + UINT8 trident_seq_reg_read(UINT8 index); + void trident_seq_reg_write(UINT8 index, UINT8 data); + +}; + + +// device type definition +extern const device_type TRIDENT_VGA; + + +// ======================> s3_vga_device + +class s3_vga_device : public svga_device +{ +public: + // construction/destruction + s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock); + + virtual READ8_MEMBER(port_03b0_r); + virtual WRITE8_MEMBER(port_03b0_w); + virtual READ8_MEMBER(port_03c0_r); + virtual WRITE8_MEMBER(port_03c0_w); + virtual READ8_MEMBER(port_03d0_r); + virtual WRITE8_MEMBER(port_03d0_w); + virtual READ8_MEMBER(mem_r); + virtual WRITE8_MEMBER(mem_w); + + virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + READ16_MEMBER(s3_line_error_r); + WRITE16_MEMBER(s3_line_error_w); + READ16_MEMBER(ibm8514_gpstatus_r); + READ16_MEMBER(s3_gpstatus_r); + WRITE16_MEMBER(ibm8514_cmd_w); + WRITE16_MEMBER(s3_cmd_w); + READ16_MEMBER(ibm8514_desty_r); + WRITE16_MEMBER(ibm8514_desty_w); + READ16_MEMBER(ibm8514_destx_r); + WRITE16_MEMBER(ibm8514_destx_w); + READ16_MEMBER(ibm8514_ssv_r); + WRITE16_MEMBER(ibm8514_ssv_w); + READ16_MEMBER(s3_width_r); + WRITE16_MEMBER(s3_width_w); + READ16_MEMBER(ibm8514_currentx_r); + WRITE16_MEMBER(ibm8514_currentx_w); + READ16_MEMBER(ibm8514_currenty_r); + WRITE16_MEMBER(ibm8514_currenty_w); + READ16_MEMBER(s3_fgcolour_r); + WRITE16_MEMBER(s3_fgcolour_w); + READ16_MEMBER(s3_bgcolour_r); + WRITE16_MEMBER(s3_bgcolour_w); + READ16_MEMBER(s3_multifunc_r); + WRITE16_MEMBER(s3_multifunc_w); + READ16_MEMBER(s3_backmix_r); + WRITE16_MEMBER(s3_backmix_w); + READ16_MEMBER(s3_foremix_r); + WRITE16_MEMBER(s3_foremix_w); + READ16_MEMBER(s3_pixel_xfer_r); + WRITE16_MEMBER(s3_pixel_xfer_w); + +protected: + // device-level overrides + virtual void device_start(); + +private: + UINT8 s3_crtc_reg_read(UINT8 index); + void s3_define_video_mode(void); + void s3_crtc_reg_write(UINT8 index, UINT8 data); + void s3_write_fg(UINT32 offset); + void s3_write_bg(UINT32 offset); + void s3_write(UINT32 offset, UINT32 src); + void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw); + void ibm8514_wait_draw_ssv(); + void ibm8514_draw_ssv(UINT8 data); + void ibm8514_wait_draw_vector(); + void s3_wait_draw(); +}; + + +// device type definition +extern const device_type S3_VGA; + + +// ======================> gamtor_vga_device + +class gamtor_vga_device : public svga_device +{ +public: + // construction/destruction + gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + + virtual READ8_MEMBER(port_03b0_r); + virtual WRITE8_MEMBER(port_03b0_w); + virtual READ8_MEMBER(port_03c0_r); + virtual WRITE8_MEMBER(port_03c0_w); + virtual READ8_MEMBER(port_03d0_r); + virtual WRITE8_MEMBER(port_03d0_w); + virtual READ8_MEMBER(mem_r); + virtual WRITE8_MEMBER(mem_w); + +protected: +private: +}; + + +// device type definition +extern const device_type GAMTOR_VGA; + +// ======================> ati_vga_device + +class ati_vga_device : public s3_vga_device +{ +public: + // construction/destruction + ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual READ8_MEMBER(mem_r); + virtual WRITE8_MEMBER(mem_w); + virtual READ8_MEMBER(port_03c0_r); + READ8_MEMBER(ati_port_ext_r); + WRITE8_MEMBER(ati_port_ext_w); + READ16_MEMBER(ibm8514_status_r); + WRITE16_MEMBER(ibm8514_htotal_w); + READ16_MEMBER(ibm8514_substatus_r); + WRITE16_MEMBER(ibm8514_subcontrol_w); + READ16_MEMBER(ibm8514_subcontrol_r); + READ16_MEMBER(ibm8514_htotal_r); + READ16_MEMBER(ibm8514_vtotal_r); + WRITE16_MEMBER(ibm8514_vtotal_w); + READ16_MEMBER(ibm8514_vdisp_r); + WRITE16_MEMBER(ibm8514_vdisp_w); + READ16_MEMBER(ibm8514_vsync_r); + WRITE16_MEMBER(ibm8514_vsync_w); + READ16_MEMBER(mach8_ec0_r); + WRITE16_MEMBER(mach8_ec0_w); + READ16_MEMBER(mach8_ec1_r); + WRITE16_MEMBER(mach8_ec1_w); + READ16_MEMBER(mach8_ec2_r); + WRITE16_MEMBER(mach8_ec2_w); + READ16_MEMBER(mach8_ec3_r); + WRITE16_MEMBER(mach8_ec3_w); + READ16_MEMBER(mach8_ext_fifo_r); + WRITE16_MEMBER(mach8_linedraw_index_w); + READ16_MEMBER(mach8_bresenham_count_r); + WRITE16_MEMBER(mach8_bresenham_count_w); + WRITE16_MEMBER(mach8_linedraw_w); + READ16_MEMBER(mach8_scratch0_r); + WRITE16_MEMBER(mach8_scratch0_w); + READ16_MEMBER(mach8_scratch1_r); + WRITE16_MEMBER(mach8_scratch1_w); + READ16_MEMBER(mach8_config1_r); + READ16_MEMBER(mach8_config2_r); +protected: + virtual machine_config_constructor device_mconfig_additions() const; +private: + void ati_define_video_mode(); + +}; + + +// device type definition +extern const device_type ATI_VGA; + +// ======================> cirrus_vga_device + +class cirrus_vga_device : public svga_device +{ +public: + // construction/destruction + cirrus_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual READ8_MEMBER(port_03c0_r); + virtual WRITE8_MEMBER(port_03c0_w); +protected: + // device-level overrides + virtual void device_start(); +private: + void cirrus_define_video_mode(); + UINT8 cirrus_seq_reg_read(UINT8 index); + void cirrus_seq_reg_write(UINT8 index, UINT8 data); +}; + +// device type definition +extern const device_type CIRRUS_VGA; /* pega notes (paradise) build in amstrad pc1640 diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c index b60ba918c42..04285f11083 100644 --- a/src/mame/drivers/calchase.c +++ b/src/mame/drivers/calchase.c @@ -175,7 +175,6 @@ public: DECLARE_DRIVER_INIT(calchase); virtual void machine_start(); virtual void machine_reset(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -543,7 +542,7 @@ WRITE16_MEMBER(calchase_state::calchase_dac_r_w) static ADDRESS_MAP_START( calchase_map, AS_PROGRAM, 32, calchase_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(trident_mem_r, trident_mem_w, 0xffffffff) // VGA VRAM + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", trident_vga_device, mem_r, mem_w, 0xffffffff) // VGA VRAM AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) AM_RANGE(0x000c8000, 0x000cffff) AM_NOP //AM_RANGE(0x000d0000, 0x000d0003) AM_RAM // XYLINX - Sincronus serial communication @@ -600,9 +599,9 @@ static ADDRESS_MAP_START( calchase_io, AS_IO, 32, calchase_state ) AM_RANGE(0x02f8, 0x02ff) AM_NOP //To debug AM_RANGE(0x0320, 0x038f) AM_NOP //To debug AM_RANGE(0x03a0, 0x03a7) AM_NOP //To debug - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(trident_03c0_r, trident_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(trident_03d0_r, trident_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", trident_vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03e0, 0x03ef) AM_NOP //To debug AM_RANGE(0x0378, 0x037f) AM_NOP //To debug // AM_RANGE(0x0300, 0x03af) AM_NOP @@ -808,8 +807,6 @@ static IRQ_CALLBACK(irq_callback) return pic8259_acknowledge( state->m_pic8259_1); } -READ8_MEMBER( calchase_state::vga_setting ) { return 0xff; } // hard-code to color - void calchase_state::machine_start() { machine().device("maincpu")->execute().set_irq_acknowledge_callback(irq_callback); @@ -948,7 +945,7 @@ static MACHINE_CONFIG_START( calchase, calchase_state ) MCFG_PCI_BUS_LEGACY_DEVICE(7, NULL, intel82371ab_pci_r, intel82371ab_pci_w) /* video hardware */ - MCFG_FRAGMENT_ADD( pcvideo_vga ) + MCFG_FRAGMENT_ADD( pcvideo_trident_vga ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") @@ -980,7 +977,6 @@ DRIVER_INIT_MEMBER(calchase_state,calchase) { m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4); - pc_vga_init(machine(), read8_delegate(FUNC(calchase_state::vga_setting),this)); init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int); intel82439tx_init(machine()); diff --git a/src/mame/drivers/gammagic.c b/src/mame/drivers/gammagic.c index 1a80961ade0..11244897728 100644 --- a/src/mame/drivers/gammagic.c +++ b/src/mame/drivers/gammagic.c @@ -103,7 +103,6 @@ public: UINT8 m_atapi_data[ATAPI_DATA_SIZE]; DECLARE_DRIVER_INIT(gammagic); - DECLARE_READ8_MEMBER(vga_setting); }; //static void atapi_irq(running_machine &machine, int state); @@ -545,7 +544,7 @@ static WRITE32_HANDLER( atapi_w ) // Memory is mostly handled by the chipset static ADDRESS_MAP_START( gammagic_map, AS_PROGRAM, 32, gammagic_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x00100000, 0x07ffffff) AM_RAM AM_RANGE(0x08000000, 0xfffdffff) AM_NOP AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user", 0x20000)/* System BIOS */ @@ -564,9 +563,9 @@ static ADDRESS_MAP_START( gammagic_io, AS_IO, 32, gammagic_state) AM_RANGE(0x00f0, 0x01ef) AM_NOP //AM_RANGE(0x01f0, 0x01f7) AM_READWRITE_LEGACY(atapi_r, atapi_w) AM_RANGE(0x01f8, 0x03ef) AM_NOP - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f0, 0x0cf7) AM_NOP AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write) AM_RANGE(0x0400, 0xffff) AM_NOP @@ -629,8 +628,6 @@ static IRQ_CALLBACK(irq_callback) return pic8259_acknowledge( state->m_pic8259_1); } -READ8_MEMBER( gammagic_state::vga_setting ) { return 0xff; } // hard-code to color - static MACHINE_START(gammagic) { gammagic_state *state = machine.driver_data(); @@ -798,7 +795,6 @@ MACHINE_CONFIG_END DRIVER_INIT_MEMBER(gammagic_state,gammagic) { - pc_vga_init(machine(), read8_delegate(FUNC(gammagic_state::vga_setting),this)); init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, gammagic_set_keyb_int); kbdc8042_init(machine(), &at8042); atapi_init(machine()); diff --git a/src/mame/drivers/gamtor.c b/src/mame/drivers/gamtor.c index fef687fcf08..7fa947ed79a 100644 --- a/src/mame/drivers/gamtor.c +++ b/src/mame/drivers/gamtor.c @@ -35,7 +35,6 @@ public: : driver_device(mconfig, type, tag){ } DECLARE_WRITE32_MEMBER(gamtor_unk_w); DECLARE_DRIVER_INIT(gaminator); - DECLARE_READ8_MEMBER(vga_setting); }; WRITE32_MEMBER(gaminator_state::gamtor_unk_w) @@ -54,11 +53,11 @@ static ADDRESS_MAP_START( gaminator_map, AS_PROGRAM, 32, gaminator_state ) /* standard VGA */ //AM_RANGE(0x40000000, 0x40000fff) AM_RAM // regs - AM_RANGE(0x400003b0, 0x400003bf) AM_READWRITE8_LEGACY(vga_port_gamtor_03b0_r, vga_port_gamtor_03b0_w, 0xffffffff) - AM_RANGE(0x400003c0, 0x400003cf) AM_READWRITE8_LEGACY(vga_port_gamtor_03c0_r, vga_port_gamtor_03c0_w, 0xffffffff) - AM_RANGE(0x400003d0, 0x400003df) AM_READWRITE8_LEGACY(vga_port_gamtor_03d0_r, vga_port_gamtor_03d0_w, 0xffffffff) + AM_RANGE(0x400003b0, 0x400003bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x400003c0, 0x400003cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x400003d0, 0x400003df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) - AM_RANGE(0x44000000, 0x4401ffff) AM_READWRITE8_LEGACY(vga_gamtor_mem_r,vga_gamtor_mem_w, 0xffffffff) // VRAM + AM_RANGE(0x44000000, 0x4401ffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) // VRAM // AM_RANGE(0x44000000, 0x44007fff) AM_RAM AM_SHARE("tmapram1") // puts strings here, looks almost like a tilemap, but where are the tiles? // AM_RANGE(0x440a0000, 0x440a1fff) AM_RAM AM_SHARE("tmapram2") // beetlem (like above, mirror?) @@ -77,7 +76,7 @@ static MACHINE_CONFIG_START( gaminator, gaminator_state ) MCFG_CPU_PROGRAM_MAP(gaminator_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", gaminator_state, irq6_line_hold) // irq6 seems to be needed to get past the ROM checking - MCFG_FRAGMENT_ADD( pcvideo_vga ) + MCFG_FRAGMENT_ADD( pcvideo_gamtor_vga ) MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") /* unknown sound */ @@ -1253,12 +1252,8 @@ ROM_START( llcharma ) ROM_LOAD( "llc_92_5.6-0", 0x0000, 0x2000000, CRC(c8c2a5d3) SHA1(ec23eff63871cc515ec58a894446d4d639d864e4) ) ROM_END -READ8_MEMBER(gaminator_state::vga_setting ) { return 0xff; } // hard-code to color - - DRIVER_INIT_MEMBER(gaminator_state,gaminator) { - pc_vga_init(machine(), read8_delegate(FUNC(gaminator_state::vga_setting),this)); } diff --git a/src/mame/drivers/magtouch.c b/src/mame/drivers/magtouch.c index b9ff99128a6..d13c0aa5111 100644 --- a/src/mame/drivers/magtouch.c +++ b/src/mame/drivers/magtouch.c @@ -100,7 +100,6 @@ public: DECLARE_WRITE_LINE_MEMBER(at_com_interrupt_1); DECLARE_DRIVER_INIT(magtouch); virtual void machine_start(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -169,7 +168,7 @@ WRITE8_MEMBER(magtouch_state::magtouch_io_w) static ADDRESS_MAP_START( magtouch_map, AS_PROGRAM, 32, magtouch_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_RANGE(0x000d8000, 0x000dffff) AM_ROMBANK("rombank") AM_RANGE(0x000f0000, 0x000fffff) AM_RAM AM_REGION("bios", 0 ) @@ -180,9 +179,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( magtouch_io, AS_IO, 32, magtouch_state ) AM_IMPORT_FROM(pcat32_io_common) AM_RANGE(0x02e0, 0x02e7) AM_READWRITE8(magtouch_io_r, magtouch_io_w, 0xffffffff) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff) ADDRESS_MAP_END @@ -200,8 +199,6 @@ static void magtouch_set_keyb_int(running_machine &machine, int state) pic8259_ir1_w(machine.device("pic8259_1"), state); } -READ8_MEMBER( magtouch_state::vga_setting ) { return 0xff; } // hard-code to color - void magtouch_state::machine_start() { machine().device("maincpu")->execute().set_irq_acknowledge_callback(pcat_irq_callback); @@ -252,7 +249,7 @@ ROM_END DRIVER_INIT_MEMBER(magtouch_state,magtouch) { - pc_vga_init(machine(), read8_delegate(FUNC(magtouch_state::vga_setting),this)); } + GAME( 1995, magtouch, 0, magtouch, magtouch, magtouch_state, magtouch, ROT0, "Micro Manufacturing", "Magical Touch", GAME_NOT_WORKING | GAME_NO_SOUND ) diff --git a/src/mame/drivers/midqslvr.c b/src/mame/drivers/midqslvr.c index 2fb1daebbce..6887b075d92 100644 --- a/src/mame/drivers/midqslvr.c +++ b/src/mame/drivers/midqslvr.c @@ -98,7 +98,6 @@ public: DECLARE_WRITE_LINE_MEMBER(midqslvr_pic8259_1_set_int_line); virtual void machine_start(); virtual void machine_reset(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -535,7 +534,7 @@ static I8237_INTERFACE( dma8237_2_config ) static ADDRESS_MAP_START(midqslvr_map, AS_PROGRAM, 32, midqslvr_state) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c3fff) AM_ROMBANK("video_bank1") AM_WRITE(isa_ram1_w) AM_RANGE(0x000c4000, 0x000c7fff) AM_ROMBANK("video_bank2") AM_WRITE(isa_ram2_w) AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1") AM_WRITE(bios_ext1_ram_w) @@ -559,9 +558,9 @@ static ADDRESS_MAP_START(midqslvr_io, AS_IO, 32, midqslvr_state) AM_RANGE(0x00e8, 0x00ef) AM_NOP AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w) AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) @@ -656,8 +655,6 @@ static void ide_interrupt(device_t *device, int state) pic8259_ir6_w(drvstate->m_pic8259_2, state); } -READ8_MEMBER( midqslvr_state::vga_setting ) { return 0xff; } // hard-code to color - void midqslvr_state::machine_start() { @@ -675,7 +672,6 @@ void midqslvr_state::machine_start() intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); - pc_vga_init(machine(), read8_delegate(FUNC(midqslvr_state::vga_setting),this)); } void midqslvr_state::machine_reset() diff --git a/src/mame/drivers/pangofun.c b/src/mame/drivers/pangofun.c index 427ad517b79..fa6dbf7cc1a 100644 --- a/src/mame/drivers/pangofun.c +++ b/src/mame/drivers/pangofun.c @@ -107,13 +107,12 @@ public: DECLARE_DRIVER_INIT(pangofun); virtual void machine_start(); - DECLARE_READ8_MEMBER(vga_setting); }; static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pangofun_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_RANGE(0x000f0000, 0x000fffff) AM_ROM AM_REGION("bios", 0 ) AM_RANGE(0x00100000, 0x00ffffff) AM_NOP @@ -124,9 +123,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pcat_io, AS_IO, 32, pangofun_state ) AM_IMPORT_FROM(pcat32_io_common) AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) ADDRESS_MAP_END #define AT_KEYB_HELPER(bit, text, key1) \ @@ -168,8 +167,6 @@ static void pangofun_set_keyb_int(running_machine &machine, int state) pic8259_ir1_w(machine.device("pic8259_1"), state); } -READ8_MEMBER(pangofun_state::vga_setting ) { return 0xff; } // hard-code to color - static void set_gate_a20(running_machine &machine, int a20) { machine.device("maincpu")->execute().set_input_line(INPUT_LINE_A20, a20); @@ -247,7 +244,6 @@ ROM_END DRIVER_INIT_MEMBER(pangofun_state,pangofun) { - pc_vga_init(machine(), read8_delegate(FUNC(pangofun_state::vga_setting),this)); } GAME( 1995, pangofun, 0, pangofun, pangofun, pangofun_state, pangofun, ROT0, "InfoCube", "Pango Fun (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/pcat_dyn.c b/src/mame/drivers/pcat_dyn.c index 4fe854e6316..4d4ee193e53 100644 --- a/src/mame/drivers/pcat_dyn.c +++ b/src/mame/drivers/pcat_dyn.c @@ -45,7 +45,6 @@ public: DECLARE_DRIVER_INIT(pcat_dyn); virtual void machine_start(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -53,7 +52,7 @@ public: /* TODO: understand the proper ROM loading.*/ static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pcat_dyn_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_RANGE(0x000c8000, 0x000cffff) AM_RAM // AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM AM_REGION("disk_bios", 0) @@ -69,9 +68,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pcat_io, AS_IO, 32, pcat_dyn_state ) AM_IMPORT_FROM(pcat32_io_common) AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) ADDRESS_MAP_END #define AT_KEYB_HELPER(bit, text, key1) \ @@ -113,8 +112,6 @@ static void pcat_dyn_set_keyb_int(running_machine &machine, int state) pic8259_ir1_w(machine.device("pic8259_1"), state); } -READ8_MEMBER(pcat_dyn_state::vga_setting ) { return 0xff; } // hard-code to color - static void set_gate_a20(running_machine &machine, int a20) { machine.device("maincpu")->execute().set_input_line(INPUT_LINE_A20, a20); @@ -200,7 +197,6 @@ ROM_END DRIVER_INIT_MEMBER(pcat_dyn_state,pcat_dyn) { - pc_vga_init(machine(), read8_delegate(FUNC(pcat_dyn_state::vga_setting),this)); } GAME( 1995, toursol, 0, pcat_dyn, pcat_dyn, pcat_dyn_state, pcat_dyn, ROT0, "Dynamo", "Tournament Solitaire (V1.06, 08/03/95)", GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/pcat_nit.c b/src/mame/drivers/pcat_nit.c index caa77a8761f..4c09f9b3272 100644 --- a/src/mame/drivers/pcat_nit.c +++ b/src/mame/drivers/pcat_nit.c @@ -112,7 +112,6 @@ public: DECLARE_WRITE_LINE_MEMBER(at_com_interrupt_1); DECLARE_DRIVER_INIT(pcat_nit); virtual void machine_start(); - DECLARE_READ8_MEMBER(vga_setting); }; WRITE_LINE_MEMBER(pcat_nit_state::microtouch_out) @@ -183,7 +182,7 @@ WRITE8_MEMBER(pcat_nit_state::pcat_nit_rombank_w) static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pcat_nit_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_WRITENOP AM_RANGE(0x000d0000, 0x000d3fff) AM_RAM AM_REGION("disk_bios", 0) AM_RANGE(0x000d7000, 0x000d7003) AM_WRITE8(pcat_nit_rombank_w, 0xff) @@ -211,9 +210,9 @@ static ADDRESS_MAP_START( pcat_nit_io, AS_IO, 32, pcat_nit_state ) AM_IMPORT_FROM(pcat32_io_common) AM_RANGE(0x0278, 0x027f) AM_READ8(pcat_nit_io_r, 0xffffffff) AM_WRITENOP AM_RANGE(0x0280, 0x0283) AM_READNOP - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff) ADDRESS_MAP_END @@ -231,8 +230,6 @@ static void streetg2_set_keyb_int(running_machine &machine, int state) pic8259_ir1_w(machine.device("pic8259_1"), state); } -READ8_MEMBER(pcat_nit_state::vga_setting ) { return 0xff; } // hard-code to color - void pcat_nit_state::machine_start() { machine().device("maincpu")->execute().set_irq_acknowledge_callback(pcat_irq_callback); @@ -429,8 +426,6 @@ DRIVER_INIT_MEMBER(pcat_nit_state,pcat_nit) { m_banked_nvram = auto_alloc_array(machine(), UINT8, 0x2000); machine().device("nvram")->set_base(m_banked_nvram, 0x2000); - - pc_vga_init(machine(), read8_delegate(FUNC(pcat_nit_state::vga_setting),this)); } GAME( 1993, bonanza, 0, pcat_nit, pcat_nit, pcat_nit_state, pcat_nit, ROT0, "New Image Technologies", "Bonanza (Revision 3)", GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/photoply.c b/src/mame/drivers/photoply.c index 7a6e5f85e58..04eb2f167a7 100644 --- a/src/mame/drivers/photoply.c +++ b/src/mame/drivers/photoply.c @@ -53,7 +53,6 @@ public: DECLARE_WRITE_LINE_MEMBER(at_pit8254_out2_changed); DECLARE_DRIVER_INIT(photoply); virtual void machine_start(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -240,7 +239,7 @@ static const struct pit8253_config at_pit8254_config = static ADDRESS_MAP_START( photoply_map, AS_PROGRAM, 32, photoply_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) // VGA RAM + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) // VGA RAM AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) //??? AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_REGION("video_bios", 0) AM_RANGE(0x000d0000, 0x000dffff) AM_RAM AM_REGION("ex_bios", 0) @@ -263,9 +262,9 @@ static ADDRESS_MAP_START( photoply_io, AS_IO, 32, photoply_state ) AM_RANGE(0x0278, 0x027f) AM_RAM //parallel port 2 AM_RANGE(0x0378, 0x037f) AM_RAM //parallel port //AM_RANGE(0x03bc, 0x03bf) AM_RAM //parallel port 3 - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) // AM_RANGE(0x03f4, 0x03f7) AM_READ_LEGACY(kludge_r) // fdc ADDRESS_MAP_END @@ -339,8 +338,6 @@ static GFXDECODE_START( photoply ) //there's also a 8x16 entry (just after the 8x8) GFXDECODE_END -READ8_MEMBER(photoply_state::vga_setting ) { return 0xff; } // hard-code to color - static MACHINE_CONFIG_START( photoply, photoply_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", I486, 75000000) /* I486DX4, 75 or 100 Mhz */ @@ -381,7 +378,6 @@ ROM_END DRIVER_INIT_MEMBER(photoply_state,photoply) { - pc_vga_init(machine(), read8_delegate(FUNC(photoply_state::vga_setting),this)); } GAME( 199?, photoply, 0, photoply, photoply, photoply_state, photoply, ROT0, "Funworld", "Photo Play 2000 (v2.01)", GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/pntnpuzl.c b/src/mame/drivers/pntnpuzl.c index 1ed4ef16134..f39ce68a4a3 100644 --- a/src/mame/drivers/pntnpuzl.c +++ b/src/mame/drivers/pntnpuzl.c @@ -153,7 +153,6 @@ public: DECLARE_READ16_MEMBER(pntnpuzl_eeprom_r); DECLARE_WRITE16_MEMBER(pntnpuzl_eeprom_w); DECLARE_DRIVER_INIT(pip); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -312,10 +311,10 @@ static ADDRESS_MAP_START( pntnpuzl_map, AS_PROGRAM, 16, pntnpuzl_state ) AM_RANGE(0x28001a, 0x28001b) AM_WRITENOP /* standard VGA */ - AM_RANGE(0x3a0000, 0x3bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffff) - AM_RANGE(0x3c03b0, 0x3c03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffff) - AM_RANGE(0x3c03c0, 0x3c03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffff) - AM_RANGE(0x3c03d0, 0x3c03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffff) + AM_RANGE(0x3a0000, 0x3bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffff) + AM_RANGE(0x3c03b0, 0x3c03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffff) + AM_RANGE(0x3c03c0, 0x3c03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffff) + AM_RANGE(0x3c03d0, 0x3c03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffff) AM_RANGE(0x400000, 0x407fff) AM_RAM ADDRESS_MAP_END @@ -359,8 +358,6 @@ static INPUT_PORTS_START( pntnpuzl ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) INPUT_PORTS_END -READ8_MEMBER(pntnpuzl_state::vga_setting ) { return 0xff; } // hard-code to color - static MACHINE_CONFIG_START( pntnpuzl, pntnpuzl_state ) MCFG_CPU_ADD("maincpu", M68000, 12000000)//?? MCFG_CPU_PROGRAM_MAP(pntnpuzl_map) @@ -387,7 +384,6 @@ DRIVER_INIT_MEMBER(pntnpuzl_state,pip) // UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base(); // rom[0x2696/2] = 0x4e71; // rom[0x26a0/2] = 0x4e71; - pc_vga_init(machine(), read8_delegate(FUNC(pntnpuzl_state::vga_setting),this)); } diff --git a/src/mame/drivers/queen.c b/src/mame/drivers/queen.c index c635f0b320c..5d8fd711435 100644 --- a/src/mame/drivers/queen.c +++ b/src/mame/drivers/queen.c @@ -95,7 +95,6 @@ public: DECLARE_WRITE8_MEMBER(at_page8_w); DECLARE_READ8_MEMBER(pc_dma_read_byte); DECLARE_WRITE8_MEMBER(pc_dma_write_byte); - DECLARE_READ8_MEMBER(vga_setting); DECLARE_READ32_MEMBER(ide_r); DECLARE_WRITE32_MEMBER(ide_w); DECLARE_READ32_MEMBER(fdc_r); @@ -518,7 +517,7 @@ static I8237_INTERFACE( dma8237_2_config ) static ADDRESS_MAP_START( queen_map, AS_PROGRAM, 32, queen_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c3fff) AM_ROMBANK("video_bank1") AM_WRITE(isa_ram1_w) AM_RANGE(0x000c4000, 0x000c7fff) AM_ROMBANK("video_bank2") AM_WRITE(isa_ram2_w) AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1") AM_WRITE(bios_ext1_ram_w) @@ -542,9 +541,9 @@ static ADDRESS_MAP_START( queen_io, AS_IO, 32, queen_state ) AM_RANGE(0x00e8, 0x00ef) AM_NOP AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w) AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) @@ -639,8 +638,6 @@ static void ide_interrupt(device_t *device, int state) pic8259_ir6_w(drvstate->m_pic8259_2, state); } -READ8_MEMBER(queen_state::vga_setting ) { return 0xff; } // hard-code to color - void queen_state::machine_start() { @@ -658,7 +655,6 @@ void queen_state::machine_start() intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); - pc_vga_init(machine(), read8_delegate(FUNC(queen_state::vga_setting),this)); } void queen_state::machine_reset() diff --git a/src/mame/drivers/savquest.c b/src/mame/drivers/savquest.c index fb1ef715c25..5e28d7329e2 100644 --- a/src/mame/drivers/savquest.c +++ b/src/mame/drivers/savquest.c @@ -94,7 +94,6 @@ public: DECLARE_WRITE_LINE_MEMBER(savquest_pic8259_1_set_int_line); virtual void machine_start(); virtual void machine_reset(); - DECLARE_READ8_MEMBER(vga_setting); }; // Intel 82439TX System Controller (MXTC) @@ -397,7 +396,7 @@ static I8237_INTERFACE( dma8237_2_config ) static ADDRESS_MAP_START(savquest_map, AS_PROGRAM, 32, savquest_state) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_RANGE(0x000e0000, 0x000fffff) AM_ROMBANK("bank1") AM_RANGE(0x000e0000, 0x000fffff) AM_WRITE(bios_ram_w) @@ -418,9 +417,9 @@ static ADDRESS_MAP_START(savquest_io, AS_IO, 32, savquest_state) AM_RANGE(0x00e8, 0x00ef) AM_NOP AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w) AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) @@ -520,8 +519,6 @@ static void ide_interrupt(device_t *device, int state) pic8259_ir6_w(drvstate->m_pic8259_2, state); } -READ8_MEMBER(savquest_state::vga_setting ) { return 0xff; } // hard-code to color - void savquest_state::machine_start() { m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4); @@ -532,7 +529,6 @@ void savquest_state::machine_start() intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); - pc_vga_init(machine(), read8_delegate(FUNC(savquest_state::vga_setting),this)); } void savquest_state::machine_reset() diff --git a/src/mame/drivers/su2000.c b/src/mame/drivers/su2000.c index 14df340fff3..f63306feb46 100644 --- a/src/mame/drivers/su2000.c +++ b/src/mame/drivers/su2000.c @@ -81,7 +81,6 @@ public: DECLARE_READ8_MEMBER(get_slave_ack); virtual void machine_start(); virtual void machine_reset(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -93,7 +92,7 @@ public: static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, su2000_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("mem_bank") - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_RANGE(0x000f0000, 0x000fffff) AM_ROM AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("maincpu", 0x0f0000) @@ -101,9 +100,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pcat_io, AS_IO, 32, su2000_state ) AM_IMPORT_FROM(pcat32_io_common) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) ADDRESS_MAP_END @@ -168,18 +167,6 @@ static void ide_interrupt(device_t *device, int state) #endif -/************************************************************* - * - * VGA - * - *************************************************************/ - -READ8_MEMBER(su2000_state::vga_setting ) -{ - /* TODO */ - return 0xff; -} - /************************************************************* * * PIC8259 Configuration @@ -290,8 +277,6 @@ void su2000_state::machine_start() init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, su2000_set_keyb_int); kbdc8042_init(machine(), &at8042); - - pc_vga_init(machine(), read8_delegate(FUNC(su2000_state::vga_setting),this)); } void su2000_state::machine_reset() diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index 088c8c63b5a..d446df54684 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -83,7 +83,6 @@ public: virtual void machine_reset(); virtual void palette_init(); UINT32 screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - DECLARE_READ8_MEMBER(vga_setting); }; #if !ENABLE_VGA @@ -457,7 +456,7 @@ static I8237_INTERFACE( dma8237_2_config ) static ADDRESS_MAP_START( taitowlf_map, AS_PROGRAM, 32, taitowlf_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM #if ENABLE_VGA - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) #else AM_RANGE(0x000a0000, 0x000bffff) AM_RAM #endif @@ -488,9 +487,9 @@ static ADDRESS_MAP_START(taitowlf_io, AS_IO, 32, taitowlf_state ) AM_RANGE(0x03b0, 0x03df) AM_NOP AM_RANGE(0x0278, 0x027b) AM_WRITE(pnp_config_w) #if ENABLE_VGA - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) #endif AM_RANGE(0x03f0, 0x03ff) AM_READWRITE(fdc_r, fdc_w) AM_RANGE(0x0a78, 0x0a7b) AM_WRITE(pnp_data_w) @@ -705,10 +704,6 @@ static void taitowlf_set_keyb_int(running_machine &machine, int state) pic8259_ir1_w(drvstate->m_pic8259_1, state); } -#if ENABLE_VGA -READ8_MEMBER(taitowlf_state::vga_setting ) { return 0xff; } // hard-code to color -#endif - DRIVER_INIT_MEMBER(taitowlf_state,taitowlf) { m_bios_ram = auto_alloc_array(machine(), UINT32, 0x10000/4); @@ -718,9 +713,6 @@ DRIVER_INIT_MEMBER(taitowlf_state,taitowlf) intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); - #if ENABLE_VGA - pc_vga_init(machine(), read8_delegate(FUNC(taitowlf_state::vga_setting),this)); - #endif } /*****************************************************************************/ diff --git a/src/mame/drivers/voyager.c b/src/mame/drivers/voyager.c index f632f22e167..0d7ebfc0fb6 100644 --- a/src/mame/drivers/voyager.c +++ b/src/mame/drivers/voyager.c @@ -69,7 +69,6 @@ public: DECLARE_DRIVER_INIT(voyager); virtual void machine_start(); virtual void machine_reset(); - DECLARE_READ8_MEMBER(vga_setting); }; @@ -396,7 +395,7 @@ WRITE32_MEMBER(voyager_state::bios_ram_w) static ADDRESS_MAP_START( voyager_map, AS_PROGRAM, 32, voyager_state ) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(trident_mem_r, trident_mem_w, 0xffffffff) // VGA VRAM + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", trident_vga_device, mem_r, mem_w, 0xffffffff) // VGA VRAM AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) AM_RANGE(0x000c8000, 0x000cffff) AM_NOP //AM_RANGE(0x000d0000, 0x000d0003) AM_RAM // XYLINX - Sincronus serial communication @@ -446,9 +445,9 @@ static ADDRESS_MAP_START( voyager_io, AS_IO, 32, voyager_state ) AM_RANGE(0x02f8, 0x02ff) AM_NOP //To debug AM_RANGE(0x0320, 0x038f) AM_NOP //To debug AM_RANGE(0x03a0, 0x03a7) AM_NOP //To debug - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(trident_03c0_r, trident_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(trident_03d0_r, trident_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", trident_vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03e0, 0x03ef) AM_NOP //To debug AM_RANGE(0x0378, 0x037f) AM_NOP //To debug // AM_RANGE(0x0300, 0x03af) AM_NOP @@ -654,8 +653,6 @@ static IRQ_CALLBACK(irq_callback) return pic8259_acknowledge( state->m_pic8259_1); } -READ8_MEMBER(voyager_state::vga_setting ) { return 0xff; } // hard-code to color - void voyager_state::machine_start() { machine().device("maincpu")->execute().set_irq_acknowledge_callback(irq_callback); @@ -794,7 +791,7 @@ static MACHINE_CONFIG_START( voyager, voyager_state ) MCFG_PCI_BUS_LEGACY_DEVICE(7, NULL, intel82371ab_pci_r, intel82371ab_pci_w) /* video hardware */ - MCFG_FRAGMENT_ADD( pcvideo_vga ) + MCFG_FRAGMENT_ADD( pcvideo_trident_vga ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") @@ -804,7 +801,6 @@ DRIVER_INIT_MEMBER(voyager_state,voyager) { m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4); - pc_vga_init(machine(), read8_delegate(FUNC(voyager_state::vga_setting),this)); init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, voyager_set_keyb_int); intel82439tx_init(machine()); diff --git a/src/mame/drivers/xtom3d.c b/src/mame/drivers/xtom3d.c index 17620969dde..70e9a51575b 100644 --- a/src/mame/drivers/xtom3d.c +++ b/src/mame/drivers/xtom3d.c @@ -115,7 +115,6 @@ public: DECLARE_WRITE_LINE_MEMBER(xtom3d_pic8259_1_set_int_line); virtual void machine_start(); virtual void machine_reset(); - DECLARE_READ8_MEMBER(vga_setting); }; // Intel 82439TX System Controller (MXTC) @@ -526,7 +525,7 @@ static I8237_INTERFACE( dma8237_2_config ) static ADDRESS_MAP_START(xtom3d_map, AS_PROGRAM, 32, xtom3d_state) AM_RANGE(0x00000000, 0x0009ffff) AM_RAM - AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x000c0000, 0x000c3fff) AM_ROMBANK("video_bank1") AM_WRITE(isa_ram1_w) AM_RANGE(0x000c4000, 0x000c7fff) AM_ROMBANK("video_bank2") AM_WRITE(isa_ram2_w) AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1") AM_WRITE(bios_ext1_ram_w) @@ -550,9 +549,9 @@ static ADDRESS_MAP_START(xtom3d_io, AS_IO, 32, xtom3d_state) AM_RANGE(0x00e8, 0x00ef) AM_NOP AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w) - AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) + AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w) AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write) @@ -648,8 +647,6 @@ static void ide_interrupt(device_t *device, int state) pic8259_ir6_w(drvstate->m_pic8259_2, state); } -READ8_MEMBER(xtom3d_state::vga_setting ) { return 0xff; } // hard-code to color - void xtom3d_state::machine_start() { @@ -667,7 +664,6 @@ void xtom3d_state::machine_start() intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); - pc_vga_init(machine(), read8_delegate(FUNC(xtom3d_state::vga_setting),this)); } void xtom3d_state::machine_reset() diff --git a/src/mess/drivers/bebox.c b/src/mess/drivers/bebox.c index 6818adf2a80..a6883271b5b 100644 --- a/src/mess/drivers/bebox.c +++ b/src/mess/drivers/bebox.c @@ -59,9 +59,9 @@ static ADDRESS_MAP_START( bebox_mem, AS_PROGRAM, 64, bebox_state ) AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003b0, 0x800003bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003c0, 0x800003cf) AM_READWRITE8_LEGACY(cirrus_03c0_r, cirrus_03c0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003d0, 0x800003df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800003b0, 0x800003bf) AM_DEVREADWRITE8("vga", cirrus_vga_device, port_03b0_r, port_03b0_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800003c0, 0x800003cf) AM_DEVREADWRITE8("vga", cirrus_vga_device, port_03c0_r, port_03c0_w, U64(0xffffffffffffffff)) + AM_RANGE(0x800003d0, 0x800003df) AM_DEVREADWRITE8("vga", cirrus_vga_device, port_03d0_r, port_03d0_w, U64(0xffffffffffffffff)) AM_RANGE(0x800003F0, 0x800003F7) AM_READWRITE_LEGACY(bebox_800003F0_r, bebox_800003F0_w ) AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0",ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE8_LEGACY(bebox_80000480_r, bebox_80000480_w, U64(0xffffffffffffffff) ) @@ -69,8 +69,8 @@ static ADDRESS_MAP_START( bebox_mem, AS_PROGRAM, 64, bebox_state ) //AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8_LEGACY("cirrus", cirrus_42E8_w, U64(0xffffffffffffffff) ) AM_RANGE(0xBFFFFFF0, 0xBFFFFFFF) AM_READ_LEGACY(bebox_interrupt_ack_r ) - AM_RANGE(0xC00A0000, 0XC00BFFFF) AM_READWRITE8_LEGACY(vga_mem_r, vga_mem_w, U64(0xffffffffffffffff) ) - AM_RANGE(0xC1000000, 0XC11FFFFF) AM_READWRITE8_LEGACY(vga_mem_linear_r, vga_mem_linear_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xC00A0000, 0XC00BFFFF) AM_DEVREADWRITE8("vga", cirrus_vga_device, mem_r, mem_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xC1000000, 0XC11FFFFF) AM_DEVREADWRITE8("vga", cirrus_vga_device, mem_linear_r, mem_linear_w, U64(0xffffffffffffffff) ) AM_RANGE(0xFFF00000, 0xFFF03FFF) AM_ROMBANK("bank2") AM_RANGE(0xFFF04000, 0xFFFFFFFF) AM_READWRITE8_LEGACY(bebox_flash_r, bebox_flash_w, U64(0xffffffffffffffff) ) ADDRESS_MAP_END @@ -186,7 +186,7 @@ static MACHINE_CONFIG_START( bebox, bebox_state ) MCFG_NS16550_ADD( "ns16550_3", bebox_uart_inteface_3, 0 ) /* TODO: Verify model */ /* video hardware */ - MCFG_FRAGMENT_ADD( pcvideo_vga ) + MCFG_FRAGMENT_ADD( pcvideo_cirrus_vga ) MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/indiana.c b/src/mess/drivers/indiana.c index 18cdcb9ed18..216dce3c5a1 100644 --- a/src/mess/drivers/indiana.c +++ b/src/mess/drivers/indiana.c @@ -22,7 +22,6 @@ public: : driver_device(mconfig, type, tag) { } DECLARE_DRIVER_INIT(indiana); virtual void machine_reset(); - DECLARE_READ8_MEMBER(indiana_vga_setting); }; @@ -35,10 +34,10 @@ static ADDRESS_MAP_START(indiana_mem, AS_PROGRAM, 32, indiana_state) AM_RANGE(0x00500000, 0x005fffff) AM_MIRROR(0x7f800000) AM_RAM // 16 bit PC MEM AM_RANGE(0x00600000, 0x006fffff) AM_MIRROR(0x7f800000) AM_RAM // 8 bit PC IO AM_RANGE(0x00700000, 0x007fffff) AM_MIRROR(0x7f800000) AM_RAM // 8 bit PC MEM - AM_RANGE(0x7f6003b0, 0x7f6003bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff) - AM_RANGE(0x7f6003c0, 0x7f6003cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff) - AM_RANGE(0x7f6003d0, 0x7f6003df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff) - AM_RANGE(0x7f7a0000, 0x7f7bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) + AM_RANGE(0x7f6003b0, 0x7f6003bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff) + AM_RANGE(0x7f6003c0, 0x7f6003cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff) + AM_RANGE(0x7f6003d0, 0x7f6003df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff) + AM_RANGE(0x7f7a0000, 0x7f7bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) AM_RANGE(0x80000000, 0x803fffff) AM_MIRROR(0x7fc00000) AM_RAM // 4 MB RAM ADDRESS_MAP_END @@ -81,14 +80,8 @@ static MACHINE_CONFIG_START( indiana, indiana_state ) MCFG_FRAGMENT_ADD( pcvideo_vga ) MACHINE_CONFIG_END -READ8_MEMBER(indiana_state::indiana_vga_setting) -{ - return 0xff; // TODO -} - DRIVER_INIT_MEMBER(indiana_state,indiana) { - pc_vga_init(machine(), read8_delegate(FUNC(indiana_state::indiana_vga_setting),this)); } /* ROM definition */ diff --git a/src/mess/video/cirrus.c b/src/mess/video/cirrus.c index 8d878c5a8ba..31730793e00 100644 --- a/src/mess/video/cirrus.c +++ b/src/mess/video/cirrus.c @@ -93,7 +93,6 @@ cirrus_device::cirrus_device(const machine_config &mconfig, const char *tag, dev void cirrus_device::device_start() { - pc_vga_cirrus_init(machine(), read8_delegate()); } //------------------------------------------------- @@ -159,5 +158,5 @@ void cirrus_device::pci_write(pci_bus_device *pcibus, int function, int offset, WRITE8_DEVICE_HANDLER( cirrus_42E8_w ) { if (data & 0x80) - pc_vga_reset(space.machine()); + device->machine().device("vga")->reset(); } diff --git a/src/mess/video/isa_svga_cirrus.c b/src/mess/video/isa_svga_cirrus.c index ba3515d8919..df502e0818a 100644 --- a/src/mess/video/isa_svga_cirrus.c +++ b/src/mess/video/isa_svga_cirrus.c @@ -20,6 +20,15 @@ ROM_END const device_type ISA8_SVGA_CIRRUS = &device_creator; +static MACHINE_CONFIG_FRAGMENT( vga_cirrus ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_vga_device, screen_update) + + MCFG_PALETTE_LENGTH(0x100) + + MCFG_DEVICE_ADD("vga", CIRRUS_VGA, 0) +MACHINE_CONFIG_END //------------------------------------------------- // machine_config_additions - device-specific @@ -28,7 +37,7 @@ const device_type ISA8_SVGA_CIRRUS = &device_creator; machine_config_constructor isa8_svga_cirrus_device::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( pcvideo_vga_isa ); + return MACHINE_CONFIG_NAME( vga_cirrus ); } //------------------------------------------------- @@ -64,23 +73,16 @@ void isa8_svga_cirrus_device::device_start() { set_isa_device(); - video_start_vga( machine() ); - - pc_vga_init(machine(), read8_delegate(FUNC(isa8_svga_cirrus_device::input_port_0_r),this)); - - int i; - for (i = 0; i < 0x100; i++) - palette_set_color_rgb(machine(), i, 0, 0, 0); - pc_video_start(machine()); - + m_vga = subdevice("vga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "svga", "dm_clgd5430"); - m_isa->install_device(0x03b0, 0x03bf, 0, 0, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w)); - m_isa->install_device(0x03c0, 0x03cf, 0, 0, FUNC(vga_port_03c0_r), FUNC(vga_port_03c0_w)); - m_isa->install_device(0x03d0, 0x03df, 0, 0, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w)); -// m_isa->install_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_port_9ae8_r), FUNC(s3_port_9ae8_w)); + m_isa->install_device(0x03b0, 0x03bf, 0, 0, read8_delegate(FUNC(cirrus_vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(cirrus_vga_device::port_03b0_w),m_vga)); + m_isa->install_device(0x03c0, 0x03cf, 0, 0, read8_delegate(FUNC(cirrus_vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(cirrus_vga_device::port_03c0_w),m_vga)); + m_isa->install_device(0x03d0, 0x03df, 0, 0, read8_delegate(FUNC(cirrus_vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(cirrus_vga_device::port_03d0_w),m_vga)); +// m_isa->install_device(0x9ae8, 0x9aeb, 0, 0, read8_delegate(FUNC(cirrus_vga_device::s3_port_9ae8_r),m_vga), write8_delegate(FUNC(cirrus_vga_device::s3_port_9ae8_w),m_vga)); - m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(vga_mem_r), FUNC(vga_mem_w)); + m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(cirrus_vga_device::mem_r),m_vga), write8_delegate(FUNC(cirrus_vga_device::mem_w),m_vga)); } //------------------------------------------------- @@ -89,5 +91,4 @@ void isa8_svga_cirrus_device::device_start() void isa8_svga_cirrus_device::device_reset() { - pc_vga_reset(machine()); } diff --git a/src/mess/video/isa_svga_cirrus.h b/src/mess/video/isa_svga_cirrus.h index d9647e8acd4..e98fd365d27 100644 --- a/src/mess/video/isa_svga_cirrus.h +++ b/src/mess/video/isa_svga_cirrus.h @@ -5,6 +5,7 @@ #include "emu.h" #include "machine/isa.h" +#include "video/pc_vga.h" //************************************************************************** // TYPE DEFINITIONS @@ -29,6 +30,8 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); +private: + cirrus_vga_device *m_vga; }; diff --git a/src/mess/video/isa_svga_s3.c b/src/mess/video/isa_svga_s3.c index 7ede5932a47..8bef7dfc4a8 100644 --- a/src/mess/video/isa_svga_s3.c +++ b/src/mess/video/isa_svga_s3.c @@ -21,6 +21,16 @@ ROM_END const device_type ISA16_SVGA_S3 = &device_creator; +static MACHINE_CONFIG_FRAGMENT( vga_s3 ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", s3_vga_device, screen_update) + + MCFG_PALETTE_LENGTH(0x100) + + MCFG_DEVICE_ADD("vga", S3_VGA, 0) +MACHINE_CONFIG_END + //------------------------------------------------- // machine_config_additions - device-specific // machine configurations @@ -28,7 +38,7 @@ const device_type ISA16_SVGA_S3 = &device_creator; machine_config_constructor isa16_svga_s3_device::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( pcvideo_s3_isa ); + return MACHINE_CONFIG_NAME( vga_s3 ); } //------------------------------------------------- @@ -64,36 +74,29 @@ void isa16_svga_s3_device::device_start() { set_isa_device(); - video_start_vga( machine() ); - - pc_vga_init(machine(), read8_delegate(FUNC(isa16_svga_s3_device::input_port_0_r),this)); - - int i; - for (i = 0; i < 0x100; i++) - palette_set_color_rgb(machine(), i, 0, 0, 0); - s3_video_start(machine()); - + m_vga = subdevice("vga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "svga", "s3_764"); - m_isa->install_device(0x03b0, 0x03bf, 0, 0, FUNC(s3_port_03b0_r), FUNC(s3_port_03b0_w)); - m_isa->install_device(0x03c0, 0x03cf, 0, 0, FUNC(s3_port_03c0_r), FUNC(s3_port_03c0_w)); - m_isa->install_device(0x03d0, 0x03df, 0, 0, FUNC(s3_port_03d0_r), FUNC(s3_port_03d0_w)); - m_isa->install16_device(0x82e8, 0x82eb, 0, 0, FUNC(ibm8514_currenty_r), FUNC(ibm8514_currenty_w)); - m_isa->install16_device(0x86e8, 0x86eb, 0, 0, FUNC(ibm8514_currentx_r), FUNC(ibm8514_currentx_w)); - m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, FUNC(ibm8514_desty_r), FUNC(ibm8514_desty_w)); - m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, FUNC(ibm8514_destx_r), FUNC(ibm8514_destx_w)); - m_isa->install16_device(0x92e8, 0x92eb, 0, 0, FUNC(s3_line_error_r), FUNC(s3_line_error_w)); - m_isa->install16_device(0x96e8, 0x96eb, 0, 0, FUNC(s3_width_r), FUNC(s3_width_w)); - m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_gpstatus_r), FUNC(s3_cmd_w)); - m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, FUNC(ibm8514_ssv_r), FUNC(ibm8514_ssv_w)); - m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, FUNC(s3_bgcolour_r), FUNC(s3_bgcolour_w)); - m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, FUNC(s3_fgcolour_r), FUNC(s3_fgcolour_w)); - m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, FUNC(s3_backmix_r), FUNC(s3_backmix_w)); - m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, FUNC(s3_foremix_r), FUNC(s3_foremix_w)); - m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, FUNC(s3_multifunc_r), FUNC(s3_multifunc_w)); - m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, FUNC(s3_pixel_xfer_r), FUNC(s3_pixel_xfer_w)); + m_isa->install_device(0x03b0, 0x03bf, 0, 0, read8_delegate(FUNC(s3_vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(s3_vga_device::port_03b0_w),m_vga)); + m_isa->install_device(0x03c0, 0x03cf, 0, 0, read8_delegate(FUNC(s3_vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(s3_vga_device::port_03c0_w),m_vga)); + m_isa->install_device(0x03d0, 0x03df, 0, 0, read8_delegate(FUNC(s3_vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(s3_vga_device::port_03d0_w),m_vga)); + m_isa->install16_device(0x82e8, 0x82eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_currenty_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_currenty_w),m_vga)); + m_isa->install16_device(0x86e8, 0x86eb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_currentx_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_currentx_w),m_vga)); + m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_desty_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_desty_w),m_vga)); + m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_destx_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_destx_w),m_vga)); + m_isa->install16_device(0x92e8, 0x92eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_line_error_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_line_error_w),m_vga)); + m_isa->install16_device(0x96e8, 0x96eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_width_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_width_w),m_vga)); + m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_gpstatus_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_cmd_w),m_vga)); + m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, read16_delegate(FUNC(s3_vga_device::ibm8514_ssv_r),m_vga), write16_delegate(FUNC(s3_vga_device::ibm8514_ssv_w),m_vga)); + m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_bgcolour_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_bgcolour_w),m_vga)); + m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_fgcolour_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_fgcolour_w),m_vga)); + m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_backmix_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_backmix_w),m_vga)); + m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_foremix_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_foremix_w),m_vga)); + m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_multifunc_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_multifunc_w),m_vga)); + m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, read16_delegate(FUNC(s3_vga_device::s3_pixel_xfer_r),m_vga), write16_delegate(FUNC(s3_vga_device::s3_pixel_xfer_w),m_vga)); - m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(s3_mem_r), FUNC(s3_mem_w)); + m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(s3_vga_device::mem_r),m_vga), write8_delegate(FUNC(s3_vga_device::mem_w),m_vga)); } //------------------------------------------------- @@ -102,5 +105,4 @@ void isa16_svga_s3_device::device_start() void isa16_svga_s3_device::device_reset() { - pc_vga_reset(machine()); } diff --git a/src/mess/video/isa_svga_s3.h b/src/mess/video/isa_svga_s3.h index fad0f4da213..f4f280f5f6a 100644 --- a/src/mess/video/isa_svga_s3.h +++ b/src/mess/video/isa_svga_s3.h @@ -5,6 +5,7 @@ #include "emu.h" #include "machine/isa.h" +#include "video/pc_vga.h" //************************************************************************** // TYPE DEFINITIONS @@ -29,6 +30,8 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); +private: + s3_vga_device *m_vga; }; diff --git a/src/mess/video/isa_svga_tseng.c b/src/mess/video/isa_svga_tseng.c index 7cc11be559d..fe04cf986f1 100644 --- a/src/mess/video/isa_svga_tseng.c +++ b/src/mess/video/isa_svga_tseng.c @@ -20,6 +20,16 @@ ROM_END const device_type ISA8_SVGA_ET4K = &device_creator; +static MACHINE_CONFIG_FRAGMENT( vga_tseng ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", tseng_vga_device, screen_update) + + MCFG_PALETTE_LENGTH(0x100) + + MCFG_DEVICE_ADD("vga", TSENG_VGA, 0) +MACHINE_CONFIG_END + //------------------------------------------------- // machine_config_additions - device-specific // machine configurations @@ -27,7 +37,7 @@ const device_type ISA8_SVGA_ET4K = &device_creator; machine_config_constructor isa8_svga_et4k_device::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( pcvideo_vga_isa ); + return MACHINE_CONFIG_NAME( vga_tseng ); } //------------------------------------------------- @@ -63,22 +73,15 @@ void isa8_svga_et4k_device::device_start() { set_isa_device(); - video_start_vga( machine() ); - - pc_vga_init(machine(), read8_delegate(FUNC(isa8_svga_et4k_device::input_port_0_r),this)); - - int i; - for (i = 0; i < 0x100; i++) - palette_set_color_rgb(machine(), i, 0, 0, 0); - pc_video_start(machine()); - + m_vga = subdevice("vga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "et4000", "et4000"); - m_isa->install_device(0x3b0, 0x3bf, 0, 0, FUNC(tseng_et4k_03b0_r), FUNC(tseng_et4k_03b0_w)); - m_isa->install_device(0x3c0, 0x3cf, 0, 0, FUNC(tseng_et4k_03c0_r), FUNC(tseng_et4k_03c0_w)); - m_isa->install_device(0x3d0, 0x3df, 0, 0, FUNC(tseng_et4k_03d0_r), FUNC(tseng_et4k_03d0_w)); + m_isa->install_device(0x3b0, 0x3bf, 0, 0, read8_delegate(FUNC(tseng_vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(tseng_vga_device::port_03b0_w),m_vga)); + m_isa->install_device(0x3c0, 0x3cf, 0, 0, read8_delegate(FUNC(tseng_vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(tseng_vga_device::port_03c0_w),m_vga)); + m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate(FUNC(tseng_vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(tseng_vga_device::port_03d0_w),m_vga)); - m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(tseng_mem_r), FUNC(tseng_mem_w)); + m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(tseng_vga_device::mem_r),m_vga), write8_delegate(FUNC(tseng_vga_device::mem_w),m_vga)); } //------------------------------------------------- @@ -87,5 +90,4 @@ void isa8_svga_et4k_device::device_start() void isa8_svga_et4k_device::device_reset() { - pc_vga_reset(machine()); } diff --git a/src/mess/video/isa_svga_tseng.h b/src/mess/video/isa_svga_tseng.h index 8b44dfef46d..735b936f82f 100644 --- a/src/mess/video/isa_svga_tseng.h +++ b/src/mess/video/isa_svga_tseng.h @@ -5,6 +5,7 @@ #include "emu.h" #include "machine/isa.h" +#include "video/pc_vga.h" //************************************************************************** // TYPE DEFINITIONS @@ -29,6 +30,8 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); +private: + tseng_vga_device *m_vga; }; diff --git a/src/mess/video/isa_vga.c b/src/mess/video/isa_vga.c index 54354338b89..7b582b50fae 100644 --- a/src/mess/video/isa_vga.c +++ b/src/mess/video/isa_vga.c @@ -27,7 +27,7 @@ const device_type ISA8_VGA = &device_creator; machine_config_constructor isa8_vga_device::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( pcvideo_vga_isa ); + return MACHINE_CONFIG_NAME( pcvideo_vga ); } //------------------------------------------------- @@ -62,23 +62,16 @@ READ8_MEMBER( isa8_vga_device::input_port_0_r ) { return 0xff; } //return space. void isa8_vga_device::device_start() { set_isa_device(); - - video_start_vga( machine() ); - - pc_vga_init(machine(), read8_delegate(FUNC(isa8_vga_device::input_port_0_r),this)); - - int i; - for (i = 0; i < 0x100; i++) - palette_set_color_rgb(machine(), i, 0, 0, 0); - pc_video_start(machine()); + + m_vga = subdevice("vga"); m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "ibm_vga", "ibm_vga"); - m_isa->install_device(0x3b0, 0x3bf, 0, 0, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w)); - m_isa->install_device(0x3c0, 0x3cf, 0, 0, FUNC(vga_port_03c0_r), FUNC(vga_port_03c0_w)); - m_isa->install_device(0x3d0, 0x3df, 0, 0, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w)); + m_isa->install_device(0x3b0, 0x3bf, 0, 0, read8_delegate(FUNC(vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(vga_device::port_03b0_w),m_vga)); + m_isa->install_device(0x3c0, 0x3cf, 0, 0, read8_delegate(FUNC(vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(vga_device::port_03c0_w),m_vga)); + m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate(FUNC(vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(vga_device::port_03d0_w),m_vga)); - m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(vga_mem_r), FUNC(vga_mem_w)); + m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(vga_device::mem_r),m_vga), write8_delegate(FUNC(vga_device::mem_w),m_vga)); } //------------------------------------------------- @@ -87,5 +80,4 @@ void isa8_vga_device::device_start() void isa8_vga_device::device_reset() { - pc_vga_reset(machine()); } diff --git a/src/mess/video/isa_vga.h b/src/mess/video/isa_vga.h index b88dfe91ff6..7e7ab09517a 100644 --- a/src/mess/video/isa_vga.h +++ b/src/mess/video/isa_vga.h @@ -5,6 +5,7 @@ #include "emu.h" #include "machine/isa.h" +#include "video/pc_vga.h" //************************************************************************** // TYPE DEFINITIONS @@ -29,6 +30,8 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); +private: + vga_device *m_vga; }; diff --git a/src/mess/video/isa_vga_ati.c b/src/mess/video/isa_vga_ati.c index d48ea496c97..792c98bbdca 100644 --- a/src/mess/video/isa_vga_ati.c +++ b/src/mess/video/isa_vga_ati.c @@ -23,6 +23,15 @@ ROM_END const device_type ISA16_VGA_GFXULTRA = &device_creator; +static MACHINE_CONFIG_FRAGMENT( vga_ati ) + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480) + MCFG_SCREEN_UPDATE_DEVICE("vga", ati_vga_device, screen_update) + + MCFG_PALETTE_LENGTH(0x100) + + MCFG_DEVICE_ADD("vga", ATI_VGA, 0) +MACHINE_CONFIG_END //------------------------------------------------- // machine_config_additions - device-specific @@ -31,7 +40,7 @@ const device_type ISA16_VGA_GFXULTRA = &device_creator("vga"); + m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "vga", "gfxultra"); - m_isa->install_device(this, 0x1ce, 0x1cf, 0, 0, FUNC(ati_port_ext_r), FUNC(ati_port_ext_w)); - m_isa->install16_device(0x2e8, 0x2eb, 0, 0, FUNC(ibm8514_status_r), FUNC(ibm8514_htotal_w)); - m_isa->install_device(0x3b0, 0x3bf, 0, 0, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w)); - m_isa->install_device(0x3c0, 0x3cf, 0, 0, FUNC(ati_port_03c0_r), FUNC(vga_port_03c0_w)); - m_isa->install_device(0x3d0, 0x3df, 0, 0, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w)); - m_isa->install16_device(0x12e8, 0x12eb, 0, 0, FUNC(ibm8514_vtotal_r),FUNC(ibm8514_vtotal_w)); - m_isa->install16_device(0x12ec, 0x12ef, 0, 0, FUNC(mach8_config1_r),NULL,NULL); - m_isa->install16_device(0x16e8, 0x16eb, 0, 0, FUNC(ibm8514_vdisp_r),FUNC(ibm8514_vdisp_w)); - m_isa->install16_device(0x16ec, 0x16ef, 0, 0, FUNC(mach8_config2_r),NULL,NULL); - m_isa->install16_device(0x1ae8, 0x1aeb, 0, 0, FUNC(ibm8514_vsync_r),FUNC(ibm8514_vsync_w)); - m_isa->install16_device(0x26e8, 0x26eb, 0, 0, FUNC(ibm8514_htotal_r),NULL,NULL); - m_isa->install16_device(0x2ee8, 0x2eeb, 0, 0, FUNC(ibm8514_subcontrol_r),NULL,NULL); - m_isa->install16_device(0x42e8, 0x42eb, 0, 0, FUNC(ibm8514_substatus_r), FUNC(ibm8514_subcontrol_w)); - m_isa->install16_device(0x52e8, 0x52eb, 0, 0, FUNC(mach8_ec0_r), FUNC(mach8_ec0_w)); - m_isa->install16_device(0x52ec, 0x52ef, 0, 0, FUNC(mach8_scratch0_r), FUNC(mach8_scratch0_w)); - m_isa->install16_device(0x56e8, 0x56eb, 0, 0, FUNC(mach8_ec1_r), FUNC(mach8_ec1_w)); - m_isa->install16_device(0x56ec, 0x56ef, 0, 0, FUNC(mach8_scratch0_r), FUNC(mach8_scratch0_w)); - m_isa->install16_device(0x5ae8, 0x5aeb, 0, 0, FUNC(mach8_ec2_r), FUNC(mach8_ec2_w)); - m_isa->install16_device(0x5ee8, 0x5eeb, 0, 0, FUNC(mach8_ec3_r), FUNC(mach8_ec3_w)); - m_isa->install16_device(0x82e8, 0x82eb, 0, 0, FUNC(ibm8514_currenty_r), FUNC(ibm8514_currenty_w)); - m_isa->install16_device(0x86e8, 0x86eb, 0, 0, FUNC(ibm8514_currentx_r), FUNC(ibm8514_currentx_w)); - m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, FUNC(ibm8514_desty_r), FUNC(ibm8514_desty_w)); - m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, FUNC(ibm8514_destx_r), FUNC(ibm8514_destx_w)); - m_isa->install16_device(0x92e8, 0x92eb, 0, 0, FUNC(s3_line_error_r), FUNC(s3_line_error_w)); - m_isa->install16_device(0x96e8, 0x96eb, 0, 0, FUNC(s3_width_r), FUNC(s3_width_w)); - m_isa->install16_device(0x96ec, 0x96ef, 0, 0, FUNC(mach8_bresenham_count_r), FUNC(mach8_bresenham_count_w)); - m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(ibm8514_gpstatus_r), FUNC(ibm8514_cmd_w)); - m_isa->install16_device(0x9aec, 0x9aef, 0, 0, FUNC(mach8_ext_fifo_r), FUNC(mach8_linedraw_index_w)); - m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, FUNC(ibm8514_ssv_r), FUNC(ibm8514_ssv_w)); - m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, FUNC(s3_bgcolour_r), FUNC(s3_bgcolour_w)); - m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, FUNC(s3_fgcolour_r), FUNC(s3_fgcolour_w)); - m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, FUNC(s3_backmix_r), FUNC(s3_backmix_w)); - m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, FUNC(s3_foremix_r), FUNC(s3_foremix_w)); - m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, FUNC(s3_multifunc_r), FUNC(s3_multifunc_w)); - m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, FUNC(s3_pixel_xfer_r), FUNC(s3_pixel_xfer_w)); - m_isa->install16_device(0xfeec, 0xfeef, 0, 0, NULL, NULL, FUNC(mach8_linedraw_w)); + m_isa->install_device(0x1ce, 0x1cf, 0, 0, read8_delegate(FUNC(ati_vga_device::ati_port_ext_r),m_vga), write8_delegate(FUNC(ati_vga_device::ati_port_ext_w),m_vga)); + m_isa->install16_device(0x2e8, 0x2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_status_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_htotal_w),m_vga)); + m_isa->install_device(0x3b0, 0x3bf, 0, 0, read8_delegate(FUNC(ati_vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(vga_device::port_03b0_w),m_vga)); + m_isa->install_device(0x3c0, 0x3cf, 0, 0, read8_delegate(FUNC(ati_vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(vga_device::port_03c0_w),m_vga)); + m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate(FUNC(ati_vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(vga_device::port_03d0_w),m_vga)); + m_isa->install16_device(0x12e8, 0x12eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_vtotal_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_vtotal_w),m_vga)); + m_isa->install16_device(0x12ec, 0x12ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_config1_r),m_vga), write16_delegate()); + m_isa->install16_device(0x16e8, 0x16eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_vdisp_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_vdisp_w),m_vga)); + m_isa->install16_device(0x16ec, 0x16ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_config2_r),m_vga), write16_delegate()); + m_isa->install16_device(0x1ae8, 0x1aeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_vsync_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_vsync_w),m_vga)); + m_isa->install16_device(0x26e8, 0x26eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_htotal_r),m_vga),write16_delegate()); + m_isa->install16_device(0x2ee8, 0x2eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_subcontrol_r),m_vga),write16_delegate()); + m_isa->install16_device(0x42e8, 0x42eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_substatus_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_subcontrol_w),m_vga)); + m_isa->install16_device(0x52e8, 0x52eb, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_ec0_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_ec0_w),m_vga)); + m_isa->install16_device(0x52ec, 0x52ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_scratch0_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_scratch0_w),m_vga)); + m_isa->install16_device(0x56e8, 0x56eb, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_ec1_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_ec1_w),m_vga)); + m_isa->install16_device(0x56ec, 0x56ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_scratch0_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_scratch0_w),m_vga)); + m_isa->install16_device(0x5ae8, 0x5aeb, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_ec2_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_ec2_w),m_vga)); + m_isa->install16_device(0x5ee8, 0x5eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_ec3_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_ec3_w),m_vga)); + m_isa->install16_device(0x82e8, 0x82eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_currenty_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_currenty_w),m_vga)); + m_isa->install16_device(0x86e8, 0x86eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_currentx_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_currentx_w),m_vga)); + m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_desty_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_desty_w),m_vga)); + m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_destx_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_destx_w),m_vga)); + m_isa->install16_device(0x92e8, 0x92eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_line_error_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_line_error_w),m_vga)); + m_isa->install16_device(0x96e8, 0x96eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_width_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_width_w),m_vga)); + m_isa->install16_device(0x96ec, 0x96ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_bresenham_count_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_bresenham_count_w),m_vga)); + m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_gpstatus_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_cmd_w),m_vga)); + m_isa->install16_device(0x9aec, 0x9aef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_ext_fifo_r),m_vga), write16_delegate(FUNC(ati_vga_device::mach8_linedraw_index_w),m_vga)); + m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_ssv_r),m_vga), write16_delegate(FUNC(ati_vga_device::ibm8514_ssv_w),m_vga)); + m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_bgcolour_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_bgcolour_w),m_vga)); + m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_fgcolour_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_fgcolour_w),m_vga)); + m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_backmix_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_backmix_w),m_vga)); + m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_foremix_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_foremix_w),m_vga)); + m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_multifunc_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_multifunc_w),m_vga)); + m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, read16_delegate(FUNC(ati_vga_device::s3_pixel_xfer_r),m_vga), write16_delegate(FUNC(ati_vga_device::s3_pixel_xfer_w),m_vga)); + m_isa->install16_device(0xfeec, 0xfeef, 0, 0, read16_delegate(), write16_delegate(FUNC(ati_vga_device::mach8_linedraw_w),m_vga)); - m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(ati_mem_r), FUNC(ati_mem_w)); + m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(ati_vga_device::mem_r),m_vga), write8_delegate(FUNC(ati_vga_device::mem_w),m_vga)); } //------------------------------------------------- @@ -124,5 +126,4 @@ void isa16_vga_gfxultra_device::device_start() void isa16_vga_gfxultra_device::device_reset() { - pc_vga_reset(machine()); } diff --git a/src/mess/video/isa_vga_ati.h b/src/mess/video/isa_vga_ati.h index 3af2af90024..7bf070021b0 100644 --- a/src/mess/video/isa_vga_ati.h +++ b/src/mess/video/isa_vga_ati.h @@ -12,6 +12,7 @@ #include "emu.h" #include "machine/isa.h" +#include "video/pc_vga.h" //************************************************************************** // TYPE DEFINITIONS @@ -36,6 +37,8 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); +private: + ati_vga_device *m_vga; };