Command Interpreter

Description:

One of first tasks is, how can I speak with my 8051?
It's very simple to connect the built-in UART with a terminal. Then you can send commands to the 8051 and read his answer.
To do this, the 8051 must recognize the commands.
The example contains only 3 commands. You can add a big count (the program memory is the only  limitation) of commands. White spaces are not eliminated. Every entry of the command table is tested until the command match. Additional characters are ignored.
Every entry contain a command string (capital letter) followed by a long jump to the program want to be executed. The 1.byte of the LJMP (02) indicate the end of the string.
The table must be ended with a zero length string (contains only a long jump to a program to send a message, that no command recognized), so it matches ever if reached. Watch, that the last zero length entry not be absent !
The 89C2051 execute the LJMP instruction, the 87C751 does not (say the phillips data sheet). In this case change the LJMP to DB 00 followed by AJMP and change the end mark test value (02) to 00 (so a NOP is executed before the AJMP).