Timer interrupt
This commit is contained in:
parent
191c10327f
commit
bb37de8eb4
@ -66,6 +66,8 @@ namespace PIC_Simulator.PIC
|
|||||||
public const uint INTCON_BIT_INTF = 1; // RB0/INT Interrupt Flag Bit
|
public const uint INTCON_BIT_INTF = 1; // RB0/INT Interrupt Flag Bit
|
||||||
public const uint INTCON_BIT_RBIF = 0; // RB Port Change Interrupt Flag Bit
|
public const uint INTCON_BIT_RBIF = 0; // RB Port Change Interrupt Flag Bit
|
||||||
|
|
||||||
|
public const uint INTERRUPT_SERVICE_ADDRESS = 0x04;
|
||||||
|
|
||||||
|
|
||||||
public const string ADDWF = "000111dfffffff";
|
public const string ADDWF = "000111dfffffff";
|
||||||
public const string ANDWF = "000101dfffffff";
|
public const string ANDWF = "000101dfffffff";
|
||||||
@ -650,6 +652,7 @@ namespace PIC_Simulator.PIC
|
|||||||
|
|
||||||
Stack.Push((uint) PCCounter);
|
Stack.Push((uint) PCCounter);
|
||||||
PCCounter = (int) (aktueller_befehl.parameter_k - 1);
|
PCCounter = (int) (aktueller_befehl.parameter_k - 1);
|
||||||
|
cycleCount = 2;
|
||||||
}
|
}
|
||||||
else if (aktueller_befehl.befehl == CLRWDT)
|
else if (aktueller_befehl.befehl == CLRWDT)
|
||||||
{
|
{
|
||||||
@ -710,7 +713,9 @@ namespace PIC_Simulator.PIC
|
|||||||
// (INTCON < 7 >).This is a two cycle
|
// (INTCON < 7 >).This is a two cycle
|
||||||
// instruction.
|
// instruction.
|
||||||
|
|
||||||
//TODO
|
PCCounter = (int) Stack.Pop();
|
||||||
|
SetRegisterOhneBank(ADDR_INTCON, INTCON_BIT_GIE, true);
|
||||||
|
cycleCount = 2;
|
||||||
}
|
}
|
||||||
else if (aktueller_befehl.befehl == RETLW)
|
else if (aktueller_befehl.befehl == RETLW)
|
||||||
{
|
{
|
||||||
@ -981,5 +986,17 @@ namespace PIC_Simulator.PIC
|
|||||||
|
|
||||||
PCCounter = 0;
|
PCCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TimerInterrupt()
|
||||||
|
{
|
||||||
|
if (!GetRegisterOhneBank(ADDR_INTCON, INTCON_BIT_GIE)) return;
|
||||||
|
if (!GetRegisterOhneBank(ADDR_INTCON, INTCON_BIT_T0IE)) return;
|
||||||
|
|
||||||
|
SetRegisterOhneBank(ADDR_INTCON, INTCON_BIT_T0IF, true);
|
||||||
|
SetRegisterOhneBank(ADDR_INTCON, INTCON_BIT_GIE, false);
|
||||||
|
|
||||||
|
Stack.Push((uint)PCCounter);
|
||||||
|
PCCounter = (int) INTERRUPT_SERVICE_ADDRESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace PIC_Simulator.PIC
|
|||||||
uint Result = current + 1;
|
uint Result = current + 1;
|
||||||
if (Result > 0xFF)
|
if (Result > 0xFF)
|
||||||
{
|
{
|
||||||
//TODO Interrupt PIT_TIMER
|
programm.TimerInterrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result %= 0x100;
|
Result %= 0x100;
|
||||||
|
Loading…
Reference in New Issue
Block a user