src/gb/mbc.h (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef GB_MBC_H
7#define GB_MBC_H
8
9#include "util/common.h"
10
11#include "core/log.h"
12
13mLOG_DECLARE_CATEGORY(GB_MBC);
14
15struct GB;
16struct GBMemory;
17void GBMBCInit(struct GB* gb);
18void GBMBCSwitchBank(struct GBMemory* memory, int bank);
19void GBMBCSwitchSramBank(struct GB* gb, int bank);
20
21struct GBMBCRTCSaveBuffer {
22 uint32_t sec;
23 uint32_t min;
24 uint32_t hour;
25 uint32_t days;
26 uint32_t daysHi;
27 uint32_t latchedSec;
28 uint32_t latchedMin;
29 uint32_t latchedHour;
30 uint32_t latchedDays;
31 uint32_t latchedDaysHi;
32 uint64_t unixTime;
33};
34void GBMBCRTCRead(struct GB* gb);
35void GBMBCRTCWrite(struct GB* gb);
36
37uint8_t GBMBC7Read(struct GBMemory*, uint16_t address);
38void GBMBC7Write(struct GBMemory*, uint16_t address, uint8_t value);
39
40#endif