From 2e6a9a553f348a7e24de4eeea52da07d0f082373 Mon Sep 17 00:00:00 2001 From: Federico Berti Date: Tue, 14 Dec 2021 10:41:21 +0000 Subject: [PATCH] 32x: fix cart test --- src/main/java/sh2/S32XMMREG.java | 4 ++-- src/test/java/s32x/S32xSharedRegsTest.java | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/sh2/S32XMMREG.java b/src/main/java/sh2/S32XMMREG.java index cd4b4a4..ce6e60a 100644 --- a/src/main/java/sh2/S32XMMREG.java +++ b/src/main/java/sh2/S32XMMREG.java @@ -67,8 +67,8 @@ public class S32XMMREG implements Device { private static final boolean verbose = false, verboseRead = false; - private static final int CART_INSERTED = 0; - private static final int CART_NOT_INSERTED = 1; + public static final int CART_INSERTED = 0; + public static final int CART_NOT_INSERTED = 1; //0 = cart inserted, 1 = otherwise private int cart = CART_NOT_INSERTED; diff --git a/src/test/java/s32x/S32xSharedRegsTest.java b/src/test/java/s32x/S32xSharedRegsTest.java index 43f0984..45c431f 100644 --- a/src/test/java/s32x/S32xSharedRegsTest.java +++ b/src/test/java/s32x/S32xSharedRegsTest.java @@ -11,6 +11,8 @@ import sh2.sh2.device.IntC; import static s32x.MarsRegTestUtil.*; +import static sh2.S32XMMREG.CART_INSERTED; +import static sh2.S32XMMREG.CART_NOT_INSERTED; import static sh2.S32xUtil.CpuDeviceAccess.*; /** @@ -64,19 +66,19 @@ private void testFm(S32xUtil.CpuDeviceAccess sh2Access) { @Test public void testCart() { + int cartSize = 0x100; //defaults to 0 - checkCart(0); + checkCart(CART_INSERTED); //cart inserted - int cart = 1; - s32XMMREG.setCart(cart); - int exp = cart << 8; + s32XMMREG.setCart(cartSize); + int exp = CART_INSERTED << 8; checkCart(exp); - //cart removed + //cart removed, size = 0 s32XMMREG.setCart(0); - checkCart(0); + checkCart(CART_NOT_INSERTED << 8); } @Test