1000 DIM STACK$(100) 2000 OPEN "RAM:PROG.DO" FOR INPUT AS 1 2200 INPUT #1, WORD$ 2300 IF EOF(1) THEN GOTO 5000 2400 IF WORD$ = "emit" THEN GOSUB 30400 2405 GOTO 2200 2500 IF WORD$ = "." THEN GOSUB 30500 2505 GOTO 2200 2600 IF WORD$ = "dup" THEN GOSUB 30700 2605 GOTO 2200 2700 IF WORD$ = "CR" THEN GOSUB 30800 2705 GOTO 2200 2800 IF WORD$ = "drop" THEN GOSUB 30900 2805 GOTO 2200 2900 IF WORD$ = "+" THEN GOSUB 31200 2905 GOTO 2200 3000 IF WORD$ = "-" THEN GOSUB 32200 3005 GOTO 2200 3100 IF WORD$ = "*" THEN GOSUB 33200 3105 GOTO 2200 3200 IF WORD$ = "/" THEN GOSUB 34200 3205 GOTO 2200 3300 REM Everything else gets pushed... 3301 GOSUB 21000 3305 GOTO 2200 5000 CLOSE 1: END 21000 REM push 21010 PTR = PTR + 1 21020 STACK$[PTR] = VALUE$ 21030 RETURN 22000 REM pop 22010 VALUE$ = STACK$[PTR] 22020 PTR = PTR - 1 22030 RETURN 30400 REM emit 30410 VALUE$ = STACK$[PTR] 30420 V = VAL(VALUE$) 30430 PRINT CHR$(V) 30440 RETURN 30500 REM . 30510 GOSUB 22000 30520 PRINT VALUE$ 30530 RETURN 30700 REM dup 30710 VALUE$ = STACK$[PTR] 30720 PTR = PTR + 1 30730 STACK$[PTR] = VALUE$ 30740 PTR = PTR + 1 30750 STACK$[PTR} = VALUE$ 30760 RETURN 30800 REM CR 30810 PRINT CHR$(13) 30820 RETURN 30900 REM drop 30910 GOSUB 22000 30920 RETURN 31200 REM + 31210 GOSUB 22000 31220 RH = VAL(VALUE$) 31230 GOSUB 22000 31240 LH = VAL(VALUE$) 31250 RT = LH + RH 31260 VALUE$ = STR$(RT) 31270 GOSUB 21000 31280 RETURN 32200 REM - 32210 GOSUB 22000 32220 RH = VAL(VALUE$) 32230 GOSUB 22000 32240 LH = VAL(VALUE$) 32250 RT = LH - RH 32260 VALUE$ = STR$(RT) 32270 GOSUB 21000 32280 RETURN 33200 REM * 33210 GOSUB 22000 33220 RH = VAL(VALUE$) 33230 GOSUB 22000 33240 LH = VAL(VALUE$) 33250 RT = LH * RH 33260 VALUE$ = STR$(RT) 33270 GOSUB 21000 33280 RETURN 34200 REM / 34210 GOSUB 22000 34220 RH = VAL(VALUE$) 34230 GOSUB 22000 34240 LH = VAL(VALUE$) 34250 RT = LH / RH 34260 VALUE$ = STR$(RT) 34270 GOSUB 21000 34280 RETURN