From f81948b663da0c9ef08e78f95b678370fcb791f1 Mon Sep 17 00:00:00 2001 From: arbee Date: Wed, 13 Apr 2016 21:54:56 -0400 Subject: [PATCH] apple2: updated PC Transporter to use alternate DMAC emulation & fixed V30 clock. [Peter Ferrie, R. Belmont] --- src/devices/bus/a2bus/pc_xporter.cpp | 60 +++++++++++++++------------- src/devices/bus/a2bus/pc_xporter.h | 2 + 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/devices/bus/a2bus/pc_xporter.cpp b/src/devices/bus/a2bus/pc_xporter.cpp index 8ecde20ef91..645157946d0 100644 --- a/src/devices/bus/a2bus/pc_xporter.cpp +++ b/src/devices/bus/a2bus/pc_xporter.cpp @@ -53,31 +53,11 @@ CF31: control/flags: bit 4 = 1 to assert reset on V30, 5 = 1 to assert halt on V30 TODO: - - Code at $70b0-$70c5 waits for the V30 to answer some configuration data. + - Code at $70b0-$70c5 waits for the V30 to answer FPU presence. - What's going on at CF0E/CF0F? - - There's likely A2 ROM at CnXX and C800-CBFF to support the "Slinky" memory - expansion card emulation function inside one of the custom ASICs. Need to - dump this... + - The manual indicates there is no ROM; special drivers installed into ProDOS 8 + provide the RAMdisk and A2-accessing-PC-drives functionality. - The final stages before the software settles into its loop are: - - 20 to C800 at cf30 - 00 to C800 at cf31 - 12 to C800 at cf2b - 21 to C800 at cf25 - 33 to C800 at cf24 - 80 to C800 at cf31 - 20 to C800 at cf30 - loop: - Read $C800 at cf36 - Read $C800 at cf31 - Read $C800 at cf31 - Read $C800 at cf36 - Read $C800 at cf31 - Read $C800 at cf31 - 80 to C800 at cf31 - loop end: (return to loop) - *********************************************************************/ #include "pc_xporter.h" @@ -94,7 +74,6 @@ const device_type A2BUS_PCXPORTER = &device_creator; static ADDRESS_MAP_START( pc_map, AS_PROGRAM, 16, a2bus_pcxporter_device ) ADDRESS_MAP_UNMAP_HIGH - //AM_RANGE(0xf0000, 0xfffff) AM_READ(pc_bios_r) ADDRESS_MAP_END static ADDRESS_MAP_START(pc_io, AS_IO, 16, a2bus_pcxporter_device ) @@ -108,7 +87,7 @@ static ADDRESS_MAP_START(pc_io, AS_IO, 16, a2bus_pcxporter_device ) ADDRESS_MAP_END MACHINE_CONFIG_FRAGMENT( pcxporter ) - MCFG_CPU_ADD("v30", V30, XTAL_14_31818MHz/3) + MCFG_CPU_ADD("v30", V30, XTAL_14_31818MHz/2) // 7.16 MHz as per manual MCFG_CPU_PROGRAM_MAP(pc_map) MCFG_CPU_IO_MAP(pc_io) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) @@ -121,7 +100,7 @@ MACHINE_CONFIG_FRAGMENT( pcxporter ) MCFG_PIT8253_CLK2(XTAL_14_31818MHz/12) /* pio port c pin 4, and speaker polling enough */ MCFG_PIT8253_OUT2_HANDLER(WRITELINE(a2bus_pcxporter_device, pc_pit8253_out2_changed)) - MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL_14_31818MHz/3 ) + MCFG_DEVICE_ADD( "dma8237", PCXPORT_DMAC, XTAL_14_31818MHz/2 ) MCFG_I8237_OUT_HREQ_CB(WRITELINE(a2bus_pcxporter_device, pc_dma_hrq_changed)) MCFG_I8237_OUT_EOP_CB(WRITELINE(a2bus_pcxporter_device, pc_dma8237_out_eop)) MCFG_I8237_IN_MEMR_CB(READ8(a2bus_pcxporter_device, pc_dma_read_byte)) @@ -390,9 +369,36 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN case 0x72c: // CGA 6845 register select m_pcio_space->write_byte(0x3d6, data); + m_6845_reg = data; break; case 0x72d: // CGA 6845 data read/write + // HACK: adjust the 40 column mode the 6502 sets to + // be more within specs. + switch (m_6845_reg) + { + case 0: + if (data == 0x3e) + { + data -= 6; + } + break; + + case 2: + if (data == 0x29) + { + data += 4; + } + break; + + case 3: + if (data == 0x5) + { + data *= 2; + } + break; + } + m_pcio_space->write_byte(0x3d7, data); break; @@ -424,7 +430,7 @@ void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UIN break; default: - printf("%02x to C800 at %x\n", data, offset + 0xc800); +// printf("%02x to C800 at %x\n", data, offset + 0xc800); m_regs[offset] = data; break; } diff --git a/src/devices/bus/a2bus/pc_xporter.h b/src/devices/bus/a2bus/pc_xporter.h index 5fc196d7f6b..e7a347fd8b3 100644 --- a/src/devices/bus/a2bus/pc_xporter.h +++ b/src/devices/bus/a2bus/pc_xporter.h @@ -123,6 +123,8 @@ private: address_space *m_pcmem_space, *m_pcio_space; bool m_reset_during_halt; + UINT8 m_6845_reg; + void pc_select_dma_channel(int channel, bool state); };