branches/alto2/src/emu/cpu/alto2/a2disk.c
| r26126 | r26127 | |
| 1036 | 1036 | UINT8 s0, s1; |
| 1037 | 1037 | |
| 1038 | 1038 | diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 1039 | if (!dhd) { |
| 1040 | // FIXME: set all signals for a not connected drive |
| 1041 | return; |
| 1042 | } |
| 1039 | 1043 | LOG((LOG_DISK,5," >>> KWD timing bitclk:%d datin:%d sect4:%d\n", bitclk, datin, dhd->get_sector_mark_0())); |
| 1040 | 1044 | |
| 1041 | 1045 | if (0 == m_dsk.seclate) { |
| r26126 | r26127 | |
| 1502 | 1506 | int strobe; |
| 1503 | 1507 | |
| 1504 | 1508 | diablo_hd_device* dhd = m_drive[unit]; |
| 1509 | if (!dhd) { |
| 1510 | // FIXME: set all signals for a not connected drive |
| 1511 | return; |
| 1512 | } |
| 1505 | 1513 | LOG((LOG_DISK,2," STROBE #%d restore:%d cylinder:%d\n", unit, restore, cylinder)); |
| 1506 | 1514 | |
| 1507 | 1515 | /* This is really monoflop 52a generating a very short 0 pulse */ |
| r26126 | r26127 | |
| 1568 | 1576 | void alto2_cpu_device::disk_ready_mf31a(void* ptr, INT32 arg) |
| 1569 | 1577 | { |
| 1570 | 1578 | diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 1571 | | m_dsk.ready_mf31a = arg & dhd->get_ready_0(); |
| 1579 | if (dhd) |
| 1580 | m_dsk.ready_mf31a = arg & dhd->get_ready_0(); |
| 1581 | else |
| 1582 | m_dsk.ready_mf31a = arg; |
| 1572 | 1583 | /* log the not ready result with level 0, else 2 */ |
| 1573 | 1584 | LOG((LOG_DISK,m_dsk.ready_mf31a ? 0 : 2," ready mf31a:%d\n", m_dsk.ready_mf31a)); |
| 1574 | 1585 | } |
| r26126 | r26127 | |
| 1610 | 1621 | PUT_KSTAT_SEEKFAIL(m_dsk.kstat, m_dsk.seekok ? 0 : 1); |
| 1611 | 1622 | |
| 1612 | 1623 | /* KSTAT[9] latch the drive seek/read/write status */ |
| 1613 | | PUT_KSTAT_SEEK(m_dsk.kstat, dhd->get_seek_read_write_0()); |
| 1624 | PUT_KSTAT_SEEK(m_dsk.kstat, dhd ? dhd->get_seek_read_write_0() : 1); |
| 1614 | 1625 | |
| 1615 | 1626 | /* KSTAT[10] latch the latched (FF 45a at CLRSTAT) ready status */ |
| 1616 | 1627 | PUT_KSTAT_NOTRDY(m_dsk.kstat, m_dsk.ff_45a & JKFF_Q ? 1 : 0); |
| r26126 | r26127 | |
| 1890 | 1901 | DEBUG_NAME(" RDYLAT 45a"); |
| 1891 | 1902 | m_dsk.ff_45a = update_jkff(m_dsk.ff_45a, |
| 1892 | 1903 | (m_dsk.ff_45a & JKFF_CLK) | |
| 1893 | | dhd->get_ready_0() | |
| 1904 | (dhd ? dhd->get_ready_0() : 1) | |
| 1894 | 1905 | JKFF_K | |
| 1895 | 1906 | JKFF_S | |
| 1896 | 1907 | 0); |
| r26126 | r26127 | |
| 1913 | 1924 | JKFF_C); |
| 1914 | 1925 | |
| 1915 | 1926 | /* set or reset monoflop 31a, depending on drive READY' */ |
| 1916 | | m_dsk.ready_mf31a = dhd->get_ready_0(); |
| 1927 | m_dsk.ready_mf31a = dhd ? dhd->get_ready_0() : 1; |
| 1917 | 1928 | |
| 1918 | 1929 | /* start monoflop 31a, which resets ready_mf31a */ |
| 1919 | 1930 | if (!m_dsk.ready_timer) |
| r26126 | r26127 | |
| 1981 | 1992 | PUT_KADDR_HEAD(m_dsk.kaddr, head); |
| 1982 | 1993 | /* get the selected head, and select drive unit and head */ |
| 1983 | 1994 | diablo_hd_device* dhd = m_drive[unit]; |
| 1984 | | dhd->select(unit, head); |
| 1995 | if (dhd) |
| 1996 | dhd->select(unit, head); |
| 1985 | 1997 | |
| 1986 | 1998 | /* On KDAR<- bit 0 of parts #36 and #37 is reset to 0, i.e. recno = 0 */ |
| 1987 | 1999 | m_dsk.krecno = 0; |
| r26126 | r26127 | |
| 2109 | 2121 | void alto2_cpu_device::f2_swrnrdy_1() |
| 2110 | 2122 | { |
| 2111 | 2123 | diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 2112 | | UINT16 r = dhd->get_seek_read_write_0(); |
| 2124 | UINT16 r = dhd ? dhd->get_seek_read_write_0() : 1; |
| 2113 | 2125 | UINT16 init = INIT ? 037 : 0; |
| 2114 | 2126 | |
| 2115 | 2127 | LOG((LOG_DISK,1," SWRNRDY; %sbranch (%#o|%#o|%#o)\n", (r | init) ? "" : "no ", m_next2, r, init)); |
| r26126 | r26127 | |
| 2171 | 2183 | { |
| 2172 | 2184 | (void)ptr; |
| 2173 | 2185 | diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 2174 | | int bits = dhd->bits_per_sector(); |
| 2186 | int bits = dhd ? dhd->bits_per_sector() : 0; |
| 2175 | 2187 | int clk = arg & 1; |
| 2176 | 2188 | int bit = 0; |
| 2177 | 2189 | |
| r26126 | r26127 | |
| 2193 | 2205 | /* do anything, if the transfer is off? */ |
| 2194 | 2206 | } else { |
| 2195 | 2207 | LOG((LOG_DISK,7," BITCLK#%d bit:%d (write) @%lldns\n", arg, bit, ntime())); |
| 2196 | | if (clk) |
| 2197 | | dhd->wr_data(arg, bit); |
| 2198 | | else |
| 2199 | | dhd->wr_data(arg, 1); |
| 2208 | if (dhd) { |
| 2209 | if (clk) |
| 2210 | dhd->wr_data(arg, bit); |
| 2211 | else |
| 2212 | dhd->wr_data(arg, 1); |
| 2213 | } |
| 2200 | 2214 | } |
| 2201 | 2215 | } else if (GET_KCOM_BCLKSRC(m_dsk.kcom)) { |
| 2202 | 2216 | /* always select the crystal clock */ |
| 2203 | | bit = dhd->rd_data(arg); |
| 2217 | if (dhd) |
| 2218 | bit = dhd->rd_data(arg); |
| 2204 | 2219 | LOG((LOG_DISK,7," BITCLK#%d bit:%d (read, crystal) @%lldns\n", arg, bit, ntime())); |
| 2205 | 2220 | kwd_timing(clk, bit, 0); |
| 2206 | 2221 | } else { |
| r26126 | r26127 | |
| 2208 | 2223 | if (GET_KCOM_XFEROFF(m_dsk.kcom)) { |
| 2209 | 2224 | bit = 1; |
| 2210 | 2225 | } else { |
| 2211 | | clk = dhd->rd_clock(arg & ~1); |
| 2212 | | bit = dhd->rd_data(arg | 1); |
| 2226 | if (dhd) { |
| 2227 | clk = dhd->rd_clock(arg & ~1); |
| 2228 | bit = dhd->rd_data(arg | 1); |
| 2229 | } |
| 2213 | 2230 | LOG((LOG_DISK,7," BITCLK#%d bit:%d (read, driveclk) @%lldns\n", arg, bit, ntime())); |
| 2214 | 2231 | } |
| 2215 | 2232 | kwd_timing(clk, bit, 0); |
| r26126 | r26127 | |
| 2217 | 2234 | |
| 2218 | 2235 | /* more bits to clock? */ |
| 2219 | 2236 | if (++arg < bits) { |
| 2237 | assert(dhd != NULL); |
| 2220 | 2238 | m_dsk.bitclk_timer->adjust(dhd->bit_time(), arg); |
| 2221 | 2239 | m_dsk.bitclk_timer->enable(); |
| 2222 | 2240 | } |
| r26126 | r26127 | |
| 2236 | 2254 | } |
| 2237 | 2255 | |
| 2238 | 2256 | /* KSTAT[0-3] update the current sector in the kstat field */ |
| 2239 | | PUT_KSTAT_SECTOR(m_dsk.kstat, dhd->get_sector()); |
| 2257 | PUT_KSTAT_SECTOR(m_dsk.kstat, dhd ? dhd->get_sector() : 017); |
| 2240 | 2258 | |
| 2241 | 2259 | /* clear input and output shift registers (?) */ |
| 2242 | 2260 | m_dsk.shiftin = 0; |
| r26126 | r26127 | |
| 2257 | 2275 | */ |
| 2258 | 2276 | void alto2_cpu_device::init_disk() |
| 2259 | 2277 | { |
| 2278 | // diablo_hd_device* dhd; |
| 2279 | // for (int unit = 0; unit < 2; unit++) { |
| 2280 | // dhd = m_drive[unit]; |
| 2281 | // if (!dhd) |
| 2282 | // continue; |
| 2283 | // dhd->sector_callback(&alto2_cpu_device::disk_sector_start); |
| 2284 | // } |
| 2285 | |
| 2260 | 2286 | memset(&m_dsk, 0, sizeof(m_dsk)); |
| 2261 | 2287 | |
| 2262 | 2288 | /** @brief simulate previous sysclka */ |
| r26126 | r26127 | |
| 2297 | 2323 | m_dsk.ok_to_run_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_ok_to_run),this)); |
| 2298 | 2324 | m_dsk.ok_to_run_timer->set_param(1); |
| 2299 | 2325 | m_dsk.ok_to_run_timer->adjust(attotime::from_nsec(15 * ALTO2_UCYCLE), 1); |
| 2300 | | |
| 2301 | | /* install a callback to be called whenever a drive sector starts */ |
| 2302 | | // diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 2303 | | // dhd->sector_callback(&alto2_cpu_device::disk_sector_start); |
| 2304 | 2326 | } |
| 2305 | 2327 | |
branches/alto2/src/emu/cpu/alto2/alto2.c
| r26126 | r26127 | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | //------------------------------------------------- |
| 120 | // driver interface to RAM |
| 121 | //------------------------------------------------- |
| 122 | |
| 123 | UINT16 alto2_cpu_device::read_ram(offs_t offset) |
| 124 | { |
| 125 | return debug_read_mem(offset); |
| 126 | } |
| 127 | |
| 128 | void alto2_cpu_device::write_ram(offs_t offset, UINT16 data) |
| 129 | { |
| 130 | debug_write_mem(offset, data); |
| 131 | } |
| 132 | |
| 133 | //------------------------------------------------- |
| 134 | // driver interface to set diablo_hd_device |
| 135 | //------------------------------------------------- |
| 136 | |
| 137 | void alto2_cpu_device::set_diablo(int unit, diablo_hd_device* ptr) |
| 138 | { |
| 139 | m_drive[unit] = ptr; |
| 140 | } |
| 141 | |
| 142 | |
| 143 | //------------------------------------------------- |
| 120 | 144 | // device_rom_region - device-specific (P)ROMs |
| 121 | 145 | //------------------------------------------------- |
| 122 | 146 | |
| r26126 | r26127 | |
| 229 | 253 | return NULL; |
| 230 | 254 | } |
| 231 | 255 | |
| 232 | | UINT16 alto2_cpu_device::read_ram(offs_t offset) |
| 233 | | { |
| 234 | | return debug_read_mem(offset); |
| 235 | | } |
| 236 | | |
| 237 | | void alto2_cpu_device::write_ram(offs_t offset, UINT16 data) |
| 238 | | { |
| 239 | | debug_write_mem(offset, data); |
| 240 | | } |
| 241 | | |
| 242 | 256 | /** |
| 243 | 257 | * @brief list of microcode PROM loading options |
| 244 | 258 | */ |
branches/alto2/src/mess/includes/alto2.h
| r26126 | r26127 | |
| 9 | 9 | |
| 10 | 10 | #include "emu.h" |
| 11 | 11 | #include "cpu/alto2/alto2.h" |
| 12 | | #include "imagedev/diablo.h" |
| 12 | #include "machine/diablo_hd.h" |
| 13 | 13 | |
| 14 | 14 | class alto2_state : public driver_device |
| 15 | 15 | { |
| r26126 | r26127 | |
| 17 | 17 | alto2_state(const machine_config &mconfig, device_type type, const char *tag) |
| 18 | 18 | : driver_device(mconfig, type, tag), |
| 19 | 19 | m_maincpu(*this, "maincpu"), |
| 20 | | m_diablo0(*this, DIABLO_TAG(0)), |
| 21 | | m_diablo1(*this, DIABLO_TAG(1)), |
| 20 | m_diablo0(*this, DIABLO_HD_0), |
| 21 | m_diablo1(*this, DIABLO_HD_1), |
| 22 | 22 | m_io_row0(*this, "ROW0"), |
| 23 | 23 | m_io_row1(*this, "ROW1"), |
| 24 | 24 | m_io_row2(*this, "ROW2"), |
| r26126 | r26127 | |
| 44 | 44 | |
| 45 | 45 | protected: |
| 46 | 46 | required_device<cpu_device> m_maincpu; |
| 47 | | optional_device<diablo_image_device> m_diablo0; |
| 48 | | optional_device<diablo_image_device> m_diablo1; |
| 47 | optional_device<diablo_hd_device> m_diablo0; // should become required_device() once the devices work right |
| 48 | optional_device<diablo_hd_device> m_diablo1; |
| 49 | 49 | required_ioport m_io_row0; |
| 50 | 50 | required_ioport m_io_row1; |
| 51 | 51 | required_ioport m_io_row2; |