mirror of
https://github.com/dschmenk/PLASMA.git
synced 2026-04-19 09:23:06 +00:00
Update version # for minor bug fixes in fileio and AUTORUN
This commit is contained in:
Binary file not shown.
@@ -6,6 +6,7 @@ import dcgrutils
|
||||
predef dcgrBoldStr(clr, x, y, strptr)#0
|
||||
predef dcgrFont(font)#0
|
||||
predef dcgrRect(x, y, w, h)#0
|
||||
predef frameRead(filestr, frame)#1
|
||||
predef spriteRead(filestr)#5
|
||||
predef spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1
|
||||
predef screenRead(filestr)#1
|
||||
|
||||
@@ -72,6 +72,8 @@ import fileio
|
||||
word online
|
||||
word readblock
|
||||
word writeblock
|
||||
word getmark
|
||||
word setmark
|
||||
end
|
||||
//
|
||||
// Globally accessible error code
|
||||
|
||||
@@ -124,6 +124,34 @@ export def dcgrRect(x, y, w, h)#0
|
||||
dcgrHLin(x, x2, v)
|
||||
next
|
||||
end
|
||||
export def frameRead(filestr, frame)#1
|
||||
var sprptr, sprsize
|
||||
byte refnum, numframes
|
||||
|
||||
sprptr = 0
|
||||
refnum = fileio:open(filestr)
|
||||
if refnum
|
||||
sprsize = 40 * 40 / 2
|
||||
sprptr = heapalloc(sprsize)
|
||||
if sprptr and fileio:read(refnum, @numframes, 1)
|
||||
if numframes < frame
|
||||
heaprelease(sprptr)
|
||||
sprptr = NULL
|
||||
fin
|
||||
fin
|
||||
if sprptr
|
||||
if fileio:setmark(refnum, (frame - 1) * sprsize + 1, 0)
|
||||
heaprelease(sprptr)
|
||||
sprptr = NULL
|
||||
elsif fileio:read(refnum, sprptr, sprsize) <> sprsize
|
||||
heaprelease(sprptr)
|
||||
sprptr = NULL
|
||||
fin
|
||||
fin
|
||||
fileio:close(refnum)
|
||||
fin
|
||||
return sprptr
|
||||
end
|
||||
export def spriteRead(filestr)#5
|
||||
var sprptr, sprsize, xorg, yorg
|
||||
byte refnum, width, height
|
||||
|
||||
@@ -26,13 +26,14 @@ const sysbuf = $0800
|
||||
predef a2getpfx(path), a2setpfx(path), a2getfileinfo(path, fileinfo), a2setfileinfo(path, fileinfo), a23geteof(refnum)#2, a23seteof(refnum, eofl, eofh), a2iobufs(iobufs), a2open(path), a2close(refnum)
|
||||
predef a23read(refnum, buf, len), a2write(refnum, buf, len), a2create(path, type, aux), a23destroy(path), a23rename(path, newpath)
|
||||
predef a2newline(refnum, emask, nlchar), a2online(unit, buf), a2readblock(unit, buf, block), a2writeblock(unit, buf, block)
|
||||
predef a23getmark(refnum)#2, a23setmark(refnum, eofl, eofh)
|
||||
//
|
||||
// Exported function table.
|
||||
//
|
||||
word fileio[]
|
||||
word = @a2getpfx, @a2setpfx, @a2getfileinfo, @a2setfileinfo, @a23geteof, @a23seteof, @a2iobufs, @a2open, @a2close
|
||||
word = @a23read, @a2write, @a2create, @a23destroy, @a23rename
|
||||
word = @a2newline, @a2online, @a2readblock, @a2writeblock
|
||||
word = @a2newline, @a2online, @a2readblock, @a2writeblock, @a23getmark, @a23setmark
|
||||
//
|
||||
// SOS/ProDOS error code
|
||||
//
|
||||
@@ -162,7 +163,7 @@ def a23geteof(refnum)#2
|
||||
return params:2, params.4
|
||||
end
|
||||
def a1seteof(refnum, eofl, eofh)
|
||||
return 0
|
||||
return -1
|
||||
end
|
||||
def a23seteof(refnum, eofl, eofh)
|
||||
byte params[5]
|
||||
@@ -171,8 +172,34 @@ def a23seteof(refnum, eofl, eofh)
|
||||
params.1 = refnum
|
||||
params:2 = eofl
|
||||
params.4 = eofh
|
||||
syscall($D0, @params)
|
||||
return params:2
|
||||
perr = syscall($D0, @params)
|
||||
return perr
|
||||
end
|
||||
def a1getmark(refnum)#2
|
||||
return 0, 0
|
||||
end
|
||||
def a23getmark(refnum)#2
|
||||
byte params[5]
|
||||
|
||||
params.0 = 2
|
||||
params.1 = refnum
|
||||
params:2 = 0
|
||||
params.4 = 0
|
||||
syscall($CF, @params)
|
||||
return params:2, params.4
|
||||
end
|
||||
def a1setmark(refnum, eofl, eofh)
|
||||
return -1
|
||||
end
|
||||
def a23setmark(refnum, eofl, eofh)
|
||||
byte params[5]
|
||||
|
||||
params.0 = 2
|
||||
params.1 = refnum
|
||||
params:2 = eofl
|
||||
params.4 = eofh
|
||||
perr = syscall($CE, @params)
|
||||
return perr
|
||||
end
|
||||
def a1open(path)
|
||||
*CFFA1FileName = path
|
||||
|
||||
@@ -20,6 +20,7 @@ cp rel/apple/HGRSPRITE#FE1000 prodos/sys/HGRSPRITE.REL
|
||||
cp rel/apple/HGRLIB#FE1000 prodos/sys/HGRLIB.REL
|
||||
cp rel/apple/DCGRLIB#FE1000 prodos/sys/DCGRLIB.REL
|
||||
cp rel/apple/DCGRUTILS#FE1000 prodos/sys/DCGRUTILS.REL
|
||||
cp rel/apple/DCGRSPRED#FE1000 prodos/sys/DCGRSPRED.REL
|
||||
cp rel/apple/GRLIB#FE1000 prodos/sys/GRLIB.REL
|
||||
cp rel/apple/DGRLIB#FE1000 prodos/sys/DGRLIB.REL
|
||||
cp rel/apple/COPY#FE1000 prodos/sys/COPY.REL
|
||||
@@ -108,7 +109,6 @@ cp rel/apple/DGRTEST#FE1000 prodos/demos/apple2/DGRTEST.REL
|
||||
|
||||
mkdir prodos/demos/apple2/dcgr
|
||||
cp rel/apple/DCGRTEST#FE1000 prodos/demos/apple2/dcgr/DCGRTEST.REL
|
||||
cp rel/apple/DCGRSPRED#FE1000 prodos/demos/apple2/dcgr/DCGRSPRED.REL
|
||||
cp samplesrc/ENT.* prodos/demos/apple2/dcgr
|
||||
|
||||
mkdir prodos/demos/apple2/spiders
|
||||
|
||||
+1
-1
@@ -1631,7 +1631,7 @@ def cmdmode#0
|
||||
word cmdptr, line
|
||||
|
||||
clrscrn
|
||||
puts("PLASMA Editor, Version 2.1\n")
|
||||
puts("PLASMA Editor, Version 2.20\n")
|
||||
while not exit
|
||||
puts(@filename)
|
||||
cmdptr = gets($BA)
|
||||
|
||||
@@ -508,7 +508,7 @@ include "toolsrc/parse.pla"
|
||||
//
|
||||
// Look at command line arguments and compile module
|
||||
//
|
||||
puts("PLASMA Compiler, Version 2.11A\n")
|
||||
puts("PLASMA Compiler, Version 2.20\n")
|
||||
arg = argNext(argFirst)
|
||||
if ^arg and ^(arg + 1) == '-'
|
||||
opt = arg + 2
|
||||
|
||||
@@ -77,6 +77,40 @@ def gr2dcgr#5
|
||||
return xCursor - xmin, yCursor - ymin, width, height, pdcgrSpr
|
||||
end
|
||||
|
||||
def greasy2gr(pGreasy)#0
|
||||
var pgrSpr
|
||||
byte i, j
|
||||
|
||||
memset(@grSprite, $0505, 40*48)
|
||||
pgrSpr = @grSprite + (24 - 40 / 2) * 40
|
||||
pgrSpr = pgrSpr + 20 - 40 / 2
|
||||
for j = 0 to 39 step 2
|
||||
for i = 0 to 39
|
||||
^(pgrSpr + i) = ^(pGreasy + i) & $0F
|
||||
next
|
||||
pgrSpr = pgrSpr + 40
|
||||
for i = 0 to 39
|
||||
^(pgrSpr + i) = (^(pGreasy + i) & $F0) >> 4
|
||||
next
|
||||
pgrSpr = pgrSpr + 40
|
||||
pGreasy = pGreasy + 40
|
||||
next
|
||||
end
|
||||
|
||||
def importGreasy(frame)
|
||||
var sprptr
|
||||
|
||||
sprptr = frameRead(@filename, frame)
|
||||
if sprptr
|
||||
heaprelease(sprptr)
|
||||
greasy2gr(sprptr)
|
||||
else
|
||||
putc(7); puts("Error importing frame #")
|
||||
puti(frame); puts(" from "); puts(@filename); putln
|
||||
fin
|
||||
return sprptr == NULL
|
||||
end
|
||||
|
||||
def readFile#1
|
||||
var xorg, yorg, width, height, sprptr
|
||||
|
||||
@@ -95,9 +129,21 @@ def writeFile#1
|
||||
return spriteWrite(@filename, xorg, yorg, width, height, sprptr)
|
||||
end
|
||||
|
||||
def strnum(strptr)
|
||||
var num
|
||||
|
||||
num = 0
|
||||
while ^strptr == ' '; strptr++; loop
|
||||
while ^strptr >= '0' and ^strptr <= '9'
|
||||
num = num * 10 + (^strptr - '0')
|
||||
strptr++
|
||||
loop
|
||||
return num
|
||||
end
|
||||
|
||||
def getCmd#1
|
||||
var cmdstr, xorg, yorg, width, height, sprptr, sprspan, grspr
|
||||
byte cl, ch
|
||||
byte frame, i
|
||||
|
||||
while 1
|
||||
if modified; putc('*'); fin
|
||||
@@ -105,6 +151,44 @@ def getCmd#1
|
||||
cmdstr = gets(':'|$80)
|
||||
if ^cmdstr
|
||||
when toupper(^(cmdstr + 1))
|
||||
is 'G'
|
||||
if modified
|
||||
puts("Lose changes (Y/N)?")
|
||||
if toupper(getc) <> 'Y'
|
||||
break
|
||||
fin
|
||||
putln
|
||||
fin
|
||||
repeat // Skip to filename
|
||||
^cmdstr--
|
||||
memcpy(cmdstr + 1, cmdstr + 2, ^cmdstr)
|
||||
until ^cmdstr == 0 or ^(cmdstr + 1) <> ' '
|
||||
frame = 1
|
||||
if ^cmdstr
|
||||
for i = 1 to ^cmdstr
|
||||
if ^(cmdstr + i) == ','
|
||||
^(cmdstr + ^cmdstr + 1) = 0
|
||||
frame = strnum(cmdstr + i + 1)
|
||||
^cmdstr = i - 1
|
||||
break
|
||||
fin
|
||||
next
|
||||
if ^cmdstr
|
||||
memcpy(@filename, cmdstr, ^cmdstr + 1)
|
||||
elsif filename[filename - 2] == '.'
|
||||
filename = filename - 3
|
||||
fin
|
||||
fin
|
||||
if frame
|
||||
modified = importGreasy(frame)
|
||||
if not modified
|
||||
filename[filename + 1] = '.'
|
||||
filename[filename + 2] = '0' + frame / 10
|
||||
filename[filename + 3] = '0' + frame % 10
|
||||
filename = filename + 3
|
||||
fin
|
||||
fin
|
||||
break
|
||||
is 'R'
|
||||
if modified
|
||||
puts("Lose changes (Y/N)?")
|
||||
@@ -194,7 +278,7 @@ def grGetKey#1
|
||||
grPlot(xCursor, yCursor)
|
||||
break
|
||||
is 128
|
||||
grColor(c)
|
||||
grColor(c == clrCursor ?? c ^ $0F :: c)
|
||||
grPlot(xCursor, yCursor)
|
||||
break
|
||||
wend
|
||||
@@ -265,7 +349,9 @@ while not quit
|
||||
is ' '
|
||||
modified = 1
|
||||
grSprite[yCursor*40 + xCursor] = clrCursor
|
||||
grView
|
||||
grColor(clrCursor)
|
||||
grPlot(xCursor, yCursor)
|
||||
//grView
|
||||
break
|
||||
is '+'
|
||||
is '='
|
||||
|
||||
@@ -40,7 +40,7 @@ predef sext(a)#1, divmod(a,b)#2, execmod(modfile)#1, syslookuptbl(a)#1
|
||||
//
|
||||
// Exported CMDSYS table
|
||||
//
|
||||
word version = $0211 // 02.11
|
||||
word version = $0220 // 02.20
|
||||
word syspath
|
||||
word syscmdln
|
||||
word = @execmod
|
||||
|
||||
@@ -39,7 +39,7 @@ predef lookuptbl(dci)#1, execsys(sysfile)#0
|
||||
//
|
||||
// Exported CMDSYS table
|
||||
//
|
||||
word version = $0211 // 02.11
|
||||
word version = $0220 // 02.20
|
||||
word syspath
|
||||
word syscmdln
|
||||
word = @execmod, @open, @close, @read, 0
|
||||
@@ -1327,6 +1327,7 @@ def docmds#0
|
||||
word prefix
|
||||
|
||||
prefix = pfxop(heap, GET_PFX)
|
||||
strcpy(getlnbuf, @cmdln)
|
||||
repeat
|
||||
if ^getlnbuf
|
||||
strcpy(@cmdln, getlnbuf)
|
||||
@@ -1386,7 +1387,7 @@ heap = @lastdef
|
||||
//
|
||||
// Print PLASMA version
|
||||
//
|
||||
prstr("PLASMA 2.11 64K\n")
|
||||
prstr("PLASMA 2.20 64K\n")
|
||||
//
|
||||
// Init symbol table.
|
||||
//
|
||||
@@ -1407,10 +1408,8 @@ syscmdln = @cmdln
|
||||
autorun = open(@autorun)
|
||||
if autorun
|
||||
cmdln = read(autorun, @cmdln+1, 81)
|
||||
strcpy(getlnbuf, @cmdln)
|
||||
close(0)
|
||||
else
|
||||
^getlnbuf = 0
|
||||
//
|
||||
// Print some startup info.
|
||||
//
|
||||
|
||||
@@ -56,7 +56,7 @@ predef lookuptbl(dci)#1, execsys(sysfile)#0
|
||||
//
|
||||
// Exported CMDSYS table
|
||||
//
|
||||
word version = $0211 // 02.11
|
||||
word version = $0220 // 02.20
|
||||
word syspath
|
||||
word syscmdln
|
||||
word = @execmod, @open, @close, @read, 0
|
||||
@@ -1409,6 +1409,7 @@ def docmds#0
|
||||
xheap = $0400 // Reset heap to point at low memory
|
||||
xheaptop = $A000 // Top below JITC
|
||||
prefix = pfxop(heap, GET_PFX)
|
||||
strcpy(getlnbuf, @cmdln)
|
||||
repeat
|
||||
if ^getlnbuf
|
||||
strcpy(@cmdln, getlnbuf)
|
||||
@@ -1472,7 +1473,7 @@ heap = @lastdef
|
||||
//
|
||||
// Print PLASMA version
|
||||
//
|
||||
prstr("PLASMA 2.11 128K\n")
|
||||
prstr("PLASMA 2.20 128K\n")
|
||||
//
|
||||
// Init symbol table.
|
||||
//
|
||||
@@ -1493,10 +1494,8 @@ syscmdln = @cmdln
|
||||
autorun = open(@autorun)
|
||||
if autorun
|
||||
cmdln = read(autorun, @cmdln+1, 81)
|
||||
strcpy(getlnbuf, @cmdln)
|
||||
close(0)
|
||||
else
|
||||
^getlnbuf = 0
|
||||
//
|
||||
// Print some startup info.
|
||||
//
|
||||
|
||||
@@ -45,7 +45,7 @@ predef syslookuptbl(dci)#1
|
||||
//
|
||||
// Exported CMDSYS table
|
||||
//
|
||||
word version = $0211 // 02.11
|
||||
word version = $0220 // 02.20
|
||||
word syspath
|
||||
word cmdlnptr
|
||||
word = @execmod, @open, @close, @read, @write
|
||||
@@ -1284,7 +1284,7 @@ cmdlnptr = @cmdln
|
||||
// Print PLASMA version
|
||||
//
|
||||
init_cons
|
||||
prstr("PLASMA 2.11\n")
|
||||
prstr("PLASMA 2.20\n")
|
||||
prstr("MEM:$"); prword(availheap); crout
|
||||
//
|
||||
// Exec command line parser
|
||||
|
||||
@@ -56,7 +56,7 @@ predef syslookuptbl(dci)#1
|
||||
//
|
||||
// Exported CMDSYS table
|
||||
//
|
||||
word version = $0211 // 02.11
|
||||
word version = $0220 // 02.20
|
||||
word syspath
|
||||
word cmdlnptr
|
||||
word = @execmod, @open, @close, @read, @write
|
||||
@@ -1307,7 +1307,7 @@ cmdlnptr = @cmdln
|
||||
// Print PLASMA version
|
||||
//
|
||||
init_cons
|
||||
prstr("PLASMA 2.11 JITC\n")
|
||||
prstr("PLASMA 2.20 JITC\n")
|
||||
prstr("MEM:$"); prword(availheap); crout
|
||||
//
|
||||
// Exec command line parser
|
||||
|
||||
Reference in New Issue
Block a user