|
1
|
|
package com.rox.ppu; |
|
2
|
|
|
|
3
|
|
import static com.rox.ByteUtil.*; |
|
4
|
|
|
|
5
|
|
/** |
|
6
|
|
* bit 0: grayscale mode |
|
7
|
|
* bit 1: show background in the leftmost 8 pixels |
|
8
|
|
* bit 2: show sprites in the leftmost 8 pixels |
|
9
|
|
* bit 3: show background |
|
10
|
|
* bit 4: show sprites |
|
11
|
|
* bits 5-7: color emphasis (red/green/blue) |
|
12
|
|
*/ |
|
13
|
|
public class PPUMaskRegister { |
|
14
|
|
private static final int SHOW_BACKGROUND_LEFT_BIT = 0x02; //PPUMASK bit 1 |
|
15
|
|
private static final int SHOW_SPRITES_LEFT_BIT = 0x04; //PPUMASK bit 2 |
|
16
|
|
private static final int SHOW_BACKGROUND_BIT = 0x08; //PPUMASK bit 3 |
|
17
|
|
private static final int SHOW_SPRITES_BIT = 0x10; //PPUMASK bit 4 |
|
18
|
|
|
|
19
|
|
private static final int RENDERING_ENABLED_MASK = SHOW_BACKGROUND_BIT | SHOW_SPRITES_BIT; |
|
20
|
|
|
|
21
|
|
private final int value; |
|
22
|
|
|
|
23
|
|
PPUMaskRegister(final int registerValue){ |
|
24
|
1
1. <init> : Replaced bitwise AND with OR → KILLED
|
value = registerValue & BYTE_MASK; |
|
25
|
|
} |
|
26
|
|
|
|
27
|
|
public boolean showBackground(){ |
|
28
|
3
1. showBackground : negated conditional → KILLED
2. showBackground : replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showBackground → KILLED
3. showBackground : Replaced bitwise AND with OR → KILLED
|
return (value & SHOW_BACKGROUND_BIT) != 0; |
|
29
|
|
} |
|
30
|
|
|
|
31
|
|
public boolean showBackgroundLeft(){ |
|
32
|
3
1. showBackgroundLeft : negated conditional → KILLED
2. showBackgroundLeft : replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showBackgroundLeft → KILLED
3. showBackgroundLeft : Replaced bitwise AND with OR → KILLED
|
return (value & SHOW_BACKGROUND_LEFT_BIT) != 0; |
|
33
|
|
} |
|
34
|
|
|
|
35
|
|
public boolean showSpritesLeft(){ |
|
36
|
3
1. showSpritesLeft : negated conditional → KILLED
2. showSpritesLeft : Replaced bitwise AND with OR → KILLED
3. showSpritesLeft : replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showSpritesLeft → KILLED
|
return (value & SHOW_SPRITES_LEFT_BIT) != 0; |
|
37
|
|
} |
|
38
|
|
|
|
39
|
|
public boolean showSprites(){ |
|
40
|
3
1. showSprites : Replaced bitwise AND with OR → KILLED
2. showSprites : negated conditional → KILLED
3. showSprites : replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showSprites → KILLED
|
return (value & SHOW_SPRITES_BIT) != 0; |
|
41
|
|
} |
|
42
|
|
|
|
43
|
|
public boolean renderingEnabled(){ |
|
44
|
3
1. renderingEnabled : negated conditional → KILLED
2. renderingEnabled : replaced boolean return with true for com/rox/ppu/PPUMaskRegister::renderingEnabled → KILLED
3. renderingEnabled : Replaced bitwise AND with OR → KILLED
|
return (value & RENDERING_ENABLED_MASK) != 0; |
|
45
|
|
} |
|
46
|
|
|
|
47
|
|
public int rawValue(){ |
|
48
|
1
1. rawValue : replaced int return with 0 for com/rox/ppu/PPUMaskRegister::rawValue → KILLED
|
return value; |
|
49
|
|
} |
|
50
|
|
} |
| | Mutations |
| 24 |
|
1.1 Location : <init> Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:rawValueReturnsExactlyWhatWasConstructedWith()] Replaced bitwise AND with OR → KILLED
|
| 28 |
|
1.1 Location : showBackground Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showBackgroundReflectsBitThree()] negated conditional → KILLED
2.2 Location : showBackground Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showBackgroundReflectsBitThree()] replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showBackground → KILLED
3.3 Location : showBackground Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showBackgroundReflectsBitThree()] Replaced bitwise AND with OR → KILLED
|
| 32 |
|
1.1 Location : showBackgroundLeft Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showBackgroundLeftReflectsBitOne()] negated conditional → KILLED
2.2 Location : showBackgroundLeft Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showBackgroundLeftReflectsBitOne()] replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showBackgroundLeft → KILLED
3.3 Location : showBackgroundLeft Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showBackgroundLeftReflectsBitOne()] Replaced bitwise AND with OR → KILLED
|
| 36 |
|
1.1 Location : showSpritesLeft Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showSpritesLeftReflectsBitTwo()] negated conditional → KILLED
2.2 Location : showSpritesLeft Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showSpritesLeftReflectsBitTwo()] Replaced bitwise AND with OR → KILLED
3.3 Location : showSpritesLeft Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showSpritesLeftReflectsBitTwo()] replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showSpritesLeft → KILLED
|
| 40 |
|
1.1 Location : showSprites Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showSpritesReflectsBitFour()] Replaced bitwise AND with OR → KILLED
2.2 Location : showSprites Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showSpritesReflectsBitFour()] negated conditional → KILLED
3.3 Location : showSprites Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:showSpritesReflectsBitFour()] replaced boolean return with true for com/rox/ppu/PPUMaskRegister::showSprites → KILLED
|
| 44 |
|
1.1 Location : renderingEnabled Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:renderingEnabledIsTrueWhenOnlyBackgroundIsOn()] negated conditional → KILLED
2.2 Location : renderingEnabled Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:renderingEnabledIsFalseWhenBothBackgroundAndSpritesAreOff()] replaced boolean return with true for com/rox/ppu/PPUMaskRegister::renderingEnabled → KILLED
3.3 Location : renderingEnabled Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:renderingEnabledIsFalseWhenBothBackgroundAndSpritesAreOff()] Replaced bitwise AND with OR → KILLED
|
| 48 |
|
1.1 Location : rawValue Killed by : com.rox.ppu.PPUMaskRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUMaskRegisterTest]/[method:constructorMasksToASingleByte()] replaced int return with 0 for com/rox/ppu/PPUMaskRegister::rawValue → KILLED
|