LoginLogin

Simulating DIRECT Mode

Root / Submissions / [.]

HTV04Created:
The following code simulates how DIRECT mode works, including how it parses syntax. It’s obviously not exact, especially because the simulator uses Slot 3 to run code.
'DIRECT Mode Simulator
'By HTV04
PRGEDIT 3
PRGDEL -1

PROJECT OUT PRJN$

WHILE 1
 IF PRJN$=="" THEN
  PRINT "OK"
 ELSE
  PRINT "["+PRJN$+"]OK"
 ENDIF
 LINPUT "";E$
 IF LEFT$(E$,5)=="NEW 1" THEN
  PRGEDIT 1
  PRGDEL -1
  PRGEDIT 3
 ELSEIF LEFT$(E$,5)=="NEW 2" THEN
  PRGEDIT 1
  PRGDEL -1
  PRGEDIT 3
 ELSEIF LEFT$(E$,5)=="RUN 1" THEN
  EXEC 1
 ELSEIF LEFT$(E$,5)=="RUN 2" THEN
  EXEC 2
 ELSE
  PRGINS E$
  EXEC 3
  PRGDEL -1
 ENDIF
WEND

but why?