diff --git a/src/inc/dcgrutils.plh b/src/inc/dcgrutils.plh index ddd9103..49a6ca4 100644 --- a/src/inc/dcgrutils.plh +++ b/src/inc/dcgrutils.plh @@ -8,4 +8,6 @@ import dcgrutils predef dcgrRect(x, y, w, h)#0 predef spriteRead(filestr)#5 predef spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1 + predef screenRead(filestr)#1 + predef screenWrite(filestr)#1 end diff --git a/src/libsrc/apple/dcgrutils.pla b/src/libsrc/apple/dcgrutils.pla index 8f353d4..057c566 100644 --- a/src/libsrc/apple/dcgrutils.pla +++ b/src/libsrc/apple/dcgrutils.pla @@ -2,6 +2,8 @@ include "inc/cmdsys.plh" include "inc/fileio.plh" include "inc/dcgrlib.plh" +const page1m = $C054 +const page1x = $C055 // // Apple //e hires character font // @@ -150,11 +152,10 @@ export def spriteRead(filestr)#5 return xorg, yorg, width, height, sprptr end export def spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1 - var sprsize, error + var sprsize byte refnum, i sprsize = (width + 1) / 2 * height - error = FALSE fileio:destroy(filestr) if fileio:create(filestr, $06, $0000) == FILE_ERR_OK refnum = fileio:open(filestr) @@ -164,9 +165,38 @@ export def spriteWrite(filestr, xorg, yorg, width, height, sprptr)#1 fileio:write(refnum, @width, 1) fileio:write(refnum, @height, 1) sprsize = (width + 1) / 2 * height - error = fileio:write(refnum, sprptr, sprsize) <> sprsize + fileio:write(refnum, sprptr, sprsize) <> sprsize fileio:close(refnum) fin fin - return error + return perr +end +export def screenRead(filestr)#1 + byte refnum + + refnum = fileio:open(filestr) + if refnum + ^page1x // Read AUX bytes + fileio:read(refnum, $2000, $2000) + ^page1m // Read MAIN bytes + fileio:read(refnum, $2000, $2000) + fileio:close(refnum) + fin + return perr +end +export def screenWrite(filestr)#1 + byte refnum + + fileio:destroy(filestr) + if fileio:create(filestr, $06, $0000) == FILE_ERR_OK + refnum = fileio:open(filestr) + if refnum + ^page1x // Write AUX bytes + fileio:write(refnum, $2000, $2000) + ^page1m // Write MAIN bytes + fileio:write(refnum, $2000, $2000) + fileio:close(refnum) + fin + fin + return perr end diff --git a/src/samplesrc/dcgrtest.pla b/src/samplesrc/dcgrtest.pla index d852602..5d3bc1b 100644 --- a/src/samplesrc/dcgrtest.pla +++ b/src/samplesrc/dcgrtest.pla @@ -422,6 +422,7 @@ def dcgrTest#0 getc end dcgrMode(0) +screenRead("monarch") readEnterprise dcgrCompSprite(2) dcgrCompMask(2)