Previous 15994 Revisions Next

r5661 Wednesday 9th September, 2009 at 19:52:28 UTC by Angelo Salese
[X1]: Basic hook-up for the z80dma (z8410) chip.
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5660r5661
141141#include "machine/z80ctc.h"
142142#include "machine/z80sio.h"
143143#include "machine/8255ppi.h"
144#include "machine/z80dma.h"
144145#include "sound/ay8910.h"
145146#include "video/mc6845.h"
146147#include "sound/2151intf.h"
r5660r5661
957958   scrn_reg.pcg_mode = (data & 0x20)>>5;
958959   scrn_reg.gfx_bank = (data & 0x10)>>4;
959960   scrn_reg.v400_mode = ((data & 0x03) == 3) ? 1 : 0;
960   printf("SCRN = %02x\n",data);
961   if(data & 0xcc)
962      printf("SCRN = %02x\n",data & 0xcc);
961963}
962964
963965static WRITE8_HANDLER( x1_ply_w )
964966{
965967   scrn_reg.ply = data;
966   printf("PLY = %02x\n",data);
968//   printf("PLY = %02x\n",data);
967969}
968970
969971static WRITE8_HANDLER( x1_6845_w )
r5660r5661
987989   }
988990}
989991
990static WRITE8_HANDLER( x1_dma_w )
991{
992   //printf("%02x %02x\n",offset,data);
993   //if(data)
994   //   fatalerror("Data written to the DMA space");
995}
996
997992static READ8_HANDLER( x1_blackclip_r )
998993{
999994   return scrn_reg.blackclip;
r5660r5661
10411036   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
10421037   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
10431038   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
1039   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); }
10441040   else if(offset >= 0x1f90 && offset <= 0x1f91)   { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); }
10451041   else if(offset >= 0x1f92 && offset <= 0x1f93)   { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); }
10461042   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); }
r5660r5661
10771073   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); }
10781074   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
10791075   else if(offset >= 0x1e00 && offset <= 0x1eff)   { rom_bank_0_w(space,0,data); }
1080   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { x1_dma_w(space,offset-0x1f80,data); }
1076   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { z80dma_w(devtag_get_device(space->machine, "dma"), 0,data); }
10811077   else if(offset >= 0x1f90 && offset <= 0x1f91)   { z80sio_c_w(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1,data); }
10821078   else if(offset >= 0x1f92 && offset <= 0x1f93)   { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); }
10831079   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); }
r5660r5661
11091105   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
11101106   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
11111107   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
1108   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { return z80dma_r(devtag_get_device(space->machine, "dma"), 0); }
11121109   else if(offset >= 0x1f90 && offset <= 0x1f91)   { return z80sio_c_r(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1); }
11131110   else if(offset >= 0x1f92 && offset <= 0x1f93)   { return z80sio_d_r(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1); }
11141111   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x1fa0); }
r5660r5661
11461143   else if(offset >= 0x1c00 && offset <= 0x1cff)   { ay8910_address_w(devtag_get_device(space->machine, "ay"), 0,data); }
11471144   else if(offset >= 0x1d00 && offset <= 0x1dff)   { rom_bank_1_w(space,0,data); }
11481145   else if(offset >= 0x1e00 && offset <= 0x1eff)   { rom_bank_0_w(space,0,data); }
1149   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { x1_dma_w(space,offset-0x1f80,data); }
1146   else if(offset >= 0x1f80 && offset <= 0x1f8f)   { z80dma_w(devtag_get_device(space->machine, "dma"), 0,data); }
11501147   else if(offset >= 0x1f90 && offset <= 0x1f91)   { z80sio_c_w(devtag_get_device(space->machine, "sio"), (offset-0x1f90) & 1,data); }
11511148   else if(offset >= 0x1f92 && offset <= 0x1f93)   { z80sio_d_w(devtag_get_device(space->machine, "sio"), (offset-0x1f92) & 1,data); }
11521149   else if(offset >= 0x1fa0 && offset <= 0x1fa3)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa0,data); }
r5660r5661
12891286   NULL      /* update address callback */
12901287};
12911288
1289static READ8_DEVICE_HANDLER(x1_dma_read_byte)
1290{
1291   const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1292   return memory_read_byte(space, offset);
1293}
1294
1295static WRITE8_DEVICE_HANDLER(x1_dma_write_byte)
1296{
1297   const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1298   memory_write_byte(space, offset, data);
1299}
1300
1301static const z80dma_interface x1_dma =
1302{
1303   "maincpu",
1304
1305   x1_dma_read_byte,
1306   x1_dma_write_byte,
1307   0, 0, 0, 0,
1308   NULL
1309};
1310
12921311/*************************************
12931312 *
12941313 *  Inputs
r5660r5661
18331852
18341853   MDRV_Z80CTC_ADD( "ctc", XTAL_4MHz , ctc_intf )
18351854   MDRV_Z80SIO_ADD( "sio", XTAL_4MHz , sio_intf )
1855   MDRV_Z80DMA_ADD( "dma", XTAL_4MHz , x1_dma )
18361856
18371857   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf )
18381858

Previous 15994 Revisions Next


© 1998-2018 The MESS Team