First steps to modular emulator
This commit is contained in:
parent
702c02383c
commit
5c7112879a
|
@ -205,17 +205,8 @@ void execute() {
|
|||
}
|
||||
}
|
||||
}
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
printf("%s: No input file specified\n", "yemu");
|
||||
return 1;
|
||||
}
|
||||
void init6502(FILE *infile) {
|
||||
reset();
|
||||
FILE *infile = fopen(argv[1], "rb");
|
||||
if (infile == NULL) {
|
||||
perror("yemu");
|
||||
return 1;
|
||||
}
|
||||
char ch;
|
||||
int pos = 0;
|
||||
while (1) { // FIXME
|
||||
|
@ -229,5 +220,5 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
execute();
|
||||
dump_cpu(cpu);
|
||||
return 0;
|
||||
return;
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
#include <stdio.h>
|
||||
|
||||
typedef unsigned char byte; // 8 bit
|
||||
typedef unsigned short word; // 16 bit
|
||||
|
||||
|
@ -66,3 +68,4 @@ struct CPU {
|
|||
byte N; // Negative Flag
|
||||
};
|
||||
|
||||
void init6502(FILE *infile);
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@ CC = gcc
|
|||
CFLAGS= -O2 -Wall -Wextra
|
||||
LFLAGS=
|
||||
|
||||
SRCFILES= main.c
|
||||
SRCFILES= main.c 6502/6502.c
|
||||
OBJFILES= yemu-6502
|
||||
|
||||
.PHONY: all clean
|
|
@ -0,0 +1,18 @@
|
|||
#include "6502/6502.h"
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
printf("%s: No input file specified\n", "yemu");
|
||||
return 1;
|
||||
}
|
||||
|
||||
FILE *infile = fopen(argv[1], "rb");
|
||||
if (infile == NULL) {
|
||||
perror("yemu");
|
||||
return 1;
|
||||
}
|
||||
init6502(infile);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue