about summary refs log blame commit diff
path: root/emulator.h
blob: c8114cb9c99af13560c0b7dd273dab7e3e0441e4 (plain) (tree)
1
2
3
4
5
6
7
8







                      




















                                

                  
                   






                                                          
#ifndef _EMULATOR_H_
#define _EMULATOR_H_

#include <stdio.h>
#include  <sys/stat.h>

typedef struct
{
    // general purpose registers
    uint8_t V0;
    uint8_t V1;
    uint8_t V2;
    uint8_t V3;
    uint8_t V4;
    uint8_t V5;
    uint8_t V6;
    uint8_t V7;
    uint8_t V8;
    uint8_t V9;
    uint8_t VA;
    uint8_t VB;
    uint8_t VC;
    uint8_t VD;
    uint8_t VE;
    uint8_t VF; //flag register
} Registers;

typedef struct
{
    uint8_t is_on;
    uint16_t pc;
    Registers regs;
    uint8_t memory[4096];
} Emulator;

int emulator_load_rom(Emulator* emulator, char* rom_name);
int emulator_tick(Emulator* emulator);

#endif