summaryrefslogtreecommitdiffstats
path: root/abcprint.c
blob: cc003c0e3d80aec916fd0f7a18bf4558a2b244f8 (plain)
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
#include "abcprintd.h"

void printer_reset(void)
{
  static int init = 0;

  if (!init) {
    fileop_prefix = "abcdir/";
    abcprint_init();
  }
}

void printer_out(int sel, int port, int value)
{
  unsigned char v = value;

  (void)sel;

  switch (port) {
  case 0:
    abcprint(&v, 1);
    break;

  case 4:
    abcprint_init();
    break;

  default:
    break;
  }
}

int printer_in(int sel, int port)
{
  int v;

  (void)sel;

  switch (port) {
  case 0:
    v = abcprint_read();
    break;

  case 1:
    v = abcprint_poll() ? 0x40 : 0;
    break;

  default:
    v = -1;
    break;
  }

  return v;
}