branches/alto2/src/emu/machine/diablo_hd.c
r26369 | r26370 | |
84 | 84 | m_rdgate_0(1), |
85 | 85 | m_cylinders(DIABLO_CYLINDERS), |
86 | 86 | m_pages(DIABLO_PAGES), |
| 87 | m_seekto(0), |
| 88 | m_restore(0), |
87 | 89 | m_cylinder(-1), |
88 | 90 | m_head(-1), |
89 | 91 | m_sector(-1), |
r26369 | r26370 | |
905 | 907 | /** |
906 | 908 | * @brief return the current cylinder of a drive unit |
907 | 909 | * |
| 910 | * This is a convenience function. |
| 911 | * There is no such signal on the BUS. |
| 912 | * |
908 | 913 | * Note: The bus lines are active low |
909 | 914 | * The value on the BUS needs an XOR with DIABLO_CYLINDER_MASK |
910 | 915 | * to resemble the physical line levels. |
r26369 | r26370 | |
919 | 924 | /** |
920 | 925 | * @brief return the current head of a drive unit |
921 | 926 | * |
| 927 | * This is a convenience function. |
| 928 | * There is no such signal on the BUS. |
| 929 | * |
922 | 930 | * Note: The bus lines are active low |
923 | 931 | * The value on the BUS needs an XOR with DIABLO_HEAD_MASK |
924 | 932 | * to resemble the physical line levels. |
r26369 | r26370 | |
951 | 959 | /** |
952 | 960 | * @brief return the current page of a drive unit |
953 | 961 | * |
954 | | * The current page number is derived from the cylinder, head, and sector numbers. |
955 | 962 | * This is a convenience function. |
956 | 963 | * There is no such signal on the BUS. |
957 | 964 | * |
| 965 | * The current page number is derived from the cylinder, |
| 966 | * head, and sector numbers. |
| 967 | * |
958 | 968 | * @return the current page for the drive |
959 | 969 | */ |
960 | 970 | int diablo_hd_device::get_page() const |
r26369 | r26370 | |
963 | 973 | } |
964 | 974 | |
965 | 975 | /** |
966 | | * @brief select a drive unit and head |
| 976 | * @brief select a drive unit |
967 | 977 | * |
| 978 | * Selecting a drive unit updates the ready status |
| 979 | * |
968 | 980 | * @param unit unit number |
969 | | * @param head head number |
970 | 981 | */ |
971 | | void diablo_hd_device::select(int unit, int head) |
| 982 | void diablo_hd_device::select(int unit) |
972 | 983 | { |
973 | | assert(unit == m_unit); |
974 | | /* this drive is selected */ |
975 | | if ((head & DIABLO_HEAD_MASK) != m_head) { |
976 | | m_head = head & DIABLO_HEAD_MASK; |
977 | | LOG_DRIVE((0,"[DHD%u] select unit:%d head:%d\n", m_unit, unit, head)); |
978 | | } |
| 984 | assert(unit == m_unit); // this drive is selected |
979 | 985 | |
980 | 986 | if (m_disk) { |
981 | 987 | m_ready_0 = 0; // it is ready |
r26369 | r26370 | |
994 | 1000 | } |
995 | 1001 | |
996 | 1002 | /** |
| 1003 | * @brief set the selected head |
| 1004 | * @param head head number |
| 1005 | */ |
| 1006 | void diablo_hd_device::set_head(int head) |
| 1007 | { |
| 1008 | if ((head & DIABLO_HEAD_MASK) != m_head) { |
| 1009 | m_head = head & DIABLO_HEAD_MASK; |
| 1010 | LOG_DRIVE((0,"[DHD%u] select head:%d\n", m_unit, m_head)); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | /** |
| 1015 | * @brief set the cylinder number to seek to |
| 1016 | * |
| 1017 | * This defines the cylinder to seek when the |
| 1018 | * STROBE line is pulsed. |
| 1019 | * |
| 1020 | * @param cylinder cylinder number (bus lines CYL[0-9]) |
| 1021 | */ |
| 1022 | void diablo_hd_device::set_cylinder(int cylinder) |
| 1023 | { |
| 1024 | if ((cylinder & DIABLO_CYLINDER_MASK) != m_seekto) { |
| 1025 | m_seekto = cylinder & DIABLO_CYLINDER_MASK; |
| 1026 | LOG_DRIVE((0,"[DHD%u] seek to cylinder:%d\n", m_unit, m_seekto)); |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | /** |
| 1031 | * @brief set the restore line |
| 1032 | * |
| 1033 | * If the restore line is asserted when the |
| 1034 | * STROBE line is pulsed, the drive seeks |
| 1035 | * towards cylinder 0. |
| 1036 | * |
| 1037 | * @param restore state of the restore line |
| 1038 | */ |
| 1039 | void diablo_hd_device::set_restore(int restore) |
| 1040 | { |
| 1041 | if ((restore & 1) != m_restore) { |
| 1042 | m_restore = restore & 1; |
| 1043 | LOG_DRIVE((0,"[DHD%u] restore:%d\n", m_unit, m_restore)); |
| 1044 | } |
| 1045 | } |
| 1046 | |
| 1047 | /** |
997 | 1048 | * @brief strobe a seek operation |
998 | 1049 | * |
999 | | * Seek to the cylinder %cylinder, or restore to cylinder 0. |
| 1050 | * Seek to the specified cylinder m_seekto, |
| 1051 | * or restore to cylinder 0, if m_restore is set. |
1000 | 1052 | * |
1001 | | * @param unit unit number |
1002 | | * @param cylinder cylinder number to seek to |
1003 | | * @param restore true, if the drive should restore to cylinder 0 |
1004 | 1053 | * @param strobe current level of the strobe signal (for edge detection) |
1005 | 1054 | */ |
1006 | | void diablo_hd_device::set_strobe(int cylinder, bool restore, int strobe) |
| 1055 | void diablo_hd_device::set_strobe(int strobe) |
1007 | 1056 | { |
1008 | | int seekto = restore ? 0 : cylinder; |
| 1057 | int seekto = m_restore ? 0 : m_seekto; |
1009 | 1058 | if (strobe) { |
1010 | 1059 | LOG_DRIVE((1,"[DHD%u] STROBE end of interlock\n", m_unit)); |
1011 | 1060 | // deassert the log address interlock |
r26369 | r26370 | |
1318 | 1367 | m_log_addx_interlock_0 = 1; // deassert drive log address interlock |
1319 | 1368 | m_seek_incomplete_0 = 1; // deassert drive seek incomplete |
1320 | 1369 | |
| 1370 | // reset the disk drive's strobe info |
| 1371 | m_seekto = 0; |
| 1372 | m_restore = 0; |
1321 | 1373 | // reset the disk drive's address |
1322 | 1374 | m_cylinder = 0; |
1323 | 1375 | m_head = 0; |
branches/alto2/src/emu/machine/diablo_hd.h
r26369 | r26370 | |
57 | 57 | int get_head() const; |
58 | 58 | int get_sector() const; |
59 | 59 | int get_page() const; |
60 | | void select(int unit, int head); |
61 | | void set_strobe(int cylinder, bool restore, int strobe); |
| 60 | void select(int unit); |
| 61 | void set_head(int head); |
| 62 | void set_cylinder(int cylinder); |
| 63 | void set_restore(int restore); |
| 64 | void set_strobe(int strobe); |
62 | 65 | void set_egate(int gate); |
63 | 66 | void set_wrgate(int gate); |
64 | 67 | void set_rdgate(int gate); |
r26369 | r26370 | |
101 | 104 | int m_rdgate_0; //!< read gate |
102 | 105 | int m_cylinders; //!< total number of cylinders |
103 | 106 | int m_pages; //!< total number of pages |
| 107 | int m_seekto; //!< seek to cylinder number |
| 108 | int m_restore; //!< restore to cylinder 0 flag |
104 | 109 | int m_cylinder; //!< current cylinder number |
105 | 110 | int m_head; //!< current head (track) number on cylinder |
106 | 111 | int m_sector; //!< current sector number in track |
branches/alto2/src/emu/cpu/alto2/a2disk.c
r26369 | r26370 | |
844 | 844 | void alto2_cpu_device::disk_strobon(void* ptr, INT32 arg) |
845 | 845 | { |
846 | 846 | (void)ptr; |
847 | | UINT8 unit = arg % 2; |
848 | | UINT8 restore = (arg / 2) % 2; |
849 | | INT32 cylinder = arg / 4; |
850 | | int seekok; |
851 | | int lai; |
852 | | int strobe; |
| 847 | int unit = arg % 2; |
| 848 | int restore = (arg / 2) % 2; |
| 849 | int cylinder = arg / 4; |
853 | 850 | |
854 | 851 | diablo_hd_device* dhd = m_drive[unit]; |
855 | 852 | LOG((LOG_DISK,2," STROBE #%d restore:%d cylinder:%d dhd:%p\n", unit, restore, cylinder, dhd)); |
856 | 853 | |
857 | | /* This is really monoflop 52a generating a very short 0 pulse */ |
858 | | for (strobe = 0; strobe < 2; strobe++) { |
| 854 | // |
| 855 | dhd->set_cylinder(cylinder); |
| 856 | dhd->set_restore(restore); |
| 857 | // This is really monoflop 52a generating a very short 0 pulse |
| 858 | for (int strobe = 0; strobe < 2; strobe++) { |
859 | 859 | UINT8 s0, s1; |
860 | | /* pulse the strobe signal to the unit */ |
861 | | dhd->set_strobe(cylinder, restore, strobe); |
| 860 | dhd->set_strobe(strobe); // pulse the strobe signal to the unit |
862 | 861 | |
863 | | lai = dhd->get_log_addx_interlock_0(); |
| 862 | int lai = dhd->get_log_addx_interlock_0(); |
864 | 863 | LOG((LOG_DISK,6," LAI':%d\n", lai)); |
865 | 864 | /** |
866 | 865 | * JK flip-flop 44a (LAI' clocked) |
r26369 | r26370 | |
895 | 894 | /* clear the monoflop 52b, i.e. no timer restart */ |
896 | 895 | LOG((LOG_DISK,2," STROBON:%d\n", m_dsk.strobe)); |
897 | 896 | /* update the seekok status: SKINC' && LAI' && Q' of FF 44a */ |
898 | | seekok = dhd->get_seek_incomplete_0(); |
| 897 | int seekok = dhd->get_seek_incomplete_0(); |
899 | 898 | if (seekok != m_dsk.seekok) { |
900 | 899 | m_dsk.seekok = seekok; |
901 | 900 | LOG((LOG_DISK,2," SEEKOK:%d\n", m_dsk.seekok)); |
r26369 | r26370 | |
1310 | 1309 | */ |
1311 | 1310 | void alto2_cpu_device::f1_late_load_kadr() |
1312 | 1311 | { |
1313 | | int unit, head; |
1314 | | |
1315 | 1312 | /* store into the separate fields of KADR */ |
1316 | 1313 | PUT_KADR_SEAL(m_dsk.kadr, GET_KADR_SEAL(m_bus)); |
1317 | 1314 | PUT_KADR_HEADER(m_dsk.kadr, GET_KADR_HEADER(m_bus)); |
r26369 | r26370 | |
1320 | 1317 | PUT_KADR_NOXFER(m_dsk.kadr, GET_KADR_NOXFER(m_bus)); |
1321 | 1318 | PUT_KADR_UNUSED(m_dsk.kadr, GET_KADR_UNUSED(m_bus)); |
1322 | 1319 | |
1323 | | unit = GET_KADDR_DRIVE(m_dsk.kaddr); // get selected drive from DATA[14] output (FF 67a really) |
1324 | | head = GET_KADDR_HEAD(m_dsk.dataout); // latch head from DATA[13] |
1325 | | PUT_KADDR_HEAD(m_dsk.kaddr, head); // store in KADDR |
| 1320 | int unit = GET_KADDR_DRIVE(m_dsk.kaddr); // get selected drive from DATA[14] output (FF 67a really) |
| 1321 | int head = GET_KADDR_HEAD(m_dsk.dataout); // latch head from DATA[13] |
| 1322 | PUT_KADDR_HEAD(m_dsk.kaddr, head); // store in KADDR |
1326 | 1323 | |
1327 | | /* take the selected head and select drive unit and head in the DIABLO HD */ |
| 1324 | // select drive unit |
1328 | 1325 | diablo_hd_device* dhd = m_drive[unit]; |
1329 | | dhd->select(unit, head); |
| 1326 | dhd->select(unit); |
| 1327 | // set selected head |
| 1328 | dhd->set_head(head); |
1330 | 1329 | |
1331 | | /* On KDAR← load bit 0 of parts #36 and #37 is reset to 0, i.e. recno = 0 */ |
| 1330 | // On KDAR← load bit 0 of parts #36 and #37 is reset to 0, i.e. recno = 0 |
1332 | 1331 | m_dsk.krecno = 0; |
1333 | | /* current read/write/check is that for the header */ |
| 1332 | // current read/write/check is that for the header |
1334 | 1333 | m_dsk.krwc = GET_KADR_HEADER(m_dsk.kadr); |
1335 | 1334 | |
1336 | 1335 | LOG((LOG_DISK,1," KADR←; BUS[8-14] #%o\n", m_dsk.kadr)); |