include/mgba/internal/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 <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/log.h>
14
15mLOG_DECLARE_CATEGORY(GB_MBC);
16
17struct GB;
18struct GBMemory;
19void GBMBCInit(struct GB* gb);
20void GBMBCSwitchBank(struct GBMemory* memory, int bank);
21void GBMBCSwitchSramBank(struct GB* gb, int bank);
22
23struct GBMBCRTCSaveBuffer {
24 uint32_t sec;
25 uint32_t min;
26 uint32_t hour;
27 uint32_t days;
28 uint32_t daysHi;
29 uint32_t latchedSec;
30 uint32_t latchedMin;
31 uint32_t latchedHour;
32 uint32_t latchedDays;
33 uint32_t latchedDaysHi;
34 uint64_t unixTime;
35};
36void GBMBCRTCRead(struct GB* gb);
37void GBMBCRTCWrite(struct GB* gb);
38
39uint8_t GBMBC7Read(struct GBMemory*, uint16_t address);
40void GBMBC7Write(struct GBMemory*, uint16_t address, uint8_t value);
41
42CXX_GUARD_END
43
44#endif