@@ -10,7 +10,7 @@ const static QStringList pins = { "_int", "_nmi", "_busrq", "_wait", "_reset" };
1010
1111ClassTrickbox::ClassTrickbox (QObject *parent) : QObject(parent)
1212{
13- static_assert (sizeof (trick) == (2 + 5 * 4 + 4 ), " unexpected trick struct size (packing?)" );
13+ static_assert (sizeof (trick) == (2 + 2 + 4 + 5 * 4 ), " unexpected trick struct size (packing?)" );
1414 m_trick = (trick *)&m_mem[TRICKBOX_START ];
1515 memset (m_mio, 0xFF , sizeof (m_mio));
1616}
@@ -35,19 +35,19 @@ quint8 ClassTrickbox::readMem(quint16 ab)
3535 */
3636void ClassTrickbox::writeMem (quint16 ab, quint8 db)
3737{
38- // Writing to address 0 immediately stops the simulation
39- if (ab == 0 )
40- {
41- qInfo () << " Stopping sim: WR(0)" ;
42- return ::controller.getSimZ80 ().doRunsim (0 );
43- }
4438 if (ab >= m_rom)
4539 m_mem[ab] = db;
4640
4741 // Trickbox control address space
4842 if (m_trickEnabled && (ab >= TRICKBOX_START ) && (ab <= TRICKBOX_END ))
4943 {
50- // We let the value already be written in RAM, which is a backing store for the trickbox
44+ // Writing to the "stop" word immediately stops the simulation
45+ if ((ab & ~1 ) == TRICKBOX_START )
46+ {
47+ qInfo () << " Stopping sim: tb_stop" ;
48+ return ::controller.getSimZ80 ().doRunsim (0 );
49+ }
50+ // We let the value be written in RAM first, which is a backing store for the trickbox
5151 // counters anyways; here we check the validity of cycle values but only on the second
5252 // memory access of each 2-byte word. Likewise, we disable trickbox control in between
5353 // writing the first byte (low value) and the final, second byte (high value).
0 commit comments