Previous 199869 Revisions Next

r26157 Thursday 14th November, 2013 at 10:14:32 UTC by Jürgen Buchmüller
Verify JK-FFs with Salto again. Move local statid wddone0 to m_dsk.
[/branches/alto2/src/emu/cpu/alto2]a2disk.c alto2.h
[/branches/alto2/src/mess/drivers]alto2.c

branches/alto2/src/emu/cpu/alto2/a2disk.c
r26156r26157
134134               s1 = (s1 & ~JKFF_Q) | JKFF_Q0;
135135            else
136136               s1 = (s1 | JKFF_Q) & ~JKFF_Q0;
137            LOG((LOG_DISK,5,"%s J:0 K':1 flip-flop Q:%d\n",
138               jkff_name, (s1 & JKFF_Q) ? 1 : 0));
137            LOG((LOG_DISK,5,"%s J:0 K':1 flip-flop Q:%d\n", jkff_name, (s1 & JKFF_Q) ? 1 : 0));
139138            break;
140139         case JKFF_K:
141140            if ((s0 ^ s1) & JKFF_Q) {
142               LOG((LOG_DISK,5,"%s J:0 K':1 keep Q:%d\n",
143                  jkff_name, (s1 & JKFF_Q) ? 1 : 0));
141               LOG((LOG_DISK,5,"%s J:0 K':1 keep Q:%d\n", jkff_name, (s1 & JKFF_Q) ? 1 : 0));
144142            }
145143            /* J is 0, and K' is 1: keep Q as is */
146144            if (s0 & JKFF_Q)
r26156r26157
152150            /* both J and K' are 1: set Q to 1 */
153151            s1 = (s1 | JKFF_Q) & ~JKFF_Q0;
154152            if (!(s0 & JKFF_Q)) {
155               LOG((LOG_DISK,5,"%s J:1 K':1 → Q:1\n",
156               jkff_name));
153               LOG((LOG_DISK,5,"%s J:1 K':1 → Q:1\n", jkff_name));
157154            }
158155            break;
159156         }
r26156r26157
10471044 */
10481045void alto2_cpu_device::kwd_timing(int bitclk, int datin, int block)
10491046{
1050   static int wddone0;
1051   int wddone1 = wddone0;
1047   int wddone = m_dsk.wddone;
10521048   int i;
10531049   UINT8 s0, s1;
10541050
r26156r26157
10781074          */
10791075         LOG((LOG_DISK,3,"   HIORDBIT:1 sets WFFO:1\n"));
10801076         PUT_KCOM_WFFO(m_dsk.kcom, 1);
1077         // TODO: show disk indicators
10811078      }
10821079      /*
10831080       * Falling edge of BITCLK, counting continues as it was preset
r26156r26157
11031100         LOG((LOG_DISK,3,"   WFFO:0 load bitcount:%2d\n", m_dsk.bitcount));
11041101      }
11051102   } else if (!m_dsk.bitclk && bitclk) {
1106      /* clock the shift register on the rising edge of bitclk */
1103      // clock the shift register on the rising edge of bitclk
11071104      m_dsk.shiftin = (m_dsk.shiftin << 1) | datin;
1108      /* and the output shift register, too */
1105      // and the output shift register too
11091106      m_dsk.shiftout = m_dsk.shiftout << 1;
11101107   }
11111108
1112   if (wddone0 != wddone1) {
1113      LOG((LOG_DISK,2,"   WDDONE':%d→%d\n", wddone0, wddone1));
1109   if (m_dsk.wddone != wddone) {
1110      LOG((LOG_DISK,2,"   WDDONE':%d→%d\n", m_dsk.wddone, wddone));
11141111   }
11151112
11161113   if (m_dsk.carry) {
11171114      /* CARRY = 1 -> WDDONE' = 0 */
1118      wddone1 = 0;
1119      if (wddone0 == 0) {
1115      wddone = 0;
1116      if (wddone == 0) {
11201117         /*
11211118          * Latch a new data word while WDDONE is 0
11221119          * Note: The shifter outputs for bits 0 to 14 are connected
r26156r26157
11311128      }
11321129   } else {
11331130      /* CARRY = 0 -> WDDONE' = 1 */
1134      wddone1 = 1;
1131      wddone = 1;
11351132   }
11361133
11371134   /* remember previous state of wddone */
1138   wddone0 = wddone1;
1135   m_dsk.wddone = wddone;
11391136
11401137   /**
11411138    * JK flip-flop 43b (word task)
r26156r26157
11501147    */
11511148   DEBUG_NAME("\t\t43b KWD   ");
11521149   s0 = m_dsk.ff_43b;
1153   s1 = wddone1 ? JKFF_CLK : 0;
1150   s1 = wddone ? JKFF_CLK : 0;
11541151   s1 |= JKFF_J;
11551152   s1 |= JKFF_K;
11561153   if (m_dsk.ok_to_run)
r26156r26157
11591156      s1 |= JKFF_C;
11601157   m_dsk.ff_43b = update_jkff(s0, s1);
11611158
1162   /* count for the 4 stages of sysclka and sysclkb transitions */
1159   // loop over the 4 stages of sysclka and sysclkb transitions
11631160   for (i = 0; i < 4; i++) {
11641161
11651162      if (m_sysclka0[i] != m_sysclka1[i]) {
r26156r26157
12501247      DEBUG_NAME("\t\t45a RDYLAT");
12511248      s0 = m_dsk.ff_45a;
12521249      s1 = m_sysclka1[i] ? JKFF_CLK : JKFF_0;
1253      if (0 == dhd->get_ready_0())
1250      if (dhd->get_ready_0())
12541251         s1 |= JKFF_J;
12551252      s1 |= JKFF_K;
12561253      s1 |= JKFF_S;
r26156r26157
13411338         s1 |= JKFF_J;
13421339      s1 |= JKFF_K;
13431340      s1 |= JKFF_S;
1344      if (!(m_dsk.ff_22b & JKFF_Q))
1341      if (m_dsk.ff_22b & JKFF_Q0)
13451342         s1 |= JKFF_C;
13461343      m_dsk.ff_21b = update_jkff(s0, s1);
13471344   }
13481345
1349   /* The 53b FF Q output is the WDINIT signal. */
1346   // The 53b FF Q output is the WDINIT signal.
13501347   if (WDINIT != m_dsk.wdinit) {
13511348      m_dsk.wdinit0 = m_dsk.wdinit;
1352      /* rising edge immediately */
1349      // rising edge immediately
13531350      if ((m_dsk.wdinit = WDINIT) == 1)
13541351         m_dsk.wdinit0 = 1;
13551352      LOG((LOG_DISK,2,"   WDINIT:%d\n", m_dsk.wdinit));
r26156r26157
13771374   }
13781375
13791376   if (m_dsk.kfer) {
1380      /* no fatal error: ready and not seqerr and seekok */
1377      // no fatal error: ready AND not seqerr AND seekok
13811378      if (!RDYLAT && !SEQERR && SEEKOK) {
13821379         LOG((LOG_DISK,2,"   reset KFER\n"));
13831380         m_dsk.kfer = 0;
13841381      }
13851382   } else {
1386      /* fatal error: not ready or seqerr or not seekok */
1383      // fatal error: not ready OR seqerr OR not seekok
13871384      if (RDYLAT) {
13881385         LOG((LOG_DISK,2,"   RDYLAT sets KFER\n"));
13891386         m_dsk.kfer = 1;
1390      } else if (SEQERR) {
1387      }
1388      if (SEQERR) {
13911389         LOG((LOG_DISK,2,"   SEQERR sets KFER\n"));
13921390         m_dsk.kfer = 1;
1393      } else if (!SEEKOK) {
1391      }
1392      if (!SEEKOK) {
13941393         LOG((LOG_DISK,2,"   not SEEKOK sets KFER\n"));
13951394         m_dsk.kfer = 1;
13961395      }
13971396   }
13981397
13991398   /*
1400    * The FF 22b Q output is the STSKENA signal,
1401    * the Q' is the WAKEKST' signal.
1399    * The FF 22b Q output is the STSKENA (sector task enable)
1400    * signal, the Q' is the WAKEKST' signal.
14021401    */
14031402   if (m_dsk.ff_22b & JKFF_Q) {
1404      if (!(m_task_wakeup & (1 << task_ksec))) {
1403      if (0 == (m_task_wakeup & (1 << task_ksec))) {
14051404         LOG((LOG_DISK,2,"   STSKENA:1; WAKEST':0 wake KSEC\n"));
14061405         m_task_wakeup |= 1 << task_kwd;
14071406      }
14081407   } else {
1409      if (m_task_wakeup & (1 << task_ksec)) {
1408      if (0 != (m_task_wakeup & (1 << task_ksec))) {
14101409         LOG((LOG_DISK,2,"   STSKENA:0; WAKEST':1\n"));
14111410         m_task_wakeup &= ~(1 << task_kwd);
14121411      }
r26156r26157
14251424    */
14261425   DEBUG_NAME("\t\t21a KSEC  ");
14271426   s0 = m_dsk.ff_21a;
1428   s1 = dhd->get_sector_mark_0() ? JKFF_0 : JKFF_CLK;
1427   s1 = 0 == dhd->get_sector_mark_0() ? JKFF_CLK : JKFF_0;
14291428   if (m_dsk.ff_22b & JKFF_Q0)
14301429      s1 |= JKFF_J;
14311430   s1 |= JKFF_K;
r26156r26157
14401439    * some time.
14411440    */
14421441   if ((m_dsk.ff_21a_old & JKFF_Q0) && (m_dsk.ff_21a & JKFF_Q)) {
1443      if (!m_dsk.seclate_timer)
1444         m_dsk.seclate_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::disk_seclate),this));;
1445      m_dsk.seclate_timer->adjust(attotime::from_nsec(TW_SECLATE), 1, attotime::never);
1442      m_dsk.seclate_timer->adjust(attotime::from_nsec(TW_SECLATE), 1);
14461443      if (m_dsk.seclate) {
14471444         m_dsk.seclate = 0;
14481445         LOG((LOG_DISK,4,"   SECLATE -> 0 pulse until %lldns\n", ntime() + TW_SECLATE));
r26156r26157
14531450    * check if write and erase gate, or read gate are changed
14541451    */
14551452   if ((m_task_wakeup & (1 << task_ksec)) || GET_KCOM_XFEROFF(m_dsk.kcom) || m_dsk.kfer) {
1453      // sector task is active OR xferoff is set OR fatal error
14561454      dhd->set_egate(1);
14571455      dhd->set_wrgate(1);
14581456      dhd->set_rdgate(1);
14591457   } else {
1460      /* enable either read or write gates depending on current record R/W */
1458      // assert either read or write gates depending on current record R/W
14611459      if (m_dsk.krwc & RWC_WRITE) {
1462         /* enable erase and write gates only if OKTORUN is high */
1460         // assert erase and write gates only if OKTORUN is high
14631461         if (m_dsk.ok_to_run) {
14641462            dhd->set_egate(0);
14651463            dhd->set_wrgate(0);
14661464         }
14671465      } else {
1468         /* enable read gate */
1466         // assert read gate
14691467         dhd->set_rdgate(0);
14701468      }
14711469   }
branches/alto2/src/emu/cpu/alto2/alto2.h
r26156r26157
13601360      UINT8 krwc;                  //!< read/write/check for current record
13611361      UINT8 kfer;                  //!< disk fatal error signal state
13621362      UINT8 wdtskena;               //!< disk word task enable (active low)
1363      UINT8 wddone;               //!< previous state of WDDONE
13631364      UINT8 wdinit0;               //!< disk word task init at the early microcycle
13641365      UINT8 wdinit;               //!< disk word task init at the late microcycle
13651366      UINT8 strobe;               //!< strobe (still) active
branches/alto2/src/mess/drivers/alto2.c
r26156r26157
274274   cpu->set_diablo(0, downcast<diablo_hd_device *>(machine().device(DIABLO_HD_0)));
275275   cpu->set_diablo(1, downcast<diablo_hd_device *>(machine().device(DIABLO_HD_1)));
276276
277#define   UNICODE_TESTING   1
277#define   UNICODE_TESTING   0
278278#ifdef   UNICODE_TESTING
279279   const char* filename = "docs/UnicodeData.txt";
280280   int res = unicode_data_load(filename);
r26156r26157
286286         logerror("%s: U+%04x (%s) is digit %u\n", __FUNCTION__, uchar, unicode_name(uchar), unicode_digit(uchar));
287287      if (UNICODE_NOT_NUMERIC != unicode_digit(uchar))
288288         logerror("%s: U+%04x (%s) is numeric %u\n", __FUNCTION__, uchar, unicode_name(uchar), unicode_numeric(uchar));
289      if (uchar != unicode_lcase(uchar))
290         logerror("%s: U+%04x (%s) lower chase is U+%04x (%s)\n", __FUNCTION__, uchar, unicode_name(uchar), unicode_lcase(uchar), unicode_name(unicode_lcase(uchar)));
289291   }
290292   unicode_data_free();
291293#endif

Previous 199869 Revisions Next


© 1997-2024 The MAME Team