Source: http://www.dusko-lolic.from.hr/i8052term/
Updated: 2011-02-06 (YYYY-MM-DD)

Home 


Intel 8052AH-BASIC terminal emulator & editor

This is one piece of software that, although created in 2004, would have been much more useful had it been written ten or fifteen years ago, while 8052AH-BASIC chip was still in it's best. Nevertheless, I did it for fun, it is still very useful if you happen to work (or learn) with BASIC-52 for whatever reason (the whole MCS-51 family is still very much alive) and I reckon it better rots on the internet than in my own archives.

If you are somewhat familiar with BASIC-52, you already know how frustrating and user unfriendly this clever little device can be. It's authors cannot be blaimed, they did their best to fit as much as possible into 8K of available ROM. But we still have to type all the same keywords again and again, and if we make a mistake, all we can do is to retype the whole line all over again. Not any more. That's how this specialised terminal emlator came to be.

Download it here. Make no mistake, it is a BASIC program but you don't upload it to 8052. It is to be executed with QBASIC interpreter under Windows (or even plain old DOS). Yes, it is a terminal emulation for BASIC written in BASIC. Let's see what it can do.

OK, you've chosen your COM port in line 12, perhaps adjusted baud rate in line 14 and started the program with F5 key. Press the space key as usual for baud rate auto detection and admire *MCS-51(tm) BASIC V1.1* prompt.

Start writing your program... Oooops! Made a mistake! The first benefit you will surely notice is that backspace now works!
And save the cursing for some other occasion if you notice a mistake somewhere in the middle of the line. Just invoke the line editor by pressing cursor left key. Move the cursor with left, rightCTRL+left, CTRL+right, HOME, END keys, now they all work as expected. Delete characters with backspace or DEL keys, finish editing with ENTER.

That's not all. All the common keywords can be entered by pressing just alt+first letter key combinations, except where indicated otherwise. Leading and trailing spaces are automatically inserted where needed. Square brackets are automatically converted to round brackets (to save you from pressing the shift key to get brackets), a knack borrowed from QBASIC. And for the lazy ones (aren't we all?), there are F-key accelerators. I hope I haven't spoilt you much.

Keywords

ExpandedShortcut
.AND.alt+7
 NOT( alt+1
.OR. alt+8
.XOR. alt+6
 PH0. alt+0
CALL 
DBY( 
ELSE 
FOR 
GOTO 
GOSUB alt+H
IF 
STEP alt+J
NEXT 
TO alt+O
PORT1 
RETURN 
STOP 
THEN 
UNTIL 
WHILE 
XBY( 

F-key accelerators

Key Function
F5 RUN
F6 CONT
F2 save program from controller to disk
F4 save output to log
Alt+F4 exit terminal
F8 repeat the last line (which can be edited before executing)
F9 repeat the last LIST command, together with its parameters
F10 LIST (enter line/range to list)
F11 upload program to controller (In full speed. The delay is governed by the ">" acknowlegment prompt)
F12 edit a program line (enter the line number)
CTRL+D clears the entire input line (direct BASIC-52 command, but terminal needs to clear it's buffers too)

Comments