mirror of
https://github.com/satoshinm/pill_6502.git
synced 2024-06-14 06:29:29 +00:00
Disable local echo, add ^E to toggle
This commit is contained in:
parent
a6f3f87b97
commit
56f6172eea
12
src/cdcacm.c
12
src/cdcacm.c
|
@ -192,6 +192,8 @@ void cdcacm_send_chunked_blocking(char *buf, int len, usbd_device *dev) {
|
||||||
extern char *process_serial_command(char b);
|
extern char *process_serial_command(char b);
|
||||||
extern void *process_serial_input_byte(char b);
|
extern void *process_serial_input_byte(char b);
|
||||||
|
|
||||||
|
bool local_echo = false;
|
||||||
|
|
||||||
static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
|
static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
|
||||||
{
|
{
|
||||||
(void)ep;
|
(void)ep;
|
||||||
|
@ -207,10 +209,12 @@ static void usbuart_usb_out_cb(usbd_device *dev, uint8_t ep)
|
||||||
for(int i = 0; i < len; i++) {
|
for(int i = 0; i < len; i++) {
|
||||||
gpio_toggle(GPIOC, GPIO13);
|
gpio_toggle(GPIOC, GPIO13);
|
||||||
|
|
||||||
// Echo back what was typed
|
// If enabled, echo back what was typed
|
||||||
// Enter sends a CR, but an LF is needed to advance to next line
|
if (local_echo) {
|
||||||
if (buf[i] == '\r') reply_buf[j++] = '\n';
|
// Enter sends a CR, but an LF is needed to advance to next line
|
||||||
reply_buf[j++] = buf[i];
|
if (buf[i] == '\r') reply_buf[j++] = '\n';
|
||||||
|
reply_buf[j++] = buf[i];
|
||||||
|
}
|
||||||
|
|
||||||
char *response = process_serial_command(buf[i]);
|
char *response = process_serial_command(buf[i]);
|
||||||
if (response) {
|
if (response) {
|
||||||
|
|
10
src/main.c
10
src/main.c
|
@ -103,6 +103,7 @@ static void usb_reset()
|
||||||
paused = false;
|
paused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool local_echo;
|
||||||
char *process_serial_command(char b) {
|
char *process_serial_command(char b) {
|
||||||
if (b == '\x16') { // ^V
|
if (b == '\x16') { // ^V
|
||||||
return "Pill 6502 version " FIRMWARE_VERSION;
|
return "Pill 6502 version " FIRMWARE_VERSION;
|
||||||
|
@ -113,12 +114,15 @@ char *process_serial_command(char b) {
|
||||||
reset6502();
|
reset6502();
|
||||||
paused = false;
|
paused = false;
|
||||||
return "reset";
|
return "reset";
|
||||||
} else if (b == '\x14') { // T
|
} else if (b == '\x05') { // ^E
|
||||||
|
local_echo = !local_echo;
|
||||||
|
return local_echo ? "local echo enabled" : "local echo disabled";
|
||||||
|
} else if (b == '\x14') { // ^T
|
||||||
static char buf[64];
|
static char buf[64];
|
||||||
snprintf(buf, sizeof(buf), "%ld ticks\r\n%ld instructions", clockticks6502, instructions);
|
snprintf(buf, sizeof(buf), "%ld ticks\r\n%ld instructions", clockticks6502, instructions);
|
||||||
return buf;
|
return buf;
|
||||||
} else if (b == '\x07') { // G
|
} else if (b == '\x07') { // ^G
|
||||||
return "^V=version ^R=reset ^P=pause ^T=ticks ^G=help";
|
return "^V=version ^R=reset ^E=echo ^P=pause ^T=ticks ^G=help";
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user