|
1
|
|
package com.rox.ppu; |
|
2
|
|
|
|
3
|
|
import static com.rox.ByteUtil.BYTE_MASK; |
|
4
|
|
|
|
5
|
|
/** |
|
6
|
|
* VPHB SINN |
|
7
|
|
* V (bit 7): NMI enable |
|
8
|
|
* P (bit 6): PPU master/slave select - unmodeled |
|
9
|
|
* H (bit 5): sprite size (0=8x8, 1=8x16) |
|
10
|
|
* B (bit 4): background pattern table select (0=$0000, 1=$1000) |
|
11
|
|
* S (bit 3): sprite pattern table select for 8x8 sprites - ignored in 8x16 mode, where the tile |
|
12
|
|
* index's own low bit selects the table instead (0=$0000, 1=$1000) |
|
13
|
|
* I (bit 2): VRAM address increment per $2007 access (0=+1, 1=+32) |
|
14
|
|
* NN (bits 1-0): base nametable select (0-3) |
|
15
|
|
*/ |
|
16
|
|
public class PPUControlRegister { |
|
17
|
|
private static final int NMI_ENABLE_BIT = 0x80; |
|
18
|
|
private static final int SPRITE_SIZE_BIT = 0x20; |
|
19
|
|
private static final int BACKGROUND_PATTERN_TABLE_SELECT_BIT = 0x10; |
|
20
|
|
private static final int SPRITE_PATTERN_TABLE_SELECT_BIT = 0x08; |
|
21
|
|
private static final int VRAM_INCREMENT_BIT = 0x04; |
|
22
|
|
private static final int NAMETABLE_SELECT_MASK = 0x03; |
|
23
|
|
|
|
24
|
|
private static final int PATTERN_TABLE_SIZE = 0x1000; |
|
25
|
|
private static final int VRAM_INCREMENT_32 = 32; |
|
26
|
|
private static final int VRAM_INCREMENT_1 = 1; |
|
27
|
|
|
|
28
|
|
private final int value; |
|
29
|
|
|
|
30
|
|
PPUControlRegister(final int registerValue){ |
|
31
|
1
1. <init> : Replaced bitwise AND with OR → KILLED
|
value = registerValue & BYTE_MASK; |
|
32
|
|
} |
|
33
|
|
|
|
34
|
|
public boolean nmiEnabled(){ |
|
35
|
3
1. nmiEnabled : negated conditional → KILLED
2. nmiEnabled : replaced boolean return with true for com/rox/ppu/PPUControlRegister::nmiEnabled → KILLED
3. nmiEnabled : Replaced bitwise AND with OR → KILLED
|
return (value & NMI_ENABLE_BIT) != 0; |
|
36
|
|
} |
|
37
|
|
|
|
38
|
|
public boolean tallSprites(){ |
|
39
|
3
1. tallSprites : replaced boolean return with true for com/rox/ppu/PPUControlRegister::tallSprites → KILLED
2. tallSprites : Replaced bitwise AND with OR → KILLED
3. tallSprites : negated conditional → KILLED
|
return (value & SPRITE_SIZE_BIT) != 0; |
|
40
|
|
} |
|
41
|
|
|
|
42
|
|
public int backgroundPatternTableBase(){ |
|
43
|
2
1. backgroundPatternTableBase : Replaced bitwise AND with OR → KILLED
2. backgroundPatternTableBase : negated conditional → KILLED
|
return (value & BACKGROUND_PATTERN_TABLE_SELECT_BIT) != 0 ? PATTERN_TABLE_SIZE : 0; |
|
44
|
|
} |
|
45
|
|
|
|
46
|
|
/** Only meaningful for 8x8 sprites - 8x16 sprites pick their table from the tile index's own low bit instead. */ |
|
47
|
|
public int spritePatternTableBase(){ |
|
48
|
2
1. spritePatternTableBase : negated conditional → KILLED
2. spritePatternTableBase : Replaced bitwise AND with OR → KILLED
|
return (value & SPRITE_PATTERN_TABLE_SELECT_BIT) != 0 ? PATTERN_TABLE_SIZE : 0; |
|
49
|
|
} |
|
50
|
|
|
|
51
|
|
public int vramIncrement(){ |
|
52
|
3
1. vramIncrement : replaced int return with 0 for com/rox/ppu/PPUControlRegister::vramIncrement → KILLED
2. vramIncrement : negated conditional → KILLED
3. vramIncrement : Replaced bitwise AND with OR → KILLED
|
return (value & VRAM_INCREMENT_BIT) != 0 ? VRAM_INCREMENT_32 : VRAM_INCREMENT_1; |
|
53
|
|
} |
|
54
|
|
|
|
55
|
|
public int nametableSelect(){ |
|
56
|
2
1. nametableSelect : replaced int return with 0 for com/rox/ppu/PPUControlRegister::nametableSelect → KILLED
2. nametableSelect : Replaced bitwise AND with OR → KILLED
|
return value & NAMETABLE_SELECT_MASK; |
|
57
|
|
} |
|
58
|
|
|
|
59
|
|
public int rawValue(){ |
|
60
|
1
1. rawValue : replaced int return with 0 for com/rox/ppu/PPUControlRegister::rawValue → KILLED
|
return value; |
|
61
|
|
} |
|
62
|
|
} |
| | Mutations |
| 31 |
|
1.1 Location : <init> Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:constructorMasksToASingleByte()] Replaced bitwise AND with OR → KILLED
|
| 35 |
|
1.1 Location : nmiEnabled Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:nmiEnabledReflectsBitSeven()] negated conditional → KILLED
2.2 Location : nmiEnabled Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:nmiEnabledReflectsBitSeven()] replaced boolean return with true for com/rox/ppu/PPUControlRegister::nmiEnabled → KILLED
3.3 Location : nmiEnabled Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:nmiEnabledReflectsBitSeven()] Replaced bitwise AND with OR → KILLED
|
| 39 |
|
1.1 Location : tallSprites Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:tallSpritesReflectsBitFive()] replaced boolean return with true for com/rox/ppu/PPUControlRegister::tallSprites → KILLED
2.2 Location : tallSprites Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:tallSpritesReflectsBitFive()] Replaced bitwise AND with OR → KILLED
3.3 Location : tallSprites Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:tallSpritesReflectsBitFive()] negated conditional → KILLED
|
| 43 |
|
1.1 Location : backgroundPatternTableBase Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:backgroundPatternTableBaseSelectsBetweenZeroAndOneThousand()] Replaced bitwise AND with OR → KILLED
2.2 Location : backgroundPatternTableBase Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:backgroundPatternTableBaseSelectsBetweenZeroAndOneThousand()] negated conditional → KILLED
|
| 48 |
|
1.1 Location : spritePatternTableBase Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:spritePatternTableBaseSelectsBetweenZeroAndOneThousand()] negated conditional → KILLED
2.2 Location : spritePatternTableBase Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:spritePatternTableBaseSelectsBetweenZeroAndOneThousand()] Replaced bitwise AND with OR → KILLED
|
| 52 |
|
1.1 Location : vramIncrement Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:vramIncrementIsThirtyTwoWhenBitSetOtherwiseOne()] replaced int return with 0 for com/rox/ppu/PPUControlRegister::vramIncrement → KILLED
2.2 Location : vramIncrement Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:vramIncrementIsThirtyTwoWhenBitSetOtherwiseOne()] negated conditional → KILLED
3.3 Location : vramIncrement Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:vramIncrementIsThirtyTwoWhenBitSetOtherwiseOne()] Replaced bitwise AND with OR → KILLED
|
| 56 |
|
1.1 Location : nametableSelect Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:nametableSelectReflectsTheLowTwoBitsOnly()] replaced int return with 0 for com/rox/ppu/PPUControlRegister::nametableSelect → KILLED
2.2 Location : nametableSelect Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:nametableSelectReflectsTheLowTwoBitsOnly()] Replaced bitwise AND with OR → KILLED
|
| 60 |
|
1.1 Location : rawValue Killed by : com.rox.ppu.PPUControlRegisterTest.[engine:junit-jupiter]/[class:com.rox.ppu.PPUControlRegisterTest]/[method:rawValueReturnsExactlyWhatWasConstructedWith()] replaced int return with 0 for com/rox/ppu/PPUControlRegister::rawValue → KILLED
|