src/mess/machine/upd71071.c
| r0 | r5971 | |
| 1 | |
| 2 | /* |
| 3 | |
| 4 | NEC uPD71071 DMA Controller |
| 5 | Used on the Fujitsu FM-Towns |
| 6 | |
| 7 | Register description: |
| 8 | |
| 9 | 0x00: Initialise (Write-only) |
| 10 | - bit 0: Reset |
| 11 | - bit 1: 16-bit data bus |
| 12 | |
| 13 | 0x01: Channel Register |
| 14 | On read: |
| 15 | - bits 0-3: Selected channel |
| 16 | - bit 4: Only base registers may be read or written |
| 17 | On write: |
| 18 | - bits 0-1: Select channel for programming count, address, and mode registers |
| 19 | - bit 2: Only base registers can be read or written to |
| 20 | |
| 21 | 0x02: |
| 22 | 0x03: Count Register (16-bit) |
| 23 | DMA Transfer counter |
| 24 | |
| 25 | 0x04: |
| 26 | 0x05: |
| 27 | 0x06: Address Register (24-bit) |
| 28 | Self-explanatory, I hope. :) |
| 29 | |
| 30 | 0x08: |
| 31 | 0x09: Device Control register (16-bit) |
| 32 | bit 0: Enable memory-to-memory (MTM) transfers |
| 33 | bit 1: Enable fixed address for channel 0 only (MTM only) |
| 34 | bit 2: Disable DMA operation (stops HLDRQ signal to the CPU) |
| 35 | bit 3: Use compressed timing |
| 36 | bit 4: Rotational Priority |
| 37 | bit 5: Extended Writing |
| 38 | bit 6: DMARQ active level (1=active low) |
| 39 | bit 7: DMAAK active level (1=active high) |
| 40 | bit 8: Bus mode (0=bus release, 1=bus hold) |
| 41 | bit 9: Wait Enable during Verify |
| 42 | |
| 43 | 0x0a: Mode Control register |
| 44 | bit 0: Transfer size (1=16-bit, 0=8-bit, 16-bit data bus size only) |
| 45 | bit 2-3: Transfer direction (ignored for MTM transfers) |
| 46 | 00 = Verify |
| 47 | 01 = I/O to memory |
| 48 | 10 = memory to I/O |
| 49 | 11 = invalid |
| 50 | bit 4: Enable auto-initialise |
| 51 | bit 5: Address direction (0=increment, 1=decrement, affects only current Address reg) |
| 52 | bit 6-7: Transfer mode (ignored for MTM transfers) |
| 53 | 00 = Demand |
| 54 | 01 = Single |
| 55 | 10 = Block |
| 56 | 11 = Cascade |
| 57 | |
| 58 | 0x0b: Status register |
| 59 | bit 0-3: Terminal count (per channel) |
| 60 | bit 4-7: DMA request present (external hardware DMA only) |
| 61 | |
| 62 | 0x0c: |
| 63 | 0x0d: Temporary register (16-bit, read-only) |
| 64 | Stores the last data transferred in an MTM transfer |
| 65 | |
| 66 | 0x0e: Request register |
| 67 | bit 0-3: Software DMA request (1=set) |
| 68 | bit 0 only in MTM transfers |
| 69 | |
| 70 | 0x0f: Mask register |
| 71 | bit 0-3: DMARQ mask |
| 72 | bits 1 and 0 only in MTM transfers |
| 73 | |
| 74 | |
| 75 | */ |
| 76 | |
| 77 | #include "driver.h" |
| 78 | #include "machine/upd71071.h" |
| 79 | |
| 80 | struct upd71071_reg |
| 81 | { |
| 82 | UINT8 initialise; |
| 83 | UINT8 channel; |
| 84 | UINT16 count_current[4]; |
| 85 | UINT16 count_base[4]; |
| 86 | UINT32 address_current[4]; |
| 87 | UINT32 address_base[4]; |
| 88 | UINT16 device_control; |
| 89 | UINT8 mode_control[4]; |
| 90 | UINT8 status; |
| 91 | UINT8 temp_l; |
| 92 | UINT8 temp_h; |
| 93 | UINT8 request; |
| 94 | UINT8 mask; |
| 95 | }; |
| 96 | |
| 97 | typedef struct _upd71071_t upd71071_t; |
| 98 | struct _upd71071_t |
| 99 | { |
| 100 | struct upd71071_reg reg; |
| 101 | int selected_channel; |
| 102 | int buswidth; |
| 103 | int dmarq[4]; |
| 104 | emu_timer* timer[4]; |
| 105 | int in_progress[4]; |
| 106 | int transfer_size[4]; |
| 107 | int base[4]; |
| 108 | const upd71071_intf* intf; |
| 109 | }; |
| 110 | |
| 111 | static TIMER_CALLBACK(dma_transfer_timer) |
| 112 | { |
| 113 | // single byte or word transfer |
| 114 | const device_config* device = ptr; |
| 115 | upd71071_t* dmac = device->token; |
| 116 | const address_space* space = cputag_get_address_space(device->machine,dmac->intf->cputag,ADDRESS_SPACE_PROGRAM); |
| 117 | int channel = param; |
| 118 | UINT16 data = 0; // data to transfer |
| 119 | |
| 120 | switch(dmac->reg.mode_control[channel] & 0x0c) |
| 121 | { |
| 122 | case 0x00: // Verify |
| 123 | break; |
| 124 | case 0x04: // I/O -> memory |
| 125 | if(dmac->intf->dma_read[channel]) |
| 126 | data = dmac->intf->dma_read[channel](device->machine); |
| 127 | memory_write_byte(space,dmac->reg.address_current[channel],data & 0xff); |
| 128 | dmac->reg.count_current[channel]--; |
| 129 | if(dmac->reg.mode_control[channel] & 0x20) // Address direction |
| 130 | dmac->reg.address_current[channel]--; |
| 131 | else |
| 132 | dmac->reg.address_current[channel]++; |
| 133 | break; |
| 134 | case 0x08: // memory -> I/O |
| 135 | data = memory_read_byte(space,dmac->reg.address_current[channel]); |
| 136 | if(dmac->intf->dma_read[channel]) |
| 137 | dmac->intf->dma_write[channel](device->machine,data); |
| 138 | dmac->reg.count_current[channel]--; |
| 139 | if(dmac->reg.mode_control[channel] & 0x20) // Address direction |
| 140 | dmac->reg.address_current[channel]--; |
| 141 | else |
| 142 | dmac->reg.address_current[channel]++; |
| 143 | break; |
| 144 | case 0x0c: // Invalid |
| 145 | break; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | void upd71071_dmarq(const device_config* device, int state,int channel) |
| 150 | { |
| 151 | upd71071_t* dmac = device->token; |
| 152 | |
| 153 | if(state != 0) |
| 154 | { |
| 155 | // start transfer |
| 156 | if(dmac->reg.mask & (1 << channel)) // is channel masked? |
| 157 | return; |
| 158 | |
| 159 | dmac->dmarq[channel] = 1; // DMARQ line is set |
| 160 | |
| 161 | switch(dmac->reg.mode_control[channel] & 0xc0) |
| 162 | { |
| 163 | case 0x00: // Demand |
| 164 | // TODO |
| 165 | break; |
| 166 | case 0x40: // Single |
| 167 | timer_adjust_oneshot(dmac->timer[channel],ATTOTIME_IN_HZ(dmac->intf->clock),channel); |
| 168 | break; |
| 169 | case 0x80: // Block |
| 170 | // TODO |
| 171 | break; |
| 172 | case 0xc0: // Cascade |
| 173 | // TODO |
| 174 | break; |
| 175 | |
| 176 | } |
| 177 | } |
| 178 | else |
| 179 | { |
| 180 | dmac->dmarq[channel] = 0; // clear DMARQ line |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | static DEVICE_START(upd71071) |
| 185 | { |
| 186 | upd71071_t* dmac = device->token; |
| 187 | int x; |
| 188 | |
| 189 | dmac->intf = device->static_config; |
| 190 | for(x=0;x<4;x++) |
| 191 | { |
| 192 | dmac->timer[x] = timer_alloc(device->machine,dma_transfer_timer,(void*)device); |
| 193 | } |
| 194 | dmac->selected_channel = 0; |
| 195 | } |
| 196 | |
| 197 | READ8_DEVICE_HANDLER(upd71071_read) |
| 198 | { |
| 199 | upd71071_t* dmac = device->token; |
| 200 | UINT8 ret = 0; |
| 201 | |
| 202 | logerror("DMA: read from register %02x\n",offset); |
| 203 | switch(offset) |
| 204 | { |
| 205 | case 0x01: // Channel |
| 206 | ret = (1 << dmac->selected_channel); |
| 207 | if(dmac->base[dmac->selected_channel] != 0) |
| 208 | ret |= 0x10; |
| 209 | break; |
| 210 | case 0x02: // Count (low) |
| 211 | if(dmac->base[dmac->selected_channel] != 0) |
| 212 | ret = dmac->reg.count_base[dmac->selected_channel] & 0xff; |
| 213 | else |
| 214 | ret = dmac->reg.count_current[dmac->selected_channel] & 0xff; |
| 215 | break; |
| 216 | case 0x03: // Count (high) |
| 217 | if(dmac->base[dmac->selected_channel] != 0) |
| 218 | ret = (dmac->reg.count_base[dmac->selected_channel] >> 8) & 0xff; |
| 219 | else |
| 220 | ret = (dmac->reg.count_current[dmac->selected_channel] >> 8) & 0xff; |
| 221 | break; |
| 222 | case 0x04: // Address (low) |
| 223 | if(dmac->base[dmac->selected_channel] != 0) |
| 224 | ret = dmac->reg.address_base[dmac->selected_channel] & 0xff; |
| 225 | else |
| 226 | ret = dmac->reg.address_current[dmac->selected_channel] & 0xff; |
| 227 | break; |
| 228 | case 0x05: // Address (mid) |
| 229 | if(dmac->base[dmac->selected_channel] != 0) |
| 230 | ret = (dmac->reg.address_base[dmac->selected_channel] >> 8) & 0xff; |
| 231 | else |
| 232 | ret = (dmac->reg.address_current[dmac->selected_channel] >> 8) & 0xff; |
| 233 | break; |
| 234 | case 0x06: // Address (high) |
| 235 | if(dmac->base[dmac->selected_channel] != 0) |
| 236 | ret = (dmac->reg.address_base[dmac->selected_channel] >> 16) & 0xff; |
| 237 | else |
| 238 | ret = (dmac->reg.address_current[dmac->selected_channel] >> 16) & 0xff; |
| 239 | break; |
| 240 | case 0x08: // Device control (low) |
| 241 | ret = dmac->reg.device_control & 0xff; |
| 242 | break; |
| 243 | case 0x09: // Device control (high) |
| 244 | ret = (dmac->reg.device_control >> 8) & 0xff; |
| 245 | break; |
| 246 | case 0x0a: // Mode control |
| 247 | ret = dmac->reg.mode_control[dmac->selected_channel]; |
| 248 | break; |
| 249 | case 0x0b: // Status |
| 250 | ret = dmac->reg.status; |
| 251 | break; |
| 252 | case 0x0c: // Temporary (low) |
| 253 | ret = dmac->reg.temp_h; |
| 254 | break; |
| 255 | case 0x0d: // Temporary (high) |
| 256 | ret = dmac->reg.temp_l; |
| 257 | break; |
| 258 | case 0x0e: // Request |
| 259 | ret = dmac->reg.request; |
| 260 | break; |
| 261 | case 0x0f: // Mask |
| 262 | ret = dmac->reg.mask; |
| 263 | break; |
| 264 | } |
| 265 | return ret; |
| 266 | } |
| 267 | |
| 268 | WRITE8_DEVICE_HANDLER(upd71071_write) |
| 269 | { |
| 270 | upd71071_t* dmac = device->token; |
| 271 | |
| 272 | switch(offset) |
| 273 | { |
| 274 | case 0x00: // Initialise |
| 275 | // TODO: reset (bit 0) |
| 276 | dmac->buswidth = data & 0x02; |
| 277 | logerror("DMA: Initialise [%02x]\n",data); |
| 278 | break; |
| 279 | case 0x01: // Channel |
| 280 | dmac->selected_channel = data & 0x03; |
| 281 | dmac->base[dmac->selected_channel] = data & 0x04; |
| 282 | logerror("DMA: Channel selected [%02x]\n",data); |
| 283 | break; |
| 284 | case 0x02: // Count (low) |
| 285 | dmac->reg.count_base[dmac->selected_channel] = |
| 286 | (dmac->reg.count_base[dmac->selected_channel] & 0xff00) | data; |
| 287 | dmac->reg.count_current[dmac->selected_channel] = |
| 288 | (dmac->reg.count_current[dmac->selected_channel] & 0xff00) | data; |
| 289 | logerror("DMA: Channel %i Counter set [%04x]\n",dmac->selected_channel,dmac->reg.count_base[dmac->selected_channel]); |
| 290 | break; |
| 291 | case 0x03: // Count (high) |
| 292 | dmac->reg.count_base[dmac->selected_channel] = |
| 293 | (dmac->reg.count_base[dmac->selected_channel] & 0x00ff) | (data << 8); |
| 294 | dmac->reg.count_current[dmac->selected_channel] = |
| 295 | (dmac->reg.count_current[dmac->selected_channel] & 0x00ff) | (data << 8); |
| 296 | logerror("DMA: Channel %i Counter set [%04x]\n",dmac->selected_channel,dmac->reg.count_base[dmac->selected_channel]); |
| 297 | break; |
| 298 | case 0x04: // Address (low) |
| 299 | dmac->reg.address_base[dmac->selected_channel] = |
| 300 | (dmac->reg.address_base[dmac->selected_channel] & 0x00ffff00) | data; |
| 301 | dmac->reg.address_current[dmac->selected_channel] = |
| 302 | (dmac->reg.address_current[dmac->selected_channel] & 0x00ffff00) | data; |
| 303 | logerror("DMA: Channel %i Address set [%06x]\n",dmac->selected_channel,dmac->reg.address_base[dmac->selected_channel]); |
| 304 | break; |
| 305 | case 0x05: // Address (mid) |
| 306 | dmac->reg.address_base[dmac->selected_channel] = |
| 307 | (dmac->reg.address_base[dmac->selected_channel] & 0x00ff00ff) | (data << 8); |
| 308 | dmac->reg.address_current[dmac->selected_channel] = |
| 309 | (dmac->reg.address_current[dmac->selected_channel] & 0x00ff00ff) | (data << 8); |
| 310 | logerror("DMA: Channel %i Address set [%06x]\n",dmac->selected_channel,dmac->reg.address_base[dmac->selected_channel]); |
| 311 | break; |
| 312 | case 0x06: // Address (high) |
| 313 | dmac->reg.address_base[dmac->selected_channel] = |
| 314 | (dmac->reg.address_base[dmac->selected_channel] & 0x0000ffff) | (data << 16); |
| 315 | dmac->reg.address_current[dmac->selected_channel] = |
| 316 | (dmac->reg.address_current[dmac->selected_channel] & 0x0000ffff) | (data << 16); |
| 317 | logerror("DMA: Channel %i Address set [%06x]\n",dmac->selected_channel,dmac->reg.address_base[dmac->selected_channel]); |
| 318 | break; |
| 319 | case 0x08: // Device control (low) |
| 320 | dmac->reg.device_control = (dmac->reg.device_control & 0xff00) | data; |
| 321 | logerror("DMA: Device control set [%04x]\n",dmac->reg.device_control); |
| 322 | break; |
| 323 | case 0x09: // Device control (high) |
| 324 | dmac->reg.device_control = (dmac->reg.device_control & 0x00ff) | (data << 8); |
| 325 | logerror("DMA: Device control set [%04x]\n",dmac->reg.device_control); |
| 326 | break; |
| 327 | case 0x0a: // Mode control |
| 328 | dmac->reg.mode_control[dmac->selected_channel] = data; |
| 329 | logerror("DMA: Channel %i Mode control set [%02x]\n",dmac->selected_channel,dmac->reg.mode_control[dmac->selected_channel]); |
| 330 | break; |
| 331 | case 0x0e: // Request |
| 332 | dmac->reg.request = data; |
| 333 | logerror("DMA: Request set [%02x]\n",data); |
| 334 | break; |
| 335 | case 0x0f: // Mask |
| 336 | dmac->reg.mask = data; |
| 337 | logerror("DMA: Mask set [%02x]\n",data); |
| 338 | break; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | DEVICE_GET_INFO(upd71071) |
| 343 | { |
| 344 | switch (state) |
| 345 | { |
| 346 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 347 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_OTHER; break; |
| 348 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(upd71071_t); break; |
| 349 | |
| 350 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 351 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(upd71071); break; |
| 352 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 353 | case DEVINFO_FCT_RESET: /* Nothing */ break; |
| 354 | |
| 355 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 356 | case DEVINFO_STR_NAME: strcpy(info->s, "NEC uPD71071"); break; |
| 357 | case DEVINFO_STR_FAMILY: strcpy(info->s, "DMA Controller"); break; |
| 358 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 359 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 360 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright the MESS Team"); break; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | READ8_DEVICE_HANDLER(upd71071_r) { return upd71071_read(device,offset); } |
| 365 | WRITE8_DEVICE_HANDLER(upd71071_w) { upd71071_write(device,offset,data); } |
| 366 | |
src/mess/drivers/fmtowns.c
| r5970 | r5971 | |
| 78 | 78 | #include "sound/rf5c68.h" |
| 79 | 79 | #include "machine/pit8253.h" |
| 80 | 80 | #include "machine/pic8259.h" |
| 81 | #include "formats/basicdsk.h" |
| 81 | 82 | #include "machine/wd17xx.h" |
| 82 | 83 | #include "devices/flopdrv.h" |
| 84 | #include "machine/upd71071.h" |
| 83 | 85 | |
| 84 | 86 | static UINT8 ftimer; |
| 85 | 87 | static UINT8 nmi_mask; |
| r5970 | r5971 | |
| 174 | 176 | |
| 175 | 177 | static READ8_HANDLER(towns_dma1_r) |
| 176 | 178 | { |
| 179 | const device_config* dev = devtag_get_device(space->machine,"dma_1"); |
| 180 | |
| 177 | 181 | logerror("DMA#1: read register %i\n",offset); |
| 178 | | return 0x00; |
| 182 | return upd71071_r(dev,offset); |
| 179 | 183 | } |
| 180 | 184 | |
| 181 | 185 | static WRITE8_HANDLER(towns_dma1_w) |
| 182 | 186 | { |
| 187 | const device_config* dev = devtag_get_device(space->machine,"dma_1"); |
| 188 | |
| 183 | 189 | logerror("DMA#1: wrote 0x%02x to register %i\n",data,offset); |
| 190 | upd71071_w(dev,offset,data); |
| 184 | 191 | } |
| 185 | 192 | |
| 186 | 193 | static READ8_HANDLER(towns_dma2_r) |
| 187 | 194 | { |
| 195 | const device_config* dev = devtag_get_device(space->machine,"dma_2"); |
| 196 | |
| 188 | 197 | logerror("DMA#2: read register %i\n",offset); |
| 189 | | return 0x00; |
| 198 | return upd71071_r(dev,offset); |
| 190 | 199 | } |
| 191 | 200 | |
| 192 | 201 | static WRITE8_HANDLER(towns_dma2_w) |
| 193 | 202 | { |
| 203 | const device_config* dev = devtag_get_device(space->machine,"dma_2"); |
| 204 | |
| 194 | 205 | logerror("DMA#2: wrote 0x%02x to register %i\n",data,offset); |
| 206 | upd71071_w(dev,offset,data); |
| 195 | 207 | } |
| 196 | 208 | |
| 197 | 209 | /* |
| 198 | 210 | * Floppy Disc Controller (MB8877A) |
| 199 | 211 | */ |
| 212 | |
| 213 | static WD17XX_CALLBACK(towns_fdc_irq) |
| 214 | { |
| 215 | const device_config* dev = devtag_get_device(device->machine,"dma_1"); |
| 216 | |
| 217 | switch(state) |
| 218 | { |
| 219 | case WD17XX_IRQ_CLR: |
| 220 | break; |
| 221 | case WD17XX_IRQ_SET: |
| 222 | break; |
| 223 | case WD17XX_DRQ_CLR: |
| 224 | upd71071_dmarq(dev,0,0); |
| 225 | break; |
| 226 | case WD17XX_DRQ_SET: |
| 227 | upd71071_dmarq(dev,1,0); |
| 228 | break; |
| 229 | } |
| 230 | } |
| 231 | |
| 200 | 232 | static READ8_HANDLER(towns_floppy_r) |
| 201 | 233 | { |
| 202 | 234 | const device_config* fdc = devtag_get_device(space->machine,"fdc"); |
| r5970 | r5971 | |
| 233 | 265 | switch(offset) |
| 234 | 266 | { |
| 235 | 267 | case 0x00: |
| 268 | // Commands 0xd0 and 0xfe (Write Track) are apparently ignored? |
| 269 | if(data == 0xd0) |
| 270 | return; |
| 271 | if(data == 0xfe) |
| 272 | return; |
| 236 | 273 | wd17xx_command_w(fdc,offset/2,data); |
| 237 | 274 | break; |
| 238 | 275 | case 0x02: |
| r5970 | r5971 | |
| 285 | 322 | } |
| 286 | 323 | } |
| 287 | 324 | |
| 325 | UINT16 towns_fdc_dma_r(running_machine* machine) |
| 326 | { |
| 327 | const device_config* fdc = devtag_get_device(machine,"fdc"); |
| 328 | return wd17xx_data_r(fdc,0); |
| 329 | } |
| 330 | |
| 331 | void towns_fdc_dma_w(running_machine* machine, UINT16 data) |
| 332 | { |
| 333 | const device_config* fdc = devtag_get_device(machine,"fdc"); |
| 334 | wd17xx_data_w(fdc,0,data); |
| 335 | } |
| 336 | |
| 288 | 337 | static READ8_HANDLER(towns_video_440_r) |
| 289 | 338 | { |
| 290 | 339 | logerror("VID: read port %04x\n",offset+0x440); |
| r5970 | r5971 | |
| 679 | 728 | logerror("VGA: VRAM wplane select (I/O) = 0x%02x\n",towns_vram_wplane); |
| 680 | 729 | } |
| 681 | 730 | |
| 731 | /* |
| 732 | * I/O ports 0x4c0-0x4cf |
| 733 | * CD-ROM driver (SCSI?) |
| 734 | */ |
| 735 | static READ8_HANDLER(towns_cdrom_r) |
| 736 | { |
| 737 | switch(offset) |
| 738 | { |
| 739 | case 0x00: |
| 740 | return 0x01; |
| 741 | default: |
| 742 | logerror("CD: read port %02x\n",offset*2); |
| 743 | return 0x00; |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | static WRITE8_HANDLER(towns_cdrom_w) |
| 748 | { |
| 749 | switch(offset) |
| 750 | { |
| 751 | default: |
| 752 | logerror("CD: read port %02x\n",offset*2); |
| 753 | } |
| 754 | } |
| 755 | |
| 682 | 756 | static ADDRESS_MAP_START(towns_mem, ADDRESS_SPACE_PROGRAM, 32) |
| 683 | 757 | // memory map based on FM-Towns/Bochs (Bochs modified to emulate the FM-Towns) |
| 684 | 758 | // may not be (and probably is not) correct |
| r5970 | r5971 | |
| 718 | 792 | AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8("pit",pit8253_r, pit8253_w, 0x00ff00ff) |
| 719 | 793 | AM_RANGE(0x0060,0x0063) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x000000ff) |
| 720 | 794 | AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff) |
| 721 | | // DMA controllers (uPD71071?) |
| 795 | // DMA controllers (uPD71071) |
| 722 | 796 | AM_RANGE(0x00a0,0x00af) AM_READWRITE8(towns_dma1_r, towns_dma1_w, 0xffffffff) |
| 723 | 797 | AM_RANGE(0x00b0,0x00bf) AM_READWRITE8(towns_dma2_r, towns_dma2_w, 0xffffffff) |
| 724 | 798 | // Floppy controller |
| r5970 | r5971 | |
| 728 | 802 | AM_RANGE(0x0404,0x0407) AM_READWRITE(towns_video_404_r, towns_video_404_w) // R/W (0x404) |
| 729 | 803 | AM_RANGE(0x0440,0x045f) AM_READWRITE8(towns_video_440_r, towns_video_440_w, 0xffffffff) |
| 730 | 804 | // System port |
| 731 | | AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0xff000000) // R/W (0x480) |
| 805 | AM_RANGE(0x0480,0x0483) AM_READWRITE8(towns_sys480_r,towns_sys480_w,0x000000ff) // R/W (0x480) |
| 732 | 806 | // CD-ROM |
| 733 | | AM_RANGE(0x04c0,0x04cf) AM_NOP |
| 807 | AM_RANGE(0x04c0,0x04cf) AM_READWRITE8(towns_cdrom_r,towns_cdrom_w,0x00ff00ff) |
| 734 | 808 | // Joystick / Mouse ports(?) |
| 735 | 809 | AM_RANGE(0x04d0,0x04d3) AM_READ(towns_padport_r) |
| 736 | 810 | // Sound (YM3438 [FM], RF5c68 [PCM]) |
| r5970 | r5971 | |
| 845 | 919 | |
| 846 | 920 | static const wd17xx_interface towns_mb8877a_interface = |
| 847 | 921 | { |
| 922 | towns_fdc_irq, |
| 848 | 923 | NULL, |
| 849 | | NULL, |
| 850 | 924 | {FLOPPY_0,FLOPPY_1,FLOPPY_2,FLOPPY_3} |
| 851 | 925 | }; |
| 852 | 926 | |
| 927 | FLOPPY_OPTIONS_START( towns ) |
| 928 | FLOPPY_OPTION( fmt_bin, "bin", "BIN disk image", basicdsk_identify_default, basicdsk_construct_default, |
| 929 | HEADS([2]) |
| 930 | TRACKS([77]) |
| 931 | SECTORS([8]) |
| 932 | SECTOR_LENGTH([1024]) |
| 933 | FIRST_SECTOR_ID([1])) |
| 934 | FLOPPY_OPTIONS_END |
| 935 | |
| 853 | 936 | static const floppy_config towns_floppy_config = |
| 854 | 937 | { |
| 855 | 938 | FLOPPY_DRIVE_DS_80, |
| 856 | | FLOPPY_OPTIONS_NAME(default), |
| 939 | FLOPPY_OPTIONS_NAME(towns), |
| 857 | 940 | DO_NOT_KEEP_GEOMETRY |
| 858 | 941 | }; |
| 859 | 942 | |
| 943 | static const upd71071_intf towns_dma_config = |
| 944 | { |
| 945 | "maincpu", |
| 946 | 1000000, |
| 947 | { towns_fdc_dma_r, 0, 0, 0 }, |
| 948 | { towns_fdc_dma_w, 0, 0, 0 } |
| 949 | }; |
| 950 | |
| 860 | 951 | // for debugging |
| 861 | 952 | static const gfx_layout x1_chars_16x16 = |
| 862 | 953 | { |
| r5970 | r5971 | |
| 913 | 1004 | MDRV_MB8877_ADD("fdc",towns_mb8877a_interface) |
| 914 | 1005 | MDRV_FLOPPY_2_DRIVES_ADD(towns_floppy_config) |
| 915 | 1006 | |
| 1007 | MDRV_UPD71071_ADD("dma_1",towns_dma_config) |
| 1008 | MDRV_UPD71071_ADD("dma_2",towns_dma_config) |
| 1009 | |
| 916 | 1010 | MDRV_VIDEO_START(towns) |
| 917 | 1011 | MDRV_VIDEO_UPDATE(towns) |
| 918 | 1012 | MACHINE_DRIVER_END |