-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squash-merging changes by @tanay-man. Thanks!
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "interrupts.h" | ||
|
||
void interrupt(cpu* c, u8 interrupt_type){ | ||
push16(c,c->flags); | ||
resetTF(c); | ||
resetIF(c); | ||
push_r(c,c->cs); | ||
push_r(c,c->ip); | ||
u32 interrupt_pointer = interrupt_type*4; | ||
c->ip = cpu_read_u16_at(c,interrupt_pointer); | ||
c->cs = cpu_read_u16_at(c,interrupt_pointer+2); | ||
return; | ||
} | ||
|
||
void iret(cpu* c){ | ||
c->ip = pop16(c); | ||
c->cs = pop16(c); | ||
c->flags = pop16(c); | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#ifndef INT_H | ||
#define INT_H | ||
#include "push_pop.h" | ||
#include "flagops.h" | ||
#include "cpu.h" | ||
// case 0x90 NOP No operation | ||
|
||
// case 0xcd INT interrupt | ||
// case 0xce INTO interrupt on overflow | ||
// case 0xcf IRET interrupt return | ||
|
||
// case 0xf4 HLT halt | ||
// case 0xfa CLI clear if ---> Already implemented | ||
// case 0xfb STI set if ---> Already implemented | ||
|
||
void interrupt(cpu* c,u8 interrupt_type); | ||
void into(void); | ||
void iret(cpu* c); | ||
void halt(void); | ||
|
||
|
||
#endif |