OXYGENHUB
# 2980b7b6d7cd enhanced-x16-emulator / tests / support / via_fixture.c
1.8 KiB · C · last changed chore(): initial commit 26 days ago source blame history raw
1
// Link seam for testing the real via.c.
2
//
3
// via.c holds two 65C22s. The generic half -- the registers, the interrupt
4
// flags and enables, the timers and the shift register -- is shared by both
5
// and touches nothing outside the chip. The other half wires VIA 1's ports to
6
// the machine: I2C to the SMC and RTC, the IEC serial bus, and the NES
7
// controllers.
8
//
9
// VIA 2 is the user port and via2_read()/via2_write() pass straight through to
10
// the generic half, so a test of the chip itself drives VIA 2 and needs none
11
// of that. This supplies what VIA 1's half refers to so the translation unit
12
// links.
13
//
14
// Every port here is inert and reads as an idle bus. Nothing records: a test
15
// that depends on one of these has left the 65C22 and gone into the machine
16
// around it, and wants rewriting rather than accommodating.
17
18
#include "i2c.h"
19
#include "joystick.h"
20
#include "serial.h"
21
22
#include <stdbool.h>
23
#include <stdint.h>
24
25
// ─── I2C ────────────────────────────────────────────────────────────────────
26
27
i2c_port_t i2c_port;
28
29
void i2c_step(void) { }
30
31
// ─── IEC serial ─────────────────────────────────────────────────────────────
32
33
serial_port_t serial_port;
34
35
bool serial_port_read_clk(void) { return true; }
36
bool serial_port_read_data(void) { return true; }
37
38
// ─── NES controllers ────────────────────────────────────────────────────────
39
40
uint8_t Joystick_data;
41
42
void joystick_set_latch(bool value) { (void)value; }
43
void joystick_set_clock(bool value) { (void)value; }