src/mess/machine/conkort.c
| r7634 | r7635 | |
| 71 | 71 | |
| 72 | 72 | Slow Controller |
| 73 | 73 | --------------- |
| 74 | | - FD1791 HLD/HLT callbacks |
| 74 | |
| 75 | - Z80 IN instruction needs to halt in mid air for this controller to ever work (the first data byte of disk sector is read too early) |
| 76 | |
| 77 | wd17xx_command_w $88 READ_SEC |
| 78 | wd17xx_data_r: (no new data) $00 (data_count 0) |
| 79 | WAIT |
| 80 | wd179x: Read Sector callback. |
| 81 | sector found! C:$00 H:$00 R:$0b N:$01 |
| 82 | wd17xx_data_r: $FF (data_count 256) |
| 83 | WAIT |
| 84 | |
| 75 | 85 | - copy protection device (sends sector header bytes to CPU? DDEN is serial clock? code checks for either $b6 or $f7) |
| 76 | 86 | |
| 77 | 87 | 06F8: ld a,$2F ; SEEK |
| r7634 | r7635 | |
| 100 | 110 | 0704: rr a |
| 101 | 111 | 0706: call $073F |
| 102 | 112 | |
| 113 | - FD1791 HLD/HLT callbacks |
| 103 | 114 | - DS/DD SS/DS jumpers |
| 104 | 115 | - S1-S5 jumpers |
| 105 | 116 | |
| r7634 | r7635 | |
| 302 | 313 | |
| 303 | 314 | /* drive selection */ |
| 304 | 315 | if (BIT(data, 0)) wd17xx_set_drive(device, 0); |
| 305 | | // if (BIT(data, 1)) wd17xx_set_drive(device, 1); |
| 316 | if (BIT(data, 1)) wd17xx_set_drive(device, 1); |
| 306 | 317 | // if (BIT(data, 2)) wd17xx_set_drive(device, 2); |
| 307 | 318 | |
| 308 | 319 | /* motor enable */ |
| r7634 | r7635 | |
| 350 | 361 | slow_t *conkort = get_safe_token_slow(device->owner); |
| 351 | 362 | UINT8 data = 0xff; |
| 352 | 363 | |
| 364 | if (!conkort->wait_enable && !conkort->fdc_irq && !conkort->fdc_drq) |
| 365 | { |
| 366 | /* TODO: this is really connected to the Z80 WAIT line */ |
| 367 | cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 368 | } |
| 369 | |
| 353 | 370 | switch (offset & 0x03) |
| 354 | 371 | { |
| 355 | 372 | case 0: data = wd17xx_status_r(device, 0); |
| r7634 | r7635 | |
| 358 | 375 | case 3: data = wd17xx_data_r(device, 0); |
| 359 | 376 | } |
| 360 | 377 | |
| 361 | | if (!conkort->wait_enable && !conkort->fdc_irq && !conkort->fdc_drq) |
| 362 | | { |
| 363 | | logerror("WAIT\n"); |
| 364 | | /* TODO: this is really connected to the Z80 _RDY line */ |
| 365 | | cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 366 | | } |
| 367 | | |
| 378 | /* FD1791 has inverted data lines */ |
| 368 | 379 | return data ^ 0xff; |
| 369 | 380 | } |
| 370 | 381 | |
| r7634 | r7635 | |
| 372 | 383 | { |
| 373 | 384 | slow_t *conkort = get_safe_token_slow(device->owner); |
| 374 | 385 | |
| 386 | if (!conkort->wait_enable && !conkort->fdc_irq && !conkort->fdc_drq) |
| 387 | { |
| 388 | logerror("WAIT\n"); |
| 389 | /* TODO: this is really connected to the Z80 WAIT line */ |
| 390 | cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 391 | } |
| 392 | |
| 393 | /* FD1791 has inverted data lines */ |
| 375 | 394 | data ^= 0xff; |
| 376 | 395 | |
| 377 | 396 | switch (offset & 0x03) |
| r7634 | r7635 | |
| 381 | 400 | case 2: wd17xx_sector_w(device, 0, data); break; |
| 382 | 401 | case 3: wd17xx_data_w(device, 0, data); break; |
| 383 | 402 | } |
| 384 | | |
| 385 | | if (!conkort->wait_enable && !conkort->fdc_irq && !conkort->fdc_drq) |
| 386 | | { |
| 387 | | logerror("WAIT\n"); |
| 388 | | /* TODO: this is really connected to the Z80 _RDY line */ |
| 389 | | cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, ASSERT_LINE); |
| 390 | | } |
| 391 | 403 | } |
| 392 | 404 | |
| 393 | 405 | /* Fast Controller */ |
| r7634 | r7635 | |
| 770 | 782 | |
| 771 | 783 | if (state) |
| 772 | 784 | { |
| 773 | | /* TODO: this is really connected to the Z80 _RDY line */ |
| 785 | /* TODO: this is really connected to the Z80 WAIT line */ |
| 774 | 786 | cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, CLEAR_LINE); |
| 775 | 787 | } |
| 776 | 788 | } |
| r7634 | r7635 | |
| 783 | 795 | |
| 784 | 796 | if (state) |
| 785 | 797 | { |
| 786 | | /* TODO: this is really connected to the Z80 _RDY line */ |
| 798 | /* TODO: this is really connected to the Z80 WAIT line */ |
| 787 | 799 | cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, CLEAR_LINE); |
| 788 | 800 | } |
| 789 | 801 | } |