branches/alto2/src/emu/cpu/alto2/a2disk.c
| r26228 | r26229 | |
| 913 | 913 | * |
| 914 | 914 | * TW_SECLATE (85960 nsec) |
| 915 | 915 | * TW_SECLATE (46*ALTO2_UCYCLE) |
| 916 | | */ |
| 917 | | #define TW_SECLATE 8596 |
| 916 | * TW_SECLATE 8596 |
| 917 | */ |
| 918 | #define TW_SECLATE 85960 |
| 918 | 919 | |
| 919 | 920 | /** @brief monoflop 52b pulse duration |
| 920 | 921 | * Rt = 20k, Cext = 0.01µF (=10000pF) => 57960ns (~58us) |
| r26228 | r26229 | |
| 1429 | 1430 | m_dsk.seclate_timer->adjust(attotime::from_nsec(TW_SECLATE), 1); |
| 1430 | 1431 | if (m_dsk.seclate) { |
| 1431 | 1432 | m_dsk.seclate = 0; |
| 1432 | | LOG((LOG_DISK,6," SECLATE -> 0 pulse until %lldns\n", ntime() + TW_SECLATE)); |
| 1433 | LOG((LOG_DISK,6," SECLATE -> 0 pulse until cycle %lld\n", cycle() + TW_SECLATE / ALTO2_UCYCLE)); |
| 1433 | 1434 | } |
| 1434 | 1435 | } |
| 1435 | 1436 | |
| r26228 | r26229 | |
| 1491 | 1492 | } |
| 1492 | 1493 | |
| 1493 | 1494 | |
| 1494 | | /** @brief timer callback to take away the SECLATE pulse (monoflop) */ |
| 1495 | /** |
| 1496 | * @brief timer callback to take away the SECLATE pulse (monoflop) |
| 1497 | * @param ptr some unused pointer |
| 1498 | * @param arg contains the seclate value |
| 1499 | */ |
| 1495 | 1500 | void alto2_cpu_device::disk_seclate(void* ptr, INT32 arg) |
| 1496 | 1501 | { |
| 1497 | 1502 | (void)ptr; |
| r26228 | r26229 | |
| 1500 | 1505 | m_dsk.seclate_timer->enable(false); |
| 1501 | 1506 | } |
| 1502 | 1507 | |
| 1503 | | /** @brief timer callback to take away the OK TO RUN pulse (reset) */ |
| 1508 | /** |
| 1509 | * @brief timer callback to take away the OK TO RUN pulse (reset) |
| 1510 | * @param ptr some unused pointer |
| 1511 | * @param arg contains the ok_to_run value |
| 1512 | */ |
| 1504 | 1513 | void alto2_cpu_device::disk_ok_to_run(void* ptr, INT32 arg) |
| 1505 | 1514 | { |
| 1506 | 1515 | (void)ptr; |
| r26228 | r26229 | |
| 1526 | 1535 | * flag 0 (SKINC, active low). If the seek would go beyond the last cylinder, |
| 1527 | 1536 | * the drive deasserts seek_incomplete, but does not assert the addx_acknowledge. |
| 1528 | 1537 | * |
| 1529 | | * @param id timer id |
| 1538 | * @param ptr some unused pointer |
| 1530 | 1539 | * @param arg contains the drive, cylinder, and restore flag |
| 1531 | 1540 | */ |
| 1532 | 1541 | void alto2_cpu_device::disk_strobon(void* ptr, INT32 arg) |
| r26228 | r26229 | |
| 1611 | 1620 | diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 1612 | 1621 | m_dsk.ready_mf31a = arg & dhd->get_ready_0(); |
| 1613 | 1622 | /* log the not ready result with level 0, else 2 */ |
| 1614 | | LOG((LOG_DISK,m_dsk.ready_mf31a ? 0 : 2," ready mf31a:%d\n", m_dsk.ready_mf31a)); |
| 1623 | LOG((LOG_DISK,m_dsk.ready_mf31a ? 0 : 2," mf31a:%d %sready\n", m_dsk.ready_mf31a, m_dsk.ready_mf31a ? "not " : "")); |
| 1615 | 1624 | } |
| 1616 | 1625 | |
| 1617 | 1626 | /** |
| r26228 | r26229 | |
| 2150 | 2159 | void alto2_cpu_device::f2_swrnrdy_1() |
| 2151 | 2160 | { |
| 2152 | 2161 | diablo_hd_device* dhd = m_drive[m_dsk.drive]; |
| 2153 | | // UINT16 r = dhd->get_seek_read_write_0(); |
| 2154 | | UINT16 r = dhd->get_ready_0(); |
| 2162 | UINT16 r = dhd->get_seek_read_write_0(); |
| 2155 | 2163 | UINT16 init = (m_task == task_kwd && m_dsk.wdinit0) ? 037 : 0; |
| 2156 | 2164 | |
| 2157 | 2165 | LOG((LOG_DISK,1," SWRNRDY; %sbranch (%#o|%#o|%#o)\n", (r | init) ? "" : "no ", m_next2, r, init)); |
| r26228 | r26229 | |
| 2382 | 2390 | m_dsk.ready_timer->reset(); |
| 2383 | 2391 | } |
| 2384 | 2392 | |
| 2393 | /** |
| 2394 | * @brief exit disk controller - free all timers |
| 2395 | */ |
| 2396 | void alto2_cpu_device::exit_disk() |
| 2397 | { |
| 2398 | // nothing to do yet |
| 2399 | } |
| 2400 | |
branches/alto2/src/emu/cpu/alto2/alto2.h
| r26228 | r26229 | |
| 215 | 215 | public: |
| 216 | 216 | // construction/destruction |
| 217 | 217 | alto2_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 218 | ~alto2_cpu_device(); |
| 218 | 219 | |
| 219 | 220 | //! driver interface to set diablo_hd_device |
| 220 | 221 | void set_diablo(int unit, diablo_hd_device* ptr); |
| r26228 | r26229 | |
| 1124 | 1125 | #else // ALTO2_UCODE_RAM_PAGES != 3 |
| 1125 | 1126 | void f1_load_srb_1(); //!< f1_load_srb late: load the S register bank from BUS[12-14] |
| 1126 | 1127 | #endif |
| 1127 | | void init_ram(int task); //!< |
| 1128 | void init_ram(int task); //!< called by RAM related tasks |
| 1129 | void exit_ram(); |
| 1128 | 1130 | |
| 1129 | 1131 | // ************************************************ |
| 1130 | 1132 | // memory mapped i/o stuff |
| r26228 | r26229 | |
| 1299 | 1301 | DECLARE_READ16_MEMBER( xbus_r ); //!< read an XBUS address |
| 1300 | 1302 | DECLARE_WRITE16_MEMBER( xbus_w ); //!< write an XBUS address (?) |
| 1301 | 1303 | void init_hw(); //!< initialize miscellaneous hardware |
| 1304 | void exit_hw(); //!< deinitialize miscellaneous hardware |
| 1302 | 1305 | |
| 1303 | 1306 | // ************************************************ |
| 1304 | 1307 | // keyboard stuff |
| r26228 | r26229 | |
| 1309 | 1312 | } m_kbd; |
| 1310 | 1313 | DECLARE_READ16_MEMBER( kbd_ad_r ); //!< read the keyboard matrix |
| 1311 | 1314 | void init_kbd(UINT16 bootkey = 0177777); //!< initialize the keyboard hardware, optinally set the boot key |
| 1315 | void exit_kbd(); //!< deinitialize the keyboard hardware |
| 1312 | 1316 | |
| 1313 | 1317 | // ************************************************ |
| 1314 | 1318 | // mouse stuff |
| r26228 | r26229 | |
| 1373 | 1377 | * </PRE> |
| 1374 | 1378 | */ |
| 1375 | 1379 | UINT8* m_madr_a32; |
| 1380 | |
| 1381 | //! mouse context |
| 1376 | 1382 | struct { |
| 1377 | 1383 | int x; |
| 1378 | 1384 | int y; |
| r26228 | r26229 | |
| 1384 | 1390 | UINT16 mouse_read(); //!< return the mouse motion flags |
| 1385 | 1391 | void mouse_motion(int x, int y); //!< register a mouse motion |
| 1386 | 1392 | void mouse_button(int b); //!< register a mouse button change |
| 1387 | | void mouse_init(); //!< initialize the mouse context to useful values |
| 1393 | void init_mouse(); //!< initialize the mouse context to useful values |
| 1394 | void exit_mouse(); //!< deinitialize the mouse |
| 1388 | 1395 | |
| 1389 | | |
| 1390 | 1396 | // ************************************************ |
| 1391 | 1397 | // disk controller stuff |
| 1392 | 1398 | // ************************************************ |
| r26228 | r26229 | |
| 1481 | 1487 | void f2_swrnrdy_1(); //!< f2_swrnrdy late: branch on the disk ready signal |
| 1482 | 1488 | void f2_nfer_1(); //!< f2_nfer late: branch on the disk fatal error condition |
| 1483 | 1489 | void f2_strobon_1(); //!< f2_strobon late: branch on the seek busy status |
| 1484 | | void init_disk(); //!< initialize the disk context and insert a disk wort timer |
| 1490 | void init_disk(); //!< initialize the disk context |
| 1491 | void exit_disk(); //!< deinitialize the disk context |
| 1485 | 1492 | |
| 1486 | 1493 | // ************************************************ |
| 1487 | 1494 | // display stuff |
| r26228 | r26229 | |
| 1758 | 1765 | * There are 32 states per scanline and 875 scanlines per frame. |
| 1759 | 1766 | * |
| 1760 | 1767 | * @param arg the current m_disp_a63 PROM address |
| 1761 | | * @result returns the next state of the display state machine |
| 1768 | * @return next state of the display state machine |
| 1762 | 1769 | */ |
| 1763 | 1770 | int display_state_machine(int arg); |
| 1764 | 1771 | |
| 1765 | | /** @brief branch on the evenfield flip-flop */ |
| 1772 | //! branch on the evenfield flip-flop |
| 1766 | 1773 | void f2_evenfield_1(void); |
| 1767 | 1774 | |
| 1768 | | /** @brief initialize the display context */ |
| 1769 | | int init_disp(); |
| 1775 | //! initialize the display context |
| 1776 | void init_disp(); |
| 1777 | //! deinitialize the display context |
| 1778 | void exit_disp(); |
| 1770 | 1779 | |
| 1771 | 1780 | // ************************************************ |
| 1772 | 1781 | // memory stuff |
| r26228 | r26229 | |
| 1889 | 1898 | void watch_write(UINT32 addr, UINT32 data); |
| 1890 | 1899 | void watch_read(UINT32 addr, UINT32 data); |
| 1891 | 1900 | #endif |
| 1901 | void init_memory(); //!< initialize the memory system |
| 1902 | void exit_memory(); //!< deinitialize the memory system |
| 1892 | 1903 | |
| 1893 | | //! initialize the memory system |
| 1894 | | void init_memory(); |
| 1895 | | |
| 1896 | 1904 | // ************************************************ |
| 1897 | 1905 | // emulator task |
| 1898 | 1906 | // ************************************************ |
| r26228 | r26229 | |
| 1918 | 1926 | void f2_acsource_0(); //!< f2_acsource early: modify RSELECT with SrcAC = (3 - IR[1-2]) |
| 1919 | 1927 | void f2_acsource_1(); //!< f2_acsource late: branch on arithmetic IR_SH, others PROM ctl2k_u3[IR[1-7]] |
| 1920 | 1928 | void init_emu(int task); //!< 000 initialize emulator task |
| 1929 | void exit_emu(); //!< deinitialize emulator task |
| 1921 | 1930 | |
| 1931 | // ************************************************ |
| 1922 | 1932 | // ksec task |
| 1933 | // ************************************************ |
| 1923 | 1934 | void f1_ksec_block_0(void); |
| 1924 | 1935 | void init_ksec(int task); //!< 004 initialize disk sector task |
| 1936 | void exit_ksec(); |
| 1925 | 1937 | |
| 1926 | 1938 | // ************************************************ |
| 1927 | 1939 | // ethernet task |
| r26228 | r26229 | |
| 2041 | 2053 | void f2_ebfct_1(); //!< f2_ebfct late: Ethernet branch function |
| 2042 | 2054 | void f2_ecbfct_1(); //!< f2_ecbfct late: Ethernet countdown branch function |
| 2043 | 2055 | void f2_eisfct_1(); //!< f2_eisfct late: Ethernet input start function |
| 2044 | | void eth_activate(); //!< called by the CPU when the Ethernet task becomes active |
| 2056 | void activate_eth(); //!< called by the CPU when the Ethernet task becomes active |
| 2045 | 2057 | void init_ether(int task); //!< 007 initialize ethernet task |
| 2058 | void exit_ether(); //!< deinitialize ethernet task |
| 2046 | 2059 | |
| 2060 | // ************************************************ |
| 2047 | 2061 | // memory refresh task |
| 2062 | // ************************************************ |
| 2048 | 2063 | void f1_mrt_block_0(); //!< f1_mrt_block early: block the display word task |
| 2049 | | void mrt_activate(); //!< called by the CPU when MRT becomes active |
| 2064 | void activate_mrt(); //!< called by the CPU when MRT becomes active |
| 2050 | 2065 | void init_mrt(int task); //!< 010 initialize memory refresh task |
| 2066 | void exit_mrt(); //!< deinitialize memory refresh task |
| 2051 | 2067 | |
| 2068 | // ************************************************ |
| 2052 | 2069 | // display word task |
| 2070 | // ************************************************ |
| 2053 | 2071 | void f1_dwt_block_0(); //!< f1_dwt_block early: block the display word task |
| 2054 | 2072 | void f2_dwt_load_ddr_1(); //!< f2_dwt_load_ddr late: load the display data register |
| 2055 | 2073 | void init_dwt(int task); //!< 011 initialize display word task |
| 2074 | void exit_dwt(); //!< deinitialize display word task |
| 2056 | 2075 | |
| 2076 | // ************************************************ |
| 2057 | 2077 | // cursor task |
| 2078 | // ************************************************ |
| 2058 | 2079 | void f1_curt_block_0(); //!< f1_curt_block early: disable the cursor task and set the curt_blocks flag |
| 2059 | 2080 | void f2_load_xpreg_1(); //!< f2_load_xpreg late: load the x position register from BUS[6-15] |
| 2060 | 2081 | void f2_load_csr_1(); //!< f2_load_csr late: load the cursor shift register from BUS[0-15] |
| 2061 | | void curt_activate(); //!< curt_activate: called by the CPU when the cursor task becomes active |
| 2082 | void activate_curt(); //!< curt_activate: called by the CPU when the cursor task becomes active |
| 2062 | 2083 | void init_curt(int task); //!< 012 initialize cursor task |
| 2084 | void exit_curt(); //!< deinitialize cursor task |
| 2063 | 2085 | |
| 2086 | // ************************************************ |
| 2064 | 2087 | // display horizontal task |
| 2088 | // ************************************************ |
| 2065 | 2089 | void f1_dht_block_0(); //!< f1_dht_block early: disable the display word task |
| 2066 | 2090 | void f2_dht_setmode_1(); //!< f2_dht_setmode late: set the next scanline's mode inverse and half clock and branch |
| 2067 | 2091 | void activate_dht(); //!< called by the CPU when the display horizontal task becomes active |
| 2068 | 2092 | void init_dht(int task); //!< 013 initialize display horizontal task |
| 2093 | void exit_dht(); //!< deinitialize display horizontal task |
| 2069 | 2094 | |
| 2095 | // ************************************************ |
| 2070 | 2096 | // display vertical task |
| 2097 | // ************************************************ |
| 2071 | 2098 | void f1_dvt_block_0(); //!< f1_dvt_block early: disable the display word task |
| 2072 | 2099 | void activate_dvt(); //!< called by the CPU when the display vertical task becomes active |
| 2073 | 2100 | void init_dvt(int task); //!< 014 initialize display vertical task |
| 2101 | void exit_dvt(); //!< deinitialize display vertical task |
| 2074 | 2102 | |
| 2103 | // ************************************************ |
| 2075 | 2104 | // parity task |
| 2105 | // ************************************************ |
| 2076 | 2106 | void activate_part(); |
| 2077 | 2107 | void init_part(int task); //!< 015 initialize parity task |
| 2108 | void exit_part(); //!< deinitialize parity task |
| 2078 | 2109 | |
| 2110 | // ************************************************ |
| 2079 | 2111 | // disk word task |
| 2112 | // ************************************************ |
| 2080 | 2113 | void f1_kwd_block_0(void); |
| 2081 | 2114 | void init_kwd(int task); //!< 016 initialize disk word task |
| 2115 | void exit_kwd(); //!< deinitialize disk word task |
| 2082 | 2116 | }; |
| 2083 | 2117 | |
| 2084 | 2118 | extern const device_type ALTO2; |