1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-05 02:30:56 +00:00

read/write dazzle draw screens

This commit is contained in:
David Schmenk 2024-11-02 08:23:40 -07:00
parent 8fc9175555
commit eb43eb4e14
3 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -422,6 +422,7 @@ def dcgrTest#0
getc
end
dcgrMode(0)
screenRead("monarch")
readEnterprise
dcgrCompSprite(2)
dcgrCompMask(2)