mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-07 15:31:49 +00:00
Add pixel read routine
This commit is contained in:
parent
27da5dca92
commit
50a4fbc230
Binary file not shown.
@ -28,6 +28,7 @@ import dcgrlib
|
|||||||
|
|
||||||
predef dcgrColor(c)#0
|
predef dcgrColor(c)#0
|
||||||
predef dcgrPlot(x, y)#0
|
predef dcgrPlot(x, y)#0
|
||||||
|
predef dcgrPixel(x, y)#1
|
||||||
predef dcgrHLin(x1, x2, y)#0
|
predef dcgrHLin(x1, x2, y)#0
|
||||||
predef dcgrVLin(y1, y2, x)#0
|
predef dcgrVLin(y1, y2, x)#0
|
||||||
predef dcgrBitMap(x, y, bitw, bith, bitptr)#0
|
predef dcgrBitMap(x, y, bitw, bith, bitptr)#0
|
||||||
|
@ -6,6 +6,7 @@ import dcgrutils
|
|||||||
predef dcgrBoldStr(clr, x, y, strptr)#0
|
predef dcgrBoldStr(clr, x, y, strptr)#0
|
||||||
predef dcgrFont(font)#0
|
predef dcgrFont(font)#0
|
||||||
predef dcgrRect(x, y, w, h)#0
|
predef dcgrRect(x, y, w, h)#0
|
||||||
|
predef dcgrGetPixMap(x, y, w, h)#1
|
||||||
predef dhgrSet(dhx, y)#0
|
predef dhgrSet(dhx, y)#0
|
||||||
predef dhgrUnset(dhx, y)#0
|
predef dhgrUnset(dhx, y)#0
|
||||||
predef spriteRead(filestr)#5
|
predef spriteRead(filestr)#5
|
||||||
|
@ -2122,6 +2122,38 @@ export def dcgrMemBl7Tile(x7, y, memptr, memspan, tileptr)#0
|
|||||||
next
|
next
|
||||||
end
|
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
|
// Hack to extend parameters for memory functions
|
||||||
//
|
//
|
||||||
def extPlotMem#0
|
def extPlotMem#0
|
||||||
|
@ -126,6 +126,21 @@ export def dcgrRect(x, y, w, h)#0
|
|||||||
dcgrHLin(x, x2, v)
|
dcgrHLin(x, x2, v)
|
||||||
next
|
next
|
||||||
end
|
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
|
export def dhgrSet(dhx, y)#0
|
||||||
dcgrColor(dhgrPix[dhx & $03])
|
dcgrColor(dhgrPix[dhx & $03])
|
||||||
dcgrOp(OP_OR)
|
dcgrOp(OP_OR)
|
||||||
|
@ -112,6 +112,7 @@ cp rel/apple/DGRTEST#FE1000 prodos/demos/apple2/DGRTEST.REL
|
|||||||
mkdir prodos/demos/apple2/dcgr
|
mkdir prodos/demos/apple2/dcgr
|
||||||
cp rel/apple/DCGRTEST#FE1000 prodos/demos/apple2/dcgr/DCGRTEST.REL
|
cp rel/apple/DCGRTEST#FE1000 prodos/demos/apple2/dcgr/DCGRTEST.REL
|
||||||
cp samplesrc/ENT.* prodos/demos/apple2/dcgr
|
cp samplesrc/ENT.* prodos/demos/apple2/dcgr
|
||||||
|
cp samplesrc/MONARCH.BIN prodos/demos/apple2/dcgr
|
||||||
|
|
||||||
mkdir prodos/demos/apple2/spiders
|
mkdir prodos/demos/apple2/spiders
|
||||||
cp rel/apple/SFM#FE1000 prodos/demos/apple2/spiders/SFM.REL
|
cp rel/apple/SFM#FE1000 prodos/demos/apple2/spiders/SFM.REL
|
||||||
|
BIN
src/samplesrc/MONARCH.BIN
Normal file
BIN
src/samplesrc/MONARCH.BIN
Normal file
Binary file not shown.
@ -122,7 +122,6 @@ def dcgrCompMask(offset)#0
|
|||||||
dcgrMemBl7(sprite7w, i * SPR_H, sprite7w, SPR_H, sprite7msk[i], sprite7span)
|
dcgrMemBl7(sprite7w, i * SPR_H, sprite7w, SPR_H, sprite7msk[i], sprite7span)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
def readEnterprise#0
|
def readEnterprise#0
|
||||||
var xorg, yorg, width, height, pixptr, t_ptr, f_ptr
|
var xorg, yorg, width, height, pixptr, t_ptr, f_ptr
|
||||||
byte i
|
byte i
|
||||||
@ -145,7 +144,6 @@ def readEnterprise#0
|
|||||||
f_ptr = f_ptr + 12
|
f_ptr = f_ptr + 12
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// Test Harness //
|
// Test Harness //
|
||||||
@ -159,10 +157,7 @@ def dhgrTest#0
|
|||||||
//
|
//
|
||||||
dcgrSurfScr(OP_OR)
|
dcgrSurfScr(OP_OR)
|
||||||
setlineplot(@dhgrSet)
|
setlineplot(@dhgrSet)
|
||||||
for i = 0 to 191 step 4
|
for i = 559 downto 0 step 20
|
||||||
line(0, 0, 559, i)
|
|
||||||
next
|
|
||||||
for i = 559 downto 0 step 7
|
|
||||||
line(0, 0, i, 191)
|
line(0, 0, i, 191)
|
||||||
next
|
next
|
||||||
getc
|
getc
|
||||||
@ -441,6 +436,9 @@ end
|
|||||||
dcgrMode(0)
|
dcgrMode(0)
|
||||||
dhgrTest
|
dhgrTest
|
||||||
screenRead("monarch")
|
screenRead("monarch")
|
||||||
|
dcgrOp(OP_SRC)
|
||||||
|
dcgrPixMap(10, 10, 20, 20, dcgrGetPixMap(60, 66, 20, 20))
|
||||||
|
getc
|
||||||
readEnterprise
|
readEnterprise
|
||||||
dcgrCompSprite(2)
|
dcgrCompSprite(2)
|
||||||
dcgrCompMask(2)
|
dcgrCompMask(2)
|
||||||
|
Loading…
Reference in New Issue
Block a user