1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-08 07:31:32 +00:00

Simplify stdlib, more efficient memcpy, prepare for libraries

This commit is contained in:
David Schmenk 2014-06-08 20:28:45 -07:00
parent 84e96156a3
commit 42751dbebf
7 changed files with 214 additions and 369 deletions

View File

@ -14,7 +14,7 @@ const CFFAEntryPtr = $0B
;
; Pedefined functions.
;
predef home, gotoxy, viewport, crout, cout, prstr, cin, rdstr
predef crout, cout, prstr, cin, rdstr
predef syscall, call
predef markheap, allocheap, allocalignheap, releaseheap, availheap
predef memset, memcpy
@ -25,14 +25,21 @@ predef loadmod, execmod
;
byte machid = $08 ; Apple 1 (NA in ProDOS Tech Ref)
;
; System variable.
;
word systemflags = 0
word heap
word symtbl, lastsym
byte perr
word cmdptr
;
; Standard Library exported functions.
;
byte stdlibstr[] = "STDLIB"
byte machidstr[] = "MACHID"
byte clsstr[] = "CLS"
byte gotoxystr[] = "GOTOXY"
byte viewstr[] = "VIEWPORT"
byte sysvarstr[] = "SYSVARS"
byte putcstr[] = "PUTC"
byte putlnstr[] = "PUTLN"
byte putsstr[] = "PUTS"
byte getcstr[] = "GETC"
byte getsstr[] = "GETS"
@ -51,15 +58,13 @@ byte uisltstr[] = "ISULT"
byte uislestr[] = "ISULE"
byte loadstr[] = "LOAD"
byte execstr[] = "EXEC"
word exports[] = @clsstr, @home
word = @gotoxystr, @gotoxy
word = @viewstr, @viewport
word exports[] = @sysstr, @syscall
word = @callstr, @call
word = @putcstr, @cout
word = @putlnstr, @crout
word = @putsstr, @prstr
word = @getcstr, @cin
word = @getsstr, @rdstr
word = @sysstr, @syscall
word = @callstr, @call
word = @hpmarkstr, @markheap
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap
@ -73,11 +78,13 @@ word = @uislestr, @uword_isle
word = @loadstr, @loadmod
word = @execstr, @execmod
word = @machidstr, @machid
word = @sysvarstr, @systemflags
word = 0
word stdlibsym = @exports
;
; String pool.
;
byte autorun[] = "AUTORUN"
byte version[] = "\nPLASMA 0.9\n"
byte freestr[] = "MEM FREE:$"
byte errorstr[] = "ERR:$"
@ -86,14 +93,6 @@ byte okstr[] = "OK"
byte huhstr[] = "?\n"
byte hexchar[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
;
; System variable.
;
word systemflags = 0
word heap
word symtbl, lastsym
byte perr
word cmdptr
;
; CALL CFFA1 API ENTRYPOINT
; SYSCALL(CMD)
;
@ -609,12 +608,6 @@ def rdstr(prompt)
cout($0D)
return inbuff
end
def home
end
def gotoxy(x, y)
end
def viewport(left, top, width, height)
end
def prbyte(v)
cout(hexchar[(v >> 4) & $0F])
return cout(hexchar[v & $0F])
@ -758,11 +751,12 @@ def lookupdef(addr, deftbl)
return 0
end
def loadmod(mod)
word refnum, rdlen, modsize, bytecode, defofst, defcnt, init, fixup
word rdlen, modsize, bytecode, defofst, defcnt, init, fixup
word addr, modaddr, modfix, modend
word deftbl, deflast
word moddep, rld, esd, sym
byte str[17], filename[17]
byte header[128]
;
; Read the RELocatable module header (first 128 bytes)
;
@ -773,25 +767,26 @@ def loadmod(mod)
fin
if rdlen > 0
readfile(@filename, heap)
modsize = (heap):0
moddep = heap+1
memcpy(@header, heap, 128)
modsize = header:0
moddep = @header.1
defofst = modsize
init = 0
if rdlen > 4 and (heap):2 == $DA7E ; DAVE = magic number :-)
;
; This is an EXTended RELocatable (data+bytecode) module.
;
defofst = (heap):6
defcnt = (heap):8
init = (heap):10
moddep = heap + 12
defofst = header:6
defcnt = header:8
init = header:10
moddep = @header.12
;
; Load module dependencies.
;
while ^moddep
if !lookupmod(moddep)
if loadmod(moddep) < 0
return perr
return -perr
fin
fin
moddep = moddep + dcitos(moddep, @str)
@ -806,15 +801,11 @@ def loadmod(mod)
; Re-read file
;
readfile(@filename, heap)
moddep = heap + 12
while ^moddep
moddep = moddep + dcitos(moddep, @str)
loop
fin
;
; Alloc heap space for relocated module (data + bytecode).
;
moddep = moddep + 1
moddep = moddep + 1 - @header + heap
modfix = moddep - (heap + 2) ; Adjust to skip header
modsize = modsize - modfix
rdlen = rdlen - modfix - 2
@ -993,17 +984,10 @@ def execmod(modfile)
end
;
; Get heap start
; Get heap start.
;
heap = *freemem
;
; Print some startup info.
;
prstr(@version)
prstr(@freestr)
prword(availheap)
crout
;
; Init symbol table.
;
symtbl = allocheap($200)
@ -1017,6 +1001,18 @@ while *stdlibsym
stdlibsym = stdlibsym + 4
loop
;
; Try to run autorun module.
;
execmod(@autorun)
perr = 0
;
; Print some startup info.
;
prstr(@version)
prstr(@freestr)
prword(availheap)
crout
;
; Handle commands.
;
while 1

