summaryrefslogtreecommitdiff
path: root/emu/emul.h
blob: 6012309a674e8c5bd493c029504400dcd1538586 (plain)
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
32
33
34
35
36
37
38
39
#ifndef EMUL_H
#define EMUL_H

#include "6502.h"
#include "memory.h"

#include <stdbool.h>

#ifdef WITH_GUI
#include <SDL.h>
#endif

enum {
	ROM_START = 0xF800,
	ROM_SIZE = 2048,
	CPU_FREQUENCY = 1000000,
	DISPLAY_FPS = 25
};

typedef struct emul_t {
	cpu_6502_t *cpu;
	memory_t *memory;
	bool gui;
	int width;
	int height;
#ifdef WITH_GUI
	SDL_Window *window;
	SDL_Renderer *renderer;
	SDL_Surface *background_image;
	SDL_Texture *background_texture;
#endif
} emul_t;

void emul_init( emul_t *emul, cpu_6502_t *cpu, memory_t *memory, int width, int height );
void emul_start( emul_t *emul );
void emul_run( emul_t *emul, int nof_steps );
void emul_free( emul_t *emul );

#endif