1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 10:37:58 +03:00
mal/basic/step0_repl.in.bas
Joel Martin 115e430d02 Basic: QBasic fixes/enabling. Recursive includes.
Enable QBasic console mode usage and fix bugs in newline handling
differences with C64 basic (cbm). To enable console mode for QBasic
programs, have basicpp.py prefix the output with the QB64 specific
console activation variables/functions.

One change to basicpp.py to make this change more straightfowards is
recursive includes so that includes can appear in more than just the
top level step files. This allows us to conditionally include the
right readline implementation. For QBasic in the special console mode
(instead of the default full-screen UI mode) we need to use the LINE
INPUT command in order to read input.
2017-09-14 23:50:15 -05:00

45 lines
570 B
QBasic
Executable File

GOTO MAIN
REM $INCLUDE: 'readline.in.bas'
REM $INCLUDE: 'debug.in.bas'
REM READ(A$) -> R$
MAL_READ:
R$=A$
RETURN
REM EVAL(A$, E) -> R$
EVAL:
R$=A$
RETURN
REM PRINT(A$) -> R$
MAL_PRINT:
R$=A$
RETURN
REM REP(A$) -> R$
REP:
GOSUB MAL_READ
A=R:GOSUB EVAL
A=R:GOSUB MAL_PRINT
RETURN
REM MAIN program
MAIN:
REPL_LOOP:
A$="user> ":GOSUB READLINE: REM call input parser
IF EZ=1 THEN GOTO QUIT
A$=R$:GOSUB REP: REM call REP
PRINT R$
GOTO REPL_LOOP
QUIT:
REM GOSUB PR_MEMORY_SUMMARY_SMALL
#cbm END
#qbasic SYSTEM