forked from angeris/CS107E-GB-Emulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
31 lines (27 loc) · 751 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "MEM.h"
#include "CPU.h"
#include "proto.h"
#include "gpio.h"
void impossible_vector(unsigned pc) {
printf("impossible exception at pc=%x\n", pc);
reboot();
}
void interrupt_vector(unsigned pc) {
gb_halt = 0;
return;
}
void main(void) {
init_cpu();
uart_init();
printf("Starting\n");
for(int i=0; i<50000000; i++); // Flush time
printf("Finished flushing\n");
//while(1) {printf("WTF"); for(int i=0; i<1000000; i++);}
while(1) {
if(!gb_halt) cpu_step(); // Should be done if there is no halting.
//check interrupts:
//if interrupt, then call correct given vector (unless GPU, then just call it whenever the interrupt occurs)
//
//check if waiting
}
}