src/mess/messdriv.c
| r3969 | r3970 | |
| 517 | 517 | DRIVER( ip244415 ) |
| 518 | 518 | |
| 519 | 519 | /* TEXAS INSTRUMENTS */ |
| 520 | | //0128u7 DRIVER( ti990_10 ) /* 1975 TI 990/10 */ |
| 521 | | //0128u7 DRIVER( ti990_4 ) /* 1976 TI 990/4 */ |
| 522 | | //0128u7 DRIVER( 990189 ) /* 1978 TM 990/189 */ |
| 523 | | //0128u7 DRIVER( 990189v ) /* 1980 TM 990/189 with Color Video Board */ |
| 520 | DRIVER( ti990_10 ) /* 1975 TI 990/10 */ |
| 521 | DRIVER( ti990_4 ) /* 1976 TI 990/4 */ |
| 522 | DRIVER( 990189 ) /* 1978 TM 990/189 */ |
| 523 | DRIVER( 990189v ) /* 1980 TM 990/189 with Color Video Board */ |
| 524 | 524 | |
| 525 | | //0128u7 DRIVER( ti99_224 ) /* 1983 TI 99/2 (24kb ROMs) */ |
| 526 | | //0128u7 DRIVER( ti99_232 ) /* 1983 TI 99/2 (32kb ROMs) */ |
| 527 | | //0128u7 DRIVER( ti99_4 ) /* 1979 TI-99/4 */ |
| 528 | | //0128u7 DRIVER( ti99_4e ) /* 1980 TI-99/4 with 50Hz video */ |
| 529 | | //0128u7 DRIVER( ti99_4a ) /* 1981 TI-99/4A */ |
| 530 | | //0128u7 DRIVER( ti99_4ae ) /* 1981 TI-99/4A with 50Hz video */ |
| 531 | | //0128u7 DRIVER( ti99_4ev) /* 1994 TI-99/4A with EVPC video card */ |
| 532 | | //0128u7 DRIVER( ti99_8 ) /* 1983 TI-99/8 */ |
| 533 | | //0128u7 DRIVER( ti99_8e ) /* 1983 TI-99/8 with 50Hz video */ |
| 525 | DRIVER( ti99_224 ) /* 1983 TI 99/2 (24kb ROMs) */ |
| 526 | DRIVER( ti99_232 ) /* 1983 TI 99/2 (32kb ROMs) */ |
| 527 | DRIVER( ti99_4 ) /* 1979 TI-99/4 */ |
| 528 | DRIVER( ti99_4e ) /* 1980 TI-99/4 with 50Hz video */ |
| 529 | DRIVER( ti99_4a ) /* 1981 TI-99/4A */ |
| 530 | DRIVER( ti99_4ae ) /* 1981 TI-99/4A with 50Hz video */ |
| 531 | DRIVER( ti99_4ev) /* 1994 TI-99/4A with EVPC video card */ |
| 532 | DRIVER( ti99_8 ) /* 1983 TI-99/8 */ |
| 533 | DRIVER( ti99_8e ) /* 1983 TI-99/8 with 50Hz video */ |
| 534 | 534 | |
| 535 | 535 | /* TI 99 clones */ |
| 536 | | //0128u7 DRIVER( tutor) /* 1983? Tomy Tutor */ |
| 537 | | //0128u7 DRIVER( geneve ) /* 1987? Myarc Geneve 9640 */ |
| 538 | | //0128u7 DRIVER( genmod ) /* 199?? Myarc Geneve 9640 */ |
| 539 | | //0128u7 DRIVER( ti99_4p ) /* 1996 SNUG 99/4P (a.k.a. SGCPU) */ |
| 536 | DRIVER( tutor) /* 1983? Tomy Tutor */ |
| 537 | DRIVER( geneve ) /* 1987? Myarc Geneve 9640 */ |
| 538 | DRIVER( genmod ) /* 199?? Myarc Geneve 9640 */ |
| 539 | DRIVER( ti99_4p ) /* 1996 SNUG 99/4P (a.k.a. SGCPU) */ |
| 540 | 540 | |
| 541 | 541 | DRIVER( avigo ) /* */ |
| 542 | 542 | |
| r3969 | r3970 | |
| 917 | 917 | DRIVER( gamecom ) /* Tiger Game.com */ |
| 918 | 918 | |
| 919 | 919 | /* Thomson */ |
| 920 | | //0128u7 DRIVER( t9000 ) /* 1980 Thomson T9000 (TO7 prototype) */ |
| 921 | | //0128u7 DRIVER( to7 ) /* 1982 Thomson TO7 */ |
| 922 | | //0128u7 DRIVER( to770 ) /* 1984 Thomson TO7/70 */ |
| 923 | | //0128u7 DRIVER( to770a ) /* 198? Thomson TO7/70 arabic version */ |
| 924 | | //0128u7 DRIVER( mo5 ) /* 1984 Thomson MO5 */ |
| 925 | | //0128u7 DRIVER( mo5e ) /* 1986 Thomson MO5E (export version) */ |
| 926 | | //0128u7 DRIVER( to9 ) /* 1985 Thomson T09 */ |
| 927 | | //0128u7 DRIVER( to8 ) /* 1986 Thomson T08 */ |
| 928 | | //0128u7 DRIVER( to8d ) /* 1987 Thomson T08D */ |
| 929 | | //0128u7 DRIVER( to9p ) /* 1986 Thomson T09+ */ |
| 930 | | //0128u7 DRIVER( mo6 ) /* 1986 Thomson MO6 */ |
| 931 | | //0128u7 DRIVER( mo5nr ) /* 1986 Thomson MO5 NR */ |
| 932 | | //0128u7 DRIVER( pro128 ) /* 1986 Olivetti Prodest PC 128 */ |
| 920 | DRIVER( t9000 ) /* 1980 Thomson T9000 (TO7 prototype) */ |
| 921 | DRIVER( to7 ) /* 1982 Thomson TO7 */ |
| 922 | DRIVER( to770 ) /* 1984 Thomson TO7/70 */ |
| 923 | DRIVER( to770a ) /* 198? Thomson TO7/70 arabic version */ |
| 924 | DRIVER( mo5 ) /* 1984 Thomson MO5 */ |
| 925 | DRIVER( mo5e ) /* 1986 Thomson MO5E (export version) */ |
| 926 | DRIVER( to9 ) /* 1985 Thomson T09 */ |
| 927 | DRIVER( to8 ) /* 1986 Thomson T08 */ |
| 928 | DRIVER( to8d ) /* 1987 Thomson T08D */ |
| 929 | DRIVER( to9p ) /* 1986 Thomson T09+ */ |
| 930 | DRIVER( mo6 ) /* 1986 Thomson MO6 */ |
| 931 | DRIVER( mo5nr ) /* 1986 Thomson MO5 NR */ |
| 932 | DRIVER( pro128 ) /* 1986 Olivetti Prodest PC 128 */ |
| 933 | 933 | |
| 934 | 934 | /* Cybiko, Inc. */ |
| 935 | 935 | // DRIVER( cybikov1 ) /* Cybiko Wireless Intertainment System - Classic V1 */ |
src/mess/machine/smc92x4.c
| r3969 | r3970 | |
| 129 | 129 | disk_unit: floppy drive index |
| 130 | 130 | head: selected head |
| 131 | 131 | */ |
| 132 | | static int floppy_read_id(int which, int disk_unit, int head) |
| 132 | static int floppy_read_id(running_machine *machine,int which, int disk_unit, int head) |
| 133 | 133 | { |
| 134 | 134 | const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit); |
| 135 | 135 | UINT8 revolution_count; |
| r3969 | r3970 | |
| 161 | 161 | which: udc controller index |
| 162 | 162 | disk_unit: floppy drive index |
| 163 | 163 | */ |
| 164 | | static int floppy_find_sector(int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *sector_data_id, int *sector_len) |
| 164 | static int floppy_find_sector(running_machine *machine,int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *sector_data_id, int *sector_len) |
| 165 | 165 | { |
| 166 | 166 | const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit); |
| 167 | 167 | UINT8 revolution_count; |
| r3969 | r3970 | |
| 202 | 202 | return FALSE; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | | static int smc92x4_floppy_read_sector(int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *dma_address) |
| 205 | static int smc92x4_floppy_read_sector(running_machine *machine,int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *dma_address) |
| 206 | 206 | { |
| 207 | 207 | int sector_data_id, sector_len; |
| 208 | 208 | UINT8 buf[MAX_SECTOR_LEN]; |
| 209 | 209 | int i; |
| 210 | 210 | const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit); |
| 211 | 211 | |
| 212 | | if (! floppy_find_sector(which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len)) |
| 212 | if (! floppy_find_sector(machine,which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len)) |
| 213 | 213 | { |
| 214 | 214 | hfdc[which].status |= ST_TC_RDIDERR; |
| 215 | 215 | return FALSE; |
| r3969 | r3970 | |
| 224 | 224 | return TRUE; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | | static int smc92x4_floppy_write_sector(int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *dma_address) |
| 227 | static int smc92x4_floppy_write_sector(running_machine *machine,int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *dma_address) |
| 228 | 228 | { |
| 229 | 229 | int sector_data_id, sector_len; |
| 230 | 230 | UINT8 buf[MAX_SECTOR_LEN]; |
| 231 | 231 | int i; |
| 232 | 232 | const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit); |
| 233 | 233 | |
| 234 | | if (! floppy_find_sector(which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len)) |
| 234 | if (! floppy_find_sector(machine,which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len)) |
| 235 | 235 | { |
| 236 | 236 | hfdc[which].status |= ST_TC_RDIDERR; |
| 237 | 237 | return FALSE; |
| r3969 | r3970 | |
| 246 | 246 | return TRUE; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | | static void floppy_step(int which, int disk_unit, int direction) |
| 249 | static void floppy_step(running_machine *machine,int which, int disk_unit, int direction) |
| 250 | 250 | { |
| 251 | 251 | const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit); |
| 252 | 252 | floppy_drive_seek(disk_img, direction); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | | static UINT8 floppy_get_disk_status(int which, int disk_unit) |
| 255 | static UINT8 floppy_get_disk_status(running_machine *machine,int which, int disk_unit) |
| 256 | 256 | { |
| 257 | 257 | const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit); |
| 258 | 258 | int status = floppy_status(disk_img, -1); |
| r3969 | r3970 | |
| 570 | 570 | smc92x4_set_interrupt(which, 1); |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | | INLINE void step(int which, select_mode_t select_mode, int disk_unit, int direction) |
| 573 | INLINE void step(running_machine *machine,int which, select_mode_t select_mode, int disk_unit, int direction) |
| 574 | 574 | { |
| 575 | 575 | switch (select_mode) |
| 576 | 576 | { |
| r3969 | r3970 | |
| 588 | 588 | |
| 589 | 589 | case sm_floppy_slow: |
| 590 | 590 | case sm_floppy_fast: |
| 591 | | floppy_step(which, disk_unit, direction); |
| 591 | floppy_step(machine,which, disk_unit, direction); |
| 592 | 592 | break; |
| 593 | 593 | } |
| 594 | 594 | } |
| r3969 | r3970 | |
| 596 | 596 | /* |
| 597 | 597 | Perform the read_id phase on a drive |
| 598 | 598 | */ |
| 599 | | INLINE int read_id(int which, select_mode_t select_mode, int disk_unit, int head, |
| 599 | INLINE int read_id(running_machine *machine,int which, select_mode_t select_mode, int disk_unit, int head, |
| 600 | 600 | int do_implied_seek, int desired_cylinder) |
| 601 | 601 | { |
| 602 | 602 | int reply; |
| r3969 | r3970 | |
| 618 | 618 | |
| 619 | 619 | case sm_floppy_slow: |
| 620 | 620 | case sm_floppy_fast: |
| 621 | | reply = floppy_read_id(which, disk_unit, head); |
| 621 | reply = floppy_read_id(machine,which, disk_unit, head); |
| 622 | 622 | break; |
| 623 | 623 | } |
| 624 | 624 | |
| r3969 | r3970 | |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | for (i=0; i<step_count; i++) |
| 671 | | step(which, select_mode, disk_unit, step_direction); |
| 671 | step(machine,which, select_mode, disk_unit, step_direction); |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | return reply; |
| r3969 | r3970 | |
| 677 | 677 | /* |
| 678 | 678 | Get the status of a drive |
| 679 | 679 | */ |
| 680 | | INLINE UINT8 get_disk_status(int which, select_mode_t select_mode, int disk_unit) |
| 680 | INLINE UINT8 get_disk_status(running_machine *machine,int which, select_mode_t select_mode, int disk_unit) |
| 681 | 681 | { |
| 682 | 682 | UINT8 reply; |
| 683 | 683 | |
| r3969 | r3970 | |
| 698 | 698 | |
| 699 | 699 | case sm_floppy_slow: |
| 700 | 700 | case sm_floppy_fast: |
| 701 | | reply = floppy_get_disk_status(which, disk_unit); |
| 701 | reply = floppy_get_disk_status(machine,which, disk_unit); |
| 702 | 702 | break; |
| 703 | 703 | |
| 704 | 704 | } |
| r3969 | r3970 | |
| 709 | 709 | /* |
| 710 | 710 | Handle the step command |
| 711 | 711 | */ |
| 712 | | static void do_step(int which, int mode) |
| 712 | static void do_step(running_machine *machine,int which, int mode) |
| 713 | 713 | { |
| 714 | 714 | select_mode_t select_mode; |
| 715 | 715 | int disk_unit = 0; |
| r3969 | r3970 | |
| 727 | 727 | goto cleanup; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | | step(which, select_mode, disk_unit, (mode & 2) ? -1 : +1); |
| 730 | step(machine,which, select_mode, disk_unit, (mode & 2) ? -1 : +1); |
| 731 | 731 | |
| 732 | 732 | cleanup: |
| 733 | 733 | /* update register state */ |
| 734 | 734 | set_command_done(which); |
| 735 | 735 | |
| 736 | 736 | /* set drive status */ |
| 737 | | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(which, select_mode, disk_unit); |
| 737 | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(machine,which, select_mode, disk_unit); |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | /* |
| 741 | 741 | Handle the restore command |
| 742 | 742 | */ |
| 743 | | static void do_restore(int which, int mode) |
| 743 | static void do_restore(running_machine *machine,int which, int mode) |
| 744 | 744 | { |
| 745 | 745 | select_mode_t select_mode; |
| 746 | 746 | int disk_unit = 0; |
| r3969 | r3970 | |
| 773 | 773 | case sm_floppy_fast: |
| 774 | 774 | seek_count = 0; |
| 775 | 775 | /* limit iterations to 2048 to prevent an endless loop if the disc is locked */ |
| 776 | | while ((seek_count < 2048) && ! (get_disk_status(which, select_mode, disk_unit) & DS_TRK00)) |
| 776 | while ((seek_count < 2048) && ! (get_disk_status(machine,which, select_mode, disk_unit) & DS_TRK00)) |
| 777 | 777 | { |
| 778 | | step(which, select_mode, disk_unit, -1); |
| 778 | step(machine,which, select_mode, disk_unit, -1); |
| 779 | 779 | seek_count++; |
| 780 | 780 | } |
| 781 | 781 | break; |
| r3969 | r3970 | |
| 786 | 786 | set_command_done(which); |
| 787 | 787 | |
| 788 | 788 | /* set drive status */ |
| 789 | | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(which, select_mode, disk_unit); |
| 789 | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(machine,which, select_mode, disk_unit); |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | /* |
| r3969 | r3970 | |
| 796 | 796 | physical_flag: if 1, read consecutive sectors, ignoring sector IDs |
| 797 | 797 | mode: extra flags (ignored) |
| 798 | 798 | */ |
| 799 | | static void do_read(int which, int physical_flag, int mode) |
| 799 | static void do_read(running_machine *machine,int which, int physical_flag, int mode) |
| 800 | 800 | { |
| 801 | 801 | select_mode_t select_mode; |
| 802 | 802 | int disk_unit = 0; |
| r3969 | r3970 | |
| 825 | 825 | goto cleanup; |
| 826 | 826 | } |
| 827 | 827 | |
| 828 | | if (! (get_disk_status(which, select_mode, disk_unit) & DS_READY)) |
| 828 | if (! (get_disk_status(machine,which, select_mode, disk_unit) & DS_READY)) |
| 829 | 829 | { |
| 830 | 830 | /* unit is not ready */ |
| 831 | 831 | hfdc[which].status |= ST_TC_RDIDERR; |
| r3969 | r3970 | |
| 837 | 837 | /* if we enable write-protect test in read operations, the ti99 HFDC DSR is |
| 838 | 838 | unable to read write-protected floppies! */ |
| 839 | 839 | if ((hfdc[which].regs[hfdc_reg_term] & TC_TWPROT) |
| 840 | | && (get_disk_status(which, select_mode, disk_unit) & DS_WRPROT)) |
| 840 | && (get_disk_status(machine,which, select_mode, disk_unit) & DS_WRPROT)) |
| 841 | 841 | { |
| 842 | 842 | /* unit is write protected */ |
| 843 | 843 | hfdc[which].status |= ST_TC_RDIDERR; /* right??? */ |
| r3969 | r3970 | |
| 845 | 845 | } |
| 846 | 846 | #endif |
| 847 | 847 | |
| 848 | | read_id(which, select_mode, disk_unit, head, ! (mode & 0x02), cylinder); |
| 848 | read_id(machine,which, select_mode, disk_unit, head, ! (mode & 0x02), cylinder); |
| 849 | 849 | |
| 850 | 850 | while (hfdc[which].regs[hfdc_reg_sector_count]) |
| 851 | 851 | { |
| r3969 | r3970 | |
| 867 | 867 | |
| 868 | 868 | case sm_floppy_slow: |
| 869 | 869 | case sm_floppy_fast: |
| 870 | | if (! smc92x4_floppy_read_sector(which, disk_unit, cylinder, head, 1, sector, &dma_address)) |
| 870 | if (! smc92x4_floppy_read_sector(machine,which, disk_unit, cylinder, head, 1, sector, &dma_address)) |
| 871 | 871 | goto cleanup; |
| 872 | 872 | break; |
| 873 | 873 | } |
| r3969 | r3970 | |
| 898 | 898 | hfdc[which].regs[hfdc_reg_des_sector] = sector; |
| 899 | 899 | |
| 900 | 900 | /* set drive status */ |
| 901 | | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(which, select_mode, disk_unit); |
| 901 | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(machine,which, select_mode, disk_unit); |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | /* |
| r3969 | r3970 | |
| 908 | 908 | physical_flag: if 1, ignore CRC/ECC bytes??? (ignored) |
| 909 | 909 | mode: extra flags (ignored) |
| 910 | 910 | */ |
| 911 | | static void do_write(int which, int physical_flag, int mode) |
| 911 | static void do_write(running_machine *machine,int which, int physical_flag, int mode) |
| 912 | 912 | { |
| 913 | 913 | select_mode_t select_mode; |
| 914 | 914 | int disk_unit = 0; |
| r3969 | r3970 | |
| 937 | 937 | goto cleanup; |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | | if (! (get_disk_status(which, select_mode, disk_unit) & DS_READY)) |
| 940 | if (! (get_disk_status(machine,which, select_mode, disk_unit) & DS_READY)) |
| 941 | 941 | { |
| 942 | 942 | /* unit is not ready */ |
| 943 | 943 | hfdc[which].status |= ST_TC_RDIDERR; |
| r3969 | r3970 | |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | if ((hfdc[which].regs[hfdc_reg_term] & TC_TWPROT) |
| 949 | | && (get_disk_status(which, select_mode, disk_unit) & DS_WRPROT)) |
| 949 | && (get_disk_status(machine,which, select_mode, disk_unit) & DS_WRPROT)) |
| 950 | 950 | { |
| 951 | 951 | /* unit is write protected */ |
| 952 | 952 | hfdc[which].status |= ST_TC_RDIDERR; /* right??? */ |
| r3969 | r3970 | |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | |
| 957 | | read_id(which, select_mode, disk_unit, head, ! (mode & 0x40), cylinder); |
| 957 | read_id(machine,which, select_mode, disk_unit, head, ! (mode & 0x40), cylinder); |
| 958 | 958 | |
| 959 | 959 | while (hfdc[which].regs[hfdc_reg_sector_count]) |
| 960 | 960 | { |
| r3969 | r3970 | |
| 976 | 976 | |
| 977 | 977 | case sm_floppy_slow: |
| 978 | 978 | case sm_floppy_fast: |
| 979 | | if (!smc92x4_floppy_write_sector(which, disk_unit, cylinder, head, 1, sector, &dma_address)) |
| 979 | if (!smc92x4_floppy_write_sector(machine,which, disk_unit, cylinder, head, 1, sector, &dma_address)) |
| 980 | 980 | goto cleanup; |
| 981 | 981 | break; |
| 982 | 982 | } |
| r3969 | r3970 | |
| 1007 | 1007 | hfdc[which].regs[hfdc_reg_des_sector] = sector; |
| 1008 | 1008 | |
| 1009 | 1009 | /* set drive status */ |
| 1010 | | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(which, select_mode, disk_unit); |
| 1010 | hfdc[which].regs[hfdc_reg_drive_stat] = get_disk_status(machine,which, select_mode, disk_unit); |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | /* |
| 1014 | 1014 | Process a command |
| 1015 | 1015 | */ |
| 1016 | | static void smc92x4_process_command(int which, int opcode) |
| 1016 | static void smc92x4_process_command(running_machine *machine,int which, int opcode) |
| 1017 | 1017 | { |
| 1018 | 1018 | if (opcode < 0x80) |
| 1019 | 1019 | { |
| r3969 | r3970 | |
| 1043 | 1043 | /* bit 0: 0 -> command ends after last seek pulse, 1 -> command |
| 1044 | 1044 | ends when the drive asserts the seek complete pin */ |
| 1045 | 1045 | logerror("smc92x4 restore command %X\n", opcode & 0x01); |
| 1046 | | do_restore(which, opcode & 0x01); |
| 1046 | do_restore(machine,which, opcode & 0x01); |
| 1047 | 1047 | break; |
| 1048 | 1048 | } |
| 1049 | 1049 | } |
| r3969 | r3970 | |
| 1054 | 1054 | /* bit 0: 0 -> command ends after last seek pulse, 1 -> command |
| 1055 | 1055 | ends when the drive asserts the seek complete pin */ |
| 1056 | 1056 | logerror("smc92x4 step command %X\n", opcode & 0x3); |
| 1057 | | do_step(which, opcode & 0x03); |
| 1057 | do_step(machine,which, opcode & 0x03); |
| 1058 | 1058 | } |
| 1059 | 1059 | else |
| 1060 | 1060 | { |
| r3969 | r3970 | |
| 1107 | 1107 | { |
| 1108 | 1108 | case 0: |
| 1109 | 1109 | logerror("smc92x4 read physical command %X\n", opcode & 0x1); |
| 1110 | | do_read(which, 1, opcode & 0x3); |
| 1110 | do_read(machine,which, 1, opcode & 0x3); |
| 1111 | 1111 | break; |
| 1112 | 1112 | case 1: |
| 1113 | 1113 | logerror("smc92x4 read track command %X\n", opcode & 0x1); |
| r3969 | r3970 | |
| 1115 | 1115 | case 2: |
| 1116 | 1116 | case 3: |
| 1117 | 1117 | logerror("smc92x4 read logical command %X\n", opcode & 0x3); |
| 1118 | | do_read(which, 0, opcode & 0x3); |
| 1118 | do_read(machine,which, 0, opcode & 0x3); |
| 1119 | 1119 | break; |
| 1120 | 1120 | } |
| 1121 | 1121 | } |
| r3969 | r3970 | |
| 1144 | 1144 | { |
| 1145 | 1145 | case 0: |
| 1146 | 1146 | logerror("smc92x4 write physical command %X\n", opcode & 0x7f); |
| 1147 | | do_write(which, 1, opcode & 0x7f); |
| 1147 | do_write(machine,which, 1, opcode & 0x7f); |
| 1148 | 1148 | break; |
| 1149 | 1149 | case 1: |
| 1150 | 1150 | logerror("smc92x4 write logical command %X\n", opcode & 0x7f); |
| 1151 | | do_write(which, 0, opcode & 0x7f); |
| 1151 | do_write(machine,which, 0, opcode & 0x7f); |
| 1152 | 1152 | break; |
| 1153 | 1153 | case 2: |
| 1154 | 1154 | logerror("smc92x4 write physical command??? %X\n", opcode & 0x7f); |
| 1155 | | do_write(which, 1, opcode & 0x7f); |
| 1155 | do_write(machine,which, 1, opcode & 0x7f); |
| 1156 | 1156 | break; |
| 1157 | 1157 | case 3: |
| 1158 | 1158 | logerror("smc92x4 write logical command??? %X\n", opcode & 0x7f); |
| 1159 | | do_write(which, 0, opcode & 0x7f); |
| 1159 | do_write(machine,which, 0, opcode & 0x7f); |
| 1160 | 1160 | break; |
| 1161 | 1161 | } |
| 1162 | 1162 | } |
| r3969 | r3970 | |
| 1169 | 1169 | /* |
| 1170 | 1170 | Read a byte of data from a smc99x4 controller |
| 1171 | 1171 | */ |
| 1172 | | int smc92x4_r(int which, int offset) |
| 1172 | int smc92x4_r(running_machine *machine,int which, int offset) |
| 1173 | 1173 | { |
| 1174 | 1174 | int reply = 0; |
| 1175 | 1175 | |
| r3969 | r3970 | |
| 1208 | 1208 | /* |
| 1209 | 1209 | Write a byte to a smc99x4 controller |
| 1210 | 1210 | */ |
| 1211 | | void smc92x4_w(int which, int offset, int data) |
| 1211 | void smc92x4_w(running_machine *machine,int which, int offset, int data) |
| 1212 | 1212 | { |
| 1213 | 1213 | data &= 0xff; |
| 1214 | 1214 | |
| r3969 | r3970 | |
| 1235 | 1235 | |
| 1236 | 1236 | case 1: |
| 1237 | 1237 | /* command register */ |
| 1238 | | smc92x4_process_command(which, data); |
| 1238 | smc92x4_process_command(machine,which, data); |
| 1239 | 1239 | break; |
| 1240 | 1240 | } |
| 1241 | 1241 | } |
| 1242 | 1242 | |
| 1243 | 1243 | READ8_HANDLER(smc92x4_0_r) |
| 1244 | 1244 | { |
| 1245 | | return smc92x4_r(0, offset); |
| 1245 | return smc92x4_r(space->machine,0, offset); |
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | WRITE8_HANDLER(smc92x4_0_w) |
| 1249 | 1249 | { |
| 1250 | | smc92x4_w(0, offset, data); |
| 1250 | smc92x4_w(space->machine,0, offset, data); |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | 1253 | static const struct harddisk_callback_config smc92x4_harddisk_config = |
src/mess/devices/thomflop.c
| r3969 | r3970 | |
| 987 | 987 | |
| 988 | 988 | |
| 989 | 989 | |
| 990 | | static int thmfc_floppy_find_sector ( chrn_id* dst ) |
| 990 | static int thmfc_floppy_find_sector ( running_machine *machine,chrn_id* dst ) |
| 991 | 991 | { |
| 992 | | const device_config* img = thmfc_floppy_image(); |
| 992 | const device_config* img = thmfc_floppy_image(machine); |
| 993 | 993 | chrn_id id; |
| 994 | 994 | int r = 0; |
| 995 | 995 | |
| r3969 | r3970 | |
| 1033 | 1033 | if ( thmfc1->op == THMFC1_OP_WRITE_SECT ) |
| 1034 | 1034 | { |
| 1035 | 1035 | /* TODO: detect ddam (?) */ |
| 1036 | | const device_config * img = thmfc_floppy_image(); |
| 1036 | const device_config * img = thmfc_floppy_image(machine); |
| 1037 | 1037 | floppy_drive_write_sector_data( img, thmfc1->side, thmfc1->sector, thmfc1->data + 3, thmfc1->data_size - 3, 0 ); |
| 1038 | 1038 | } |
| 1039 | 1039 | thmfc1->op = THMFC1_OP_RESET; |
| r3969 | r3970 | |
| 1085 | 1085 | { |
| 1086 | 1086 | if ( thmfc_floppy_is_qdd() ) |
| 1087 | 1087 | /* QDD: track = whole disk */ |
| 1088 | | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); |
| 1088 | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(machine), thmfc1->data ); |
| 1089 | 1089 | else |
| 1090 | 1090 | { |
| 1091 | 1091 | thmfc1->data_raw_idx = 0; |
| 1092 | | thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(), thmfc1->data, |
| 1092 | thmfc1->data_raw_size = thom_floppy_make_track( thmfc_floppy_image(machine), thmfc1->data, |
| 1093 | 1093 | thmfc1->sector_size, thmfc1->side ); |
| 1094 | 1094 | } |
| 1095 | 1095 | assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); |
| r3969 | r3970 | |
| 1123 | 1123 | |
| 1124 | 1124 | if ( ! thmfc1->data_raw_size ) |
| 1125 | 1125 | { |
| 1126 | | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); |
| 1126 | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(machine), thmfc1->data ); |
| 1127 | 1127 | assert( thmfc1->data_raw_size < sizeof( thmfc1->data ) ); |
| 1128 | 1128 | } |
| 1129 | 1129 | |
| r3969 | r3970 | |
| 1153 | 1153 | |
| 1154 | 1154 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector )); |
| 1155 | 1155 | |
| 1156 | | floppy_drive_format_sector( thmfc_floppy_image(), 0, sector, 0, 0, sector, 128, filler ); |
| 1156 | floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler ); |
| 1157 | 1157 | thmfc1->data_idx = 0; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| r3969 | r3970 | |
| 1175 | 1175 | if ( i >= 0 ) |
| 1176 | 1176 | { |
| 1177 | 1177 | /* got an id & a data field => write */ |
| 1178 | | const device_config * img = thmfc_floppy_image(); |
| 1178 | const device_config * img = thmfc_floppy_image(machine); |
| 1179 | 1179 | int sector = (int) thmfc1->data[ i + 1 ] * 256 + |
| 1180 | 1180 | (int) thmfc1->data[ i + 2 ]; |
| 1181 | 1181 | |
| r3969 | r3970 | |
| 1235 | 1235 | if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) ) |
| 1236 | 1236 | { |
| 1237 | 1237 | /* got id field => format */ |
| 1238 | | const device_config * img = thmfc_floppy_image(); |
| 1238 | const device_config * img = thmfc_floppy_image(machine); |
| 1239 | 1239 | UINT8 track = thmfc1->data[4]; |
| 1240 | 1240 | UINT8 side = thmfc1->data[5]; |
| 1241 | 1241 | UINT8 sector = thmfc1->data[6]; |
| r3969 | r3970 | |
| 1265 | 1265 | case 1: /* STAT1 */ |
| 1266 | 1266 | { |
| 1267 | 1267 | UINT8 data = 0; |
| 1268 | | const device_config * img = thmfc_floppy_image(); |
| 1268 | const device_config * img = thmfc_floppy_image(space->machine); |
| 1269 | 1269 | int flags = floppy_drive_get_flag_state( img, -1 ); |
| 1270 | 1270 | if ( thmfc_floppy_is_qdd() ) |
| 1271 | 1271 | { |
| r3969 | r3970 | |
| 1352 | 1352 | case THMFC1_OP_WRITE_SECT: |
| 1353 | 1353 | if ( qdd ) |
| 1354 | 1354 | logerror( "thmfc_floppy_w: smart operation 1 not supported for QDD\n" ); |
| 1355 | | else if ( thmfc_floppy_find_sector( NULL ) ) |
| 1355 | else if ( thmfc_floppy_find_sector( space->machine, NULL ) ) |
| 1356 | 1356 | { |
| 1357 | 1357 | thmfc1->data_idx = 0; |
| 1358 | 1358 | thmfc1->data_size = thmfc1->sector_size + 3; /* A1 A1 FB <data> */ |
| r3969 | r3970 | |
| 1366 | 1366 | case THMFC1_OP_READ_ADDR: |
| 1367 | 1367 | if ( qdd ) |
| 1368 | 1368 | logerror( "thmfc_floppy_w: smart operation 2 not supported for QDD\n" ); |
| 1369 | | else if ( thmfc_floppy_find_sector( &id ) ) |
| 1369 | else if ( thmfc_floppy_find_sector( space->machine, &id ) ) |
| 1370 | 1370 | { |
| 1371 | 1371 | thmfc1->data_size = |
| 1372 | 1372 | thom_floppy_make_addr( id, thmfc1->data, thmfc1->sector_size ); |
| r3969 | r3970 | |
| 1382 | 1382 | case THMFC1_OP_READ_SECT: |
| 1383 | 1383 | if ( qdd ) |
| 1384 | 1384 | logerror( "thmfc_floppy_w: smart operation 3 not supported for QDD\n" ); |
| 1385 | | else if ( thmfc_floppy_find_sector( &id ) ) |
| 1385 | else if ( thmfc_floppy_find_sector( space->machine, &id ) ) |
| 1386 | 1386 | { |
| 1387 | 1387 | thmfc1->data_size = thom_floppy_make_sector |
| 1388 | | ( thmfc_floppy_image(), id, thmfc1->data, thmfc1->sector_size ); |
| 1388 | ( thmfc_floppy_image(space->machine), id, thmfc1->data, thmfc1->sector_size ); |
| 1389 | 1389 | assert( thmfc1->data_size < sizeof( thmfc1->data ) ); |
| 1390 | 1390 | thmfc1->data_finish = thmfc1->sector_size + 4; |
| 1391 | 1391 | thmfc1->data_idx = 1; |
| r3969 | r3970 | |
| 1399 | 1399 | /* synchronize to word, if needed (QDD only) */ |
| 1400 | 1400 | if ( wsync && qdd ) { |
| 1401 | 1401 | if ( ! thmfc1->data_raw_size ) |
| 1402 | | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data ); |
| 1402 | thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(space->machine), thmfc1->data ); |
| 1403 | 1403 | while ( thmfc1->data_raw_idx < thmfc1->data_raw_size && |
| 1404 | 1404 | thmfc1->data[ thmfc1->data_raw_idx ] != thmfc1->wsync ) |
| 1405 | 1405 | { |
| r3969 | r3970 | |
| 1447 | 1447 | thmfc1->drive |= 1 ^ ((data >> 6) & 1); |
| 1448 | 1448 | } |
| 1449 | 1449 | |
| 1450 | | img = thmfc_floppy_image(); |
| 1450 | img = thmfc_floppy_image(space->machine); |
| 1451 | 1451 | thom_floppy_active( space->machine, 0 ); |
| 1452 | 1452 | |
| 1453 | 1453 | LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", |
| r3969 | r3970 | |
| 1503 | 1503 | thmfc1->track = data; |
| 1504 | 1504 | LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", |
| 1505 | 1505 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 1506 | | floppy_drive_get_current_track( thmfc_floppy_image() ) )); |
| 1506 | floppy_drive_get_current_track( thmfc_floppy_image(space->machine) ) )); |
| 1507 | 1507 | break; |
| 1508 | 1508 | |
| 1509 | 1509 | case 7: /* WCELL */ |