#pragma once
#include <stdint.h>
#include <stdio.h>
namespace mem
{
    #define MBC_NONE     0
    #define MBC1         1
    #define MBC2         2
    #define MBC3         3
    #define MBC5         5
    #define MBC6         6
    #define MBC7         7
    
    void init(uint8_t* rom, const int size);
    void reset();
    
    uint8_t readMem(uint16_t address);
    void writeMem(uint16_t address, uint8_t value);
    void requestInterrupt(uint8_t type);
    
    void saveState(FILE* f);
    void loadState(FILE* f);

    uint8_t *rawVram();
    uint8_t *rawHram(uint16_t address);

    void init_dma_transfer(uint8_t source);
    void update_mapped(const uint32_t dt);
}
