Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
32x: fix cart test
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Berti committed Dec 14, 2021
1 parent c3cd04e commit 2e6a9a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/sh2/S32XMMREG.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions src/test/java/s32x/S32xSharedRegsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

/**
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2e6a9a5

Please sign in to comment.