| 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/kc.h" |
| 26 |
#include "kc/z80.h" |
| 27 |
#include "kc/muglerpc/pio.h" |
| 28 |
|
| 29 |
#include "libdbg/dbg.h" |
| 30 |
|
| 31 |
PIOMuglerPCSystem::PIOMuglerPCSystem(void) |
| 32 |
{ |
| 33 |
} |
| 34 |
|
| 35 |
PIOMuglerPCSystem::~PIOMuglerPCSystem(void) |
| 36 |
{ |
| 37 |
} |
| 38 |
|
| 39 |
byte_t |
| 40 |
PIOMuglerPCSystem::in(word_t addr) |
| 41 |
{ |
| 42 |
byte_t val = 0xff; |
| 43 |
|
| 44 |
switch (addr & 3) |
| 45 |
{ |
| 46 |
case 0: |
| 47 |
val = in_A_DATA(); |
| 48 |
break; |
| 49 |
case 1: |
| 50 |
val = in_B_DATA(); |
| 51 |
break; |
| 52 |
case 2: |
| 53 |
val = in_A_CTRL(); |
| 54 |
break; |
| 55 |
case 3: |
| 56 |
val = in_B_CTRL(); |
| 57 |
break; |
| 58 |
} |
| 59 |
|
| 60 |
DBG(2, form("KCemu/PIO/muglerpc/in", |
| 61 |
"PIOMuglerPCSystem::in(): addr = %04x, val = %02x\n", |
| 62 |
addr, val)); |
| 63 |
|
| 64 |
return val; |
| 65 |
} |
| 66 |
|
| 67 |
void |
| 68 |
PIOMuglerPCSystem::out(word_t addr, byte_t val) |
| 69 |
{ |
| 70 |
DBG(2, form("KCemu/PIO/muglerpc/out", |
| 71 |
"PIOMuglerPCSystem::out(): addr = %04x, val = %02x\n", |
| 72 |
addr, val)); |
| 73 |
|
| 74 |
switch (addr & 3) |
| 75 |
{ |
| 76 |
case 0: |
| 77 |
out_A_DATA(val); |
| 78 |
break; |
| 79 |
case 1: |
| 80 |
out_B_DATA(val); |
| 81 |
break; |
| 82 |
case 2: |
| 83 |
out_A_CTRL(val); |
| 84 |
break; |
| 85 |
case 3: |
| 86 |
out_B_CTRL(val); |
| 87 |
break; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
void |
| 92 |
PIOMuglerPCSystem::change_A(byte_t changed, byte_t val) |
| 93 |
{ |
| 94 |
} |
| 95 |
|
| 96 |
void |
| 97 |
PIOMuglerPCSystem::change_B(byte_t changed, byte_t val) |
| 98 |
{ |
| 99 |
} |
| 100 |
|
| 101 |
PIOMuglerPCUser::PIOMuglerPCUser(void) |
| 102 |
{ |
| 103 |
} |
| 104 |
|
| 105 |
PIOMuglerPCUser::~PIOMuglerPCUser(void) |
| 106 |
{ |
| 107 |
} |
| 108 |
|
| 109 |
byte_t |
| 110 |
PIOMuglerPCUser::in(word_t addr) |
| 111 |
{ |
| 112 |
byte_t val = 0xff; |
| 113 |
|
| 114 |
switch (addr & 3) |
| 115 |
{ |
| 116 |
case 0: |
| 117 |
val = in_A_DATA(); |
| 118 |
break; |
| 119 |
case 1: |
| 120 |
val = in_B_DATA(); |
| 121 |
break; |
| 122 |
case 2: |
| 123 |
val = in_A_CTRL(); |
| 124 |
break; |
| 125 |
case 3: |
| 126 |
val = in_B_CTRL(); |
| 127 |
break; |
| 128 |
} |
| 129 |
|
| 130 |
DBG(2, form("KCemu/PIO/muglerpc/in", |
| 131 |
"PIOMuglerPCUser::in(): addr = %04x, val = %02x\n", |
| 132 |
addr, val)); |
| 133 |
|
| 134 |
return val; |
| 135 |
} |
| 136 |
|
| 137 |
void |
| 138 |
PIOMuglerPCUser::out(word_t addr, byte_t val) |
| 139 |
{ |
| 140 |
DBG(2, form("KCemu/PIO/muglerpc/out", |
| 141 |
"PIOMuglerPCSystem::out(): addr = %04x, val = %02x\n", |
| 142 |
addr, val)); |
| 143 |
|
| 144 |
switch (addr & 3) |
| 145 |
{ |
| 146 |
case 0: |
| 147 |
out_A_DATA(val); |
| 148 |
break; |
| 149 |
case 1: |
| 150 |
out_B_DATA(val); |
| 151 |
break; |
| 152 |
case 2: |
| 153 |
out_A_CTRL(val); |
| 154 |
break; |
| 155 |
case 3: |
| 156 |
out_B_CTRL(val); |
| 157 |
break; |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
void |
| 162 |
PIOMuglerPCUser::change_A(byte_t changed, byte_t val) |
| 163 |
{ |
| 164 |
} |
| 165 |
|
| 166 |
void |
| 167 |
PIOMuglerPCUser::change_B(byte_t changed, byte_t val) |
| 168 |
{ |
| 169 |
} |