From cb53a637c14ccbf24f473e446599eef7655957fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Jos=C3=A9=20de=20Oliveira?= Date: Sat, 30 Dec 2023 18:34:31 -0300 Subject: [PATCH] fix(graphics): resolve scroll and high resolution issues --- cli/roms/test/Test128.ch8 | Bin 280 -> 0 bytes cli/roms/test/scroll.ch8 | Bin 38 -> 0 bytes cli/roms/test/scroll2.ch8 | Bin 90 -> 0 bytes core/cpu/cpu.go | 8 ++++---- 4 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 cli/roms/test/Test128.ch8 delete mode 100644 cli/roms/test/scroll.ch8 delete mode 100644 cli/roms/test/scroll2.ch8 diff --git a/cli/roms/test/Test128.ch8 b/cli/roms/test/Test128.ch8 deleted file mode 100644 index c08fc64c5e2238544f3b202fdb99089b5d0b147b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 280 zcmZSh&+s6HA(bJ`ZqcnPL06JWI9wWpB!qYt-2sX+rPW=Dx)xQ+Xnz@0w8$sZq>Urs~$7};kp&;7QK7t<>mG2K?6|2?~tFzy9cYD Mta|XO>)oP907eI%bpQYW diff --git a/cli/roms/test/scroll.ch8 b/cli/roms/test/scroll.ch8 deleted file mode 100644 index 1aafb8b882b3a88983d06297125063f3d6a85528..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 38 ucmZSh&+spsHHTYCj^TGTqqT()7sH?G|JDpbLP~N%T(?gh<@{>E@D2d&6%674 diff --git a/cli/roms/test/scroll2.ch8 b/cli/roms/test/scroll2.ch8 deleted file mode 100644 index fd2255ba59f3aba42f5b75e805491dc9bbd3ce09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90 zcmZSh&+spsHHTYCj^TGTqqT()7sH?G|JDpbLP~N%T(?gh<#c6O5a7zVAj*|#L5eH$ nf;?B21r@HW3z}Tn7WBBXFPP@av0#BK=YmzYPcgjv&wu~`HcuR4 diff --git a/core/cpu/cpu.go b/core/cpu/cpu.go index e149043..53d5e95 100644 --- a/core/cpu/cpu.go +++ b/core/cpu/cpu.go @@ -80,9 +80,9 @@ func (cpu *CPU) clock() { switch opcode.instruction { case 0x0000: - switch opcode.registerY { - case 0xC: + if opcode.registerY == 0xC { cpu.scd(opcode.n) + return } switch opcode.nnn { @@ -330,8 +330,8 @@ func (cpu *CPU) ldm(vIndex uint8) { } func (cpu *CPU) drw(oc *opcode) { - x := cpu.v[oc.registerX] & 0x3F - y := cpu.v[oc.registerY] & 0x1F + x := cpu.v[oc.registerX] & (byte(cpu.Graphics.Width - 1)) + y := cpu.v[oc.registerY] & (byte(cpu.Graphics.Height - 1)) cpu.v[0xF] = 0x00 for i := 0; uint8(i) < oc.n; i++ {