A project to implement a console using the Mbed using VGA for video output and a PS/2 keyboard for the input. The eventual goal is to also include tools for managing SD cards, and a semi-self-hosting programming environment.
Dependencies: PS2_MbedConsole fastlib SDFileSystem vga640x480g_mbedconsole lightvm mbed
MbedConsole is a cool little project to have a self-contained computer all on an Mbed. So far it has VGA and PS/2 support and can stand alone without a computer powering it. Next planned features are SD card support and a lightweight programmable VM complete with a file editor and self-hosted assembler.
You can view additional details about it at http://earlz.net/tags/mbedconsole
Diff: textio.cpp
- Revision:
- 11:fede136943a9
- Parent:
- 4:b44c27404035
- Child:
- 12:3ee3062cc11c
--- a/textio.cpp Wed Sep 26 05:22:44 2012 +0000 +++ b/textio.cpp Fri Sep 28 04:03:54 2012 +0000 @@ -71,38 +71,35 @@ char vgetc() { - while(!serial.readable()){ - return serial.getc(); - } - return '!'; //unreachable + char tmp=kbd_GetKey(); + vputc(tmp); + return tmp; } int vgetsl(char *buf, int len) { int pos=0; while(1){ - if(serial.readable()){ - buf[pos]=serial.getc(); - if(buf[pos]=='\r'){ - buf[pos]='\n'; + buf[pos]=kbd_GetKey(); + if(buf[pos]=='\r'){ + buf[pos]='\n'; + } + + vputc(buf[pos]); + if(buf[pos]=='\b'){ + buf[pos]=0; + if(pos>0){ + pos--; + buf[pos--]=0; } - - vputc(buf[pos]); - if(buf[pos]=='\b'){ - buf[pos]=0; - if(pos>0){ - pos--; - buf[pos--]=0; - } - } - if(pos>len-1){ - break; - } - if(buf[pos]=='\n'){ - buf[pos]=0; - return 1; - } - pos++; + } + if(pos>len-1){ + break; } + if(buf[pos]=='\n'){ + buf[pos]=0; + return 1; + } + pos++; } return 0; }