Previous 15994 Revisions Next

r6001 Wednesday 7th October, 2009 at 19:51:06 UTC by Angelo Salese
[PC98]: More basic devices implemented
[src/mess/drivers]pc98.c

src/mess/drivers/pc98.c
r6000r6001
22
33    NEC PC-98 computer series
44
5   preliminary driver by Angelo Salese
6
7   Reminder: tests A20 line feature, afaik it's NOT supported by the i386 core (along with protected mode / MMU)
8
9========================================================================================
10
511    This series features a huge number of models released between 1982 and 1997. They
612    were not IBM PC-compatible, but they had similar hardware (and software: in the
713    1990s, they run MS Windows as OS)
r6000r6001
209215#include "driver.h"
210216#include "cpu/i386/i386.h"
211217#include "machine/8255ppi.h"
218#include "machine/pit8253.h"
212219
213220static UINT32 *pc9801_vram;
221static UINT32 *gfx_bitmap_ram;
222static UINT8 ems_bank;
214223
215224static VIDEO_START( pc9801 )
216225{
226   gfx_bitmap_ram = auto_alloc_array(machine, UINT32, 0x18000*2);
217227}
218228
219229static VIDEO_UPDATE( pc9801 )
r6000r6001
345355      crtc_cmd_w(space,0,data);
346356}
347357
358static WRITE8_HANDLER( ems_sel_w )
359{
360   if(offset == 3)
361   {
362      if(data == 0x22)
363         ems_bank = 1;
364      if(data == 0x20)
365         ems_bank = 0;
366      //printf("%02x %02x\n",offset,data);
367   }
368}
369
370static READ8_HANDLER( port_70_r )
371{
372   if(offset & 1)
373   {
374      logerror("pit port $70 R access %02x\n",offset >> 1);
375      return mame_rand(space->machine);//pit8253_r(devtag_get_device(space->machine, "pit8253"), (offset & 6) >> 1);
376   }
377
378   logerror("crtc port $70 R access %02x\n",offset >> 1);
379   return 0xff;
380}
381
382static WRITE8_HANDLER( port_70_w )
383{
384   if(offset & 1)
385   {
386      logerror("pit port $70 W access %02x %02x\n",offset >> 1,data);
387      pit8253_w(devtag_get_device(space->machine, "pit8253"), (offset & 6) >> 1, data);
388   }
389   else
390      logerror("crtc port $70 W access %02x %02x\n",offset >> 1,data);
391}
392
393/* FIXME */
394static READ8_HANDLER( port_00_r )
395{
396   if(!(offset & 1))
397   {
398      logerror("pic8259 port $00 R access %02x\n",offset >> 1);
399      return mame_rand(space->machine);//pic8259_r(devtag_get_device(space->machine, "pic8259"), (offset & 6) >> 1);
400   }
401
402   logerror("??? port $00 R access %02x\n",offset >> 1);
403   return 0xff;
404}
405
406static WRITE8_HANDLER( port_00_w )
407{
408   if(!(offset & 1))
409   {
410      logerror("pic8259 port $00 W access %02x %02x\n",offset >> 1,data);
411      //pic8259_w(devtag_get_device(space->machine, "pic8259"), (offset & 6) >> 1, data);
412   }
413   else
414      logerror("??? port $00 W access %02x %02x\n",offset >> 1,data);
415}
416
417static READ32_HANDLER( gfx_bitmap_ram_r ) { return gfx_bitmap_ram[offset+ems_bank*0x18000/4]; }
418static WRITE32_HANDLER( gfx_bitmap_ram_w ) { gfx_bitmap_ram[offset+ems_bank*0x18000/4] = data; }
419
348420static ADDRESS_MAP_START( pc9801_mem, ADDRESS_SPACE_PROGRAM, 32)
349   AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
350   AM_RANGE(0x000a0000, 0x000bffff) AM_RAM AM_BASE(&pc9801_vram)
421   AM_RANGE(0x00000000, 0x0009ffff) AM_MIRROR(0x00100000) AM_RAM
422   AM_RANGE(0x000a0000, 0x000a3fff) AM_RAM AM_BASE(&pc9801_vram) //vram + attr
423   AM_RANGE(0x000a4000, 0x000a4fff) AM_RAM //cg window
424   AM_RANGE(0x000a8000, 0x000bffff) AM_READWRITE(gfx_bitmap_ram_r,gfx_bitmap_ram_w)
351425   AM_RANGE(0x000e0000, 0x000fffff) AM_ROM AM_REGION("maincpu",0)
352426   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("maincpu",0)
353427ADDRESS_MAP_END
r6000r6001
355429
356430
357431static ADDRESS_MAP_START( pc9801_io, ADDRESS_SPACE_IO, 32)
358//   AM_RANGE(0x0000, 0x0000) pic8259
359//   AM_RANGE(0x0002, 0x0002)
432   AM_RANGE(0x0000, 0x000f) AM_READWRITE8(port_00_r,port_00_w,0xffffffff) // pic8259 (even ports)
360433//   AM_RANGE(0x0020, 0x0020) rtc
361434//   AM_RANGE(0x0022, 0x0022)
362//   AM_RANGE(0x0030, 0x0030) rs232c (i8251 1)
363//   AM_RANGE(0x0032, 0x0032)
364//   AM_RANGE(0x0031, 0x0031) system port (ppi8255 1)
365//   AM_RANGE(0x0033, 0x0033)
366//   AM_RANGE(0x0035, 0x0035)
367//   AM_RANGE(0x0037, 0x0037)
368   AM_RANGE(0x0030, 0x0037) AM_READWRITE8(sys_port_r,sys_port_w,0xffffffff)
369//   AM_RANGE(0x0040, 0x0040) printer port (ppi8255 2)
370//   AM_RANGE(0x0042, 0x0042)
371//   AM_RANGE(0x0044, 0x0044)
372//   AM_RANGE(0x0046, 0x0046)
373//   AM_RANGE(0x0041, 0x0041) keyboard (i8251 2)
374//   AM_RANGE(0x0043, 0x0043)
375   AM_RANGE(0x0040, 0x0047) AM_READWRITE8(sio_port_r,sio_port_w,0xffffffff)
376//   AM_RANGE(0x0060, 0x0060) uPD7220 status reg / param write (for chars)
377//   AM_RANGE(0x0062, 0x0062) uPD7220 fifo read / cmd write
378   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(port_60_r,port_60_w,0xffffffff)
435   AM_RANGE(0x0030, 0x0037) AM_READWRITE8(sys_port_r,sys_port_w,0xffffffff) // rs232c (even ports) / system ppi8255 (odd ports)
436   AM_RANGE(0x0040, 0x0047) AM_READWRITE8(sio_port_r,sio_port_w,0xffffffff) // printer ppi8255 (even ports) / keyboard (odd ports)
437   AM_RANGE(0x0060, 0x0063) AM_READWRITE8(port_60_r,port_60_w,0xffffffff) // uPD7220 status & fifo (R) / param & cmd (W) master (even ports)
379438//   AM_RANGE(0x0064, 0x0064) V-SYNC related write
380439//   AM_RANGE(0x0068, 0x0068) Flip-Flop 1 r/w
381440//   AM_RANGE(0x006a, 0x006a) Flip-Flop 2 r/w
r6000r6001
386445//   AM_RANGE(0x0076, 0x0076)
387446//   AM_RANGE(0x0078, 0x0078)
388447//   AM_RANGE(0x007a, 0x007a)
389//   AM_RANGE(0x0071, 0x0071) pit8253
390//   AM_RANGE(0x0073, 0x0073)
391//   AM_RANGE(0x0075, 0x0075)
392//   AM_RANGE(0x0077, 0x0077)
393448//   AM_RANGE(0x007c, 0x007c) GRCG mode write
394449//   AM_RANGE(0x007e, 0x007e) GRCG tile write
395//   AM_RANGE(0x00a0, 0x00a0) uPD7220 status reg / param write (for gfx)
396//   AM_RANGE(0x00a2, 0x00a2) uPD7220 fifo read / cmd write
397   AM_RANGE(0x00a0, 0x00a3) AM_READWRITE8(port_a0_r,port_a0_w,0xffffffff)
450   AM_RANGE(0x0070, 0x007f) AM_READWRITE8(port_70_r,port_70_w,0xffffffff) // crtc regs (even ports) / pit8253 (odd ports)
451   AM_RANGE(0x00a0, 0x00a3) AM_READWRITE8(port_a0_r,port_a0_w,0xffffffff) // uPD7220 status & fifo (R) / param & cmd (W) slave (even ports)
398452//    AM_RANGE(0x00e0, 0x00ef) DMA
399//   AM_RANGE(0x043f, 0x043f) EMS select (bankswitch)
453   AM_RANGE(0x043c, 0x043f) AM_WRITE8(ems_sel_w,0xffffffff)
400454
401455//   (and many more...)
402456ADDRESS_MAP_END
r6000r6001
504558   DEVCB_NULL               /* Port C write */
505559};
506560
561static PIT8253_OUTPUT_CHANGED( pc_timer0_w )
562{
563//   pic8259_set_irq_line(filetto_devices.pic8259_1, 0, state);
564}
565
566static const struct pit8253_config pit8253_config =
567{
568   {
569      {
570         4772720/4,            /* heartbeat IRQ */
571         pc_timer0_w
572      }, {
573         4772720/4,            /* dram refresh */
574         NULL
575      }, {
576         4772720/4,            /* pio port c pin 4, and speaker polling enough */
577         NULL
578      }
579   }
580};
581
507582/* I suspect the dump for pc9801 comes from a i386 later model... the original machine would use a i8086 @ 5Mhz CPU (see notes at top) */
508583/* More investigations are required, but in the meanwhile I set a I386 as main CPU */
509584static MACHINE_DRIVER_START( pc9801 )
r6000r6001
516591
517592   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf )
518593   MDRV_PPI8255_ADD( "ppi8255_1", printer_intf )
594   MDRV_PIT8253_ADD( "pit8253", pit8253_config )
519595
520596   /* video hardware */
521597   MDRV_SCREEN_ADD("screen", RASTER)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team