Mark Wickens

5 ONERRORGOTO500
10 MODE8:DIM:ERASEa,a$:DIMa(3),a$(1):DEFSEG=0
100 CLS:PRINT" MC[↑]   MR[↓]   M-[←]   M+[→]";
110 LOCATE0,1:PRINTCHR$(5);a(2);:LOCATE16,1:PRINTa(3);:LOCATE0,0:LOCATE0,1
120 a$(0)=INPUT$(1,@):a(0)=ASC(a$(0)):IFa(0)=46 OR(a(0)>47 ANDa(0)<58) THEN200
130 IFa(0)=42 ORa(0)=43 ORa(0)=45 ORa(0)=47 ORa(0)=94 THENa$(0)=STR$(a(2))+a$(0):GOTO200
140 IFa(0)<14 ORa(0)>127 THEN110
150 IFa(0)=40 ORa(0)=41 THEN200
160 IFa(0)>27 ANDa(0)<32 THEN300
200 LOCATE0,0:LOCATE0,1:PRINTCHR$(5);a$(0);
210 a(0)=ASC(INPUT$(1)):a(1)=PEEK(206):IFa(0)>32 ANDa(0)<127 ANDa(1)=0 THENPRINTCHR$(a(0));:GOTO210
220 IFa(0)=8 THENPRINTCHR$(8);:GOTO210
230 IFa(0)=31 ANDa(1)=0 THENGOSUB350:PRINTa$(1);:GOTO210
240 IFa(0)=13 ORa(0)=28 ORa(0)=29 THEN400
250 IFa(0)=30 THENa(3)=0:GOTO210
260 IFa(0)=12 THENa$(0)="":GOTO200
270 IFa(0)=9 ORa(0)=14 ORa(0)=15 THENPRINTCHR$(a(0));
280 GOTO210
300 IFa(0)=28 THENa(3)=a(3)+a(2):GOTO110
310 IFa(0)=29 THENa(3)=a(3)-a(2):GOTO110
320 IFa(0)=30 THENa(3)=0:GOTO110
330 IFa(0)=31 THENGOSUB350:a$(0)=a$(1):GOTO200
350 a$(1)=STR$(a(3)):IFa(3)>=0 THENa$(1)=MID$(a$(1),2)
360 RETURN
400 MODE33(32,1024,223):IFCALC$="" THEN110
405 a(2)=VALF(CALC$):IFa(0)=13 THEN110
410 IFa(0)=28 THENa(3)=a(3)+a(2):GOTO110
420 IFa(0)=29 THENa(3)=a(3)-a(2):GOTO110
500 IFERR=1 THENCLS:ONERRORGOTO0
510 LOCATE0,0:LOCATE0,1:PRINTCHR$(5);" Error";:w$=INPUT$(1,@)
520 IFERL=300 ORERL=310 THENRESUME110
530 LOCATE0,1:PRINTCHR$(5);CALC$;:RESUME210