Well with asm, you don't have to use commands. You can just test/set the pixels directly, making it faster. Day 24 of the 28 days tells you most of what you should know about testing/setting pixels. If the pixel-coordinate is a constant (not likely, but who knows?) you could just use the bit/set instructions. Theoretically it's also possible for non-constant coordinates, but not usually a good plan (smc or a large switch block for something so simple?)
Now that I think about it, maybe smc
would be viable alternative..
Maybe something like this?
Code: Select all
CheckPixel:
;returns Z if white, NZ if black
;A = x coordinate
;L = y coordinate
;coordinates must be inside the valid range for the result to make sense
ld h,0
ld d,h
ld e,l
add hl,hl
add hl,de
add hl,hl
add hl,hl
ld e,a
srl e
srl e
srl e
add hl,de
ld de,PlotScreen
add hl,de
and 7
add a,a
add a,a
add a,a
or $46
ld (bit+1),a
bit:
bit 0,(hl)
ret
Ok maybe not such a good plan after all, this is huge, and mostly a copy of GetPixel.. But no loop (which can only be up to 7 iterations long anyway..)