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: forth_machine.cpp
- Revision:
- 7:2ac6752d47d2
- Parent:
- 6:a4dff59ef214
- Child:
- 8:f356684767ef
--- a/forth_machine.cpp Fri Sep 21 04:53:45 2012 +0000 +++ b/forth_machine.cpp Sat Sep 22 03:00:55 2012 +0000 @@ -80,18 +80,19 @@ int forth_execute(uint8_t* block, int length) { - int pos=0; + uint16_t pos=0; while(pos<length) { - + serial.getc(); Opcode op=(Opcode)block[pos]; - //printf("opcode: %x\n",(int)op); + printf("opcode: %x\r\n",(int)op); switch(op) { case BranchTrue: if(pl_pop()){ pos++; pos=*((uint16_t*)&block[pos]); + }else{ pos+=3; } @@ -100,8 +101,10 @@ if(!pl_pop()){ pos++; pos=*((uint16_t*)&block[pos]); + serial.printf("branch false %x\r\n",(int)pos); }else{ pos+=3; + serial.printf("branch false skip %x\r\n", (int)pos); } break; case Branch: @@ -143,6 +146,8 @@ ((BuiltinFunction)tmp)(); pos+=4; break; + case Ret: + return; default: