src/mess/video/733_asr.c
| r3909 | r3910 | |
| 60 | 60 | |
| 61 | 61 | int x; |
| 62 | 62 | |
| 63 | | void (*int_callback)(int state); |
| 63 | void (*int_callback)(running_machine *, int state); |
| 64 | 64 | |
| 65 | 65 | bitmap_t *bitmap; |
| 66 | 66 | } asr[MAX_ASR]; |
| r3909 | r3910 | |
| 167 | 167 | memcpy(dst, fontdata6x8, asrfontdata_size); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | | int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(int state)) |
| 170 | int asr733_init_term(running_machine *machine, int unit, void (*int_callback)(running_machine *, int state)) |
| 171 | 171 | { |
| 172 | 172 | const device_config *screen = video_screen_first(machine->config); |
| 173 | 173 | int width = video_screen_get_width(screen); |
| r3909 | r3910 | |
| 183 | 183 | return 0; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | | static void asr_field_interrupt(int unit) |
| 186 | static void asr_field_interrupt(running_machine *machine, int unit) |
| 187 | 187 | { |
| 188 | 188 | if ((asr[unit].mode & AM_enint_mask) && (asr[unit].new_status_flag)) /* right??? */ |
| 189 | 189 | { |
| 190 | 190 | asr[unit].status |= AS_int_mask; |
| 191 | 191 | if (asr[unit].int_callback) |
| 192 | | (*asr[unit].int_callback)(1); |
| 192 | (*asr[unit].int_callback)(machine, 1); |
| 193 | 193 | } |
| 194 | 194 | else |
| 195 | 195 | { |
| 196 | 196 | asr[unit].status &= ~AS_int_mask; |
| 197 | 197 | if (asr[unit].int_callback) |
| 198 | | (*asr[unit].int_callback)(0); |
| 198 | (*asr[unit].int_callback)(machine, 0); |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | | void asr733_reset(int unit) |
| 202 | void asr733_reset(running_machine *machine, int unit) |
| 203 | 203 | { |
| 204 | 204 | /*asr[unit].OutQueueLen = 0;*/ |
| 205 | 205 | |
| 206 | 206 | asr[unit].status = AS_dsr_mask | AS_wrq_mask; |
| 207 | 207 | asr[unit].mode = 0; |
| 208 | 208 | |
| 209 | | asr_field_interrupt(unit); |
| 209 | asr_field_interrupt(machine, unit); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /* write a single char on screen */ |
| r3909 | r3910 | |
| 295 | 295 | |
| 296 | 296 | asr[unit].status |= AS_wrq_mask; |
| 297 | 297 | asr[unit].new_status_flag = 1; /* right??? */ |
| 298 | | asr_field_interrupt(unit); |
| 298 | asr_field_interrupt(machine, unit); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | #if 0 |
| r3909 | r3910 | |
| 309 | 309 | |
| 310 | 310 | ASR.status |= AS_rrq_mask; |
| 311 | 311 | ASR.new_status_flag = 1; /* right??? */ |
| 312 | | asr_field_interrupt(); |
| 312 | asr_field_interrupt(machine, 0); |
| 313 | 313 | } |
| 314 | 314 | #endif |
| 315 | 315 | |
| r3909 | r3910 | |
| 389 | 389 | else |
| 390 | 390 | asr[unit].mode &= ~ (1 << (offset - 8)); |
| 391 | 391 | if (offset == 14) |
| 392 | | asr_field_interrupt(unit); |
| 392 | asr_field_interrupt(machine, unit); |
| 393 | 393 | break; |
| 394 | 394 | |
| 395 | 395 | case 11: /* clear write request (write any value to execute) */ |
| 396 | 396 | case 12: /* clear read request (write any value to execute) */ |
| 397 | 397 | asr[unit].status &= ~ (1 << (offset - 8)); |
| 398 | | asr_field_interrupt(unit); |
| 398 | asr_field_interrupt(machine, unit); |
| 399 | 399 | break; |
| 400 | 400 | |
| 401 | 401 | case 13: /* clear new status flag - whatever it means (write any value to execute) */ |
| 402 | 402 | asr[unit].new_status_flag = 0; |
| 403 | | asr_field_interrupt(unit); |
| 403 | asr_field_interrupt(machine, unit); |
| 404 | 404 | break; |
| 405 | 405 | } |
| 406 | 406 | } |
| r3909 | r3910 | |
| 671 | 671 | { /* repeat current key */ |
| 672 | 672 | asr[unit].status |= AS_rrq_mask; |
| 673 | 673 | asr[unit].new_status_flag = 1; /* right??? */ |
| 674 | | asr_field_interrupt(unit); |
| 674 | asr_field_interrupt(machine, unit); |
| 675 | 675 | repeat_timer = 0; |
| 676 | 676 | } |
| 677 | 677 | } |
| r3909 | r3910 | |
| 704 | 704 | asr[unit].recv_buf = (int)key_translate[modifier_state][last_key_pressed]; |
| 705 | 705 | asr[unit].status |= AS_rrq_mask; |
| 706 | 706 | asr[unit].new_status_flag = 1; /* right??? */ |
| 707 | | asr_field_interrupt(unit); |
| 707 | asr_field_interrupt(machine, unit); |
| 708 | 708 | return; |
| 709 | 709 | } |
| 710 | 710 | } |
src/mess/machine/990_hd.c
| r3909 | r3910 | |
| 23 | 23 | #include "harddisk.h" |
| 24 | 24 | #include "devices/harddriv.h" |
| 25 | 25 | |
| 26 | | static void update_interrupt(void); |
| 26 | static void update_interrupt(running_machine *machine); |
| 27 | 27 | |
| 28 | 28 | /* max disk units per controller: 4 is the protocol limit, but it may be |
| 29 | 29 | overriden if more than one controller is used */ |
| r3909 | r3910 | |
| 90 | 90 | { |
| 91 | 91 | UINT16 w[8]; |
| 92 | 92 | |
| 93 | | void (*interrupt_callback)(int state); |
| 93 | void (*interrupt_callback)(running_machine *machine, int state); |
| 94 | 94 | |
| 95 | 95 | hd_unit_t d[MAX_DISK_UNIT]; |
| 96 | 96 | } hdc_t; |
| r3909 | r3910 | |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | |
| 329 | | void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(int state)) |
| 329 | void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state)) |
| 330 | 330 | { |
| 331 | 331 | memset(hdc.w, 0, sizeof(hdc.w)); |
| 332 | 332 | hdc.w[7] = w7_idle; |
| r3909 | r3910 | |
| 339 | 339 | |
| 340 | 340 | hdc.interrupt_callback = interrupt_callback; |
| 341 | 341 | |
| 342 | | update_interrupt(); |
| 342 | update_interrupt(machine); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | |
| r3909 | r3910 | |
| 372 | 372 | /* |
| 373 | 373 | Update interrupt state |
| 374 | 374 | */ |
| 375 | | static void update_interrupt(void) |
| 375 | static void update_interrupt(running_machine *machine) |
| 376 | 376 | { |
| 377 | 377 | if (hdc.interrupt_callback) |
| 378 | | (*hdc.interrupt_callback)((hdc.w[7] & w7_idle) |
| 378 | (*hdc.interrupt_callback)(machine, (hdc.w[7] & w7_idle) |
| 379 | 379 | && (((hdc.w[7] & w7_int_enable) && (hdc.w[7] & (w7_complete | w7_error))) |
| 380 | 380 | || ((hdc.w[0] & (hdc.w[0] >> 4)) & w0_attn_mask))); |
| 381 | 381 | } |
| r3909 | r3910 | |
| 385 | 385 | |
| 386 | 386 | Terminate current command and return non-zero if the address is invalid. |
| 387 | 387 | */ |
| 388 | | static int check_sector_address(int unit, unsigned int cylinder, unsigned int head, unsigned int sector) |
| 388 | static int check_sector_address(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector) |
| 389 | 389 | { |
| 390 | 390 | if ((cylinder > hdc.d[unit].cylinders) || (head > hdc.d[unit].heads) || (sector > hdc.d[unit].sectors_per_track)) |
| 391 | 391 | { /* invalid address */ |
| r3909 | r3910 | |
| 401 | 401 | } |
| 402 | 402 | else if (sector > hdc.d[unit].sectors_per_track) |
| 403 | 403 | hdc.w[7] |= w7_idle | w7_error | w7_command_time_out_err; |
| 404 | | update_interrupt(); |
| 404 | update_interrupt(machine); |
| 405 | 405 | return 1; |
| 406 | 406 | } |
| 407 | 407 | |
| r3909 | r3910 | |
| 411 | 411 | /* |
| 412 | 412 | Seek to sector whose address is given |
| 413 | 413 | */ |
| 414 | | static int sector_to_lba(int unit, unsigned int cylinder, unsigned int head, unsigned int sector, unsigned int *lba) |
| 414 | static int sector_to_lba(running_machine *machine, int unit, unsigned int cylinder, unsigned int head, unsigned int sector, unsigned int *lba) |
| 415 | 415 | { |
| 416 | | if (check_sector_address(unit, cylinder, head, sector)) |
| 416 | if (check_sector_address(machine, unit, cylinder, head, sector)) |
| 417 | 417 | return 1; |
| 418 | 418 | |
| 419 | 419 | * lba = (cylinder*hdc.d[unit].heads + head)*hdc.d[unit].sectors_per_track + sector; |
| r3909 | r3910 | |
| 499 | 499 | { |
| 500 | 500 | /* No idea what to report... */ |
| 501 | 501 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 502 | | update_interrupt(); |
| 502 | update_interrupt(machine); |
| 503 | 503 | return; |
| 504 | 504 | } |
| 505 | 505 | else if (! is_unit_loaded(dsk_sel)) |
| 506 | 506 | { /* offline */ |
| 507 | 507 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 508 | 508 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 509 | | update_interrupt(); |
| 509 | update_interrupt(machine); |
| 510 | 510 | return; |
| 511 | 511 | } |
| 512 | 512 | |
| r3909 | r3910 | |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | hdc.w[7] |= w7_idle | w7_complete; |
| 538 | | update_interrupt(); |
| 538 | update_interrupt(machine); |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | /* |
| r3909 | r3910 | |
| 543 | 543 | |
| 544 | 544 | The emulation just clears the track data in the disk image. |
| 545 | 545 | */ |
| 546 | | static void write_format(void) |
| 546 | static void write_format(running_machine *machine) |
| 547 | 547 | { |
| 548 | 548 | unsigned int cylinder, head, sector; |
| 549 | 549 | unsigned int lba; |
| r3909 | r3910 | |
| 558 | 558 | { |
| 559 | 559 | /* No idea what to report... */ |
| 560 | 560 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 561 | | update_interrupt(); |
| 561 | update_interrupt(machine); |
| 562 | 562 | return; |
| 563 | 563 | } |
| 564 | 564 | else if (! is_unit_loaded(dsk_sel)) |
| 565 | 565 | { /* offline */ |
| 566 | 566 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 567 | 567 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 568 | | update_interrupt(); |
| 568 | update_interrupt(machine); |
| 569 | 569 | return; |
| 570 | 570 | } |
| 571 | 571 | else if (hdc.d[dsk_sel].unsafe) |
| 572 | 572 | { /* disk in unsafe condition */ |
| 573 | 573 | hdc.w[0] |= w0_unsafe | w0_pack_change; |
| 574 | 574 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 575 | | update_interrupt(); |
| 575 | update_interrupt(machine); |
| 576 | 576 | return; |
| 577 | 577 | } |
| 578 | 578 | else if (hdc.d[dsk_sel].wp) |
| 579 | 579 | { /* disk write-protected */ |
| 580 | 580 | hdc.w[0] |= w0_write_protect; |
| 581 | 581 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 582 | | update_interrupt(); |
| 582 | update_interrupt(machine); |
| 583 | 583 | return; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | cylinder = hdc.w[3]; |
| 587 | 587 | head = hdc.w[1] & w1_head_address; |
| 588 | 588 | |
| 589 | | if (sector_to_lba(dsk_sel, cylinder, head, 0, &lba)) |
| 589 | if (sector_to_lba(machine, dsk_sel, cylinder, head, 0, &lba)) |
| 590 | 590 | return; |
| 591 | 591 | |
| 592 | 592 | memset(buffer, 0, hdc.d[dsk_sel].bytes_per_sector); |
| r3909 | r3910 | |
| 599 | 599 | { |
| 600 | 600 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 601 | 601 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 602 | | update_interrupt(); |
| 602 | update_interrupt(machine); |
| 603 | 603 | return; |
| 604 | 604 | } |
| 605 | 605 | |
| r3909 | r3910 | |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | hdc.w[7] |= w7_idle | w7_complete; |
| 610 | | update_interrupt(); |
| 610 | update_interrupt(machine); |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /* |
| r3909 | r3910 | |
| 633 | 633 | { |
| 634 | 634 | /* No idea what to report... */ |
| 635 | 635 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 636 | | update_interrupt(); |
| 636 | update_interrupt(machine); |
| 637 | 637 | return; |
| 638 | 638 | } |
| 639 | 639 | else if (! is_unit_loaded(dsk_sel)) |
| 640 | 640 | { /* offline */ |
| 641 | 641 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 642 | 642 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 643 | | update_interrupt(); |
| 643 | update_interrupt(machine); |
| 644 | 644 | return; |
| 645 | 645 | } |
| 646 | 646 | else if (hdc.d[dsk_sel].unsafe) |
| 647 | 647 | { /* disk in unsafe condition */ |
| 648 | 648 | hdc.w[0] |= w0_unsafe | w0_pack_change; |
| 649 | 649 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 650 | | update_interrupt(); |
| 650 | update_interrupt(machine); |
| 651 | 651 | return; |
| 652 | 652 | } |
| 653 | 653 | |
| r3909 | r3910 | |
| 658 | 658 | head = hdc.w[1] & w1_head_address; |
| 659 | 659 | sector = hdc.w[2] & 0xff; |
| 660 | 660 | |
| 661 | | if (sector_to_lba(dsk_sel, cylinder, head, sector, &lba)) |
| 661 | if (sector_to_lba(machine, dsk_sel, cylinder, head, sector, &lba)) |
| 662 | 662 | return; |
| 663 | 663 | |
| 664 | 664 | while (byte_count) |
| r3909 | r3910 | |
| 667 | 667 | { |
| 668 | 668 | hdc.w[0] |= w0_seek_incomplete; |
| 669 | 669 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 670 | | update_interrupt(); |
| 670 | update_interrupt(machine); |
| 671 | 671 | return; |
| 672 | 672 | } |
| 673 | 673 | |
| r3909 | r3910 | |
| 677 | 677 | if (bytes_read != bytes_to_read) |
| 678 | 678 | { /* behave as if the controller could not found the sector ID mark */ |
| 679 | 679 | hdc.w[7] |= w7_idle | w7_error | w7_command_time_out_err; |
| 680 | | update_interrupt(); |
| 680 | update_interrupt(machine); |
| 681 | 681 | return; |
| 682 | 682 | } |
| 683 | 683 | |
| r3909 | r3910 | |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | hdc.w[7] |= w7_idle | w7_complete; |
| 710 | | update_interrupt(); |
| 710 | update_interrupt(machine); |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /* |
| r3909 | r3910 | |
| 733 | 733 | { |
| 734 | 734 | /* No idea what to report... */ |
| 735 | 735 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 736 | | update_interrupt(); |
| 736 | update_interrupt(machine); |
| 737 | 737 | return; |
| 738 | 738 | } |
| 739 | 739 | else if (! is_unit_loaded(dsk_sel)) |
| 740 | 740 | { /* offline */ |
| 741 | 741 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 742 | 742 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 743 | | update_interrupt(); |
| 743 | update_interrupt(machine); |
| 744 | 744 | return; |
| 745 | 745 | } |
| 746 | 746 | else if (hdc.d[dsk_sel].unsafe) |
| 747 | 747 | { /* disk in unsafe condition */ |
| 748 | 748 | hdc.w[0] |= w0_unsafe | w0_pack_change; |
| 749 | 749 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 750 | | update_interrupt(); |
| 750 | update_interrupt(machine); |
| 751 | 751 | return; |
| 752 | 752 | } |
| 753 | 753 | else if (hdc.d[dsk_sel].wp) |
| 754 | 754 | { /* disk write-protected */ |
| 755 | 755 | hdc.w[0] |= w0_write_protect; |
| 756 | 756 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 757 | | update_interrupt(); |
| 757 | update_interrupt(machine); |
| 758 | 758 | return; |
| 759 | 759 | } |
| 760 | 760 | |
| r3909 | r3910 | |
| 765 | 765 | head = hdc.w[1] & w1_head_address; |
| 766 | 766 | sector = hdc.w[2] & 0xff; |
| 767 | 767 | |
| 768 | | if (sector_to_lba(dsk_sel, cylinder, head, sector, &lba)) |
| 768 | if (sector_to_lba(machine, dsk_sel, cylinder, head, sector, &lba)) |
| 769 | 769 | return; |
| 770 | 770 | |
| 771 | 771 | while (byte_count > 0) |
| r3909 | r3910 | |
| 774 | 774 | { |
| 775 | 775 | hdc.w[0] |= w0_seek_incomplete; |
| 776 | 776 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 777 | | update_interrupt(); |
| 777 | update_interrupt(machine); |
| 778 | 778 | return; |
| 779 | 779 | } |
| 780 | 780 | |
| r3909 | r3910 | |
| 797 | 797 | { |
| 798 | 798 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 799 | 799 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 800 | | update_interrupt(); |
| 800 | update_interrupt(machine); |
| 801 | 801 | return; |
| 802 | 802 | } |
| 803 | 803 | |
| r3909 | r3910 | |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | 821 | hdc.w[7] |= w7_idle | w7_complete; |
| 822 | | update_interrupt(); |
| 822 | update_interrupt(machine); |
| 823 | 823 | } |
| 824 | 824 | |
| 825 | 825 | /* |
| r3909 | r3910 | |
| 842 | 842 | { |
| 843 | 843 | /* No idea what to report... */ |
| 844 | 844 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 845 | | update_interrupt(); |
| 845 | update_interrupt(machine); |
| 846 | 846 | return; |
| 847 | 847 | } |
| 848 | 848 | else if (! is_unit_loaded(dsk_sel)) |
| 849 | 849 | { /* offline */ |
| 850 | 850 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 851 | 851 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 852 | | update_interrupt(); |
| 852 | update_interrupt(machine); |
| 853 | 853 | return; |
| 854 | 854 | } |
| 855 | 855 | else if (hdc.d[dsk_sel].unsafe) |
| 856 | 856 | { /* disk in unsafe condition */ |
| 857 | 857 | hdc.w[0] |= w0_unsafe | w0_pack_change; |
| 858 | 858 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 859 | | update_interrupt(); |
| 859 | update_interrupt(machine); |
| 860 | 860 | return; |
| 861 | 861 | } |
| 862 | 862 | |
| r3909 | r3910 | |
| 867 | 867 | head = hdc.w[1] & w1_head_address; |
| 868 | 868 | sector = hdc.w[2] & 0xff; |
| 869 | 869 | |
| 870 | | if (check_sector_address(dsk_sel, cylinder, head, sector)) |
| 870 | if (check_sector_address(machine, dsk_sel, cylinder, head, sector)) |
| 871 | 871 | return; |
| 872 | 872 | |
| 873 | 873 | dma_address = ((((int) hdc.w[6]) << 16) | hdc.w[5]) & 0x1ffffe; |
| r3909 | r3910 | |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | hdc.w[7] |= w7_idle | w7_complete; |
| 896 | | update_interrupt(); |
| 896 | update_interrupt(machine); |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | 899 | /* |
| 900 | 900 | Handle the restore command: return to track 0. |
| 901 | 901 | */ |
| 902 | | static void restore(void) |
| 902 | static void restore(running_machine *machine) |
| 903 | 903 | { |
| 904 | 904 | int dsk_sel = cur_disk_unit(); |
| 905 | 905 | |
| r3909 | r3910 | |
| 908 | 908 | { |
| 909 | 909 | /* No idea what to report... */ |
| 910 | 910 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 911 | | update_interrupt(); |
| 911 | update_interrupt(machine); |
| 912 | 912 | return; |
| 913 | 913 | } |
| 914 | 914 | else if (! is_unit_loaded(dsk_sel)) |
| 915 | 915 | { /* offline */ |
| 916 | 916 | hdc.w[0] |= w0_offline | w0_not_ready; |
| 917 | 917 | hdc.w[7] |= w7_idle | w7_error | w7_unit_err; |
| 918 | | update_interrupt(); |
| 918 | update_interrupt(machine); |
| 919 | 919 | return; |
| 920 | 920 | } |
| 921 | 921 | |
| r3909 | r3910 | |
| 925 | 925 | return;*/ |
| 926 | 926 | |
| 927 | 927 | hdc.w[7] |= w7_idle | w7_complete; |
| 928 | | update_interrupt(); |
| 928 | update_interrupt(machine); |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | /* |
| r3909 | r3910 | |
| 949 | 949 | case 0x01: //0b001: |
| 950 | 950 | /* write format */ |
| 951 | 951 | logerror("write format\n"); |
| 952 | | write_format(); |
| 952 | write_format(machine); |
| 953 | 953 | break; |
| 954 | 954 | case 0x02: //0b010: |
| 955 | 955 | /* read data */ |
| r3909 | r3910 | |
| 971 | 971 | logerror("unformatted write\n"); |
| 972 | 972 | /* ... */ |
| 973 | 973 | hdc.w[7] |= w7_idle | w7_error | w7_abnormal_completion; |
| 974 | | update_interrupt(); |
| 974 | update_interrupt(machine); |
| 975 | 975 | break; |
| 976 | 976 | case 0x06: //0b110: |
| 977 | 977 | /* seek */ |
| 978 | 978 | logerror("seek\n"); |
| 979 | 979 | /* This command can (almost) safely be ignored */ |
| 980 | 980 | hdc.w[7] |= w7_idle | w7_complete; |
| 981 | | update_interrupt(); |
| 981 | update_interrupt(machine); |
| 982 | 982 | break; |
| 983 | 983 | case 0x07: //0b111: |
| 984 | 984 | /* restore */ |
| 985 | 985 | logerror("restore\n"); |
| 986 | | restore(); |
| 986 | restore(machine); |
| 987 | 987 | break; |
| 988 | 988 | } |
| 989 | 989 | } |
| r3909 | r3910 | |
| 1015 | 1015 | hdc.w[offset] = (hdc.w[offset] & ((~w_mask[offset]) | mem_mask)) | (data & w_mask[offset] & ~mem_mask); |
| 1016 | 1016 | |
| 1017 | 1017 | if ((offset == 0) || (offset == 7)) |
| 1018 | | update_interrupt(); |
| 1018 | update_interrupt(space->machine); |
| 1019 | 1019 | |
| 1020 | 1020 | if ((offset == 7) && (old_data & w7_idle) && ! (data & w7_idle)) |
| 1021 | 1021 | { /* idle has been cleared: start command execution */ |
src/mess/machine/990_tap.c
| r3909 | r3910 | |
| 33 | 33 | #include "990_tap.h" |
| 34 | 34 | #include "image.h" |
| 35 | 35 | |
| 36 | | static void update_interrupt(void); |
| 36 | static void update_interrupt(running_machine *machine); |
| 37 | 37 | |
| 38 | 38 | #define MAX_TAPE_UNIT 4 |
| 39 | 39 | |
| r3909 | r3910 | |
| 49 | 49 | { |
| 50 | 50 | UINT16 w[8]; |
| 51 | 51 | |
| 52 | | void (*interrupt_callback)(int state); |
| 52 | void (*interrupt_callback)(running_machine *machine, int state); |
| 53 | 53 | |
| 54 | 54 | tape_unit_t t[MAX_TAPE_UNIT]; |
| 55 | 55 | } tpc_t; |
| r3909 | r3910 | |
| 171 | 171 | /* |
| 172 | 172 | Init the tape controller core |
| 173 | 173 | */ |
| 174 | | void ti990_tpc_init(void (*interrupt_callback)(int state)) |
| 174 | void ti990_tpc_init(running_machine *machine, void (*interrupt_callback)(running_machine *machine, int state)) |
| 175 | 175 | { |
| 176 | 176 | memset(tpc.w, 0, sizeof(tpc.w)); |
| 177 | 177 | /* The PE bit is always set for the MT3200 (but not MT1600) */ |
| r3909 | r3910 | |
| 180 | 180 | |
| 181 | 181 | tpc.interrupt_callback = interrupt_callback; |
| 182 | 182 | |
| 183 | | update_interrupt(); |
| 183 | update_interrupt(machine); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /* |
| r3909 | r3910 | |
| 212 | 212 | /* |
| 213 | 213 | Update interrupt state |
| 214 | 214 | */ |
| 215 | | static void update_interrupt(void) |
| 215 | static void update_interrupt(running_machine *machine) |
| 216 | 216 | { |
| 217 | 217 | if (tpc.interrupt_callback) |
| 218 | | (*tpc.interrupt_callback)((tpc.w[7] & w7_idle) |
| 218 | (*tpc.interrupt_callback)(machine, (tpc.w[7] & w7_idle) |
| 219 | 219 | && (((tpc.w[7] & w7_int_enable) && (tpc.w[7] & (w7_complete | w7_error))) |
| 220 | 220 | || ((tpc.w[0] & ~(tpc.w[0] >> 4)) & w0_rewind_mask))); |
| 221 | 221 | } |
| r3909 | r3910 | |
| 244 | 244 | { |
| 245 | 245 | /* No idea what to report... */ |
| 246 | 246 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 247 | | update_interrupt(); |
| 247 | update_interrupt(machine); |
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | else if (! image_exists(tpc.t[tap_sel].img)) |
| 251 | 251 | { /* offline */ |
| 252 | 252 | tpc.w[0] |= w0_offline; |
| 253 | 253 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 254 | | update_interrupt(); |
| 254 | update_interrupt(machine); |
| 255 | 255 | return; |
| 256 | 256 | } |
| 257 | 257 | #if 0 |
| r3909 | r3910 | |
| 259 | 259 | { /* rewind in progress */ |
| 260 | 260 | tpc.w[0] |= 0x80 >> tap_sel; |
| 261 | 261 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 262 | | update_interrupt(); |
| 262 | update_interrupt(machine); |
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | 265 | #endif |
| r3909 | r3910 | |
| 278 | 278 | tpc.t[tap_sel].eot = 1; |
| 279 | 279 | tpc.w[0] |= w0_EOT; /* or should it be w0_command_timeout? */ |
| 280 | 280 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 281 | | update_interrupt(); |
| 281 | update_interrupt(machine); |
| 282 | 282 | goto update_registers; |
| 283 | 283 | } |
| 284 | 284 | else |
| r3909 | r3910 | |
| 289 | 289 | image_unload(tpc.t[tap_sel].img); |
| 290 | 290 | tpc.w[0] |= w0_offline; |
| 291 | 291 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 292 | | update_interrupt(); |
| 292 | update_interrupt(machine); |
| 293 | 293 | goto update_registers; |
| 294 | 294 | } |
| 295 | 295 | } |
| r3909 | r3910 | |
| 302 | 302 | image_unload(tpc.t[tap_sel].img); |
| 303 | 303 | tpc.w[0] |= w0_offline; |
| 304 | 304 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 305 | | update_interrupt(); |
| 305 | update_interrupt(machine); |
| 306 | 306 | goto update_registers; |
| 307 | 307 | } |
| 308 | 308 | |
| r3909 | r3910 | |
| 312 | 312 | logerror("read binary forward: found EOF, requested %d\n", char_count); |
| 313 | 313 | tpc.w[0] |= w0_EOF; |
| 314 | 314 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 315 | | update_interrupt(); |
| 315 | update_interrupt(machine); |
| 316 | 316 | goto update_registers; |
| 317 | 317 | } |
| 318 | 318 | |
| r3909 | r3910 | |
| 329 | 329 | image_unload(tpc.t[tap_sel].img); |
| 330 | 330 | tpc.w[0] |= w0_offline; |
| 331 | 331 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 332 | | update_interrupt(); |
| 332 | update_interrupt(machine); |
| 333 | 333 | goto update_registers; |
| 334 | 334 | } |
| 335 | 335 | |
| r3909 | r3910 | |
| 339 | 339 | { |
| 340 | 340 | tpc.w[0] |= w0_EOR; |
| 341 | 341 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 342 | | update_interrupt(); |
| 342 | update_interrupt(machine); |
| 343 | 343 | goto skip_trailer; |
| 344 | 344 | } |
| 345 | 345 | |
| r3909 | r3910 | |
| 373 | 373 | image_unload(tpc.t[tap_sel].img); |
| 374 | 374 | tpc.w[0] |= w0_offline; |
| 375 | 375 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 376 | | update_interrupt(); |
| 376 | update_interrupt(machine); |
| 377 | 377 | goto update_registers; |
| 378 | 378 | } |
| 379 | 379 | } |
| r3909 | r3910 | |
| 382 | 382 | { |
| 383 | 383 | tpc.w[0] |= w0_EOR; |
| 384 | 384 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 385 | | update_interrupt(); |
| 385 | update_interrupt(machine); |
| 386 | 386 | goto skip_trailer; |
| 387 | 387 | } |
| 388 | 388 | |
| r3909 | r3910 | |
| 394 | 394 | image_unload(tpc.t[tap_sel].img); |
| 395 | 395 | tpc.w[0] |= w0_offline; |
| 396 | 396 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 397 | | update_interrupt(); |
| 397 | update_interrupt(machine); |
| 398 | 398 | goto update_registers; |
| 399 | 399 | } |
| 400 | 400 | } |
| r3909 | r3910 | |
| 406 | 406 | image_unload(tpc.t[tap_sel].img); |
| 407 | 407 | tpc.w[0] |= w0_offline; |
| 408 | 408 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 409 | | update_interrupt(); |
| 409 | update_interrupt(machine); |
| 410 | 410 | goto update_registers; |
| 411 | 411 | } |
| 412 | 412 | |
| r3909 | r3910 | |
| 416 | 416 | image_unload(tpc.t[tap_sel].img); |
| 417 | 417 | tpc.w[0] |= w0_offline; |
| 418 | 418 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 419 | | update_interrupt(); |
| 419 | update_interrupt(machine); |
| 420 | 420 | goto update_registers; |
| 421 | 421 | } |
| 422 | 422 | if (buffer[2] || buffer[3]) |
| r3909 | r3910 | |
| 427 | 427 | image_unload(tpc.t[tap_sel].img); |
| 428 | 428 | tpc.w[0] |= w0_offline; |
| 429 | 429 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 430 | | update_interrupt(); |
| 430 | update_interrupt(machine); |
| 431 | 431 | goto update_registers; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | if (! (tpc.w[7] & w7_error)) |
| 435 | 435 | { |
| 436 | 436 | tpc.w[7] |= w7_idle | w7_complete; |
| 437 | | update_interrupt(); |
| 437 | update_interrupt(machine); |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | update_registers: |
| r3909 | r3910 | |
| 449 | 449 | /* |
| 450 | 450 | Handle the record skip forward command: skip a specified number of records. |
| 451 | 451 | */ |
| 452 | | static void cmd_record_skip_forward(void) |
| 452 | static void cmd_record_skip_forward(running_machine *machine) |
| 453 | 453 | { |
| 454 | 454 | UINT8 buffer[4]; |
| 455 | 455 | int reclen; |
| r3909 | r3910 | |
| 463 | 463 | { |
| 464 | 464 | /* No idea what to report... */ |
| 465 | 465 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 466 | | update_interrupt(); |
| 466 | update_interrupt(machine); |
| 467 | 467 | return; |
| 468 | 468 | } |
| 469 | 469 | else if (! image_exists(tpc.t[tap_sel].img)) |
| 470 | 470 | { /* offline */ |
| 471 | 471 | tpc.w[0] |= w0_offline; |
| 472 | 472 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 473 | | update_interrupt(); |
| 473 | update_interrupt(machine); |
| 474 | 474 | return; |
| 475 | 475 | } |
| 476 | 476 | #if 0 |
| r3909 | r3910 | |
| 478 | 478 | { /* rewind in progress */ |
| 479 | 479 | tpc.w[0] |= 0x80 >> tap_sel; |
| 480 | 480 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 481 | | update_interrupt(); |
| 481 | update_interrupt(machine); |
| 482 | 482 | return; |
| 483 | 483 | } |
| 484 | 484 | #endif |
| r3909 | r3910 | |
| 498 | 498 | tpc.t[tap_sel].eot = 1; |
| 499 | 499 | tpc.w[0] |= w0_EOT; /* or should it be w0_command_timeout? */ |
| 500 | 500 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 501 | | update_interrupt(); |
| 501 | update_interrupt(machine); |
| 502 | 502 | goto update_registers; |
| 503 | 503 | } |
| 504 | 504 | else |
| r3909 | r3910 | |
| 508 | 508 | image_unload(tpc.t[tap_sel].img); |
| 509 | 509 | tpc.w[0] |= w0_offline; |
| 510 | 510 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 511 | | update_interrupt(); |
| 511 | update_interrupt(machine); |
| 512 | 512 | goto update_registers; |
| 513 | 513 | } |
| 514 | 514 | } |
| r3909 | r3910 | |
| 520 | 520 | image_unload(tpc.t[tap_sel].img); |
| 521 | 521 | tpc.w[0] |= w0_offline; |
| 522 | 522 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 523 | | update_interrupt(); |
| 523 | update_interrupt(machine); |
| 524 | 524 | goto update_registers; |
| 525 | 525 | } |
| 526 | 526 | |
| r3909 | r3910 | |
| 530 | 530 | logerror("record skip forward: found EOF\n"); |
| 531 | 531 | tpc.w[0] |= w0_EOF; |
| 532 | 532 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 533 | | update_interrupt(); |
| 533 | update_interrupt(machine); |
| 534 | 534 | goto update_registers; |
| 535 | 535 | } |
| 536 | 536 | |
| r3909 | r3910 | |
| 540 | 540 | image_unload(tpc.t[tap_sel].img); |
| 541 | 541 | tpc.w[0] |= w0_offline; |
| 542 | 542 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 543 | | update_interrupt(); |
| 543 | update_interrupt(machine); |
| 544 | 544 | goto update_registers; |
| 545 | 545 | } |
| 546 | 546 | |
| r3909 | r3910 | |
| 549 | 549 | image_unload(tpc.t[tap_sel].img); |
| 550 | 550 | tpc.w[0] |= w0_offline; |
| 551 | 551 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 552 | | update_interrupt(); |
| 552 | update_interrupt(machine); |
| 553 | 553 | goto update_registers; |
| 554 | 554 | } |
| 555 | 555 | |
| r3909 | r3910 | |
| 558 | 558 | image_unload(tpc.t[tap_sel].img); |
| 559 | 559 | tpc.w[0] |= w0_offline; |
| 560 | 560 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 561 | | update_interrupt(); |
| 561 | update_interrupt(machine); |
| 562 | 562 | goto update_registers; |
| 563 | 563 | } |
| 564 | 564 | if (buffer[2] || buffer[3]) |
| r3909 | r3910 | |
| 568 | 568 | image_unload(tpc.t[tap_sel].img); |
| 569 | 569 | tpc.w[0] |= w0_offline; |
| 570 | 570 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 571 | | update_interrupt(); |
| 571 | update_interrupt(machine); |
| 572 | 572 | goto update_registers; |
| 573 | 573 | } |
| 574 | 574 | |
| r3909 | r3910 | |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | tpc.w[7] |= w7_idle | w7_complete; |
| 579 | | update_interrupt(); |
| 579 | update_interrupt(machine); |
| 580 | 580 | |
| 581 | 581 | update_registers: |
| 582 | 582 | tpc.w[4] = record_count; |
| r3909 | r3910 | |
| 585 | 585 | /* |
| 586 | 586 | Handle the record skip reverse command: skip a specified number of records backwards. |
| 587 | 587 | */ |
| 588 | | static void cmd_record_skip_reverse(void) |
| 588 | static void cmd_record_skip_reverse(running_machine *machine) |
| 589 | 589 | { |
| 590 | 590 | UINT8 buffer[4]; |
| 591 | 591 | int reclen; |
| r3909 | r3910 | |
| 600 | 600 | { |
| 601 | 601 | /* No idea what to report... */ |
| 602 | 602 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 603 | | update_interrupt(); |
| 603 | update_interrupt(machine); |
| 604 | 604 | return; |
| 605 | 605 | } |
| 606 | 606 | else if (! image_exists(tpc.t[tap_sel].img)) |
| 607 | 607 | { /* offline */ |
| 608 | 608 | tpc.w[0] |= w0_offline; |
| 609 | 609 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 610 | | update_interrupt(); |
| 610 | update_interrupt(machine); |
| 611 | 611 | return; |
| 612 | 612 | } |
| 613 | 613 | #if 0 |
| r3909 | r3910 | |
| 615 | 615 | { /* rewind in progress */ |
| 616 | 616 | tpc.w[0] |= 0x80 >> tap_sel; |
| 617 | 617 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 618 | | update_interrupt(); |
| 618 | update_interrupt(machine); |
| 619 | 619 | return; |
| 620 | 620 | } |
| 621 | 621 | #endif |
| r3909 | r3910 | |
| 632 | 632 | tpc.t[tap_sel].bot = 1; |
| 633 | 633 | tpc.w[0] |= w0_BOT; |
| 634 | 634 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 635 | | update_interrupt(); |
| 635 | update_interrupt(machine); |
| 636 | 636 | goto update_registers; |
| 637 | 637 | } |
| 638 | 638 | if (image_fseek(tpc.t[tap_sel].img, -4, SEEK_CUR)) |
| r3909 | r3910 | |
| 640 | 640 | image_unload(tpc.t[tap_sel].img); |
| 641 | 641 | tpc.w[0] |= w0_offline; |
| 642 | 642 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 643 | | update_interrupt(); |
| 643 | update_interrupt(machine); |
| 644 | 644 | goto update_registers; |
| 645 | 645 | } |
| 646 | 646 | bytes_read = image_fread(tpc.t[tap_sel].img, buffer, 4); |
| r3909 | r3910 | |
| 652 | 652 | image_unload(tpc.t[tap_sel].img); |
| 653 | 653 | tpc.w[0] |= w0_offline; |
| 654 | 654 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 655 | | update_interrupt(); |
| 655 | update_interrupt(machine); |
| 656 | 656 | goto update_registers; |
| 657 | 657 | } |
| 658 | 658 | reclen = (((int) buffer[1]) << 8) | buffer[0]; |
| r3909 | r3910 | |
| 663 | 663 | image_unload(tpc.t[tap_sel].img); |
| 664 | 664 | tpc.w[0] |= w0_offline; |
| 665 | 665 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 666 | | update_interrupt(); |
| 666 | update_interrupt(machine); |
| 667 | 667 | goto update_registers; |
| 668 | 668 | } |
| 669 | 669 | |
| r3909 | r3910 | |
| 676 | 676 | image_unload(tpc.t[tap_sel].img); |
| 677 | 677 | tpc.w[0] |= w0_offline; |
| 678 | 678 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 679 | | update_interrupt(); |
| 679 | update_interrupt(machine); |
| 680 | 680 | goto update_registers; |
| 681 | 681 | } |
| 682 | 682 | tpc.w[0] |= w0_EOF; |
| 683 | 683 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 684 | | update_interrupt(); |
| 684 | update_interrupt(machine); |
| 685 | 685 | goto update_registers; |
| 686 | 686 | } |
| 687 | 687 | |
| r3909 | r3910 | |
| 690 | 690 | image_unload(tpc.t[tap_sel].img); |
| 691 | 691 | tpc.w[0] |= w0_offline; |
| 692 | 692 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 693 | | update_interrupt(); |
| 693 | update_interrupt(machine); |
| 694 | 694 | goto update_registers; |
| 695 | 695 | } |
| 696 | 696 | |
| r3909 | r3910 | |
| 699 | 699 | image_unload(tpc.t[tap_sel].img); |
| 700 | 700 | tpc.w[0] |= w0_offline; |
| 701 | 701 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 702 | | update_interrupt(); |
| 702 | update_interrupt(machine); |
| 703 | 703 | goto update_registers; |
| 704 | 704 | } |
| 705 | 705 | if (reclen != ((((int) buffer[1]) << 8) | buffer[0])) |
| r3909 | r3910 | |
| 707 | 707 | image_unload(tpc.t[tap_sel].img); |
| 708 | 708 | tpc.w[0] |= w0_offline; |
| 709 | 709 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 710 | | update_interrupt(); |
| 710 | update_interrupt(machine); |
| 711 | 711 | goto update_registers; |
| 712 | 712 | } |
| 713 | 713 | if (buffer[2] || buffer[3]) |
| r3909 | r3910 | |
| 717 | 717 | image_unload(tpc.t[tap_sel].img); |
| 718 | 718 | tpc.w[0] |= w0_offline; |
| 719 | 719 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 720 | | update_interrupt(); |
| 720 | update_interrupt(machine); |
| 721 | 721 | goto update_registers; |
| 722 | 722 | } |
| 723 | 723 | |
| r3909 | r3910 | |
| 726 | 726 | image_unload(tpc.t[tap_sel].img); |
| 727 | 727 | tpc.w[0] |= w0_offline; |
| 728 | 728 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 729 | | update_interrupt(); |
| 729 | update_interrupt(machine); |
| 730 | 730 | goto update_registers; |
| 731 | 731 | } |
| 732 | 732 | |
| r3909 | r3910 | |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | tpc.w[7] |= w7_idle | w7_complete; |
| 737 | | update_interrupt(); |
| 737 | update_interrupt(machine); |
| 738 | 738 | |
| 739 | 739 | update_registers: |
| 740 | 740 | tpc.w[4] = record_count; |
| r3909 | r3910 | |
| 743 | 743 | /* |
| 744 | 744 | Handle the rewind command: rewind to BOT. |
| 745 | 745 | */ |
| 746 | | static void cmd_rewind(void) |
| 746 | static void cmd_rewind(running_machine *machine) |
| 747 | 747 | { |
| 748 | 748 | int tap_sel = cur_tape_unit(); |
| 749 | 749 | |
| r3909 | r3910 | |
| 751 | 751 | { |
| 752 | 752 | /* No idea what to report... */ |
| 753 | 753 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 754 | | update_interrupt(); |
| 754 | update_interrupt(machine); |
| 755 | 755 | return; |
| 756 | 756 | } |
| 757 | 757 | else if (! image_exists(tpc.t[tap_sel].img)) |
| 758 | 758 | { /* offline */ |
| 759 | 759 | tpc.w[0] |= w0_offline; |
| 760 | 760 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 761 | | update_interrupt(); |
| 761 | update_interrupt(machine); |
| 762 | 762 | return; |
| 763 | 763 | } |
| 764 | 764 | #if 0 |
| r3909 | r3910 | |
| 766 | 766 | { /* rewind in progress */ |
| 767 | 767 | tpc.w[0] |= 0x80 >> tap_sel; |
| 768 | 768 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 769 | | update_interrupt(); |
| 769 | update_interrupt(machine); |
| 770 | 770 | return; |
| 771 | 771 | } |
| 772 | 772 | #endif |
| r3909 | r3910 | |
| 778 | 778 | image_unload(tpc.t[tap_sel].img); |
| 779 | 779 | tpc.w[0] |= w0_offline; |
| 780 | 780 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 781 | | update_interrupt(); |
| 781 | update_interrupt(machine); |
| 782 | 782 | return; |
| 783 | 783 | } |
| 784 | 784 | tpc.t[tap_sel].bot = 1; |
| 785 | 785 | |
| 786 | 786 | tpc.w[7] |= w7_idle | w7_complete; |
| 787 | | update_interrupt(); |
| 787 | update_interrupt(machine); |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | /* |
| 791 | 791 | Handle the rewind and offline command: disable the tape unit. |
| 792 | 792 | */ |
| 793 | | static void cmd_rewind_and_offline(void) |
| 793 | static void cmd_rewind_and_offline(running_machine *machine) |
| 794 | 794 | { |
| 795 | 795 | int tap_sel = cur_tape_unit(); |
| 796 | 796 | |
| r3909 | r3910 | |
| 798 | 798 | { |
| 799 | 799 | /* No idea what to report... */ |
| 800 | 800 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 801 | | update_interrupt(); |
| 801 | update_interrupt(machine); |
| 802 | 802 | return; |
| 803 | 803 | } |
| 804 | 804 | else if (! image_exists(tpc.t[tap_sel].img)) |
| 805 | 805 | { /* offline */ |
| 806 | 806 | tpc.w[0] |= w0_offline; |
| 807 | 807 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 808 | | update_interrupt(); |
| 808 | update_interrupt(machine); |
| 809 | 809 | return; |
| 810 | 810 | } |
| 811 | 811 | #if 0 |
| r3909 | r3910 | |
| 813 | 813 | { /* rewind in progress */ |
| 814 | 814 | tpc.w[0] |= 0x80 >> tap_sel; |
| 815 | 815 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 816 | | update_interrupt(); |
| 816 | update_interrupt(machine); |
| 817 | 817 | return; |
| 818 | 818 | } |
| 819 | 819 | #endif |
| r3909 | r3910 | |
| 822 | 822 | image_unload(tpc.t[tap_sel].img); |
| 823 | 823 | |
| 824 | 824 | tpc.w[7] |= w7_idle | w7_complete; |
| 825 | | update_interrupt(); |
| 825 | update_interrupt(machine); |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | 828 | /* |
| 829 | 829 | Handle the read transport status command: return the current tape status. |
| 830 | 830 | */ |
| 831 | | static void read_transport_status(void) |
| 831 | static void read_transport_status(running_machine *machine) |
| 832 | 832 | { |
| 833 | 833 | int tap_sel = cur_tape_unit(); |
| 834 | 834 | |
| r3909 | r3910 | |
| 836 | 836 | { |
| 837 | 837 | /* No idea what to report... */ |
| 838 | 838 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 839 | | update_interrupt(); |
| 839 | update_interrupt(machine); |
| 840 | 840 | } |
| 841 | 841 | else if (! image_exists(tpc.t[tap_sel].img)) |
| 842 | 842 | { /* offline */ |
| 843 | 843 | tpc.w[0] |= w0_offline; |
| 844 | 844 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 845 | | update_interrupt(); |
| 845 | update_interrupt(machine); |
| 846 | 846 | } |
| 847 | 847 | #if 0 |
| 848 | 848 | else if (0) |
| 849 | 849 | { /* rewind in progress */ |
| 850 | 850 | tpc.w[0] |= /*...*/; |
| 851 | 851 | tpc.w[7] |= w7_idle | w7_error | w7_tape_error; |
| 852 | | update_interrupt(); |
| 852 | update_interrupt(machine); |
| 853 | 853 | } |
| 854 | 854 | #endif |
| 855 | 855 | else |
| r3909 | r3910 | |
| 861 | 861 | if (tpc.t[tap_sel].wp) |
| 862 | 862 | tpc.w[0] |= w0_write_ring; |
| 863 | 863 | tpc.w[7] |= w7_idle | w7_complete; |
| 864 | | update_interrupt(); |
| 864 | update_interrupt(machine); |
| 865 | 865 | } |
| 866 | 866 | } |
| 867 | 867 | |
| r3909 | r3910 | |
| 881 | 881 | /* NOP */ |
| 882 | 882 | logerror("NOP\n"); |
| 883 | 883 | tpc.w[7] |= w7_idle | w7_complete; |
| 884 | | update_interrupt(); |
| 884 | update_interrupt(machine); |
| 885 | 885 | break; |
| 886 | 886 | case 0x01: |
| 887 | 887 | /* buffer sync: means nothing under emulation */ |
| 888 | 888 | logerror("buffer sync\n"); |
| 889 | 889 | tpc.w[7] |= w7_idle | w7_complete; |
| 890 | | update_interrupt(); |
| 890 | update_interrupt(machine); |
| 891 | 891 | break; |
| 892 | 892 | case 0x02: |
| 893 | 893 | /* write EOF - not emulated */ |
| 894 | 894 | logerror("write EOF\n"); |
| 895 | 895 | /* ... */ |
| 896 | 896 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 897 | | update_interrupt(); |
| 897 | update_interrupt(machine); |
| 898 | 898 | break; |
| 899 | 899 | case 0x03: |
| 900 | 900 | /* record skip reverse - not fully tested */ |
| 901 | 901 | logerror("record skip reverse\n"); |
| 902 | | cmd_record_skip_reverse(); |
| 902 | cmd_record_skip_reverse(machine); |
| 903 | 903 | break; |
| 904 | 904 | case 0x04: |
| 905 | 905 | /* read binary forward */ |
| r3909 | r3910 | |
| 909 | 909 | case 0x05: |
| 910 | 910 | /* record skip forward - not tested */ |
| 911 | 911 | logerror("record skip forward\n"); |
| 912 | | cmd_record_skip_forward(); |
| 912 | cmd_record_skip_forward(machine); |
| 913 | 913 | break; |
| 914 | 914 | case 0x06: |
| 915 | 915 | /* write binary forward - not emulated */ |
| 916 | 916 | logerror("write binary forward\n"); |
| 917 | 917 | /* ... */ |
| 918 | 918 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 919 | | update_interrupt(); |
| 919 | update_interrupt(machine); |
| 920 | 920 | break; |
| 921 | 921 | case 0x07: |
| 922 | 922 | /* erase - not emulated */ |
| 923 | 923 | logerror("erase\n"); |
| 924 | 924 | /* ... */ |
| 925 | 925 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 926 | | update_interrupt(); |
| 926 | update_interrupt(machine); |
| 927 | 927 | break; |
| 928 | 928 | case 0x08: |
| 929 | 929 | case 0x09: |
| 930 | 930 | /* read transport status */ |
| 931 | 931 | logerror("read transport status\n"); |
| 932 | | read_transport_status(); |
| 932 | read_transport_status(machine); |
| 933 | 933 | break; |
| 934 | 934 | case 0x0A: |
| 935 | 935 | /* rewind - not tested */ |
| 936 | 936 | logerror("rewind\n"); |
| 937 | | cmd_rewind(); |
| 937 | cmd_rewind(machine); |
| 938 | 938 | break; |
| 939 | 939 | case 0x0B: |
| 940 | 940 | /* rewind and offline - not tested */ |
| 941 | 941 | logerror("rewind and offline\n"); |
| 942 | | cmd_rewind_and_offline(); |
| 942 | cmd_rewind_and_offline(machine); |
| 943 | 943 | break; |
| 944 | 944 | case 0x0F: |
| 945 | 945 | /* extended control and status - not emulated */ |
| 946 | 946 | logerror("extended control and status\n"); |
| 947 | 947 | /* ... */ |
| 948 | 948 | tpc.w[7] |= w7_idle | w7_error | w7_hard_error; |
| 949 | | update_interrupt(); |
| 949 | update_interrupt(machine); |
| 950 | 950 | break; |
| 951 | 951 | } |
| 952 | 952 | } |
| r3909 | r3910 | |
| 979 | 979 | tpc.w[offset] = (tpc.w[offset] & ((~w_mask[offset]) | mem_mask)) | (data & w_mask[offset] & ~mem_mask); |
| 980 | 980 | |
| 981 | 981 | if ((offset == 0) || (offset == 7)) |
| 982 | | update_interrupt(); |
| 982 | update_interrupt(space->machine); |
| 983 | 983 | |
| 984 | 984 | if ((offset == 7) && (old_data & w7_idle) && ! (data & w7_idle)) |
| 985 | 985 | { /* idle has been cleared: start command execution */ |