EEPROM
This commit is contained in:
@ -12,6 +12,11 @@ public class DataRegister {
|
||||
private static final int PCLATH = 0xA;
|
||||
private static final int INTCON = 0xB;
|
||||
|
||||
private static final int EEDATA = 0x08;
|
||||
private static final int EEADR = 0x09;
|
||||
private static final int EECON1 = 0x88;
|
||||
private static final int EECON2 = 0x89;
|
||||
|
||||
private static final int TRISA = 0x85;
|
||||
private static final int TRISB = 0x86;
|
||||
|
||||
@ -23,6 +28,7 @@ public class DataRegister {
|
||||
|
||||
private static final int [] dataRegister = new int[0xFF];
|
||||
private static final int [] syncedRegisters = {INDF, PCL, STATUS, FSR, PCLATH, INTCON};
|
||||
private static final int [] eepromRegisters = {EEDATA, EEADR, EECON1, EECON2};
|
||||
public static final int [] ioRegisters = {PORTA, PORTB, TRISA, TRISB};
|
||||
|
||||
public static void initDataRegister() {
|
||||
@ -81,6 +87,10 @@ public class DataRegister {
|
||||
IOPorts.setRegister(bank() + address, content);
|
||||
return;
|
||||
}
|
||||
if (Arrays.stream(eepromRegisters).anyMatch(i -> i == address)){
|
||||
EEPROM.parse(bank() + address, content, 0b11);
|
||||
return;
|
||||
}
|
||||
if (fileAddress == PCL || fileAddress == 0x80 + PCL){
|
||||
programCounter = content + (dataRegister[PCLATH] << 8);
|
||||
}
|
||||
@ -112,6 +122,10 @@ public class DataRegister {
|
||||
IOPorts.clearBit(bank() + address, bit);
|
||||
return;
|
||||
}
|
||||
if (Arrays.stream(eepromRegisters).anyMatch(i -> i == address)){
|
||||
EEPROM.parse(bank () + address, bit, 0b00);
|
||||
return;
|
||||
}
|
||||
if (!isSyncedRegister(address)) {
|
||||
if (getBit(address, bit) == 1) {
|
||||
dataRegister[bank() + address] -= (int) Math.pow(2, bit);
|
||||
@ -136,6 +150,10 @@ public class DataRegister {
|
||||
IOPorts.setBit(bank() + address, bit);
|
||||
return;
|
||||
}
|
||||
if (Arrays.stream(eepromRegisters).anyMatch(i -> i == address)){
|
||||
EEPROM.parse(bank () + address, bit, 0b10);
|
||||
return;
|
||||
}
|
||||
if (!isSyncedRegister(address)) {
|
||||
if (getBit(address, bit) == 0) {
|
||||
dataRegister[bank() + address] += (int) Math.pow(2, bit);
|
||||
|
||||
Reference in New Issue
Block a user