1 /*
2 * KCemu -- The emulator for the KC85 homecomputer series and much more.
3 * Copyright (C) 1997-2010 Torsten Paul
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include <iostream>
21 #include <iomanip>
22
23 #include "kc/system.h"
24
25 #include "kc/z80.h"
26 #include "kc/ctc9.h"
27
28 #include "libdbg/dbg.h"
29
CTC9(void)30 CTC9::CTC9(void)
31 {
32 }
33
~CTC9(void)34 CTC9::~CTC9(void)
35 {
36 }
37
38 byte_t
in(word_t addr)39 CTC9::in(word_t addr)
40 {
41 DBG(2, form("KCemu/CTC/9/in",
42 "CTC9::in(): addr = %04x\n",
43 addr));
44
45 switch (addr & 3)
46 {
47 case 0:
48 return c_in(0);
49 case 1:
50 return c_in(1);
51 case 2:
52 return c_in(2);
53 case 3:
54 return c_in(3);
55 }
56
57 return 0; // shouldn't be reached
58 }
59
60 void
out(word_t addr,byte_t val)61 CTC9::out(word_t addr, byte_t val)
62 {
63 DBG(2, form("KCemu/CTC/9/out",
64 "CTC9::out(): addr = %04x, val = %02x\n",
65 addr, val));
66
67 switch (addr & 3)
68 {
69 case 0:
70 c_out(0, val);
71 break;
72 case 1:
73 c_out(1, val);
74 break;
75 case 2:
76 c_out(2, val);
77 break;
78 case 3:
79 c_out(3, val);
80 break;
81 }
82 }
83
84 bool
irq_0(void)85 CTC9::irq_0(void)
86 {
87 trigger(2);
88 return false;
89 }
90
91 bool
irq_1(void)92 CTC9::irq_1(void)
93 {
94 return false;
95 }
96
97 bool
irq_2(void)98 CTC9::irq_2(void)
99 {
100 trigger(3);
101 return false;
102 }
103
104 bool
irq_3(void)105 CTC9::irq_3(void)
106 {
107 return false;
108 }
109
110 long
counter_value_0(void)111 CTC9::counter_value_0(void)
112 {
113 return 0;
114 }
115
116 long
counter_value_1(void)117 CTC9::counter_value_1(void)
118 {
119 return 0;
120 }
121
122 long
counter_value_2(void)123 CTC9::counter_value_2(void)
124 {
125 return 0;
126 }
127
128 long
counter_value_3(void)129 CTC9::counter_value_3(void)
130 {
131 return 0;
132 }
133