Previous 15994 Revisions Next

r14153 Tuesday 24th January, 2012 at 14:17:47 UTC by Miodrag Milanović
Some VGA cleanup and refactoring (no whatsnew)
[src/emu/video]pc_vga.c pc_vga.h
[src/mame/drivers]calchase.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 xtom3d.c
[src/mess/machine]at.c pc.c
[src/mess/video]cirrus.c

src/mame/drivers/su2000.c
r14152r14153
171171   return 0xff;
172172}
173173
174/* TODO */
175static const struct pc_vga_interface vga_interface =
176{
177   vga_setting,
178   AS_PROGRAM,
179   0xa0000,
180   AS_IO,
181   0x0000
182};
183
184
185174/*************************************************************
186175 *
187176 * PIC8259 Configuration
r14152r14153
295284
296285   kbdc8042_init(machine, &at8042);
297286
298   pc_vga_init(machine, &vga_interface, NULL);
287   pc_vga_init(machine, vga_setting, NULL);
288   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
299289}
300290
301291static MACHINE_RESET( su2000 )
src/mame/drivers/queen.c
r14152r14153
644644
645645static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
646646
647static const struct pc_vga_interface vga_interface =
648{
649   vga_setting,
650   AS_PROGRAM,
651   0xa0000,
652   AS_IO,
653   0x0000
654};
655
656647static MACHINE_START( queen )
657648{
658649   queen_state *state = machine.driver_data<queen_state>();
r14152r14153
671662   intel82439tx_init(machine);
672663
673664   kbdc8042_init(machine, &at8042);
674   pc_vga_init(machine, &vga_interface, NULL);
665   pc_vga_init(machine, vga_setting, NULL);
666   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
675667}
676668
677669static MACHINE_RESET( queen )
src/mame/drivers/savquest.c
r14152r14153
524524
525525static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
526526
527static const struct pc_vga_interface vga_interface =
528{
529   vga_setting,
530   AS_PROGRAM,
531   0xa0000,
532   AS_IO,
533   0x0000
534};
535
536527static MACHINE_START( savquest )
537528{
538529   savquest_state *state = machine.driver_data<savquest_state>();
r14152r14153
544535   intel82439tx_init(machine);
545536
546537   kbdc8042_init(machine, &at8042);
547   pc_vga_init(machine, &vga_interface, NULL);
538   pc_vga_init(machine, vga_setting, NULL);
539   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
548540}
549541
550542static MACHINE_RESET( savquest )
src/mame/drivers/photoply.c
r14152r14153
330330
331331static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
332332
333static const struct pc_vga_interface vga_interface =
334{
335   vga_setting,
336   AS_PROGRAM,
337   0xa0000,
338   AS_IO,
339   0x0000
340};
341
342
343
344333static MACHINE_CONFIG_START( photoply, photoply_state )
345334   /* basic machine hardware */
346335   MCFG_CPU_ADD("maincpu", I486, 75000000)   /* I486DX4, 75 or 100 Mhz */
r14152r14153
382371
383372static DRIVER_INIT( photoply )
384373{
385   pc_vga_init(machine, &vga_interface, NULL);
374   pc_vga_init(machine, vga_setting, NULL);
375   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
386376}
387377
388378GAME( 199?, photoply,  0,   photoply, photoply, photoply, ROT0, "Funworld", "PhotoPlay", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/midqslvr.c
r14152r14153
662662
663663static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
664664
665static const struct pc_vga_interface vga_interface =
666{
667   vga_setting,
668   AS_PROGRAM,
669   0xa0000,
670   AS_IO,
671   0x0000
672};
673
674665static MACHINE_START( midqslvr )
675666{
676667   midqslvr_state *state = machine.driver_data<midqslvr_state>();
r14152r14153
689680   intel82439tx_init(machine);
690681
691682   kbdc8042_init(machine, &at8042);
692   pc_vga_init(machine, &vga_interface, NULL);
683   pc_vga_init(machine, vga_setting, NULL);
684   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
693685}
694686
695687static MACHINE_RESET( midqslvr )
src/mame/drivers/calchase.c
r14152r14153
593593
594594static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
595595
596static const struct pc_vga_interface vga_interface =
597{
598   vga_setting,
599   AS_PROGRAM,
600   0xa0000,
601   AS_IO,
602   0x0000
603};
604
605
606
607596static MACHINE_START(calchase)
608597{
609598   calchase_state *state = machine.driver_data<calchase_state>();
r14152r14153
749738   calchase_state *state = machine.driver_data<calchase_state>();
750739   state->m_bios_ram = auto_alloc_array(machine, UINT32, 0x20000/4);
751740
752   pc_vga_init(machine, &vga_interface, NULL);
741   pc_vga_init(machine, vga_setting, NULL);
742   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
743
753744   init_pc_common(machine, PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int);
754745
755746   intel82439tx_init(machine);
src/mame/drivers/xtom3d.c
r14152r14153
653653
654654static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
655655
656static const struct pc_vga_interface vga_interface =
657{
658   vga_setting,
659   AS_PROGRAM,
660   0xa0000,
661   AS_IO,
662   0x0000
663};
664
665656static MACHINE_START( xtom3d )
666657{
667658   xtom3d_state *state = machine.driver_data<xtom3d_state>();
r14152r14153
680671   intel82439tx_init(machine);
681672
682673   kbdc8042_init(machine, &at8042);
683   pc_vga_init(machine, &vga_interface, NULL);
674   pc_vga_init(machine, vga_setting, NULL);
675   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
684676}
685677
686678static MACHINE_RESET( xtom3d )
src/mame/drivers/pcat_dyn.c
r14152r14153
109109
110110static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
111111
112static const struct pc_vga_interface vga_interface =
113{
114   vga_setting,
115   AS_PROGRAM,
116   0xa0000,
117   AS_IO,
118   0x0000
119};
120
121112static void set_gate_a20(running_machine &machine, int a20)
122113{
123114   cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20);
r14152r14153
204195
205196static DRIVER_INIT(pcat_dyn)
206197{
207   pc_vga_init(machine, &vga_interface, NULL);
198   pc_vga_init(machine, vga_setting, NULL);
199   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
208200}
209201
210202GAME( 1995, toursol,  0,       pcat_dyn, pcat_dyn, pcat_dyn, ROT0, "Dynamo", "Tournament Solitaire (V1.06, 08/03/95)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/pcat_nit.c
r14152r14153
215215
216216static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
217217
218static const struct pc_vga_interface vga_interface =
219{
220   vga_setting,
221   AS_PROGRAM,
222   0xa0000,
223   AS_IO,
224   0x0000
225};
226
227218static MACHINE_START( streetg2 )
228219{
229220   device_set_irq_callback(machine.device("maincpu"), pcat_irq_callback);
r14152r14153
422413   state->m_banked_nvram = auto_alloc_array(machine, UINT8, 0x2000);
423414   machine.device<nvram_device>("nvram")->set_base(state->m_banked_nvram, 0x2000);
424415
425   pc_vga_init(machine, &vga_interface, NULL);
416   pc_vga_init(machine, vga_setting, NULL);
417   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
426418}
427419
428420GAME( 1993, bonanza,    0,         pcat_nit,  pcat_nit, pcat_nit, ROT0, "New Image Technologies",  "Bonanza (Revision 3)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/magtouch.c
r14152r14153
182182
183183static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
184184
185static const struct pc_vga_interface vga_interface =
186{
187   vga_setting,
188   AS_PROGRAM,
189   0xa0000,
190   AS_IO,
191   0x0000
192};
193
194185static MACHINE_START( magtouch )
195186{
196187   device_set_irq_callback(machine.device("maincpu"), pcat_irq_callback);
r14152r14153
242233
243234static DRIVER_INIT(magtouch)
244235{
245   pc_vga_init(machine, &vga_interface, NULL);
236   pc_vga_init(machine, vga_setting, NULL);
237   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
246238}
247239
248240GAME( 1995, magtouch,   0,         magtouch,  magtouch, magtouch, ROT0, "Micro Manufacturing",     "Magical Touch", GAME_NOT_WORKING | GAME_NO_SOUND )
src/mame/drivers/pangofun.c
r14152r14153
164164
165165static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
166166
167static const struct pc_vga_interface vga_interface =
168{
169   vga_setting,
170   AS_PROGRAM,
171   0xa0000,
172   AS_IO,
173   0x0000
174};
175
176167static void set_gate_a20(running_machine &machine, int a20)
177168{
178169   cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20);
r14152r14153
251242
252243static DRIVER_INIT(pangofun)
253244{
254   pc_vga_init(machine, &vga_interface, NULL);
245   pc_vga_init(machine, vga_setting, NULL);
246   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);
255247}
256248
257249GAME( 1995, pangofun,  0,   pangofun, pangofun, pangofun, ROT0, "InfoCube", "Pango Fun (Italy)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/taitowlf.c
r14152r14153
699699
700700#if ENABLE_VGA
701701static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
702
703static const struct pc_vga_interface vga_interface =
704{
705   vga_setting,
706   AS_PROGRAM,
707   0xa0000,
708   AS_IO,
709   0x0000
710};
711702#endif
712703
713704static DRIVER_INIT( taitowlf )
r14152r14153
721712
722713   kbdc8042_init(machine, &at8042);
723714   #if ENABLE_VGA
724   pc_vga_init(machine, &vga_interface, NULL);
715   pc_vga_init(machine, vga_setting, NULL);
716   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);   
725717   #endif
726718}
727719
src/mame/drivers/pntnpuzl.c
r14152r14153
354354
355355static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color
356356
357static const struct pc_vga_interface vga_interface =
358{
359   vga_setting,
360   AS_PROGRAM,
361   0x3a0000,
362   AS_PROGRAM,
363   0x3c0000
364};
365
366357static MACHINE_CONFIG_START( pntnpuzl, pntnpuzl_state )
367358   MCFG_CPU_ADD("maincpu", M68000, 12000000)//??
368359   MCFG_CPU_PROGRAM_MAP(pntnpuzl_map)
r14152r14153
389380//  UINT16 *rom = (UINT16 *)machine.region("maincpu")->base();
390381//  rom[0x2696/2] = 0x4e71;
391382//  rom[0x26a0/2] = 0x4e71;
392   pc_vga_init(machine, &vga_interface, NULL);
383   pc_vga_init(machine, vga_setting, NULL);
384   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0x3a0000, machine.device("maincpu")->memory().space(AS_PROGRAM), 0x3c0000);   
385   
393386}
394387
395388GAME( 199?, pntnpuzl,    0, pntnpuzl,    pntnpuzl,    pip, ROT90,  "Century?", "Paint & Puzzle",GAME_NO_SOUND|GAME_NOT_WORKING )
src/emu/video/pc_vga.c
r14152r14153
5555
5656static struct
5757{
58   struct pc_vga_interface vga_intf;
58   read8_space_func read_dipswitch;
5959   struct pc_svga_interface svga_intf;
6060
6161   UINT8 *memory;
62   UINT8 *fontdirty;
6362   UINT32 pens[16]; /* the current 16 pens */
6463
6564   UINT8 miscellaneous_output;
r14152r14153
620619   vga.memory[offset] = data;
621620}
622621
623INLINE WRITE8_HANDLER(vga_dirty_font_w)
624{
625   if (vga.memory[offset] != data)
626   {
627      vga.memory[offset] = data;
628      if ((offset&3)==2)
629         vga.fontdirty[offset>>7]=1;
630   }
631}
632
633622static READ8_HANDLER(vga_text_r)
634623{
635624   int data;
r14152r14153
729718   if (vga.sequencer.data[2]&2)
730719      vga_dirty_w(space, (offset<<2)+1, vga_latch_write(1,data));
731720   if (vga.sequencer.data[2]&4)
732      vga_dirty_font_w(space, (offset<<2)+2, vga_latch_write(2,data));
721      vga_dirty_w(space, (offset<<2)+2, vga_latch_write(2,data));
733722   if (vga.sequencer.data[2]&8)
734723      vga_dirty_w(space, (offset<<2)+3, vga_latch_write(3,data));
735724   if ((offset==0xffff)&&(data==0)) vga.log=1;
r14152r14153
745734
746735static WRITE8_HANDLER(vga_vga_w)
747736{
748   vga_dirty_font_w(space, ((offset&~3)<<2)|(offset&3),data);
737   vga_dirty_w(space, ((offset&~3)<<2)|(offset&3),data);
749738}
750739
751static void vga_cpu_interface(running_machine &machine)
752{
753   address_space *space = machine.firstcpu->memory().space(vga.vga_intf.mem_addressspace);
754   static int sequencer, gc;
755   read8_space_func read_handler; const char *read_handler_name;
756   write8_space_func write_handler; const char *write_handler_name;
757   UINT8 sel;
758   int buswidth;
759   UINT64 mask = 0;
760
761   if ((gc==vga.gc.data[6])&&(sequencer==vga.sequencer.data[4])) return;
762
763   gc=vga.gc.data[6];
764   sequencer=vga.sequencer.data[4];
765
766   if (vga.sequencer.data[4]&8)
767   {
768      read_handler = vga_vga_r; read_handler_name = "vga_vga_r";
769      write_handler = vga_vga_w; write_handler_name = "vga_vga_w";
770   }
771   else if (vga.sequencer.data[4] & 4)
772   {
773      read_handler = vga_ega_r; read_handler_name = "vga_ega_r";
774      write_handler = vga_ega_w; write_handler_name = "vga_ega_w";
775   }
776   else
777   {
778      read_handler = vga_text_r; read_handler_name = "vga_text_r";
779      write_handler = vga_text_w; write_handler_name = "vga_text_w";
780   }
781
782   /* remap the VGA memory */
783
784   buswidth = downcast<legacy_cpu_device *>(machine.firstcpu)->space_config(AS_PROGRAM)->m_databus_width;
785   switch(buswidth)
786   {
787      case 8:
788         mask = 0;
789         break;
790
791      case 16:
792         mask = 0xffff;
793         break;
794
795      case 32:
796         mask = 0xffffffff;
797         break;
798
799      case 64:
800         mask = -1;
801         break;
802
803      default:
804         fatalerror("VGA: Bus width %d not supported", buswidth);
805         break;
806   }
807
808   sel = vga.gc.data[6] & 0x0c;
809   if (sel)
810   {
811      if (sel == 0x04) space->install_legacy_read_handler(vga.vga_intf.mem_offset + 0x00000, vga.vga_intf.mem_offset + 0x0ffff, read_handler, read_handler_name, mask); else space->nop_read(vga.vga_intf.mem_offset + 0x00000, vga.vga_intf.mem_offset + 0x0ffff);
812      if (sel == 0x08) space->install_legacy_read_handler(vga.vga_intf.mem_offset + 0x10000, vga.vga_intf.mem_offset + 0x17fff, read_handler, read_handler_name, mask); else space->nop_read(vga.vga_intf.mem_offset + 0x10000, vga.vga_intf.mem_offset + 0x17fff);
813      if (sel == 0x0C) space->install_legacy_read_handler(vga.vga_intf.mem_offset + 0x18000, vga.vga_intf.mem_offset + 0x1ffff, read_handler, read_handler_name, mask); else space->nop_read(vga.vga_intf.mem_offset + 0x18000, vga.vga_intf.mem_offset + 0x1ffff);
814      if (sel == 0x04) space->install_legacy_write_handler(vga.vga_intf.mem_offset + 0x00000, vga.vga_intf.mem_offset + 0x0ffff, write_handler, write_handler_name, mask); else space->nop_write(vga.vga_intf.mem_offset + 0x00000, vga.vga_intf.mem_offset + 0x0ffff);
815      if (sel == 0x08) space->install_legacy_write_handler(vga.vga_intf.mem_offset + 0x10000, vga.vga_intf.mem_offset + 0x17fff, write_handler, write_handler_name, mask); else space->nop_write(vga.vga_intf.mem_offset + 0x10000, vga.vga_intf.mem_offset + 0x17fff);
816      if (sel == 0x0C) space->install_legacy_write_handler(vga.vga_intf.mem_offset + 0x18000, vga.vga_intf.mem_offset + 0x1ffff, write_handler, write_handler_name, mask); else space->nop_write(vga.vga_intf.mem_offset + 0x18000, vga.vga_intf.mem_offset + 0x1ffff);
817   }
818   else
819   {
820      space->install_read_bank(vga.vga_intf.mem_offset + 0x00000, vga.vga_intf.mem_offset + 0x1ffff, "vga_bank" );
821      space->install_write_bank(vga.vga_intf.mem_offset + 0x00000, vga.vga_intf.mem_offset + 0x1ffff, "vga_bank" );
822      memory_set_bankptr(machine, "vga_bank", vga.memory);
823   }
824}
825
826740#if 0
827741static UINT8 crtc_reg_read(UINT8 index)
828742{
r14152r14153
11121026         switch ((vga.miscellaneous_output>>2)&3)
11131027         {
11141028            case 3:
1115               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(space, 0) & 0x01)
1029               if (vga.read_dipswitch && vga.read_dipswitch(space, 0) & 0x01)
11161030                  data |= 0x10;
11171031               break;
11181032            case 2:
1119               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(space, 0) & 0x02)
1033               if (vga.read_dipswitch && vga.read_dipswitch(space, 0) & 0x02)
11201034                  data |= 0x10;
11211035               break;
11221036            case 1:
1123               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(space, 0) & 0x04)
1037               if (vga.read_dipswitch && vga.read_dipswitch(space, 0) & 0x04)
11241038                  data |= 0x10;
11251039               break;
11261040            case 0:
1127               if (vga.vga_intf.read_dipswitch && vga.vga_intf.read_dipswitch(space, 0) & 0x08)
1041               if (vga.read_dipswitch && vga.read_dipswitch(space, 0) & 0x08)
11281042                  data |= 0x10;
11291043               break;
11301044         }
r14152r14153
12651179      if (vga.sequencer.index < vga.svga_intf.seq_regcount)
12661180      {
12671181         vga.sequencer.data[vga.sequencer.index] = data;
1268         vga_cpu_interface(space->machine());
1269
12701182         recompute_params(space->machine());
12711183      }
12721184      break;
r14152r14153
13291241      if (vga.gc.index < vga.svga_intf.gc_regcount)
13301242      {
13311243         vga.gc.data[vga.gc.index] = data;
1332         vga_cpu_interface(space->machine());
13331244      }
13341245      break;
13351246   }
r14152r14153
13701281   the video memory area,
13711282   so I introduced the reset to switch to b8000 area */
13721283   vga.sequencer.data[4] = 0;
1373   vga_cpu_interface(machine);
13741284
13751285   /* TODO: real defaults */
13761286   vga.crtc.line_compare = 0x3ff;
13771287}
13781288
1379void pc_vga_init(running_machine &machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf)
1289static READ8_HANDLER(vga_mem_r)
13801290{
1381   int i, j, k, mask1, buswidth;
1382   address_space *io_space; // , mem_space;
1291   read8_space_func read_handler;
1292   if (vga.sequencer.data[4]&8)
1293   {
1294      read_handler = vga_vga_r;
1295   }
1296   else if (vga.sequencer.data[4] & 4)
1297   {
1298      read_handler = vga_ega_r;
1299   }
1300   else
1301   {
1302      read_handler = vga_text_r;
1303   }
1304   switch((vga.gc.data[6] >> 2) & 0x03)
1305   {
1306      case 0: return vga.memory[offset & 0x1ffff];
1307      case 1: return read_handler(space,(offset - 0x00000) & 0x0ffff);
1308      case 2: return read_handler(space,(offset - 0x10000) & 0x0ffff);
1309      case 3: return read_handler(space,(offset - 0x18000) & 0x0ffff);
1310   }
1311   return 0;
1312}
13831313
1314static WRITE8_HANDLER(vga_mem_w)
1315{
1316   write8_space_func write_handler;
1317   if (vga.sequencer.data[4]&8)
1318   {
1319      write_handler = vga_vga_w;
1320   }
1321   else if (vga.sequencer.data[4] & 4)
1322   {
1323      write_handler = vga_ega_w;
1324   }
1325   else
1326   {
1327      write_handler = vga_text_w;
1328   }
1329   switch((vga.gc.data[6] >> 2) & 0x03)
1330   {
1331      case 0: vga.memory[offset & 0x1ffff] = data; break;
1332      case 1: write_handler(space,(offset - 0x00000) & 0x0ffff,data); break;
1333      case 2: write_handler(space,(offset - 0x10000) & 0x0ffff,data); break;
1334      case 3: write_handler(space,(offset - 0x18000) & 0x0ffff,data); break;
1335   }
1336
1337}
1338
1339void pc_vga_init(running_machine &machine, read8_space_func read_dipswitch, const struct pc_svga_interface *svga_intf)
1340{
1341   int i, j, k, mask1;
1342
13841343   memset(&vga, 0, sizeof(vga));
13851344
13861345   for (k=0;k<4;k++)
r14152r14153
13911350            color_bitplane_to_packed[k][j][i]=(i&mask1)?(1<<k):0;
13921351      }
13931352   }
1394   UINT64 mask = 0;
13951353   /* copy over interfaces */
1396   vga.vga_intf = *vga_intf;
1354   vga.read_dipswitch = read_dipswitch;
13971355   if (svga_intf)
13981356   {
13991357      vga.svga_intf = *svga_intf;
r14152r14153
14141372   }
14151373
14161374   vga.memory         = auto_alloc_array(machine, UINT8, vga.svga_intf.vram_size);
1417   vga.fontdirty      = auto_alloc_array(machine, UINT8, 0x800);
14181375   vga.sequencer.data   = auto_alloc_array(machine, UINT8, vga.svga_intf.seq_regcount);
14191376   vga.crtc.data      = auto_alloc_array(machine, UINT8, vga.svga_intf.crtc_regcount);
14201377   vga.gc.data         = auto_alloc_array(machine, UINT8, vga.svga_intf.gc_regcount);
14211378   memset(vga.memory, '\0', vga.svga_intf.vram_size);
1422   memset(vga.fontdirty, '\0', 0x800);
14231379   memset(vga.sequencer.data, '\0', vga.svga_intf.seq_regcount);
14241380   memset(vga.crtc.data, '\0', vga.svga_intf.crtc_regcount);
14251381   memset(vga.gc.data, '\0', vga.svga_intf.gc_regcount);
14261382
1427   buswidth = downcast<legacy_cpu_device *>(machine.firstcpu)->space_config(AS_PROGRAM)->m_databus_width;
1428//  mem_space = machine.firstcpu->memory().space(vga.vga_intf.mem_addressspace);
1429   io_space = machine.firstcpu->memory().space(vga.vga_intf.port_addressspace);
1383   pc_vga_reset(machine);
1384}
1385
1386void pc_vga_io_init(running_machine &machine, address_space *mem_space, offs_t mem_offset, address_space *io_space, offs_t port_offset)
1387{
1388   int buswidth;
1389   UINT64 mask = 0;
1390
1391   buswidth = machine.firstcpu->memory().space_config(AS_PROGRAM)->m_databus_width;
14301392   switch(buswidth)
14311393   {
14321394      case 8:
r14152r14153
14491411         fatalerror("VGA: Bus width %d not supported", buswidth);
14501412         break;
14511413   }
1452   io_space->install_legacy_read_handler(vga.vga_intf.port_offset + 0x3b0, vga.vga_intf.port_offset + 0x3bf, FUNC(vga_port_03b0_r), mask);
1453   io_space->install_legacy_read_handler(vga.vga_intf.port_offset + 0x3c0, vga.vga_intf.port_offset + 0x3cf, FUNC(vga_port_03c0_r), mask);
1454   io_space->install_legacy_read_handler(vga.vga_intf.port_offset + 0x3d0, vga.vga_intf.port_offset + 0x3df, FUNC(vga_port_03d0_r), mask);
1414   io_space->install_legacy_readwrite_handler(port_offset + 0x3b0, port_offset + 0x3bf, FUNC(vga_port_03b0_r), FUNC(vga_port_03b0_w), mask);
1415   io_space->install_legacy_readwrite_handler(port_offset + 0x3c0, port_offset + 0x3cf, FUNC(vga_port_03c0_r), FUNC(vga_port_03c0_w), mask);
1416   io_space->install_legacy_readwrite_handler(port_offset + 0x3d0, port_offset + 0x3df, FUNC(vga_port_03d0_r), FUNC(vga_port_03d0_w), mask);
14551417
1456   io_space->install_legacy_write_handler(vga.vga_intf.port_offset + 0x3b0, vga.vga_intf.port_offset + 0x3bf, FUNC(vga_port_03b0_w), mask);
1457   io_space->install_legacy_write_handler(vga.vga_intf.port_offset + 0x3c0, vga.vga_intf.port_offset + 0x3cf, FUNC(vga_port_03c0_w), mask);
1458   io_space->install_legacy_write_handler(vga.vga_intf.port_offset + 0x3d0, vga.vga_intf.port_offset + 0x3df, FUNC(vga_port_03d0_w), mask);
1459
1460   pc_vga_reset(machine);
1418   mem_space->install_legacy_readwrite_handler(mem_offset + 0x00000, mem_offset + 0x1ffff, FUNC(vga_mem_r), FUNC(vga_mem_w), mask);
14611419}
14621420
14631421static VIDEO_START( vga )
src/emu/video/pc_vga.h
r14152r14153
1111
1212MACHINE_CONFIG_EXTERN( pcvideo_vga );
1313
14struct pc_vga_interface
15{
16   /* VGA dipswitch (???) */
17   read8_space_func read_dipswitch;
18
19   /* where the RAM go */
20   int mem_addressspace;
21   offs_t mem_offset;
22
23   /* where the ports go */
24   int port_addressspace;
25   offs_t port_offset;
26};
27
2814struct pc_svga_interface
2915{
3016   size_t vram_size;
r14152r14153
3420   void (*choosevideomode)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *sequencer, const UINT8 *crtc, const UINT8 *gc, int *width, int *height);
3521};
3622
37void pc_vga_init(running_machine &machine, const struct pc_vga_interface *vga_intf, const struct pc_svga_interface *svga_intf);
23void pc_vga_init(running_machine &machine, read8_space_func read_dipswitch, const struct pc_svga_interface *svga_intf);
24void pc_vga_io_init(running_machine &machine, address_space *mem_space, offs_t mem_offset, address_space *io_space, offs_t port_offset);
3825void pc_vga_reset(running_machine &machine);
3926void *pc_vga_memory(void);
4027size_t pc_vga_memory_size(void);
src/mess/machine/at.c
r14152r14153
322322
323323static READ8_HANDLER( input_port_0_r ) { return input_port_read(space->machine(), "IN0"); }
324324
325static const struct pc_vga_interface vga_interface =
326{
327   input_port_0_r,
328   AS_PROGRAM,
329   0xa0000,
330   AS_IO,
331   0x0000
332};
333
334
335325DRIVER_INIT( atcga )
336326{
337327   init_at_common(machine);
r14152r14153
340330DRIVER_INIT( atvga)
341331{
342332   init_at_common(machine);
343   pc_vga_init(machine, &vga_interface, NULL);
333   pc_vga_init(machine, input_port_0_r, NULL);
334   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);   
344335}
345336
346337static IRQ_CALLBACK(at_irq_callback)
src/mess/machine/pc.c
r14152r14153
10801080
10811081static READ8_HANDLER( input_port_0_r ) { return input_port_read(space->machine(), "IN0"); }
10821082
1083static const struct pc_vga_interface vga_interface =
1084{
1085   input_port_0_r,
1086   AS_PROGRAM,
1087   0xa0000,
1088   AS_IO,
1089   0x0000
1090};
1091
1092
1093
10941083DRIVER_INIT( pc1640 )
10951084{
10961085   address_space *io_space = machine.firstcpu->memory().space( AS_IO );
r14152r14153
11051094{
11061095   mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line);
11071096
1108   pc_vga_init(machine, &vga_interface, NULL);
1097   pc_vga_init(machine, input_port_0_r, NULL);
1098   pc_vga_io_init(machine, machine.device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine.device("maincpu")->memory().space(AS_IO), 0x0000);   
11091099}
11101100
11111101static IRQ_CALLBACK(pc_irq_callback)
src/mess/video/cirrus.c
r14152r14153
146146{
147147}
148148
149static const struct pc_vga_interface bebox_vga_interface =
150{
151   NULL,
152   AS_PROGRAM,
153   0xC00A0000,
154   AS_PROGRAM,
155   0x80000000
156};
157
158149const struct pc_svga_interface cirrus_svga_interface =
159150{
160151   2 * 1024 * 1024,   /* 2 megs vram */
r14152r14153
171162
172163void cirrus_device::device_start()
173164{
174   pc_vga_init(machine(), &bebox_vga_interface, &cirrus_svga_interface);
165   pc_vga_init(machine(), NULL, &cirrus_svga_interface);
166   pc_vga_io_init(machine(), machine().device("ppc1")->memory().space(AS_PROGRAM), 0xC00A0000, machine().device("ppc1")->memory().space(AS_PROGRAM), 0x80000000);
175167}
176168
177169//-------------------------------------------------

Previous 15994 Revisions Next


© 1998-2018 The MESS Team