|
|
@@ -58,6 +58,9 @@ function TimerATick(cia){ |
|
|
|
cia.__CTA = BITM.clear(cia.__CTA, 0); |
|
|
|
} |
|
|
|
|
|
|
|
// Setting the interrupt bit for timer A |
|
|
|
cia.__IC = BITM.set(cia.__IC, 0); |
|
|
|
|
|
|
|
// Check to see if timer modifies the PORT B bit 6. |
|
|
|
// If so, determine if it's a pulse or an toggle. |
|
|
|
if (BITM.isOn(cia.__CTA, 1)) |
|
|
@@ -83,6 +86,8 @@ function TimerBTick(cia){ |
|
|
|
cia.__CTB = BITM.clear(cia.__CTB, 0); |
|
|
|
} |
|
|
|
|
|
|
|
cia.__IC = BITM.set(cia.__IC, 1); |
|
|
|
|
|
|
|
if (BITM.isOn(cia.__CTB, 1)) |
|
|
|
cia.__PDB = (BITM.isOn(cia.__CTB, 2) === 0) ? BITM.set(cia.__PDB, 7) : BITM.toggle(cia.__PDB, 7); |
|
|
|
} |
|
|
@@ -102,7 +107,9 @@ class MOSCIA{ |
|
|
|
|
|
|
|
this.__CTA = 0; |
|
|
|
this.__CTB = 0; |
|
|
|
|
|
|
|
this.__IC = 0; |
|
|
|
this.__ICMask = 0; |
|
|
|
|
|
|
|
this.__timerA = 0; |
|
|
|
this.__timerALatch = 0; |
|
|
@@ -152,7 +159,9 @@ class MOSCIA{ |
|
|
|
case 0x0C: // Serial Data |
|
|
|
break; |
|
|
|
case 0x0D: // Interrupt Control |
|
|
|
break; |
|
|
|
let v = this.__IC; |
|
|
|
this.__IC = 0; |
|
|
|
return v; break; |
|
|
|
case 0x0E: // Control Timer Reg A |
|
|
|
val = this.__CTA; break; |
|
|
|
case 0x0F: // Control Timer Reg B |
|
|
@@ -210,6 +219,17 @@ class MOSCIA{ |
|
|
|
case 0x0C: // Serial Data |
|
|
|
break; |
|
|
|
case 0x0D: // Interrupt Control |
|
|
|
if (BITM.isOn(d & 0xFF, 7)){ |
|
|
|
for (let i=0; i < 5; i++){ |
|
|
|
if (BITM.isOn(d & 0xFF, i)) |
|
|
|
this.__ICMask = BITM.set(this.__ICMask, i); |
|
|
|
} |
|
|
|
} else { |
|
|
|
for (let i=0; i < 5; i++){ |
|
|
|
if (BITM.isOn(d & 0xFF, i)) |
|
|
|
this.__ICMask = BITM.clear(this.__ICMask, i); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case 0x0E: // Control Timer Reg A |
|
|
|
this.__CTA = d & 0xFF; |