src/mess/machine/coco.c
| r4386 | r4387 | |
| 84 | 84 | #include "driver.h" |
| 85 | 85 | #include "debug/debugcpu.h" |
| 86 | 86 | #include "cpu/m6809/m6809.h" |
| 87 | | #include "machine/6821pia.h" |
| 87 | #include "machine/6821new.h" |
| 88 | 88 | #include "includes/coco.h" |
| 89 | 89 | #include "includes/cococart.h" |
| 90 | 90 | #include "machine/6883sam.h" |
| r4386 | r4387 | |
| 124 | 124 | static emu_timer *mux_sel2_timer; |
| 125 | 125 | static UINT8 mux_sel1, mux_sel2; |
| 126 | 126 | |
| 127 | | static WRITE8_HANDLER ( d_pia1_pb_w ); |
| 128 | | static WRITE8_HANDLER ( d_pia1_pa_w ); |
| 129 | | static READ8_HANDLER ( d_pia1_pa_r ); |
| 130 | | static WRITE8_HANDLER ( d_pia0_pa_w ); |
| 131 | | static WRITE8_HANDLER ( d_pia0_pb_w ); |
| 132 | | static WRITE8_HANDLER ( d_pia1_cb2_w); |
| 133 | | static WRITE8_HANDLER ( d_pia0_cb2_w); |
| 134 | | static WRITE8_HANDLER ( d_pia1_ca2_w); |
| 135 | | static WRITE8_HANDLER ( d_pia0_ca2_w); |
| 136 | | static void d_pia0_irq_a(running_machine *machine, int state); |
| 137 | | static void d_pia0_irq_b(running_machine *machine, int state); |
| 138 | | static void d_pia1_firq_a(running_machine *machine, int state); |
| 139 | | static void d_pia1_firq_b(running_machine *machine, int state); |
| 127 | static WRITE8_DEVICE_HANDLER ( d_pia1_pb_w ); |
| 128 | static WRITE8_DEVICE_HANDLER ( d_pia1_pa_w ); |
| 129 | static READ8_DEVICE_HANDLER ( d_pia1_pa_r ); |
| 130 | static WRITE8_DEVICE_HANDLER ( d_pia0_pa_w ); |
| 131 | static WRITE8_DEVICE_HANDLER ( d_pia0_pb_w ); |
| 132 | static WRITE8_DEVICE_HANDLER ( d_pia1_cb2_w); |
| 133 | static WRITE8_DEVICE_HANDLER ( d_pia0_cb2_w); |
| 134 | static WRITE8_DEVICE_HANDLER ( d_pia1_ca2_w); |
| 135 | static WRITE8_DEVICE_HANDLER ( d_pia0_ca2_w); |
| 136 | static WRITE_LINE_DEVICE_HANDLER( d_pia0_irq_a ); |
| 137 | static WRITE_LINE_DEVICE_HANDLER( d_pia0_irq_b ); |
| 138 | static WRITE_LINE_DEVICE_HANDLER( d_pia1_firq_a ); |
| 139 | static WRITE_LINE_DEVICE_HANDLER( d_pia1_firq_b ); |
| 140 | 140 | static SAM6883_SET_PAGE_ONE_MODE( d_sam_set_pageonemode ); |
| 141 | 141 | static SAM6883_SET_MPU_RATE( d_sam_set_mpurate ); |
| 142 | 142 | static SAM6883_SET_MEMORY_SIZE( d_sam_set_memorysize); |
| 143 | 143 | static SAM6883_SET_MAP_TYPE( d_sam_set_maptype ); |
| 144 | 144 | |
| 145 | 145 | /* CoCo 1 specific */ |
| 146 | | static READ8_HANDLER ( d_pia1_pb_r_coco ); |
| 146 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_coco ); |
| 147 | 147 | |
| 148 | 148 | /* CoCo 2 specific */ |
| 149 | | static READ8_HANDLER ( d_pia1_pb_r_coco2 ); |
| 149 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_coco2 ); |
| 150 | 150 | |
| 151 | 151 | /* CoCo 3 specific */ |
| 152 | 152 | UINT8 coco3_gimereg[16]; |
| r4386 | r4387 | |
| 155 | 155 | static UINT8 coco3_interupt_line; |
| 156 | 156 | static UINT8 gime_firq, gime_irq; |
| 157 | 157 | |
| 158 | | static void coco3_pia0_irq_a(running_machine *machine, int state); |
| 159 | | static void coco3_pia0_irq_b(running_machine *machine, int state); |
| 160 | | static void coco3_pia1_firq_a(running_machine *machine, int state); |
| 161 | | static void coco3_pia1_firq_b(running_machine *machine, int state); |
| 158 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia0_irq_a ); |
| 159 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia0_irq_b ); |
| 160 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia1_firq_a ); |
| 161 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia1_firq_b ); |
| 162 | 162 | |
| 163 | 163 | static SAM6883_SET_MAP_TYPE( coco3_sam_set_maptype ); |
| 164 | 164 | static SAM6883_GET_RAMBASE( coco3_sam_get_rambase ); |
| 165 | 165 | |
| 166 | 166 | /* Dragon 32 specific */ |
| 167 | | static READ8_HANDLER ( d_pia1_pb_r_dragon32 ); |
| 167 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_dragon32 ); |
| 168 | 168 | |
| 169 | 169 | /* Dragon 64 / 64 Plus / Tano (Alpha) specific */ |
| 170 | | static WRITE8_HANDLER ( dragon64_pia1_pb_w ); |
| 170 | static WRITE8_DEVICE_HANDLER ( dragon64_pia1_pb_w ); |
| 171 | 171 | |
| 172 | 172 | /* Dragon 64 / Alpha shared */ |
| 173 | 173 | static void dragon_page_rom(running_machine *machine, int romswitch); |
| 174 | 174 | |
| 175 | 175 | /* Dragon Alpha specific */ |
| 176 | | static WRITE8_HANDLER ( dgnalpha_pia2_pa_w ); |
| 177 | | static void d_pia2_firq_a(running_machine *machine, int state); |
| 178 | | static void d_pia2_firq_b(running_machine *machine, int state); |
| 176 | static WRITE8_DEVICE_HANDLER ( dgnalpha_pia2_pa_w ); |
| 177 | static WRITE_LINE_DEVICE_HANDLER( d_pia2_firq_a ); |
| 178 | static WRITE_LINE_DEVICE_HANDLER( d_pia2_firq_b ); |
| 179 | 179 | static int dgnalpha_just_reset; /* Reset flag used to ignore first NMI after reset */ |
| 180 | 180 | |
| 181 | 181 | /* Dragon Plus specific */ |
| r4386 | r4387 | |
| 260 | 260 | |
| 261 | 261 | /* ----------------------------------------------------------------------- */ |
| 262 | 262 | |
| 263 | | static const pia6821_interface coco_pia_intf[] = |
| 263 | const pia6821_interface coco_pia_intf[] = |
| 264 | 264 | { |
| 265 | 265 | /* PIA 0 */ |
| 266 | 266 | { |
| 267 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 268 | | /*outputs: A/B,CA/B2 */ d_pia0_pa_w, d_pia0_pb_w, d_pia0_ca2_w, d_pia0_cb2_w, |
| 269 | | /*irqs : A/B */ d_pia0_irq_a, d_pia0_irq_b |
| 267 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 268 | DEVCB_NULL, |
| 269 | DEVCB_NULL, |
| 270 | DEVCB_NULL, |
| 271 | DEVCB_NULL, |
| 272 | DEVCB_NULL, |
| 273 | DEVCB_NULL, |
| 274 | /*outputs: A/B,CA/B2 */ |
| 275 | DEVCB_HANDLER(d_pia0_pa_w), |
| 276 | DEVCB_HANDLER(d_pia0_pb_w), |
| 277 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 278 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 279 | /*irqs : A/B */ |
| 280 | DEVCB_LINE(d_pia0_irq_a), |
| 281 | DEVCB_LINE(d_pia0_irq_b) |
| 270 | 282 | }, |
| 271 | 283 | |
| 272 | 284 | /* PIA 1 */ |
| 273 | 285 | { |
| 274 | | /*inputs : A/B,CA/B1,CA/B2 */ d_pia1_pa_r, d_pia1_pb_r_coco, 0, 0, 0, 0, |
| 275 | | /*outputs: A/B,CA/B2 */ d_pia1_pa_w, d_pia1_pb_w, d_pia1_ca2_w, d_pia1_cb2_w, |
| 276 | | /*irqs : A/B */ d_pia1_firq_a, d_pia1_firq_b |
| 286 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 287 | DEVCB_HANDLER(d_pia1_pa_r), |
| 288 | DEVCB_HANDLER(d_pia1_pb_r_coco), |
| 289 | DEVCB_NULL, |
| 290 | DEVCB_NULL, |
| 291 | DEVCB_NULL, |
| 292 | DEVCB_NULL, |
| 293 | /*outputs: A/B,CA/B2 */ |
| 294 | DEVCB_HANDLER(d_pia1_pa_w), |
| 295 | DEVCB_HANDLER(d_pia1_pb_w), |
| 296 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 297 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 298 | /*irqs : A/B */ |
| 299 | DEVCB_LINE(d_pia1_firq_a), |
| 300 | DEVCB_LINE(d_pia1_firq_b) |
| 277 | 301 | } |
| 278 | 302 | }; |
| 279 | 303 | |
| 280 | | static const pia6821_interface coco2_pia_intf[] = |
| 304 | const pia6821_interface coco2_pia_intf[] = |
| 281 | 305 | { |
| 282 | 306 | /* PIA 0 */ |
| 283 | 307 | { |
| 284 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 285 | | /*outputs: A/B,CA/B2 */ d_pia0_pa_w, d_pia0_pb_w, d_pia0_ca2_w, d_pia0_cb2_w, |
| 286 | | /*irqs : A/B */ d_pia0_irq_a, d_pia0_irq_b |
| 308 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 309 | DEVCB_NULL, |
| 310 | DEVCB_NULL, |
| 311 | DEVCB_NULL, |
| 312 | DEVCB_NULL, |
| 313 | DEVCB_NULL, |
| 314 | DEVCB_NULL, |
| 315 | /*outputs: A/B,CA/B2 */ |
| 316 | DEVCB_HANDLER(d_pia0_pa_w), |
| 317 | DEVCB_HANDLER(d_pia0_pb_w), |
| 318 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 319 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 320 | /*irqs : A/B */ |
| 321 | DEVCB_LINE(d_pia0_irq_a), |
| 322 | DEVCB_LINE(d_pia0_irq_b) |
| 287 | 323 | }, |
| 288 | 324 | |
| 289 | 325 | /* PIA 1 */ |
| 290 | 326 | { |
| 291 | | /*inputs : A/B,CA/B1,CA/B2 */ d_pia1_pa_r, d_pia1_pb_r_coco2, 0, 0, 0, 0, |
| 292 | | /*outputs: A/B,CA/B2 */ d_pia1_pa_w, d_pia1_pb_w, d_pia1_ca2_w, d_pia1_cb2_w, |
| 293 | | /*irqs : A/B */ d_pia1_firq_a, d_pia1_firq_b |
| 327 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 328 | DEVCB_HANDLER(d_pia1_pa_r), |
| 329 | DEVCB_HANDLER(d_pia1_pb_r_coco2), |
| 330 | DEVCB_NULL, |
| 331 | DEVCB_NULL, |
| 332 | DEVCB_NULL, |
| 333 | DEVCB_NULL, |
| 334 | /*outputs: A/B,CA/B2 */ |
| 335 | DEVCB_HANDLER(d_pia1_pa_w), |
| 336 | DEVCB_HANDLER(d_pia1_pb_w), |
| 337 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 338 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 339 | /*irqs : A/B */ |
| 340 | DEVCB_LINE(d_pia1_firq_a), |
| 341 | DEVCB_LINE(d_pia1_firq_b) |
| 294 | 342 | } |
| 295 | 343 | }; |
| 296 | 344 | |
| 297 | | static const pia6821_interface coco3_pia_intf[] = |
| 345 | const pia6821_interface coco3_pia_intf[] = |
| 298 | 346 | { |
| 299 | 347 | /* PIA 0 */ |
| 300 | 348 | { |
| 301 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 302 | | /*outputs: A/B,CA/B2 */ d_pia0_pa_w, d_pia0_pb_w, d_pia0_ca2_w, d_pia0_cb2_w, |
| 303 | | /*irqs : A/B */ coco3_pia0_irq_a, coco3_pia0_irq_b |
| 349 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 350 | DEVCB_NULL, |
| 351 | DEVCB_NULL, |
| 352 | DEVCB_NULL, |
| 353 | DEVCB_NULL, |
| 354 | DEVCB_NULL, |
| 355 | DEVCB_NULL, |
| 356 | /*outputs: A/B,CA/B2 */ |
| 357 | DEVCB_HANDLER(d_pia0_pa_w), |
| 358 | DEVCB_HANDLER(d_pia0_pb_w), |
| 359 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 360 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 361 | /*irqs : A/B */ |
| 362 | DEVCB_LINE(coco3_pia0_irq_a), |
| 363 | DEVCB_LINE(coco3_pia0_irq_b) |
| 304 | 364 | }, |
| 305 | 365 | |
| 306 | 366 | /* PIA 1 */ |
| 307 | 367 | { |
| 308 | | /*inputs : A/B,CA/B1,CA/B2 */ d_pia1_pa_r, d_pia1_pb_r_coco2, 0, 0, 0, 0, |
| 309 | | /*outputs: A/B,CA/B2 */ d_pia1_pa_w, d_pia1_pb_w, d_pia1_ca2_w, d_pia1_cb2_w, |
| 310 | | /*irqs : A/B */ coco3_pia1_firq_a, coco3_pia1_firq_b |
| 368 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 369 | DEVCB_HANDLER(d_pia1_pa_r), |
| 370 | DEVCB_HANDLER(d_pia1_pb_r_coco2), |
| 371 | DEVCB_NULL, |
| 372 | DEVCB_NULL, |
| 373 | DEVCB_NULL, |
| 374 | DEVCB_NULL, |
| 375 | /*outputs: A/B,CA/B2 */ |
| 376 | DEVCB_HANDLER(d_pia1_pa_w), |
| 377 | DEVCB_HANDLER(d_pia1_pb_w), |
| 378 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 379 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 380 | /*irqs : A/B */ |
| 381 | DEVCB_LINE(coco3_pia1_firq_a), |
| 382 | DEVCB_LINE(coco3_pia1_firq_b) |
| 311 | 383 | } |
| 312 | 384 | }; |
| 313 | 385 | |
| 314 | | static const pia6821_interface dragon32_pia_intf[] = |
| 386 | const pia6821_interface dragon32_pia_intf[] = |
| 315 | 387 | { |
| 316 | 388 | /* PIA 0 */ |
| 317 | 389 | { |
| 318 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 319 | | /*outputs: A/B,CA/B2 */ d_pia0_pa_w, d_pia0_pb_w, d_pia0_ca2_w, d_pia0_cb2_w, |
| 320 | | /*irqs : A/B */ d_pia0_irq_a, d_pia0_irq_b |
| 390 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 391 | DEVCB_NULL, |
| 392 | DEVCB_NULL, |
| 393 | DEVCB_NULL, |
| 394 | DEVCB_NULL, |
| 395 | DEVCB_NULL, |
| 396 | DEVCB_NULL, |
| 397 | /*outputs: A/B,CA/B2 */ |
| 398 | DEVCB_HANDLER(d_pia0_pa_w), |
| 399 | DEVCB_HANDLER(d_pia0_pb_w), |
| 400 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 401 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 402 | /*irqs : A/B */ |
| 403 | DEVCB_LINE(d_pia0_irq_a), |
| 404 | DEVCB_LINE(d_pia0_irq_b) |
| 321 | 405 | }, |
| 322 | 406 | |
| 323 | 407 | /* PIA 1 */ |
| 324 | 408 | { |
| 325 | | /*inputs : A/B,CA/B1,CA/B2 */ d_pia1_pa_r, d_pia1_pb_r_dragon32, 0, 0, 0, 0, |
| 326 | | /*outputs: A/B,CA/B2 */ d_pia1_pa_w, d_pia1_pb_w, d_pia1_ca2_w, d_pia1_cb2_w, |
| 327 | | /*irqs : A/B */ d_pia1_firq_a, d_pia1_firq_b |
| 409 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 410 | DEVCB_HANDLER(d_pia1_pa_r), |
| 411 | DEVCB_HANDLER(d_pia1_pb_r_dragon32), |
| 412 | DEVCB_NULL, |
| 413 | DEVCB_NULL, |
| 414 | DEVCB_NULL, |
| 415 | DEVCB_NULL, |
| 416 | /*outputs: A/B,CA/B2 */ |
| 417 | DEVCB_HANDLER(d_pia1_pa_w), |
| 418 | DEVCB_HANDLER(d_pia1_pb_w), |
| 419 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 420 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 421 | /*irqs : A/B */ |
| 422 | DEVCB_LINE(d_pia1_firq_a), |
| 423 | DEVCB_LINE(d_pia1_firq_b) |
| 328 | 424 | } |
| 329 | 425 | }; |
| 330 | 426 | |
| 331 | | static const pia6821_interface dragon64_pia_intf[] = |
| 427 | const pia6821_interface dragon64_pia_intf[] = |
| 332 | 428 | { |
| 333 | 429 | /* PIA 0 */ |
| 334 | 430 | { |
| 335 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 336 | | /*outputs: A/B,CA/B2 */ d_pia0_pa_w, d_pia0_pb_w, d_pia0_ca2_w, d_pia0_cb2_w, |
| 337 | | /*irqs : A/B */ d_pia0_irq_a, d_pia0_irq_b |
| 431 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 432 | DEVCB_NULL, |
| 433 | DEVCB_NULL, |
| 434 | DEVCB_NULL, |
| 435 | DEVCB_NULL, |
| 436 | DEVCB_NULL, |
| 437 | DEVCB_NULL, |
| 438 | /*outputs: A/B,CA/B2 */ |
| 439 | DEVCB_HANDLER(d_pia0_pa_w), |
| 440 | DEVCB_HANDLER(d_pia0_pb_w), |
| 441 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 442 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 443 | /*irqs : A/B */ |
| 444 | DEVCB_LINE(d_pia0_irq_a), |
| 445 | DEVCB_LINE(d_pia0_irq_b) |
| 338 | 446 | }, |
| 339 | 447 | |
| 340 | 448 | /* PIA 1 */ |
| 341 | 449 | { |
| 342 | | /*inputs : A/B,CA/B1,CA/B2 */ d_pia1_pa_r, d_pia1_pb_r_coco, 0, 0, 0, 0, |
| 343 | | /*outputs: A/B,CA/B2 */ d_pia1_pa_w, dragon64_pia1_pb_w, d_pia1_ca2_w, d_pia1_cb2_w, |
| 344 | | /*irqs : A/B */ d_pia1_firq_a, d_pia1_firq_b |
| 450 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 451 | DEVCB_HANDLER(d_pia1_pa_r), |
| 452 | DEVCB_HANDLER(d_pia1_pb_r_coco), |
| 453 | DEVCB_NULL, |
| 454 | DEVCB_NULL, |
| 455 | DEVCB_NULL, |
| 456 | DEVCB_NULL, |
| 457 | /*outputs: A/B,CA/B2 */ |
| 458 | DEVCB_HANDLER(d_pia1_pa_w), |
| 459 | DEVCB_HANDLER(dragon64_pia1_pb_w), |
| 460 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 461 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 462 | /*irqs : A/B */ |
| 463 | DEVCB_LINE(d_pia1_firq_a), |
| 464 | DEVCB_LINE(d_pia1_firq_b) |
| 345 | 465 | } |
| 346 | 466 | }; |
| 347 | 467 | |
| 348 | | static const pia6821_interface dgnalpha_pia_intf[] = |
| 468 | const pia6821_interface dgnalpha_pia_intf[] = |
| 349 | 469 | { |
| 350 | 470 | /* PIA 0 and 1 as Dragon 64 */ |
| 351 | 471 | /* PIA 0 */ |
| 352 | 472 | { |
| 353 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 354 | | /*outputs: A/B,CA/B2 */ d_pia0_pa_w, d_pia0_pb_w, d_pia0_ca2_w, d_pia0_cb2_w, |
| 355 | | /*irqs : A/B */ d_pia0_irq_a, d_pia0_irq_b |
| 473 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 474 | DEVCB_NULL, |
| 475 | DEVCB_NULL, |
| 476 | DEVCB_NULL, |
| 477 | DEVCB_NULL, |
| 478 | DEVCB_NULL, |
| 479 | DEVCB_NULL, |
| 480 | /*outputs: A/B,CA/B2 */ |
| 481 | DEVCB_HANDLER(d_pia0_pa_w), |
| 482 | DEVCB_HANDLER(d_pia0_pb_w), |
| 483 | DEVCB_HANDLER(d_pia0_ca2_w), |
| 484 | DEVCB_HANDLER(d_pia0_cb2_w), |
| 485 | /*irqs : A/B */ |
| 486 | DEVCB_LINE(d_pia0_irq_a), |
| 487 | DEVCB_LINE(d_pia0_irq_b) |
| 356 | 488 | }, |
| 357 | 489 | |
| 358 | 490 | /* PIA 1 */ |
| 359 | 491 | { |
| 360 | | /*inputs : A/B,CA/B1,CA/B2 */ d_pia1_pa_r, d_pia1_pb_r_coco, 0, 0, 0, 0, |
| 361 | | /*outputs: A/B,CA/B2 */ d_pia1_pa_w, d_pia1_pb_w, d_pia1_ca2_w, d_pia1_cb2_w, |
| 362 | | /*irqs : A/B */ d_pia1_firq_a, d_pia1_firq_b |
| 492 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 493 | DEVCB_HANDLER(d_pia1_pa_r), |
| 494 | DEVCB_HANDLER(d_pia1_pb_r_coco), |
| 495 | DEVCB_NULL, |
| 496 | DEVCB_NULL, |
| 497 | DEVCB_NULL, |
| 498 | DEVCB_NULL, |
| 499 | /*outputs: A/B,CA/B2 */ |
| 500 | DEVCB_HANDLER(d_pia1_pa_w), |
| 501 | DEVCB_HANDLER(d_pia1_pb_w), |
| 502 | DEVCB_HANDLER(d_pia1_ca2_w), |
| 503 | DEVCB_HANDLER(d_pia1_cb2_w), |
| 504 | /*irqs : A/B */ |
| 505 | DEVCB_LINE(d_pia1_firq_a), |
| 506 | DEVCB_LINE(d_pia1_firq_b) |
| 363 | 507 | }, |
| 364 | 508 | |
| 365 | 509 | /* PIA 2 */ |
| 366 | 510 | { |
| 367 | | /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, |
| 368 | | /*outputs: A/B,CA/B2 */ dgnalpha_pia2_pa_w, 0, 0, 0, |
| 369 | | /*irqs : A/B */ d_pia2_firq_a, d_pia2_firq_b |
| 511 | /*inputs : A/B,CA/B1,CA/B2 */ |
| 512 | DEVCB_NULL, |
| 513 | DEVCB_NULL, |
| 514 | DEVCB_NULL, |
| 515 | DEVCB_NULL, |
| 516 | DEVCB_NULL, |
| 517 | DEVCB_NULL, |
| 518 | /*outputs: A/B,CA/B2 */ |
| 519 | DEVCB_HANDLER(dgnalpha_pia2_pa_w), |
| 520 | DEVCB_NULL, |
| 521 | DEVCB_NULL, |
| 522 | DEVCB_NULL, |
| 523 | /*irqs : A/B */ |
| 524 | DEVCB_LINE(d_pia2_firq_a), |
| 525 | DEVCB_LINE(d_pia2_firq_b) |
| 370 | 526 | } |
| 371 | 527 | |
| 372 | 528 | }; |
| r4386 | r4387 | |
| 449 | 605 | static void pak_load_trailer(running_machine *machine, const pak_decodedtrailer *trailer) |
| 450 | 606 | { |
| 451 | 607 | const device_config *sam = devtag_get_device(machine, SAM6883, "sam"); |
| 608 | const device_config *pia_0 = devtag_get_device(machine, PIA6821, "pia_0"); |
| 609 | const device_config *pia_1 = devtag_get_device(machine, PIA6821, "pia_1"); |
| 610 | |
| 452 | 611 | cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc); |
| 453 | 612 | cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x); |
| 454 | 613 | cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y); |
| r4386 | r4387 | |
| 465 | 624 | * startup. I wish I had a better solution |
| 466 | 625 | */ |
| 467 | 626 | |
| 468 | | pia_write(0, 1, 0x00); |
| 469 | | pia_write(0, 3, 0x00); |
| 470 | | pia_write(0, 0, 0x00); |
| 471 | | pia_write(0, 2, 0xff); |
| 472 | | pia_write(1, 1, 0x00); |
| 473 | | pia_write(1, 3, 0x00); |
| 474 | | pia_write(1, 0, 0xfe); |
| 475 | | pia_write(1, 2, 0xf8); |
| 627 | pia_w(pia_0, 1, 0x00); |
| 628 | pia_w(pia_0, 3, 0x00); |
| 629 | pia_w(pia_0, 0, 0x00); |
| 630 | pia_w(pia_0, 2, 0xff); |
| 631 | pia_w(pia_1, 1, 0x00); |
| 632 | pia_w(pia_1, 3, 0x00); |
| 633 | pia_w(pia_1, 0, 0xfe); |
| 634 | pia_w(pia_1, 2, 0xf8); |
| 476 | 635 | |
| 477 | | pia_write(0, 1, trailer->pia[1]); |
| 478 | | pia_write(0, 0, trailer->pia[0]); |
| 479 | | pia_write(0, 3, trailer->pia[3]); |
| 480 | | pia_write(0, 2, trailer->pia[2]); |
| 636 | pia_w(pia_0, 1, trailer->pia[1]); |
| 637 | pia_w(pia_0, 0, trailer->pia[0]); |
| 638 | pia_w(pia_0, 3, trailer->pia[3]); |
| 639 | pia_w(pia_0, 2, trailer->pia[2]); |
| 481 | 640 | |
| 482 | | pia_write(1, 1, trailer->pia[5]); |
| 483 | | pia_write(1, 0, trailer->pia[4]); |
| 484 | | pia_write(1, 3, trailer->pia[7]); |
| 485 | | pia_write(1, 2, trailer->pia[6]); |
| 641 | pia_w(pia_1, 1, trailer->pia[5]); |
| 642 | pia_w(pia_1, 0, trailer->pia[4]); |
| 643 | pia_w(pia_1, 3, trailer->pia[7]); |
| 644 | pia_w(pia_1, 2, trailer->pia[6]); |
| 486 | 645 | |
| 487 | 646 | /* For some reason, specifying use of high ram seems to screw things up; |
| 488 | 647 | * I'm not sure whether it is because I'm using the wrong method to get |
| r4386 | r4387 | |
| 756 | 915 | |
| 757 | 916 | static void d_recalc_irq(running_machine *machine) |
| 758 | 917 | { |
| 759 | | UINT8 pia0_irq_a = pia_get_irq_a(0); |
| 760 | | UINT8 pia0_irq_b = pia_get_irq_b(0); |
| 918 | const device_config *pia_0 = devtag_get_device( machine, PIA6821, "pia_0" ); |
| 919 | UINT8 pia0_irq_a = pianew_get_irq_a(pia_0); |
| 920 | UINT8 pia0_irq_b = pianew_get_irq_b(pia_0); |
| 761 | 921 | |
| 762 | 922 | if (pia0_irq_a || pia0_irq_b) |
| 763 | 923 | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); |
| r4386 | r4387 | |
| 767 | 927 | |
| 768 | 928 | static void d_recalc_firq(running_machine *machine) |
| 769 | 929 | { |
| 770 | | UINT8 pia1_firq_a = pia_get_irq_a(1); |
| 771 | | UINT8 pia1_firq_b = pia_get_irq_b(1); |
| 772 | | UINT8 pia2_firq_a = pia_get_irq_a(2); |
| 773 | | UINT8 pia2_firq_b = pia_get_irq_b(2); |
| 930 | const device_config *pia_1 = devtag_get_device( machine, PIA6821, "pia_1" ); |
| 931 | const device_config *pia_2 = devtag_get_device( machine, PIA6821, "pia_2" ); |
| 932 | UINT8 pia1_firq_a = pianew_get_irq_a(pia_1); |
| 933 | UINT8 pia1_firq_b = pianew_get_irq_b(pia_1); |
| 934 | UINT8 pia2_firq_a = pianew_get_irq_a(pia_2); |
| 935 | UINT8 pia2_firq_b = pianew_get_irq_b(pia_2); |
| 774 | 936 | |
| 775 | 937 | if (pia1_firq_a || pia1_firq_b || pia2_firq_a || pia2_firq_b) |
| 776 | 938 | cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE); |
| r4386 | r4387 | |
| 794 | 956 | d_recalc_firq(machine); |
| 795 | 957 | } |
| 796 | 958 | |
| 797 | | static void d_pia0_irq_a(running_machine *machine, int state) |
| 959 | static WRITE_LINE_DEVICE_HANDLER( d_pia0_irq_a ) |
| 798 | 960 | { |
| 799 | | d_recalc_irq(machine); |
| 961 | d_recalc_irq(device->machine); |
| 800 | 962 | } |
| 801 | 963 | |
| 802 | | static void d_pia0_irq_b(running_machine *machine, int state) |
| 964 | static WRITE_LINE_DEVICE_HANDLER( d_pia0_irq_b ) |
| 803 | 965 | { |
| 804 | | d_recalc_irq(machine); |
| 966 | d_recalc_irq(device->machine); |
| 805 | 967 | } |
| 806 | 968 | |
| 807 | | static void d_pia1_firq_a(running_machine *machine, int state) |
| 969 | static WRITE_LINE_DEVICE_HANDLER( d_pia1_firq_a ) |
| 808 | 970 | { |
| 809 | | d_recalc_firq(machine); |
| 971 | d_recalc_firq(device->machine); |
| 810 | 972 | } |
| 811 | 973 | |
| 812 | | static void d_pia1_firq_b(running_machine *machine, int state) |
| 974 | static WRITE_LINE_DEVICE_HANDLER( d_pia1_firq_b ) |
| 813 | 975 | { |
| 814 | | d_recalc_firq(machine); |
| 976 | d_recalc_firq(device->machine); |
| 815 | 977 | } |
| 816 | 978 | |
| 817 | 979 | /* Dragon Alpha second PIA IRQ lines also cause FIRQ */ |
| 818 | | static void d_pia2_firq_a(running_machine *machine, int state) |
| 980 | static WRITE_LINE_DEVICE_HANDLER( d_pia2_firq_a ) |
| 819 | 981 | { |
| 820 | | d_recalc_firq(machine); |
| 982 | d_recalc_firq(device->machine); |
| 821 | 983 | } |
| 822 | 984 | |
| 823 | | static void d_pia2_firq_b(running_machine *machine, int state) |
| 985 | static WRITE_LINE_DEVICE_HANDLER( d_pia2_firq_b ) |
| 824 | 986 | { |
| 825 | | d_recalc_firq(machine); |
| 987 | d_recalc_firq(device->machine); |
| 826 | 988 | } |
| 827 | 989 | |
| 828 | | static void coco3_pia0_irq_a(running_machine *machine, int state) |
| 990 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia0_irq_a ) |
| 829 | 991 | { |
| 830 | | coco3_recalc_irq(machine); |
| 992 | coco3_recalc_irq(device->machine); |
| 831 | 993 | } |
| 832 | 994 | |
| 833 | | static void coco3_pia0_irq_b(running_machine *machine, int state) |
| 995 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia0_irq_b ) |
| 834 | 996 | { |
| 835 | | coco3_recalc_irq(machine); |
| 997 | coco3_recalc_irq(device->machine); |
| 836 | 998 | } |
| 837 | 999 | |
| 838 | | static void coco3_pia1_firq_a(running_machine *machine, int state) |
| 1000 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia1_firq_a ) |
| 839 | 1001 | { |
| 840 | | coco3_recalc_firq(machine); |
| 1002 | coco3_recalc_firq(device->machine); |
| 841 | 1003 | } |
| 842 | 1004 | |
| 843 | | static void coco3_pia1_firq_b(running_machine *machine, int state) |
| 1005 | static WRITE_LINE_DEVICE_HANDLER( coco3_pia1_firq_b ) |
| 844 | 1006 | { |
| 845 | | coco3_recalc_firq(machine); |
| 1007 | coco3_recalc_firq(device->machine); |
| 846 | 1008 | } |
| 847 | 1009 | |
| 848 | 1010 | static void coco3_raise_interrupt(running_machine *machine, UINT8 mask, int state) |
| r4386 | r4387 | |
| 881 | 1043 | |
| 882 | 1044 | void coco3_horizontal_sync_callback(running_machine *machine,int data) |
| 883 | 1045 | { |
| 884 | | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1046 | const device_config *pia_0 = devtag_get_device( machine, PIA6821, "pia_0" ); |
| 885 | 1047 | |
| 886 | | pia_0_ca1_w(space, 0, data); |
| 1048 | pia_ca1_w(pia_0, 0, data); |
| 887 | 1049 | coco3_raise_interrupt(machine, COCO3_INT_HBORD, data); |
| 888 | 1050 | } |
| 889 | 1051 | |
| r4386 | r4387 | |
| 891 | 1053 | |
| 892 | 1054 | void coco3_field_sync_callback(running_machine *machine,int data) |
| 893 | 1055 | { |
| 894 | | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1056 | const device_config *pia_0 = devtag_get_device( machine, PIA6821, "pia_0" ); |
| 895 | 1057 | |
| 896 | | pia_0_cb1_w(space, 0, data); |
| 1058 | pia_cb1_w(pia_0, 0, data); |
| 897 | 1059 | } |
| 898 | 1060 | |
| 899 | 1061 | void coco3_gime_field_sync_callback(running_machine *machine) |
| r4386 | r4387 | |
| 1135 | 1297 | return state->cococart_device; |
| 1136 | 1298 | } |
| 1137 | 1299 | |
| 1138 | | static int get_soundmux_status(void) |
| 1300 | static int get_soundmux_status(running_machine *machine) |
| 1139 | 1301 | { |
| 1302 | const device_config *pia_1 = devtag_get_device( machine, PIA6821, "pia_1" ); |
| 1303 | |
| 1140 | 1304 | int soundmux_status = 0; |
| 1141 | | if (pia_get_output_cb2(1)) |
| 1305 | if (pianew_get_output_cb2(pia_1)) |
| 1142 | 1306 | soundmux_status |= SOUNDMUX_STATUS_ENABLE; |
| 1143 | 1307 | if (mux_sel1) |
| 1144 | 1308 | soundmux_status |= SOUNDMUX_STATUS_SEL1; |
| r4386 | r4387 | |
| 1155 | 1319 | * switch on or off. |
| 1156 | 1320 | */ |
| 1157 | 1321 | cassette_state new_state; |
| 1158 | | int soundmux_status = get_soundmux_status(); |
| 1322 | int soundmux_status = get_soundmux_status(machine); |
| 1159 | 1323 | |
| 1160 | 1324 | switch(soundmux_status) { |
| 1161 | 1325 | case SOUNDMUX_STATUS_ENABLE | SOUNDMUX_STATUS_SEL1: |
| r4386 | r4387 | |
| 1181 | 1345 | static void coco_sound_update(running_machine *machine) |
| 1182 | 1346 | { |
| 1183 | 1347 | const device_config *dac_device = devtag_get_device(machine, SOUND, "dac"); |
| 1348 | const device_config *pia_1 = devtag_get_device( machine, PIA6821, "pia_1" ); |
| 1184 | 1349 | |
| 1185 | 1350 | /* Call this function whenever you need to update the sound. It will |
| 1186 | 1351 | * automatically mute any devices that are switched out. |
| 1187 | 1352 | */ |
| 1188 | | UINT8 dac = pia_get_output_a(1) & 0xFC; |
| 1189 | | UINT8 pia1_pb1 = (pia_get_output_b(1) & 0x02) ? 0x80 : 0x00; |
| 1190 | | int soundmux_status = get_soundmux_status(); |
| 1353 | UINT8 dac = pianew_get_output_a(pia_1) & 0xFC; |
| 1354 | UINT8 pia1_pb1 = (pianew_get_output_b(pia_1) & 0x02) ? 0x80 : 0x00; |
| 1355 | int soundmux_status = get_soundmux_status(machine); |
| 1191 | 1356 | |
| 1192 | 1357 | switch(soundmux_status) |
| 1193 | 1358 | { |
| r4386 | r4387 | |
| 1253 | 1418 | PIA0 CB2 - SEL2 (Used by sound mux and joystick) |
| 1254 | 1419 | ***************************************************************************/ |
| 1255 | 1420 | |
| 1256 | | static WRITE8_HANDLER ( d_pia0_ca2_w ) |
| 1421 | static WRITE8_DEVICE_HANDLER ( d_pia0_ca2_w ) |
| 1257 | 1422 | { |
| 1258 | 1423 | timer_adjust_oneshot(mux_sel1_timer, JOYSTICK_MUX_DELAY, data); |
| 1259 | 1424 | } |
| r4386 | r4387 | |
| 1265 | 1430 | soundmux_update(machine); |
| 1266 | 1431 | } |
| 1267 | 1432 | |
| 1268 | | static WRITE8_HANDLER ( d_pia0_cb2_w ) |
| 1433 | static WRITE8_DEVICE_HANDLER ( d_pia0_cb2_w ) |
| 1269 | 1434 | { |
| 1270 | 1435 | timer_adjust_oneshot(mux_sel2_timer, JOYSTICK_MUX_DELAY, data); |
| 1271 | 1436 | } |
| r4386 | r4387 | |
| 1294 | 1459 | |
| 1295 | 1460 | static UINT8 coco_update_keyboard(running_machine *machine) |
| 1296 | 1461 | { |
| 1462 | const device_config *pia_0 = devtag_get_device( machine, PIA6821, "pia_0" ); |
| 1463 | const device_config *pia_1 = devtag_get_device( machine, PIA6821, "pia_1" ); |
| 1297 | 1464 | UINT8 porta = 0x7F, port_za = 0x7f; |
| 1298 | 1465 | int joyval; |
| 1299 | 1466 | static const int joy_rat_table[] = {15, 24, 42, 33 }; |
| 1300 | 1467 | static const int dclg_table[] = {0, 14, 30, 49 }; |
| 1301 | 1468 | attotime dclg_time = attotime_zero; |
| 1302 | 1469 | UINT8 pia0_pb; |
| 1303 | | UINT8 dac = pia_get_output_a(1) & 0xFC; |
| 1470 | UINT8 dac = pianew_get_output_a(pia_1) & 0xFC; |
| 1304 | 1471 | int joystick_axis, joystick; |
| 1305 | | pia0_pb = pia_get_output_b(0); |
| 1472 | pia0_pb = pianew_get_output_b(pia_0); |
| 1306 | 1473 | joystick_axis = mux_sel1; |
| 1307 | 1474 | joystick = mux_sel2; |
| 1308 | 1475 | |
| r4386 | r4387 | |
| 1315 | 1482 | if ((input_port_read(machine, "row5") | pia0_pb) != 0xff) porta &= ~0x20; |
| 1316 | 1483 | if ((input_port_read(machine, "row6") | pia0_pb) != 0xff) porta &= ~0x40; |
| 1317 | 1484 | |
| 1318 | | if ((input_port_read(machine, "row0") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x01; |
| 1319 | | if ((input_port_read(machine, "row1") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x02; |
| 1320 | | if ((input_port_read(machine, "row2") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x04; |
| 1321 | | if ((input_port_read(machine, "row3") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x08; |
| 1322 | | if ((input_port_read(machine, "row4") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x10; |
| 1323 | | if ((input_port_read(machine, "row5") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x20; |
| 1324 | | if ((input_port_read(machine, "row6") | pia_get_port_b_z_mask(0)) != 0xff) port_za &= ~0x40; |
| 1485 | if ((input_port_read(machine, "row0") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x01; |
| 1486 | if ((input_port_read(machine, "row1") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x02; |
| 1487 | if ((input_port_read(machine, "row2") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x04; |
| 1488 | if ((input_port_read(machine, "row3") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x08; |
| 1489 | if ((input_port_read(machine, "row4") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x10; |
| 1490 | if ((input_port_read(machine, "row5") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x20; |
| 1491 | if ((input_port_read(machine, "row6") | pianew_get_port_b_z_mask(pia_0)) != 0xff) port_za &= ~0x40; |
| 1325 | 1492 | |
| 1326 | 1493 | switch(get_input_device(machine, joystick ? INPUTPORT_LEFT_JOYSTICK : INPUTPORT_RIGHT_JOYSTICK)) |
| 1327 | 1494 | { |
| r4386 | r4387 | |
| 1392 | 1559 | porta &= ~input_port_read_safe(machine, "joystick_buttons", 0); |
| 1393 | 1560 | port_za &= ~input_port_read_safe(machine, "joystick_buttons", 0); |
| 1394 | 1561 | |
| 1395 | | pia_set_input_a(0, porta, port_za); |
| 1562 | pianew_set_input_a(pia_0, porta, port_za); |
| 1396 | 1563 | return porta; |
| 1397 | 1564 | } |
| 1398 | 1565 | |
| r4386 | r4387 | |
| 1410 | 1577 | |
| 1411 | 1578 | |
| 1412 | 1579 | /* three functions that update the keyboard in varying ways */ |
| 1413 | | static WRITE8_HANDLER ( d_pia0_pb_w ) { (*update_keyboard)(space->machine); } |
| 1580 | static WRITE8_DEVICE_HANDLER ( d_pia0_pb_w ) { (*update_keyboard)(device->machine); } |
| 1414 | 1581 | INPUT_CHANGED(coco_keyboard_changed) { (*update_keyboard)(field->port->machine); } |
| 1415 | 1582 | static TIMER_CALLBACK(coco_update_keyboard_timerproc) { (*update_keyboard)(machine); } |
| 1416 | 1583 | |
| 1417 | | static WRITE8_HANDLER ( d_pia0_pa_w ) |
| 1584 | static WRITE8_DEVICE_HANDLER ( d_pia0_pa_w ) |
| 1418 | 1585 | { |
| 1419 | | if (get_input_device(space->machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_CC3MAX_INTERFACE) |
| 1420 | | coco_hiresjoy_w(space->machine, data & 0x04); |
| 1586 | if (get_input_device(device->machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_CC3MAX_INTERFACE) |
| 1587 | coco_hiresjoy_w(device->machine, data & 0x04); |
| 1421 | 1588 | } |
| 1422 | 1589 | |
| 1423 | 1590 | |
| r4386 | r4387 | |
| 1442 | 1609 | PIA1 CB2 - SNDEN (Sound Enable) |
| 1443 | 1610 | ***************************************************************************/ |
| 1444 | 1611 | |
| 1445 | | static WRITE8_HANDLER ( d_pia1_cb2_w ) |
| 1612 | static WRITE8_DEVICE_HANDLER ( d_pia1_cb2_w ) |
| 1446 | 1613 | { |
| 1447 | | soundmux_update(space->machine); |
| 1614 | soundmux_update(device->machine); |
| 1448 | 1615 | } |
| 1449 | 1616 | |
| 1450 | 1617 | /* Printer output functions used by d_pia1_pa_w */ |
| r4386 | r4387 | |
| 1459 | 1626 | /* Printer output for the Dragon, output to Paralel port */ |
| 1460 | 1627 | static void printer_out_dragon(running_machine *machine, int data) |
| 1461 | 1628 | { |
| 1629 | const device_config *pia_0 = devtag_get_device( machine, PIA6821, "pia_0" ); |
| 1630 | |
| 1462 | 1631 | /* If strobe bit is high send data from pia0 port b to dragon parallel printer */ |
| 1463 | 1632 | if (data & 0x02) |
| 1464 | 1633 | { |
| 1465 | | printer_output(printer_image(machine), pia_get_output_b(0)); |
| 1634 | printer_output(printer_image(machine), pianew_get_output_b(pia_0)); |
| 1466 | 1635 | } |
| 1467 | 1636 | } |
| 1468 | 1637 | |
| 1469 | | static WRITE8_HANDLER ( d_pia1_pa_w ) |
| 1638 | static WRITE8_DEVICE_HANDLER ( d_pia1_pa_w ) |
| 1470 | 1639 | { |
| 1471 | 1640 | /* |
| 1472 | 1641 | * This port appears at $FF20 |
| r4386 | r4387 | |
| 1475 | 1644 | * 7-2: DAC to speaker or cassette |
| 1476 | 1645 | * 1: Serial out (CoCo), Printer strobe (Dragon) |
| 1477 | 1646 | */ |
| 1478 | | UINT8 dac = pia_get_output_a(1) & 0xFC; |
| 1647 | UINT8 dac = pianew_get_output_a(device) & 0xFC; |
| 1479 | 1648 | static int dclg_previous_bit; |
| 1480 | 1649 | |
| 1481 | | coco_sound_update(space->machine); |
| 1650 | coco_sound_update(device->machine); |
| 1482 | 1651 | |
| 1483 | | if (get_input_device(space->machine, INPUTPORT_SERIAL) == INPUTDEVICE_DIECOM_LIGHTGUN) |
| 1652 | if (get_input_device(device->machine, INPUTPORT_SERIAL) == INPUTDEVICE_DIECOM_LIGHTGUN) |
| 1484 | 1653 | { |
| 1485 | 1654 | int dclg_this_bit = ((data & 2) >> 1); |
| 1486 | 1655 | |
| r4386 | r4387 | |
| 1523 | 1692 | } |
| 1524 | 1693 | else |
| 1525 | 1694 | { |
| 1526 | | cassette_output(cassette_device_image(space->machine), ((int) dac - 0x80) / 128.0); |
| 1695 | cassette_output(cassette_device_image(device->machine), ((int) dac - 0x80) / 128.0); |
| 1527 | 1696 | } |
| 1528 | 1697 | |
| 1529 | | (*update_keyboard)(space->machine); |
| 1698 | (*update_keyboard)(device->machine); |
| 1530 | 1699 | |
| 1531 | | if (get_input_device(space->machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_INTERFACE) |
| 1532 | | coco_hiresjoy_w(space->machine, dac >= 0x80); |
| 1700 | if (get_input_device(device->machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_INTERFACE) |
| 1701 | coco_hiresjoy_w(device->machine, dac >= 0x80); |
| 1533 | 1702 | |
| 1534 | 1703 | /* Handle printer output, serial for CoCos, Paralell for Dragons */ |
| 1535 | 1704 | |
| 1536 | | printer_out(space->machine, data); |
| 1705 | printer_out(device->machine, data); |
| 1537 | 1706 | } |
| 1538 | 1707 | |
| 1539 | 1708 | /* |
| r4386 | r4387 | |
| 1544 | 1713 | * semigraphics modes |
| 1545 | 1714 | */ |
| 1546 | 1715 | |
| 1547 | | static WRITE8_HANDLER( d_pia1_pb_w ) |
| 1716 | static WRITE8_DEVICE_HANDLER( d_pia1_pb_w ) |
| 1548 | 1717 | { |
| 1549 | 1718 | m6847_video_changed(); |
| 1550 | 1719 | |
| r4386 | r4387 | |
| 1554 | 1723 | * |
| 1555 | 1724 | * Source: Page 31 of the Tandy Color Computer Serice Manual |
| 1556 | 1725 | */ |
| 1557 | | coco_sound_update(space->machine); |
| 1726 | coco_sound_update(device->machine); |
| 1558 | 1727 | } |
| 1559 | 1728 | |
| 1560 | | static WRITE8_HANDLER( dragon64_pia1_pb_w ) |
| 1729 | static WRITE8_DEVICE_HANDLER( dragon64_pia1_pb_w ) |
| 1561 | 1730 | { |
| 1562 | 1731 | int ddr; |
| 1563 | 1732 | |
| 1564 | | d_pia1_pb_w(space, 0, data); |
| 1733 | d_pia1_pb_w(device, 0, data); |
| 1565 | 1734 | |
| 1566 | | ddr = ~pia_get_port_b_z_mask(1); |
| 1735 | ddr = ~pianew_get_port_b_z_mask(device); |
| 1567 | 1736 | |
| 1568 | 1737 | /* If bit 2 of the pia1 ddrb is 1 then this pin is an output so use it */ |
| 1569 | 1738 | /* to control the paging of the 32k and 64k basic roms */ |
| r4386 | r4387 | |
| 1571 | 1740 | /* always be high (enabling 32k basic rom) */ |
| 1572 | 1741 | if (ddr & 0x04) |
| 1573 | 1742 | { |
| 1574 | | dragon_page_rom(space->machine, data & 0x04); |
| 1743 | dragon_page_rom(device->machine, data & 0x04); |
| 1575 | 1744 | } |
| 1576 | 1745 | } |
| 1577 | 1746 | |
| r4386 | r4387 | |
| 1586 | 1755 | CB1 DRQ from WD2797 disk controler. |
| 1587 | 1756 | ***************************************************************************/ |
| 1588 | 1757 | |
| 1589 | | static WRITE8_HANDLER( dgnalpha_pia2_pa_w ) |
| 1758 | static WRITE8_DEVICE_HANDLER( dgnalpha_pia2_pa_w ) |
| 1590 | 1759 | { |
| 1591 | | const device_config *ay8912 = devtag_get_device(space->machine, SOUND, "ay8912"); |
| 1760 | const device_config *ay8912 = devtag_get_device(device->machine, SOUND, "ay8912"); |
| 1592 | 1761 | int bc_flags; /* BCDDIR/BC1, as connected to PIA2 port a bits 0 and 1 */ |
| 1593 | 1762 | |
| 1594 | 1763 | /* If bit 2 of the pia2 ddra is 1 then this pin is an output so use it */ |
| r4386 | r4387 | |
| 1597 | 1766 | /* always be high (enabling boot rom) */ |
| 1598 | 1767 | /* PIA FIXME if (pia_get_ddr_a(2) & 0x04) */ |
| 1599 | 1768 | { |
| 1600 | | dragon_page_rom(space->machine, data & 0x04); /* bit 2 controls boot or basic rom */ |
| 1769 | dragon_page_rom(device->machine, data & 0x04); /* bit 2 controls boot or basic rom */ |
| 1601 | 1770 | } |
| 1602 | 1771 | |
| 1603 | 1772 | /* Bits 0 and 1 for pia2 port a control the BCDIR and BC1 lines of the */ |
| r4386 | r4387 | |
| 1609 | 1778 | case 0x00 : /* Inactive, do nothing */ |
| 1610 | 1779 | break; |
| 1611 | 1780 | case 0x01 : /* Write to selected port */ |
| 1612 | | ay8910_data_w(ay8912, 0, pia_get_output_b(2)); |
| 1781 | ay8910_data_w(ay8912, 0, pianew_get_output_b(device)); |
| 1613 | 1782 | break; |
| 1614 | 1783 | case 0x02 : /* Read from selected port */ |
| 1615 | | pia_set_input_b(2, ay8910_r(ay8912, 0)); |
| 1784 | /* TODO FIXME 6821pia devicification |
| 1785 | pianew_set_input_b(device, ay8910_r(ay8912, 0)); |
| 1786 | */ |
| 1616 | 1787 | break; |
| 1617 | 1788 | case 0x03 : /* Select port to write to */ |
| 1618 | | ay8910_address_w(ay8912, 0, pia_get_output_b(2)); |
| 1789 | ay8910_address_w(ay8912, 0, pianew_get_output_b(device)); |
| 1619 | 1790 | break; |
| 1620 | 1791 | } |
| 1621 | 1792 | } |
| r4386 | r4387 | |
| 1648 | 1819 | /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2 */ |
| 1649 | 1820 | /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */ |
| 1650 | 1821 | /* for pia1 cb1 */ |
| 1822 | const device_config *pia_2 = devtag_get_device( device->machine, PIA6821, "pia_2" ); |
| 1651 | 1823 | |
| 1652 | | const address_space *space = cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1653 | | |
| 1654 | 1824 | switch(state) |
| 1655 | 1825 | { |
| 1656 | 1826 | case WD17XX_IRQ_CLR: |
| r4386 | r4387 | |
| 1663 | 1833 | } |
| 1664 | 1834 | else |
| 1665 | 1835 | { |
| 1666 | | if (pia_get_output_ca2_z(2)) |
| 1836 | if (pianew_get_output_ca2_z(pia_2)) |
| 1667 | 1837 | cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); |
| 1668 | 1838 | } |
| 1669 | 1839 | break; |
| 1670 | 1840 | case WD17XX_DRQ_CLR: |
| 1671 | | pia_2_cb1_w(space, 0, CARTLINE_CLEAR); |
| 1841 | pia_cb1_w(pia_2, 0, CARTLINE_CLEAR); |
| 1672 | 1842 | break; |
| 1673 | 1843 | case WD17XX_DRQ_SET: |
| 1674 | | pia_2_cb1_w(space, 0, CARTLINE_ASSERTED); |
| 1844 | pia_cb1_w(pia_2, 0, CARTLINE_ASSERTED); |
| 1675 | 1845 | break; |
| 1676 | 1846 | } |
| 1677 | 1847 | } |
| r4386 | r4387 | |
| 1735 | 1905 | { |
| 1736 | 1906 | } |
| 1737 | 1907 | |
| 1738 | | static WRITE8_HANDLER ( d_pia1_ca2_w ) |
| 1908 | static WRITE8_DEVICE_HANDLER ( d_pia1_ca2_w ) |
| 1739 | 1909 | { |
| 1740 | 1910 | cassette_change_state( |
| 1741 | | cassette_device_image(space->machine), |
| 1911 | cassette_device_image(device->machine), |
| 1742 | 1912 | data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 1743 | 1913 | CASSETTE_MASK_MOTOR); |
| 1744 | 1914 | } |
| 1745 | 1915 | |
| 1746 | 1916 | |
| 1747 | 1917 | |
| 1748 | | static READ8_HANDLER ( d_pia1_pa_r ) |
| 1918 | static READ8_DEVICE_HANDLER ( d_pia1_pa_r ) |
| 1749 | 1919 | { |
| 1750 | | return (cassette_input(cassette_device_image(space->machine)) >= 0) ? 1 : 0; |
| 1920 | return (cassette_input(cassette_device_image(device->machine)) >= 0) ? 1 : 0; |
| 1751 | 1921 | } |
| 1752 | 1922 | |
| 1753 | 1923 | |
| 1754 | 1924 | |
| 1755 | | static READ8_HANDLER ( d_pia1_pb_r_coco ) |
| 1925 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_coco ) |
| 1756 | 1926 | { |
| 1927 | const device_config *pia_0 = devtag_get_device( device->machine, PIA6821, "pia_0" ); |
| 1928 | |
| 1757 | 1929 | /* This handles the reading of the memory sense switch (pb2) for the CoCo 1, |
| 1758 | 1930 | * and serial-in (pb0). Serial-in not yet implemented. */ |
| 1759 | 1931 | int result; |
| r4386 | r4387 | |
| 1766 | 1938 | the full 64K, as this uses Color Basic 1.2, which can configure 64K rams */ |
| 1767 | 1939 | |
| 1768 | 1940 | if (mess_ram_size > 0x8000) /* 1 bank of 64K rams */ |
| 1769 | | result = (pia_get_output_b(0) & 0x80) >> 5; |
| 1941 | result = (pianew_get_output_b(pia_0) & 0x80) >> 5; |
| 1770 | 1942 | else if (mess_ram_size >= 0x4000) /* 1 or 2 banks of 16K rams */ |
| 1771 | 1943 | result = 0x04; |
| 1772 | 1944 | else |
| r4386 | r4387 | |
| 1775 | 1947 | return result; |
| 1776 | 1948 | } |
| 1777 | 1949 | |
| 1778 | | static READ8_HANDLER ( d_pia1_pb_r_dragon32 ) |
| 1950 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_dragon32 ) |
| 1779 | 1951 | { |
| 1780 | 1952 | /* This handles the reading of the memory sense switch (pb2) for the Dragon 32, |
| 1781 | 1953 | * and pb0, is the printer /busy line. */ |
| r4386 | r4387 | |
| 1794 | 1966 | return result; |
| 1795 | 1967 | } |
| 1796 | 1968 | |
| 1797 | | static READ8_HANDLER ( d_pia1_pb_r_coco2 ) |
| 1969 | static READ8_DEVICE_HANDLER ( d_pia1_pb_r_coco2 ) |
| 1798 | 1970 | { |
| 1971 | const device_config *pia_0 = devtag_get_device( device->machine, PIA6821, "pia_0" ); |
| 1972 | |
| 1799 | 1973 | /* This handles the reading of the memory sense switch (pb2) for the CoCo 2 and 3, |
| 1800 | 1974 | * and serial-in (pb0). Serial-in not yet implemented. |
| 1801 | 1975 | */ |
| r4386 | r4387 | |
| 1806 | 1980 | else if (mess_ram_size <= 0x4000) |
| 1807 | 1981 | result = 0x04; /* 16K: wire pia1_pb2 high */ |
| 1808 | 1982 | else |
| 1809 | | result = (pia_get_output_b(0) & 0x40) >> 4; /* 32/64K: wire output of pia0_pb6 to input pia1_pb2 */ |
| 1983 | result = (pianew_get_output_b(pia_0) & 0x40) >> 4; /* 32/64K: wire output of pia0_pb6 to input pia1_pb2 */ |
| 1810 | 1984 | return result; |
| 1811 | 1985 | } |
| 1812 | 1986 | |
| r4386 | r4387 | |
| 2624 | 2798 | |
| 2625 | 2799 | void coco_cart_w(const device_config *device, int data) |
| 2626 | 2800 | { |
| 2627 | | const address_space *space = cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 2628 | | pia_1_cb1_w(space, 0, data ? ASSERT_LINE : CLEAR_LINE); |
| 2801 | const device_config *pia_1 = devtag_get_device( device->machine, PIA6821, "pia_1" ); |
| 2802 | |
| 2803 | pia_cb1_w(pia_1, 0, data ? ASSERT_LINE : CLEAR_LINE); |
| 2629 | 2804 | } |
| 2630 | 2805 | |
| 2631 | 2806 | |
| r4386 | r4387 | |
| 2669 | 2844 | also call twiddle Q lines, if necessary |
| 2670 | 2845 | -------------------------------------------------*/ |
| 2671 | 2846 | |
| 2672 | | WRITE8_HANDLER(coco_pia_1_w) |
| 2847 | WRITE8_DEVICE_HANDLER(coco_pia_1_w) |
| 2673 | 2848 | { |
| 2674 | | pia_1_w(space, offset, data); |
| 2675 | | coco_cartridge_twiddle_q_lines(cococart_device(space->machine)); |
| 2849 | pia_w(device, offset, data); |
| 2850 | coco_cartridge_twiddle_q_lines(cococart_device(device->machine)); |
| 2676 | 2851 | } |
| 2677 | 2852 | |
| 2678 | 2853 | |
| r4386 | r4387 | |
| 2683 | 2858 | typedef struct _machine_init_interface machine_init_interface; |
| 2684 | 2859 | struct _machine_init_interface |
| 2685 | 2860 | { |
| 2686 | | const pia6821_interface *piaintf; /* PIA initializer */ |
| 2687 | | int piaintf_count; /* PIA count */ |
| 2688 | 2861 | timer_fired_func recalc_interrupts_; /* recalculate inturrupts callback */ |
| 2689 | 2862 | void (*printer_out_)(running_machine *machine, int data); /* printer output callback */ |
| 2690 | 2863 | }; |
| r4386 | r4387 | |
| 2699 | 2872 | static void generic_init_machine(running_machine *machine, const machine_init_interface *init) |
| 2700 | 2873 | { |
| 2701 | 2874 | coco_state *state = (coco_state *) machine->driver_data; |
| 2702 | | int i; |
| 2703 | 2875 | |
| 2704 | 2876 | /* locate devices */ |
| 2705 | 2877 | state->cococart_device = devtag_get_device(machine, DEVICE_TYPE_WILDCARD, "coco_cartslot"); |
| r4386 | r4387 | |
| 2735 | 2907 | /* setup printer output callback */ |
| 2736 | 2908 | printer_out = init->printer_out_; |
| 2737 | 2909 | |
| 2738 | | /* setup PIAs */ |
| 2739 | | for (i = 0; i < init->piaintf_count; i++) |
| 2740 | | pia_config(machine, i, &init->piaintf[i]); |
| 2741 | | pia_reset(); |
| 2742 | | |
| 2743 | 2910 | debug_cpu_set_dasm_override(machine->cpu[0], coco_dasm_override); |
| 2744 | 2911 | |
| 2745 | 2912 | state_save_register_global(machine, mux_sel1); |
| r4386 | r4387 | |
| 2765 | 2932 | |
| 2766 | 2933 | /* Setup machine initialization */ |
| 2767 | 2934 | memset(&init, 0, sizeof(init)); |
| 2768 | | init.piaintf = dragon32_pia_intf; |
| 2769 | | init.piaintf_count = ARRAY_LENGTH(dragon32_pia_intf); |
| 2770 | 2935 | init.recalc_interrupts_ = d_recalc_interrupts; |
| 2771 | 2936 | init.printer_out_ = printer_out_dragon; |
| 2772 | 2937 | |
| r4386 | r4387 | |
| 2779 | 2944 | |
| 2780 | 2945 | /* Setup machine initialization */ |
| 2781 | 2946 | memset(&init, 0, sizeof(init)); |
| 2782 | | init.piaintf = dragon64_pia_intf; |
| 2783 | | init.piaintf_count = ARRAY_LENGTH(dragon64_pia_intf); |
| 2784 | 2947 | init.recalc_interrupts_ = d_recalc_interrupts; |
| 2785 | 2948 | init.printer_out_ = printer_out_dragon; |
| 2786 | 2949 | |
| r4386 | r4387 | |
| 2793 | 2956 | |
| 2794 | 2957 | /* Setup machine initialization */ |
| 2795 | 2958 | memset(&init, 0, sizeof(init)); |
| 2796 | | init.piaintf = dragon64_pia_intf; |
| 2797 | | init.piaintf_count = ARRAY_LENGTH(dragon64_pia_intf); |
| 2798 | 2959 | init.recalc_interrupts_ = d_recalc_interrupts; |
| 2799 | 2960 | init.printer_out_ = printer_out_dragon; |
| 2800 | 2961 | |
| r4386 | r4387 | |
| 2807 | 2968 | |
| 2808 | 2969 | /* Setup machine initialization */ |
| 2809 | 2970 | memset(&init, 0, sizeof(init)); |
| 2810 | | init.piaintf = dgnalpha_pia_intf; |
| 2811 | | init.piaintf_count = ARRAY_LENGTH(dgnalpha_pia_intf); |
| 2812 | 2971 | init.recalc_interrupts_ = d_recalc_interrupts; |
| 2813 | 2972 | init.printer_out_ = printer_out_dragon; |
| 2814 | 2973 | |
| r4386 | r4387 | |
| 2831 | 2990 | |
| 2832 | 2991 | /* Setup machine initialization */ |
| 2833 | 2992 | memset(&init, 0, sizeof(init)); |
| 2834 | | init.piaintf = coco_pia_intf; |
| 2835 | | init.piaintf_count = ARRAY_LENGTH(coco_pia_intf); |
| 2836 | 2993 | init.recalc_interrupts_ = d_recalc_interrupts; |
| 2837 | 2994 | init.printer_out_ = printer_out_coco; |
| 2838 | 2995 | |
| r4386 | r4387 | |
| 2845 | 3002 | |
| 2846 | 3003 | /* Setup machine initialization */ |
| 2847 | 3004 | memset(&init, 0, sizeof(init)); |
| 2848 | | init.piaintf = coco2_pia_intf; |
| 2849 | | init.piaintf_count = ARRAY_LENGTH(coco2_pia_intf); |
| 2850 | 3005 | init.recalc_interrupts_ = d_recalc_interrupts; |
| 2851 | 3006 | init.printer_out_ = printer_out_coco; |
| 2852 | 3007 | |
| r4386 | r4387 | |
| 2896 | 3051 | |
| 2897 | 3052 | /* Setup machine initialization */ |
| 2898 | 3053 | memset(&init, 0, sizeof(init)); |
| 2899 | | init.piaintf = coco3_pia_intf; |
| 2900 | | init.piaintf_count = ARRAY_LENGTH(coco3_pia_intf); |
| 2901 | 3054 | init.recalc_interrupts_ = coco3_recalc_interrupts; |
| 2902 | 3055 | init.printer_out_ = printer_out_coco; |
| 2903 | 3056 | |
src/mess/drivers/coco.c
| r4386 | r4387 | |
| 14 | 14 | #include "cpu/m6809/m6809.h" |
| 15 | 15 | #include "cpu/hd6309/hd6309.h" |
| 16 | 16 | #include "sound/wave.h" |
| 17 | | #include "machine/6821pia.h" |
| 17 | #include "machine/6821new.h" |
| 18 | 18 | #include "video/m6847.h" |
| 19 | 19 | #include "machine/msm6242.h" |
| 20 | 20 | #include "machine/ds1315.h" |
| r4386 | r4387 | |
| 58 | 58 | AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14) |
| 59 | 59 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15) |
| 60 | 60 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16) |
| 61 | | AM_RANGE(0xff00, 0xff1f) AM_READWRITE(pia_0_r, pia_0_w) |
| 62 | | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 61 | AM_RANGE(0xff00, 0xff1f) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) |
| 62 | AM_RANGE(0xff20, 0xff3f) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, coco_pia_1_w) |
| 63 | 63 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE(COCO_CARTRIDGE, "coco_cartslot", coco_cartridge_r, coco_cartridge_w) |
| 64 | 64 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 65 | 65 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| r4386 | r4387 | |
| 85 | 85 | AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14) |
| 86 | 86 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15) |
| 87 | 87 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16) |
| 88 | | AM_RANGE(0xff00, 0xff1f) AM_READWRITE(pia_0_r, pia_0_w) |
| 89 | | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 88 | AM_RANGE(0xff00, 0xff1f) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) |
| 89 | AM_RANGE(0xff20, 0xff3f) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, coco_pia_1_w) |
| 90 | 90 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE(DRAGON_CARTRIDGE, "coco_cartslot", coco_cartridge_r, coco_cartridge_w) |
| 91 | 91 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 92 | 92 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| r4386 | r4387 | |
| 113 | 113 | AM_RANGE(0xc000, 0xdfff) AM_RAMBANK(7) |
| 114 | 114 | AM_RANGE(0xe000, 0xfdff) AM_RAMBANK(8) |
| 115 | 115 | AM_RANGE(0xfe00, 0xfeff) AM_RAMBANK(9) |
| 116 | | AM_RANGE(0xff00, 0xff1f) AM_READWRITE(pia_0_r, pia_0_w) |
| 117 | | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 116 | AM_RANGE(0xff00, 0xff1f) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) |
| 117 | AM_RANGE(0xff20, 0xff3f) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, coco_pia_1_w) |
| 118 | 118 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE(COCO_CARTRIDGE, "coco_cartslot", coco_cartridge_r, coco_cartridge_w) |
| 119 | 119 | AM_RANGE(0xff80, 0xff85) AM_DEVREADWRITE(COCO_VHD, "vhd", coco_vhd_io_r, coco_vhd_io_w) |
| 120 | 120 | AM_RANGE(0xff90, 0xff9f) AM_READWRITE(coco3_gime_r, coco3_gime_w) |
| r4386 | r4387 | |
| 144 | 144 | AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14) |
| 145 | 145 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15) |
| 146 | 146 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16) |
| 147 | | AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r, pia_0_w) AM_MIRROR(0x0018) |
| 147 | AM_RANGE(0xff00, 0xff03) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) AM_MIRROR(0x0018) |
| 148 | 148 | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE(ACIA6551, "acia", acia_6551_r, acia_6551_w) AM_MIRROR(0x0018) |
| 149 | | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 149 | AM_RANGE(0xff20, 0xff3f) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, coco_pia_1_w) |
| 150 | 150 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE(DRAGON_CARTRIDGE, "coco_cartslot", coco_cartridge_r, coco_cartridge_w) |
| 151 | 151 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 152 | 152 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| r4386 | r4387 | |
| 178 | 178 | AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14) |
| 179 | 179 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15) |
| 180 | 180 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16) |
| 181 | | AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r,pia_0_w) AM_MIRROR(0x0018) |
| 181 | AM_RANGE(0xff00, 0xff03) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r,pia_w) AM_MIRROR(0x0018) |
| 182 | 182 | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE(ACIA6551, "acia", acia_6551_r,acia_6551_w) AM_MIRROR(0x0018) |
| 183 | | AM_RANGE(0xff20, 0xff3f) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 183 | AM_RANGE(0xff20, 0xff3f) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, coco_pia_1_w) |
| 184 | 184 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE(DRAGON_CARTRIDGE, "coco_cartslot", coco_cartridge_r, coco_cartridge_w) |
| 185 | 185 | AM_RANGE(0xff90, 0xffbf) AM_NOP |
| 186 | 186 | AM_RANGE(0xffc0, 0xffdf) AM_DEVWRITE(SAM6883, "sam", sam6883_w) |
| r4386 | r4387 | |
| 256 | 256 | AM_RANGE(0xD000, 0xDFFF) AM_RAMBANK(14) |
| 257 | 257 | AM_RANGE(0xE000, 0xEFFF) AM_RAMBANK(15) |
| 258 | 258 | AM_RANGE(0xF000, 0xFEFF) AM_RAMBANK(16) |
| 259 | | AM_RANGE(0xff00, 0xff03) AM_READWRITE(pia_0_r, pia_0_w) |
| 259 | AM_RANGE(0xff00, 0xff03) AM_DEVREADWRITE(PIA6821, "pia_0", pia_r, pia_w) |
| 260 | 260 | AM_RANGE(0xff04, 0xff07) AM_DEVREADWRITE(ACIA6551, "acia", acia_6551_r, acia_6551_w) |
| 261 | | AM_RANGE(0xff20, 0xff23) AM_READWRITE(pia_1_r, coco_pia_1_w) |
| 262 | | AM_RANGE(0xff24, 0xff27) AM_READWRITE(pia_2_r, pia_2_w) /* Third PIA on Dragon Alpha */ |
| 261 | AM_RANGE(0xff20, 0xff23) AM_DEVREADWRITE(PIA6821, "pia_1", pia_r, coco_pia_1_w) |
| 262 | AM_RANGE(0xff24, 0xff27) AM_DEVREADWRITE(PIA6821, "pia_2", pia_r, pia_w) /* Third PIA on Dragon Alpha */ |
| 263 | 263 | AM_RANGE(0Xff28, 0xff2b) AM_READWRITE(alpha_modem_r, alpha_modem_w) /* Modem, dummy to stop eror log ! */ |
| 264 | 264 | AM_RANGE(0xff2c, 0xff2f) AM_READWRITE(wd2797_r, wd2797_w) /* Alpha onboard disk interface */ |
| 265 | 265 | AM_RANGE(0xff40, 0xff7f) AM_DEVREADWRITE(DRAGON_CARTRIDGE, "coco_cartslot", coco_cartridge_r, coco_cartridge_w) |
| r4386 | r4387 | |
| 698 | 698 | |
| 699 | 699 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 700 | 700 | |
| 701 | MDRV_PIA6821_ADD( "pia_0", dragon32_pia_intf[0] ) |
| 702 | MDRV_PIA6821_ADD( "pia_1", dragon32_pia_intf[1] ) |
| 703 | |
| 701 | 704 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 702 | 705 | |
| 703 | 706 | MDRV_DRAGON_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 738 | 741 | /* acia */ |
| 739 | 742 | MDRV_ACIA6551_ADD("acia") |
| 740 | 743 | |
| 744 | MDRV_PIA6821_ADD( "pia_0", dragon64_pia_intf[0] ) |
| 745 | MDRV_PIA6821_ADD( "pia_1", dragon64_pia_intf[1] ) |
| 746 | |
| 741 | 747 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 742 | 748 | |
| 743 | 749 | MDRV_DRAGON_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 778 | 784 | /* acia */ |
| 779 | 785 | MDRV_ACIA6551_ADD("acia") |
| 780 | 786 | |
| 787 | MDRV_PIA6821_ADD( "pia_0", dragon64_pia_intf[0] ) |
| 788 | MDRV_PIA6821_ADD( "pia_1", dragon64_pia_intf[1] ) |
| 789 | |
| 781 | 790 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 782 | 791 | |
| 783 | 792 | MDRV_DRAGON_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 824 | 833 | /* acia */ |
| 825 | 834 | MDRV_ACIA6551_ADD("acia") |
| 826 | 835 | |
| 836 | MDRV_PIA6821_ADD( "pia_0", dgnalpha_pia_intf[0] ) |
| 837 | MDRV_PIA6821_ADD( "pia_1", dgnalpha_pia_intf[1] ) |
| 838 | MDRV_PIA6821_ADD( "pia_2", dgnalpha_pia_intf[2] ) |
| 839 | |
| 827 | 840 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 828 | 841 | |
| 829 | 842 | MDRV_DRAGON_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 864 | 877 | /* acia */ |
| 865 | 878 | MDRV_ACIA6551_ADD("acia") |
| 866 | 879 | |
| 880 | MDRV_PIA6821_ADD( "pia_0", dragon64_pia_intf[0] ) |
| 881 | MDRV_PIA6821_ADD( "pia_1", dragon64_pia_intf[1] ) |
| 882 | |
| 867 | 883 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 868 | 884 | |
| 869 | 885 | MDRV_DRAGON_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 902 | 918 | /* cassette */ |
| 903 | 919 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 904 | 920 | |
| 921 | MDRV_PIA6821_ADD( "pia_0", coco_pia_intf[0] ) |
| 922 | MDRV_PIA6821_ADD( "pia_1", coco_pia_intf[1] ) |
| 923 | |
| 905 | 924 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 906 | 925 | |
| 907 | 926 | MDRV_COCO_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 940 | 959 | /* cassette */ |
| 941 | 960 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 942 | 961 | |
| 962 | MDRV_PIA6821_ADD( "pia_0", coco2_pia_intf[0] ) |
| 963 | MDRV_PIA6821_ADD( "pia_1", coco2_pia_intf[1] ) |
| 964 | |
| 943 | 965 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 944 | 966 | |
| 945 | 967 | MDRV_COCO_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 978 | 1000 | /* cassette */ |
| 979 | 1001 | MDRV_CASSETTE_ADD( "cassette", coco_cassette_config ) |
| 980 | 1002 | |
| 1003 | MDRV_PIA6821_ADD( "pia_0", coco2_pia_intf[0] ) |
| 1004 | MDRV_PIA6821_ADD( "pia_1", coco2_pia_intf[1] ) |
| 1005 | |
| 981 | 1006 | MDRV_SAM6883_ADD("sam", coco_sam_intf) |
| 982 | 1007 | |
| 983 | 1008 | MDRV_COCO_CARTRIDGE_ADD("coco_cartslot") |
| r4386 | r4387 | |
| 1012 | 1037 | MDRV_SCREEN_SIZE(640, 25+192+26) |
| 1013 | 1038 | MDRV_SCREEN_VISIBLE_AREA(0, 639, 0, 239) |
| 1014 | 1039 | |
| 1040 | MDRV_PIA6821_ADD( "pia_0", coco3_pia_intf[0] ) |
| 1041 | MDRV_PIA6821_ADD( "pia_1", coco3_pia_intf[1] ) |
| 1042 | |
| 1015 | 1043 | /* sound hardware */ |
| 1016 | 1044 | MDRV_IMPORT_FROM( coco_sound ) |
| 1017 | 1045 | |