From: Neal Andrew Crook Date: Wed, 1 Jun 2016 22:25:57 +0000 (+0100) Subject: Use #define to turn virtual keyboard input on for debugging in the X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6bc59e4ce1c23e51f3db611689cc7cdd759874ea;p=FUZIX.git Use #define to turn virtual keyboard input on for debugging in the emulator. --- diff --git a/Kernel/platform-multicomp09/devtty.c b/Kernel/platform-multicomp09/devtty.c index 1b7d0e5e..73ee51b7 100644 --- a/Kernel/platform-multicomp09/devtty.c +++ b/Kernel/platform-multicomp09/devtty.c @@ -11,6 +11,7 @@ #include #undef DEBUG /* UNdefine to delete debug code sequences */ +#undef MC09_VIRTUAL_IN /* Multicomp has 3 serial ports. Each is a cut-down 6850, with fixed BAUD rate and word size. @@ -28,11 +29,18 @@ static uint8_t *uart[] = { (volatile uint8_t *)0xFFD5, (volatile uint8_t *)0xFFD4, /* UART Data, Status port2, tty3 */ }; - -/* static int icount = 0; */ -/* static int imatch = 100; */ -/* static uint8_t input[] = "ls -al\nXpwd\nXps\nXwho\nX"; */ -/* static int ccount = 0; */ +#ifdef MC09_VIRTUAL_IN +/* Feed characters in to the console - for use in emulation because + my emulator currently does not support non-blocking input and it's + more fun making progress here than fixing the emulator. +*/ +static int icount = 0; +static int imatch = 100; +/* X represents a pause at end-of-line*/ +/* Without pauses, the input streams ahead of the output */ +static uint8_t input[] = "ls -al\nXpwd\nXps\nX\x04root\nXtime ls\nX\nfforth /usr/src/fforth/fforth_tests.fth\nX"; +static int ccount = 0; +#endif #define VSECT __attribute__((section(".video"))) @@ -88,7 +96,6 @@ int my_tty_close(uint8_t minor) /* Output for the system console (kprintf etc) */ -/* [NAC HACK 2016May12] should this use minor number of BOOT_TTY or TTYDEV instead of being hard-wired to 1?? */ void kputchar(char c) { if (c == '\n') @@ -151,26 +158,27 @@ void platform_interrupt(void) .. assuming I eventually get around to enabling serial Rx interrupts this will just get perkier with no additional coding required [NAC HACK 2016May05] enable serial interrupts!! - - **Really** need to get non-blocking input working on the emulator.. */ - c = *(uart[1*2 + 1]); - if (c & 0x01) { tty_inproc(1, *(uart[1*2])); } + +#ifdef MC09_VIRTUAL_IN + icount++; + if (icount == imatch) { + imatch += 200; + if (input[ccount] != 0) { + while (input[ccount] != 'X') { + tty_inproc(minor(TTYDEV), input[ccount++]); + } + ccount++; + } + } +#else + c = *(uart[1*2 + 1]); + if (c & 0x01) { tty_inproc(1, *(uart[1*2])); } /* c = *(uart[2*2 + 1]); if (c & 0x01) { tty_inproc(2, *(uart[2*2])); } c = *(uart[3*2 + 1]); if (c & 0x01) { tty_inproc(3, *(uart[3*2])); } */ - - /* icount++; */ - /* if (icount == imatch) { */ - /* imatch += 200; */ - /* if (input[ccount] != 0) { */ - /* while (input[ccount] != 'X') { */ - /* tty_inproc(minor(TTYDEV), input[ccount++]); */ - /* } */ - /* ccount++; */ - /* } */ - /* } */ +#endif /* [NAC HACK 2016May07] need defines for the timer */ c = *((volatile uint8_t *)0xFFDD);