Latched8BitMemoryBus.java

1
package com.rox.mem;
2
3
/**
4
 * 16bit addressed, 8bit data memory
5
 */
6
public class Latched8BitMemoryBus implements LatchedMemoryBus {
7
    private final MemoryBus memoryBus; //XXX: Should probably make this MemoryBus8Bit which would do the masking for us
8
    private int addressedMemory;
9
10
    public final static int ADDRESS_MASK = 0xFFFF;
11
    public final static int DATA_MASK = 0xFF;
12
13
    public Latched8BitMemoryBus(final MemoryBus memoryBus){
14
        this.memoryBus = memoryBus;
15
    }
16
17
    @Override
18
    public void loadMemoryAddress(final int memory) {
19 1 1. loadMemoryAddress : Replaced bitwise AND with OR → KILLED
        this.addressedMemory = memory & ADDRESS_MASK;
20
    }
21
22
    @Override
23
    public int getAddressedMemory(){
24 2 1. getAddressedMemory : Replaced bitwise AND with OR → KILLED
2. getAddressedMemory : replaced int return with 0 for com/rox/mem/Latched8BitMemoryBus::getAddressedMemory → KILLED
        return this.addressedMemory & ADDRESS_MASK;
25
    }
26
27
    @Override
28
    public int fetch() {
29 1 1. fetch : replaced int return with 0 for com/rox/mem/Latched8BitMemoryBus::fetch → KILLED
        return memoryBus.read(addressedMemory);
30
    }
31
32
    @Override
33
    public void store(final int value) {
34 2 1. store : Replaced bitwise AND with OR → KILLED
2. store : removed call to com/rox/mem/MemoryBus::write → KILLED
        memoryBus.write(addressedMemory, value & DATA_MASK);
35
    }
36
}

Mutations

19

1.1
Location : loadMemoryAddress
Killed by : com.rox.mem.Latched8BitMemoryBusTest.[engine:jqwik]/[class:com.rox.mem.Latched8BitMemoryBusTest]/[property:fetchValidAddress(int)]
Replaced bitwise AND with OR → KILLED

24

1.1
Location : getAddressedMemory
Killed by : com.rox.cpu.mos6502.MOS6502MicroOpTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.MOS6502MicroOpTest]/[method:addressMemPointerEndToEnd()]
Replaced bitwise AND with OR → KILLED

2.2
Location : getAddressedMemory
Killed by : com.rox.cpu.mos6502.MOS6502MicroOpTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.MOS6502MicroOpTest]/[method:addressMemPointerEndToEnd()]
replaced int return with 0 for com/rox/mem/Latched8BitMemoryBus::getAddressedMemory → KILLED

29

1.1
Location : fetch
Killed by : com.rox.cpu.mos6502.MOS6502MicroOpTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.MOS6502MicroOpTest]/[method:dummyWriteMemWritesBackTheSameValue()]
replaced int return with 0 for com/rox/mem/Latched8BitMemoryBus::fetch → KILLED

34

1.1
Location : store
Killed by : com.rox.mem.Latched8BitMemoryBusTest.[engine:jqwik]/[class:com.rox.mem.Latched8BitMemoryBusTest]/[property:invalidValueStorageWrapsIt(int, int)]
Replaced bitwise AND with OR → KILLED

2.2
Location : store
Killed by : com.rox.mem.Latched8BitMemoryBusTest.[engine:jqwik]/[class:com.rox.mem.Latched8BitMemoryBusTest]/[property:invalidValueStorageWrapsIt(int, int)]
removed call to com/rox/mem/MemoryBus::write → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1