diff --git a/src/cdcacm.c b/src/cdcacm.c index 4e441cf..8dbf58a 100644 --- a/src/cdcacm.c +++ b/src/cdcacm.c @@ -225,6 +225,8 @@ static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep) } // prompt + reply_buf[j++] = '\r'; + reply_buf[j++] = '\n'; reply_buf[j++] = '>'; reply_buf[j++] = ' '; } diff --git a/src/main.c b/src/main.c index 1565672..febbf55 100644 --- a/src/main.c +++ b/src/main.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include +#include "fake6502.h" #include "cdcacm.h" #include "version.h" @@ -82,6 +84,7 @@ static const char *usb_strings[] = { void sys_tick_handler(void) { + step6502(); gpio_toggle(GPIOC, GPIO13); } @@ -96,6 +99,10 @@ char *process_serial_command(char *buf, int len) { if (buf[0] == 'v') { return "Pill 6502 version " FIRMWARE_VERSION; + } else if (buf[0] == 't') { + static char buf[64]; + snprintf(buf, sizeof(buf), "%ld ticks\r\n%ld instructions", clockticks6502, instructions); + return buf; } else { return "invalid command, try ? for help"; } @@ -156,6 +163,8 @@ int main(void) usbd_control_buffer, sizeof(usbd_control_buffer)); usbd_register_set_config_callback(usbd_dev, usb_set_config); + reset6502(); + while (1) usbd_poll(usbd_dev); }