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: plEarlz.cpp
- Revision:
- 9:4211d638b2e9
- Parent:
- 8:f356684767ef
- Child:
- 16:370b9e559f92
--- a/plEarlz.cpp Sat Sep 22 04:14:01 2012 +0000 +++ b/plEarlz.cpp Wed Sep 26 04:12:57 2012 +0000 @@ -188,8 +188,19 @@ pl_push(pl_pop()>0); }else if(word[0]=='$'){ //print string (address on stack + }else if(word[0]=='['){ + //begin quotation + push_opcode(Push); + push_opcode_word(pl_blockpos+3); + push_opcode(Branch); + push_target(pl_blockpos); + push_opcode_word(0); + }else if(word[0] == ']'){ + //end quotation + push_opcode(Ret); + write_blockword(last_target->target, pl_blockpos); + pop_target(); } - }else if(strlcmp("if", word, 3)==0){ push_opcode(BranchFalse); push_target(pl_blockpos); @@ -204,6 +215,20 @@ }else if(strlcmp("end", word, 4)==0){ write_blockword(last_target->target,(uint16_t)pl_blockpos); pop_target(); + }else if(strlcmp("tif", word, 4)==0){ + /** + swap value 2 behind stack to front + call.true 1 from stack + call.false top of stack + _label: + **/ + //alloca(10); + push_opcode(Push); + push_opcode_dword(3); + push_opcode(Pick); + push_opcode(BranchFalse); + //push_opcode_word(pl_blockpos+ + }else{ vputs("I don't know the word '"); vputs(word); @@ -251,6 +276,11 @@ word[wordpos]=c; wordpos++; }else if(is_quote(c)){ + push_opcode(LoadStr); + for(;i<len;i++) + { + //char c=line[ + } vputs("This isn't supported yet foo!"); return; }else{ @@ -277,7 +307,7 @@ printheapstats(); vputs("\n"); char *line=(char*)malloc(MAXLINELENGTH); - sprintf(line, "Stack Size: %i; Max Recursion Level %i; Loaded WORDs: %i", MAXSTACK, MAXCALLS, 0); + sprintf(line, "Stack Size: %i; Max Recursion Level %i; Loaded WORDs: %i", MAXSTACK, MAXTEMPSTACK, 0); vputs(line); sprintf(line, "Max line length: %i\n", MAXLINELENGTH); vputs(line);