Previous 15994 Revisions Next

r6504 Wednesday 2nd December, 2009 at 16:07:22 UTC by Curt Coder
[P8000] Added FDC emulation.
[src/mess/drivers]p8k.c

src/mess/drivers/p8k.c
r6503r6504
1111    TODO:
1212      * add Z8001 core so that we can handle the 16bit IO Map (Z8000 uses a
1313        8bit IO Map, and hence I commented out the whole map)
14      * add floppy emulation to 8 bit board
1514      * properly implement Z80 daisy chain in 16 bit board
1615
1716****************************************************************************/
r6503r6504
2019#include "cpu/z80/z80.h"
2120#include "cpu/z8000/z8000.h"
2221#include "cpu/z80/z80daisy.h"
22#include "formats/basicdsk.h"
23#include "devices/flopdrv.h"
24#include "machine/upd765.h"
2325#include "machine/z80ctc.h"
2426#include "machine/z80pio.h"
2527#include "machine/z80sio.h"
r6503r6504
7375   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc_0", z80ctc_r, z80ctc_w)
7476   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80pio_0", z80pio_alt_r, z80pio_alt_w)
7577   AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("z80pio_1", z80pio_alt_r, z80pio_alt_w)
76   AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_alt_r, z80pio_alt_w)   // we still need to add the FDC related part of this one
77//  AM_RANGE(0x20, 0x23) // FDC
78   AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_alt_r, z80pio_alt_w)
79   AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("i8272", upd765_data_r, upd765_data_w)
80   AM_RANGE(0x21, 0x21) AM_DEVREAD("i8272", upd765_status_r)
7881   AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("z80sio_0", sio2_r, sio2_w)
7982   AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("z80sio_1", sio2_r, sio2_w)
8083   AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80ctc_1", z80ctc_r, z80ctc_w)
81   AM_RANGE(0x3c, 0x3c) AM_DEVREADWRITE("z80dma", z80dma_r, z80dma_w)   // FDC related
84   AM_RANGE(0x3c, 0x3c) AM_DEVREADWRITE("z80dma", z80dma_r, z80dma_w)
8285ADDRESS_MAP_END
8386
8487static ADDRESS_MAP_START(p8k_16_memmap, ADDRESS_SPACE_PROGRAM, 16)
r6503r6504
206209
207210/* Z80 DMA */
208211
209// still to implement: dma io read/write which handle FDC. also, the interrupt should deal with FDC as well, with p8k_daisy_interrupt as a fallback
212static WRITE_LINE_DEVICE_HANDLER( p8k_dma_irq_w )
213{
214   if (state)
215   {
216      const device_config *i8272 = devtag_get_device(device->machine, "i8272");
217      upd765_tc_w(i8272, state);
218   }
210219
220   p8k_daisy_interrupt(device, state);
221}
222
211223static Z80DMA_INTERFACE( p8k_dma_intf )
212224{
213   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT),
225   DEVCB_LINE(p8k_dma_irq_w),
214226   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0),
215227   DEVCB_NULL,
216228   DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte),
r6503r6504
320332   NULL               /* receive handler */
321333};
322334
323
324335/* Z80 Daisy Chain */
325336
326337static const z80_daisy_chain p8k_daisy_chain[] =
r6503r6504
336347   { NULL }
337348};
338349
350/* Intel 8272 Interface */
339351
352static WRITE_LINE_DEVICE_HANDLER( p8k_i8272_irq_w )
353{
354   const device_config *z80pio = devtag_get_device(device->machine, "z80pio_2");
355   
356   z80pio_p_w(z80pio, 1, (state) ? 0x10 : 0x00);
357}
358
359static UPD765_DMA_REQUEST( p8k_i8272_drq_w )
360{
361   const device_config *z80dma = devtag_get_device(device->machine, "z80dma");
362
363   z80dma_rdy_w(z80dma, state);
364}
365
366static const struct upd765_interface p8k_i8272_intf =
367{
368   DEVCB_LINE(p8k_i8272_irq_w),
369   p8k_i8272_drq_w,
370   NULL,
371   UPD765_RDY_PIN_CONNECTED,
372   { FLOPPY_0, FLOPPY_1, NULL, NULL }
373};
374
375static const floppy_config p8k_floppy_config =
376{
377   DEVCB_NULL,
378   DEVCB_NULL,
379   DEVCB_NULL,
380   DEVCB_NULL,
381   DEVCB_NULL,
382   FLOPPY_DRIVE_DS_80,
383   FLOPPY_OPTIONS_NAME(default),
384   DO_NOT_KEEP_GEOMETRY
385};
386
340387/***************************************************************************
341388
342389    P8000 16bit Peripherals
r6503r6504
443490   NULL               /* receive handler */
444491};
445492
446
447493/* Z80 Daisy Chain */
448494
449495static const z80_daisy_chain p8k_16_daisy_chain[] =
r6503r6504
483529   MDRV_Z80PIO_ADD("z80pio_0", p8k_pio_0_intf)
484530   MDRV_Z80PIO_ADD("z80pio_1", p8k_pio_1_intf)
485531   MDRV_Z80PIO_ADD("z80pio_2", p8k_pio_2_intf)
532   MDRV_UPD765A_ADD("i8272", p8k_i8272_intf)
533   MDRV_FLOPPY_2_DRIVES_ADD(p8k_floppy_config)
486534
487535   /* sound hardware */
488536   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team