1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-06-26 06:29:28 +00:00

More WIP for the graphics libraries

This commit is contained in:
Dave Schmenk 2019-12-19 14:27:08 -08:00
parent 72f7dea67f
commit b9c5a8cb23
9 changed files with 189 additions and 59 deletions

View File

@ -1,5 +1,4 @@
import dgrlib
word[] dgrbuff
predef dgrPlot(x, y)#0
predef dgrHLin(x1, x2, y)#0
predef dgrVLin(y1, y2, x)#0

View File

@ -29,7 +29,7 @@ word = $0450,$04D0,$0550,$05D0,$0650,$06D0,$0750,$07D0
word[] dgr2rows = $0800,$0880,$0900,$0980,$0A00,$0A80,$0B00,$0B80
word = $0828,$08A8,$0928,$09A8,$0A28,$0AA8,$0B28,$0BA8
word = $0850,$08D0,$0950,$09D0,$0A50,$0AD0,$0B50,$0BD0
export word[] dgrbuff = @dgr1rows, @dgr2rows
word[] dgrbuff = @dgr1rows, @dgr2rows
word drawbufptr
byte drawpage
//

View File

@ -47,6 +47,7 @@ INET = rel/INET\#FE1000
DHCP = rel/DHCP\#FE1000
HTTPD = rel/HTTPD\#FE1000
TFTPD = rel/TFTPD\#FE1000
GRLIB = rel/apple/GRLIB\#FE1000
DGRLIB = rel/apple/DGRLIB\#FE1000
LINESPANS = rel/apple/LINESPANS\#FE1000
GRAFIX = rel/apple/GRAFIX\#FE1000
@ -57,6 +58,7 @@ ROGUE = rel/ROGUE\#FE1000
ROGUEMAP = rel/ROGUEMAP\#FE1000
ROGUECOMBAT= rel/ROGUECOMBAT\#FE1000
MON = rel/apple/MON\#FE1000
GRTEST = rel/apple/GRTEST\#FE1000
DGRTEST = rel/apple/DGRTEST\#FE1000
HGRTEST = rel/apple/HGRTEST\#FE1000
MEMMGR = rel/MEMMGR\#FE1000
@ -88,7 +90,8 @@ TXTTYPE = .TXT
#SYSTYPE = \#FF2000
#TXTTYPE = \#040000
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(LINESPANS) $(DGRLIB) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVMJIT) $(PLVM802) $(PLVM03) $(CMD) $(CMDJIT) $(JIT) $(JIT16) $(JITUNE) $(SOSCMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(PRIMEGAP) $(MOUSE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(TFTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(LINESPANS) $(GRLIB) $(DGRLIB) $(GRTEST) $(DGRTEST) $(HGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(LZ4) $(LZ4CAT) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
-rm vmsrc/plvmzp.inc
c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64)
@ -382,10 +385,18 @@ $(PORTIO): libsrc/apple/portio.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/portio.pla > libsrc/apple/portio.a
acme --setpc 4094 -o $(PORTIO) libsrc/apple/portio.a
$(GRLIB): libsrc/apple/grlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/grlib.pla > libsrc/apple/grlib.a
acme --setpc 4094 -o $(GRLIB) libsrc/apple/grlib.a
$(DGRLIB): libsrc/apple/dgrlib.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < libsrc/apple/dgrlib.pla > libsrc/apple/dgrlib.a
acme --setpc 4094 -o $(DGRLIB) libsrc/apple/dgrlib.a
$(GRTEST): samplesrc/grtest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/grtest.pla > samplesrc/grtest.a
acme --setpc 4094 -o $(GRTEST) samplesrc/grtest.a
$(DGRTEST): samplesrc/dgrtest.pla $(PLVM02) $(PLASM)
./$(PLASM) -AMOW < samplesrc/dgrtest.pla > samplesrc/dgrtest.a
acme --setpc 4094 -o $(DGRTEST) samplesrc/dgrtest.a

View File

@ -10,6 +10,7 @@ mkdir prodos/sys
cp rel/apple/FILEIO#FE1000 prodos/sys/FILEIO.REL
cp rel/apple/CONIO#FE1000 prodos/sys/CONIO.REL
cp rel/apple/LINESPANS#FE1000 prodos/sys/LINESPANS.REL
cp rel/apple/GRLIB#FE1000 prodos/sys/GRLIB.REL
cp rel/apple/DGRLIB#FE1000 prodos/sys/DGRLIB.REL
cp rel/ARGS#FE1000 prodos/sys/ARGS.REL
cp rel/ED#FE1000 prodos/sys/ED.REL
@ -54,6 +55,7 @@ cp ../sysfiles/ELEMS.CODE#060000 prodos/fpsos/sys/ELEMS.CODE.BIN
rm -rf prodos/demos
mkdir prodos/demos
cp rel/apple/GRTEST#FE1000 prodos/demos/GRTEST.REL
cp rel/apple/DGRTEST#FE1000 prodos/demos/DGRTEST.REL
cp rel/apple/HGRTEST#FE1000 prodos/demos/HGRTEST.REL
cp rel/apple/ROD#FE1000 prodos/demos/ROD.REL
@ -98,6 +100,7 @@ cp rel/CODEOPT#FE1000 prodos/bld/CODEOPT.REL
mkdir prodos/bld/samples
cp samplesrc/hello.pla prodos/bld/samples/HELLO.PLA.TXT
cp samplesrc/grtest.pla prodos/bld/samples/GRTEST.PLA.TXT
cp samplesrc/dgrtest.pla prodos/bld/samples/DGRTEST.PLA.TXT
cp samplesrc/hgrtest.pla prodos/bld/samples/HGRTEST.PLA.TXT
cp samplesrc/fibertest.pla prodos/bld/samples/FIBERTEST.PLA.TXT
@ -138,6 +141,7 @@ cp inc/args.plh prodos/bld/inc/ARGS.PLH.TXT
cp inc/cmdsys.plh prodos/bld/inc/CMDSYS.PLH.TXT
cp inc/conio.plh prodos/bld/inc/CONIO.PLH.TXT
cp inc/linespans.plh prodos/bld/inc/LINESPANS.PLH.TXT
cp inc/grlib.plh prodos/bld/inc/GRLIB.PLH.TXT
cp inc/dgrlib.plh prodos/bld/inc/DGRLIB.PLH.TXT
cp inc/fiber.plh prodos/bld/inc/FIBER.PLH.TXT
cp inc/fileio.plh prodos/bld/inc/FILEIO.PLH.TXT

View File

@ -52,13 +52,58 @@ byte hrmask = $81,$83,$87,$8F,$9F,$BF,$FF
word curhclr
word ball0[9] = $0000, $1800, $3C00, $7E00, $7E00, $3C00, $1800, $0000
var err, dx2, dy2, sx, sy
asm grInc(buff)
!SOURCE "vmsrc/plvmzp.inc"
GBASL = $26
GBASH = $27
GBASE = GBASL
GCLR = $30
end
asm divmod7(x)#2
LDA ESTKL,X ; X COORD LSB
LDY ESTKH,X ; X COORD MSB
BNE + ; MUST BE >= 140
CMP #140
BCC ++
+ SEC
SBC #140
LDY #20
++ CMP #70
BCC +
SBC #70
STA ESTKL,X
TYA
ADC #9
TAY
LDA ESTKL,X
+ CMP #35
BCC +
SBC #35
STA ESTKL,X
TYA
ADC #4
TAY
LDA ESTKL,X
+
- CMP #7
BCC +
SBC #7
INY
BNE -
+ DEX
STA ESTKL,X ; REMAINDER
STY ESTKL+1,X ; QUOTIENT
LDA #$00
STA ESTKH,X
STA ESTKH+1,X
RTS
end
def hgrPlot(x, y)#0
word pptr
byte ofst, pixofst, pmask
ofst, pixofst = divmod(x, 7)
ofst, pixofst = divmod7(x)
pptr = (hgrscan[y] | hgr1) + ofst
pmask = hbmask[pixofst]
^pptr = (^pptr & ~pmask) | (curhclr.[ofst & 1] & pmask)
@ -71,9 +116,9 @@ def hgrHlin(x1, x2, y)#0
if x1 == x2
hgrPlot(x1, y)
else
lofst, lpixofst = divmod(x1, 7)
lofst, lpixofst = divmod7(x1)
pptr = (hgrscan[y] | hgr1) + lofst
rofst, rpixofst = divmod(x2, 7)
rofst, rpixofst = divmod7(x2)
lpmask = hlmask[lpixofst]
rpmask = hrmask[rpixofst]
if lofst == rofst
@ -94,14 +139,18 @@ def hgrVlin(y1, y2, x)#0
word pptr, y
byte ofst, pixofst, pmask, cmask
ofst, pixofst = divmod(x, 7)
pmask = hbmask[pixofst]
cmask = curhclr.[ofst & 1] & pmask
pmask = ~pmask
for y = y1 to y2
pptr = (hgrscan[y] | hgr1) + ofst
^pptr = (^pptr & pmask) | cmask
next
if y1 == y2
hgrPlot(x, y1)
else
ofst, pixofst = divmod7(x)
pmask = hbmask[pixofst]
cmask = curhclr.[ofst & 1] & pmask
pmask = ~pmask
for y = y1 to y2
pptr = (hgrscan[y] | hgr1) + ofst
^pptr = (^pptr & pmask) | cmask
next
fin
end
def hgrColor(c)#0
curhclr = hcolor[c & $07]
@ -120,39 +169,11 @@ def hgrBLT(page, x, y, w, h, pSrc)#0
h--
until not h
end
def phline(x1, x2, y)#0
var x
if sx < 0
sy = -sy; x1, x2 = x2, x1
fin
err = dy2 - dx2 / 2
for x = x1 to x2
hgrPlot(x, y)
if err >= 0
err = err - dx2
y = y + sy
fin
err = err + dy2
next
end
def pvline(y1, y2, x)#0
var y
if sy < 0
sx = -sx; y1, y2 = y2, y1
fin
err = dx2 - dy2 / 2
for y = y1 to y2
hgrPlot(x, y)
if err >= 0
err = err - dy2
x = x + sx
fin
err = err + dx2
next
end
def simpleline(x1, y1, x2, y2)#0
var err, dx2, dy2, sx, sy, x, y
word pptr
byte ofst, pixofst, pmask, clr
sx = 1
sy = 1
dx2 = (x2 - x1) * 2
@ -163,10 +184,65 @@ def simpleline(x1, y1, x2, y2)#0
if dy2 < 0
sy = -1; dy2 = -dy2
fin
if dx2 >= dy2
phline(x1, x2, y1)
else
pvline(y1, y2, x1)
if sx < 0
sy = -sy; x1, x2 = x2, x1
fin
err = dy2 - dx2 / 2
ofst, pixofst = divmod7(x1)
pptr = (hgrscan[y1] | hgr1) + ofst
clr = curhclr.[ofst & 1]
for x = x1 to x2
pmask = hbmask[pixofst]
^pptr = (^pptr & ~pmask) | (clr & pmask)
pixofst++
if pixofst > 7
pixofst = 0
pptr++
ofst++
clr = curhclr.[ofst & 1]
fin
if err >= 0
err = err - dx2
y1 = y1 + sy
pptr = (hgrscan[y1] | hgr1) + ofst
fin
err = err + dy2
next
else
if sy < 0
sx = -sx; y1, y2 = y2, y1
fin
err = dx2 - dy2 / 2
ofst, pixofst = divmod7(x1)
clr = curhclr.[ofst & 1]
pmask = hbmask[pixofst]
for y = y1 to y2
pptr = (hgrscan[y] | hgr1) + ofst
^pptr = (^pptr & ~pmask) | (clr & pmask)
if err >= 0
err = err - dy2
if sx > 0
pixofst++
if pixofst > 7
pixofst = 0
ofst++
clr = curhclr.[ofst & 1]
fin
else
if pixofst == 0
pixofst = 7
ofst--
clr = curhclr.[ofst & 1]
else
pixofst--
fin
fin
pmask = hbmask[pixofst]
fin
err = err + dx2
next
fin
end
@ -175,10 +251,10 @@ def testline#0
setlinespans(@hgrHlin, @hgrVlin)
hgrColor(2)
for i = 0 to 191
simpleline(0, 0, i, 191)
simpleline(0, 0, 191, i)
next
//for i = 0 to 191
// simpleline(0, 0, i, 191)
// simpleline(0, 0, 191, i)
//next
memset(hgr1, 0, $2000) // Clear HGR page 1
hgrColor(1);
for i = 0 to 191

View File

@ -8,7 +8,9 @@ echo "BLD/CODEOPT"; atftp $1 --put -l rel/CODEOPT#FE1000 -r $2/BLD/CODEOPT#FE10
echo "BLD/INC/ARGS.PLH"; atftp $1 --put -l inc/args.plh -r $2/BLD/INC/ARGS.PLH#040000
echo "BLD/INC/CMDSYS.PLH"; atftp $1 --put -l inc/cmdsys.plh -r $2/BLD/INC/CMDSYS.PLH#040000
echo "BLD/INC/CONIO.PLH"; atftp $1 --put -l inc/conio.plh -r $2/BLD/INC/CONIO.PLH#040000
echo "BLD/INC/DGR.PLH"; atftp $1 --put -l inc/dgr.plh -r $2/BLD/INC/DGR.PLH#040000
echo "BLD/INC/LINESPANS.PLH"; atftp $1 --put -l inc/linespans.plh -r $2/BLD/INC/LINESPANS.PLH#040000
echo "BLD/INC/GRLIB.PLH"; atftp $1 --put -l inc/grlib.plh -r $2/BLD/INC/GRLIB.PLH#040000
echo "BLD/INC/DGRLIB.PLH"; atftp $1 --put -l inc/dgrlib.plh -r $2/BLD/INC/DGRLIB.PLH#040000
echo "BLD/INC/FIBER.PLH"; atftp $1 --put -l inc/fiber.plh -r $2/BLD/INC/FIBER.PLH#040000
echo "BLD/INC/FILEIO.PLH"; atftp $1 --put -l inc/fileio.plh -r $2/BLD/INC/FILEIO.PLH#040000
echo "BLD/INC/FPSTR.PLH"; atftp $1 --put -l inc/fpstr.plh -r $2/BLD/INC/FPSTR.PLH#040000
@ -34,8 +36,9 @@ echo "BLD/SAMPLES/TEST.PLA"; atftp $1 --put -l samplesrc/test.pla -r $
echo "BLD/SAMPLES/FIBERTEST.PLA"; atftp $1 --put -l samplesrc/fibertest.pla -r $2/BLD/SAMPLES/FIBERTEST.PLA#040000
echo "BLD/SAMPLES/MOUSETEST.PLA"; atftp $1 --put -l samplesrc/mousetest.pla -r $2/BLD/SAMPLES/MOUSETEST.PLA#040000
echo "BLD/SAMPLES/ROD.PLA"; atftp $1 --put -l samplesrc/rod.pla -r $2/BLD/SAMPLES/ROD.PLA#040000
echo "BLD/SAMPLES/GRTEST.PLA"; atftp $1 --put -l samplesrc/grtest.pla -r $2/BLD/SAMPLES/GRTEST.PLA#040000
echo "BLD/SAMPLES/DGRTEST.PLA"; atftp $1 --put -l samplesrc/dgrtest.pla -r $2/BLD/SAMPLES/DGRTEST.PLA#040000
echo "BLD/SAMPLES/HGR1TEST.PLA"; atftp $1 --put -l samplesrc/hgr1test.pla -r $2/BLD/SAMPLES/HGR1TEST.PLA#040000
echo "BLD/SAMPLES/HGRTEST.PLA"; atftp $1 --put -l samplesrc/hgrtest.pla -r $2/BLD/SAMPLES/HGRTEST.PLA#040000
echo "BLD/SAMPLES/PLAYSEQ.PLA"; atftp $1 --put -l samplesrc/playseq.pla -r $2/BLD/SAMPLES/PLAYSEQ.PLA#040000
echo "BLD/SAMPLES/RPNCALC.PLA"; atftp $1 --put -l samplesrc/rpncalc.pla -r $2/BLD/SAMPLES/RPNCALC.PLA#040000
echo "BLD/SAMPLES/SIEVE.PLA"; atftp $1 --put -l samplesrc/sieve.pla -r $2/BLD/SAMPLES/SIEVE.PLA#040000

View File

@ -5,6 +5,7 @@ echo "DEMOS/RPNCALC"; atftp $1 --put -l rel/RPNCALC#FE1000
echo "DEMOS/LZ4CAT"; atftp $1 --put -l rel/LZ4CAT#FE1000 -r $2/DEMOS/LZ4CAT#FE1000
echo "DEMOS/SIEVE"; atftp $1 --put -l rel/SIEVE#FE1000 -r $2/DEMOS/SIEVE#FE1000
echo "DEMOS/ROD"; atftp $1 --put -l rel/apple/ROD#FE1000 -r $2/DEMOS/ROD#FE1000
echo "DEMOS/GRTEST"; atftp $1 --put -l rel/apple/GRTEST#FE1000 -r $2/DEMOS/GRTEST#FE1000
echo "DEMOS/DGRTEST"; atftp $1 --put -l rel/apple/DGRTEST#FE1000 -r $2/DEMOS/DGRTEST#FE1000
# Music demo

View File

@ -23,7 +23,9 @@ echo "SYS/LONGJUMP"; atftp $1 --put -l rel/LONGJMP#FE1000 -r $2/SYS/LONGJMP#FE10
echo "SYS/LZ4"; atftp $1 --put -l rel/LZ4#FE1000 -r $2/SYS/LZ4#FE1000
echo "SYS/MEMMGR"; atftp $1 --put -l rel/MEMMGR#FE1000 -r $2/SYS/MEMMGR#FE1000
echo "SYS/CONIO"; atftp $1 --put -l rel/apple/CONIO#FE1000 -r $2/SYS/CONIO#FE1000
echo "SYS/DGR"; atftp $1 --put -l rel/apple/DGR#FE1000 -r $2/SYS/DGR#FE1000
echo "SYS/LINESPANS"; atftp $1 --put -l rel/apple/LINESPANS#FE1000 -r $2/SYS/LINESPANS#FE1000
echo "SYS/GRLIB"; atftp $1 --put -l rel/apple/GRLIB#FE1000 -r $2/SYS/GRLIB#FE1000
echo "SYS/DGRLIB"; atftp $1 --put -l rel/apple/DGRLIB#FE1000 -r $2/SYS/DGRLIB#FE1000
echo "SYS/FILEIO"; atftp $1 --put -l rel/apple/FILEIO#FE1000 -r $2/SYS/FILEIO#FE1000
echo "SYS/JOYBUZZ"; atftp $1 --put -l rel/apple/JOYBUZZ#FE1000 -r $2/SYS/JOYBUZZ#FE1000
echo "SYS/SNDSEQ"; atftp $1 --put -l rel/apple/SNDSEQ#FE1000 -r $2/SYS/SNDSEQ#FE1000

View File

@ -770,8 +770,25 @@ def cursleft#0
fin
end
def pgleft#0
word i, strptr
strptr = txtlinbuf=>[cursrow]
if curscol > ^strptr
i = ^strptr
else
for i = 1 to ^strptr
if ^(strptr + i) <> keyspace
break
fin
next
i--
if i >= curscol
i = 0
fin
fin
cursoff
if curshpos(curscol - 8)
if curshpos(i)
//if curshpos(curscol - 8)
drawscrn(scrntop, scrnleft)
else
if flags & selection
@ -794,8 +811,25 @@ def cursright#0
fin
end
def pgright#0
word i, strptr
strptr = txtlinbuf=>[cursrow]
if curscol >= ^strptr
i = curscol + 8
else
for i = 1 to ^strptr
if ^(strptr + i) <> keyspace
break
fin
next
i--
if curscol >= i
i = ^strptr
fin
fin
cursoff
if curshpos(curscol + 8)
if curshpos(i)
//if curshpos(curscol + 8)
drawscrn(scrntop, scrnleft)
else
if flags & selection