mirror of
https://github.com/tuz358/cpu-emulator.git
synced 2025-12-18 13:04:35 +03:00
first commit
This commit is contained in:
25
main.cpp
Normal file
25
main.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include "include/emulator.h"
|
||||
|
||||
const size_t MEMORY_SIZE = 1*KB;
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
FILE *bin;
|
||||
bin = fopen(argv[1], "rb");
|
||||
|
||||
Emulator emulator;
|
||||
emulator.init(MEMORY_SIZE, bin);
|
||||
fclose(bin);
|
||||
|
||||
while(emulator.get_eip() < MEMORY_SIZE) {
|
||||
uint8_t opcode = emulator.read_next_opcode();
|
||||
emulator.exec(opcode);
|
||||
|
||||
if (emulator.get_eip() == 0x00) break;
|
||||
}
|
||||
|
||||
emulator.free();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user