1.6 KiB
1.6 KiB
Dev notes — 2023-08-15
Goals for today
-
Review planned changes to simulator
- 'opcodes' and 'operands'
- fix $00 contains $20 bug
-
Review planned changes to the system
- CHP, CFC -> FHP, FTG -- dev note 2023-08-07
- [/] bank-switching flag in 0 page
- added notes below, but decided to leave implementation for another day
- ? 5x5 display
-
[/] Implement any changes necessary for writing a program?
-
[-] Write a program
- [-] LOGO turtle on 5x5?
Overflow flag
Ken Shirriff, The 6502 overflow flag explained mathematically:
A common definition of overflow is
V = C6 xor C7. That is, overflow happens if the carry into bit 7 is different from the carry out.
Bank switching
Planned memory map
00-0F- display (4x4)10-1F- keypad? (details TBD)20- pointer to display memory21- pointer to keypad memory22- pointer to memory bank23-2F- reserved for future use / variable storage30- initial value for IP30-80- free80-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);