mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-20 10:33:57 +00:00
Add more I/O functions
This commit is contained in:
parent
3b323c76ee
commit
44aab3e3ba
12
doc/DRAWL.md
12
doc/DRAWL.md
@ -36,8 +36,6 @@ The DRAWL implementation comes with the following built-in functions:
|
||||
- T = True
|
||||
- F = False
|
||||
- NIL = NULL
|
||||
- SPACE = SPACE character on output
|
||||
- CR = Carriage Return character on output
|
||||
- CSET() = Set constant value
|
||||
- CSETQ() = Set constant value
|
||||
- DEFINE() = Define function
|
||||
@ -173,6 +171,16 @@ The DRAWL implementation comes with the following built-in functions:
|
||||
- CHARS() = CHARacter String from integer value
|
||||
- ASCII() = ASCII value of first character in string
|
||||
|
||||
### I/O functions
|
||||
|
||||
- HOME()
|
||||
- GOTOXY()
|
||||
- KEYPRESSED()
|
||||
- READKEY()
|
||||
- READ()
|
||||
- READFILE()
|
||||
- READSTRING()
|
||||
|
||||
### Lo-Res Graphics
|
||||
|
||||
- GR() = Turn lo-res graphics mode on/off
|
||||
|
Binary file not shown.
@ -49,7 +49,6 @@ import sexpr
|
||||
|
||||
var exception
|
||||
var hook_eval
|
||||
var assoc_list
|
||||
byte trace
|
||||
|
||||
var fmt_fpint
|
||||
@ -101,11 +100,6 @@ def natv_fpfrac(symptr, expr)
|
||||
return sym_fpfrac
|
||||
end
|
||||
|
||||
def natv_clear(symptr, expr)
|
||||
assoc_list = NULL
|
||||
return NULL
|
||||
end
|
||||
|
||||
def natv_gc(symptr, expr)
|
||||
gc
|
||||
return new_int(heapavail, 0)
|
||||
@ -162,6 +156,28 @@ def natv_printer(symptr, expr)
|
||||
return new_int(slot, 0)
|
||||
end
|
||||
|
||||
def natv_home(symptr, expr)
|
||||
conio:textmode(40) // 40 column text
|
||||
return NULL
|
||||
end
|
||||
|
||||
def natv_gotoxy(symptr, expr)
|
||||
byte x, y
|
||||
|
||||
x = eval_int16(expr)
|
||||
y = eval_int16(expr=>cdr)
|
||||
conio:gotoxy(x, y)
|
||||
return NULL
|
||||
end
|
||||
|
||||
def natv_keypressed(symptr, expr)
|
||||
return bool_pred(conio:keypressed())
|
||||
end
|
||||
|
||||
def natv_readkey(symptr, expr)
|
||||
return new_int(conio:getkey(), 0)
|
||||
end
|
||||
|
||||
def natv_read(symptr, expr)
|
||||
return readfn()
|
||||
end
|
||||
@ -325,14 +341,17 @@ sym_fpint=>natv = @natv_fpint
|
||||
sym_fpfrac=>natv = @natv_fpfrac
|
||||
sym_fpint=>apval = new_int(fmt_fpint, 0) ^ NULL_HACK
|
||||
sym_fpfrac=>apval = new_int(fmt_fpfrac, 0) ^ NULL_HACK
|
||||
new_sym("CLEAR")=>natv = @natv_clear
|
||||
new_sym("QUIT")=>natv = @natv_bye
|
||||
new_sym("GC")=>natv = @natv_gc
|
||||
new_sym("GR")=>natv = @natv_gr
|
||||
new_sym("COLOR")=>natv = @natv_color
|
||||
new_sym("PLOT")=>natv = @natv_plot
|
||||
new_sym("PRINTER")=>natv = @natv_printer
|
||||
new_sym("HOME")=>natv = @natv_home
|
||||
new_sym("GOTOXY")=>natv = @natv_gotoxy
|
||||
new_sym("KEYPRESSED")=>natv = @natv_keypressed
|
||||
new_sym("READ")=>natv = @natv_read
|
||||
new_sym("READKEY")=>natv = @natv_readkey
|
||||
new_sym("READSTRING")=>natv = @natv_readstring
|
||||
new_sym("READFILE")=>natv = @natv_readfile
|
||||
|
||||
|
@ -33,5 +33,6 @@
|
||||
(PLOTSIN)
|
||||
(COLOR 9)
|
||||
(PLOTCOS)
|
||||
; RETURN TO TEXT MODE - UNCOMMENT NEXT LINE
|
||||
; (GR F)
|
||||
"Press a key..."
|
||||
(READKEY)
|
||||
(GR F)
|
||||
|
@ -61,7 +61,7 @@ export var fmt_fpfrac = 4
|
||||
export byte trace = FALSE
|
||||
export var exception = NULL
|
||||
export var hook_eval = NULL // Installable hook for eval_expr()
|
||||
export var assoc_list = NULL // SYM->value association list
|
||||
var assoc_list = NULL // SYM->value association list
|
||||
var cons_list = NULL
|
||||
var cons_free = NULL
|
||||
var int_list = NULL
|
||||
@ -80,7 +80,7 @@ const HASH_MASK = HASH_SIZE-1
|
||||
word hashtbl[HASH_SIZE]
|
||||
|
||||
var sym_nil, sym_true, sym_quote, sym_lambda, sym_funarg, sym_set
|
||||
var sym_macro, sym_cond, sym_if, sym_label, sym_for, sym_space, sym_cr
|
||||
var sym_macro, sym_cond, sym_if, sym_label, sym_for
|
||||
var prog, prog_expr, prog_return // Current PROG expressions
|
||||
var tempstr
|
||||
|
||||
@ -1317,16 +1317,8 @@ def natv_prin(symptr, expr)
|
||||
|
||||
result = NULL
|
||||
while expr
|
||||
if expr=>car == sym_space
|
||||
result = sym_space
|
||||
putc(' ')
|
||||
elsif expr=>car == sym_cr
|
||||
result = sym_cr
|
||||
putln
|
||||
else
|
||||
result = eval_expr(expr=>car)
|
||||
print_expr(result)
|
||||
fin
|
||||
result = eval_expr(expr=>car)
|
||||
print_expr(result)
|
||||
expr = expr=>cdr
|
||||
loop
|
||||
return result
|
||||
@ -1610,8 +1602,6 @@ sym_true = new_sym("*T*")
|
||||
sym_true=>apval = sym_true ^ NULL_HACK
|
||||
new_sym("T")=>apval = sym_true ^ NULL_HACK
|
||||
new_sym("F")=>apval = NULL_HACK
|
||||
sym_space = new_sym("SPACE")
|
||||
sym_cr = new_sym("CR")
|
||||
sym_lambda = new_sym("LAMBDA")
|
||||
sym_funarg = new_sym("FUNARG")
|
||||
sym_macro = new_sym("MACRO")
|
||||
|
Loading…
x
Reference in New Issue
Block a user