View File

@ -16,26 +16,34 @@ const resxhgr2 = $0020
;
; Pedefined functions.
;
predef home, gotoxy, viewport, crout, cout, prstr, cin, rdstr
predef syscall, call
predef crout, cout, prstr, cin, rdstr
predef markheap, allocheap, allocalignheap, releaseheap, availheap
predef memset, memcpy
predef uword_isgt, uword_isge, uword_islt, uword_isle
predef loadmod, execmod
;
; System variable.
;
word systemflags = 0
word heap
word xheap = $0800
word lastsym = symtbl
byte perr
word cmdptr
;
; Standard Library exported functions.
;
byte stdlibstr[] = "STDLIB"
byte machidstr[] = "MACHID"
byte clsstr[] = "CLS"
byte gotoxystr[] = "GOTOXY"
byte viewstr[] = "VIEWPORT"
byte sysvarstr[] = "SYSVARS"
byte sysstr[] = "SYSCALL"
byte callstr[] = "CALL"
byte putcstr[] = "PUTC"
byte putlnstr[] = "PUTLN"
byte putsstr[] = "PUTS"
byte getcstr[] = "GETC"
byte getsstr[] = "GETS"
byte sysstr[] = "SYSCALL"
byte callstr[] = "CALL"
byte hpmarkstr[] = "HEAPMARK"
byte hpalignstr[] = "HEAPALLOCALIGN"
byte hpallocstr[] = "HEAPALLOC"
@ -49,15 +57,13 @@ byte uisltstr[] = "ISULT"
byte uislestr[] = "ISULE"
byte loadstr[] = "LOAD"
byte execstr[] = "EXEC"
word exports[] = @clsstr, @home
word = @gotoxystr, @gotoxy
word = @viewstr, @viewport
word exports[] = @sysstr, @syscall
word = @callstr, @call
word = @putcstr, @cout
word = @putlnstr, @crout
word = @putsstr, @prstr
word = @getcstr, @cin
word = @getsstr, @rdstr
word = @sysstr, @syscall
word = @callstr, @call
word = @hpmarkstr, @markheap
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap
@ -71,11 +77,13 @@ word = @uislestr, @uword_isle
word = @loadstr, @loadmod
word = @execstr, @execmod
word = @machidstr, MACHID
word = @sysvarstr, @systemflags
word = 0
word stdlibsym = @exports
;
; String pool.
;
byte autorun[] = "AUTORUN"
byte version[] = "PLASMA 0.9\n"
byte freestr[] = "MEM FREE:$"
byte errorstr[] = "ERR:$"
@ -83,15 +91,6 @@ byte okstr[] = "OK"
byte huhstr[] = "?\n"
byte prefix[32] = ""
;
; System variable.
;
word heap
word lastsym = symtbl
word xheap = $0800
word systemflags = 0
byte perr
word cmdptr
;
; Utility functions
;
asm equates
@ -128,25 +127,25 @@ PARAMS: !WORD 0000
end
;
; CALL 6502 ROUTINE
; CALL(AREG, XREG, YREG, STATUS, ADDR)
; CALL(ADDR, AREG, XREG, YREG, STATUS)
;
asm call
REGVALS = SRC
PHP
LDA ESTKL,X
LDA ESTKL+4,X
STA TMPL
LDA ESTKH,X
LDA ESTKH+4,X
STA TMPH
INX
LDA ESTKL,X
PHA
INX
LDA ESTKL,X
TAY
INX
LDA ESTKL+1,X
TAY
LDA ESTKL+3,X
PHA
LDA ESTKL,X
LDA ESTKL+2,X
INX
INX
INX
INX
STX ESP
TAX
@ -328,67 +327,6 @@ asm memxcpy
INX
RTS
end
;
; HOME
;
asm home
STX ESP
BIT ROMEN
JSR $FC58
BIT LCRDEN+LCBNK2
LDX ESP
DEX
RTS
end
;
; SET VIEWPORT
; VIEWPORT(LEFT, TOP, WIDTH, HEIGHT)
;
asm viewport
LDA ESTKL+1,X
BNE +
LDA ESTKL,X
BNE +
STA ESTKL+3,X
STA ESTKL+2,X
LDA #40
STA ESTKL+1,X
LDA #24
STA ESTKL,X
+ LDA ESTKL+3,X
STA $20
LDA ESTKL+1,X
STA $21
LDA ESTKL+2,X
STA $22
CLC
ADC ESTKL,X
STA $23
LDY #$00
STY $24
LDA $22
INX
INX
BNE VTAB
end
;
; SET VIEWPORT RELATIVE CURSOR POSITION
; GOTOXY(X,Y)
;
asm gotoxy
LDA ESTKL+1,X
STA $24
LDA ESTKL,X
CLC
ADC $22
VTAB STX ESP
BIT ROMEN
JSR $FB5B
BIT LCRDEN+LCBNK2
LDX ESP
INX
RTS
end
asm crout
DEX
LDA #$8D
@ -1032,7 +970,7 @@ def loadmod(mod)
close(refnum)
refnum = 0
if loadmod(moddep) < 0
return perr
return -perr
fin
fin
moddep = moddep + dcitos(moddep, @str)
@ -1351,7 +1289,13 @@ def execmod(modfile)
fin
end
;
; Get heap start.
;
heap = *freemem
;
; Init symbol table.
;
stodci(@stdlibstr, heap)
addmod(heap, 1)
while *stdlibsym
@ -1359,7 +1303,15 @@ while *stdlibsym
addsym(heap, (stdlibsym):2)
stdlibsym = stdlibsym + 4
loop
;
; Try to run autorun module.
;
execmod(@autorun)
resetmemfiles()
perr = 0
;
; Print some startup info.
;
prstr(@version)
prstr(@freestr)
prword(availheap)

