Previous 15994 Revisions Next

r6247 Monday 2nd November, 2009 at 08:03:28 UTC by Curt Coder
Refactored to use the new I8255A device.
[src/mess/drivers]act.c pc98.c x1.c

src/mess/drivers/act.c
r6246r6247
1414#include "driver.h"
1515#include "cpu/i86/i86.h"
1616#include "video/mc6845.h"
17#include "machine/8255ppi.h"
17#include "machine/i8255a.h"
1818#include "machine/wd17xx.h"
1919#include "devices/flopdrv.h"
2020#include "cpu/z80/z80daisy.h"
r6246r6247
238238   ADDRESS_MAP_UNMAP_HIGH
239239   AM_RANGE(0x0000, 0x0003) AM_DEVREADWRITE8("pic8259_master",pic8259_r, pic8259_w,0x00ff)
240240   AM_RANGE(0x0040, 0x0047) AM_READWRITE8(act_fdc_r, act_fdc_w,0x00ff)
241   AM_RANGE(0x0048, 0x004f) AM_DEVREADWRITE8("ppi8255_0", ppi8255_r, ppi8255_w,0x00ff)
241   AM_RANGE(0x0048, 0x004f) AM_DEVREADWRITE8("ppi8255_0", i8255a_r, i8255a_w,0x00ff)
242242//   AM_RANGE(0x0050, 0x0051) sound gen
243243   AM_RANGE(0x0058, 0x005f) AM_DEVREADWRITE8("pit8253",pit8253_r,pit8253_w,0x00ff)
244244   AM_RANGE(0x0060, 0x0067) AM_READWRITE8(act_sio_r,act_sio_w,0x00ff)
r6246r6247
344344   wd17xx_set_side(dev,(data & 0x04)>>2);
345345}
346346
347static const ppi8255_interface ppi8255_intf =
347static I8255A_INTERFACE( ppi8255_intf )
348348{
349349   DEVCB_NULL,                           /* Port A read */
350350   DEVCB_HANDLER(act_portb_r),               /* Port B read */
r6246r6247
496496
497497//   MDRV_MC6845_ADD("crtc", MC6845, XTAL_3_579545MHz/2, mc6845_intf)   /* hand tuned to get ~50 fps */
498498
499//   MDRV_PPI8255_ADD("ppi8255_0", ppi8255_intf )
499//   MDRV_I8255A_ADD("ppi8255_0", ppi8255_intf )
500500   MDRV_WD2793_ADD("fdc", act_wd2797_interface )
501501
502502   MDRV_GFXDECODE(act_f1)
r6246r6247
525525
526526   MDRV_MC6845_ADD("crtc", MC6845, XTAL_3_579545MHz/2, mc6845_intf)   /* hand tuned to get ~50 fps */
527527
528   MDRV_PPI8255_ADD("ppi8255_0", ppi8255_intf )
528   MDRV_I8255A_ADD("ppi8255_0", ppi8255_intf )
529529   MDRV_WD2793_ADD("fdc", act_wd2797_interface )
530530   MDRV_PIC8259_ADD( "pic8259_master", pic8259_master_config )
531531   MDRV_PIT8253_ADD( "pit8253", pit8253_config )
src/mess/drivers/x1.c
r6246r6247
176176#include "cpu/z80/z80daisy.h"
177177#include "machine/z80ctc.h"
178178#include "machine/z80sio.h"
179#include "machine/8255ppi.h"
179#include "machine/i8255a.h"
180180#include "machine/z80dma.h"
181181#include "sound/ay8910.h"
182182#include "video/mc6845.h"
r6246r6247
12781278   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
12791279   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
12801280   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
1281   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
1281   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return i8255a_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
12821282   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
12831283//   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); }
12841284//   else if(offset >= 0x1f90 && offset <= 0x1f91)   { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); }
r6246r6247
13121312   else if(offset >= 0x1400 && offset <= 0x17ff)   { x1_pcg_w(space, offset-0x1400,data); }
13131313   else if(offset == 0x1800 || offset == 0x1801)   { x1_6845_w(space, offset-0x1800, data); }
13141314   else if(offset >= 0x1900 && offset <= 0x19ff)   { sub_io_w(space, 0,data); }
1315   else if(offset >= 0x1a00 && offset <= 0x1aff)   { ppi8255_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); }
1315   else if(offset >= 0x1a00 && offset <= 0x1aff)   { i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); }
13161316   else if(offset >= 0x1b00 && offset <= 0x1bff)   { ay8910_data_w(devtag_get_device(space->machine, "ay"), 0,data); }
13171317   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); }
13181318   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
r6246r6247
13481348   else if(offset >= 0x0ff8 && offset <= 0x0fff)   { return x1_fdc_r(space, offset-0xff8); }
13491349   else if(offset >= 0x1400 && offset <= 0x17ff)   { return x1_pcg_r(space, offset-0x1400); }
13501350   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
1351   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
1351   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return i8255a_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
13521352   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
13531353   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); }
13541354   else if(offset >= 0x1f90 && offset <= 0x1f91)   { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); }
r6246r6247
13891389   else if(offset >= 0x1400 && offset <= 0x17ff)   { x1_pcg_w(space, offset-0x1400,data); }
13901390   else if(offset == 0x1800 || offset == 0x1801)   { x1_6845_w(space, offset-0x1800, data); }
13911391   else if(offset >= 0x1900 && offset <= 0x19ff)   { sub_io_w(space, 0,data); }
1392   else if(offset >= 0x1a00 && offset <= 0x1aff)   { ppi8255_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); }
1392   else if(offset >= 0x1a00 && offset <= 0x1aff)   { i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3,data); }
13931393   else if(offset >= 0x1b00 && offset <= 0x1bff)   { ay8910_data_w(devtag_get_device(space->machine, "ay"), 0,data); }
13941394   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); }
13951395   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
r6246r6247
15141514   cassette_output(devtag_get_device(device->machine,"cass"),(data & 0x01) ? +1.0 : -1.0);
15151515}
15161516
1517static const ppi8255_interface ppi8255_intf =
1517static I8255A_INTERFACE( ppi8255_intf )
15181518{
15191519   DEVCB_HANDLER(x1_porta_r),                  /* Port A read */
15201520   DEVCB_HANDLER(x1_portb_r),                  /* Port B read */
r6246r6247
21292129
21302130   MDRV_DEVICE_ADD("x1kb", DEVICE_GET_INFO_NAME(x1_keyboard_getinfo), 0)
21312131
2132   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf )
2132   MDRV_I8255A_ADD( "ppi8255_0", ppi8255_intf )
21332133
21342134   MDRV_MACHINE_RESET(x1)
21352135
src/mess/drivers/pc98.c
r6246r6247
225225
226226#include "driver.h"
227227#include "cpu/i386/i386.h"
228#include "machine/8255ppi.h"
228#include "machine/i8255a.h"
229229#include "machine/pit8253.h"
230230#include "machine/8237dma.h"
231231#include "machine/pic8259.h"
r6246r6247
317317      return 0x18; //FIXME: kludge to get over a probable PPI bug.
318318
319319   if(offset & 1)
320      return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset & 6) >> 1);
320      return i8255a_r(devtag_get_device(space->machine, "ppi8255_0"), (offset & 6) >> 1);
321321
322322   logerror("RS-232c R access %02x\n",offset >> 1);
323323   return 0xff;
r6246r6247
327327static WRITE8_HANDLER( sys_port_w )
328328{
329329   if(offset & 1)
330      ppi8255_w(devtag_get_device(space->machine, "ppi8255_0"), (offset & 6) >> 1, data);
330      i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), (offset & 6) >> 1, data);
331331   else
332332      logerror("RS-232c W access %02x %02x\n",offset >> 1,data);
333333}
r6246r6247
335335static READ8_HANDLER( sio_port_r )
336336{
337337   if(!(offset & 1))
338      return ppi8255_r(devtag_get_device(space->machine, "ppi8255_1"), (offset & 6) >> 1);
338      return i8255a_r(devtag_get_device(space->machine, "ppi8255_1"), (offset & 6) >> 1);
339339
340340   logerror("keyboard R access %02x\n",offset >> 1);
341341   return 0xff;
r6246r6247
345345static WRITE8_HANDLER( sio_port_w )
346346{
347347   if(!(offset & 1))
348      ppi8255_w(devtag_get_device(space->machine, "ppi8255_1"), (offset & 6) >> 1, data);
348      i8255a_w(devtag_get_device(space->machine, "ppi8255_1"), (offset & 6) >> 1, data);
349349   else
350350      logerror("keyboard W access %02x %02x\n",offset >> 1,data);
351351}
r6246r6247
780780   //printf("PPI Port C write %02x\n",data);
781781}
782782
783static const ppi8255_interface ppi8255_intf =
783static I8255A_INTERFACE( ppi8255_intf )
784784{
785785   DEVCB_HANDLER(pc98_porta_r),               /* Port A read */
786786   DEVCB_HANDLER(pc98_portb_r),               /* Port B read */
r6246r6247
810810}
811811
812812
813static const ppi8255_interface printer_intf =
813static I8255A_INTERFACE( printer_intf )
814814{
815815   DEVCB_HANDLER(printer_porta_r),               /* Port A read */
816816   DEVCB_HANDLER(printer_portb_r),               /* Port B read */
r6246r6247
950950
951951   MDRV_MACHINE_RESET(pc9801)
952952
953   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf )
954   MDRV_PPI8255_ADD( "ppi8255_1", printer_intf )
953   MDRV_I8255A_ADD( "ppi8255_0", ppi8255_intf )
954   MDRV_I8255A_ADD( "ppi8255_1", printer_intf )
955955   MDRV_PIT8253_ADD( "pit8253", pit8253_config )
956956   MDRV_DMA8237_ADD( "dma8237_1", dma8237_1_config )
957957   MDRV_PIC8259_ADD( "pic8259_master", pic8259_master_config )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team