Previous 199869 Revisions Next

r18229 Monday 1st October, 2012 at 11:44:29 UTC by Miodrag Milanović
Converted VGA to be multiple devices, this will require some cleanup in future (no whatsnew)
[src/emu/video]pc_vga.c pc_vga.h
[src/mame/drivers]calchase.c gammagic.c gamtor.c magtouch.c midqslvr.c pangofun.c pcat_dyn.c pcat_nit.c photoply.c pntnpuzl.c queen.c savquest.c su2000.c taitowlf.c voyager.c xtom3d.c
[src/mess/drivers]bebox.c indiana.c
[src/mess/video]cirrus.c isa_svga_cirrus.c isa_svga_cirrus.h isa_svga_s3.c isa_svga_s3.h isa_svga_tseng.c isa_svga_tseng.h isa_vga.c isa_vga.h isa_vga_ati.c isa_vga_ati.h

trunk/src/mame/drivers/taitowlf.c
r18228r18229
8383   virtual void machine_reset();
8484   virtual void palette_init();
8585   UINT32 screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
86   DECLARE_READ8_MEMBER(vga_setting);
8786};
8887
8988#if !ENABLE_VGA
r18228r18229
457456static ADDRESS_MAP_START( taitowlf_map, AS_PROGRAM, 32, taitowlf_state )
458457   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
459458   #if ENABLE_VGA
460   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
459   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
461460   #else
462461   AM_RANGE(0x000a0000, 0x000bffff) AM_RAM
463462   #endif
r18228r18229
488487   AM_RANGE(0x03b0, 0x03df) AM_NOP
489488   AM_RANGE(0x0278, 0x027b) AM_WRITE(pnp_config_w)
490489   #if ENABLE_VGA
491   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
492   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
493   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
490   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
491   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
492   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
494493   #endif
495494   AM_RANGE(0x03f0, 0x03ff) AM_READWRITE(fdc_r, fdc_w)
496495   AM_RANGE(0x0a78, 0x0a7b) AM_WRITE(pnp_data_w)
r18228r18229
705704   pic8259_ir1_w(drvstate->m_pic8259_1, state);
706705}
707706
708#if ENABLE_VGA
709READ8_MEMBER(taitowlf_state::vga_setting ) { return 0xff; } // hard-code to color
710#endif
711
712707DRIVER_INIT_MEMBER(taitowlf_state,taitowlf)
713708{
714709   m_bios_ram = auto_alloc_array(machine(), UINT32, 0x10000/4);
r18228r18229
718713   intel82439tx_init(machine());
719714
720715   kbdc8042_init(machine(), &at8042);
721   #if ENABLE_VGA
722   pc_vga_init(machine(), read8_delegate(FUNC(taitowlf_state::vga_setting),this));
723   #endif
724716}
725717
726718/*****************************************************************************/
trunk/src/mame/drivers/queen.c
r18228r18229
9595   DECLARE_WRITE8_MEMBER(at_page8_w);
9696   DECLARE_READ8_MEMBER(pc_dma_read_byte);
9797   DECLARE_WRITE8_MEMBER(pc_dma_write_byte);
98   DECLARE_READ8_MEMBER(vga_setting);
9998   DECLARE_READ32_MEMBER(ide_r);
10099   DECLARE_WRITE32_MEMBER(ide_w);
101100   DECLARE_READ32_MEMBER(fdc_r);
r18228r18229
518517
519518static ADDRESS_MAP_START( queen_map, AS_PROGRAM, 32, queen_state )
520519   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
521   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
520   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
522521   AM_RANGE(0x000c0000, 0x000c3fff) AM_ROMBANK("video_bank1") AM_WRITE(isa_ram1_w)
523522   AM_RANGE(0x000c4000, 0x000c7fff) AM_ROMBANK("video_bank2") AM_WRITE(isa_ram2_w)
524523   AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1") AM_WRITE(bios_ext1_ram_w)
r18228r18229
542541   AM_RANGE(0x00e8, 0x00ef) AM_NOP
543542
544543   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
545   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
546   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
547   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
544   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
545   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
546   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
548547   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w)
549548
550549   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
r18228r18229
639638   pic8259_ir6_w(drvstate->m_pic8259_2, state);
640639}
641640
642READ8_MEMBER(queen_state::vga_setting ) { return 0xff; } // hard-code to color
643
644641void queen_state::machine_start()
645642{
646643
r18228r18229
658655   intel82439tx_init(machine());
659656
660657   kbdc8042_init(machine(), &at8042);
661   pc_vga_init(machine(), read8_delegate(FUNC(queen_state::vga_setting),this));
662658}
663659
664660void queen_state::machine_reset()
trunk/src/mame/drivers/pntnpuzl.c
r18228r18229
153153   DECLARE_READ16_MEMBER(pntnpuzl_eeprom_r);
154154   DECLARE_WRITE16_MEMBER(pntnpuzl_eeprom_w);
155155   DECLARE_DRIVER_INIT(pip);
156   DECLARE_READ8_MEMBER(vga_setting);
157156};
158157
159158
r18228r18229
312311   AM_RANGE(0x28001a, 0x28001b) AM_WRITENOP
313312
314313   /* standard VGA */
315   AM_RANGE(0x3a0000, 0x3bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffff)   
316   AM_RANGE(0x3c03b0, 0x3c03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffff)
317   AM_RANGE(0x3c03c0, 0x3c03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffff)
318   AM_RANGE(0x3c03d0, 0x3c03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffff)   
314   AM_RANGE(0x3a0000, 0x3bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffff)   
315   AM_RANGE(0x3c03b0, 0x3c03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffff)
316   AM_RANGE(0x3c03c0, 0x3c03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffff)
317   AM_RANGE(0x3c03d0, 0x3c03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffff)   
319318
320319   AM_RANGE(0x400000, 0x407fff) AM_RAM
321320ADDRESS_MAP_END
r18228r18229
359358   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D)
360359INPUT_PORTS_END
361360
362READ8_MEMBER(pntnpuzl_state::vga_setting ) { return 0xff; } // hard-code to color
363
364361static MACHINE_CONFIG_START( pntnpuzl, pntnpuzl_state )
365362   MCFG_CPU_ADD("maincpu", M68000, 12000000)//??
366363   MCFG_CPU_PROGRAM_MAP(pntnpuzl_map)
r18228r18229
387384//  UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
388385//  rom[0x2696/2] = 0x4e71;
389386//  rom[0x26a0/2] = 0x4e71;
390   pc_vga_init(machine(), read8_delegate(FUNC(pntnpuzl_state::vga_setting),this));
391387
392388}
393389
trunk/src/mame/drivers/voyager.c
r18228r18229
6969   DECLARE_DRIVER_INIT(voyager);
7070   virtual void machine_start();
7171   virtual void machine_reset();
72   DECLARE_READ8_MEMBER(vga_setting);
7372};
7473
7574
r18228r18229
396395
397396static ADDRESS_MAP_START( voyager_map, AS_PROGRAM, 32, voyager_state )
398397   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
399   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(trident_mem_r, trident_mem_w, 0xffffffff) // VGA VRAM
398   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", trident_vga_device, mem_r, mem_w, 0xffffffff) // VGA VRAM
400399   AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0)
401400   AM_RANGE(0x000c8000, 0x000cffff) AM_NOP
402401   //AM_RANGE(0x000d0000, 0x000d0003) AM_RAM  // XYLINX - Sincronus serial communication
r18228r18229
446445   AM_RANGE(0x02f8, 0x02ff) AM_NOP //To debug
447446   AM_RANGE(0x0320, 0x038f) AM_NOP //To debug
448447   AM_RANGE(0x03a0, 0x03a7) AM_NOP //To debug
449   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
450   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(trident_03c0_r, trident_03c0_w, 0xffffffff)
451   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(trident_03d0_r, trident_03d0_w, 0xffffffff)   
448   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
449   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
450   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", trident_vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
452451   AM_RANGE(0x03e0, 0x03ef) AM_NOP //To debug
453452   AM_RANGE(0x0378, 0x037f) AM_NOP //To debug
454453   // AM_RANGE(0x0300, 0x03af) AM_NOP
r18228r18229
654653   return pic8259_acknowledge( state->m_pic8259_1);
655654}
656655
657READ8_MEMBER(voyager_state::vga_setting ) { return 0xff; } // hard-code to color
658
659656void voyager_state::machine_start()
660657{
661658   machine().device("maincpu")->execute().set_irq_acknowledge_callback(irq_callback);
r18228r18229
794791   MCFG_PCI_BUS_LEGACY_DEVICE(7, NULL, intel82371ab_pci_r, intel82371ab_pci_w)
795792
796793   /* video hardware */
797   MCFG_FRAGMENT_ADD( pcvideo_vga )
794   MCFG_FRAGMENT_ADD( pcvideo_trident_vga )
798795
799796   /* sound hardware */
800797   MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
r18228r18229
804801{
805802   m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4);
806803
807   pc_vga_init(machine(), read8_delegate(FUNC(voyager_state::vga_setting),this));
808804   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, voyager_set_keyb_int);
809805
810806   intel82439tx_init(machine());
trunk/src/mame/drivers/gammagic.c
r18228r18229
103103   UINT8 m_atapi_data[ATAPI_DATA_SIZE];
104104   
105105   DECLARE_DRIVER_INIT(gammagic);
106   DECLARE_READ8_MEMBER(vga_setting);
107106};
108107
109108//static void atapi_irq(running_machine &machine, int state);
r18228r18229
545544// Memory is mostly handled by the chipset
546545static ADDRESS_MAP_START( gammagic_map, AS_PROGRAM, 32, gammagic_state )
547546   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
548   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
547   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
549548   AM_RANGE(0x00100000, 0x07ffffff) AM_RAM
550549   AM_RANGE(0x08000000, 0xfffdffff) AM_NOP
551550   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user", 0x20000)/* System BIOS */
r18228r18229
564563   AM_RANGE(0x00f0, 0x01ef) AM_NOP
565564   //AM_RANGE(0x01f0, 0x01f7) AM_READWRITE_LEGACY(atapi_r, atapi_w)
566565   AM_RANGE(0x01f8, 0x03ef) AM_NOP
567   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
568   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
569   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)   
566   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
567   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
568   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
570569   AM_RANGE(0x03f0, 0x0cf7) AM_NOP
571570   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write)
572571   AM_RANGE(0x0400, 0xffff) AM_NOP
r18228r18229
629628   return pic8259_acknowledge( state->m_pic8259_1);
630629}
631630
632READ8_MEMBER( gammagic_state::vga_setting ) { return 0xff; } // hard-code to color
633
634631static MACHINE_START(gammagic)
635632{
636633   gammagic_state *state = machine.driver_data<gammagic_state>();
r18228r18229
798795
799796DRIVER_INIT_MEMBER(gammagic_state,gammagic)
800797{
801   pc_vga_init(machine(), read8_delegate(FUNC(gammagic_state::vga_setting),this));
802798   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, gammagic_set_keyb_int);
803799   kbdc8042_init(machine(), &at8042);
804800   atapi_init(machine());   
trunk/src/mame/drivers/su2000.c
r18228r18229
8181   DECLARE_READ8_MEMBER(get_slave_ack);
8282   virtual void machine_start();
8383   virtual void machine_reset();
84   DECLARE_READ8_MEMBER(vga_setting);
8584};
8685
8786
r18228r18229
9392
9493static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, su2000_state )
9594   AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("mem_bank")
96   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
95   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
9796   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM
9897   AM_RANGE(0x000f0000, 0x000fffff) AM_ROM
9998   AM_RANGE(0xffff0000, 0xffffffff) AM_ROM AM_REGION("maincpu", 0x0f0000)
r18228r18229
101100
102101static ADDRESS_MAP_START( pcat_io, AS_IO, 32, su2000_state )
103102   AM_IMPORT_FROM(pcat32_io_common)
104   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
105   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
106   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
103   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
104   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
105   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
107106ADDRESS_MAP_END
108107
109108
r18228r18229
170169
171170/*************************************************************
172171 *
173 * VGA
174 *
175 *************************************************************/
176
177READ8_MEMBER(su2000_state::vga_setting )
178{
179   /* TODO */
180   return 0xff;
181}
182
183/*************************************************************
184 *
185172 * PIC8259 Configuration
186173 *
187174 *************************************************************/
r18228r18229
290277   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, su2000_set_keyb_int);
291278
292279   kbdc8042_init(machine(), &at8042);
293
294   pc_vga_init(machine(), read8_delegate(FUNC(su2000_state::vga_setting),this));
295280}
296281
297282void su2000_state::machine_reset()
trunk/src/mame/drivers/gamtor.c
r18228r18229
3535      : driver_device(mconfig, type, tag){ }
3636   DECLARE_WRITE32_MEMBER(gamtor_unk_w);
3737   DECLARE_DRIVER_INIT(gaminator);
38   DECLARE_READ8_MEMBER(vga_setting);
3938};
4039
4140WRITE32_MEMBER(gaminator_state::gamtor_unk_w)
r18228r18229
5453
5554   /* standard VGA */
5655   //AM_RANGE(0x40000000, 0x40000fff) AM_RAM // regs
57   AM_RANGE(0x400003b0, 0x400003bf) AM_READWRITE8_LEGACY(vga_port_gamtor_03b0_r, vga_port_gamtor_03b0_w, 0xffffffff)
58   AM_RANGE(0x400003c0, 0x400003cf) AM_READWRITE8_LEGACY(vga_port_gamtor_03c0_r, vga_port_gamtor_03c0_w, 0xffffffff)
59   AM_RANGE(0x400003d0, 0x400003df) AM_READWRITE8_LEGACY(vga_port_gamtor_03d0_r, vga_port_gamtor_03d0_w, 0xffffffff)
56   AM_RANGE(0x400003b0, 0x400003bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
57   AM_RANGE(0x400003c0, 0x400003cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
58   AM_RANGE(0x400003d0, 0x400003df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
6059
61   AM_RANGE(0x44000000, 0x4401ffff) AM_READWRITE8_LEGACY(vga_gamtor_mem_r,vga_gamtor_mem_w, 0xffffffff) // VRAM
60   AM_RANGE(0x44000000, 0x4401ffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) // VRAM
6261//  AM_RANGE(0x44000000, 0x44007fff) AM_RAM AM_SHARE("tmapram1") // puts strings here, looks almost like a tilemap, but where are the tiles?
6362//  AM_RANGE(0x440a0000, 0x440a1fff) AM_RAM AM_SHARE("tmapram2") // beetlem (like above, mirror?)
6463
r18228r18229
7776   MCFG_CPU_PROGRAM_MAP(gaminator_map)
7877   MCFG_CPU_VBLANK_INT_DRIVER("screen", gaminator_state,  irq6_line_hold) // irq6 seems to be needed to get past the ROM checking
7978
80   MCFG_FRAGMENT_ADD( pcvideo_vga )
79   MCFG_FRAGMENT_ADD( pcvideo_gamtor_vga )
8180
8281   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
8382   /* unknown sound */
r18228r18229
12531252   ROM_LOAD( "llc_92_5.6-0", 0x0000, 0x2000000, CRC(c8c2a5d3) SHA1(ec23eff63871cc515ec58a894446d4d639d864e4) )
12541253ROM_END
12551254
1256READ8_MEMBER(gaminator_state::vga_setting ) { return 0xff; } // hard-code to color
1257
1258
12591255DRIVER_INIT_MEMBER(gaminator_state,gaminator)
12601256{
1261   pc_vga_init(machine(), read8_delegate(FUNC(gaminator_state::vga_setting),this));
12621257}
12631258
12641259
trunk/src/mame/drivers/savquest.c
r18228r18229
9494   DECLARE_WRITE_LINE_MEMBER(savquest_pic8259_1_set_int_line);
9595   virtual void machine_start();
9696   virtual void machine_reset();
97   DECLARE_READ8_MEMBER(vga_setting);
9897};
9998
10099// Intel 82439TX System Controller (MXTC)
r18228r18229
397396
398397static ADDRESS_MAP_START(savquest_map, AS_PROGRAM, 32, savquest_state)
399398   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
400   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
399   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
401400   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
402401   AM_RANGE(0x000e0000, 0x000fffff) AM_ROMBANK("bank1")
403402   AM_RANGE(0x000e0000, 0x000fffff) AM_WRITE(bios_ram_w)
r18228r18229
418417   AM_RANGE(0x00e8, 0x00ef) AM_NOP
419418
420419   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
421   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
422   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
423   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
420   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
421   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
422   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
424423   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w)
425424
426425   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
r18228r18229
520519   pic8259_ir6_w(drvstate->m_pic8259_2, state);
521520}
522521
523READ8_MEMBER(savquest_state::vga_setting ) { return 0xff; } // hard-code to color
524
525522void savquest_state::machine_start()
526523{
527524   m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4);
r18228r18229
532529   intel82439tx_init(machine());
533530
534531   kbdc8042_init(machine(), &at8042);
535   pc_vga_init(machine(), read8_delegate(FUNC(savquest_state::vga_setting),this));
536532}
537533
538534void savquest_state::machine_reset()
trunk/src/mame/drivers/xtom3d.c
r18228r18229
115115   DECLARE_WRITE_LINE_MEMBER(xtom3d_pic8259_1_set_int_line);
116116   virtual void machine_start();
117117   virtual void machine_reset();
118   DECLARE_READ8_MEMBER(vga_setting);
119118};
120119
121120// Intel 82439TX System Controller (MXTC)
r18228r18229
526525
527526static ADDRESS_MAP_START(xtom3d_map, AS_PROGRAM, 32, xtom3d_state)
528527   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
529   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
528   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
530529   AM_RANGE(0x000c0000, 0x000c3fff) AM_ROMBANK("video_bank1") AM_WRITE(isa_ram1_w)
531530   AM_RANGE(0x000c4000, 0x000c7fff) AM_ROMBANK("video_bank2") AM_WRITE(isa_ram2_w)
532531   AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1") AM_WRITE(bios_ext1_ram_w)
r18228r18229
550549   AM_RANGE(0x00e8, 0x00ef) AM_NOP
551550
552551   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
553   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
554   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
555   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
552   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
553   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
554   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
556555   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w)
557556
558557   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
r18228r18229
648647   pic8259_ir6_w(drvstate->m_pic8259_2, state);
649648}
650649
651READ8_MEMBER(xtom3d_state::vga_setting ) { return 0xff; } // hard-code to color
652
653650void xtom3d_state::machine_start()
654651{
655652
r18228r18229
667664   intel82439tx_init(machine());
668665
669666   kbdc8042_init(machine(), &at8042);
670   pc_vga_init(machine(), read8_delegate(FUNC(xtom3d_state::vga_setting),this));
671667}
672668
673669void xtom3d_state::machine_reset()
trunk/src/mame/drivers/photoply.c
r18228r18229
5353   DECLARE_WRITE_LINE_MEMBER(at_pit8254_out2_changed);
5454   DECLARE_DRIVER_INIT(photoply);
5555   virtual void machine_start();
56   DECLARE_READ8_MEMBER(vga_setting);
5756};
5857
5958
r18228r18229
240239
241240static ADDRESS_MAP_START( photoply_map, AS_PROGRAM, 32, photoply_state )
242241   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
243   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff) // VGA RAM
242   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff) // VGA RAM
244243   AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0) //???
245244   AM_RANGE(0x000c8000, 0x000cffff) AM_RAM AM_REGION("video_bios", 0)
246245   AM_RANGE(0x000d0000, 0x000dffff) AM_RAM AM_REGION("ex_bios", 0)
r18228r18229
263262   AM_RANGE(0x0278, 0x027f) AM_RAM //parallel port 2
264263   AM_RANGE(0x0378, 0x037f) AM_RAM //parallel port
265264   //AM_RANGE(0x03bc, 0x03bf) AM_RAM //parallel port 3
266   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
267   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
268   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)   
265   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
266   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
267   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
269268//  AM_RANGE(0x03f4, 0x03f7) AM_READ_LEGACY(kludge_r) // fdc
270269ADDRESS_MAP_END
271270
r18228r18229
339338   //there's also a 8x16 entry (just after the 8x8)
340339GFXDECODE_END
341340
342READ8_MEMBER(photoply_state::vga_setting ) { return 0xff; } // hard-code to color
343
344341static MACHINE_CONFIG_START( photoply, photoply_state )
345342   /* basic machine hardware */
346343   MCFG_CPU_ADD("maincpu", I486, 75000000)   /* I486DX4, 75 or 100 Mhz */
r18228r18229
381378
382379DRIVER_INIT_MEMBER(photoply_state,photoply)
383380{
384   pc_vga_init(machine(), read8_delegate(FUNC(photoply_state::vga_setting),this));
385381}
386382
387383GAME( 199?, photoply,  0,   photoply, photoply, photoply_state, photoply, ROT0, "Funworld", "Photo Play 2000 (v2.01)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/mame/drivers/midqslvr.c
r18228r18229
9898   DECLARE_WRITE_LINE_MEMBER(midqslvr_pic8259_1_set_int_line);
9999   virtual void machine_start();
100100   virtual void machine_reset();
101   DECLARE_READ8_MEMBER(vga_setting);
102101};
103102
104103
r18228r18229
535534
536535static ADDRESS_MAP_START(midqslvr_map, AS_PROGRAM, 32, midqslvr_state)
537536   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
538   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
537   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
539538   AM_RANGE(0x000c0000, 0x000c3fff) AM_ROMBANK("video_bank1") AM_WRITE(isa_ram1_w)
540539   AM_RANGE(0x000c4000, 0x000c7fff) AM_ROMBANK("video_bank2") AM_WRITE(isa_ram2_w)
541540   AM_RANGE(0x000e0000, 0x000e3fff) AM_ROMBANK("bios_ext1") AM_WRITE(bios_ext1_ram_w)
r18228r18229
559558   AM_RANGE(0x00e8, 0x00ef) AM_NOP
560559
561560   AM_RANGE(0x01f0, 0x01f7) AM_READWRITE(ide_r, ide_w)
562   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
563   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
564   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)   
561   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
562   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
563   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
565564   AM_RANGE(0x03f0, 0x03f7) AM_READWRITE(fdc_r, fdc_w)
566565
567566   AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
r18228r18229
656655   pic8259_ir6_w(drvstate->m_pic8259_2, state);
657656}
658657
659READ8_MEMBER( midqslvr_state::vga_setting ) { return 0xff; } // hard-code to color
660
661658void midqslvr_state::machine_start()
662659{
663660
r18228r18229
675672   intel82439tx_init(machine());
676673
677674   kbdc8042_init(machine(), &at8042);
678   pc_vga_init(machine(), read8_delegate(FUNC(midqslvr_state::vga_setting),this));
679675}
680676
681677void midqslvr_state::machine_reset()
trunk/src/mame/drivers/calchase.c
r18228r18229
175175   DECLARE_DRIVER_INIT(calchase);
176176   virtual void machine_start();
177177   virtual void machine_reset();
178   DECLARE_READ8_MEMBER(vga_setting);
179178};
180179
181180
r18228r18229
543542
544543static ADDRESS_MAP_START( calchase_map, AS_PROGRAM, 32, calchase_state )
545544   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
546   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(trident_mem_r, trident_mem_w, 0xffffffff) // VGA VRAM
545   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", trident_vga_device, mem_r, mem_w, 0xffffffff) // VGA VRAM
547546   AM_RANGE(0x000c0000, 0x000c7fff) AM_RAM AM_REGION("video_bios", 0)
548547   AM_RANGE(0x000c8000, 0x000cffff) AM_NOP
549548   //AM_RANGE(0x000d0000, 0x000d0003) AM_RAM  // XYLINX - Sincronus serial communication
r18228r18229
600599   AM_RANGE(0x02f8, 0x02ff) AM_NOP //To debug
601600   AM_RANGE(0x0320, 0x038f) AM_NOP //To debug
602601   AM_RANGE(0x03a0, 0x03a7) AM_NOP //To debug
603   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
604   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(trident_03c0_r, trident_03c0_w, 0xffffffff)
605   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(trident_03d0_r, trident_03d0_w, 0xffffffff)   
602   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
603   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", trident_vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
604   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", trident_vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
606605   AM_RANGE(0x03e0, 0x03ef) AM_NOP //To debug
607606   AM_RANGE(0x0378, 0x037f) AM_NOP //To debug
608607   // AM_RANGE(0x0300, 0x03af) AM_NOP
r18228r18229
808807   return pic8259_acknowledge( state->m_pic8259_1);
809808}
810809
811READ8_MEMBER( calchase_state::vga_setting ) { return 0xff; } // hard-code to color
812
813810void calchase_state::machine_start()
814811{
815812   machine().device("maincpu")->execute().set_irq_acknowledge_callback(irq_callback);
r18228r18229
948945   MCFG_PCI_BUS_LEGACY_DEVICE(7, NULL, intel82371ab_pci_r, intel82371ab_pci_w)
949946
950947   /* video hardware */
951   MCFG_FRAGMENT_ADD( pcvideo_vga )
948   MCFG_FRAGMENT_ADD( pcvideo_trident_vga )
952949
953950   /* sound hardware */
954951   MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
r18228r18229
980977{
981978   m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4);
982979
983   pc_vga_init(machine(), read8_delegate(FUNC(calchase_state::vga_setting),this));
984980   init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int);
985981
986982   intel82439tx_init(machine());
trunk/src/mame/drivers/pcat_dyn.c
r18228r18229
4545
4646   DECLARE_DRIVER_INIT(pcat_dyn);
4747   virtual void machine_start();
48   DECLARE_READ8_MEMBER(vga_setting);
4948};
5049
5150
r18228r18229
5352/* TODO: understand the proper ROM loading.*/
5453static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pcat_dyn_state )
5554   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
56   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
55   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
5756   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
5857   AM_RANGE(0x000c8000, 0x000cffff) AM_RAM
5958//  AM_RANGE(0x000d0000, 0x000d7fff) AM_RAM AM_REGION("disk_bios", 0)
r18228r18229
6968static ADDRESS_MAP_START( pcat_io, AS_IO, 32, pcat_dyn_state )
7069   AM_IMPORT_FROM(pcat32_io_common)
7170   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
72   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
73   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
74   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
71   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
72   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
73   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
7574ADDRESS_MAP_END
7675
7776#define AT_KEYB_HELPER(bit, text, key1) \
r18228r18229
113112   pic8259_ir1_w(machine.device("pic8259_1"), state);
114113}
115114
116READ8_MEMBER(pcat_dyn_state::vga_setting ) { return 0xff; } // hard-code to color
117
118115static void set_gate_a20(running_machine &machine, int a20)
119116{
120117   machine.device("maincpu")->execute().set_input_line(INPUT_LINE_A20, a20);
r18228r18229
200197
201198DRIVER_INIT_MEMBER(pcat_dyn_state,pcat_dyn)
202199{
203   pc_vga_init(machine(), read8_delegate(FUNC(pcat_dyn_state::vga_setting),this));
204200}
205201
206202GAME( 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 )
trunk/src/mame/drivers/pcat_nit.c
r18228r18229
112112   DECLARE_WRITE_LINE_MEMBER(at_com_interrupt_1);
113113   DECLARE_DRIVER_INIT(pcat_nit);
114114   virtual void machine_start();
115   DECLARE_READ8_MEMBER(vga_setting);
116115};
117116
118117WRITE_LINE_MEMBER(pcat_nit_state::microtouch_out)
r18228r18229
183182
184183static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pcat_nit_state )
185184   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
186   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
185   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
187186   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0) AM_WRITENOP
188187   AM_RANGE(0x000d0000, 0x000d3fff) AM_RAM AM_REGION("disk_bios", 0)
189188   AM_RANGE(0x000d7000, 0x000d7003) AM_WRITE8(pcat_nit_rombank_w, 0xff)
r18228r18229
211210   AM_IMPORT_FROM(pcat32_io_common)
212211   AM_RANGE(0x0278, 0x027f) AM_READ8(pcat_nit_io_r, 0xffffffff) AM_WRITENOP
213212   AM_RANGE(0x0280, 0x0283) AM_READNOP
214   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
215   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
216   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
213   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
214   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
215   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
217216   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
218217ADDRESS_MAP_END
219218
r18228r18229
231230   pic8259_ir1_w(machine.device("pic8259_1"), state);
232231}
233232
234READ8_MEMBER(pcat_nit_state::vga_setting ) { return 0xff; } // hard-code to color
235
236233void pcat_nit_state::machine_start()
237234{
238235   machine().device("maincpu")->execute().set_irq_acknowledge_callback(pcat_irq_callback);
r18228r18229
429426{
430427   m_banked_nvram = auto_alloc_array(machine(), UINT8, 0x2000);
431428   machine().device<nvram_device>("nvram")->set_base(m_banked_nvram, 0x2000);
432
433   pc_vga_init(machine(), read8_delegate(FUNC(pcat_nit_state::vga_setting),this));
434429}
435430
436431GAME( 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 )
trunk/src/mame/drivers/magtouch.c
r18228r18229
100100   DECLARE_WRITE_LINE_MEMBER(at_com_interrupt_1);
101101   DECLARE_DRIVER_INIT(magtouch);
102102   virtual void machine_start();
103   DECLARE_READ8_MEMBER(vga_setting);
104103};
105104
106105
r18228r18229
169168
170169static ADDRESS_MAP_START( magtouch_map, AS_PROGRAM, 32, magtouch_state )
171170   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
172   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
171   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
173172   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
174173   AM_RANGE(0x000d8000, 0x000dffff) AM_ROMBANK("rombank")
175174   AM_RANGE(0x000f0000, 0x000fffff) AM_RAM AM_REGION("bios", 0 )
r18228r18229
180179static ADDRESS_MAP_START( magtouch_io, AS_IO, 32, magtouch_state )
181180   AM_IMPORT_FROM(pcat32_io_common)
182181   AM_RANGE(0x02e0, 0x02e7) AM_READWRITE8(magtouch_io_r, magtouch_io_w, 0xffffffff)
183   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
184   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
185   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
182   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
183   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
184   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
186185   AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE8("ns16450_0", ns16450_device, ins8250_r, ins8250_w, 0xffffffff)
187186ADDRESS_MAP_END
188187
r18228r18229
200199   pic8259_ir1_w(machine.device("pic8259_1"), state);
201200}
202201
203READ8_MEMBER( magtouch_state::vga_setting ) { return 0xff; } // hard-code to color
204
205202void magtouch_state::machine_start()
206203{
207204   machine().device("maincpu")->execute().set_irq_acknowledge_callback(pcat_irq_callback);
r18228r18229
252249
253250DRIVER_INIT_MEMBER(magtouch_state,magtouch)
254251{
255   pc_vga_init(machine(), read8_delegate(FUNC(magtouch_state::vga_setting),this));
256252}
257253
254
258255GAME( 1995, magtouch,   0,         magtouch,  magtouch, magtouch_state, magtouch, ROT0, "Micro Manufacturing",     "Magical Touch", GAME_NOT_WORKING | GAME_NO_SOUND )
trunk/src/mame/drivers/pangofun.c
r18228r18229
107107
108108   DECLARE_DRIVER_INIT(pangofun);
109109   virtual void machine_start();
110   DECLARE_READ8_MEMBER(vga_setting);
111110};
112111
113112
114113static ADDRESS_MAP_START( pcat_map, AS_PROGRAM, 32, pangofun_state )
115114   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
116   AM_RANGE(0x000a0000, 0x000bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)
115   AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
117116   AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM AM_REGION("video_bios", 0)
118117   AM_RANGE(0x000f0000, 0x000fffff) AM_ROM AM_REGION("bios", 0 )
119118   AM_RANGE(0x00100000, 0x00ffffff) AM_NOP
r18228r18229
124123static ADDRESS_MAP_START( pcat_io, AS_IO, 32, pangofun_state )
125124   AM_IMPORT_FROM(pcat32_io_common)
126125   AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("rtc", mc146818_device, read, write, 0xffffffff)
127   AM_RANGE(0x03b0, 0x03bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
128   AM_RANGE(0x03c0, 0x03cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
129   AM_RANGE(0x03d0, 0x03df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)     
126   AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
127   AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
128   AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)   
130129ADDRESS_MAP_END
131130
132131#define AT_KEYB_HELPER(bit, text, key1) \
r18228r18229
168167   pic8259_ir1_w(machine.device("pic8259_1"), state);
169168}
170169
171READ8_MEMBER(pangofun_state::vga_setting ) { return 0xff; } // hard-code to color
172
173170static void set_gate_a20(running_machine &machine, int a20)
174171{
175172   machine.device("maincpu")->execute().set_input_line(INPUT_LINE_A20, a20);
r18228r18229
247244
248245DRIVER_INIT_MEMBER(pangofun_state,pangofun)
249246{
250   pc_vga_init(machine(), read8_delegate(FUNC(pangofun_state::vga_setting),this));
251247}
252248
253249GAME( 1995, pangofun,  0,   pangofun, pangofun, pangofun_state, pangofun, ROT0, "InfoCube", "Pango Fun (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND )
trunk/src/emu/video/pc_vga.c
r18228r18229
333333
334334#define LOG_8514      0
335335
336static VIDEO_RESET( vga );
337
338336/***************************************************************************
339337
340    MachineDriver stuff
338    Generic VGA
341339
342340***************************************************************************/
341// device type definition
342const device_type VGA = &device_creator<vga_device>;
343const device_type TSENG_VGA = &device_creator<tseng_vga_device>;
344const device_type TRIDENT_VGA = &device_creator<trident_vga_device>;
345const device_type S3_VGA = &device_creator<s3_vga_device>;
346const device_type GAMTOR_VGA = &device_creator<gamtor_vga_device>;
347const device_type ATI_VGA = &device_creator<ati_vga_device>;
348const device_type CIRRUS_VGA = &device_creator<cirrus_vga_device>;
343349
344void pc_video_start(running_machine &machine)
350vga_device::vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
351    : device_t(mconfig, type, name, tag, owner, clock)
345352{
346   // ...
353}
347354
355vga_device::vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
356    : device_t(mconfig, VGA, "VGA", tag, owner, clock)
357{
358}
359
360svga_device::svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
361    : vga_device(mconfig, type, name, tag, owner, clock)
362{
363}
364
365tseng_vga_device::tseng_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
366    : svga_device(mconfig, TSENG_VGA, "TSENG_VGA", tag, owner, clock)
367{
368}
369
370trident_vga_device::trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
371    : svga_device(mconfig, TRIDENT_VGA, "TRIDENT_VGA", tag, owner, clock)
372{
373}
374
375s3_vga_device::s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
376    : svga_device(mconfig, type, name, tag, owner, clock)
377{
378}
379
380s3_vga_device::s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
381    : svga_device(mconfig, S3_VGA, "S3_VGA", tag, owner, clock)
382{
383}
384
385gamtor_vga_device::gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
386    : svga_device(mconfig, GAMTOR_VGA, "GAMTOR_VGA", tag, owner, clock)
387{
388}
389
390ati_vga_device::ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
391    : s3_vga_device(mconfig, ATI_VGA, "ATI_VGA", tag, owner, clock)
392{
393}
394cirrus_vga_device::cirrus_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
395    : svga_device(mconfig, CIRRUS_VGA, "CIRRUS_VGA", tag, owner, clock)
396{
397}
398
399
400void vga_device::device_start()
401{
402   memset(&vga, 0, sizeof(vga));
403
404   int i;
405   for (i = 0; i < 0x100; i++)
406      palette_set_color_rgb(machine(), i, 0, 0, 0);
407
348408   // Avoid an infinite loop when displaying.  0 is not possible anyway.
349409   vga.crtc.maximum_scan_line = 1;
410   
411
412   // copy over interfaces
413   vga.read_dipswitch = read8_delegate(); //read_dipswitch;   
414   vga.svga_intf.vram_size = 0x100000;
415   vga.svga_intf.seq_regcount = 0x05;
416   vga.svga_intf.crtc_regcount = 0x19;
417
418   vga.memory   = auto_alloc_array_clear(machine(), UINT8, vga.svga_intf.vram_size);   
350419}
351420
352void s3_video_start(running_machine &machine)
421void cirrus_vga_device::device_start()
353422{
354   int x;
423   memset(&vga, 0, sizeof(vga));
424
425   int i;
426   for (i = 0; i < 0x100; i++)
427      palette_set_color_rgb(machine(), i, 0, 0, 0);
428
355429   // Avoid an infinite loop when displaying.  0 is not possible anyway.
356430   vga.crtc.maximum_scan_line = 1;
431   
432
433   // copy over interfaces
434   vga.read_dipswitch = read8_delegate(); //read_dipswitch;   
435   vga.svga_intf.vram_size = 0x200000;
436   vga.svga_intf.seq_regcount = 0x08;
437   vga.svga_intf.crtc_regcount = 0x19;
438
439   vga.memory   = auto_alloc_array_clear(machine(), UINT8, vga.svga_intf.vram_size);   
440}
441
442void s3_vga_device::device_start()
443{
444   vga_device::device_start();   
445   int x;
357446   // Initialise hardware graphics cursor colours, Windows 95 doesn't touch the registers for some reason
358447   for(x=0;x<4;x++)
359448   {
r18228r18229
362451   }
363452}
364453
365static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
454void vga_device::vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect)
366455{
367456   UINT8 ch, attr;
368457   UINT8 bits;
r18228r18229
374463   pen_t pen;
375464
376465   if(vga.crtc.cursor_enable)
377      vga.cursor.visible = machine.primary_screen->frame_number() & 0x10;
466      vga.cursor.visible = machine().primary_screen->frame_number() & 0x10;
378467   else
379468      vga.cursor.visible = 0;
380469
r18228r18229
387476         attr = vga.memory[(pos<<1) + 1];
388477         font_base = 0x20000+(ch<<5);
389478         font_base += ((attr & 8) ? vga.sequencer.char_sel.B : vga.sequencer.char_sel.A)*0x2000;
390         blink_en = (vga.attribute.data[0x10]&8&&machine.primary_screen->frame_number() & 0x20) ? attr & 0x80 : 0;
479         blink_en = (vga.attribute.data[0x10]&8&&machine().primary_screen->frame_number() & 0x20) ? attr & 0x80 : 0;
391480
392481         fore_col = attr & 0xf;
393482         back_col = (attr & 0x70) >> 4;
r18228r18229
405494               else
406495                  pen = vga.pens[back_col];
407496
408               if(!machine.primary_screen->visible_area().contains(column*width+w, line+h))
497               if(!machine().primary_screen->visible_area().contains(column*width+w, line+h))
409498                  continue;
410499               bitmapline[column*width+w] = pen;
411500
r18228r18229
418507               else
419508                  pen = vga.pens[back_col];
420509
421               if(!machine.primary_screen->visible_area().contains(column*width+w, line+h))
510               if(!machine().primary_screen->visible_area().contains(column*width+w, line+h))
422511                  continue;
423512               bitmapline[column*width+w] = pen;
424513            }
r18228r18229
429518                (h<=vga.crtc.cursor_scan_end)&&(h<height)&&(line+h<TEXT_LINES);
430519                h++)
431520            {
432               if(!machine.primary_screen->visible_area().contains(column*width, line+h))
521               if(!machine().primary_screen->visible_area().contains(column*width, line+h))
433522                  continue;
434523               bitmap.plot_box(column*width, line+h, width, 1, vga.pens[attr&0xf]);
435524            }
r18228r18229
438527   }
439528}
440529
441static void vga_vh_ega(running_machine &machine, bitmap_rgb32 &bitmap,  const rectangle &cliprect)
530void vga_device::vga_vh_ega(bitmap_rgb32 &bitmap,  const rectangle &cliprect)
442531{
443532   int pos, line, column, c, addr, i, yi;
444533   int height = vga.crtc.maximum_scan_line * (vga.crtc.scan_doubling + 1);
r18228r18229
465554            for (i = 7; i >= 0; i--)
466555            {
467556               pen = vga.pens[(data[0]&1) | (data[1]&2) | (data[2]&4) | (data[3]&8)];
468               if(!machine.primary_screen->visible_area().contains(c+i, line + yi))
557               if(!machine().primary_screen->visible_area().contains(c+i, line + yi))
469558                  continue;
470559               bitmapline[c+i] = pen;
471560
r18228r18229
480569}
481570
482571/* TODO: I'm guessing that in 256 colors mode every pixel actually outputs two pixels. Is it right? */
483static void vga_vh_vga(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
572void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect)
484573{
485574   int pos, line, column, c, addr, curr_addr;
486575   UINT32 *bitmapline;
r18228r18229
512601
513602               for(xi=0;xi<8;xi++)
514603               {
515                  if(!machine.primary_screen->visible_area().contains(c+xi-pel_shift, line + yi))
604                  if(!machine().primary_screen->visible_area().contains(c+xi-pel_shift, line + yi))
516605                     continue;
517                  bitmapline[c+xi-pel_shift] = machine.pens[vga.memory[(pos & 0xffff)+((xi >> 1)*0x10000)]];
606                  bitmapline[c+xi-pel_shift] = machine().pens[vga.memory[(pos & 0xffff)+((xi >> 1)*0x10000)]];
518607               }
519608            }
520609         }
r18228r18229
539628
540629               for(xi=0;xi<0x10;xi++)
541630               {
542                  if(!machine.primary_screen->visible_area().contains(c+xi-pel_shift, line + yi))
631                  if(!machine().primary_screen->visible_area().contains(c+xi-pel_shift, line + yi))
543632                     continue;
544                  bitmapline[c+xi-pel_shift] = machine.pens[vga.memory[(pos+(xi >> 1)) & 0xffff]];
633                  bitmapline[c+xi-pel_shift] = machine().pens[vga.memory[(pos+(xi >> 1)) & 0xffff]];
545634               }
546635            }
547636         }
r18228r18229
549638   }
550639}
551640
552static void vga_vh_cga(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
641void vga_device::vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect)
553642{
554643   UINT32 *bitmapline;
555644   int height = (vga.crtc.scan_doubling + 1);
r18228r18229
573662            for(xi=0;xi<4;xi++)
574663            {
575664               pen = vga.pens[(vga.memory[addr] >> (6-xi*2)) & 3];
576               if(!machine.primary_screen->visible_area().contains(x+xi, y * height + yi))
665               if(!machine().primary_screen->visible_area().contains(x+xi, y * height + yi))
577666                  continue;
578667               bitmapline[x+xi] = pen;
579668            }
r18228r18229
584673   }
585674}
586675
587static void vga_vh_mono(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
676void vga_device::vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect)
588677{
589678   UINT32 *bitmapline;
590679   int height = (vga.crtc.scan_doubling + 1);
r18228r18229
608697            for(xi=0;xi<8;xi++)
609698            {
610699               pen = vga.pens[(vga.memory[addr] >> (7-xi)) & 1];
611               if(!machine.primary_screen->visible_area().contains(x+xi, y * height + yi))
700               if(!machine().primary_screen->visible_area().contains(x+xi, y * height + yi))
612701                  continue;
613702               bitmapline[x+xi] = pen;
614703            }
r18228r18229
619708   }
620709}
621710
622static void svga_vh_rgb8(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
711void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect)
623712{
624713   int pos, line, column, c, addr, curr_addr;
625714   UINT32 *bitmapline;
r18228r18229
661750
662751               for(xi=0;xi<8;xi++)
663752               {
664                  if(!machine.primary_screen->visible_area().contains(c+xi, line + yi))
753                  if(!machine().primary_screen->visible_area().contains(c+xi, line + yi))
665754                     continue;
666                  bitmapline[c+xi] = machine.pens[vga.memory[(pos+(xi))]];
755                  bitmapline[c+xi] = machine().pens[vga.memory[(pos+(xi))]];
667756               }
668757            }
669758         }
r18228r18229
671760   }
672761}
673762
674static void svga_vh_rgb15(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
763void svga_device::svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect)
675764{
676765   #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8))
677766   #define IV 0xff000000
r18228r18229
700789         {
701790            int r,g,b;
702791
703            if(!machine.primary_screen->visible_area().contains(c+xi, line + yi))
792            if(!machine().primary_screen->visible_area().contains(c+xi, line + yi))
704793               continue;
705794
706795            r = (MV(pos+xm)&0x7c00)>>10;
r18228r18229
715804   }
716805}
717806
718static void svga_vh_rgb16(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
807void svga_device::svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect)
719808{
720809   #define MV(x) (vga.memory[x]+(vga.memory[x+1]<<8))
721810   #define IV 0xff000000
r18228r18229
744833         {
745834            int r,g,b;
746835
747            if(!machine.primary_screen->visible_area().contains(c+xi, line + yi))
836            if(!machine().primary_screen->visible_area().contains(c+xi, line + yi))
748837               continue;
749838
750839            r = (MV(pos+xm)&0xf800)>>11;
r18228r18229
759848   }
760849}
761850
762static void svga_vh_rgb24(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
851void svga_device::svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect)
763852{
764853   #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16))
765854   #define ID 0xff000000
r18228r18229
788877         {
789878            int r,g,b;
790879
791            if(!machine.primary_screen->visible_area().contains(c+xi, line + yi))
880            if(!machine().primary_screen->visible_area().contains(c+xi, line + yi))
792881               continue;
793882
794883            r = (MD(pos+xm)&0xff0000)>>16;
r18228r18229
800889   }
801890}
802891
803static void svga_vh_rgb32(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
892void svga_device::svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect)
804893{
805894   #define MD(x) (vga.memory[x]+(vga.memory[x+1]<<8)+(vga.memory[x+2]<<16))
806895   #define ID 0xff000000
r18228r18229
829918         {
830919            int r,g,b;
831920
832            if(!machine.primary_screen->visible_area().contains(c+xi, line + yi))
921            if(!machine().primary_screen->visible_area().contains(c+xi, line + yi))
833922               continue;
834923
835924            r = (MD(pos+xm)&0xff0000)>>16;
r18228r18229
853942   RGB15_MODE,
854943   RGB16_MODE,
855944   RGB24_MODE,
856   RGB32_MODE,
857   SVGA_HACK
945   RGB32_MODE
858946};
859947
948UINT8 vga_device::pc_vga_choosevideomode()
949{
950   int i;
860951
861static UINT8 pc_vga_choosevideomode(running_machine &machine)
952   if (vga.crtc.sync_en)
953   {
954      if (vga.dac.dirty)
955      {
956         for (i=0; i<256;i++)
957         {
958            /* TODO: color shifters? */
959            palette_set_color_rgb(machine(), i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
960                            (vga.dac.color[i & vga.dac.mask].green & 0x3f) << 2,
961                            (vga.dac.color[i & vga.dac.mask].blue & 0x3f) << 2);
962         }
963         vga.dac.dirty = 0;
964      }
965
966      if (vga.attribute.data[0x10] & 0x80)
967      {
968         for (i=0; i<16;i++)
969         {
970            vga.pens[i] = machine().pens[(vga.attribute.data[i]&0x0f)
971                               |((vga.attribute.data[0x14]&0xf)<<4)];
972         }
973      }
974      else
975      {
976         for (i=0; i<16;i++)
977         {
978            vga.pens[i]=machine().pens[(vga.attribute.data[i]&0x3f)
979                               |((vga.attribute.data[0x14]&0xc)<<4)];
980         }
981      }
982
983      if (!GRAPHIC_MODE)
984      {
985         return TEXT_MODE;
986      }
987      else if (vga.gc.shift256)
988      {
989         return VGA_MODE;
990      }
991      else if (vga.gc.shift_reg)
992      {
993         return CGA_MODE;
994      }
995      else if (vga.gc.memory_map_sel == 0x03)
996      {
997         return MONO_MODE;
998      }
999      else
1000      {
1001         return EGA_MODE;
1002      }
1003   }
1004
1005   return SCREEN_OFF;
1006}
1007
1008
1009UINT8 svga_device::pc_vga_choosevideomode()
8621010{
8631011   int i;
8641012
r18228r18229
8691017         for (i=0; i<256;i++)
8701018         {
8711019            /* TODO: color shifters? */
872            palette_set_color_rgb(machine, i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
1020            palette_set_color_rgb(machine(), i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
8731021                            (vga.dac.color[i & vga.dac.mask].green & 0x3f) << 2,
8741022                            (vga.dac.color[i & vga.dac.mask].blue & 0x3f) << 2);
8751023         }
r18228r18229
8801028      {
8811029         for (i=0; i<16;i++)
8821030         {
883            vga.pens[i] = machine.pens[(vga.attribute.data[i]&0x0f)
1031            vga.pens[i] = machine().pens[(vga.attribute.data[i]&0x0f)
8841032                               |((vga.attribute.data[0x14]&0xf)<<4)];
8851033         }
8861034      }
r18228r18229
8881036      {
8891037         for (i=0; i<16;i++)
8901038         {
891            vga.pens[i]=machine.pens[(vga.attribute.data[i]&0x3f)
1039            vga.pens[i]=machine().pens[(vga.attribute.data[i]&0x3f)
8921040                               |((vga.attribute.data[0x14]&0xc)<<4)];
8931041         }
8941042      }
r18228r18229
9151063      }
9161064      else if (!GRAPHIC_MODE)
9171065      {
918         //proc = vga_vh_text;
919         //*height = TEXT_LINES;
920         //*width = TEXT_COLUMNS * CHAR_WIDTH;
921
9221066         return TEXT_MODE;
9231067      }
9241068      else if (vga.gc.shift256)
9251069      {
926         //proc = vga_vh_vga;
927         //*height = LINES;
928         //*width = VGA_COLUMNS * 8;
9291070         return VGA_MODE;
9301071      }
9311072      else if (vga.gc.shift_reg)
9321073      {
933         // cga
9341074         return CGA_MODE;
9351075      }
9361076      else if (vga.gc.memory_map_sel == 0x03)
9371077      {
938         // mono
9391078         return MONO_MODE;
9401079      }
9411080      else
9421081      {
943         //proc = vga_vh_ega;
944         //*height = LINES;
945         //*width = EGA_COLUMNS * 8;
9461082         return EGA_MODE;
9471083      }
9481084   }
r18228r18229
9501086   return SCREEN_OFF;
9511087}
9521088
953SCREEN_UPDATE_RGB32( pc_video )
1089
1090UINT32 vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
9541091{
955   UINT8 cur_mode = pc_vga_choosevideomode(screen.machine());
1092   UINT8 cur_mode = pc_vga_choosevideomode();
1093   switch(cur_mode)
1094   {
1095      case SCREEN_OFF:   bitmap.fill  (get_black_pen(machine()), cliprect);break;
1096      case TEXT_MODE:    vga_vh_text  (bitmap, cliprect); break;
1097      case VGA_MODE:     vga_vh_vga   (bitmap, cliprect); break;
1098      case EGA_MODE:     vga_vh_ega   (bitmap, cliprect); break;
1099      case CGA_MODE:     vga_vh_cga   (bitmap, cliprect); break;
1100      case MONO_MODE:    vga_vh_mono  (bitmap, cliprect); break;
1101   }
9561102
957   //popmessage("%02x %02x",cur_mode,vga.attribute.data[0x13]);
958   //popmessage("%d",vga.attribute.pel_shift);
959   //popmessage("%d %d %d",vga.crtc.vert_blank_start,vga.crtc.vert_blank_end,vga.crtc.vert_total);
960
1103   return 0;
1104}
1105UINT32 svga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
1106{
1107   UINT8 cur_mode = pc_vga_choosevideomode();
9611108   switch(cur_mode)
9621109   {
963      case SCREEN_OFF:   bitmap.fill  (get_black_pen(screen.machine()), cliprect);break;
964      case TEXT_MODE:    vga_vh_text  (screen.machine(), bitmap, cliprect); break;
965      case VGA_MODE:     vga_vh_vga   (screen.machine(), bitmap, cliprect); break;
966      case EGA_MODE:     vga_vh_ega   (screen.machine(), bitmap, cliprect); break;
967      case CGA_MODE:     vga_vh_cga   (screen.machine(), bitmap, cliprect); break;
968      case MONO_MODE:    vga_vh_mono  (screen.machine(), bitmap, cliprect); break;
969      case RGB8_MODE:    svga_vh_rgb8 (screen.machine(), bitmap, cliprect); break;
970      case RGB15_MODE:   svga_vh_rgb15(screen.machine(), bitmap, cliprect); break;
971      case RGB16_MODE:   svga_vh_rgb16(screen.machine(), bitmap, cliprect); break;
972      case RGB24_MODE:   svga_vh_rgb24(screen.machine(), bitmap, cliprect); break;
973      case RGB32_MODE:   svga_vh_rgb32(screen.machine(), bitmap, cliprect); break;
1110      case SCREEN_OFF:   bitmap.fill  (get_black_pen(machine()), cliprect);break;
1111      case TEXT_MODE:    vga_vh_text  (bitmap, cliprect); break;
1112      case VGA_MODE:     vga_vh_vga   (bitmap, cliprect); break;
1113      case EGA_MODE:     vga_vh_ega   (bitmap, cliprect); break;
1114      case CGA_MODE:     vga_vh_cga   (bitmap, cliprect); break;
1115      case MONO_MODE:    vga_vh_mono  (bitmap, cliprect); break;
1116      case RGB8_MODE:    svga_vh_rgb8 (bitmap, cliprect); break;
1117      case RGB15_MODE:   svga_vh_rgb15(bitmap, cliprect); break;
1118      case RGB16_MODE:   svga_vh_rgb16(bitmap, cliprect); break;
1119      case RGB24_MODE:   svga_vh_rgb24(bitmap, cliprect); break;
1120      case RGB32_MODE:   svga_vh_rgb32(bitmap, cliprect); break;
9741121   }
9751122
9761123   return 0;
9771124}
9781125
979SCREEN_UPDATE_RGB32( pc_video_s3 )
1126UINT32 s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
9801127{
9811128   UINT8 cur_mode = 0;
9821129
983   SCREEN_UPDATE32_CALL( pc_video );
1130   svga_device::screen_update(screen, bitmap, cliprect);
9841131
985   cur_mode = pc_vga_choosevideomode(screen.machine());
1132   cur_mode = pc_vga_choosevideomode();
9861133
9871134   // draw hardware graphics cursor
9881135   // TODO: support 16 bit and greater video modes
r18228r18229
10551202
10561203/***************************************************************************/
10571204
1058INLINE UINT8 rotate_right(UINT8 val)
1205inline UINT8 vga_device::rotate_right(UINT8 val)
10591206{
10601207   return (val >> vga.gc.rotate_count) | (val << (8 - vga.gc.rotate_count));
10611208}
10621209
1063INLINE UINT8 vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask)
1210inline UINT8 vga_device::vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask)
10641211{
10651212   UINT8 res = 0;
10661213
r18228r18229
10831230   return res;
10841231}
10851232
1086INLINE UINT8 vga_latch_write(int offs, UINT8 data)
1233inline UINT8 vga_device::vga_latch_write(int offs, UINT8 data)
10871234{
10881235   UINT8 res = 0;
10891236
r18228r18229
11101257   return res;
11111258}
11121259
1113static UINT8 crtc_reg_read(UINT8 index)
1260UINT8 vga_device::crtc_reg_read(UINT8 index)
11141261{
11151262   UINT8 res;
11161263
r18228r18229
12241371   return res;
12251372}
12261373
1227static void recompute_params_clock(running_machine &machine, int divisor, int xtal)
1374void vga_device::recompute_params_clock(int divisor, int xtal)
12281375{
12291376   int vblank_period,hblank_period;
12301377   attoseconds_t refresh;
r18228r18229
12451392
12461393   refresh  = HZ_TO_ATTOSECONDS(pixel_clock) * (hblank_period) * vblank_period;
12471394
1248   machine.primary_screen->configure((hblank_period), (vblank_period), visarea, refresh );
1395   machine().primary_screen->configure((hblank_period), (vblank_period), visarea, refresh );
12491396//  popmessage("%d %d\n",vga.crtc.horz_total * 8,vga.crtc.vert_total);
12501397}
12511398
1252static void recompute_params(running_machine &machine)
1399void vga_device::recompute_params()
12531400{
1254   recompute_params_clock(machine, 1, (vga.miscellaneous_output & 0xc) ? XTAL_28_63636MHz : XTAL_25_1748MHz);
1401   recompute_params_clock(1, (vga.miscellaneous_output & 0xc) ? XTAL_28_63636MHz : XTAL_25_1748MHz);
12551402   if(vga.miscellaneous_output & 8)
12561403      logerror("Warning: VGA external clock latch selected\n");
12571404}
12581405
1259static void crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data)
1406void vga_device::crtc_reg_write(UINT8 index, UINT8 data)
12601407{
12611408   /* Doom does this */
12621409//  if(vga.crtc.protect_enable && index <= 0x07)
r18228r18229
12681415         if(vga.crtc.protect_enable)
12691416            break;
12701417         vga.crtc.horz_total = (vga.crtc.horz_total & ~0xff) | (data & 0xff);
1271         recompute_params(machine);
1418         recompute_params();
12721419         break;
12731420      case 0x01:
12741421         if(vga.crtc.protect_enable)
12751422            break;
12761423         vga.crtc.horz_disp_end = (data & 0xff);
1277         recompute_params(machine);
1424         recompute_params();
12781425         break;
12791426      case 0x02:
12801427         if(vga.crtc.protect_enable)
r18228r18229
13071454            break;
13081455         vga.crtc.vert_total &= ~0xff;
13091456         vga.crtc.vert_total |= data & 0xff;
1310         recompute_params(machine);
1457         recompute_params();
13111458         break;
13121459      case 0x07: // Overflow Register
13131460         vga.crtc.line_compare       &= ~0x100;
r18228r18229
13251472         vga.crtc.vert_retrace_start |= ((data & 0x04) << (8-2));
13261473         vga.crtc.vert_disp_end      |= ((data & 0x02) << (8-1));
13271474         vga.crtc.vert_total         |= ((data & 0x01) << (8-0));
1328         recompute_params(machine);
1475         recompute_params();
13291476         break;
13301477      case 0x08: // Preset Row Scan Register
13311478         vga.crtc.byte_panning = (data & 0x60) >> 5;
r18228r18229
13691516      case 0x12:
13701517         vga.crtc.vert_disp_end &= ~0xff;
13711518         vga.crtc.vert_disp_end |= data & 0xff;
1372         recompute_params(machine);
1519         recompute_params();
13731520         break;
13741521      case 0x13:
13751522         vga.crtc.offset = data & 0xff;
r18228r18229
14051552   }
14061553}
14071554
1408static void seq_reg_write(running_machine &machine, UINT8 index, UINT8 data)
1555void vga_device::seq_reg_write(UINT8 index, UINT8 data)
14091556{
14101557   switch(index)
14111558   {
r18228r18229
14231570   }
14241571}
14251572
1426static UINT8 vga_vblank(running_machine &machine)
1573UINT8 vga_device::vga_vblank()
14271574{
14281575   UINT8 res;
14291576   UINT16 vblank_start,vblank_end,vpos;
r18228r18229
14321579   res = 0;
14331580   vblank_start = vga.crtc.vert_blank_start;
14341581   vblank_end = vga.crtc.vert_blank_start + vga.crtc.vert_blank_end;
1435   vpos = machine.primary_screen->vpos();
1582   vpos = machine().primary_screen->vpos();
14361583
14371584   /* check if we are under vblank period */
14381585   if(vblank_end > vga.crtc.vert_total)
r18228r18229
14521599   return res;
14531600}
14541601
1455static READ8_HANDLER(vga_crtc_r)
1602READ8_MEMBER(vga_device::vga_crtc_r)
14561603{
14571604   UINT8 data = 0xff;
14581605
r18228r18229
14691616      data = 0;
14701617
14711618      hsync = space.machine().primary_screen->hblank() & 1;
1472      vsync = vga_vblank(space.machine()); //space.machine().primary_screen->vblank() & 1;
1619      vsync = vga_vblank(); //space.machine().primary_screen->vblank() & 1;
14731620
14741621      data |= (hsync | vsync) & 1; // DD - display disable register
14751622      data |= (vsync & 1) << 3; // VRetrace register
r18228r18229
15021649   return data;
15031650}
15041651
1505static WRITE8_HANDLER(vga_crtc_w)
1652WRITE8_MEMBER(vga_device::vga_crtc_w)
15061653{
15071654   switch (offset)
15081655   {
r18228r18229
15191666               data);
15201667         }
15211668
1522         crtc_reg_write(space.machine(),vga.crtc.index,data);
1669         crtc_reg_write(vga.crtc.index,data);
15231670         //space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos());
15241671         #if 0
15251672         if((vga.crtc.index & 0xfe) != 0x0e)
r18228r18229
15351682
15361683
15371684
1538READ8_HANDLER( vga_port_03b0_r )
1685READ8_MEMBER(vga_device::port_03b0_r)
15391686{
15401687   UINT8 data = 0xff;
15411688   if (CRTC_PORT_ADDR==0x3b0)
r18228r18229
15431690   return data;
15441691}
15451692
1546static UINT8 gc_reg_read(running_machine &machine,UINT8 index)
1693UINT8 vga_device::gc_reg_read(UINT8 index)
15471694{
15481695   UINT8 res;
15491696
r18228r18229
15911738   return res;
15921739}
15931740
1594READ8_HANDLER( vga_port_03c0_r )
1741READ8_MEMBER(vga_device::port_03c0_r)
15951742{
15961743   UINT8 data = 0xff;
15971744
r18228r18229
16151762            case 3:
16161763               if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x01)
16171764                  data |= 0x10;
1765               else
1766                  data |= 0x10;
16181767               break;
16191768            case 2:
16201769               if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x02)
16211770                  data |= 0x10;
1771               else
1772                  data |= 0x10;
16221773               break;
16231774            case 1:
16241775               if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x04)
16251776                  data |= 0x10;
1777               else
1778                  data |= 0x10;
16261779               break;
16271780            case 0:
16281781               if (!vga.read_dipswitch.isnull() && vga.read_dipswitch(space, 0, mem_mask) & 0x08)
16291782                  data |= 0x10;
1783               else
1784                  data |= 0x10;
16301785               break;
16311786         }
16321787         break;
r18228r18229
16931848         break;
16941849
16951850      case 0xf:
1696         data = gc_reg_read(space.machine(),vga.gc.index);
1851         data = gc_reg_read(vga.gc.index);
16971852         break;
16981853   }
16991854   return data;
17001855}
17011856
1702READ8_HANDLER(vga_port_03d0_r)
1857READ8_MEMBER(vga_device::port_03d0_r)
17031858{
17041859   UINT8 data = 0xff;
17051860   if (CRTC_PORT_ADDR == 0x3d0)
r18228r18229
17131868   return data;
17141869}
17151870
1716WRITE8_HANDLER( vga_port_03b0_w )
1871WRITE8_MEMBER(vga_device::port_03b0_w)
17171872{
17181873   if (LOG_ACCESSES)
17191874      logerror("vga_port_03b0_w(): port=0x%04x data=0x%02x\n", offset + 0x3b0, data);
r18228r18229
17221877      vga_crtc_w(space, offset, data, mem_mask);
17231878}
17241879
1725static void attribute_reg_write(UINT8 index, UINT8 data)
1880void vga_device::attribute_reg_write(UINT8 index, UINT8 data)
17261881{
17271882   if((index & 0x30) == 0)
17281883   {
r18228r18229
17431898   }
17441899}
17451900
1746static void gc_reg_write(running_machine &machine,UINT8 index,UINT8 data)
1901void vga_device::gc_reg_write(UINT8 index,UINT8 data)
17471902{
17481903   switch(index)
17491904   {
r18228r18229
17881943   }
17891944}
17901945
1791WRITE8_HANDLER(vga_port_03c0_w)
1946WRITE8_MEMBER(vga_device::port_03c0_w)
17921947{
17931948   if (LOG_ACCESSES)
17941949      logerror("vga_port_03c0_w(): port=0x%04x data=0x%02x\n", offset + 0x3c0, data);
r18228r18229
18071962      break;
18081963   case 2:
18091964      vga.miscellaneous_output=data;
1810      recompute_params(space.machine());
1965      recompute_params();
18111966      break;
18121967   case 3:
18131968      vga.oak.reg = data;
r18228r18229
18281983         vga.sequencer.data[vga.sequencer.index] = data;
18291984      }
18301985
1831      seq_reg_write(space.machine(),vga.sequencer.index,data);
1832      recompute_params(space.machine());
1986      seq_reg_write(vga.sequencer.index,data);
1987      recompute_params();
18331988      break;
18341989   case 6:
18351990      vga.dac.mask=data;
r18228r18229
18692024      vga.gc.index=data;
18702025      break;
18712026   case 0xf:
1872      gc_reg_write(space.machine(),vga.gc.index,data);
2027      gc_reg_write(vga.gc.index,data);
18732028      break;
18742029   }
18752030}
18762031
18772032
18782033
1879WRITE8_HANDLER(vga_port_03d0_w)
2034WRITE8_MEMBER(vga_device::port_03d0_w)
18802035{
18812036   if (LOG_ACCESSES)
18822037      logerror("vga_port_03d0_w(): port=0x%04x data=0x%02x\n", offset + 0x3d0, data);
r18228r18229
18852040      vga_crtc_w(space, offset, data, mem_mask);
18862041}
18872042
1888void pc_vga_reset(running_machine &machine)
2043void vga_device::device_reset()
18892044{
18902045   /* clear out the VGA structure */
18912046   memset(vga.pens, 0, sizeof(vga.pens));
r18228r18229
19122067   vga.crtc.line_compare = 0x3ff;
19132068}
19142069
1915READ8_HANDLER(vga_mem_r)
2070READ8_MEMBER(vga_device::mem_r)
19162071{
19172072   /* TODO: check me */
19182073   switch(vga.gc.memory_map_sel & 0x03)
r18228r18229
19782133   return 0;
19792134}
19802135
1981WRITE8_HANDLER(vga_mem_w)
2136WRITE8_MEMBER(vga_device::mem_w)
19822137{
19832138   //Inside each case must prevent writes to non-mapped VGA memory regions, not only mask the offset.
19842139   switch(vga.gc.memory_map_sel & 0x03)
r18228r18229
20162171   }
20172172}
20182173
2019void pc_vga_init(running_machine &machine, read8_delegate read_dipswitch)
2174READ8_MEMBER(vga_device::mem_linear_r)
20202175{
2021   memset(&vga, 0, sizeof(vga));
2022
2023   /* copy over interfaces */
2024   vga.read_dipswitch = read_dipswitch;   
2025   vga.svga_intf.vram_size = 0x100000;
2026   vga.svga_intf.seq_regcount = 0x05;
2027   vga.svga_intf.crtc_regcount = 0x19;
2028
2029   vga.memory         = auto_alloc_array_clear(machine, UINT8, vga.svga_intf.vram_size);
2030   pc_vga_reset(machine);
2031
2032}
2033
2034void pc_vga_cirrus_init(running_machine &machine, read8_delegate read_dipswitch)
2035{
2036   memset(&vga, 0, sizeof(vga));
2037
2038   /* copy over interfaces */
2039   vga.read_dipswitch = read_dipswitch;
2040   vga.svga_intf.vram_size = 0x200000;
2041   vga.svga_intf.seq_regcount = 0x08;
2042   vga.svga_intf.crtc_regcount = 0x19;
2043
2044   vga.memory         = auto_alloc_array_clear(machine, UINT8, vga.svga_intf.vram_size);
2045   
2046   pc_vga_reset(machine);
2047
2048}
2049
2050VIDEO_START( vga )
2051{
2052   int i;
2053   for (i = 0; i < 0x100; i++)
2054      palette_set_color_rgb(machine, i, 0, 0, 0);
2055   pc_video_start(machine);
2056}
2057
2058static VIDEO_RESET( vga )
2059{
2060   pc_vga_reset(machine);
2061}
2062
2063READ8_HANDLER(vga_mem_linear_r)
2064{
20652176   return vga.memory[offset];
20662177}
20672178
2068WRITE8_HANDLER(vga_mem_linear_w)
2179WRITE8_MEMBER(vga_device::mem_linear_w)
20692180{
20702181   vga.memory[offset] = data;
20712182}
r18228r18229
20852196MACHINE_CONFIG_FRAGMENT( pcvideo_vga )
20862197   MCFG_SCREEN_ADD("screen", RASTER)
20872198   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
2088   MCFG_SCREEN_UPDATE_STATIC(pc_video)
2199   MCFG_SCREEN_UPDATE_DEVICE("vga", vga_device, screen_update)
20892200
20902201   MCFG_PALETTE_LENGTH(0x100)
2202   MCFG_DEVICE_ADD("vga", VGA, 0)
2203MACHINE_CONFIG_END
20912204
2092   MCFG_VIDEO_START(vga)
2093   MCFG_VIDEO_RESET(vga)
2205MACHINE_CONFIG_FRAGMENT( pcvideo_trident_vga )
2206   MCFG_SCREEN_ADD("screen", RASTER)
2207   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
2208   MCFG_SCREEN_UPDATE_DEVICE("vga", trident_vga_device, screen_update)
2209
2210   MCFG_PALETTE_LENGTH(0x100)
2211   
2212   MCFG_DEVICE_ADD("vga", TRIDENT_VGA, 0)
20942213MACHINE_CONFIG_END
20952214
2096MACHINE_CONFIG_FRAGMENT( pcvideo_vga_isa )
2215MACHINE_CONFIG_FRAGMENT( pcvideo_cirrus_vga )
20972216   MCFG_SCREEN_ADD("screen", RASTER)
20982217   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
2099   MCFG_SCREEN_UPDATE_STATIC(pc_video)
2218   MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_vga_device, screen_update)
21002219
21012220   MCFG_PALETTE_LENGTH(0x100)
2221   
2222   MCFG_DEVICE_ADD("vga", CIRRUS_VGA, 0)
21022223MACHINE_CONFIG_END
21032224
2104MACHINE_CONFIG_FRAGMENT( pcvideo_s3_isa )
2225MACHINE_CONFIG_FRAGMENT( pcvideo_gamtor_vga )
21052226   MCFG_SCREEN_ADD("screen", RASTER)
21062227   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
2107   MCFG_SCREEN_UPDATE_STATIC(pc_video_s3)
2228   MCFG_SCREEN_UPDATE_DEVICE("vga", gamtor_vga_device, screen_update)
21082229
21092230   MCFG_PALETTE_LENGTH(0x100)
2231   MCFG_DEVICE_ADD("vga", GAMTOR_VGA, 0)
21102232MACHINE_CONFIG_END
21112233
2112MACHINE_CONFIG_FRAGMENT( pcvideo_ati_isa )
2234
2235MACHINE_CONFIG_FRAGMENT( pcvideo_s3_isa )
21132236   MCFG_SCREEN_ADD("screen", RASTER)
21142237   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
2115   MCFG_SCREEN_UPDATE_STATIC(pc_video)
2238   //MCFG_SCREEN_UPDATE_STATIC(pc_video_s3)
21162239
21172240   MCFG_PALETTE_LENGTH(0x100)
2241MACHINE_CONFIG_END
21182242
2243static MACHINE_CONFIG_FRAGMENT( ati_vga )
21192244   MCFG_EEPROM_ADD("ati_eeprom",ati_eeprom_interface)
21202245MACHINE_CONFIG_END
21212246
2247//-------------------------------------------------
2248//  machine_config_additions - device-specific
2249//  machine configurations
2250//-------------------------------------------------
2251
2252machine_config_constructor ati_vga_device::device_mconfig_additions() const
2253{
2254   return MACHINE_CONFIG_NAME( ati_vga );
2255}
2256
21222257/******************************************
21232258
21242259Tseng ET4000k implementation
21252260
21262261******************************************/
21272262
2128static void tseng_define_video_mode(running_machine &machine)
2263void tseng_vga_device::tseng_define_video_mode()
21292264{
21302265   int divisor;
21312266   int xtal = 0;
r18228r18229
21802315         divisor = 1;
21812316         break;
21822317   }
2183   recompute_params_clock(machine, divisor, xtal);
2318   recompute_params_clock(divisor, xtal);
21842319}
21852320
2186static UINT8 tseng_crtc_reg_read(running_machine &machine, UINT8 index)
2321UINT8 tseng_vga_device::tseng_crtc_reg_read(UINT8 index)
21872322{
21882323   UINT8 res;
21892324
r18228r18229
22092344   return res;
22102345}
22112346
2212static void tseng_crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data)
2347void tseng_vga_device::tseng_crtc_reg_write(UINT8 index, UINT8 data)
22132348{
22142349   if(index <= 0x18)
2215      crtc_reg_write(machine,index,data);
2350      crtc_reg_write(index,data);
22162351   else
22172352   {
22182353      switch(index)
r18228r18229
22312366   }
22322367}
22332368
2234static UINT8 tseng_seq_reg_read(running_machine &machine, UINT8 index)
2369UINT8 tseng_vga_device::tseng_seq_reg_read(UINT8 index)
22352370{
22362371   UINT8 res;
22372372
r18228r18229
22532388   return res;
22542389}
22552390
2256static void tseng_seq_reg_write(running_machine &machine, UINT8 index, UINT8 data)
2391void tseng_vga_device::tseng_seq_reg_write(UINT8 index, UINT8 data)
22572392{
22582393   if(index <= 0x04)
22592394   {
22602395      vga.sequencer.data[vga.sequencer.index] = data;
2261      seq_reg_write(machine,vga.sequencer.index,data);
2396      seq_reg_write(vga.sequencer.index,data);
22622397   }
22632398   else
22642399   {
r18228r18229
22722407   }
22732408}
22742409
2275READ8_HANDLER(tseng_et4k_03b0_r)
2410READ8_MEMBER(tseng_vga_device::port_03b0_r)
22762411{
22772412   UINT8 res = 0xff;
22782413
r18228r18229
22812416      switch(offset)
22822417      {
22832418         case 5:
2284            res = tseng_crtc_reg_read(space.machine(),vga.crtc.index);
2419            res = tseng_crtc_reg_read(vga.crtc.index);
22852420            break;
22862421         case 8:
22872422            res = et4k.reg_3d8;
22882423            break;
22892424         default:
2290            res = vga_port_03b0_r(space,offset);
2425            res = vga_device::port_03b0_r(space,offset,mem_mask);
22912426            break;
22922427      }
22932428   }
r18228r18229
22952430   return res;
22962431}
22972432
2298WRITE8_HANDLER(tseng_et4k_03b0_w)
2433WRITE8_MEMBER(tseng_vga_device::port_03b0_w)
22992434{
23002435   if (CRTC_PORT_ADDR == 0x3b0)
23012436   {
r18228r18229
23032438      {
23042439         case 5:
23052440            vga.crtc.data[vga.crtc.index] = data;
2306            tseng_crtc_reg_write(space.machine(),vga.crtc.index,data);
2441            tseng_crtc_reg_write(vga.crtc.index,data);
23072442            break;
23082443         case 8:
23092444            et4k.reg_3d8 = data;
r18228r18229
23132448               et4k.ext_reg_ena = false;
23142449            break;
23152450         default:
2316            vga_port_03b0_w(space,offset,data);
2451            vga_device::port_03b0_w(space,offset,data,mem_mask);
23172452            break;
23182453      }
23192454   }
2320   tseng_define_video_mode(space.machine());
2455   tseng_define_video_mode();
23212456}
23222457
23232458
2324READ8_HANDLER(tseng_et4k_03c0_r)
2459READ8_MEMBER(tseng_vga_device::port_03c0_r)
23252460{
23262461   UINT8 res;
23272462
23282463   switch(offset)
23292464   {
23302465      case 0x05:
2331         res = tseng_seq_reg_read(space.machine(),vga.sequencer.index);
2466         res = tseng_seq_reg_read(vga.sequencer.index);
23322467         break;
23332468      case 0x0d:
23342469         res = svga.bank_w & 0xf;
r18228r18229
23432478            break;
23442479         }
23452480         et4k.dac_state++;
2346         res = vga_port_03c0_r(space,offset);
2481         res = vga_device::port_03c0_r(space,offset,mem_mask);
23472482         break;
23482483      case 0x08:
23492484         et4k.dac_state = 0;
23502485      default:
2351         res = vga_port_03c0_r(space,offset);
2486         res = vga_device::port_03c0_r(space,offset,mem_mask);
23522487         break;
23532488   }
23542489
23552490   return res;
23562491}
23572492
2358WRITE8_HANDLER(tseng_et4k_03c0_w)
2493WRITE8_MEMBER(tseng_vga_device::port_03c0_w)
23592494{
23602495   switch(offset)
23612496   {
23622497      case 0x05:
2363         tseng_seq_reg_write(space.machine(),vga.sequencer.index,data);
2498         tseng_seq_reg_write(vga.sequencer.index,data);
23642499         break;
23652500      case 0x0d:
23662501         svga.bank_w = data & 0xf;
r18228r18229
23732508            break;
23742509         }
23752510      default:
2376         vga_port_03c0_w(space,offset,data);
2511         vga_device::port_03c0_w(space,offset,data,mem_mask);
23772512         break;
23782513   }
2379   tseng_define_video_mode(space.machine());
2514   tseng_define_video_mode();
23802515}
23812516
2382READ8_HANDLER(tseng_et4k_03d0_r)
2517READ8_MEMBER(tseng_vga_device::port_03d0_r)
23832518{
23842519   UINT8 res = 0xff;
23852520
r18228r18229
23882523      switch(offset)
23892524      {
23902525         case 5:
2391            res = tseng_crtc_reg_read(space.machine(),vga.crtc.index);
2526            res = tseng_crtc_reg_read(vga.crtc.index);
23922527            break;
23932528         case 8:
23942529            res = et4k.reg_3d8;
23952530            break;
23962531         default:
2397            res = vga_port_03d0_r(space,offset);
2532            res = vga_device::port_03d0_r(space,offset,mem_mask);
23982533            break;
23992534      }
24002535   }
r18228r18229
24022537   return res;
24032538}
24042539
2405WRITE8_HANDLER(tseng_et4k_03d0_w)
2540WRITE8_MEMBER(tseng_vga_device::port_03d0_w)
24062541{
24072542   if (CRTC_PORT_ADDR == 0x3d0)
24082543   {
r18228r18229
24102545      {
24112546         case 5:
24122547            vga.crtc.data[vga.crtc.index] = data;
2413            tseng_crtc_reg_write(space.machine(),vga.crtc.index,data);
2548            tseng_crtc_reg_write(vga.crtc.index,data);
24142549            //if((vga.crtc.index & 0xfe) != 0x0e)
24152550            //  printf("%02x %02x %d\n",vga.crtc.index,data,space.machine().primary_screen->vpos());
24162551            break;
r18228r18229
24222557               et4k.ext_reg_ena = false;
24232558            break;
24242559         default:
2425            vga_port_03d0_w(space,offset,data);
2560            vga_device::port_03d0_w(space,offset,data,mem_mask);
24262561            break;
24272562      }
24282563   }
2429   tseng_define_video_mode(space.machine());
2564   tseng_define_video_mode();
24302565}
24312566
2432READ8_HANDLER( tseng_mem_r )
2567READ8_MEMBER(tseng_vga_device::mem_r)
24332568{
24342569   if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en)
24352570   {
r18228r18229
24372572      return vga.memory[(offset+svga.bank_r*0x10000)];
24382573   }
24392574
2440   return vga_mem_r(space,offset);
2575   return vga_device::mem_r(space,offset,mem_mask);
24412576}
24422577
2443WRITE8_HANDLER( tseng_mem_w )
2578WRITE8_MEMBER(tseng_vga_device::mem_w)
24442579{
24452580   if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en)
24462581   {
r18228r18229
24482583      vga.memory[(offset+svga.bank_w*0x10000)] = data;
24492584   }
24502585   else
2451      vga_mem_w(space,offset,data);
2586      vga_device::mem_w(space,offset,data,mem_mask);
24522587}
24532588
24542589/******************************************
r18228r18229
24562591Trident implementation
24572592
24582593******************************************/
2459static UINT8 trident_seq_reg_read(running_machine &machine, UINT8 index)
2594UINT8 trident_vga_device::trident_seq_reg_read(UINT8 index)
24602595{
24612596   UINT8 res;
24622597
r18228r18229
24812616   return res;
24822617}
24832618
2484static void trident_seq_reg_write(running_machine &machine, UINT8 index, UINT8 data)
2619void trident_vga_device::trident_seq_reg_write(UINT8 index, UINT8 data)
24852620{
24862621   if(index <= 0x04)
24872622   {
24882623      vga.sequencer.data[vga.sequencer.index] = data;
2489      seq_reg_write(machine,vga.sequencer.index,data);
2490      recompute_params(machine);
2624      seq_reg_write(vga.sequencer.index,data);
2625      recompute_params();
24912626   }
24922627   else
24932628   {
r18228r18229
25042639}
25052640
25062641
2507READ8_HANDLER(trident_03c0_r)
2642READ8_MEMBER(trident_vga_device::port_03c0_r)
25082643{
25092644   UINT8 res;
25102645
25112646   switch(offset)
25122647   {
25132648      case 0x05:
2514         res = trident_seq_reg_read(space.machine(),vga.sequencer.index);
2649         res = trident_seq_reg_read(vga.sequencer.index);
25152650         break;
25162651      default:
2517         res = vga_port_03c0_r(space,offset);
2652         res = vga_device::port_03c0_r(space,offset,mem_mask);
25182653         break;
25192654   }
25202655
25212656   return res;
25222657}
25232658
2524WRITE8_HANDLER(trident_03c0_w)
2659WRITE8_MEMBER(trident_vga_device::port_03c0_w)
25252660{
25262661   switch(offset)
25272662   {
25282663      case 0x05:
2529         trident_seq_reg_write(space.machine(),vga.sequencer.index,data);
2664         trident_seq_reg_write(vga.sequencer.index,data);
25302665         break;
25312666      default:
2532         vga_port_03c0_w(space,offset,data);
2667         vga_device::port_03c0_w(space,offset,data,mem_mask);
25332668         break;
25342669   }
25352670}
25362671
25372672
2538READ8_HANDLER(trident_03d0_r)
2673READ8_MEMBER(trident_vga_device::port_03d0_r)
25392674{
25402675   UINT8 res = 0xff;
25412676
r18228r18229
25472682            res = svga.bank_w & 0x1f; // TODO: a lot more complex than this
25482683            break;
25492684         default:
2550            res = vga_port_03d0_r(space,offset);
2685            res = vga_device::port_03d0_r(space,offset,mem_mask);
25512686            break;
25522687      }
25532688   }
r18228r18229
25552690   return res;
25562691}
25572692
2558WRITE8_HANDLER(trident_03d0_w)
2693WRITE8_MEMBER(trident_vga_device::port_03d0_w)
25592694{
25602695   if (CRTC_PORT_ADDR == 0x3d0)
25612696   {
r18228r18229
25652700            svga.bank_w = data & 0x1f; // TODO: a lot more complex than this
25662701            break;
25672702         default:
2568            vga_port_03d0_w(space,offset,data);
2703            vga_device::port_03d0_w(space,offset,data,mem_mask);
25692704            break;
25702705      }
25712706   }
25722707}
25732708
2574READ8_HANDLER( trident_mem_r )
2709READ8_MEMBER(trident_vga_device::mem_r )
25752710{
25762711   if (svga.rgb15_en & 0x30)
25772712   {
r18228r18229
25822717      return data;
25832718   }
25842719
2585   return vga_mem_r(space,offset);
2720   return vga_device::mem_r(space,offset,mem_mask);
25862721}
25872722
2588WRITE8_HANDLER( trident_mem_w )
2723WRITE8_MEMBER(trident_vga_device::mem_w)
25892724{
25902725   if (svga.rgb15_en & 0x30)
25912726   {
r18228r18229
25952730      return;
25962731   }
25972732
2598   vga_mem_w(space,offset,data);
2733   vga_device::mem_w(space,offset,data,mem_mask);
25992734}
26002735
26012736/******************************************
r18228r18229
26042739
26052740******************************************/
26062741
2607static UINT8 s3_crtc_reg_read(running_machine &machine, UINT8 index)
2742UINT8 s3_vga_device::s3_crtc_reg_read(UINT8 index)
26082743{
26092744   UINT8 res;
26102745
r18228r18229
27032838   return res;
27042839}
27052840
2706static void s3_define_video_mode(void)
2841void s3_vga_device::s3_define_video_mode()
27072842{
27082843   if((s3.ext_misc_ctrl_2) >> 4)
27092844   {
r18228r18229
27282863   }
27292864}
27302865
2731static void s3_crtc_reg_write(running_machine &machine, UINT8 index, UINT8 data)
2866void s3_vga_device::s3_crtc_reg_write(UINT8 index, UINT8 data)
27322867{
27332868   if(index <= 0x18)
2734      crtc_reg_write(machine,index,data);
2869      crtc_reg_write(index,data);
27352870   else
27362871   {
27372872      switch(index)
r18228r18229
29473082}
29483083
29493084
2950READ8_HANDLER(s3_port_03b0_r)
3085READ8_MEMBER(s3_vga_device::port_03b0_r)
29513086{
29523087   UINT8 res = 0xff;
29533088
r18228r18229
29563091      switch(offset)
29573092      {
29583093         case 5:
2959            res = s3_crtc_reg_read(space.machine(),vga.crtc.index);
3094            res = s3_crtc_reg_read(vga.crtc.index);
29603095            break;
29613096         default:
2962            res = vga_port_03b0_r(space,offset);
3097            res = vga_device::port_03b0_r(space,offset,mem_mask);
29633098            break;
29643099      }
29653100   }
r18228r18229
29673102   return res;
29683103}
29693104
2970WRITE8_HANDLER(s3_port_03b0_w)
3105WRITE8_MEMBER(s3_vga_device::port_03b0_w)
29713106{
29723107   if (CRTC_PORT_ADDR == 0x3b0)
29733108   {
r18228r18229
29753110      {
29763111         case 5:
29773112            vga.crtc.data[vga.crtc.index] = data;
2978            s3_crtc_reg_write(space.machine(),vga.crtc.index,data);
3113            s3_crtc_reg_write(vga.crtc.index,data);
29793114            break;
29803115         default:
2981            vga_port_03b0_w(space,offset,data);
3116            vga_device::port_03b0_w(space,offset,data,mem_mask);
29823117            break;
29833118      }
29843119   }
29853120}
29863121
2987READ8_HANDLER(s3_port_03c0_r)
3122READ8_MEMBER(s3_vga_device::port_03c0_r)
29883123{
29893124   UINT8 res;
29903125
29913126   switch(offset)
29923127   {
29933128      default:
2994         res = vga_port_03c0_r(space,offset);
3129         res = vga_device::port_03c0_r(space,offset,mem_mask);
29953130         break;
29963131   }
29973132
29983133   return res;
29993134}
30003135
3001WRITE8_HANDLER(s3_port_03c0_w)
3136WRITE8_MEMBER(s3_vga_device::port_03c0_w)
30023137{
30033138   switch(offset)
30043139   {
30053140      default:
3006         vga_port_03c0_w(space,offset,data);
3141         vga_device::port_03c0_w(space,offset,data,mem_mask);
30073142         break;
30083143   }
30093144}
30103145
3011READ8_HANDLER(s3_port_03d0_r)
3146READ8_MEMBER(s3_vga_device::port_03d0_r)
30123147{
30133148   UINT8 res = 0xff;
30143149
r18228r18229
30173152      switch(offset)
30183153      {
30193154         case 5:
3020            res = s3_crtc_reg_read(space.machine(),vga.crtc.index);
3155            res = s3_crtc_reg_read(vga.crtc.index);
30213156            break;
30223157         default:
3023            res = vga_port_03d0_r(space,offset);
3158            res = vga_device::port_03d0_r(space,offset,mem_mask);
30243159            break;
30253160      }
30263161   }
r18228r18229
30283163   return res;
30293164}
30303165
3031WRITE8_HANDLER(s3_port_03d0_w)
3166WRITE8_MEMBER(s3_vga_device::port_03d0_w)
30323167{
30333168   if (CRTC_PORT_ADDR == 0x3d0)
30343169   {
r18228r18229
30363171      {
30373172         case 5:
30383173            vga.crtc.data[vga.crtc.index] = data;
3039            s3_crtc_reg_write(space.machine(),vga.crtc.index,data);
3174            s3_crtc_reg_write(vga.crtc.index,data);
30403175            break;
30413176         default:
3042            vga_port_03d0_w(space,offset,data);
3177            vga_device::port_03d0_w(space,offset,data,mem_mask);
30433178            break;
30443179      }
30453180   }
30463181}
30473182
3048READ8_HANDLER( ati_port_03c0_r )
3183READ8_MEMBER(ati_vga_device::port_03c0_r)
30493184{
30503185   UINT8 data = 0xff;
30513186
r18228r18229
30563191         data = vga.attribute.data[vga.attribute.index&0x1f];
30573192      break;
30583193   default:
3059      data = vga_port_03c0_r(space,offset);
3194      data = vga_device::port_03c0_r(space,offset,mem_mask);
30603195      break;
30613196   }
30623197   return data;
r18228r18229
30653200
30663201/* accelerated ports, TBD ... */
30673202
3068static void s3_write_fg(UINT32 offset)
3203void s3_vga_device::s3_write_fg(UINT32 offset)
30693204{
30703205   UINT8 dst = vga.memory[offset];
30713206   UINT8 src = 0;
r18228r18229
31463281   }
31473282}
31483283
3149static void s3_write_bg(UINT32 offset)
3284void s3_vga_device::s3_write_bg(UINT32 offset)
31503285{
31513286   UINT8 dst = vga.memory[offset];
31523287   UINT8 src = 0;
r18228r18229
32273362   }
32283363}
32293364
3230void s3_write(UINT32 offset, UINT32 src)
3365void s3_vga_device::s3_write(UINT32 offset, UINT32 src)
32313366{
32323367   int data_size = 8;
32333368   UINT32 xfer = 0;
r18228r18229
32913426            the major or independent axis).
32923427     0-13  (80x +) LINE PARAMETER/ERROR TERM. See above.
32933428 */
3294READ16_HANDLER(s3_line_error_r)
3429READ16_MEMBER(s3_vga_device::s3_line_error_r)
32953430{
32963431   return ibm8514.line_errorterm;
32973432}
32983433
3299WRITE16_HANDLER(s3_line_error_w)
3434WRITE16_MEMBER(s3_vga_device::s3_line_error_w)
33003435{
33013436   ibm8514.line_errorterm = data;
33023437   if(LOG_8514) logerror("S3: Line Parameter/Error Term write %04x\n",data);
r18228r18229
33233458            available, Fh for 9 words, 7 for 10 words, 3 for 11 words, 1 for
33243459            12 words and 0 for 13 words available.
33253460 */
3326READ16_HANDLER(ibm8514_gpstatus_r)
3461READ16_MEMBER(s3_vga_device::ibm8514_gpstatus_r)
33273462{
33283463   UINT16 ret = 0x0000;
33293464
r18228r18229
33353470   return ret;
33363471}
33373472
3338static void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw)
3473void s3_vga_device::ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw)
33393474{
33403475   UINT32 offset;
33413476   int x = 0;
r18228r18229
33803515   }
33813516}
33823517
3383READ16_HANDLER(s3_gpstatus_r)
3518READ16_MEMBER(s3_vga_device::s3_gpstatus_r)
33843519{
33853520   UINT16 ret = 0x0000;
33863521
r18228r18229
34803615                rectangle, which is copied repeatably to the destination
34813616                rectangle.
34823617 */
3483WRITE16_HANDLER(ibm8514_cmd_w)
3618WRITE16_MEMBER(s3_vga_device::ibm8514_cmd_w)
34843619{
34853620   int x,y;
34863621   int pattern_x,pattern_y;
r18228r18229
37433878   }
37443879}
37453880
3746WRITE16_HANDLER(s3_cmd_w)
3881WRITE16_MEMBER(s3_vga_device::s3_cmd_w)
37473882{
37483883   if(s3.enable_8514 != 0)
37493884      ibm8514_cmd_w(space,offset,data,mem_mask);
r18228r18229
37603895     0-13  (80 x+) LINE PARAMETER AXIAL STEP CONSTANT. Se above
37613896
37623897 */
3763READ16_HANDLER( ibm8514_desty_r )
3898READ16_MEMBER(s3_vga_device::ibm8514_desty_r)
37643899{
37653900   return ibm8514.line_axial_step;
37663901}
37673902
3768WRITE16_HANDLER( ibm8514_desty_w )
3903WRITE16_MEMBER(s3_vga_device::ibm8514_desty_w)
37693904{
37703905   ibm8514.line_axial_step = data;
37713906   ibm8514.dest_y = data;
r18228r18229
37853920     0-13  (80x +) LINE PARAMETER DIAGONAL STEP CONSTANT. Se above
37863921
37873922 */
3788READ16_HANDLER( ibm8514_destx_r )
3923READ16_MEMBER(s3_vga_device::ibm8514_destx_r)
37893924{
37903925   return ibm8514.line_diagonal_step;
37913926}
37923927
3793WRITE16_HANDLER( ibm8514_destx_w )
3928WRITE16_MEMBER(s3_vga_device::ibm8514_destx_w)
37943929{
37953930   ibm8514.line_diagonal_step = data;
37963931   ibm8514.dest_x = data;
r18228r18229
38193954      9EE9h before execution starts. A single 16bit write will do.
38203955      If only one SSV is desired the other byte can be set to 0.
38213956 */
3822static void ibm8514_wait_draw_ssv()
3957void s3_vga_device::ibm8514_wait_draw_ssv()
38233958{
38243959   UINT8 len = ibm8514.wait_vector_len;
38253960   UINT8 dir = ibm8514.wait_vector_dir;
r18228r18229
39074042   }
39084043}
39094044
3910static void ibm8514_draw_ssv(UINT8 data)
4045void s3_vga_device::ibm8514_draw_ssv(UINT8 data)
39114046{
39124047   UINT8 len = data & 0x0f;
39134048   UINT8 dir = (data & 0xe0) >> 5;
r18228r18229
39164051   ibm8514_draw_vector(len,dir,draw);
39174052}
39184053
3919READ16_HANDLER(ibm8514_ssv_r)
4054READ16_MEMBER(s3_vga_device::ibm8514_ssv_r)
39204055{
39214056   return ibm8514.ssv;
39224057}
39234058
3924WRITE16_HANDLER(ibm8514_ssv_w)
4059WRITE16_MEMBER(s3_vga_device::ibm8514_ssv_w)
39254060{
39264061   ibm8514.ssv = data;
39274062
r18228r18229
39494084   if(LOG_8514) logerror("8514/A: Short Stroke Vector write %04x\n",data);
39504085}
39514086
3952static void ibm8514_wait_draw_vector()
4087void s3_vga_device::ibm8514_wait_draw_vector()
39534088{
39544089   UINT8 len = ibm8514.wait_vector_len;
39554090   UINT8 dir = ibm8514.wait_vector_dir;
r18228r18229
40284163            independent axis). Must be positive.
40294164     0-11  (80x +) RECTANGLE WIDTH/LINE PARAMETER MAX. See above
40304165 */
4031READ16_HANDLER( s3_width_r )
4166READ16_MEMBER(s3_vga_device::s3_width_r)
40324167{
40334168   return s3.rect_width;
40344169}
40354170
4036WRITE16_HANDLER( s3_width_w )
4171WRITE16_MEMBER(s3_vga_device::s3_width_w)
40374172{
40384173   s3.rect_width = data & 0x1fff;
40394174   if(LOG_8514) logerror("S3: Major Axis Pixel Count / Rectangle Width write %04x\n",data);
40404175}
40414176
4042READ16_HANDLER(ibm8514_currentx_r)
4177READ16_MEMBER(s3_vga_device::ibm8514_currentx_r)
40434178{
40444179   return ibm8514.curr_x;
40454180}
40464181
4047WRITE16_HANDLER(ibm8514_currentx_w)
4182WRITE16_MEMBER(s3_vga_device::ibm8514_currentx_w)
40484183{
40494184   ibm8514.curr_x = data;
40504185   ibm8514.prev_x = data;
40514186   if(LOG_8514) logerror("8514/A: Current X set to %04x (%i)\n",data,ibm8514.curr_x);
40524187}
40534188
4054READ16_HANDLER(ibm8514_currenty_r)
4189READ16_MEMBER(s3_vga_device::ibm8514_currenty_r)
40554190{
40564191   return ibm8514.curr_y;
40574192}
40584193
4059WRITE16_HANDLER(ibm8514_currenty_w)
4194WRITE16_MEMBER(s3_vga_device::ibm8514_currenty_w)
40604195{
40614196   ibm8514.curr_y = data;
40624197   ibm8514.prev_y = data;
40634198   if(LOG_8514) logerror("8514/A: Current Y set to %04x (%i)\n",data,ibm8514.curr_y);
40644199}
40654200
4066READ16_HANDLER(s3_fgcolour_r)
4201READ16_MEMBER(s3_vga_device::s3_fgcolour_r)
40674202{
40684203   return s3.fgcolour;
40694204}
40704205
4071WRITE16_HANDLER(s3_fgcolour_w)
4206WRITE16_MEMBER(s3_vga_device::s3_fgcolour_w)
40724207{
40734208   s3.fgcolour = data;
40744209   if(LOG_8514) logerror("S3: Foreground Colour write %04x\n",data);
40754210}
40764211
4077READ16_HANDLER(s3_bgcolour_r)
4212READ16_MEMBER(s3_vga_device::s3_bgcolour_r)
40784213{
40794214   return s3.bgcolour;
40804215}
40814216
4082WRITE16_HANDLER(s3_bgcolour_w)
4217WRITE16_MEMBER(s3_vga_device::s3_bgcolour_w)
40834218{
40844219   s3.bgcolour = data;
40854220   if(LOG_8514) logerror("S3: Background Colour write %04x\n",data);
40864221}
40874222
4088READ16_HANDLER( s3_multifunc_r )
4223READ16_MEMBER(s3_vga_device::s3_multifunc_r )
40894224{
40904225   switch(s3.multifunc_sel)
40914226   {
r18228r18229
41064241   }
41074242}
41084243
4109WRITE16_HANDLER( s3_multifunc_w )
4244WRITE16_MEMBER(s3_vga_device::s3_multifunc_w )
41104245{
41114246   switch(data & 0xf000)
41124247   {
r18228r18229
41974332   }
41984333}
41994334
4200static void s3_wait_draw()
4335void s3_vga_device::s3_wait_draw()
42014336{
42024337   int x, data_size = 8;
42034338   UINT32 off;
r18228r18229
43814516             2  BSS is Pixel Data from the PIX_TRANS register (E2E8h)
43824517             3  BSS is Bitmap Data (Source data from display buffer).
43834518 */
4384READ16_HANDLER(s3_backmix_r)
4519READ16_MEMBER(s3_vga_device::s3_backmix_r)
43854520{
43864521   return s3.bgmix;
43874522}
43884523
4389WRITE16_HANDLER(s3_backmix_w)
4524WRITE16_MEMBER(s3_vga_device::s3_backmix_w)
43904525{
43914526   s3.bgmix = data;
43924527   if(LOG_8514) logerror("S3: BG Mix write %04x\n",data);
43934528}
43944529
4395READ16_HANDLER(s3_foremix_r)
4530READ16_MEMBER(s3_vga_device::s3_foremix_r)
43964531{
43974532   return s3.fgmix;
43984533}
43994534
4400WRITE16_HANDLER(s3_foremix_w)
4535WRITE16_MEMBER(s3_vga_device::s3_foremix_w)
44014536{
44024537   s3.fgmix = data;
44034538   if(LOG_8514) logerror("S3: FG Mix write %04x\n",data);
44044539}
44054540
4406READ16_HANDLER(s3_pixel_xfer_r)
4541READ16_MEMBER(s3_vga_device::s3_pixel_xfer_r)
44074542{
44084543   if(offset == 1)
44094544      return (s3.pixel_xfer & 0xffff0000) >> 16;
r18228r18229
44114546      return s3.pixel_xfer & 0x0000ffff;
44124547}
44134548
4414WRITE16_HANDLER(s3_pixel_xfer_w)
4549WRITE16_MEMBER(s3_vga_device::s3_pixel_xfer_w)
44154550{
44164551   if(offset == 1)
44174552      s3.pixel_xfer = (s3.pixel_xfer & 0x0000ffff) | (data << 16);
r18228r18229
44304565   if(LOG_8514) logerror("S3: Pixel Transfer = %08x\n",s3.pixel_xfer);
44314566}
44324567
4433READ8_HANDLER( s3_mem_r )
4568READ8_MEMBER(s3_vga_device::mem_r)
44344569{
44354570   if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb32_en)
44364571   {
r18228r18229
44524587      }
44534588      return data;
44544589   }
4455   return vga_mem_r(space,offset);
4590   return vga_device::mem_r(space,offset,mem_mask);
44564591}
44574592
4458WRITE8_HANDLER( s3_mem_w )
4593WRITE8_MEMBER(s3_vga_device::mem_w)
44594594{
44604595   // bit 4 of CR53 enables memory-mapped I/O
44614596   // 0xA0000-0xA7ffff maps to port 0xE2E8 (pixel transfer)
r18228r18229
46854820      return;
46864821   }
46874822
4688   vga_mem_w(space,offset,data);
4823   vga_device::mem_w(space,offset,data,mem_mask);
46894824}
46904825
46914826/******************************************
r18228r18229
46944829
46954830******************************************/
46964831
4697READ8_HANDLER(vga_gamtor_mem_r)
4832READ8_MEMBER(gamtor_vga_device::mem_r)
46984833{
46994834   return vga.memory[offset];
47004835}
47014836
4702WRITE8_HANDLER(vga_gamtor_mem_w)
4837WRITE8_MEMBER(gamtor_vga_device::mem_w)
47034838{
47044839   vga.memory[offset] = data;
47054840}
47064841
47074842
4708READ8_HANDLER(vga_port_gamtor_03b0_r)
4843READ8_MEMBER(gamtor_vga_device::port_03b0_r)
47094844{
47104845   UINT8 res;
47114846
47124847   switch(offset)
47134848   {
47144849      default:
4715         res = vga_port_03b0_r(space,offset ^ 3);
4850         res = vga_device::port_03b0_r(space,offset ^ 3,mem_mask);
47164851         break;
47174852   }
47184853
47194854   return res;
47204855}
47214856
4722WRITE8_HANDLER(vga_port_gamtor_03b0_w)
4857WRITE8_MEMBER(gamtor_vga_device::port_03b0_w)
47234858{
47244859   switch(offset)
47254860   {
47264861      default:
4727         vga_port_03b0_w(space,offset ^ 3,data);
4862         vga_device::port_03b0_w(space,offset ^ 3,data,mem_mask);
47284863         break;
47294864   }
47304865}
47314866
4732READ8_HANDLER(vga_port_gamtor_03c0_r)
4867READ8_MEMBER(gamtor_vga_device::port_03c0_r)
47334868{
47344869   UINT8 res;
47354870
47364871   switch(offset)
47374872   {
47384873      default:
4739         res = vga_port_03c0_r(space,offset ^ 3);
4874         res = vga_device::port_03c0_r(space,offset ^ 3,mem_mask);
47404875         break;
47414876   }
47424877
47434878   return res;
47444879}
47454880
4746WRITE8_HANDLER(vga_port_gamtor_03c0_w)
4881WRITE8_MEMBER(gamtor_vga_device::port_03c0_w)
47474882{
47484883   switch(offset)
47494884   {
47504885      default:
4751         vga_port_03c0_w(space,offset ^ 3,data);
4886         vga_device::port_03c0_w(space,offset ^ 3,data,mem_mask);
47524887         break;
47534888   }
47544889}
47554890
4756READ8_HANDLER(vga_port_gamtor_03d0_r)
4891READ8_MEMBER(gamtor_vga_device::port_03d0_r)
47574892{
47584893   UINT8 res;
47594894
47604895   switch(offset)
47614896   {
47624897      default:
4763         res = vga_port_03d0_r(space,offset ^ 3);
4898         res = vga_device::port_03d0_r(space,offset ^ 3,mem_mask);
47644899         break;
47654900   }
47664901
47674902   return res;
47684903}
47694904
4770WRITE8_HANDLER(vga_port_gamtor_03d0_w)
4905WRITE8_MEMBER(gamtor_vga_device::port_03d0_w)
47714906{
47724907   switch(offset)
47734908   {
47744909      default:
4775         vga_port_03d0_w(space,offset ^ 3,data);
4910         vga_device::port_03d0_w(space,offset ^ 3,data,mem_mask);
47764911         break;
47774912   }
47784913}
47794914
47804915
4781static void ati_define_video_mode(running_machine &machine)
4916void ati_vga_device::ati_define_video_mode()
47824917{
47834918   int clock;
47844919   UINT8 clock_type;
r18228r18229
48494984      logerror("Invalid dot clock %i selected.\n",clock_type);
48504985   }
48514986//  logerror("ATI: Clock select type %i (%iHz / %i)\n",clock_type,clock,div);
4852   recompute_params_clock(machine,divisor,clock / div);
4987   recompute_params_clock(divisor,clock / div);
48534988}
48544989
4855READ8_HANDLER( ati_mem_r )
4990READ8_MEMBER(ati_vga_device::mem_r)
48564991{
48574992   if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en)
48584993   {
r18228r18229
48604995      return vga.memory[(offset+svga.bank_r*0x10000)];
48614996   }
48624997
4863   return vga_mem_r(space,offset);
4998   return vga_device::mem_r(space,offset,mem_mask);
48644999}
48655000
4866WRITE8_HANDLER( ati_mem_w )
5001WRITE8_MEMBER(ati_vga_device::mem_w)
48675002{
48685003   if(svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb24_en)
48695004   {
r18228r18229
48715006      vga.memory[(offset+svga.bank_w*0x10000)] = data;
48725007   }
48735008   else
4874      vga_mem_w(space,offset,data);
5009      vga_device::mem_w(space,offset,data,mem_mask);
48755010}
48765011
48775012
4878READ8_DEVICE_HANDLER(ati_port_ext_r)
5013READ8_MEMBER(ati_vga_device::ati_port_ext_r)
48795014{
48805015   UINT8 ret = 0xff;
48815016
r18228r18229
48945029         break;
48955030      case 0x37:
48965031         {
4897            eeprom_device* eep = device->subdevice<eeprom_device>("ati_eeprom");
5032            eeprom_device* eep = subdevice<eeprom_device>("ati_eeprom");
48985033            ret = 0x00;
48995034            ret |= eep->read_bit() << 3;
49005035         }
r18228r18229
49075042   return ret;
49085043}
49095044
4910WRITE8_DEVICE_HANDLER(ati_port_ext_w)
5045WRITE8_MEMBER(ati_vga_device::ati_port_ext_w)
49115046{
49125047   switch(offset)
49135048   {
r18228r18229
49535088      case 0x33:  // EEPROM
49545089         if(data & 0x04)
49555090         {
4956            eeprom_device* eep = device->subdevice<eeprom_device>("ati_eeprom");
5091            eeprom_device* eep = subdevice<eeprom_device>("ati_eeprom");
49575092            if(eep != NULL)
49585093            {
49595094               eep->write_bit((data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
r18228r18229
49695104      }
49705105      break;
49715106   }
4972   ati_define_video_mode(device->machine());
5107   ati_define_video_mode();
49735108}
49745109
49755110/*
r18228r18229
49855120           This bit toggles every time a HSYNC pulse starts
49865121     3-15  Reserved(0)
49875122 */
4988READ16_HANDLER(ibm8514_status_r)
5123READ16_MEMBER(ati_vga_device::ibm8514_status_r)
49895124{
4990   return vga_vblank(space.machine()) << 1;
5125   return vga_vblank() << 1;
49915126}
49925127
4993WRITE16_HANDLER(ibm8514_htotal_w)
5128WRITE16_MEMBER(ati_vga_device::ibm8514_htotal_w)
49945129{
49955130   ibm8514.htotal = data & 0x01ff;
49965131   //vga.crtc.horz_total = data & 0x01ff;
r18228r18229
50175152     8-11  CHIP_REV. Chip revision number.
50185153    12-15  (CT82c480) CHIP_ID. 0=CT 82c480.
50195154 */
5020READ16_HANDLER(ibm8514_substatus_r)
5155READ16_MEMBER(ati_vga_device::ibm8514_substatus_r)
50215156{
50225157   // TODO:
5023   if(vga_vblank(space.machine()) != 0)  // not correct, but will do for now
5158   if(vga_vblank() != 0)  // not correct, but will do for now
50245159      ibm8514.substatus |= 0x01;
50255160   return ibm8514.substatus;
50265161}
r18228r18229
50425177    12-13  CHPTEST. Used for chip testing.
50435178    14-15  Graphics Processor Control (GPCTRL).
50445179 */
5045WRITE16_HANDLER(ibm8514_subcontrol_w)
5180WRITE16_MEMBER(ati_vga_device::ibm8514_subcontrol_w)
50465181{
50475182   ibm8514.subctrl = data;
50485183   ibm8514.substatus &= ~(data & 0x0f);  // reset interrupts
50495184//  if(LOG_8514) logerror("8514/A: Subsystem control write %04x\n",data);
50505185}
50515186
5052READ16_HANDLER(ibm8514_subcontrol_r)
5187READ16_MEMBER(ati_vga_device::ibm8514_subcontrol_r)
50535188{
50545189   return ibm8514.subctrl;
50555190}
50565191
5057READ16_HANDLER(ibm8514_htotal_r)
5192READ16_MEMBER(ati_vga_device::ibm8514_htotal_r)
50585193{
50595194   return ibm8514.htotal;
50605195}
50615196
5062READ16_HANDLER(ibm8514_vtotal_r)
5197READ16_MEMBER(ati_vga_device::ibm8514_vtotal_r)
50635198{
50645199   return ibm8514.vtotal;
50655200}
50665201
5067WRITE16_HANDLER(ibm8514_vtotal_w)
5202WRITE16_MEMBER(ati_vga_device::ibm8514_vtotal_w)
50685203{
50695204   ibm8514.vtotal = data;
50705205//  vga.crtc.vert_total = data;
50715206   if(LOG_8514) logerror("8514/A: Vertical total write %04x\n",data);
50725207}
50735208
5074READ16_HANDLER(ibm8514_vdisp_r)
5209READ16_MEMBER(ati_vga_device::ibm8514_vdisp_r)
50755210{
50765211   return ibm8514.vdisp;
50775212}
50785213
5079WRITE16_HANDLER(ibm8514_vdisp_w)
5214WRITE16_MEMBER(ati_vga_device::ibm8514_vdisp_w)
50805215{
50815216   ibm8514.vdisp = data;
50825217//  vga.crtc.vert_disp_end = data >> 3;
50835218   if(LOG_8514) logerror("8514/A: Vertical Displayed write %04x\n",data);
50845219}
50855220
5086READ16_HANDLER(ibm8514_vsync_r)
5221READ16_MEMBER(ati_vga_device::ibm8514_vsync_r)
50875222{
50885223   return ibm8514.vsync;
50895224}
50905225
5091WRITE16_HANDLER(ibm8514_vsync_w)
5226WRITE16_MEMBER(ati_vga_device::ibm8514_vsync_w)
50925227{
50935228   ibm8514.vsync = data;
50945229   if(LOG_8514) logerror("8514/A: Vertical Sync write %04x\n",data);
50955230}
50965231
5097READ16_HANDLER(mach8_ec0_r)
5232READ16_MEMBER(ati_vga_device::mach8_ec0_r)
50985233{
50995234   return ibm8514.ec0;
51005235}
51015236
5102WRITE16_HANDLER(mach8_ec0_w)
5237WRITE16_MEMBER(ati_vga_device::mach8_ec0_w)
51035238{
51045239   ibm8514.ec0 = data;
51055240   if(LOG_8514) logerror("8514/A: Extended configuration 0 write %04x\n",data);
51065241}
51075242
5108READ16_HANDLER(mach8_ec1_r)
5243READ16_MEMBER(ati_vga_device::mach8_ec1_r)
51095244{
51105245   return ibm8514.ec1;
51115246}
51125247
5113WRITE16_HANDLER(mach8_ec1_w)
5248WRITE16_MEMBER(ati_vga_device::mach8_ec1_w)
51145249{
51155250   ibm8514.ec1 = data;
51165251   if(LOG_8514) logerror("8514/A: Extended configuration 1 write %04x\n",data);
51175252}
51185253
5119READ16_HANDLER(mach8_ec2_r)
5254READ16_MEMBER(ati_vga_device::mach8_ec2_r)
51205255{
51215256   return ibm8514.ec2;
51225257}
51235258
5124WRITE16_HANDLER(mach8_ec2_w)
5259WRITE16_MEMBER(ati_vga_device::mach8_ec2_w)
51255260{
51265261   ibm8514.ec2 = data;
51275262   if(LOG_8514) logerror("8514/A: Extended configuration 2 write %04x\n",data);
51285263}
51295264
5130READ16_HANDLER(mach8_ec3_r)
5265READ16_MEMBER(ati_vga_device::mach8_ec3_r)
51315266{
51325267   return ibm8514.ec3;
51335268}
51345269
5135WRITE16_HANDLER(mach8_ec3_w)
5270WRITE16_MEMBER(ati_vga_device::mach8_ec3_w)
51365271{
51375272   ibm8514.ec3 = data;
51385273   if(LOG_8514) logerror("8514/A: Extended configuration 3 write %04x\n",data);
51395274}
51405275
5141READ16_HANDLER(mach8_ext_fifo_r)
5276READ16_MEMBER(ati_vga_device::mach8_ext_fifo_r)
51425277{
51435278   return 0x00;  // for now, report all FIFO slots at free
51445279}
51455280
5146WRITE16_HANDLER(mach8_linedraw_index_w)
5281WRITE16_MEMBER(ati_vga_device::mach8_linedraw_index_w)
51475282{
51485283   ati.linedraw = data & 0x07;
51495284   if(LOG_8514) logerror("Mach8: Line Draw Index write %04x\n",data);
51505285}
51515286
5152READ16_HANDLER(mach8_bresenham_count_r)
5287READ16_MEMBER(ati_vga_device::mach8_bresenham_count_r)
51535288{
51545289   return s3.rect_width & 0x1fff;
51555290}
51565291
5157WRITE16_HANDLER(mach8_bresenham_count_w)
5292WRITE16_MEMBER(ati_vga_device::mach8_bresenham_count_w)
51585293{
51595294   s3.rect_width = data & 0x1fff;
51605295   if(LOG_8514) logerror("Mach8: Bresenham count write %04x\n",data);
51615296}
51625297
5163WRITE16_HANDLER(mach8_linedraw_w)
5298WRITE16_MEMBER(ati_vga_device::mach8_linedraw_w)
51645299{
51655300   // TODO: actually draw the lines
51665301   switch(ati.linedraw)
r18228r18229
51935328   logerror("ATI: Linedraw register write %04x, mode %i\n",data,ati.linedraw);
51945329}
51955330
5196READ16_HANDLER(mach8_scratch0_r)
5331READ16_MEMBER(ati_vga_device::mach8_scratch0_r)
51975332{
51985333   return ati.scratch0;
51995334}
52005335
5201WRITE16_HANDLER(mach8_scratch0_w)
5336WRITE16_MEMBER(ati_vga_device::mach8_scratch0_w)
52025337{
52035338   ati.scratch0 = data;
52045339   if(LOG_8514) logerror("Mach8: Scratch Pad 0 write %04x\n",data);
52055340}
52065341
5207READ16_HANDLER(mach8_scratch1_r)
5342READ16_MEMBER(ati_vga_device::mach8_scratch1_r)
52085343{
52095344   return ati.scratch1;
52105345}
52115346
5212WRITE16_HANDLER(mach8_scratch1_w)
5347WRITE16_MEMBER(ati_vga_device::mach8_scratch1_w)
52135348{
52145349   ati.scratch1 = data;
52155350   if(LOG_8514) logerror("Mach8: Scratch Pad 1 write %04x\n",data);
r18228r18229
52285363    9-15  ROM_LOCATION. If bit 2 and 3 are 0 the ROM will be at this location:
52295364           0: C000h, 1: C080h, 2: C100h, .. 127: FF80h (unlikely)
52305365 */
5231READ16_HANDLER(mach8_config1_r)
5366READ16_MEMBER(ati_vga_device::mach8_config1_r)
52325367{
52335368   return 0x0082;
52345369}
r18228r18229
52415376       3  WRITE_PER_BIT. Write masked VRAM operations supported if set
52425377       4  FLASH_ENA. Flash page writes supported if set
52435378 */
5244READ16_HANDLER(mach8_config2_r)
5379READ16_MEMBER(ati_vga_device::mach8_config2_r)
52455380{
52465381   return 0x0002;
52475382}
r18228r18229
52525387
52535388******************************************/
52545389
5255static void cirrus_define_video_mode(running_machine &machine)
5390void cirrus_vga_device::cirrus_define_video_mode()
52565391{
52575392   svga.rgb8_en = 0;
52585393   svga.rgb15_en = 0;
r18228r18229
52725407   }
52735408}
52745409
5275static UINT8 cirrus_seq_reg_read(running_machine &machine, UINT8 index)
5410 UINT8 cirrus_vga_device::cirrus_seq_reg_read(UINT8 index)
52765411{
52775412   UINT8 res;
52785413
r18228r18229
52955430   return res;
52965431}
52975432
5298static void cirrus_seq_reg_write(running_machine &machine, UINT8 index, UINT8 data)
5433void cirrus_vga_device::cirrus_seq_reg_write(UINT8 index, UINT8 data)
52995434{
53005435   if(index <= 0x04)
53015436   {
53025437      vga.sequencer.data[vga.sequencer.index] = data;
5303      seq_reg_write(machine,vga.sequencer.index,data);
5438      seq_reg_write(vga.sequencer.index,data);
53045439   }
53055440   else
53065441   {
r18228r18229
53145449      }
53155450   }
53165451}
5317READ8_HANDLER(cirrus_03c0_r)
5452READ8_MEMBER(cirrus_vga_device::port_03c0_r)
53185453{
53195454   UINT8 res;
53205455
53215456   switch(offset)
53225457   {
53235458      case 0x05:
5324         res = cirrus_seq_reg_read(space.machine(),vga.sequencer.index);
5459         res = cirrus_seq_reg_read(vga.sequencer.index);
53255460         break;
53265461      default:
5327         res = vga_port_03c0_r(space,offset);
5462         res = vga_device::port_03c0_r(space,offset,mem_mask);
53285463         break;
53295464   }
53305465
53315466   return res;
53325467}
53335468
5334WRITE8_HANDLER(cirrus_03c0_w)
5469WRITE8_MEMBER(cirrus_vga_device::port_03c0_w)
53355470{
53365471   switch(offset)
53375472   {
53385473      case 0x05:
5339         cirrus_seq_reg_write(space.machine(),vga.sequencer.index,data);
5474         cirrus_seq_reg_write(vga.sequencer.index,data);
53405475         break;
53415476      default:
5342         vga_port_03c0_w(space,offset,data);
5477         vga_device::port_03c0_w(space,offset,data,mem_mask);
53435478         break;
53445479   }
5345   cirrus_define_video_mode(space.machine());
5480   cirrus_define_video_mode();
53465481}
trunk/src/emu/video/pc_vga.h
r18228r18229
1010#define PC_VGA_H
1111
1212MACHINE_CONFIG_EXTERN( pcvideo_vga );
13MACHINE_CONFIG_EXTERN( pcvideo_vga_isa );
14MACHINE_CONFIG_EXTERN( pcvideo_s3_isa );
15MACHINE_CONFIG_EXTERN( pcvideo_ati_isa );
13MACHINE_CONFIG_EXTERN( pcvideo_trident_vga );
14MACHINE_CONFIG_EXTERN( pcvideo_gamtor_vga );
15MACHINE_CONFIG_EXTERN( pcvideo_cirrus_vga );
1616
17VIDEO_START( vga );
18void pc_vga_init(running_machine &machine, read8_delegate read_dipswitch);
19void pc_vga_cirrus_init(running_machine &machine, read8_delegate read_dipswitch);
20void pc_vga_reset(running_machine &machine);
21void pc_video_start(running_machine &machine);
22void s3_video_start(running_machine &machine);
17// ======================> vga_device
2318
24DECLARE_READ8_HANDLER(vga_port_03b0_r);
25DECLARE_READ8_HANDLER(vga_port_03c0_r);
26DECLARE_READ8_HANDLER(vga_port_03d0_r);
27DECLARE_READ8_HANDLER(vga_mem_r);
28DECLARE_READ8_HANDLER(vga_mem_linear_r);
29DECLARE_WRITE8_HANDLER(vga_port_03b0_w);
30DECLARE_WRITE8_HANDLER(vga_port_03c0_w);
31DECLARE_WRITE8_HANDLER(vga_port_03d0_w);
32DECLARE_WRITE8_HANDLER(vga_mem_w);
33DECLARE_WRITE8_HANDLER(vga_mem_linear_w);
19class vga_device :  public device_t
20{
21public:
22    // construction/destruction
23    vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
24   vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
3425
35/* per-device implementations */
36DECLARE_READ8_HANDLER(tseng_et4k_03b0_r);
37DECLARE_WRITE8_HANDLER(tseng_et4k_03b0_w);
38DECLARE_READ8_HANDLER(tseng_et4k_03c0_r);
39DECLARE_WRITE8_HANDLER(tseng_et4k_03c0_w);
40DECLARE_READ8_HANDLER(tseng_et4k_03d0_r);
41DECLARE_WRITE8_HANDLER(tseng_et4k_03d0_w);
42DECLARE_READ8_HANDLER(tseng_mem_r);
43DECLARE_WRITE8_HANDLER(tseng_mem_w);
4426
45DECLARE_READ8_HANDLER(trident_03c0_r);
46DECLARE_WRITE8_HANDLER(trident_03c0_w);
47DECLARE_READ8_HANDLER(trident_03d0_r);
48DECLARE_WRITE8_HANDLER(trident_03d0_w);
49DECLARE_READ8_HANDLER(trident_mem_r);
50DECLARE_WRITE8_HANDLER(trident_mem_w);
27   virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
28   
29   virtual READ8_MEMBER(port_03b0_r);
30   virtual WRITE8_MEMBER(port_03b0_w);
31   virtual READ8_MEMBER(port_03c0_r);
32   virtual WRITE8_MEMBER(port_03c0_w);
33   virtual READ8_MEMBER(port_03d0_r);
34   virtual WRITE8_MEMBER(port_03d0_w);
35   virtual READ8_MEMBER(mem_r);
36   virtual WRITE8_MEMBER(mem_w);
37   virtual READ8_MEMBER(mem_linear_r);
38   virtual WRITE8_MEMBER(mem_linear_w);
39protected:
40    // device-level overrides
41    virtual void device_start();
42    virtual void device_reset();
5143
52DECLARE_READ8_HANDLER(s3_port_03b0_r);
53DECLARE_WRITE8_HANDLER(s3_port_03b0_w);
54DECLARE_READ8_HANDLER(s3_port_03c0_r);
55DECLARE_WRITE8_HANDLER(s3_port_03c0_w);
56DECLARE_READ8_HANDLER(s3_port_03d0_r);
57DECLARE_WRITE8_HANDLER(s3_port_03d0_w);
58DECLARE_READ16_HANDLER(s3_gpstatus_r);
59DECLARE_WRITE16_HANDLER(s3_cmd_w);
60DECLARE_READ16_HANDLER(ibm8514_ssv_r);
61DECLARE_WRITE16_HANDLER(ibm8514_ssv_w);
62DECLARE_READ16_HANDLER(ibm8514_desty_r);
63DECLARE_WRITE16_HANDLER(ibm8514_desty_w);
64DECLARE_READ16_HANDLER(ibm8514_destx_r);
65DECLARE_WRITE16_HANDLER(ibm8514_destx_w);
66DECLARE_READ16_HANDLER(ibm8514_currentx_r);
67DECLARE_WRITE16_HANDLER(ibm8514_currentx_w);
68DECLARE_READ16_HANDLER(ibm8514_currenty_r);
69DECLARE_WRITE16_HANDLER(ibm8514_currenty_w);
70DECLARE_READ16_HANDLER(s3_line_error_r);
71DECLARE_WRITE16_HANDLER(s3_line_error_w);
72DECLARE_READ16_HANDLER(s3_width_r);
73DECLARE_WRITE16_HANDLER(s3_width_w);
74DECLARE_READ16_HANDLER(s3_multifunc_r);
75DECLARE_WRITE16_HANDLER(s3_multifunc_w);
76DECLARE_READ16_HANDLER(s3_fgcolour_r);
77DECLARE_WRITE16_HANDLER(s3_fgcolour_w);
78DECLARE_READ16_HANDLER(s3_bgcolour_r);
79DECLARE_WRITE16_HANDLER(s3_bgcolour_w);
80DECLARE_READ16_HANDLER(s3_backmix_r);
81DECLARE_WRITE16_HANDLER(s3_backmix_w);
82DECLARE_READ16_HANDLER(s3_foremix_r);
83DECLARE_WRITE16_HANDLER(s3_foremix_w);
84DECLARE_READ16_HANDLER(s3_pixel_xfer_r);
85DECLARE_WRITE16_HANDLER(s3_pixel_xfer_w);
86DECLARE_READ8_HANDLER(s3_mem_r);
87DECLARE_WRITE8_HANDLER(s3_mem_w);
44   void vga_vh_text(bitmap_rgb32 &bitmap, const rectangle &cliprect);
45   void vga_vh_ega(bitmap_rgb32 &bitmap,  const rectangle &cliprect);
46   void vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect);
47   void vga_vh_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect);
48   void vga_vh_mono(bitmap_rgb32 &bitmap, const rectangle &cliprect);
49   virtual UINT8 pc_vga_choosevideomode();   
50   void recompute_params_clock(int divisor, int xtal);
51   UINT8 crtc_reg_read(UINT8 index);
52   void recompute_params();
53   void crtc_reg_write(UINT8 index, UINT8 data);
54   void seq_reg_write(UINT8 index, UINT8 data);
55   UINT8 vga_vblank();
56   READ8_MEMBER(vga_crtc_r);
57   WRITE8_MEMBER(vga_crtc_w);
58   UINT8 gc_reg_read(UINT8 index);
59   void attribute_reg_write(UINT8 index, UINT8 data);
60   void gc_reg_write(UINT8 index,UINT8 data);
61private:
62   inline UINT8 rotate_right(UINT8 val);
63   inline UINT8 vga_logical_op(UINT8 data, UINT8 plane, UINT8 mask);
64   inline UINT8 vga_latch_write(int offs, UINT8 data);
65};
8866
89DECLARE_READ8_HANDLER( ati_port_03c0_r );
90DECLARE_READ8_DEVICE_HANDLER(ati_port_ext_r);
91DECLARE_WRITE8_DEVICE_HANDLER(ati_port_ext_w);
92DECLARE_READ16_HANDLER(ibm8514_gpstatus_r);
93DECLARE_WRITE16_HANDLER(ibm8514_cmd_w);
94DECLARE_READ16_HANDLER(mach8_ext_fifo_r);
95DECLARE_WRITE16_HANDLER(mach8_linedraw_index_w);
96DECLARE_READ16_HANDLER(mach8_bresenham_count_r);
97DECLARE_WRITE16_HANDLER(mach8_bresenham_count_w);
98DECLARE_READ16_HANDLER(mach8_scratch0_r);
99DECLARE_WRITE16_HANDLER(mach8_scratch0_w);
100DECLARE_READ16_HANDLER(mach8_scratch1_r);
101DECLARE_WRITE16_HANDLER(mach8_scratch1_w);
102DECLARE_READ16_HANDLER(mach8_config1_r);
103DECLARE_READ16_HANDLER(mach8_config2_r);
104DECLARE_READ16_HANDLER(ibm8514_status_r);
105DECLARE_READ16_HANDLER(ibm8514_substatus_r);
106DECLARE_WRITE16_HANDLER(ibm8514_subcontrol_w);
107DECLARE_READ16_HANDLER(ibm8514_subcontrol_r);
108DECLARE_READ16_HANDLER(ibm8514_htotal_r);
109DECLARE_WRITE16_HANDLER(ibm8514_htotal_w);
110DECLARE_READ16_HANDLER(ibm8514_vtotal_r);
111DECLARE_WRITE16_HANDLER(ibm8514_vtotal_w);
112DECLARE_READ16_HANDLER(ibm8514_vdisp_r);
113DECLARE_WRITE16_HANDLER(ibm8514_vdisp_w);
114DECLARE_READ16_HANDLER(ibm8514_vsync_r);
115DECLARE_WRITE16_HANDLER(ibm8514_vsync_w);
116DECLARE_WRITE16_HANDLER(mach8_linedraw_w);
117DECLARE_READ16_HANDLER(mach8_ec0_r);
118DECLARE_WRITE16_HANDLER(mach8_ec0_w);
119DECLARE_READ16_HANDLER(mach8_ec1_r);
120DECLARE_WRITE16_HANDLER(mach8_ec1_w);
121DECLARE_READ16_HANDLER(mach8_ec2_r);
122DECLARE_WRITE16_HANDLER(mach8_ec2_w);
123DECLARE_READ16_HANDLER(mach8_ec3_r);
124DECLARE_WRITE16_HANDLER(mach8_ec3_w);
125DECLARE_READ8_HANDLER(ati_mem_r);
126DECLARE_WRITE8_HANDLER(ati_mem_w);
12767
128DECLARE_READ8_HANDLER(cirrus_03c0_r);
129DECLARE_WRITE8_HANDLER(cirrus_03c0_w);
68// device type definition
69extern const device_type VGA;
13070
131DECLARE_READ8_HANDLER(vga_gamtor_mem_r);
132DECLARE_WRITE8_HANDLER(vga_gamtor_mem_w);
133DECLARE_READ8_HANDLER(vga_port_gamtor_03b0_r);
134DECLARE_WRITE8_HANDLER(vga_port_gamtor_03b0_w);
135DECLARE_READ8_HANDLER(vga_port_gamtor_03c0_r);
136DECLARE_WRITE8_HANDLER(vga_port_gamtor_03c0_w);
137DECLARE_READ8_HANDLER(vga_port_gamtor_03d0_r);
138DECLARE_WRITE8_HANDLER(vga_port_gamtor_03d0_w);
71// ======================> svga_device
72
73class svga_device :  public vga_device
74{
75public:
76    // construction/destruction
77   svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);   
78
79   virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
80protected:
81   void svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect);
82   void svga_vh_rgb15(bitmap_rgb32 &bitmap, const rectangle &cliprect);
83   void svga_vh_rgb16(bitmap_rgb32 &bitmap, const rectangle &cliprect);
84   void svga_vh_rgb24(bitmap_rgb32 &bitmap, const rectangle &cliprect);
85   void svga_vh_rgb32(bitmap_rgb32 &bitmap, const rectangle &cliprect);
86   virtual UINT8 pc_vga_choosevideomode();
87private:
88};
89
90// ======================> tseng_vga_device
91
92class tseng_vga_device :  public svga_device
93{
94public:
95    // construction/destruction
96    tseng_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
97
98   virtual READ8_MEMBER(port_03b0_r);
99   virtual WRITE8_MEMBER(port_03b0_w);
100   virtual READ8_MEMBER(port_03c0_r);
101   virtual WRITE8_MEMBER(port_03c0_w);
102   virtual READ8_MEMBER(port_03d0_r);
103   virtual WRITE8_MEMBER(port_03d0_w);
104   virtual READ8_MEMBER(mem_r);
105   virtual WRITE8_MEMBER(mem_w);
106
107protected:
108
109private:
110   void tseng_define_video_mode();
111   UINT8 tseng_crtc_reg_read(UINT8 index);
112   void tseng_crtc_reg_write(UINT8 index, UINT8 data);
113   UINT8 tseng_seq_reg_read(UINT8 index);
114   void tseng_seq_reg_write(UINT8 index, UINT8 data);
115
116};
117
118
119// device type definition
120extern const device_type TSENG_VGA;
121
122// ======================> trident_vga_device
123
124class trident_vga_device :  public svga_device
125{
126public:
127    // construction/destruction
128    trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
129
130   virtual READ8_MEMBER(port_03c0_r);
131   virtual WRITE8_MEMBER(port_03c0_w);
132   virtual READ8_MEMBER(port_03d0_r);
133   virtual WRITE8_MEMBER(port_03d0_w);
134   virtual READ8_MEMBER(mem_r);
135   virtual WRITE8_MEMBER(mem_w);
136
137protected:
138
139private:
140   UINT8 trident_seq_reg_read(UINT8 index);
141   void trident_seq_reg_write(UINT8 index, UINT8 data);
142
143};
144
145
146// device type definition
147extern const device_type TRIDENT_VGA;
148
149
150// ======================> s3_vga_device
151
152class s3_vga_device :  public svga_device
153{
154public:
155    // construction/destruction
156    s3_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
157   s3_vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
158
159   virtual READ8_MEMBER(port_03b0_r);
160   virtual WRITE8_MEMBER(port_03b0_w);
161   virtual READ8_MEMBER(port_03c0_r);
162   virtual WRITE8_MEMBER(port_03c0_w);
163   virtual READ8_MEMBER(port_03d0_r);
164   virtual WRITE8_MEMBER(port_03d0_w);
165   virtual READ8_MEMBER(mem_r);
166   virtual WRITE8_MEMBER(mem_w);
167   
168   virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
169   
170   READ16_MEMBER(s3_line_error_r);
171   WRITE16_MEMBER(s3_line_error_w);
172   READ16_MEMBER(ibm8514_gpstatus_r);
173   READ16_MEMBER(s3_gpstatus_r);
174   WRITE16_MEMBER(ibm8514_cmd_w);
175   WRITE16_MEMBER(s3_cmd_w);
176   READ16_MEMBER(ibm8514_desty_r);
177   WRITE16_MEMBER(ibm8514_desty_w);
178   READ16_MEMBER(ibm8514_destx_r);
179   WRITE16_MEMBER(ibm8514_destx_w);
180   READ16_MEMBER(ibm8514_ssv_r);
181   WRITE16_MEMBER(ibm8514_ssv_w);
182   READ16_MEMBER(s3_width_r);
183   WRITE16_MEMBER(s3_width_w);
184   READ16_MEMBER(ibm8514_currentx_r);
185   WRITE16_MEMBER(ibm8514_currentx_w);
186   READ16_MEMBER(ibm8514_currenty_r);
187   WRITE16_MEMBER(ibm8514_currenty_w);
188   READ16_MEMBER(s3_fgcolour_r);
189   WRITE16_MEMBER(s3_fgcolour_w);
190   READ16_MEMBER(s3_bgcolour_r);
191   WRITE16_MEMBER(s3_bgcolour_w);
192   READ16_MEMBER(s3_multifunc_r);
193   WRITE16_MEMBER(s3_multifunc_w);
194   READ16_MEMBER(s3_backmix_r);
195   WRITE16_MEMBER(s3_backmix_w);
196   READ16_MEMBER(s3_foremix_r);
197   WRITE16_MEMBER(s3_foremix_w);
198   READ16_MEMBER(s3_pixel_xfer_r);
199   WRITE16_MEMBER(s3_pixel_xfer_w);
200   
201protected:
202    // device-level overrides
203    virtual void device_start();
204
205private:
206   UINT8 s3_crtc_reg_read(UINT8 index);
207   void s3_define_video_mode(void);
208   void s3_crtc_reg_write(UINT8 index, UINT8 data);
209   void s3_write_fg(UINT32 offset);
210   void s3_write_bg(UINT32 offset);
211   void s3_write(UINT32 offset, UINT32 src);
212   void ibm8514_draw_vector(UINT8 len, UINT8 dir, bool draw);
213   void ibm8514_wait_draw_ssv();
214   void ibm8514_draw_ssv(UINT8 data);
215   void ibm8514_wait_draw_vector();
216   void s3_wait_draw();
217};
218
219
220// device type definition
221extern const device_type S3_VGA;
222
223
224// ======================> gamtor_vga_device
225
226class gamtor_vga_device :  public svga_device
227{
228public:
229    // construction/destruction
230    gamtor_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
231
232
233   virtual READ8_MEMBER(port_03b0_r);
234   virtual WRITE8_MEMBER(port_03b0_w);
235   virtual READ8_MEMBER(port_03c0_r);
236   virtual WRITE8_MEMBER(port_03c0_w);
237   virtual READ8_MEMBER(port_03d0_r);
238   virtual WRITE8_MEMBER(port_03d0_w);
239   virtual READ8_MEMBER(mem_r);
240   virtual WRITE8_MEMBER(mem_w);
241   
242protected:
243private:
244};
245
246
247// device type definition
248extern const device_type GAMTOR_VGA;
249
250// ======================> ati_vga_device
251
252class ati_vga_device :  public s3_vga_device
253{
254public:
255    // construction/destruction
256    ati_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
257
258   virtual READ8_MEMBER(mem_r);
259   virtual WRITE8_MEMBER(mem_w);
260   virtual READ8_MEMBER(port_03c0_r);
261   READ8_MEMBER(ati_port_ext_r);
262   WRITE8_MEMBER(ati_port_ext_w);
263   READ16_MEMBER(ibm8514_status_r);
264   WRITE16_MEMBER(ibm8514_htotal_w);
265   READ16_MEMBER(ibm8514_substatus_r);
266   WRITE16_MEMBER(ibm8514_subcontrol_w);
267   READ16_MEMBER(ibm8514_subcontrol_r);
268   READ16_MEMBER(ibm8514_htotal_r);
269   READ16_MEMBER(ibm8514_vtotal_r);
270   WRITE16_MEMBER(ibm8514_vtotal_w);
271   READ16_MEMBER(ibm8514_vdisp_r);
272   WRITE16_MEMBER(ibm8514_vdisp_w);
273   READ16_MEMBER(ibm8514_vsync_r);
274   WRITE16_MEMBER(ibm8514_vsync_w);
275   READ16_MEMBER(mach8_ec0_r);
276   WRITE16_MEMBER(mach8_ec0_w);
277   READ16_MEMBER(mach8_ec1_r);
278   WRITE16_MEMBER(mach8_ec1_w);
279   READ16_MEMBER(mach8_ec2_r);
280   WRITE16_MEMBER(mach8_ec2_w);
281   READ16_MEMBER(mach8_ec3_r);
282   WRITE16_MEMBER(mach8_ec3_w);
283   READ16_MEMBER(mach8_ext_fifo_r);
284   WRITE16_MEMBER(mach8_linedraw_index_w);
285   READ16_MEMBER(mach8_bresenham_count_r);
286   WRITE16_MEMBER(mach8_bresenham_count_w);
287   WRITE16_MEMBER(mach8_linedraw_w);
288   READ16_MEMBER(mach8_scratch0_r);
289   WRITE16_MEMBER(mach8_scratch0_w);
290   READ16_MEMBER(mach8_scratch1_r);
291   WRITE16_MEMBER(mach8_scratch1_w);
292   READ16_MEMBER(mach8_config1_r);
293   READ16_MEMBER(mach8_config2_r);   
294protected:
295   virtual machine_config_constructor device_mconfig_additions() const;
296private:
297   void ati_define_video_mode();
298
299};
300
301
302// device type definition
303extern const device_type ATI_VGA;
304
305// ======================> cirrus_vga_device
306
307class cirrus_vga_device :  public svga_device
308{
309public:
310    // construction/destruction
311    cirrus_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
312
313   virtual READ8_MEMBER(port_03c0_r);
314   virtual WRITE8_MEMBER(port_03c0_w);
315protected:
316   // device-level overrides
317    virtual void device_start();
318private:
319   void cirrus_define_video_mode();
320   UINT8 cirrus_seq_reg_read(UINT8 index);
321   void cirrus_seq_reg_write(UINT8 index, UINT8 data);
322};
323
324// device type definition
325extern const device_type CIRRUS_VGA;
139326/*
140327  pega notes (paradise)
141328  build in amstrad pc1640
trunk/src/mess/video/cirrus.c
r18228r18229
9393
9494void cirrus_device::device_start()
9595{
96   pc_vga_cirrus_init(machine(), read8_delegate());
9796}
9897
9998//-------------------------------------------------
r18228r18229
159158WRITE8_DEVICE_HANDLER( cirrus_42E8_w )
160159{
161160   if (data & 0x80)
162      pc_vga_reset(space.machine());
161      device->machine().device("vga")->reset();
163162}
trunk/src/mess/video/isa_svga_cirrus.c
r18228r18229
2020
2121const device_type ISA8_SVGA_CIRRUS = &device_creator<isa8_svga_cirrus_device>;
2222
23static MACHINE_CONFIG_FRAGMENT( vga_cirrus )
24   MCFG_SCREEN_ADD("screen", RASTER)
25   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
26   MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_vga_device, screen_update)
2327
28   MCFG_PALETTE_LENGTH(0x100)
29   
30   MCFG_DEVICE_ADD("vga", CIRRUS_VGA, 0)
31MACHINE_CONFIG_END
32
2433//-------------------------------------------------
2534//  machine_config_additions - device-specific
2635//  machine configurations
r18228r18229
2837
2938machine_config_constructor isa8_svga_cirrus_device::device_mconfig_additions() const
3039{
31   return MACHINE_CONFIG_NAME( pcvideo_vga_isa );
40   return MACHINE_CONFIG_NAME( vga_cirrus );
3241}
3342
3443//-------------------------------------------------
r18228r18229
6473{
6574   set_isa_device();
6675
67   video_start_vga( machine() );
68
69   pc_vga_init(machine(), read8_delegate(FUNC(isa8_svga_cirrus_device::input_port_0_r),this));
70
71   int i;
72   for (i = 0; i < 0x100; i++)
73      palette_set_color_rgb(machine(), i, 0, 0, 0);
74   pc_video_start(machine());
75
76   m_vga = subdevice<cirrus_vga_device>("vga");
77   
7678   m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "svga", "dm_clgd5430");
7779
78   m_isa->install_device(0x03b0, 0x03bf, 0, 0, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w));
79   m_isa->install_device(0x03c0, 0x03cf, 0, 0, FUNC(vga_port_03c0_r), FUNC(vga_port_03c0_w));
80   m_isa->install_device(0x03d0, 0x03df, 0, 0, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w));
81//  m_isa->install_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_port_9ae8_r), FUNC(s3_port_9ae8_w));
80   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));
81   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));
82   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));
83//  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));
8284
83   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(vga_mem_r), FUNC(vga_mem_w));
85   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));
8486}
8587
8688//-------------------------------------------------
r18228r18229
8991
9092void isa8_svga_cirrus_device::device_reset()
9193{
92   pc_vga_reset(machine());
9394}
trunk/src/mess/video/isa_svga_cirrus.h
r18228r18229
55
66#include "emu.h"
77#include "machine/isa.h"
8#include "video/pc_vga.h"
89
910//**************************************************************************
1011//  TYPE DEFINITIONS
r18228r18229
2930        // device-level overrides
3031        virtual void device_start();
3132        virtual void device_reset();
33private:     
34      cirrus_vga_device *m_vga;     
3235};
3336
3437
trunk/src/mess/video/isa_svga_tseng.c
r18228r18229
2020const device_type ISA8_SVGA_ET4K = &device_creator<isa8_svga_et4k_device>;
2121
2222
23static MACHINE_CONFIG_FRAGMENT( vga_tseng )
24   MCFG_SCREEN_ADD("screen", RASTER)
25   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
26   MCFG_SCREEN_UPDATE_DEVICE("vga", tseng_vga_device, screen_update)
27
28   MCFG_PALETTE_LENGTH(0x100)
29   
30   MCFG_DEVICE_ADD("vga", TSENG_VGA, 0)
31MACHINE_CONFIG_END
32
2333//-------------------------------------------------
2434//  machine_config_additions - device-specific
2535//  machine configurations
r18228r18229
2737
2838machine_config_constructor isa8_svga_et4k_device::device_mconfig_additions() const
2939{
30   return MACHINE_CONFIG_NAME( pcvideo_vga_isa );
40   return MACHINE_CONFIG_NAME( vga_tseng );
3141}
3242
3343//-------------------------------------------------
r18228r18229
6373{
6474   set_isa_device();
6575
66   video_start_vga( machine() );
67
68   pc_vga_init(machine(), read8_delegate(FUNC(isa8_svga_et4k_device::input_port_0_r),this));
69
70   int i;
71   for (i = 0; i < 0x100; i++)
72      palette_set_color_rgb(machine(), i, 0, 0, 0);
73   pc_video_start(machine());
74
76   m_vga = subdevice<tseng_vga_device>("vga");
77   
7578   m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "et4000", "et4000");
7679
77   m_isa->install_device(0x3b0, 0x3bf, 0, 0, FUNC(tseng_et4k_03b0_r), FUNC(tseng_et4k_03b0_w));
78   m_isa->install_device(0x3c0, 0x3cf, 0, 0, FUNC(tseng_et4k_03c0_r), FUNC(tseng_et4k_03c0_w));
79   m_isa->install_device(0x3d0, 0x3df, 0, 0, FUNC(tseng_et4k_03d0_r), FUNC(tseng_et4k_03d0_w));
80   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));
81   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));
82   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));
8083
81   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(tseng_mem_r), FUNC(tseng_mem_w));
84   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));
8285}
8386
8487//-------------------------------------------------
r18228r18229
8790
8891void isa8_svga_et4k_device::device_reset()
8992{
90   pc_vga_reset(machine());
9193}
trunk/src/mess/video/isa_svga_tseng.h
r18228r18229
55
66#include "emu.h"
77#include "machine/isa.h"
8#include "video/pc_vga.h"
89
910//**************************************************************************
1011//  TYPE DEFINITIONS
r18228r18229
2930        // device-level overrides
3031        virtual void device_start();
3132        virtual void device_reset();
33private:     
34      tseng_vga_device *m_vga;
3235};
3336
3437
trunk/src/mess/video/isa_svga_s3.c
r18228r18229
2121const device_type ISA16_SVGA_S3 = &device_creator<isa16_svga_s3_device>;
2222
2323
24static MACHINE_CONFIG_FRAGMENT( vga_s3 )
25   MCFG_SCREEN_ADD("screen", RASTER)
26   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
27   MCFG_SCREEN_UPDATE_DEVICE("vga", s3_vga_device, screen_update)
28
29   MCFG_PALETTE_LENGTH(0x100)
30   
31   MCFG_DEVICE_ADD("vga", S3_VGA, 0)
32MACHINE_CONFIG_END
33
2434//-------------------------------------------------
2535//  machine_config_additions - device-specific
2636//  machine configurations
r18228r18229
2838
2939machine_config_constructor isa16_svga_s3_device::device_mconfig_additions() const
3040{
31   return MACHINE_CONFIG_NAME( pcvideo_s3_isa );
41   return MACHINE_CONFIG_NAME( vga_s3 );
3242}
3343
3444//-------------------------------------------------
r18228r18229
6474{
6575   set_isa_device();
6676
67   video_start_vga( machine() );
68
69   pc_vga_init(machine(), read8_delegate(FUNC(isa16_svga_s3_device::input_port_0_r),this));
70
71   int i;
72   for (i = 0; i < 0x100; i++)
73      palette_set_color_rgb(machine(), i, 0, 0, 0);
74   s3_video_start(machine());
75
77   m_vga = subdevice<s3_vga_device>("vga");
78   
7679   m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "svga", "s3_764");
7780
78   m_isa->install_device(0x03b0, 0x03bf, 0, 0, FUNC(s3_port_03b0_r), FUNC(s3_port_03b0_w));
79   m_isa->install_device(0x03c0, 0x03cf, 0, 0, FUNC(s3_port_03c0_r), FUNC(s3_port_03c0_w));
80   m_isa->install_device(0x03d0, 0x03df, 0, 0, FUNC(s3_port_03d0_r), FUNC(s3_port_03d0_w));
81   m_isa->install16_device(0x82e8, 0x82eb, 0, 0, FUNC(ibm8514_currenty_r), FUNC(ibm8514_currenty_w));
82   m_isa->install16_device(0x86e8, 0x86eb, 0, 0, FUNC(ibm8514_currentx_r), FUNC(ibm8514_currentx_w));
83   m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, FUNC(ibm8514_desty_r), FUNC(ibm8514_desty_w));
84   m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, FUNC(ibm8514_destx_r), FUNC(ibm8514_destx_w));
85   m_isa->install16_device(0x92e8, 0x92eb, 0, 0, FUNC(s3_line_error_r), FUNC(s3_line_error_w));
86   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, FUNC(s3_width_r), FUNC(s3_width_w));
87   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(s3_gpstatus_r), FUNC(s3_cmd_w));
88   m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, FUNC(ibm8514_ssv_r), FUNC(ibm8514_ssv_w));
89   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, FUNC(s3_bgcolour_r), FUNC(s3_bgcolour_w));
90   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, FUNC(s3_fgcolour_r), FUNC(s3_fgcolour_w));
91   m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, FUNC(s3_backmix_r), FUNC(s3_backmix_w));
92   m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, FUNC(s3_foremix_r), FUNC(s3_foremix_w));
93   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, FUNC(s3_multifunc_r), FUNC(s3_multifunc_w));
94   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, FUNC(s3_pixel_xfer_r), FUNC(s3_pixel_xfer_w));
81   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));
82   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));
83   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));
84   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));
85   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));
86   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));
87   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));
88   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));
89   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));
90   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));
91   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));
92   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));
93   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));
94   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));
95   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));
96   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));
97   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));
9598
96   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(s3_mem_r), FUNC(s3_mem_w));
99   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));
97100}
98101
99102//-------------------------------------------------
r18228r18229
102105
103106void isa16_svga_s3_device::device_reset()
104107{
105   pc_vga_reset(machine());
106108}
trunk/src/mess/video/isa_svga_s3.h
r18228r18229
55
66#include "emu.h"
77#include "machine/isa.h"
8#include "video/pc_vga.h"
89
910//**************************************************************************
1011//  TYPE DEFINITIONS
r18228r18229
2930        // device-level overrides
3031        virtual void device_start();
3132        virtual void device_reset();
33private:     
34      s3_vga_device *m_vga;
3235};
3336
3437
trunk/src/mess/video/isa_vga_ati.c
r18228r18229
2323
2424const device_type ISA16_VGA_GFXULTRA = &device_creator<isa16_vga_gfxultra_device>;
2525
26static MACHINE_CONFIG_FRAGMENT( vga_ati )
27   MCFG_SCREEN_ADD("screen", RASTER)
28   MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
29   MCFG_SCREEN_UPDATE_DEVICE("vga", ati_vga_device, screen_update)
2630
31   MCFG_PALETTE_LENGTH(0x100)
32   
33   MCFG_DEVICE_ADD("vga", ATI_VGA, 0)
34MACHINE_CONFIG_END
35
2736//-------------------------------------------------
2837//  machine_config_additions - device-specific
2938//  machine configurations
r18228r18229
3140
3241machine_config_constructor isa16_vga_gfxultra_device::device_mconfig_additions() const
3342{
34   return MACHINE_CONFIG_NAME( pcvideo_ati_isa );
43   return MACHINE_CONFIG_NAME( vga_ati );
3544}
3645
3746//-------------------------------------------------
r18228r18229
6776{
6877   set_isa_device();
6978
70   video_start_vga( machine() );
71
72   pc_vga_init(machine(), read8_delegate(FUNC(isa16_vga_gfxultra_device::input_port_0_r),this));
73
74   int i;
75   for (i = 0; i < 0x100; i++)
76      palette_set_color_rgb(machine(), i, 0, 0, 0);
77   pc_video_start(machine());
78
79   m_vga = subdevice<ati_vga_device>("vga");
80   
7981   m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "vga", "gfxultra");
8082
81   m_isa->install_device(this, 0x1ce, 0x1cf, 0, 0, FUNC(ati_port_ext_r), FUNC(ati_port_ext_w));
82   m_isa->install16_device(0x2e8, 0x2eb, 0, 0, FUNC(ibm8514_status_r), FUNC(ibm8514_htotal_w));
83   m_isa->install_device(0x3b0, 0x3bf, 0, 0, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w));
84   m_isa->install_device(0x3c0, 0x3cf, 0, 0, FUNC(ati_port_03c0_r), FUNC(vga_port_03c0_w));
85   m_isa->install_device(0x3d0, 0x3df, 0, 0, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w));
86   m_isa->install16_device(0x12e8, 0x12eb, 0, 0, FUNC(ibm8514_vtotal_r),FUNC(ibm8514_vtotal_w));
87   m_isa->install16_device(0x12ec, 0x12ef, 0, 0, FUNC(mach8_config1_r),NULL,NULL);
88   m_isa->install16_device(0x16e8, 0x16eb, 0, 0, FUNC(ibm8514_vdisp_r),FUNC(ibm8514_vdisp_w));
89   m_isa->install16_device(0x16ec, 0x16ef, 0, 0, FUNC(mach8_config2_r),NULL,NULL);
90   m_isa->install16_device(0x1ae8, 0x1aeb, 0, 0, FUNC(ibm8514_vsync_r),FUNC(ibm8514_vsync_w));
91   m_isa->install16_device(0x26e8, 0x26eb, 0, 0, FUNC(ibm8514_htotal_r),NULL,NULL);
92   m_isa->install16_device(0x2ee8, 0x2eeb, 0, 0, FUNC(ibm8514_subcontrol_r),NULL,NULL);
93   m_isa->install16_device(0x42e8, 0x42eb, 0, 0, FUNC(ibm8514_substatus_r), FUNC(ibm8514_subcontrol_w));
94   m_isa->install16_device(0x52e8, 0x52eb, 0, 0, FUNC(mach8_ec0_r), FUNC(mach8_ec0_w));
95   m_isa->install16_device(0x52ec, 0x52ef, 0, 0, FUNC(mach8_scratch0_r), FUNC(mach8_scratch0_w));
96   m_isa->install16_device(0x56e8, 0x56eb, 0, 0, FUNC(mach8_ec1_r), FUNC(mach8_ec1_w));
97   m_isa->install16_device(0x56ec, 0x56ef, 0, 0, FUNC(mach8_scratch0_r), FUNC(mach8_scratch0_w));
98   m_isa->install16_device(0x5ae8, 0x5aeb, 0, 0, FUNC(mach8_ec2_r), FUNC(mach8_ec2_w));
99   m_isa->install16_device(0x5ee8, 0x5eeb, 0, 0, FUNC(mach8_ec3_r), FUNC(mach8_ec3_w));
100   m_isa->install16_device(0x82e8, 0x82eb, 0, 0, FUNC(ibm8514_currenty_r), FUNC(ibm8514_currenty_w));
101   m_isa->install16_device(0x86e8, 0x86eb, 0, 0, FUNC(ibm8514_currentx_r), FUNC(ibm8514_currentx_w));
102   m_isa->install16_device(0x8ae8, 0x8aeb, 0, 0, FUNC(ibm8514_desty_r), FUNC(ibm8514_desty_w));
103   m_isa->install16_device(0x8ee8, 0x8eeb, 0, 0, FUNC(ibm8514_destx_r), FUNC(ibm8514_destx_w));
104   m_isa->install16_device(0x92e8, 0x92eb, 0, 0, FUNC(s3_line_error_r), FUNC(s3_line_error_w));
105   m_isa->install16_device(0x96e8, 0x96eb, 0, 0, FUNC(s3_width_r), FUNC(s3_width_w));
106   m_isa->install16_device(0x96ec, 0x96ef, 0, 0, FUNC(mach8_bresenham_count_r), FUNC(mach8_bresenham_count_w));
107   m_isa->install16_device(0x9ae8, 0x9aeb, 0, 0, FUNC(ibm8514_gpstatus_r), FUNC(ibm8514_cmd_w));
108   m_isa->install16_device(0x9aec, 0x9aef, 0, 0, FUNC(mach8_ext_fifo_r), FUNC(mach8_linedraw_index_w));
109   m_isa->install16_device(0x9ee8, 0x9eeb, 0, 0, FUNC(ibm8514_ssv_r), FUNC(ibm8514_ssv_w));
110   m_isa->install16_device(0xa2e8, 0xa2eb, 0, 0, FUNC(s3_bgcolour_r), FUNC(s3_bgcolour_w));
111   m_isa->install16_device(0xa6e8, 0xa6eb, 0, 0, FUNC(s3_fgcolour_r), FUNC(s3_fgcolour_w));
112   m_isa->install16_device(0xb6e8, 0xb6eb, 0, 0, FUNC(s3_backmix_r), FUNC(s3_backmix_w));
113   m_isa->install16_device(0xbae8, 0xbaeb, 0, 0, FUNC(s3_foremix_r), FUNC(s3_foremix_w));
114   m_isa->install16_device(0xbee8, 0xbeeb, 0, 0, FUNC(s3_multifunc_r), FUNC(s3_multifunc_w));
115   m_isa->install16_device(0xe2e8, 0xe2eb, 0, 0, FUNC(s3_pixel_xfer_r), FUNC(s3_pixel_xfer_w));
116   m_isa->install16_device(0xfeec, 0xfeef, 0, 0, NULL, NULL, FUNC(mach8_linedraw_w));
83   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));
84   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));
85   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));
86   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));
87   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));
88   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));
89   m_isa->install16_device(0x12ec, 0x12ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_config1_r),m_vga), write16_delegate());
90   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));
91   m_isa->install16_device(0x16ec, 0x16ef, 0, 0, read16_delegate(FUNC(ati_vga_device::mach8_config2_r),m_vga), write16_delegate());
92   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));
93   m_isa->install16_device(0x26e8, 0x26eb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_htotal_r),m_vga),write16_delegate());
94   m_isa->install16_device(0x2ee8, 0x2eeb, 0, 0, read16_delegate(FUNC(ati_vga_device::ibm8514_subcontrol_r),m_vga),write16_delegate());
95   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));
96   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));
97   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));
98   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));
99   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));
100   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));
101   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));
102   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));
103   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));
104   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));
105   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));
106   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));
107   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));
108   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));
109   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));
110   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));
111   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));
112   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));
113   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));
114   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));
115   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));
116   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));
117   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));
118   m_isa->install16_device(0xfeec, 0xfeef, 0, 0, read16_delegate(), write16_delegate(FUNC(ati_vga_device::mach8_linedraw_w),m_vga));
117119
118   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(ati_mem_r), FUNC(ati_mem_w));
120   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));
119121}
120122
121123//-------------------------------------------------
r18228r18229
124126
125127void isa16_vga_gfxultra_device::device_reset()
126128{
127   pc_vga_reset(machine());
128129}
trunk/src/mess/video/isa_vga_ati.h
r18228r18229
1212
1313#include "emu.h"
1414#include "machine/isa.h"
15#include "video/pc_vga.h"
1516
1617//**************************************************************************
1718//  TYPE DEFINITIONS
r18228r18229
3637        // device-level overrides
3738        virtual void device_start();
3839        virtual void device_reset();
40private:     
41      ati_vga_device *m_vga;     
3942};
4043
4144
trunk/src/mess/video/isa_vga.c
r18228r18229
2727
2828machine_config_constructor isa8_vga_device::device_mconfig_additions() const
2929{
30   return MACHINE_CONFIG_NAME( pcvideo_vga_isa );
30   return MACHINE_CONFIG_NAME( pcvideo_vga );
3131}
3232
3333//-------------------------------------------------
r18228r18229
6262void isa8_vga_device::device_start()
6363{
6464   set_isa_device();
65   
66   m_vga = subdevice<vga_device>("vga");
6567
66   video_start_vga( machine() );
67
68   pc_vga_init(machine(), read8_delegate(FUNC(isa8_vga_device::input_port_0_r),this));
69
70   int i;
71   for (i = 0; i < 0x100; i++)
72      palette_set_color_rgb(machine(), i, 0, 0, 0);
73   pc_video_start(machine());
74
7568   m_isa->install_rom(this, 0xc0000, 0xc7fff, 0, 0, "ibm_vga", "ibm_vga");
7669
77   m_isa->install_device(0x3b0, 0x3bf, 0, 0, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w));
78   m_isa->install_device(0x3c0, 0x3cf, 0, 0, FUNC(vga_port_03c0_r), FUNC(vga_port_03c0_w));
79   m_isa->install_device(0x3d0, 0x3df, 0, 0, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w));
70   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));
71   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));
72   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));
8073
81   m_isa->install_memory(0xa0000, 0xbffff, 0, 0, FUNC(vga_mem_r), FUNC(vga_mem_w));
74   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));
8275}
8376
8477//-------------------------------------------------
r18228r18229
8780
8881void isa8_vga_device::device_reset()
8982{
90   pc_vga_reset(machine());
9183}
trunk/src/mess/video/isa_vga.h
r18228r18229
55
66#include "emu.h"
77#include "machine/isa.h"
8#include "video/pc_vga.h"
89
910//**************************************************************************
1011//  TYPE DEFINITIONS
r18228r18229
2930        // device-level overrides
3031        virtual void device_start();
3132        virtual void device_reset();
33private:
34      vga_device *m_vga;
3235};
3336
3437
trunk/src/mess/drivers/bebox.c
r18228r18229
5959   AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
6060   AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
6161   AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
62   AM_RANGE(0x800003b0, 0x800003bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, U64(0xffffffffffffffff))
63   AM_RANGE(0x800003c0, 0x800003cf) AM_READWRITE8_LEGACY(cirrus_03c0_r, cirrus_03c0_w, U64(0xffffffffffffffff))
64   AM_RANGE(0x800003d0, 0x800003df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, U64(0xffffffffffffffff))
62   AM_RANGE(0x800003b0, 0x800003bf) AM_DEVREADWRITE8("vga", cirrus_vga_device, port_03b0_r, port_03b0_w, U64(0xffffffffffffffff))
63   AM_RANGE(0x800003c0, 0x800003cf) AM_DEVREADWRITE8("vga", cirrus_vga_device, port_03c0_r, port_03c0_w, U64(0xffffffffffffffff))
64   AM_RANGE(0x800003d0, 0x800003df) AM_DEVREADWRITE8("vga", cirrus_vga_device, port_03d0_r, port_03d0_w, U64(0xffffffffffffffff))
6565   AM_RANGE(0x800003F0, 0x800003F7) AM_READWRITE_LEGACY(bebox_800003F0_r, bebox_800003F0_w )
6666   AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0",ns16550_device,  ins8250_r, ins8250_w, U64(0xffffffffffffffff) )
6767   AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE8_LEGACY(bebox_80000480_r, bebox_80000480_w, U64(0xffffffffffffffff) )
r18228r18229
6969   //AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8_LEGACY("cirrus", cirrus_42E8_w, U64(0xffffffffffffffff) )
7070
7171   AM_RANGE(0xBFFFFFF0, 0xBFFFFFFF) AM_READ_LEGACY(bebox_interrupt_ack_r )
72   AM_RANGE(0xC00A0000, 0XC00BFFFF) AM_READWRITE8_LEGACY(vga_mem_r, vga_mem_w, U64(0xffffffffffffffff) )
73   AM_RANGE(0xC1000000, 0XC11FFFFF) AM_READWRITE8_LEGACY(vga_mem_linear_r, vga_mem_linear_w, U64(0xffffffffffffffff) )
72   AM_RANGE(0xC00A0000, 0XC00BFFFF) AM_DEVREADWRITE8("vga", cirrus_vga_device, mem_r, mem_w, U64(0xffffffffffffffff) )
73   AM_RANGE(0xC1000000, 0XC11FFFFF) AM_DEVREADWRITE8("vga", cirrus_vga_device, mem_linear_r, mem_linear_w, U64(0xffffffffffffffff) )
7474   AM_RANGE(0xFFF00000, 0xFFF03FFF) AM_ROMBANK("bank2")
7575   AM_RANGE(0xFFF04000, 0xFFFFFFFF) AM_READWRITE8_LEGACY(bebox_flash_r, bebox_flash_w, U64(0xffffffffffffffff) )
7676ADDRESS_MAP_END
r18228r18229
186186   MCFG_NS16550_ADD( "ns16550_3", bebox_uart_inteface_3, 0 )   /* TODO: Verify model */
187187
188188   /* video hardware */
189   MCFG_FRAGMENT_ADD( pcvideo_vga )
189   MCFG_FRAGMENT_ADD( pcvideo_cirrus_vga )
190190
191191
192192   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mess/drivers/indiana.c
r18228r18229
2222      : driver_device(mconfig, type, tag) { }
2323   DECLARE_DRIVER_INIT(indiana);
2424   virtual void machine_reset();
25   DECLARE_READ8_MEMBER(indiana_vga_setting);
2625};
2726
2827
r18228r18229
3534   AM_RANGE(0x00500000, 0x005fffff) AM_MIRROR(0x7f800000) AM_RAM // 16 bit PC MEM
3635   AM_RANGE(0x00600000, 0x006fffff) AM_MIRROR(0x7f800000) AM_RAM // 8 bit PC IO
3736   AM_RANGE(0x00700000, 0x007fffff) AM_MIRROR(0x7f800000) AM_RAM // 8 bit PC MEM
38   AM_RANGE(0x7f6003b0, 0x7f6003bf) AM_READWRITE8_LEGACY(vga_port_03b0_r, vga_port_03b0_w, 0xffffffff)
39   AM_RANGE(0x7f6003c0, 0x7f6003cf) AM_READWRITE8_LEGACY(vga_port_03c0_r, vga_port_03c0_w, 0xffffffff)
40   AM_RANGE(0x7f6003d0, 0x7f6003df) AM_READWRITE8_LEGACY(vga_port_03d0_r, vga_port_03d0_w, 0xffffffff)   
41   AM_RANGE(0x7f7a0000, 0x7f7bffff) AM_READWRITE8_LEGACY(vga_mem_r,vga_mem_w, 0xffffffff)   
37   AM_RANGE(0x7f6003b0, 0x7f6003bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
38   AM_RANGE(0x7f6003c0, 0x7f6003cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
39   AM_RANGE(0x7f6003d0, 0x7f6003df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
40   AM_RANGE(0x7f7a0000, 0x7f7bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)   
4241   AM_RANGE(0x80000000, 0x803fffff) AM_MIRROR(0x7fc00000) AM_RAM // 4 MB RAM   
4342ADDRESS_MAP_END
4443
r18228r18229
8180   MCFG_FRAGMENT_ADD( pcvideo_vga )
8281MACHINE_CONFIG_END
8382
84READ8_MEMBER(indiana_state::indiana_vga_setting)
85{
86   return 0xff;   // TODO
87}
88
8983DRIVER_INIT_MEMBER(indiana_state,indiana)
9084{
91   pc_vga_init(machine(), read8_delegate(FUNC(indiana_state::indiana_vga_setting),this));
9285}
9386
9487/* ROM definition */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team