Docs: Add an abandoned interval-timer-based refactor of the main CPU loop to dev notes
This commit is contained in:
parent
af12704c36
commit
2a7d855b35
|
|
@ -34,4 +34,19 @@ Ken Shirriff, [The 6502 overflow flag explained mathematically](https://www.righ
|
|||
- `23-2F` - reserved for future use / variable storage
|
||||
- `30 ` - initial value for IP
|
||||
- `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