trunk/src/mess/drivers/apc.c
| r18967 | r18968 | |
| 15 | 15 | i/o memory map: |
| 16 | 16 | 0x00 - 0x1f DMA |
| 17 | 17 | 0x20 - 0x23 i8259 master |
| 18 | | 0x28 - 0x2b i8259 slave |
| 19 | | 0x2b / 0x2f / 0x61 / 0x6f pit8253 (!) |
| 18 | 0x28 - 0x2f i8259 slave (even), pit8253 (odd) |
| 20 | 19 | 0x30 - 0x37 serial i8251, even #1 / odd #2 |
| 21 | 20 | 0x38 - 0x3f DMA segments |
| 22 | 21 | 0x40 - 0x43 upd7220, even chr / odd bitmap |
| r18967 | r18968 | |
| 25 | 24 | 0x58 rtc |
| 26 | 25 | 0x5a - 0x5e APU |
| 27 | 26 | 0x60 MPU (melody) |
| 27 | 0x61 - 0x67 (Mirror of pit8253?) |
| 28 | 28 | 0x68 - 0x6f parallel port |
| 29 | 29 | |
| 30 | 30 | ***************************************************************************/ |
| r18967 | r18968 | |
| 68 | 68 | |
| 69 | 69 | DECLARE_READ8_MEMBER(apc_port_28_r); |
| 70 | 70 | DECLARE_WRITE8_MEMBER(apc_port_28_w); |
| 71 | | DECLARE_WRITE8_MEMBER(apc_port_2e_w); |
| 72 | 71 | DECLARE_READ8_MEMBER(apc_port_60_r); |
| 73 | 72 | DECLARE_WRITE8_MEMBER(apc_port_60_w); |
| 74 | 73 | DECLARE_READ8_MEMBER(apc_gdc_r); |
| r18967 | r18968 | |
| 135 | 134 | UINT8 res; |
| 136 | 135 | |
| 137 | 136 | if(offset & 1) |
| 137 | res = pit8253_r(machine().device("pit8253"), space, (offset & 6) >> 1); |
| 138 | else |
| 138 | 139 | { |
| 139 | | if(offset == 3) |
| 140 | | res = pit8253_r(machine().device("pit8253"), space, 0); |
| 141 | | else |
| 140 | if(offset & 4) |
| 142 | 141 | { |
| 143 | | printf("Read undefined port 0x29\n"); |
| 142 | printf("Read undefined port %02x\n",offset+0x28); |
| 144 | 143 | res = 0xff; |
| 145 | 144 | } |
| 145 | else |
| 146 | res = pic8259_r(machine().device("pic8259_slave"), space, (offset & 2) >> 1); |
| 146 | 147 | } |
| 147 | | else |
| 148 | | { |
| 149 | | res = pic8259_r(machine().device("pic8259_slave"), space, (offset & 2) >> 1); |
| 150 | | } |
| 151 | 148 | |
| 152 | 149 | return res; |
| 153 | 150 | } |
| r18967 | r18968 | |
| 155 | 152 | WRITE8_MEMBER(apc_state::apc_port_28_w) |
| 156 | 153 | { |
| 157 | 154 | if(offset & 1) |
| 155 | pit8253_w(machine().device("pit8253"), space, (offset & 6) >> 1, data); |
| 156 | else |
| 158 | 157 | { |
| 159 | | if(offset == 3) |
| 160 | | pit8253_w(machine().device("pit8253"), space, 0, data); |
| 158 | if(offset & 4) |
| 159 | printf("Write undefined port %02x\n",offset+0x28); |
| 161 | 160 | else |
| 162 | | { |
| 163 | | printf("Write undefined port 0x29\n"); |
| 164 | | } |
| 161 | pic8259_w(machine().device("pic8259_slave"), space, (offset & 2) >> 1, data); |
| 165 | 162 | } |
| 166 | | else |
| 167 | | { |
| 168 | | pic8259_w(machine().device("pic8259_slave"), space, (offset & 2) >> 1, data); |
| 169 | | } |
| 170 | 163 | } |
| 171 | 164 | |
| 172 | | WRITE8_MEMBER(apc_state::apc_port_2e_w) |
| 173 | | { |
| 174 | | pit8253_w(machine().device("pit8253"), space, 1, data); |
| 175 | | } |
| 176 | 165 | |
| 177 | | |
| 178 | 166 | READ8_MEMBER(apc_state::apc_port_60_r) |
| 179 | 167 | { |
| 180 | 168 | UINT8 res; |
| 181 | 169 | |
| 182 | 170 | if(offset & 1) |
| 183 | 171 | { |
| 184 | | if(offset == 1) |
| 185 | | res = pit8253_r(machine().device("pit8253"), space, 2); |
| 186 | | else |
| 187 | | { |
| 188 | | printf("Read undefined port %02x\n",offset+0x60); |
| 189 | | res = 0xff; |
| 190 | | } |
| 172 | printf("Read undefined port %02x\n",offset+0x60); |
| 173 | res = 0xff; |
| 191 | 174 | } |
| 192 | 175 | else |
| 193 | 176 | { |
| r18967 | r18968 | |
| 202 | 185 | { |
| 203 | 186 | if(offset & 1) |
| 204 | 187 | { |
| 205 | | if(offset == 1) |
| 206 | | pit8253_w(machine().device("pit8253"), space, 2, data); |
| 207 | | else if(offset == 7) |
| 208 | | pit8253_w(machine().device("pit8253"), space, 3, data); |
| 209 | | else |
| 210 | | { |
| 211 | | printf("Write undefined port %02x\n",offset+0x60); |
| 212 | | } |
| 188 | printf("Write undefined port %02x\n",offset+0x60); |
| 213 | 189 | } |
| 214 | 190 | else |
| 215 | 191 | { |
| r18967 | r18968 | |
| 260 | 236 | // ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 261 | 237 | AM_RANGE(0x00, 0x1f) AM_READWRITE8(apc_dma_r, apc_dma_w, 0x00ff) |
| 262 | 238 | AM_RANGE(0x20, 0x23) AM_DEVREADWRITE8_LEGACY("pic8259_master", pic8259_r, pic8259_w, 0x00ff) // i8259 |
| 263 | | AM_RANGE(0x28, 0x2b) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff) |
| 264 | | AM_RANGE(0x2e, 0x2f) AM_WRITE8(apc_port_2e_w, 0x00ff) |
| 265 | | // 0x2b RTC counter port 0 |
| 266 | | // 0x2f RTC counter mode 0 (w) |
| 239 | AM_RANGE(0x28, 0x2f) AM_READWRITE8(apc_port_28_r, apc_port_28_w, 0xffff) |
| 267 | 240 | // 0x30, 0x37 serial port 0/1 (i8251) (even/odd) |
| 268 | 241 | // 0x38, 0x3f DMA extended address |
| 269 | 242 | AM_RANGE(0x40, 0x43) AM_READWRITE8(apc_gdc_r, apc_gdc_w, 0xffff) |
| r18967 | r18968 | |
| 274 | 247 | // 0x5e APU status/command |
| 275 | 248 | AM_RANGE(0x60, 0x67) AM_READWRITE8(apc_port_60_r, apc_port_60_w, 0xffff) |
| 276 | 249 | // 0x60 Melody Processing Unit |
| 277 | | // 0x61 RTC counter port 1 |
| 278 | | // 0x67 RTC counter mode 1 (w) |
| 279 | 250 | // AM_RANGE(0x68, 0x6f) i8255 , printer port (A: status (R) B: data (W) C: command (W)) |
| 280 | 251 | // AM_DEVREADWRITE8("upd7220_btm", upd7220_device, read, write, 0x00ff) |
| 281 | 252 | ADDRESS_MAP_END |