revamped pixel output draft
This commit is contained in:
+18
-1
@@ -39,8 +39,25 @@ function ESOPExtensions() {
|
||||
height = 48,
|
||||
vramOffset = vm.videoMemOffset,
|
||||
vramSize = vm.videoMemSize,
|
||||
ctx = cnv.getContext('2d', {alpha: false})
|
||||
ctx = cnv.getContext('2d', {alpha: false}),
|
||||
xval = null, yval = null
|
||||
ctx.globalAlpha = 1
|
||||
//setup pixel drawing ports
|
||||
function pixelHook(port, coord, prev) {
|
||||
if(port === 2) xval = coord
|
||||
else if(port === 3) yval = coord
|
||||
if(xval !== null && yval !== null) { //both coordinates set, update the pixel
|
||||
var pxlOffset = yval * width + xval,
|
||||
byteOffset = pxlOffset >>> 3,
|
||||
bitOffset = 7 - pxlOffset + (byteOffset << 3),
|
||||
vramvalue = vm.getram(vramOffset + byteOffset, 1)[0]
|
||||
vm.setram(vramOffset + byteOffset, vramvalue | (1<<bitOffset))
|
||||
xval = yval = null
|
||||
}
|
||||
vm.setdev(port, prev) //preserve the input value
|
||||
}
|
||||
vm.setWriteHook(2, pixelHook) //X
|
||||
vm.setWriteHook(3, pixelHook) //Y
|
||||
//setup screen renderer
|
||||
function renderScreen() {
|
||||
var vram = vm.getram(vramOffset, vramSize),
|
||||
|
||||
Reference in New Issue
Block a user