Open satoshinm opened 6 years ago
First attempt, this crashes with SIGSEGV:
@@ -202,7 +200,13 @@ int main(void)
reset6502();
- while (1)
+ while (1) {
usbd_poll(usbd_dev);
+
+ if (!paused) {
+ step6502();
+ gpio_toggle(GPIOC, GPIO13);
+ }
+ }
when writing to the ACIA data port, which writes to the USB CDC-ACM - is it not fully initialized yet? The ACIA has a flag we could set/clear when ready to receive written data, but how to know when it is ready?
Enhanced ^T command, currently computes it runs at about 3.5 kHz (starting point before optimization) - as expected from the 1 ms systick timer + cycle count of average instruction:
131658 ticks
37665 instructions
3483 Hz
132244 ticks
37832 instructions
3508 Hz
132325 ticks
37855 instructions
3521 Hz
132405 ticks
37877 instructions
3636 Hz
132479 ticks
37899 instructions
3363 Hz
If i got that right, you're executing triggered by SysTick.
I would suggest let the emulator just run free in main()'s for(;;) {
Maybe an OS (RTOS) could be useful for this job, but also could eat up resources.
Here's how to overclock BluePill and others to 128MHz: https://github.com/spacerace/HY-MiniSTM32V/tree/master/makefile_overclock https://github.com/spacerace/HY-MiniSTM32V/tree/master/keil_overclock
Executing 6502 instructions on systick every 1 ms gives about a 1 / (1 ms) = 1 kHz clock rate; it ought to be possible to improve this, probably by moving off systick and step6502(), instead using exec6502(ticks), but note the USB device also requires periodic attention (currently polled with
while (1) usbd_poll(usbd_dev)
).