trunk/src/lib/formats/imd_dsk.c
| r18982 | r18983 | |
| 475 | 475 | int cpos; |
| 476 | 476 | UINT16 crc; |
| 477 | 477 | // sync and IDAM and gap 2 |
| 478 | | for(int j=0; j< 6; j++) fm_w(track_data, tpos, 8, 0xff); |
| 478 | for(int j=0; j< 6; j++) fm_w(track_data, tpos, 8, 0x00); |
| 479 | 479 | cpos = tpos; |
| 480 | | raw_w(track_data, tpos, 8, 0xf57e); |
| 480 | raw_w(track_data, tpos, 16, 0xf57e); |
| 481 | 481 | fm_w (track_data, tpos, 8, tnum ? tnum[i] : track); |
| 482 | 482 | fm_w (track_data, tpos, 8, hnum ? hnum[i] : head); |
| 483 | 483 | fm_w (track_data, tpos, 8, snum[i]); |
| r18982 | r18983 | |
| 491 | 491 | |
| 492 | 492 | else { |
| 493 | 493 | // sync, DAM, data and gap 3 |
| 494 | | for(int j=0; j< 6; j++) fm_w(track_data, tpos, 8, 0xff); |
| 494 | for(int j=0; j< 6; j++) fm_w(track_data, tpos, 8, 0x00); |
| 495 | 495 | cpos = tpos; |
| 496 | | raw_w(track_data, tpos, 8, stype == 3 || stype == 4 || stype == 7 || stype == 8 ? 0xf56a : 0xf56f); |
| 496 | raw_w(track_data, tpos, 16, stype == 3 || stype == 4 || stype == 7 || stype == 8 ? 0xf56a : 0xf56f); |
| 497 | 497 | if(stype == 2 || stype == 4 || stype == 6 || stype == 8) { |
| 498 | 498 | for(int j=0; j<size; j++) fm_w(track_data, tpos, 8, img[pos]); |
| 499 | 499 | pos++; |
trunk/src/emu/imagedev/floppy.c
| r18982 | r18983 | |
| 23 | 23 | const device_type FLOPPY_525_QD = &device_creator<floppy_525_qd>; |
| 24 | 24 | const device_type FLOPPY_525_HD = &device_creator<floppy_525_hd>; |
| 25 | 25 | const device_type FLOPPY_8_SSSD = &device_creator<floppy_8_sssd>; |
| 26 | const device_type FLOPPY_8_DSDD = &device_creator<floppy_8_dsdd>; |
| 26 | 27 | |
| 27 | 28 | floppy_connector::floppy_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 28 | 29 | device_t(mconfig, FLOPPY_CONNECTOR, "Floppy drive connector abstraction", tag, owner, clock), |
| r18982 | r18983 | |
| 174 | 175 | void floppy_image_device::device_start() |
| 175 | 176 | { |
| 176 | 177 | rpm = 0; |
| 178 | motor_always_on = false; |
| 177 | 179 | setup_characteristics(); |
| 178 | 180 | |
| 179 | 181 | idx = 0; |
| r18982 | r18983 | |
| 194 | 196 | revolution_start_time = attotime::never; |
| 195 | 197 | revolution_count = 0; |
| 196 | 198 | mon = 1; |
| 199 | if(motor_always_on) |
| 200 | mon_w(0); |
| 197 | 201 | } |
| 198 | 202 | |
| 199 | 203 | void floppy_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| r18982 | r18983 | |
| 1032 | 1036 | form_factor = floppy_image::FF_8; |
| 1033 | 1037 | tracks = 77; |
| 1034 | 1038 | sides = 1; |
| 1035 | | set_rpm(300); |
| 1039 | motor_always_on = true; |
| 1040 | set_rpm(360); |
| 1036 | 1041 | } |
| 1037 | 1042 | |
| 1038 | 1043 | void floppy_8_sssd::handled_variants(UINT32 *variants, int &var_count) const |
| r18982 | r18983 | |
| 1040 | 1045 | var_count = 0; |
| 1041 | 1046 | variants[var_count++] = floppy_image::SSSD; |
| 1042 | 1047 | } |
| 1048 | |
| 1049 | floppy_8_dsdd::floppy_8_dsdd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 1050 | floppy_image_device(mconfig, FLOPPY_8_DSDD, "8\" double density double sided floppy drive", tag, owner, clock) |
| 1051 | { |
| 1052 | } |
| 1053 | |
| 1054 | floppy_8_dsdd::~floppy_8_dsdd() |
| 1055 | { |
| 1056 | } |
| 1057 | |
| 1058 | void floppy_8_dsdd::setup_characteristics() |
| 1059 | { |
| 1060 | form_factor = floppy_image::FF_8; |
| 1061 | tracks = 77; |
| 1062 | sides = 2; |
| 1063 | motor_always_on = true; |
| 1064 | set_rpm(360); |
| 1065 | } |
| 1066 | |
| 1067 | void floppy_8_dsdd::handled_variants(UINT32 *variants, int &var_count) const |
| 1068 | { |
| 1069 | var_count = 0; |
| 1070 | variants[var_count++] = floppy_image::SSSD; |
| 1071 | variants[var_count++] = floppy_image::SSDD; |
| 1072 | variants[var_count++] = floppy_image::DSDD; |
| 1073 | } |
trunk/src/emu/imagedev/floppy.h
| r18982 | r18983 | |
| 110 | 110 | int tracks; /* addressable tracks */ |
| 111 | 111 | int sides; /* number of heads */ |
| 112 | 112 | UINT32 form_factor; /* 3"5, 5"25, etc */ |
| 113 | bool motor_always_on; |
| 113 | 114 | |
| 114 | 115 | /* state of input lines */ |
| 115 | 116 | int dir; /* direction */ |
| r18982 | r18983 | |
| 282 | 283 | virtual void setup_characteristics(); |
| 283 | 284 | }; |
| 284 | 285 | |
| 286 | class floppy_8_dsdd : public floppy_image_device { |
| 287 | public: |
| 288 | floppy_8_dsdd(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 289 | virtual ~floppy_8_dsdd(); |
| 290 | virtual void handled_variants(UINT32 *variants, int &var_count) const; |
| 291 | virtual void device_config_complete() { m_shortname = "floppy_8_dsdd"; } |
| 292 | virtual const char *image_interface() const { return "floppy_8"; } |
| 293 | protected: |
| 294 | virtual void setup_characteristics(); |
| 295 | }; |
| 296 | |
| 285 | 297 | class floppy_connector: public device_t, |
| 286 | 298 | public device_slot_interface |
| 287 | 299 | { |
| r18982 | r18983 | |
| 314 | 326 | extern const device_type FLOPPY_525_QD; |
| 315 | 327 | extern const device_type FLOPPY_525_HD; |
| 316 | 328 | extern const device_type FLOPPY_8_SSSD; |
| 329 | extern const device_type FLOPPY_8_DSDD; |
| 317 | 330 | |
| 318 | 331 | #endif /* FLOPPY_H */ |
trunk/src/mess/machine/upd765.c
| r18982 | r18983 | |
| 195 | 195 | bool upd765_family_device::get_ready(int fid) |
| 196 | 196 | { |
| 197 | 197 | if(ready_connected) |
| 198 | | return flopi[fid].dev ? flopi[fid].dev->ready_r() : false; |
| 198 | return flopi[fid].dev ? !flopi[fid].dev->ready_r() : false; |
| 199 | 199 | return external_ready; |
| 200 | 200 | } |
| 201 | 201 | |
| r18982 | r18983 | |
| 438 | 438 | void upd765_family_device::fifo_push(UINT8 data, bool internal) |
| 439 | 439 | { |
| 440 | 440 | if(fifo_pos == 16) { |
| 441 | | if(internal) |
| 441 | if(internal) { |
| 442 | if(!(st1 & ST1_OR)) |
| 443 | logerror("%s: Fifo overrun\n", tag()); |
| 442 | 444 | st1 |= ST1_OR; |
| 445 | } |
| 443 | 446 | return; |
| 444 | 447 | } |
| 445 | 448 | fifo[fifo_pos++] = data; |
| r18982 | r18983 | |
| 456 | 459 | UINT8 upd765_family_device::fifo_pop(bool internal) |
| 457 | 460 | { |
| 458 | 461 | if(!fifo_pos) { |
| 459 | | if(internal) |
| 462 | if(internal) { |
| 463 | if(!(st1 & ST1_OR)) |
| 464 | logerror("%s: Fifo underrun\n", tag()); |
| 460 | 465 | st1 |= ST1_OR; |
| 466 | } |
| 461 | 467 | return 0; |
| 462 | 468 | } |
| 463 | 469 | UINT8 r = fifo[0]; |
| r18982 | r18983 | |
| 668 | 674 | break; |
| 669 | 675 | } |
| 670 | 676 | |
| 677 | case SEARCH_ADDRESS_MARK_HEADER_FM: |
| 678 | if(read_one_bit(limit)) |
| 679 | return; |
| 680 | #if 0 |
| 681 | fprintf(stderr, "%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, |
| 682 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 683 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 684 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| 685 | (cur_live.shift_reg & 0x0100 ? 0x10 : 0x00) | |
| 686 | (cur_live.shift_reg & 0x0040 ? 0x08 : 0x00) | |
| 687 | (cur_live.shift_reg & 0x0010 ? 0x04 : 0x00) | |
| 688 | (cur_live.shift_reg & 0x0004 ? 0x02 : 0x00) | |
| 689 | (cur_live.shift_reg & 0x0001 ? 0x01 : 0x00), |
| 690 | cur_live.bit_counter); |
| 691 | #endif |
| 692 | |
| 693 | if(cur_live.shift_reg == 0xf57e) { |
| 694 | cur_live.crc = 0xef21; |
| 695 | cur_live.data_separator_phase = false; |
| 696 | cur_live.bit_counter = 0; |
| 697 | cur_live.state = READ_ID_BLOCK; |
| 698 | } |
| 699 | break; |
| 700 | |
| 671 | 701 | case READ_ID_BLOCK: { |
| 672 | 702 | if(read_one_bit(limit)) |
| 673 | 703 | return; |
| r18982 | r18983 | |
| 757 | 787 | cur_live.state = IDLE; |
| 758 | 788 | return; |
| 759 | 789 | |
| 790 | case SEARCH_ADDRESS_MARK_DATA_FM: |
| 791 | if(read_one_bit(limit)) |
| 792 | return; |
| 793 | #if 0 |
| 794 | fprintf(stderr, "%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm).cstr(), cur_live.shift_reg, |
| 795 | (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | |
| 796 | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | |
| 797 | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | |
| 798 | (cur_live.shift_reg & 0x0100 ? 0x10 : 0x00) | |
| 799 | (cur_live.shift_reg & 0x0040 ? 0x08 : 0x00) | |
| 800 | (cur_live.shift_reg & 0x0010 ? 0x04 : 0x00) | |
| 801 | (cur_live.shift_reg & 0x0004 ? 0x02 : 0x00) | |
| 802 | (cur_live.shift_reg & 0x0001 ? 0x01 : 0x00), |
| 803 | cur_live.bit_counter >> 4, cur_live.bit_counter & 15); |
| 804 | #endif |
| 805 | if(cur_live.bit_counter > 23*16) { |
| 806 | live_delay(SEARCH_ADDRESS_MARK_DATA_FAILED); |
| 807 | return; |
| 808 | } |
| 809 | |
| 810 | if(cur_live.bit_counter >= 11*16 && (cur_live.shift_reg == 0xf56a || cur_live.shift_reg == 0xf56f)) { |
| 811 | cur_live.crc = cur_live.shift_reg == 0xf56a ? 0x8fe7 : 0xbf84; |
| 812 | cur_live.data_separator_phase = false; |
| 813 | cur_live.bit_counter = 0; |
| 814 | cur_live.state = READ_SECTOR_DATA; |
| 815 | } |
| 816 | break; |
| 817 | |
| 760 | 818 | case READ_SECTOR_DATA: { |
| 761 | 819 | if(read_one_bit(limit)) |
| 762 | 820 | return; |
| r18982 | r18983 | |
| 1331 | 1389 | case SEEK_DONE: |
| 1332 | 1390 | fi.counter = 0; |
| 1333 | 1391 | fi.sub_state = SCAN_ID; |
| 1334 | | live_start(fi, SEARCH_ADDRESS_MARK_HEADER); |
| 1392 | live_start(fi, command[0] & 0x40 ? SEARCH_ADDRESS_MARK_HEADER : SEARCH_ADDRESS_MARK_HEADER_FM); |
| 1335 | 1393 | return; |
| 1336 | 1394 | |
| 1337 | 1395 | case SCAN_ID: |
| r18982 | r18983 | |
| 1364 | 1422 | sector_size = calc_sector_size(cur_live.idbuf[3]); |
| 1365 | 1423 | fifo_expect(sector_size, false); |
| 1366 | 1424 | fi.sub_state = SECTOR_READ; |
| 1367 | | live_start(fi, SEARCH_ADDRESS_MARK_DATA); |
| 1425 | live_start(fi, command[0] & 0x40 ? SEARCH_ADDRESS_MARK_DATA : SEARCH_ADDRESS_MARK_DATA_FM); |
| 1368 | 1426 | return; |
| 1369 | 1427 | |
| 1370 | 1428 | case SCAN_ID_FAILED: |
| r18982 | r18983 | |
| 2019 | 2077 | // logerror("write %02x %04x %04x\n", mfm, cur_live.crc, raw); |
| 2020 | 2078 | } |
| 2021 | 2079 | |
| 2080 | void upd765_family_device::live_write_fm(UINT8 fm) |
| 2081 | { |
| 2082 | bool context = cur_live.data_bit_context; |
| 2083 | UINT16 raw = 0; |
| 2084 | for(int i=0; i<8; i++) { |
| 2085 | bool bit = fm & (0x80 >> i); |
| 2086 | raw |= 0x8000 >> (2*i); |
| 2087 | if(bit) |
| 2088 | raw |= 0x4000 >> (2*i); |
| 2089 | context = bit; |
| 2090 | } |
| 2091 | cur_live.data_reg = fm; |
| 2092 | cur_live.shift_reg = raw; |
| 2093 | cur_live.data_bit_context = context; |
| 2094 | // logerror("write %02x %04x %04x\n", fm, cur_live.crc, raw); |
| 2095 | } |
| 2096 | |
| 2022 | 2097 | bool upd765_family_device::sector_matches() const |
| 2023 | 2098 | { |
| 2024 | 2099 | return |
trunk/src/mess/drivers/apc.c
| r18982 | r18983 | |
| 613 | 613 | }; |
| 614 | 614 | |
| 615 | 615 | static SLOT_INTERFACE_START( apc_floppies ) |
| 616 | | SLOT_INTERFACE( "8sd", FLOPPY_8_SSSD ) // TODO: Ok? |
| 616 | SLOT_INTERFACE( "8", FLOPPY_8_DSDD ) |
| 617 | 617 | SLOT_INTERFACE_END |
| 618 | 618 | |
| 619 | 619 | PALETTE_INIT_MEMBER(apc_state,apc) |
| r18982 | r18983 | |
| 641 | 641 | MCFG_I8237_ADD("8237dma", MAIN_CLOCK, dma8237_config) |
| 642 | 642 | |
| 643 | 643 | MCFG_UPD765A_ADD("upd765", true, true) |
| 644 | | MCFG_FLOPPY_DRIVE_ADD("upd765:0", apc_floppies, "8sd", 0, apc_floppy_formats) |
| 645 | | MCFG_FLOPPY_DRIVE_ADD("upd765:1", apc_floppies, "8sd", 0, apc_floppy_formats) |
| 644 | MCFG_FLOPPY_DRIVE_ADD("upd765:0", apc_floppies, "8", 0, apc_floppy_formats) |
| 645 | MCFG_FLOPPY_DRIVE_ADD("upd765:1", apc_floppies, "8", 0, apc_floppy_formats) |
| 646 | 646 | |
| 647 | 647 | /* video hardware */ |
| 648 | 648 | MCFG_SCREEN_ADD("screen", RASTER) |