src/mess/machine/pc_fdc.c
| r2471 | r2472 | |
| 227 | 227 | | | `-------------- 1 = turn floppy drive B motor on |
| 228 | 228 | | `---------------- 1 = turn floppy drive C motor on |
| 229 | 229 | `------------------ 1 = turn floppy drive D motor on |
| 230 | | |
| 231 | | On a PC Jr the DOR is wired up a bit differently: |
| 232 | | |7|6|5|4|3|2|1|0| |
| 233 | | | | | | | | | `--- Drive enable ( 0 = off, 1 = on ) |
| 234 | | | | | | | | `----- Reserved |
| 235 | | | | | | | `------- Reserved |
| 236 | | | | | | `--------- Reserved |
| 237 | | | | | `----------- Reserved |
| 238 | | | | `------------- Watchdog Timer Enable ( 0 = watchdog enabled, 1 = watchdog disabled ) |
| 239 | | | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger ) |
| 240 | | `----------------- FDC Reset ( 0 = hold reset, 1 = release reset ) |
| 241 | 230 | */ |
| 242 | 231 | |
| 243 | | static void pc_fdc_dor_w(UINT8 data) |
| 232 | static void pc_fdc_dor_w(running_machine *machine, UINT8 data) |
| 244 | 233 | { |
| 245 | 234 | int selected_drive; |
| 246 | 235 | int floppy_count; |
| 247 | 236 | |
| 248 | | floppy_count = device_count(Machine, IO_FLOPPY); |
| 237 | floppy_count = device_count(machine, IO_FLOPPY); |
| 249 | 238 | |
| 250 | 239 | if (floppy_count > (fdc->digital_output_register & 0x03)) |
| 251 | 240 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, fdc->digital_output_register & 0x03), 1, 0); |
| r2471 | r2472 | |
| 321 | 310 | } |
| 322 | 311 | |
| 323 | 312 | |
| 313 | /* PCJr FDC Digitial Output Register (DOR) |
| 324 | 314 | |
| 315 | On a PC Jr the DOR is wired up a bit differently: |
| 316 | |7|6|5|4|3|2|1|0| |
| 317 | | | | | | | | `--- Drive enable ( 0 = off, 1 = on ) |
| 318 | | | | | | | `----- Reserved |
| 319 | | | | | | `------- Reserved |
| 320 | | | | | `--------- Reserved |
| 321 | | | | `----------- Reserved |
| 322 | | | `------------- Watchdog Timer Enable ( 0 = watchdog enabled, 1 = watchdog disabled ) |
| 323 | | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger ) |
| 324 | `----------------- FDC Reset ( 0 = hold reset, 1 = release reset ) |
| 325 | */ |
| 326 | |
| 327 | static void pcjr_fdc_dor_w(running_machine *machine, UINT8 data) |
| 328 | { |
| 329 | int floppy_count; |
| 330 | |
| 331 | floppy_count = device_count(machine, IO_FLOPPY); |
| 332 | |
| 333 | /* set floppy drive motor state */ |
| 334 | if (floppy_count > 0) |
| 335 | floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), data & 0x01); |
| 336 | |
| 337 | if ( data & 0x01 ) |
| 338 | { |
| 339 | if ( floppy_count ) |
| 340 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0); |
| 341 | } |
| 342 | |
| 343 | /* reset? */ |
| 344 | if ( ! (data & 0x80) ) |
| 345 | { |
| 346 | /* yes */ |
| 347 | |
| 348 | /* pc-xt expects a interrupt to be generated |
| 349 | when the fdc is reset. |
| 350 | In the FDC docs, it states that a INT will |
| 351 | be generated if READY input is true when the |
| 352 | fdc is reset. |
| 353 | |
| 354 | It also states, that outputs to drive are set to 0. |
| 355 | Maybe this causes the drive motor to go on, and therefore |
| 356 | the ready line is set. |
| 357 | |
| 358 | This in return causes a int?? --- |
| 359 | |
| 360 | |
| 361 | what is not yet clear is if this is a result of the drives ready state |
| 362 | changing... |
| 363 | */ |
| 364 | nec765_set_ready_state(1); |
| 365 | |
| 366 | /* set FDC at reset */ |
| 367 | nec765_set_reset_state(1); |
| 368 | } |
| 369 | else |
| 370 | { |
| 371 | pc_fdc_set_tc_state(0); |
| 372 | |
| 373 | /* release reset on fdc */ |
| 374 | nec765_set_reset_state(0); |
| 375 | } |
| 376 | |
| 377 | logerror("pcjr_fdc_dor_w: changing dor from %02x to %02x\n", fdc->digital_output_register, data); |
| 378 | |
| 379 | fdc->digital_output_register = data; |
| 380 | } |
| 381 | |
| 382 | |
| 325 | 383 | READ8_HANDLER ( pc_fdc_r ) |
| 326 | 384 | { |
| 327 | 385 | UINT8 data = 0xff; |
| r2471 | r2472 | |
| 367 | 425 | case 1: /* n/a */ |
| 368 | 426 | break; |
| 369 | 427 | case 2: |
| 370 | | pc_fdc_dor_w(data); |
| 428 | pc_fdc_dor_w(machine, data); |
| 371 | 429 | break; |
| 372 | 430 | case 3: |
| 373 | 431 | /* tape drive select? */ |
| r2471 | r2472 | |
| 395 | 453 | } |
| 396 | 454 | } |
| 397 | 455 | |
| 456 | WRITE8_HANDLER ( pcjr_fdc_w ) |
| 457 | { |
| 458 | if (LOG_FDC) |
| 459 | logerror("pcjr_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) activecpu_get_reg(REG_PC), offset, data); |
| 460 | |
| 461 | switch(offset) |
| 462 | { |
| 463 | case 2: |
| 464 | pcjr_fdc_dor_w( machine, data ); |
| 465 | break; |
| 466 | default: |
| 467 | pc_fdc_w( machine, offset, data ); |
| 468 | break; |
| 469 | } |
| 470 | } |
| 471 | |
src/mess/drivers/pc.c
| r2471 | r2472 | |
| 285 | 285 | |
| 286 | 286 | |
| 287 | 287 | |
| 288 | static ADDRESS_MAP_START(ibmpcjr_io, ADDRESS_SPACE_IO, 8) |
| 289 | AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE(DMA8237, "dma8237", dma8237_r, dma8237_w) |
| 290 | AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE(PIC8259, "pic8259_master", pic8259_r, pic8259_w) |
| 291 | AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE(PIT8253, "pit8253", pit8253_r, pit8253_w) |
| 292 | AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE(PPI8255, "ppi8255", ppi8255_r, ppi8255_w) |
| 293 | AM_RANGE(0x0080, 0x0087) AM_READWRITE(pc_page_r, pc_page_w) |
| 294 | AM_RANGE(0x00a0, 0x00a0) AM_WRITE( pc_nmi_enable_w ) |
| 295 | AM_RANGE(0x00c0, 0x00c0) AM_WRITE( SN76496_0_w) |
| 296 | AM_RANGE(0x00f0, 0x00f7) AM_READWRITE(pc_fdc_r, pcjr_fdc_w) |
| 297 | AM_RANGE(0x0200, 0x0207) AM_READWRITE(pc_JOY_r, pc_JOY_w) |
| 298 | AM_RANGE(0x02f8, 0x02ff) AM_DEVREADWRITE(INS8250, "ins8250_0", ins8250_r, ins8250_w) |
| 299 | AM_RANGE(0x0320, 0x0323) AM_READWRITE(pc_HDC1_r, pc_HDC1_w) |
| 300 | AM_RANGE(0x0324, 0x0327) AM_READWRITE(pc_HDC2_r, pc_HDC2_w) |
| 301 | AM_RANGE(0x0378, 0x037f) AM_READWRITE(pc_t1t_p37x_r, pc_t1t_p37x_w) |
| 302 | AM_RANGE(0x03bc, 0x03be) AM_READWRITE(pc_parallelport0_r, pc_parallelport0_w) |
| 303 | AM_RANGE(0x03d0, 0x03df) AM_READWRITE(pc_T1T_r, pc_T1T_w) |
| 304 | AM_RANGE(0x03f8, 0x03ff) AM_DEVREADWRITE(INS8250, "ins8250_0", ins8250_r, ins8250_w) |
| 305 | ADDRESS_MAP_END |
| 306 | |
| 307 | |
| 308 | |
| 288 | 309 | static ADDRESS_MAP_START(pc200_io, ADDRESS_SPACE_IO, 16) |
| 289 | 310 | AM_RANGE(0x0000, 0x000f) AM_DEVREADWRITE8(DMA8237, "dma8237", dma8237_r, dma8237_w, 0xffff) |
| 290 | 311 | AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE8(PIC8259, "pic8259_master", pic8259_r, pic8259_w, 0xffff) |
| r2471 | r2472 | |
| 1684 | 1705 | MACHINE_DRIVER_END |
| 1685 | 1706 | |
| 1686 | 1707 | |
| 1708 | static MACHINE_DRIVER_START( ibmpcjr ) |
| 1709 | /* basic machine hardware */ |
| 1710 | MDRV_CPU_PC(tandy1000, ibmpcjr, I8088, 8000000, tandy1000_frame_interrupt) |
| 1711 | |
| 1712 | MDRV_MACHINE_START(pc) |
| 1713 | MDRV_MACHINE_RESET(pc) |
| 1714 | |
| 1715 | MDRV_DEVICE_ADD( "pit8253", PIT8253 ) |
| 1716 | MDRV_DEVICE_CONFIG( pc_pit8253_config ) |
| 1717 | |
| 1718 | MDRV_DEVICE_ADD( "dma8237", DMA8237 ) |
| 1719 | MDRV_DEVICE_CONFIG( pc_dma8237_config ) |
| 1720 | |
| 1721 | MDRV_DEVICE_ADD( "pic8259_master", PIC8259 ) |
| 1722 | MDRV_DEVICE_CONFIG( pc_pic8259_master_config ) |
| 1723 | |
| 1724 | MDRV_DEVICE_ADD( "pic8259_slave", PIC8259 ) |
| 1725 | MDRV_DEVICE_CONFIG( pc_pic8259_slave_config ) |
| 1726 | |
| 1727 | MDRV_DEVICE_ADD( "ppi8255", PPI8255 ) |
| 1728 | MDRV_DEVICE_CONFIG( pc_ppi8255_interface ) |
| 1729 | |
| 1730 | MDRV_DEVICE_ADD( "ins8250_0", INS8250 ) /* TODO: Verify model */ |
| 1731 | MDRV_DEVICE_CONFIG( ibmpc_com_interface[0] ) |
| 1732 | |
| 1733 | MDRV_DEVICE_ADD( "ins8250_1", INS8250 ) /* TODO: Verify model */ |
| 1734 | MDRV_DEVICE_CONFIG( ibmpc_com_interface[1] ) |
| 1735 | |
| 1736 | /* video hardware */ |
| 1737 | MDRV_IMPORT_FROM( pcvideo_t1000 ) |
| 1738 | |
| 1739 | /* sound hardware */ |
| 1740 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 1741 | MDRV_SOUND_ADD(CUSTOM, 0) |
| 1742 | MDRV_SOUND_CONFIG(pc_sound_interface) |
| 1743 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1744 | MDRV_SOUND_ADD(SN76496, 2386360) |
| 1745 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 1746 | |
| 1747 | MDRV_NVRAM_HANDLER( tandy1000 ) |
| 1748 | |
| 1749 | /* printer */ |
| 1750 | MDRV_DEVICE_ADD("printer", PRINTER) |
| 1751 | MACHINE_DRIVER_END |
| 1752 | |
| 1687 | 1753 | #if 0 |
| 1688 | 1754 | //pcjr roms? (incomplete dump, most likely 64 kbyte) |
| 1689 | 1755 | // basic c1.20 |
| r2471 | r2472 | |
| 2131 | 2197 | COMP( 1988, europc, ibm5150, 0, europc, europc, europc, ibmpc, "Schneider Rdf. AG", "EURO PC", 0) |
| 2132 | 2198 | |
| 2133 | 2199 | // pcjr (better graphics, better sound) |
| 2134 | | COMP( 1983, ibmpcjr, ibm5150, 0, t1000hx, tandy1t, t1000hx, ibmpc, "International Business Machines", "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS ) |
| 2200 | COMP( 1983, ibmpcjr, ibm5150, 0, ibmpcjr, tandy1t, t1000hx, ibmpc, "International Business Machines", "IBM PC Jr", GAME_NOT_WORKING|GAME_IMPERFECT_COLORS ) |
| 2135 | 2201 | COMP( 1987, t1000hx, ibm5150, 0, t1000hx, tandy1t, t1000hx, ibmpc, "Tandy Radio Shack", "Tandy 1000HX", 0) |
| 2136 | 2202 | COMP( 1987, t1000sx, ibm5150, 0, t1000hx, tandy1t, t1000hx, ibmpc, "Tandy Radio Shack", "Tandy 1000SX", 0) |
| 2137 | 2203 | |