|
|
|
|
|
|
|
|
cia.__CTA = BITM.clear(cia.__CTA, 0); |
|
|
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. |
|
|
// Check to see if timer modifies the PORT B bit 6. |
|
|
// If so, determine if it's a pulse or an toggle. |
|
|
// If so, determine if it's a pulse or an toggle. |
|
|
if (BITM.isOn(cia.__CTA, 1)) |
|
|
if (BITM.isOn(cia.__CTA, 1)) |
|
|
|
|
|
|
|
|
cia.__CTB = BITM.clear(cia.__CTB, 0); |
|
|
cia.__CTB = BITM.clear(cia.__CTB, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cia.__IC = BITM.set(cia.__IC, 1); |
|
|
|
|
|
|
|
|
if (BITM.isOn(cia.__CTB, 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); |
|
|
cia.__PDB = (BITM.isOn(cia.__CTB, 2) === 0) ? BITM.set(cia.__PDB, 7) : BITM.toggle(cia.__PDB, 7); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.__CTA = 0; |
|
|
this.__CTA = 0; |
|
|
this.__CTB = 0; |
|
|
this.__CTB = 0; |
|
|
|
|
|
|
|
|
this.__IC = 0; |
|
|
this.__IC = 0; |
|
|
|
|
|
this.__ICMask = 0; |
|
|
|
|
|
|
|
|
this.__timerA = 0; |
|
|
this.__timerA = 0; |
|
|
this.__timerALatch = 0; |
|
|
this.__timerALatch = 0; |
|
|
|
|
|
|
|
|
case 0x0C: // Serial Data |
|
|
case 0x0C: // Serial Data |
|
|
break; |
|
|
break; |
|
|
case 0x0D: // Interrupt Control |
|
|
case 0x0D: // Interrupt Control |
|
|
break; |
|
|
|
|
|
|
|
|
let v = this.__IC; |
|
|
|
|
|
this.__IC = 0; |
|
|
|
|
|
return v; break; |
|
|
case 0x0E: // Control Timer Reg A |
|
|
case 0x0E: // Control Timer Reg A |
|
|
val = this.__CTA; break; |
|
|
val = this.__CTA; break; |
|
|
case 0x0F: // Control Timer Reg B |
|
|
case 0x0F: // Control Timer Reg B |
|
|
|
|
|
|
|
|
case 0x0C: // Serial Data |
|
|
case 0x0C: // Serial Data |
|
|
break; |
|
|
break; |
|
|
case 0x0D: // Interrupt Control |
|
|
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; |
|
|
break; |
|
|
case 0x0E: // Control Timer Reg A |
|
|
case 0x0E: // Control Timer Reg A |
|
|
this.__CTA = d & 0xFF; |
|
|
this.__CTA = d & 0xFF; |