src/emu/machine/6522via.c
| r6626 | r6627 | |
| 263 | 263 | /* Default clock is from CPU1 */ |
| 264 | 264 | if (device->clock == 0) |
| 265 | 265 | device_set_clock(device, device->machine->firstcpu->clock); |
| 266 | |
| 267 | /* save state register */ |
| 268 | state_save_register_device_item(device, 0, v->in_a); |
| 269 | state_save_register_device_item(device, 0, v->in_ca1); |
| 270 | state_save_register_device_item(device, 0, v->in_ca2); |
| 271 | state_save_register_device_item(device, 0, v->out_a); |
| 272 | state_save_register_device_item(device, 0, v->out_ca2); |
| 273 | state_save_register_device_item(device, 0, v->ddr_a); |
| 274 | state_save_register_device_item(device, 0, v->in_b); |
| 275 | state_save_register_device_item(device, 0, v->in_cb1); |
| 276 | state_save_register_device_item(device, 0, v->in_cb2); |
| 277 | state_save_register_device_item(device, 0, v->out_b); |
| 278 | state_save_register_device_item(device, 0, v->out_cb2); |
| 279 | state_save_register_device_item(device, 0, v->ddr_b); |
| 280 | state_save_register_device_item(device, 0, v->t1cl); |
| 281 | state_save_register_device_item(device, 0, v->t1ch); |
| 282 | state_save_register_device_item(device, 0, v->t1ll); |
| 283 | state_save_register_device_item(device, 0, v->t1lh); |
| 284 | state_save_register_device_item(device, 0, v->t2cl); |
| 285 | state_save_register_device_item(device, 0, v->t2ch); |
| 286 | state_save_register_device_item(device, 0, v->t2ll); |
| 287 | state_save_register_device_item(device, 0, v->t2lh); |
| 288 | state_save_register_device_item(device, 0, v->sr); |
| 289 | state_save_register_device_item(device, 0, v->pcr); |
| 290 | state_save_register_device_item(device, 0, v->acr); |
| 291 | state_save_register_device_item(device, 0, v->ier); |
| 292 | state_save_register_device_item(device, 0, v->ifr); |
| 293 | state_save_register_device_item(device, 0, v->t1_active); |
| 294 | state_save_register_device_item(device, 0, v->t2_active); |
| 295 | state_save_register_device_item(device, 0, v->shift_counter); |
| 266 | 296 | } |
| 267 | 297 | |
| 268 | 298 | |
src/mess/machine/c1541.c
| r6626 | r6627 | |
| 118 | 118 | |
| 119 | 119 | TODO: |
| 120 | 120 | |
| 121 | | - read data fails |
| 122 | | - detect sync from 10 consecutive 1-bits |
| 123 | | - get track length from image |
| 121 | - job flag never gets cleared |
| 124 | 122 | - activity led |
| 125 | 123 | - write G64 |
| 126 | 124 | - D64 to G64 conversion |
| r6626 | r6627 | |
| 154 | 152 | XTAL_16MHz/13.0, XTAL_16MHz/14.0, XTAL_16MHz/15.0, XTAL_16MHz/16.0 |
| 155 | 153 | }; |
| 156 | 154 | |
| 155 | #define SYNC_MARK 0x3ff |
| 156 | |
| 157 | 157 | /*************************************************************************** |
| 158 | 158 | TYPE DEFINITIONS |
| 159 | 159 | ***************************************************************************/ |
| r6626 | r6627 | |
| 165 | 165 | int address; /* serial bus address - 8 */ |
| 166 | 166 | UINT8 track_buffer[8192]; /* track data buffer */ |
| 167 | 167 | int track_len; /* track length */ |
| 168 | | int track : 1; /* current position of the actuator (half track) */ |
| 169 | 168 | int buffer_pos; /* current byte position within track buffer */ |
| 170 | 169 | int bit_pos; /* current bit position within track buffer byte */ |
| 170 | int bit_count; /* */ |
| 171 | UINT16 data; |
| 171 | 172 | |
| 172 | 173 | /* signals */ |
| 173 | 174 | UINT8 yb; /* GCR data byte */ |
| r6626 | r6627 | |
| 177 | 178 | int stp; /* stepping motor */ |
| 178 | 179 | int soe; /* s? output enable */ |
| 179 | 180 | int mode; /* mode (0 = write, 1 = read) */ |
| 180 | | int sync; |
| 181 | 181 | |
| 182 | 182 | /* serial bus */ |
| 183 | 183 | int data_out; /* serial bus data output */ |
| r6626 | r6627 | |
| 226 | 226 | c1541_t *c1541 = get_safe_token(device); |
| 227 | 227 | int byte = 0; |
| 228 | 228 | |
| 229 | | if (c1541->bit_pos == 0x07) |
| 229 | /* shift in data from the read head */ |
| 230 | c1541->data <<= 1; |
| 231 | c1541->data |= BIT(c1541->track_buffer[c1541->buffer_pos], c1541->bit_pos); |
| 232 | c1541->bit_pos--; |
| 233 | c1541->bit_count++; |
| 234 | |
| 235 | if (c1541->bit_pos < 0) |
| 230 | 236 | { |
| 231 | | UINT8 data = c1541->track_buffer[c1541->buffer_pos]; |
| 232 | | |
| 233 | | if (data != 0xff) |
| 234 | | { |
| 235 | | c1541->yb = data; |
| 236 | | byte = 1; |
| 237 | | } |
| 238 | | |
| 239 | | c1541->sync = !(c1541->mode && (data == 0xff)); |
| 240 | | |
| 237 | c1541->bit_pos = 7; |
| 241 | 238 | c1541->buffer_pos++; |
| 242 | 239 | |
| 243 | | if (c1541->buffer_pos > c1541->track_len) |
| 240 | if (c1541->buffer_pos > c1541->track_len + 1) |
| 244 | 241 | { |
| 245 | | c1541->buffer_pos = 0; |
| 242 | /* loop to the start of the track */ |
| 243 | c1541->buffer_pos = 2; |
| 246 | 244 | } |
| 245 | } |
| 247 | 246 | |
| 248 | | // logerror("YB %02x pos %u\n", c1541->yb, c1541->buffer_pos-1); |
| 247 | if ((c1541->data & SYNC_MARK) == SYNC_MARK) |
| 248 | { |
| 249 | /* SYNC detected */ |
| 250 | c1541->bit_count = 0; |
| 251 | } |
| 249 | 252 | |
| 250 | | c1541->bit_pos = 0; |
| 251 | | } |
| 252 | | else |
| 253 | if (c1541->bit_count > 7) |
| 253 | 254 | { |
| 254 | | c1541->bit_pos++; |
| 255 | /* byte ready */ |
| 256 | c1541->bit_count = 0; |
| 257 | byte = 1; |
| 255 | 258 | } |
| 256 | 259 | |
| 257 | 260 | if (c1541->byte != byte) |
| r6626 | r6627 | |
| 418 | 421 | |
| 419 | 422 | c1541_t *c1541 = get_safe_token(device->owner); |
| 420 | 423 | |
| 421 | | return c1541->yb; |
| 424 | return c1541->data & 0xff; |
| 422 | 425 | } |
| 423 | 426 | |
| 424 | 427 | static WRITE8_DEVICE_HANDLER( yb_w ) |
| r6626 | r6627 | |
| 467 | 470 | data |= (floppy_drive_get_flag_state(c1541->image, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) == FLOPPY_DRIVE_DISK_WRITE_PROTECTED) << 4; |
| 468 | 471 | |
| 469 | 472 | /* SYNC detect */ |
| 470 | | //logerror("SYNC %u\n", !(c1541->mode && (c1541->yb == 0xff))); |
| 471 | | data |= c1541->sync << 7; |
| 473 | data |= !(c1541->mode && ((c1541->data & SYNC_MARK) == SYNC_MARK)) << 7; |
| 472 | 474 | |
| 473 | 475 | return data; |
| 474 | 476 | } |
| r6626 | r6627 | |
| 511 | 513 | |
| 512 | 514 | if (tracks != 0) |
| 513 | 515 | { |
| 514 | | c1541->track_len = 8192; // TODO get track length from image |
| 515 | | c1541->buffer_pos = 0; |
| 516 | | c1541->bit_pos = 0; |
| 516 | c1541->track_len = 8192; |
| 517 | c1541->buffer_pos = 2; |
| 518 | c1541->bit_pos = 7; |
| 519 | c1541->bit_count = 0; |
| 517 | 520 | |
| 518 | 521 | floppy_drive_seek(c1541->image, tracks); |
| 519 | 522 | floppy_drive_read_track_data_info_buffer(c1541->image, 0, c1541->track_buffer, &c1541->track_len); |
| 523 | |
| 524 | c1541->track_len = (c1541->track_buffer[1] << 8) | c1541->track_buffer[0]; |
| 520 | 525 | } |
| 521 | 526 | |
| 522 | 527 | c1541->stp = stp; |
| r6626 | r6627 | |
| 531 | 536 | /* density select */ |
| 532 | 537 | if (c1541->ds != ds) |
| 533 | 538 | { |
| 534 | | //logerror("DS %u\n", ds); |
| 535 | 539 | timer_adjust_periodic(c1541->bit_timer, attotime_zero, 0, ATTOTIME_IN_HZ(C1541_BITRATE[ds]/4)); |
| 536 | 540 | c1541->ds = ds; |
| 537 | 541 | } |
src/mess/drivers/c64.c
| r6626 | r6627 | |
| 587 | 587 | MDRV_SOUND_CONFIG(c64_sound_interface) |
| 588 | 588 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 589 | 589 | |
| 590 | | MDRV_DEVICE_REMOVE("serial_bus") // in the current code, serial bus device is tied to the floppy drive |
| 590 | MDRV_DEVICE_REMOVE("serial_bus") |
| 591 | MDRV_DEVICE_REMOVE("c1541") |
| 591 | 592 | MDRV_DEVICE_REMOVE("cart1") |
| 592 | 593 | MDRV_DEVICE_REMOVE("cart2") |
| 593 | 594 | |
| r6626 | r6627 | |
| 605 | 606 | MDRV_DEVICE_REMOVE( "dac" ) |
| 606 | 607 | MDRV_DEVICE_REMOVE( "cassette" ) |
| 607 | 608 | MDRV_DEVICE_REMOVE( "quickload" ) |
| 609 | MDRV_DEVICE_REMOVE("serial_bus") |
| 610 | MDRV_DEVICE_REMOVE("c1541") |
| 608 | 611 | MACHINE_DRIVER_END |
| 609 | 612 | |
| 610 | 613 | |
| 611 | 614 | static MACHINE_DRIVER_START( sx64 ) |
| 612 | 615 | MDRV_IMPORT_FROM( c64pal ) |
| 613 | 616 | |
| 614 | | MDRV_DEVICE_REMOVE("serial_bus") // in the current code, serial bus device is tied to the floppy drive |
| 615 | | MDRV_IMPORT_FROM( cpu_vc1541 ) // so we need to remove the one from MDRV_IMPORT_FROM(simulated_drive)! |
| 616 | | |
| 617 | 617 | MDRV_DEVICE_REMOVE( "dac" ) |
| 618 | 618 | MDRV_DEVICE_REMOVE( "cassette" ) |
| 619 | 619 | #ifdef CPU_SYNC |
| r6626 | r6627 | |
| 743 | 743 | ROM_REGION( 0x80000, "cart", ROMREGION_ERASE00 ) |
| 744 | 744 | ROM_END |
| 745 | 745 | |
| 746 | | |
| 747 | | |
| 748 | | /************************************* |
| 749 | | * |
| 750 | | * System configuration(s) |
| 751 | | * |
| 752 | | *************************************/ |
| 753 | | |
| 754 | | |
| 755 | | static SYSTEM_CONFIG_START(c64) |
| 756 | | CONFIG_DEVICE(cbmfloppy_device_getinfo) |
| 757 | | SYSTEM_CONFIG_END |
| 758 | | |
| 759 | | static SYSTEM_CONFIG_START(sx64) |
| 760 | | CONFIG_DEVICE(vc1541_device_getinfo) |
| 761 | | SYSTEM_CONFIG_END |
| 762 | | |
| 763 | 746 | /*************************************************************************** |
| 764 | 747 | |
| 765 | 748 | Game driver(s) |
| r6626 | r6627 | |
| 768 | 751 | |
| 769 | 752 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 770 | 753 | |
| 771 | | COMP(1982, max, 0, 0, ultimax, c64, ultimax, 0, "Commodore Business Machines Co.", "Commodore Max Machine", 0) |
| 754 | COMP(1982, max, 0, 0, ultimax, c64, ultimax, 0, "Commodore Business Machines Co.", "Commodore Max Machine", 0) |
| 772 | 755 | |
| 773 | | COMP(1982, c64, 0, 0, c64, c64, c64, c64, "Commodore Business Machines Co.", "Commodore 64 (NTSC)", 0) |
| 774 | | COMP(1982, c64pal, c64, 0, c64pal, c64, c64pal, c64, "Commodore Business Machines Co.", "Commodore 64 (PAL)", 0) |
| 775 | | COMP(1982, c64jpn, c64, 0, c64, c64, c64, c64, "Commodore Business Machines Co.", "Commodore 64 (Japan)", 0) |
| 776 | | COMP(1982, vic64s, c64, 0, c64pal, vic64s, c64pal, c64, "Commodore Business Machines Co.", "VIC 64S", 0) |
| 777 | | COMP(1982, c64swe, c64, 0, c64pal, vic64s, c64pal, c64, "Commodore Business Machines Co.", "Commodore 64 (Sweden)", 0) |
| 756 | COMP(1982, c64, 0, 0, c64, c64, c64, 0, "Commodore Business Machines Co.", "Commodore 64 (NTSC)", 0) |
| 757 | COMP(1982, c64pal, c64, 0, c64pal, c64, c64pal, 0, "Commodore Business Machines Co.", "Commodore 64 (PAL)", 0) |
| 758 | COMP(1982, c64jpn, c64, 0, c64, c64, c64, 0, "Commodore Business Machines Co.", "Commodore 64 (Japan)", 0) |
| 759 | COMP(1982, vic64s, c64, 0, c64pal, vic64s, c64pal, 0, "Commodore Business Machines Co.", "VIC 64S", 0) |
| 760 | COMP(1982, c64swe, c64, 0, c64pal, vic64s, c64pal, 0, "Commodore Business Machines Co.", "Commodore 64 (Sweden/Finland)", 0) |
| 778 | 761 | |
| 779 | | COMP(1983, pet64, c64, 0, pet64, c64, c64, c64, "Commodore Business Machines Co.", "PET 64 (NTSC)", 0) |
| 780 | | COMP(1983, cbm4064, c64, 0, pet64, c64, c64, c64, "Commodore Business Machines Co.", "CBM 4064 (NTSC)", 0) |
| 781 | | COMP(1983, edu64, c64, 0, pet64, c64, c64, c64, "Commodore Business Machines Co.", "Educator 64 (NTSC)", 0) // maybe different palette? |
| 762 | COMP(1983, pet64, c64, 0, pet64, c64, c64, 0, "Commodore Business Machines Co.", "PET 64 (NTSC)", 0) |
| 763 | COMP(1983, cbm4064, c64, 0, pet64, c64, c64, 0, "Commodore Business Machines Co.", "CBM 4064 (NTSC)", 0) |
| 764 | COMP(1983, edu64, c64, 0, pet64, c64, c64, 0, "Commodore Business Machines Co.", "Educator 64 (NTSC)", 0) // maybe different palette? |
| 782 | 765 | |
| 783 | | // missing floppy emulation, among other things |
| 784 | | COMP(1984, sx64, c64, 0, sx64, c64, sx64, sx64, "Commodore Business Machines Co.", "SX-64 Executive Computer (PAL)", GAME_NOT_WORKING) |
| 785 | | COMP(1984, vip64, c64, 0, sx64, vip64, sx64, sx64, "Commodore Business Machines Co.", "VIP64 (SX64 PAL), Swedish Expansion Kit", GAME_NOT_WORKING) |
| 786 | | COMP(198?, dx64, c64, 0, sx64, c64, sx64, sx64, "Commodore Business Machines Co.", "DX-64 (Prototype, PAL)", GAME_NOT_WORKING) |
| 766 | COMP(1984, sx64, c64, 0, sx64, c64, sx64, 0, "Commodore Business Machines Co.", "SX-64 Executive Computer (PAL)", GAME_NOT_WORKING) |
| 767 | COMP(1984, vip64, c64, 0, sx64, vip64, sx64, 0, "Commodore Business Machines Co.", "VIP64 (SX64 PAL), Swedish Expansion Kit", GAME_NOT_WORKING) |
| 768 | COMP(198?, dx64, c64, 0, sx64, c64, sx64, 0, "Commodore Business Machines Co.", "DX-64 (Prototype, PAL)", GAME_NOT_WORKING) |
| 787 | 769 | |
| 788 | | COMP(1986, c64c, c64, 0, c64, c64, c64, c64, "Commodore Business Machines Co.", "Commodore 64C (NTSC)", 0) |
| 789 | | COMP(1986, c64cpal, c64, 0, c64pal, c64, c64pal, c64, "Commodore Business Machines Co.", "Commodore 64C (PAL)", 0) |
| 790 | | COMP(1986, c64g, c64, 0, c64pal, c64, c64pal, c64, "Commodore Business Machines Co.", "Commodore 64G (PAL)", 0) |
| 770 | COMP(1986, c64c, c64, 0, c64, c64, c64, 0, "Commodore Business Machines Co.", "Commodore 64C (NTSC)", 0) |
| 771 | COMP(1986, c64cpal, c64, 0, c64pal, c64, c64pal, 0, "Commodore Business Machines Co.", "Commodore 64C (PAL)", 0) |
| 772 | COMP(1986, c64g, c64, 0, c64pal, c64, c64pal, 0, "Commodore Business Machines Co.", "Commodore 64G (PAL)", 0) |
| 791 | 773 | |
| 792 | 774 | CONS(1990, c64gs, c64, 0, c64gs, c64gs, c64gs, 0, "Commodore Business Machines Co.", "Commodore 64 Games System (PAL)", 0) |