1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-03-14 16:16:40 +00:00

Update images with more 80 column support and LISP memory improvemets

This commit is contained in:
David Schmenk
2025-04-21 13:21:58 -07:00
parent 22a411c098
commit e2ea8af616
11 changed files with 48 additions and 33 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -565,7 +565,7 @@ def a2viewport(left, top, width, height)
if !width or !height
left = 0
top = 0
width = 40
width = flags & txt80 ?? 80 :: 40
height = 24
fin
^WNDLEFT = left
@@ -781,6 +781,9 @@ def a2textmode(columns)
conio:textctrl = @a2ctrl
columns = 40
fin
^showtext
^showfull
a2viewport(0, 0, 0, 0)
conio:clear(cls)
return columns
end

View File

@@ -135,7 +135,7 @@ def natv_gr(symptr, expr)
if eval_expr(expr=>car)
conio:grmode(TRUE) // Mixed mode
else
conio:textmode(40) // 40 column text
conio:textmode(0) // Text mode
fin
return expr
end

View File

@@ -73,6 +73,12 @@ const ERR_NOT_STR = -12
const ERR_BAD_INDEX = -13
const ERR_BAD_GO = -14
//
// Temp string size
//
const TMPSTR_SIZE = 128
//
// Variables
//
@@ -106,7 +112,6 @@ 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
var prog, prog_expr, prog_return // Current PROG expressions
var tempstr
predef print_expr(expr)#0
predef eval_expr(expr)#1
@@ -1220,14 +1225,15 @@ end
def natv_number(symptr, expr)
var num
char tempstr[TMPSTR_SIZE]
expr = eval_expr(expr=>car)
if not expr; return NULL; fin
when expr->type & TYPE_MASK
is STRING_TYPE // Convert string to number
memcpy(tempstr, expr + stringstr, expr->stringstr + 1)
^(tempstr + ^tempstr + 1) = 0
drop, expr = parse_num(tempstr + 1)
memcpy(@tempstr, expr + stringstr, expr->stringstr + 1)
tempstr[tempstr[0] + 1] = 0
drop, expr = parse_num(@tempstr + 1)
break
is SYM_TYPE
is ARRAY_TYPE
@@ -1491,35 +1497,37 @@ end
//
def natv_string(symptr, expr)
char tempstr[TMPSTR_SIZE]
expr = eval_expr(expr=>car)
if not expr; return NULL; fin
^tempstr = 0
tempstr[0] = 0
when expr->type & TYPE_MASK
is NUM_TYPE
when expr->type
is NUM_INT
i32tos(expr + intval, tempstr)
i32tos(expr + intval, @tempstr)
break
is NUM_FLOAT
ext2str(expr + floatval, tempstr, fmt_fpint, fmt_fpfrac, fmt_fp)
if ^(tempstr + 1) == ' ' // Remove leading space
memcpy (tempstr + 1, tempstr + 2, ^tempstr)
^tempstr--
ext2str(expr + floatval, @tempstr, fmt_fpint, fmt_fpfrac, fmt_fp)
if tempstr[1] == ' ' // Remove leading space
memcpy (@tempstr + 1, @tempstr + 2, tempstr[0])
tempstr[0]--
fin
break
wend
break
is SYM_TYPE
^tempstr = expr->type & SYM_LEN
memcpy(tempstr + 1, expr + name, ^tempstr)
tempstr[0] = expr->type & SYM_LEN
memcpy(@tempstr + 1, expr + name, tempstr[0])
break;
is ARRAY_TYPE
^tempstr = 2
^(tempstr + 1) = '['
^(tempstr + 2) = ']'
tempstr[0] = 2
tempstr[1] = '['
tempstr[2] = ']'
break;
wend
return new_string(tempstr)
return new_string(@tempstr)
end
def natv_stringp(symptr, expr)
@@ -1529,6 +1537,7 @@ end
def natv_subs(symptr, expr)
var stringptr
byte ofst, len
char tempstr[TMPSTR_SIZE]
stringptr = eval_expr(expr=>car)
if stringptr->type <> STRING_TYPE
@@ -1553,27 +1562,28 @@ def natv_subs(symptr, expr)
if ofst + len > stringptr->stringstr
len = stringptr->stringstr - ofst
fin
memcpy(tempstr + 1, stringptr + stringstr + ofst + 1, len)
^tempstr = len
return new_string(tempstr)
memcpy(@tempstr + 1, stringptr + stringstr + ofst + 1, len)
tempstr[0] = len
return new_string(@tempstr)
end
def natv_cats(symptr, expr)
var len, stringptr
char tempstr[TMPSTR_SIZE]
len = 0
while expr
stringptr = eval_expr(expr=>car)
if stringptr->type == STRING_TYPE
if len + stringptr->stringstr < 255
memcpy(tempstr + len + 1, stringptr + stringstr + 1, stringptr->stringstr)
if len + stringptr->stringstr < TMPSTR_SIZE
memcpy(@tempstr + len + 1, stringptr + stringstr + 1, stringptr->stringstr)
len = len + stringptr->stringstr
fin
fin
expr = expr=>cdr
loop
^tempstr = len
return new_string(tempstr)
tempstr[0] = len
return new_string(@tempstr)
end
def natv_lens(symptr, expr)
@@ -1586,16 +1596,18 @@ def natv_lens(symptr, expr)
end
def natv_chars(symptr, expr)
^tempstr = 0
char tempstr[TMPSTR_SIZE]
tempstr[0] = 0
while expr
symptr = eval_expr(expr=>car)
if symptr->type == NUM_INT
^tempstr++
^(tempstr + ^tempstr) = symptr=>intval[0]
tempstr[0]++
tempstr[tempstr[0]] = symptr=>intval[0]
fin
expr = expr=>cdr
loop
return new_string(tempstr)
return new_string(@tempstr)
end
def natv_ascii(symptr, expr)
@@ -1836,6 +1848,5 @@ new_sym("LENS")=>natv = @natv_lens
new_sym("CHARS")=>natv = @natv_chars
new_sym("ASCII")=>natv = @natv_ascii
//new_sym("SYMS")=>natv = @natv_syms
tempstr = heapalloc(256)
return modkeep | modinitkeep
done

View File

@@ -7,7 +7,7 @@ CONIOAPI 6 IFACE PLASMA _TEXTTYPE
: NORMALTEXT 1 $FF _TEXTTYPE DROP ;
: INVERSETEXT 1 $3F _TEXTTYPE DROP ;
: FLASHTEXT 1 $7F _TEXTTYPE DROP ;
CONIOAPI 7 IFACE PLASMA _TEXT : TEXT 40 _TEXT DROP ;
CONIOAPI 7 IFACE PLASMA _TEXT : TEXT 0 _TEXT DROP ;
CONIOAPI 8 IFACE PLASMA _GR : GR 1 _GR DROP ;
CONIOAPI 9 IFACE PLASMA _COLOR : COLOR _COLOR DROP ;
CONIOAPI 10 IFACE PLASMA _PLOT : PLOT _PLOT DROP ;

View File

@@ -1813,8 +1813,9 @@ def _comment_#0
end
def typelist(typestr, typemask, type)#0
word d
byte tab
byte tab, width
width = cmdsys:_sysflags_ & vid80col ?? 79 :: 39
puts(typestr)
tab = ^typestr
d = latest
@@ -1822,7 +1823,7 @@ def typelist(typestr, typemask, type)#0
if ^d // Skip NONAME definitions
if (typemask & ^_ffa_(d)) == type
tab = tab + 1 + ^d
if tab > 39
if tab > width
putln;
tab = ^d
else