Docs: Add an abandoned interval-timer-based refactor of the main CPU loop to dev notes
This commit is contained in:
parent
c415056194
commit
1baa0ded32
|
|
@ -35,3 +35,18 @@ Ken Shirriff, [The 6502 overflow flag explained mathematically](https://www.righ
|
||||||
- `30 ` - initial value for IP
|
- `30 ` - initial value for IP
|
||||||
- `30-80` - free
|
- `30-80` - free
|
||||||
- `80-FF` - free, can be bank-switched
|
- `80-FF` - free, can be bank-switched
|
||||||
|
|
||||||
|
## Looping using an interval timer
|
||||||
|
|
||||||
|
const loop = setInterval(async () => {
|
||||||
|
step = step + 1;
|
||||||
|
// Temporary limit as a lazy way to halt infinite loops:
|
||||||
|
if (CYCLE_LIMIT && (step > CYCLE_LIMIT)) {
|
||||||
|
console.log('SIMULATION HALTING - reached cycle limit');
|
||||||
|
clearInterval(loop);
|
||||||
|
}
|
||||||
|
if (!CPU.running) clearInterval(loop);
|
||||||
|
if (CPU.IP >= CPU.memory.length) clearInterval(loop);
|
||||||
|
stepCPU();
|
||||||
|
await logCPUState(debug);
|
||||||
|
}, frameRate);
|
||||||
Loading…
Reference in New Issue