From f07d0e315b3ebca2ce0465b57d54eed3707c7654 Mon Sep 17 00:00:00 2001 From: Ross Andrews Date: Thu, 2 Feb 2023 23:55:42 -0600 Subject: [PATCH] Animating the display (fuzz demo) --- vweb/src/emulator_display.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vweb/src/emulator_display.jsx b/vweb/src/emulator_display.jsx index b9e7d47..133b579 100644 --- a/vweb/src/emulator_display.jsx +++ b/vweb/src/emulator_display.jsx @@ -8,12 +8,20 @@ export default function({}) { const display = useRef(null) const request = useRef(null) + const blah = useRef(0) + const drawFrame = useCallback(() => { + for(let n = 0; n < 160 * 120; n++) { + cpu.current.poke(0x10000 + n, Math.random() * 256) + } display.current.draw(cpu.current, ctx.current) request.current = requestAnimationFrame(drawFrame) }, []) useEffect(() => { + cpu.current.poke(16 + 0, 3) + cpu.current.poke24(16 + 10, 160) // Set the virtual h / w + cpu.current.poke24(16 + 13, 120) ctx.current = canvas.current.getContext('2d') display.current = new Display() request.current = requestAnimationFrame(drawFrame)