-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathsysport.c
87 lines (63 loc) · 1.33 KB
/
sysport.c
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "compiler.h"
#include "pccore.h"
#include "iocore.h"
#include "sound.h"
#include "beep.h"
// ---- I/O
static void IOOUTCALL sysp_o35(UINT port, REG8 dat) {
if ((sysport.c ^ dat) & 0x04) { // ver0.29
rs232c.send = 1;
}
sysport.c = dat;
beep_oneventset();
(void)port;
}
static void IOOUTCALL sysp_o37(UINT port, REG8 dat) {
REG8 bit;
if (!(dat & 0xf0)) {
bit = 1 << (dat >> 1);
if (dat & 1) {
sysport.c |= bit;
}
else {
sysport.c &= ~bit;
}
if (bit == 0x04) { // ver0.29
rs232c.send = 1;
}
else if (bit == 0x08) {
beep_oneventset();
}
}
(void)port;
}
static REG8 IOINPCALL sysp_i31(UINT port) {
(void)port;
return(pccore.dipsw[1]);
}
static REG8 IOINPCALL sysp_i33(UINT port) {
REG8 ret;
ret = ((~pccore.dipsw[0]) & 1) << 3;
ret |= rs232c_stat();
ret |= uPD4990.cdat;
(void)port;
return(ret);
}
static REG8 IOINPCALL sysp_i35(UINT port) {
(void)port;
return(sysport.c);
}
// ---- I/F
static const IOOUT syspo31[4] = {
NULL, NULL, sysp_o35, sysp_o37};
static const IOINP syspi31[4] = {
sysp_i31, sysp_i33, sysp_i35, NULL};
void systemport_reset(const NP2CFG *pConfig) {
sysport.c = 0xf9;
beep_oneventset();
(void)pConfig;
}
void systemport_bind(void) {
iocore_attachsysoutex(0x0031, 0xcf1, syspo31, 4);
iocore_attachsysinpex(0x0031, 0xcf1, syspi31, 4);
}