From 1c39679540c84dd26ea954b30b6837154aa6055f Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Thu, 5 Sep 2024 21:34:48 -0700 Subject: [PATCH] pix7 clipping --- src/inc/dcgrlib.plh | 21 ++++++++++++++------- src/samplesrc/dcgrtest.pla | 36 +++++++++++++++++++----------------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/inc/dcgrlib.plh b/src/inc/dcgrlib.plh index 8c482e4..0122cba 100644 --- a/src/inc/dcgrlib.plh +++ b/src/inc/dcgrlib.plh @@ -1,4 +1,7 @@ import dcgrlib + const SCR_WIDTH7 = 20 + const SCR_WIDTH = 140 + const SCR_HEIGHT = 192 const OP_SRC = 0 const OP_XOR = 1 const OP_AND = 2 @@ -21,14 +24,18 @@ import dcgrlib const DCLR_ACQUA = 14 const DCLR_WHITE = 15 + predef dcgrDivMod7(x)#2 + predef dcgrDiv7(x)#1 predef dcgrColor(c)#0 - predef dcgrPlot(x, y)#0 - predef dcgrHlin(x1, x2, y)#0 - predef dcgrVlin(y1, y2, x)#0 - predef dcgrPixBLT(x, y, w, h, pixptr)#0 - predef dcgrBLTMem(x7, y, w7, h, dstptr)#0 - predef dcgrMemBLT(x7, y, w7, h, srcptr)#0 + predef dcgrPlotScr(x, y)#0 + predef dcgrHlinScr(x1, x2, y)#0 + predef dcgrVlinScr(y1, y2, x)#0 + predef dcgrPixBLTScr(x, y, w, h, pixptr)#0 + predef dcgrScrBLTMem(x7, y, w7, h, dstptr, dstspan)#0 + predef dcgrMemBLTScr(x7, y, w7, h, srcptr, srcspan)#0 + predef dcgrFillScr(x7, y, w7, h)#0 predef dcgrVLB#0 - predef dcgrOp(op)#0 + predef dcgrOpScr(op)#0 + predef dcgrAllocBLKMem(w, h)#3 predef dcgrMode(mode) end diff --git a/src/samplesrc/dcgrtest.pla b/src/samplesrc/dcgrtest.pla index c749643..8b5270a 100644 --- a/src/samplesrc/dcgrtest.pla +++ b/src/samplesrc/dcgrtest.pla @@ -25,34 +25,36 @@ byte[] = $55,$55,$00,$00,$00,$00,$55,$55 byte[] = $55,$55,$00,$00,$00,$00,$55,$55 def dcgrTest#0 - byte i, j, oi, oj, w7 - word pixblk, inci, incj + word i, j, oi7, oj, backw7 + word backblk, backspan, inci, incj - setlineplot(@dcgrPlot) - setlinespans(@dcgrHLin, @dcgrVLin) - for i = 0 to 191 step 4 + setlineplot(@dcgrPlotScr) + setlinespans(@dcgrHLinScr, @dcgrVLinScr) + for i = 0 to 191 step 2 dcgrColor(i) linespans(0, 0, 139, i) next - for i = 139 downto 0 step 4 + for i = 139 downto 0 step 2 dcgrColor(i) linespans(0, 0, i, 191) next + dcgrColor(DCLR_BLACK) + //dcgrFillScr(21/7, 30, 100/7, 132) i = 86; j = 90 - oi = i; oj = j + oi7 = i/7; oj = j inci = 1; incj = 1 - w7 = (16+13)/7 - pixblk = heapalloc(w7*16) - dcgrBLTMem(i/7, j, w7, 16, pixblk) + backblk, backspan, backw7 = dcgrAllocBLKMem(SCR_WIDTH, 16) + dcgrScrBLTMem(0, j, backw7, 16, backblk, backspan) while ^$C000 < 128 - dcgrMemBLT(oi/7, oj, w7, 16, pixblk) - dcgrBLTMem(i/7, j, w7, 16, pixblk) - dcgrPixBLT(i, j, 16, 16, @sprite) - oi = i; oj = j - if i > 125 or i < 2; inci = -inci; fin + dcgrMemBLTScr(oi7, oj, (16+14)/7, 16, backblk + oi7 * 4, backspan) + //dcgrFillScr(oi7, oj, (16+14)/7, 16) + dcgrPixBLTScr(i, j, 16, 16, @sprite) + oi7 = i/7; oj = j + //if i > 125 or i < 2; inci = -inci; fin + if i > 138 or i < -16; inci = -inci; fin i = i + inci - if j > 178 or j < 2; incj = -incj; fin - j = j + incj + //if j > 178 or j < 2; incj = -incj; fin + //j = j + incj loop ^$C010 getc