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
shell.cpp
- Committer:
- earlz
- Date:
- 2012-09-19
- Revision:
- 3:2bc2b0dce10e
- Parent:
- 2:e2a4c5d17d59
- Child:
- 9:4211d638b2e9
File content as of revision 3:2bc2b0dce10e:
#include "mbedconsole.h" #include "plEarlz.h" LocalFileSystem local("local"); void shell_begin(){ vputs(">>Micro eMBEDded Shell v0.1<<\n"); char *cmd=(char*)malloc(128); bool valid=false; while(1){ vputs("> "); vgetsl(cmd, 128); vputc('\n'); valid=false; if(strlcmp(cmd, "help", 5)==0){ valid=true; vputs("Command list:\n"); vputs("help -- this text \n"); vputs("cls -- clear the screen\n"); }else if(strlcmp(cmd,"cls",4)==0){ valid=true; vga_cls(); vsetcursor(0,0); }else if(strlcmp(cmd,"test", 5)==0){ valid=true; vputs("Opening File...Screen may flicker!\n"); // Drive should be marked as removed wait(5); FILE *fp = fopen("/local/test.txt", "w"); if(!fp) { vputs("File /local/test.txt could not be opened!\n"); exit(1); } wait(5.0); vputs("Writing Data...\n"); fprintf(fp, "Hello World!"); wait(5.0); vputs("Closing File...\n"); fclose(fp); // Drive should be restored. this is the same as just returning from main wait(5); }else if(strlcmp(cmd, "plearlz", 8)==0){ valid=1; pl_shell(); } if(!valid){ vputs("invalid command!\n"); } } }