mirror of
https://github.com/satoshinm/pill_6502.git
synced 2024-12-28 23:30:30 +00:00
Step the 6502 on each systick, and add 't' command to show ticks/instructions executed
This commit is contained in:
parent
71c0b67f53
commit
ca77b072ab
@ -225,6 +225,8 @@ static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prompt
|
// prompt
|
||||||
|
reply_buf[j++] = '\r';
|
||||||
|
reply_buf[j++] = '\n';
|
||||||
reply_buf[j++] = '>';
|
reply_buf[j++] = '>';
|
||||||
reply_buf[j++] = ' ';
|
reply_buf[j++] = ' ';
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libopencm3/cm3/nvic.h>
|
#include <libopencm3/cm3/nvic.h>
|
||||||
#include <libopencm3/cm3/systick.h>
|
#include <libopencm3/cm3/systick.h>
|
||||||
@ -28,6 +29,7 @@
|
|||||||
#include <libopencm3/usb/hid.h>
|
#include <libopencm3/usb/hid.h>
|
||||||
#include <libopencm3/usb/cdc.h>
|
#include <libopencm3/usb/cdc.h>
|
||||||
|
|
||||||
|
#include "fake6502.h"
|
||||||
#include "cdcacm.h"
|
#include "cdcacm.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@ -82,6 +84,7 @@ static const char *usb_strings[] = {
|
|||||||
|
|
||||||
void sys_tick_handler(void)
|
void sys_tick_handler(void)
|
||||||
{
|
{
|
||||||
|
step6502();
|
||||||
gpio_toggle(GPIOC, GPIO13);
|
gpio_toggle(GPIOC, GPIO13);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +99,10 @@ char *process_serial_command(char *buf, int len) {
|
|||||||
|
|
||||||
if (buf[0] == 'v') {
|
if (buf[0] == 'v') {
|
||||||
return "Pill 6502 version " FIRMWARE_VERSION;
|
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 {
|
} else {
|
||||||
return "invalid command, try ? for help";
|
return "invalid command, try ? for help";
|
||||||
}
|
}
|
||||||
@ -156,6 +163,8 @@ int main(void)
|
|||||||
usbd_control_buffer, sizeof(usbd_control_buffer));
|
usbd_control_buffer, sizeof(usbd_control_buffer));
|
||||||
usbd_register_set_config_callback(usbd_dev, usb_set_config);
|
usbd_register_set_config_callback(usbd_dev, usb_set_config);
|
||||||
|
|
||||||
|
reset6502();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
usbd_poll(usbd_dev);
|
usbd_poll(usbd_dev);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user