~groovestomp/gsnes

ref: 85e494661af3862ec2f0c9d77df6ce9bdfcde828 gsnes/bus.h -rwxr-xr-x 1.5 KiB
85e49466 — GrooveStomp Working input and fixed a bug in ADC() 1 year, 5 months ago
                                                                                
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/******************************************************************************
  GrooveStomp's NES Emulator
  Copyright (c) 2019 Aaron Oman (GrooveStomp)

  File: bus.h
  Created: 2019-10-16
  Updated: 2019-12-06
  Author: Aaron Oman
  Notice: GNU AGPLv3 License

  Based off of: One Lone Coder NES Emulator Copyright (C) 2019 Javidx9
  This program comes with ABSOLUTELY NO WARRANTY.
  This is free software, and you are welcome to redistribute it under certain
  conditions; See LICENSE for details.
 ******************************************************************************/
//! \file bus.h
#ifndef BUS_VERSION
#define BUS_VERSION "0.1.0"

#include <stdint.h>
#include <stdbool.h>

struct cpu;
struct bus;
struct ppu;
struct cart;

struct controller {
        uint8_t input;
};

struct bus *
BusInit(struct cpu *cpu, struct ppu *ppu);

void
BusDeinit(struct bus *bus);

void
BusWrite(struct bus *bus, uint16_t addr, uint8_t data);

uint8_t
BusRead(struct bus *bus, uint16_t addr, bool readOnly);

void
BusReset(struct bus *bus);

//! \brief Increment the system by the fastest clock tick
//!
//! The running frequency is determined by the fastest clock in the system - in
//! this case, the PPU.  Every other clock is some fraction slower than the PPU,
//! so we compute a modulus every cycle to determine when to increment other
//! clocks.
//!
//! \param[in,out] bus
void
BusTick(struct bus *bus);

void
BusAttachCart(struct bus *bus, struct cart *cart);

struct controller *
BusGetControllers(struct bus *bus);

#endif // BUS_VERSION