View File

@ -161,51 +161,9 @@ RAMDONE CLI
STA $D103,Y ; YEAH, I HARDCODED THE ADDRESS
DEY
BPL -
;*
;* LOOK FOR STARTUP FILE
;*
JSR PRODOS ; OPEN AUTORUN
!BYTE $C8
!WORD OPENPARMS
BNE NOAUTO
LDA REFNUM
STA NLPARMS+1
JSR PRODOS
!BYTE $C9
!WORD NLPARMS
BNE NOAUTO
LDA REFNUM
STA READPARMS+1
JSR PRODOS
!BYTE $CA
!WORD READPARMS
BNE NOAUTO
LDX READPARMS+6
STX STRBUF ; STRING LENGTH
JSR PRODOS
!BYTE $CC
!WORD CLOSEPARMS
NOAUTO JMP CMDEXEC
JMP CMDEXEC
GETPFXPARMS !BYTE 1
!WORD STRBUF ; PATH STRING GOES HERE
AUTORUN !BYTE 7
!TEXT "AUTORUN"
OPENPARMS !BYTE 3
!WORD AUTORUN
!WORD $0800
REFNUM !BYTE 0
NLPARMS !BYTE 3
!BYTE 0
!BYTE $7F
!BYTE $0D
READPARMS !BYTE 4
!BYTE 0
!WORD STRBUF+1
!WORD $0080
!WORD 0
CLOSEPARMS !BYTE 1
!BYTE 0
PAGE3 = *
!PSEUDOPC $03D0 {
;*
@ -359,12 +317,12 @@ NEXTOPX INY
FETCHOPX LDA (IP),Y
STA *+4
JMP (OPXTBL) ; USE AUX OPCODES
TIMERX STA ALTRDOFF
CLI
JSR JMPTMR
SEI
STA ALTRDON
JMP FETCHOPX
;TIMERX STA ALTRDOFF
; CLI
; JSR JMPTMR
; SEI
; STA ALTRDON
; JMP FETCHOPX
;*
;* INTERP BYTECODE IN MAIN MEM
;*
@ -379,8 +337,8 @@ FETCHOP LDA (IP),Y
ORA #$80 ; USE MAIN OPCODES
STA *+4
JMP (OPTBL)
TIMER JSR JMPTMR
JMP FETCHOP
;TIMER JSR JMPTMR
; JMP FETCHOP
;*
;* INDIRECT JUMP TO (TMRVEC)
;*

View File

@ -2,6 +2,11 @@ import STDLIB
predef call, puts
end
;
; Handy constants.
;
const FALSE=$0000
const TRUE=!FALSE
;
; CALL return register structure.
;
const acc = 0
@ -9,49 +14,43 @@ const xreg = 1
const yreg = 2
const preg = 3
;
; Hardware constants
; Hardware constants.
;
const speaker = $C030
const showgraphics = $C050
const showtext = $C051
const showfull = $C052
const showmix = $C053
const showpage1 = $C054
const showpage2 = $C055
const showlores = $C056
const showhires = $C057
const keyboard = $C000
const keystrobe = $C010
const hgr1 = $2000
const hgr2 = $4000
const page1 = 0
const page2 = 1
;
; ROM routinse.
;
const grplot = $F800
const initmode = $FB2F
const textmode = $FB39
const grmode = $FB40
const vtab = $FB5B
const grcolor = $F864
const home = $FC58
;
; String data.
;
const speaker=$C030
const showgraphics=$C050
const showtext=$C051
const showfull=$C052
const showmix=$C053
const TRUE=$FFFF
const FALSE=$0000
const showpage1=$C054
const showpage2=$C055
const showlores=$C056
const showhires=$C057
const keyboard=$C000
const keystrobe=$C010
const hgr1=$2000
const hgr2=$4000
const page1=0
const page2=1
byte exitmsg[] = "Press any key to exit.\n"
byte goodbye[] = "That's all, folks!\n"
byte i, j, k, w, fmi, fmk, color
def textmode
call(0, 0, 0, 0, $FB39)
end
def home
call(0, 0, 0, 0, $FC58)
end
def gotoxy(x, y)
^($24) = x
call(y, 0, 0, 0, $FB5B)
end
def grmode
call(0, 0, 0, 0, $FB40)
^showlores
end
def grcolor(color)
call(color, 0, 0, 0, $F864)
end
def grplot(x, y)
call(y, 0, x, 0, $F800)
end
def colors
;
; Rod's Colors
;
def rod
byte i, j, k, w, fmi, fmk, color
while TRUE
for w = 3 to 50
for i = 1 to 19
@ -60,15 +59,15 @@ def colors
color = (j * 3) / (i + 3) + i * w / 12
fmi = 40 - i
fmk = 40 - k
call(color, 0, 0, 0, $F864) ;grcolor(color);
call(k, 0, i, 0, $F800) ;grplot(i, k);
call(i, 0, k, 0, $F800) ;grplot(k, i);
call(fmk, 0, fmi, 0, $F800) ;grplot(fmi, fmk);
call(fmi, 0, fmk, 0, $F800) ;grplot(fmk, fmi);
call(fmi, 0, k, 0, $F800) ;grplot(k, fmi);
call(k, 0, fmi, 0, $F800) ;grplot(fmi, k);
call(fmk, 0, i, 0, $F800) ;grplot(i, fmk);
call(i, 0, fmk, 0, $F800) ;grplot(fmk, i);
call(grcolor, color, 0, 0, 0) ;grcolor(color);
call(grplot, k, 0, i, 0) ;grplot(i, k);
call(grplot, i, 0, k, 0) ;grplot(k, i);
call(grplot, fmk, 0, fmi, 0) ;grplot(fmi, fmk);
call(grplot, fmi, 0, fmk, 0) ;grplot(fmk, fmi);
call(grplot, fmi, 0, k, 0) ;grplot(k, fmi);
call(grplot, k, 0, fmi, 0) ;grplot(fmi, k);
call(grplot, fmk, 0, i, 0) ;grplot(i, fmk);
call(grplot, i, 0, fmk, 0) ;grplot(fmk, i);
if ^keyboard >= 128
return ^keystrobe
fin
@ -78,12 +77,13 @@ def colors
loop
end
grmode()
gotoxy(10,22)
call(initmode, 0, 0, 0, 0) ;initmode()
call(grmode, 0, 0, 0, 0) ;grmode()
^$24 = 10 ;gotoxy(10,22)
call(vtab, 22, 0, 0, 0)
puts(@exitmsg)
colors()
textmode()
home()
rod
call(textmode, 0, 0, 0, 0) ;textmode()
call(home, 0, 0, 0, 0) ;home()
puts(@goodbye)
done

View File

@ -9,7 +9,7 @@ const O_READ_WRITE = 3
;
; Pedefined functions.
;
predef home, gotoxy, viewport, crout, cout, prstr, cin, rdstr
predef crout, cout, prstr, cin, rdstr
predef syscall, call
predef markheap, allocheap, allocalignheap, releaseheap, availheap
predef memset, memcpy
@ -20,20 +20,29 @@ predef loadmod, execmod
;
byte machid = $F2 ; Apple ///, 80 columns
;
; System variable.
;
word systemflags = 0
word heap = $2000
word refcons, devcons
byte modid = 0
byte modseg[15]
word symtbl, lastsym
byte perr, terr, lerr
word cmdptr
;
; Standard Library exported functions.
;
byte stdlibstr[] = "STDLIB"
byte machidstr[] = "MACHID"
byte clsstr[] = "CLS"
byte gotoxystr[] = "GOTOXY"
byte viewstr[] = "VIEWPORT"
byte sysvarstr[] = "SYSVARS"
byte sysstr[] = "SYSCALL"
byte callstr[] = "CALL"
byte putcstr[] = "PUTC"
byte putlnstr[] = "PUTLN"
byte putsstr[] = "PUTS"
byte getcstr[] = "GETC"
byte getsstr[] = "GETS"
byte sysstr[] = "SYSCALL"
byte sysstr[] = "SYSCALL"
byte callstr[] = "CALL"
byte hpmarkstr[] = "HEAPMARK"
byte hpalignstr[] = "HEAPALLOCALIGN"
byte hpallocstr[] = "HEAPALLOC"
@ -47,15 +56,13 @@ byte uisltstr[] = "ISULT"
byte uislestr[] = "ISULE"
byte loadstr[] = "LOAD"
byte execstr[] = "EXEC"
word exports[] = @clsstr, @home
word = @gotoxystr, @gotoxy
word = @viewstr, @viewport
word exports[] = @sysstr, @syscall
word = @callstr, @call
word = @putcstr, @cout
word = @putlnstr, @crout
word = @putsstr, @prstr
word = @getcstr, @cin
word = @getsstr, @rdstr
word = @sysstr, @syscall
word = @callstr, @call
word = @hpmarkstr, @markheap
word = @hpallocstr,@allocheap
word = @hpalignstr,@allocalignheap
@ -69,32 +76,23 @@ word = @uislestr, @uword_isle
word = @loadstr, @loadmod
word = @execstr, @execmod
word = @machidstr, @machid
word = @sysvarstr, @systemflags
word = 0
word stdlibsym = @exports
;
; String pool.
;
byte console[] = ".CONSOLE"
byte devtovol[] = " => /"
byte autorun[] = "AUTORUN"
byte version[] = "PLASMA 0.9\n"
byte freestr[] = "MEM FREE:$"
byte errorstr[] = "ERR:$"
byte okstr[] = "OK"
byte huhstr[] = "?\n"
byte devtovol[] = " => /"
byte prefix[128] = ""
byte hexchar[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
;
; System variable.
;
word systemflags = 0
byte modid = 0
byte modseg[15]
word heap = $2000
word symtbl, lastsym
word refcons, devcons
byte perr, terr, lerr
word cmdptr
;
; CALL SOS
; SYSCALL(CMD, PARAMS)
;
@ -804,31 +802,6 @@ def rdstr(prompt)
cout($0D)
return heap
end
def home
return cout(28)
end
def gotoxy(x, y)
cout(26)
cout(x)
return cout(y)
end
def viewport(left, top, width, height)
if !width or !height
;
; Reset the full-screen viewport
;
left = 0
top = 0
width = 80
height = 24
fin
cout(1) ; Reset viewport
gotoxy(left, top)
cout(2)
gotoxy(width - 1, height - 1)
cout(3)
return gotoxy(0, 0)
end
def crout
return cout($0D)
end
@ -963,28 +936,15 @@ def adddef(ext, addr, deflast)
(defentry):1 = interp
(defentry):3 = addr
(defentry):5 = ext ; ext is byte, so this nulls out next entry
;prword(defentry)
;cout('@')
;prbyte(ext)
;cout(':')
;prword(addr)
;crout
return defentry
end
def lookupdef(addr, deftbl)
while (deftbl).0 == $20
if (deftbl):3 == addr
;prword(addr)
;cout('>')
;prword(deftbl)
;crout
return deftbl
fin
deftbl = deftbl + 6
loop
;prword(addr)
;cout('?')
;crout
return 0
end
def loadmod(mod)
@ -1001,7 +961,6 @@ def loadmod(mod)
dcitos(mod, @filename)
refnum = open(@filename, O_READ)
if refnum > 0
;newline(refnum, 0, $0D)
rdlen = read(refnum, @header, 128)
modsize = header:0
moddep = @header.1
@ -1024,7 +983,7 @@ def loadmod(mod)
close(refnum)
refnum = 0
if loadmod(moddep) < 0
return perr
return -perr
fin
fin
moddep = moddep + dcitos(moddep, @str)
@ -1084,13 +1043,6 @@ def loadmod(mod)
if !codeseg.1 ; Fix up address if at bottom of segment: 8n:00 -> 8(n-1):80
codeseg = codeseg - $8001
fin
;prbyte((rld - bytecode + 255) >> 8)
;cout(':')
;prword(codeseg)
;cout('-')
;cout('>')
;prword(defaddr)
;crout
defext = codeseg.0 | $80
defaddr = codeseg & $FF00
;
@ -1105,49 +1057,15 @@ def loadmod(mod)
else
addr = (rld):1 + modfix
if uword_isge(addr, modaddr) ; Skip fixups to header
;if uword_isge(addr, modend)
; cout('<')
; prword((rld):1)
; cout('>')
; prword(rld)
; crout
;fin
if ^rld & $80 ; WORD sized fixup.
fixup = *addr
else ; BYTE sized fixup.
fixup = ^addr
fin
; if uword_isge(fixup, modend)
; cout('<')
; cout('<')
; prword(*addr);fixup)
; cout('@')
; prword(addr)
; cout('>')
; cout('>')
; prword(^rld)
; crout
; fin
if ^rld & $10 ; EXTERN reference.
fixup = fixup + lookupextern(esd, (rld).3)
else ; INTERN fixup.
fixup = fixup + modfix - MODADDR
; if uword_isge(fixup, modend)
; prword(@(modaddr).$62)
; cout('=')
; prword((modaddr).$62)
; crout
; cout('<')
; cout('<')
; cout('<')
; prword(fixup)
; cout('>')
; cout('>')
; cout('>')
; prword(rld)
; cin
; crout
; fin
if uword_isge(fixup, bytecode)
;
; Bytecode address - replace with call def directory.
@ -1353,17 +1271,10 @@ def execmod(modfile)
end
;
; Init console
; Init console.
;
init_cons
;
; Print some startup info.
;
prstr(@version)
prstr(@freestr)
prword(availheap)
crout
;
; Init symbol table.
;
symtbl = allocheap($400)
@ -1377,6 +1288,18 @@ while *stdlibsym
stdlibsym = stdlibsym + 4
loop
;
; Try to run autorun module.
;
execmod(@autorun)
perr = 0
;
; Print some startup info.
;
prstr(@version)
prstr(@freestr)
prword(availheap)
crout
;
; Handle commands.
;
while 1

View File

@ -9,7 +9,13 @@ include(testlib.plh)
; Declare all global variables for this module.
;
byte hello[] = "Hello, world.\n"
byte hello[] = "Hello, Apple "
byte a1[] = "1"
byte a2[] = "]["
byte a2p[] = "][+"
byte a2e[] = "//e"
byte a2c[] = "//c"
byte a3[] = "///"
word struct[] = 1, 10, 100, 1000, 10000
byte spaces[] = " "
@ -47,14 +53,28 @@ def nums(range)
end
export def main(range)
cls
nums(*range)
tens(*range*10)
viewport(12, 12, 16, 8)
ascii
viewport(0, 0, 40, 24)
gotoxy(15,5)
putln
puts(@hello)
when MACHID & $C8
is $08
puts(@a1)
is $00
puts(@a2)
is $40
puts(@a2p)
is $80
puts(@a2e)
is $88
puts(@a2c)
is $C0
puts(@a3)
otherwise
putc('?')
wend
putln
end
main(@struct:6)

View File

@ -38,10 +38,6 @@ export def puti(i)
fin
end
export def putln
putc($0D)
end
puts(@loadstr)
putln
done