Initialize Component Management
This commit is contained in:
@ -6,7 +6,7 @@ import fabrik.simulator.pic16f84.interfaces.IOPortInterface;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class DataRegister implements DataRegisterInterface {
|
||||
public class DataRegister extends PICComponent implements DataRegisterInterface {
|
||||
private final int INDF = 0x0;
|
||||
private final int PCL = 0x2;
|
||||
private final int STATUS = 0x3;
|
||||
@ -34,18 +34,18 @@ public class DataRegister implements DataRegisterInterface {
|
||||
private final int [] syncedRegisters = {INDF, PCL, STATUS, FSR, PCLATH, INTCON};
|
||||
private final int [] eepromRegisters = {EEDATA, EEADR, EECON1, EECON2};
|
||||
public final int [] ioRegisters = {PORTA, PORTB, TRISA, TRISB};
|
||||
|
||||
private final EEPROMInterface eeprom;
|
||||
private final PreScaler preScaler;
|
||||
private final IOPortInterface ioPorts;
|
||||
|
||||
public DataRegister (EEPROMInterface eeprom, PreScaler preScaler, IOPortInterface ioPorts) {
|
||||
this.eeprom = eeprom;
|
||||
this.preScaler = preScaler;
|
||||
this.ioPorts = ioPorts;
|
||||
initOrReset();
|
||||
|
||||
public DataRegister () {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(PICComponents picComponents) {
|
||||
super.initialize(picComponents);
|
||||
System.out.println("DataRegister.\n");
|
||||
initOrReset();
|
||||
}
|
||||
|
||||
private void initOrReset () {
|
||||
dataRegister[PCL] = 0b0;
|
||||
@ -62,7 +62,7 @@ public class DataRegister implements DataRegisterInterface {
|
||||
carryFlag = 0;
|
||||
zeroFlag = 0;
|
||||
digitCarryFlag = 0;
|
||||
ioPorts.resetTRIS();
|
||||
super.ioPorts.resetTRIS();
|
||||
System.out.println(Arrays.toString(dataRegister));
|
||||
}
|
||||
|
||||
@ -350,7 +350,6 @@ public class DataRegister implements DataRegisterInterface {
|
||||
public int getDirectRegister(int address) {
|
||||
return dataRegister[address];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user