diff --git a/images/apple/DCGR-TK.PO b/images/apple/DCGR-TK.PO index 4a4597b..a0e21ea 100755 Binary files a/images/apple/DCGR-TK.PO and b/images/apple/DCGR-TK.PO differ diff --git a/src/inc/dcgrlib.plh b/src/inc/dcgrlib.plh index a7c4a7e..57e40cc 100644 --- a/src/inc/dcgrlib.plh +++ b/src/inc/dcgrlib.plh @@ -28,6 +28,7 @@ import dcgrlib predef dcgrColor(c)#0 predef dcgrPlot(x, y)#0 + predef dcgrPixel(x, y)#1 predef dcgrHLin(x1, x2, y)#0 predef dcgrVLin(y1, y2, x)#0 predef dcgrBitMap(x, y, bitw, bith, bitptr)#0 diff --git a/src/inc/dcgrutils.plh b/src/inc/dcgrutils.plh index c729efe..d0682e0 100644 --- a/src/inc/dcgrutils.plh +++ b/src/inc/dcgrutils.plh @@ -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 dcgrGetPixMap(x, y, w, h)#1 predef dhgrSet(dhx, y)#0 predef dhgrUnset(dhx, y)#0 predef spriteRead(filestr)#5 diff --git a/src/libsrc/apple/dcgrlib.pla b/src/libsrc/apple/dcgrlib.pla index b71ab0b..ef617be 100644 --- a/src/libsrc/apple/dcgrlib.pla +++ b/src/libsrc/apple/dcgrlib.pla @@ -2122,6 +2122,38 @@ export def dcgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0 next end // +// Read pixel and return color +// +export def dcgrPixel(x, y)#1 + byte x7, m7, i + word[2] pix7, clr7 + word amask, mmask + + x7 = divmod7[x] >> 3 + if dcgrSurface // Memory + dcgrMemBl7Mem(x7, y, surfWidth, surfHeight, surfPtr, surfSpan, 1, 1, @pix7) + else // Screen + dcgrScrBl7Mem(x7, y, 1, 1, @pix7, 4) + fin + m7 = divmod7[x] & $07 + amask = auxclrmsk[m7] + if amask & $80; amask = (amask & $7F) << 8; fin + mmask = memclrmsk[m7] + if mmask & $80; mmask = (mmask & $7F) << 8; fin + pix7[0] = pix7[0] & amask + pix7[1] = pix7[1] & mmask + for i = 0 to 15 +// clr7[0] = (auxclrsl[i] | (auxclrsh[i] << 8)) & amask +// clr7[1] = (memclrsl[i] | (memclrsh[i] << 8)) & mmask +// if pix7[0] == clr7[0] and pix7[1] == clr7[1] + if pix7[0] == (auxclrsl[i] | (auxclrsh[i] << 8)) & amask + if pix7[1] == (memclrsl[i] | (memclrsh[i] << 8)) & mmask + return i // Color match + fin; fin + next + return 15 +end +// // Hack to extend parameters for memory functions // def extPlotMem#0 diff --git a/src/libsrc/apple/dcgrutils.pla b/src/libsrc/apple/dcgrutils.pla index 4245ce4..7044cc7 100644 --- a/src/libsrc/apple/dcgrutils.pla +++ b/src/libsrc/apple/dcgrutils.pla @@ -126,6 +126,21 @@ export def dcgrRect(x, y, w, h)#0 dcgrHLin(x, x2, v) next end +export def dcgrGetPixMap(x, y, w, h)#1 + var pixmap, pixptr + byte i, j + + pixmap = heapalloc((w + 1)/2 * h) + pixptr = pixmap + w--; h-- + for j = 0 to h + for i = 0 to w step 2 + ^pixptr = dcgrPixel(i+x, j+y) | (dcgrPixel(i+x+1, j+y) << 4) + pixptr++ + next + next + return pixmap +end export def dhgrSet(dhx, y)#0 dcgrColor(dhgrPix[dhx & $03]) dcgrOp(OP_OR) diff --git a/src/mkrel b/src/mkrel index 3b467e9..13cf5cf 100755 --- a/src/mkrel +++ b/src/mkrel @@ -112,6 +112,7 @@ 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 samplesrc/ENT.* prodos/demos/apple2/dcgr +cp samplesrc/MONARCH.BIN prodos/demos/apple2/dcgr mkdir prodos/demos/apple2/spiders cp rel/apple/SFM#FE1000 prodos/demos/apple2/spiders/SFM.REL diff --git a/src/samplesrc/MONARCH.BIN b/src/samplesrc/MONARCH.BIN new file mode 100644 index 0000000..8812c4b Binary files /dev/null and b/src/samplesrc/MONARCH.BIN differ diff --git a/src/samplesrc/dcgrtest.pla b/src/samplesrc/dcgrtest.pla index c68a3e0..34213dc 100644 --- a/src/samplesrc/dcgrtest.pla +++ b/src/samplesrc/dcgrtest.pla @@ -122,7 +122,6 @@ def dcgrCompMask(offset)#0 dcgrMemBl7(sprite7w, i * SPR_H, sprite7w, SPR_H, sprite7msk[i], sprite7span) next end - def readEnterprise#0 var xorg, yorg, width, height, pixptr, t_ptr, f_ptr byte i @@ -145,7 +144,6 @@ def readEnterprise#0 f_ptr = f_ptr + 12 next end - //////////////////////////////////////////////////////////////// // // // Test Harness // @@ -159,10 +157,7 @@ def dhgrTest#0 // dcgrSurfScr(OP_OR) setlineplot(@dhgrSet) - for i = 0 to 191 step 4 - line(0, 0, 559, i) - next - for i = 559 downto 0 step 7 + for i = 559 downto 0 step 20 line(0, 0, i, 191) next getc @@ -441,6 +436,9 @@ end dcgrMode(0) dhgrTest screenRead("monarch") +dcgrOp(OP_SRC) +dcgrPixMap(10, 10, 20, 20, dcgrGetPixMap(60, 66, 20, 20)) +getc readEnterprise dcgrCompSprite(2) dcgrCompMask(2)