timer0 Interrupt fully working

This commit is contained in:
Darkress
2023-06-18 19:24:40 +02:00
parent 60b288a762
commit 791201c884
3 changed files with 4 additions and 2 deletions

View File

@@ -26,6 +26,8 @@ public class Cli
System.out.printf("%s:\t\t%s\t", "PortA", Integer.toBinaryString(Memory.getPortA()));
System.out.printf("%s:\t\t%s\t", "PortB", Integer.toBinaryString(Memory.getPortB()));
System.out.printf("%n");
printf(Memory.getRegister(0x0B), "IntCon", true);
System.out.printf("%n");
}
private static void printf(int value, String description, boolean hex) {

View File

@@ -3,7 +3,7 @@ package de.darkress.pic16f84sim.microcontroller;
public class Interrupt
{
private static boolean globalInterruptEnabled() {
return (Memory.getRegister(0x0B) & 0x80) == 0x80;
return (Memory.getRegister(0x0B) & 0x80) == 0x80; // Check GIE
}
public static boolean checkTimerInterruptConditions() {

View File

@@ -43,7 +43,7 @@ public class Timer
{
int timerRegister = Memory.getRegister(0x01);
timerRegister = (timerRegister + 1) % 256;
if(timerRegister == 0 && !((Memory.getRegister(0x0B) & 0x04) == 0x04)) //check for timer Overflow --> interrupt
if(timerRegister == 0)// && !((Memory.getRegister(0x0B) & 0x04) == 0x04)) //check for timer Overflow --> interrupt
{
System.out.println("Timer Overflow");
Memory.setRegister(0x0B, Memory.getRegister(0x0B) | 0x04); //set T0IF