-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathprintif.c
77 lines (57 loc) · 1.15 KB
/
printif.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
#include "compiler.h"
#include "commng.h"
#include "cpucore.h"
#include "pccore.h"
#include "iocore.h"
COMMNG cm_prt;
// ---- I/O
static void IOOUTCALL prt_o40(UINT port, REG8 dat) {
COMMNG prt;
prt = cm_prt;
if (prt == NULL) {
prt = commng_create(COMCREATE_PRINTER);
cm_prt = prt;
}
prt->write(prt, (UINT8)dat);
// TRACEOUT(("prt - %.2x", dat));
(void)port;
}
static REG8 IOINPCALL prt_i42(UINT port) {
REG8 ret;
ret = 0x84;
if (pccore.cpumode & CPUMODE_8MHZ) {
ret |= 0x20;
}
if (pccore.dipsw[0] & 4) {
ret |= 0x10;
}
if (pccore.dipsw[0] & 0x80) {
ret |= 0x08;
}
if (!(pccore.model & PCMODEL_EPSON)) {
if (CPU_TYPE & CPUTYPE_V30) {
ret |= 0x02;
}
}
else {
if (pccore.dipsw[2] & 0x80) {
ret |= 0x02;
}
}
(void)port;
return(ret);
}
// ---- I/F
static const IOOUT prto40[4] = {
prt_o40, NULL, NULL, NULL};
static const IOINP prti40[4] = {
NULL, prt_i42, NULL, NULL};
void printif_reset(const NP2CFG *pConfig) {
commng_destroy(cm_prt);
cm_prt = NULL;
(void)pConfig;
}
void printif_bind(void) {
iocore_attachsysoutex(0x0040, 0x0cf1, prto40, 4);
iocore_attachsysinpex(0x0040, 0x0cf1, prti40, 4);
}