| Previous | 15994 Revisions | Next |
| r5932 Wednesday 30th September, 2009 at 23:40:58 UTC by Fabio Priuli |
|---|
| Run srcclean on devices/ and formats/ folders, and on a few drivers not actively worked on |
| [src/mess/devices] | aescart.c aescart.h appldriv.c appldriv.h bitbngr.c bitbngr.h cartslot.c cartslot.h cassette.c cassette.h chd_cd.c chd_cd.h coco_232.c coco_fdc.c coco_pak.c coco_vhd.c coco_vhd.h cococart.c cococart.h flopdrv.c flopdrv.h harddriv.c harddriv.h kermit.c kermit.h messram.c microdrv.c multcart.c multcart.h orch90.c printer.c printer.h snapquik.c snapquik.h sonydriv.c sonydriv.h thomflop.c ti99cart.c ti99cart.h xmodem.c xmodem.h z80bin.c z80bin.h |
| [src/mess/drivers] | c128.c c16.c c64.c c65.c genesis.c glasgow.c gmaster.c hp48.c mephisto.c nes.c pasogo.c ssystem3.c thomson.c vc20.c |
| [src/mess/formats] | a26_cas.h adam_dsk.c adam_dsk.h ami_dsk.c ami_dsk.h ap2_dsk.c ap2_dsk.h ap_dsk35.c ap_dsk35.h atarist_dsk.c atarist_dsk.h basicdsk.c basicdsk.h cassimg.c cassimg.h cbm_tap.c cbm_tap.h coco_cas.c coco_cas.h coco_dsk.c coco_dsk.h cocopak.c comx35_dsk.c comx35_dsk.h cpis_dsk.c cpis_dsk.h cqm_dsk.c csw_cas.c csw_cas.h d88_dsk.c dim_dsk.c dim_dsk.h dsk_dsk.c flopimg.c flopimg.h fm7_cas.c fmsx_cas.h imd_dsk.c ioprocs.c ioprocs.h jupi_tap.c lviv_lvt.h mz_cas.c mz_cas.h orao_cas.c oric_dsk.c oric_dsk.h oric_tap.c oric_tap.h pc_dsk.c pc_dsk.h pmd_pmd.h primoptp.c primoptp.h rk_cas.c sord_cas.c sord_cas.h svi_cas.h thom_cas.c thom_dsk.c trd_dsk.c trd_dsk.h trs_dsk.h tzx_cas.c uef_cas.c uef_cas.h vt_cas.c vt_cas.h vt_dsk.c vt_dsk.h wavfile.c wavfile.h x1_tap.c x1_tap.h zx81_p.c zx81_p.h |
| [src/mess/machine] | nes.c nes_mmc.c thomson.c |
| r5931 | r5932 | |
|---|---|---|
| 1093 | 1093 | /* joystick */ |
| 1094 | 1094 | data = input_port_read(device->machine, "game_port_directions"); |
| 1095 | 1095 | /* bit 0=0 => P1 up bit 4=0 => P2 up |
| 1096 | bit 1=0 => P1 down bit 5=0 => P2 down | |
| 1097 | bit 2=0 => P1 left bit 6=0 => P2 left | |
| 1098 | bit 3=0 => P1 right bit 7=0 => P2 right | |
| 1099 | */ | |
| 1096 | bit 1=0 => P1 down bit 5=0 => P2 down | |
| 1097 | bit 2=0 => P1 left bit 6=0 => P2 left | |
| 1098 | bit 3=0 => P1 right bit 7=0 => P2 right | |
| 1099 | */ | |
| 1100 | 1100 | /* remove impossible combinations: up+down, left+right */ |
| 1101 | 1101 | if ( ! ( data & 0x03 ) ) |
| 1102 | 1102 | data |= 0x03; |
| r5931 | r5932 | |
| 1203 | 1203 | pia6821_cb1_w( game_pia, 0, (in & 0x08) ? 1 : 0 ); /* P2 action B */ |
| 1204 | 1204 | pia6821_ca1_w( game_pia, 0, (in & 0x04) ? 1 : 0 ); /* P1 action B */ |
| 1205 | 1205 | /* TODO: |
| 1206 | it seems that CM 90-112 behaves differently | |
| 1207 | - ca1 is P1 action A, i.e., in & 0x40 | |
| 1208 | - ca2 is P2 action A, i.e., in & 0x80 | |
| 1209 | - cb1, cb2 are not connected (should not be a problem) | |
| 1210 | */ | |
| 1206 | it seems that CM 90-112 behaves differently | |
| 1207 | - ca1 is P1 action A, i.e., in & 0x40 | |
| 1208 | - ca2 is P2 action A, i.e., in & 0x80 | |
| 1209 | - cb1, cb2 are not connected (should not be a problem) | |
| 1210 | */ | |
| 1211 | 1211 | /* Note: the MO6 & MO5NR have slightly different connections |
| 1212 | (see mo6_game_update_cb) | |
| 1213 | */ | |
| 1212 | (see mo6_game_update_cb) | |
| 1213 | */ | |
| 1214 | 1214 | } |
| 1215 | 1215 | } |
| 1216 | 1216 | |
| r5931 | r5932 | |
| 2823 | 2823 | port |= 1; /* shift & control */ |
| 2824 | 2824 | |
| 2825 | 2825 | /* TODO: correct handling of simultaneous keystokes: |
| 2826 | return the new key preferably & disable repeat | |
| 2827 | */ | |
| 2826 | return the new key preferably & disable repeat | |
| 2827 | */ | |
| 2828 | 2828 | for ( bit = 0; bit < 8; bit++ ) |
| 2829 | 2829 | { |
| 2830 | 2830 | if ( ! (port & (1 << bit)) ) |
| r5931 | r5932 | |
| 3255 | 3255 | port |= 1; /* shift & control */ |
| 3256 | 3256 | |
| 3257 | 3257 | /* TODO: correct handling of simultaneous keystokes: |
| 3258 | return the new key preferably & disable repeat | |
| 3259 | */ | |
| 3258 | return the new key preferably & disable repeat | |
| 3259 | */ | |
| 3260 | 3260 | for ( bit = 0; bit < 8; bit++ ) |
| 3261 | 3261 | { |
| 3262 | 3262 | if ( ! (port & (1 << bit)) ) |
| r5931 | r5932 | |
| 3319 | 3319 | /* key polling */ |
| 3320 | 3320 | int k = to8_kbd_get_key(machine); |
| 3321 | 3321 | /* if not in transfer, send pulse from time to time |
| 3322 | (helps avoiding CPU lock) | |
| 3323 | */ | |
| 3322 | (helps avoiding CPU lock) | |
| 3323 | */ | |
| 3324 | 3324 | if ( ! to8_kbd_ack ) |
| 3325 | 3325 | mc6846_set_input_cp1( devtag_get_device(machine, "mc6846"), 0 ); |
| 3326 | 3326 | mc6846_set_input_cp1( devtag_get_device(machine, "mc6846"), 1 ); |
| r5931 | r5932 | |
| 3557 | 3557 | } |
| 3558 | 3558 | |
| 3559 | 3559 | /* due to adressing distortion, the 16 KB banked memory space is |
| 3560 | split into two 8 KB spaces: | |
| 3561 | - 0xa000-0xbfff maps to 0x2000-0x3fff in 16 KB bank | |
| 3562 | - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank | |
| 3563 | this is important if we map a bank that is also reachable by another, | |
| 3564 | undistorted space, such as cartridge, page 0 (video), or page 1 | |
| 3565 | */ | |
| 3560 | split into two 8 KB spaces: | |
| 3561 | - 0xa000-0xbfff maps to 0x2000-0x3fff in 16 KB bank | |
| 3562 | - 0xc000-0xdfff maps to 0x0000-0x1fff in 16 KB bank | |
| 3563 | this is important if we map a bank that is also reachable by another, | |
| 3564 | undistorted space, such as cartridge, page 0 (video), or page 1 | |
| 3565 | */ | |
| 3566 | 3566 | to8_data_vpage = bank; |
| 3567 | 3567 | if ( mess_ram_size == 512*1024 || to8_data_vpage < 16 ) |
| 3568 | 3568 | { |
| r5931 | r5932 | |
|---|---|---|
| 450 | 450 | const char *filetype = image_filetype(image); |
| 451 | 451 | |
| 452 | 452 | if (!mame_stricmp(filetype, "nes")) |
| 453 | { | |
| 453 | { | |
| 454 | 454 | /* Verify the file is in iNES format */ |
| 455 | 455 | memset(magic, '\0', sizeof(magic)); |
| 456 | 456 | image_fread(image, magic, 4); |
| r5931 | r5932 | |
| 501 | 501 | |
| 502 | 502 | /* Read the second ROM option byte (offset 7) */ |
| 503 | 503 | image_fread(image, &m, 1); |
| 504 | ||
| 504 | ||
| 505 | 505 | /* Check for skanky headers */ |
| 506 | 506 | image_fread(image, &skank, 8); |
| 507 | 507 | |
| r5931 | r5932 | |
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | logerror("\n"); |
| 519 | ||
| 519 | ||
| 520 | 520 | nes.mapper = nes.mapper | (m & 0xf0); |
| 521 | 521 | } |
| 522 | 522 | |
| r5931 | r5932 | |
| 525 | 525 | nes.trainer = local_options & 0x04; |
| 526 | 526 | nes.four_screen_vram = local_options & 0x08; |
| 527 | 527 | |
| 528 | if (nes.battery) | |
| 528 | if (nes.battery) | |
| 529 | 529 | logerror("-- Battery found\n"); |
| 530 | 530 | |
| 531 | if (nes.trainer) | |
| 531 | if (nes.trainer) | |
| 532 | 532 | logerror("-- Trainer found\n"); |
| 533 | 533 | |
| 534 | if (nes.four_screen_vram) | |
| 534 | if (nes.four_screen_vram) | |
| 535 | 535 | logerror("-- 4-screen VRAM\n"); |
| 536 | 536 | |
| 537 | 537 | /* Free the regions that were allocated by the ROM loader */ |
| r5931 | r5932 | |
| 586 | 586 | logerror("**\n"); |
| 587 | 587 | logerror("Mapper: %d\n", nes.mapper); |
| 588 | 588 | logerror("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks); |
| 589 | // printf("Mapper: %d\n", nes.mapper); | |
| 590 | // printf("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks); | |
| 589 | // printf("Mapper: %d\n", nes.mapper); | |
| 590 | // printf("PRG chunks: %02x, size: %06x\n", nes.prg_chunks, 0x4000 * nes.prg_chunks); | |
| 591 | 591 | |
| 592 | 592 | /* Read in any chr chunks */ |
| 593 | 593 | if (nes.chr_chunks > 0) |
| r5931 | r5932 | |
| 617 | 617 | |
| 618 | 618 | logerror("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks); |
| 619 | 619 | logerror("**\n"); |
| 620 | // printf("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks); | |
| 621 | // printf("**\n"); | |
| 620 | // printf("CHR chunks: %02x, size: %06x\n", nes.chr_chunks, 0x4000 * nes.chr_chunks); | |
| 621 | // printf("**\n"); | |
| 622 | 622 | |
| 623 | 623 | /* Attempt to load a battery file for this ROM. If successful, we */ |
| 624 | 624 | /* must wait until later to move it to the system memory. */ |
| r5931 | r5932 | |
| 685 | 685 | if (unif_board == NULL) |
| 686 | 686 | { |
| 687 | 687 | logerror("Unsupported UNIF board.\n"); |
| 688 | // | |
| 688 | // return INIT_FAIL; | |
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | else if ((magic2[0] == 'R') && (magic2[1] == 'E') && (magic2[2] == 'A') && (magic2[3] == 'D')) |
| r5931 | r5932 | |
|---|---|---|
| 6 | 6 | MESS source file to handle various Multi-Memory Controllers (aka Mappers) used by NES carts. |
| 7 | 7 | |
| 8 | 8 | Many information about the mappers below come from the wonderful doc written by Disch. |
| 9 | Current info (when used) are based on v0.6.1 of his docs. | |
| 9 | Current info (when used) are based on v0.6.1 of his docs. | |
| 10 | 10 | You can find the latest version of the doc at http://www.romhacking.net/docs/362/ |
| 11 | 11 | |
| 12 | 12 | |
| r5931 | r5932 | |
| 19 | 19 | * 016 some graphics problem (e.g. Rokudenashi Blues misses some element of graphics) |
| 20 | 20 | * 018 Pizza Pop and Plasma Ball shows graphics issues for this mapper |
| 21 | 21 | * 024, 026, 085 Registers of the additional sound hardware are not emulated |
| 22 | * 032 Major League is not properly working: check missing windows or field graphics in top view screens | |
| 22 | * 032 Major League is not properly working: check missing windows or field graphics in top view screens | |
| 23 | 23 | (it requires one hack to support both boards using this mapper) |
| 24 | 24 | * 033 has still some graphics problem (e.g. missing text in Akira) |
| 25 | 25 | * 034 Impossible Mission 2 is not working |
| r5931 | r5932 | |
| 37 | 37 | * 072, 086, 092 lack samples support (maybe others as well) |
| 38 | 38 | * 074 is only preliminar (no correct CHR swap) |
| 39 | 39 | * 077 Requires 4-screen mirroring. Currently, it is very glitchy |
| 40 | * 078 Cosmo Carrier is not working (it requires one hack to support both boards using this mapper). | |
| 40 | * 078 Cosmo Carrier is not working (it requires one hack to support both boards using this mapper). | |
| 41 | 41 | also, we lack NT mirroring |
| 42 | 42 | * 082 has chr-rom banking problems. Also mapper is in the middle of sram, which is unemulated. |
| 43 | 43 | * 083 has serious glitches |
| r5931 | r5932 | |
| 153 | 153 | static int mult1, mult2; |
| 154 | 154 | |
| 155 | 155 | /* common local variables */ |
| 156 | static UINT8 mmc_chr_source; // this is set at init to CHRROM or CHRRAM. a few mappers can swap between | |
| 156 | static UINT8 mmc_chr_source; // this is set at init to CHRROM or CHRRAM. a few mappers can swap between | |
| 157 | 157 | // the two (this is done in the specific handlers) |
| 158 | 158 | static UINT8 mmc_cmd1, mmc_cmd2; // these represent registers where the mapper writes important values |
| 159 | 159 | static UINT8 mmc_bank_latch1, mmc_bank_latch2; // some mappers change banks by writing subsets of these bits |
| r5931 | r5932 | |
| 659 | 659 | } |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | /* Other custom mirroring helpers are defined below: Waixing games use waixing_set_mirror (which swaps | |
| 662 | /* Other custom mirroring helpers are defined below: Waixing games use waixing_set_mirror (which swaps | |
| 663 | 663 | MIRROR_HIGH and MIRROR_LOW compared to the above) and Sachen games use sachen_set_mirror (which has |
| 664 | 664 | a slightly different MIRROR_HIGH, with page 0 set to 0) */ |
| 665 | 665 | |
| r5931 | r5932 | |
| 672 | 672 | No need of additional MMC |
| 673 | 673 | |
| 674 | 674 | Known Boards: NROM, FB02??, FB04??, Jaleco JF01, JF02, JF03, JF04 |
| 675 | Games: Mario Bros., Super Mario Bros., Tennis and most of | |
| 676 | the first generation games | |
| 675 | Games: Mario Bros., Super Mario Bros., Tennis and most of | |
| 676 | the first generation games | |
| 677 | 677 | |
| 678 | 678 | In MESS: Supported, no need of specific handlers or IRQ |
| 679 | 679 | |
| r5931 | r5932 | |
| 683 | 683 | |
| 684 | 684 | Mapper 1 |
| 685 | 685 | |
| 686 | Known Boards: MMC1 based Boards, i.e. SAROM, SBROM, SCROM, | |
| 686 | Known Boards: MMC1 based Boards, i.e. SAROM, SBROM, SCROM, | |
| 687 | 687 | SEROM, SFROM, SGROM, SHROM, SJROM, SKROM, SLROM, SNROM, |
| 688 | 688 | SOROM, SUROM, SXROM, WH?? |
| 689 | Games: Faxanadu, Final Fantasy I & II, Kid Icarus, Legend | |
| 689 | Games: Faxanadu, Final Fantasy I & II, Kid Icarus, Legend | |
| 690 | 690 | of Zelda, Metroid |
| 691 | 691 | |
| 692 | 692 | In MESS: Supported |
| r5931 | r5932 | |
| 941 | 941 | |
| 942 | 942 | Known Boards: CNROM, CXROM, X79B?, Bandai Aerobics Board, |
| 943 | 943 | Tengen 800008, Bootleg Board by NTDEC (N715062) |
| 944 | Games: Adventure Island, Flipull, Friday 13th, GeGeGe no | |
| 945 | Kitarou, Ghostbusters, Gradius, Hokuto no Ken, Milon's | |
| 944 | Games: Adventure Island, Flipull, Friday 13th, GeGeGe no | |
| 945 | Kitarou, Ghostbusters, Gradius, Hokuto no Ken, Milon's | |
| 946 | 946 | Secret Castle |
| 947 | 947 | |
| 948 | 948 | In MESS: Supported |
| r5931 | r5932 | |
| 958 | 958 | |
| 959 | 959 | Mapper 4 |
| 960 | 960 | |
| 961 | Known Boards: MMC3 based Boards, i.e. HKROM, TEROM, TBROM, | |
| 962 | TFROM, TGROM, TKROM, TLROM, TNROM, TR1ROM, TSROM, | |
| 961 | Known Boards: MMC3 based Boards, i.e. HKROM, TEROM, TBROM, | |
| 962 | TFROM, TGROM, TKROM, TLROM, TNROM, TR1ROM, TSROM, | |
| 963 | 963 | TVROM, TRXROM |
| 964 | Games: Final Fantasy III, MegaMan 3,4,5 & 6, Startropics, | |
| 965 | Super Mario Bros. 2 & 3, | |
| 964 | Games: Final Fantasy III, MegaMan 3,4,5 & 6, Startropics, | |
| 965 | Super Mario Bros. 2 & 3, | |
| 966 | 966 | |
| 967 | 967 | In MESS: Supported |
| 968 | 968 | |
| r5931 | r5932 | |
| 1015 | 1015 | |
| 1016 | 1016 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 1017 | 1017 | { |
| 1018 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, | |
| 1018 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, | |
| 1019 | 1019 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 1020 | 1020 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 1021 | 1021 | // timer_adjust_oneshot(nes_irq_timer, cputag_clocks_to_attotime(device->machine, "maincpu", 4), 0); |
| r5931 | r5932 | |
| 1123 | 1123 | |
| 1124 | 1124 | Mapper 5 |
| 1125 | 1125 | |
| 1126 | Known Boards: MMC3 based Boards, i.e. ELROM, EKROM, ETROM, | |
| 1126 | Known Boards: MMC3 based Boards, i.e. ELROM, EKROM, ETROM, | |
| 1127 | 1127 | EWROM and EXROM variants |
| 1128 | 1128 | Games: Castlevania III, Just Breed, many Koei titles |
| 1129 | 1129 | |
| r5931 | r5932 | |
| 1716 | 1716 | |
| 1717 | 1717 | Mapper 7 |
| 1718 | 1718 | |
| 1719 | Known Boards: AMROM, ANROM, AN1ROM, AOROM and unlicensed | |
| 1719 | Known Boards: AMROM, ANROM, AN1ROM, AOROM and unlicensed | |
| 1720 | 1720 | AxROM |
| 1721 | 1721 | Games: Arch Rivals, Battletoads, Cabal, Commando, Solstice |
| 1722 | 1722 | |
| r5931 | r5932 | |
| 1987 | 1987 | |
| 1988 | 1988 | Known Boards: Bandai LZ93D50 24C02 |
| 1989 | 1989 | Games: Crayon Shin-Chan - Ora to Poi Poi, Dragon Ball Z Gaiden, |
| 1990 | Dragon Ball Z II & III, Rokudenashi Blues, SD Gundam | |
| 1990 | Dragon Ball Z II & III, Rokudenashi Blues, SD Gundam | |
| 1991 | 1991 | Gaiden - KGM2 |
| 1992 | 1992 | |
| 1993 | 1993 | In MESS: Supported |
| r5931 | r5932 | |
| 2140 | 2140 | |
| 2141 | 2141 | Known Boards: Jaleco JF23, JF24, JF25, JF27, JF29, JF30, JF31, |
| 2142 | 2142 | JF32, JF33, JF34, JF35, JF36, JF37, JF38, JF40, JF41, SS88006 |
| 2143 | Games: Lord of King, Magic John, Moe Pro '90, Ninja Jajamaru, | |
| 2143 | Games: Lord of King, Magic John, Moe Pro '90, Ninja Jajamaru, | |
| 2144 | 2144 | Pizza Pop, Plasma Ball |
| 2145 | 2145 | |
| 2146 | 2146 | In MESS: Supported |
| r5931 | r5932 | |
| 2396 | 2396 | Mapper 19 |
| 2397 | 2397 | |
| 2398 | 2398 | Known Boards: Namcot 163 & 163S |
| 2399 | Games: Battle Fleet, Family Circuit '91, Famista '90, '91, | |
| 2399 | Games: Battle Fleet, Family Circuit '91, Famista '90, '91, | |
| 2400 | 2400 | '92 & '94, Megami Tensei II, Top Striker, Wagyan Land 2 & 3 |
| 2401 | 2401 | |
| 2402 | 2402 | In MESS: Supported |
| r5931 | r5932 | |
| 2604 | 2604 | Mapper 21 & 25 |
| 2605 | 2605 | |
| 2606 | 2606 | Known Boards: Konami VRC4A & VRC4C (21), VRC4B & VRC4D (25) |
| 2607 | Games: Ganbare Goemon Gaiden 2, Wai Wai World 2 (21), Bio | |
| 2607 | Games: Ganbare Goemon Gaiden 2, Wai Wai World 2 (21), Bio | |
| 2608 | 2608 | Miracle Bokutte Upa, Ganbare Goemon Gaiden, TMNT 1 & 2 Jpn (25) |
| 2609 | 2609 | |
| 2610 | 2610 | In MESS: Supported |
| r5931 | r5932 | |
| 2778 | 2778 | Known Boards: Konami VRC2A |
| 2779 | 2779 | Games: Ganbare Pennant Race, Twin Bee 3 |
| 2780 | 2780 | |
| 2781 | In MESS: Supported. | |
| 2781 | In MESS: Supported. | |
| 2782 | 2782 | |
| 2783 | 2783 | *************************************************************/ |
| 2784 | 2784 | |
| r5931 | r5932 | |
| 2943 | 2943 | |
| 2944 | 2944 | switch (offset & 0x7003) |
| 2945 | 2945 | { |
| 2946 | case 0x0000: | |
| 2947 | case 0x0001: | |
| 2948 | case 0x0002: | |
| 2946 | case 0x0000: | |
| 2947 | case 0x0001: | |
| 2948 | case 0x0002: | |
| 2949 | 2949 | case 0x0003: |
| 2950 | 2950 | /* Switch 16k bank at $8000 */ |
| 2951 | 2951 | prg16_89ab(space->machine, data); |
| r5931 | r5932 | |
| 2964 | 2964 | case 0x0c: set_nt_mirroring(PPU_MIRROR_HIGH); break; |
| 2965 | 2965 | } |
| 2966 | 2966 | break; |
| 2967 | case 0x4000: | |
| 2968 | case 0x4001: | |
| 2969 | case 0x4002: | |
| 2967 | case 0x4000: | |
| 2968 | case 0x4001: | |
| 2969 | case 0x4002: | |
| 2970 | 2970 | case 0x4003: |
| 2971 | 2971 | /* Switch 8k bank at $c000 */ |
| 2972 | 2972 | prg8_cd(space->machine, data); |
| r5931 | r5932 | |
| 3080 | 3080 | Known Boards: Unknown Bootleg Board |
| 3081 | 3081 | Games: World Hero |
| 3082 | 3082 | |
| 3083 | In MESS: Unsupported. | |
| 3083 | In MESS: Unsupported. | |
| 3084 | 3084 | |
| 3085 | 3085 | *************************************************************/ |
| 3086 | 3086 | |
| r5931 | r5932 | |
| 3133 | 3133 | Mapper 32 |
| 3134 | 3134 | |
| 3135 | 3135 | Known Boards: Irem G101A & G101B |
| 3136 | Games: Ai Sensei no Oshiete, Image Fight, Kaiketsu | |
| 3136 | Games: Ai Sensei no Oshiete, Image Fight, Kaiketsu | |
| 3137 | 3137 | Yanchamaru 2, Maikyuu Shima, Paaman, Paaman 2 |
| 3138 | 3138 | |
| 3139 | 3139 | In MESS: Supported. |
| r5931 | r5932 | |
| 3172 | 3172 | Mapper 33 |
| 3173 | 3173 | |
| 3174 | 3174 | Known Boards: Taito TC0190FMC |
| 3175 | Games: Akira, Bakushou!! Jinsei Gekijou, Don Doko Don, | |
| 3176 | Insector X, Operation Wolf, Power Blazer, Takeshi no | |
| 3175 | Games: Akira, Bakushou!! Jinsei Gekijou, Don Doko Don, | |
| 3176 | Insector X, Operation Wolf, Power Blazer, Takeshi no | |
| 3177 | 3177 | Sengoku Fuuunji |
| 3178 | 3178 | |
| 3179 | 3179 | In MESS: Supported. |
| r5931 | r5932 | |
| 3219 | 3219 | Mapper 34 |
| 3220 | 3220 | |
| 3221 | 3221 | Known Boards: BNROM, Unlicensed BxROM, NINA001, NINA002 |
| 3222 | Games: Deadly Tower, Impossible Mission II, Titanic 1912, | |
| 3222 | Games: Deadly Tower, Impossible Mission II, Titanic 1912, | |
| 3223 | 3223 | Dance Xtreme |
| 3224 | 3224 | |
| 3225 | 3225 | In MESS: Supported. |
| r5931 | r5932 | |
| 3274 | 3274 | Known Boards: Bootleg Board by TXC |
| 3275 | 3275 | Games: Strike Wolf (also Policeman?? according to Nestopia) |
| 3276 | 3276 | |
| 3277 | In MESS: Supported. | |
| 3277 | In MESS: Supported. | |
| 3278 | 3278 | |
| 3279 | 3279 | *************************************************************/ |
| 3280 | 3280 | |
| r5931 | r5932 | |
| 3298 | 3298 | |
| 3299 | 3299 | MMC3 clone |
| 3300 | 3300 | |
| 3301 | In MESS: Unsupported. | |
| 3301 | In MESS: Unsupported. | |
| 3302 | 3302 | |
| 3303 | 3303 | *************************************************************/ |
| 3304 | 3304 | |
| r5931 | r5932 | |
| 3309 | 3309 | Known Boards: Discrete Logic Board |
| 3310 | 3310 | Games: Crime Busters |
| 3311 | 3311 | |
| 3312 | In MESS: Supported. | |
| 3312 | In MESS: Supported. | |
| 3313 | 3313 | |
| 3314 | 3314 | *************************************************************/ |
| 3315 | 3315 | |
| r5931 | r5932 | |
| 3328 | 3328 | Known Boards: Bootleg Board by Subor |
| 3329 | 3329 | Games: Study n Game 32 in 1 |
| 3330 | 3330 | |
| 3331 | In MESS: Partially Supported. | |
| 3331 | In MESS: Partially Supported. | |
| 3332 | 3332 | |
| 3333 | 3333 | *************************************************************/ |
| 3334 | 3334 | |
| r5931 | r5932 | |
| 3659 | 3659 | Mapper 48 |
| 3660 | 3660 | |
| 3661 | 3661 | Known Boards: Taito TC0190FMC PAL16R4 |
| 3662 | Games: Bakushou!! Jinsei Gekijou 3, Bubble Bobble 2, | |
| 3662 | Games: Bakushou!! Jinsei Gekijou 3, Bubble Bobble 2, | |
| 3663 | 3663 | Captain Saver, Don Doko Don 2, Flintstones, Jetsons |
| 3664 | 3664 | |
| 3665 | In MESS: Unsupported. | |
| 3665 | In MESS: Unsupported. | |
| 3666 | 3666 | |
| 3667 | 3667 | *************************************************************/ |
| 3668 | 3668 | |
| r5931 | r5932 | |
| 3699 | 3699 | Known Boards: Unknown Bootleg Board |
| 3700 | 3700 | Games: Super Mario Bros. Pirate Alt. Levels |
| 3701 | 3701 | |
| 3702 | In MESS: Unsupported. | |
| 3702 | In MESS: Unsupported. | |
| 3703 | 3703 | |
| 3704 | 3704 | *************************************************************/ |
| 3705 | 3705 | |
| r5931 | r5932 | |
| 3761 | 3761 | |
| 3762 | 3762 | MMC3 clone |
| 3763 | 3763 | |
| 3764 | In MESS: Unsupported. | |
| 3764 | In MESS: Unsupported. | |
| 3765 | 3765 | |
| 3766 | 3766 | *************************************************************/ |
| 3767 | 3767 | |
| r5931 | r5932 | |
| 3772 | 3772 | Known Boards: Unknown Multigame Bootleg Board |
| 3773 | 3773 | Games: Supervision 16 in 1 |
| 3774 | 3774 | |
| 3775 | In MESS: Unsupported. | |
| 3775 | In MESS: Unsupported. | |
| 3776 | 3776 | |
| 3777 | 3777 | *************************************************************/ |
| 3778 | 3778 | |
| r5931 | r5932 | |
| 3783 | 3783 | Known Boards: Unknown Multigame Bootleg Board |
| 3784 | 3784 | Games: [no games in nes.hsi] |
| 3785 | 3785 | |
| 3786 | In MESS: Unsupported. | |
| 3786 | In MESS: Unsupported. | |
| 3787 | 3787 | |
| 3788 | 3788 | *************************************************************/ |
| 3789 | 3789 | |
| r5931 | r5932 | |
| 3794 | 3794 | Known Boards: Unknown Bootleg Board |
| 3795 | 3795 | Games: [no games in nes.hsi] |
| 3796 | 3796 | |
| 3797 | In MESS: Unsupported. | |
| 3797 | In MESS: Unsupported. | |
| 3798 | 3798 | |
| 3799 | 3799 | *************************************************************/ |
| 3800 | 3800 | |
| r5931 | r5932 | |
| 3805 | 3805 | Known Boards: Bootleg Board by Kaiser (KS202) |
| 3806 | 3806 | Games: Super Mario Bros. 3 Pirate |
| 3807 | 3807 | |
| 3808 | In MESS: Unsupported. | |
| 3808 | In MESS: Unsupported. | |
| 3809 | 3809 | |
| 3810 | 3810 | *************************************************************/ |
| 3811 | 3811 | |
| r5931 | r5932 | |
| 3886 | 3886 | Mapper 60 |
| 3887 | 3887 | |
| 3888 | 3888 | Known Boards: Unknown Multigame Bootleg Board |
| 3889 | Games: 4 in 1, 35 in 1 | |
| 3889 | Games: 4 in 1, 35 in 1 | |
| 3890 | 3890 | |
| 3891 | In MESS: Unsupported. | |
| 3891 | In MESS: Unsupported. | |
| 3892 | 3892 | |
| 3893 | 3893 | *************************************************************/ |
| 3894 | 3894 | |
| r5931 | r5932 | |
| 3901 | 3901 | |
| 3902 | 3902 | Simple Mapper: prg/chr/nt are swapped depending on the offset |
| 3903 | 3903 | of writes in 0x8000-0xffff. offset&0x80 set NT mirroring, |
| 3904 | when (offset&0x30) is 0,3 prg32 is set; when it is 1,2 | |
| 3904 | when (offset&0x30) is 0,3 prg32 is set; when it is 1,2 | |
| 3905 | 3905 | two 16k prg banks are set. See below for the values used in |
| 3906 | 3906 | these banks. |
| 3907 | 3907 | |
| r5931 | r5932 | |
| 3965 | 3965 | Known Boards: Unknown Multigame Bootleg Board |
| 3966 | 3966 | Games: [no games in nes.hsi] |
| 3967 | 3967 | |
| 3968 | In MESS: Unsupported. | |
| 3968 | In MESS: Unsupported. | |
| 3969 | 3969 | |
| 3970 | 3970 | *************************************************************/ |
| 3971 | 3971 | |
| r5931 | r5932 | |
| 3974 | 3974 | Mapper 64 |
| 3975 | 3975 | |
| 3976 | 3976 | Known Boards: Tengen 800032 |
| 3977 | Games: Klax, Road Runner, Rolling Thunder, Shinobi, Skulls | |
| 3977 | Games: Klax, Road Runner, Rolling Thunder, Shinobi, Skulls | |
| 3978 | 3978 | & Croosbones, Xybots |
| 3979 | 3979 | |
| 3980 | 3980 | In MESS: Supported. It also uses mapper4_irq. |
| r5931 | r5932 | |
| 4085 | 4085 | Mapper 65 |
| 4086 | 4086 | |
| 4087 | 4087 | Known Boards: Irem H3001 |
| 4088 | Games: Daiku no Gen San 2 - Akage no Dan no Gyakushuu, | |
| 4088 | Games: Daiku no Gen San 2 - Akage no Dan no Gyakushuu, | |
| 4089 | 4089 | Kaiketsu Yanchamaru 3, Spartan X 2 |
| 4090 | 4090 | |
| 4091 | 4091 | In MESS: Supported. |
| r5931 | r5932 | |
| 4264 | 4264 | |
| 4265 | 4265 | switch (m68_mirror) |
| 4266 | 4266 | { |
| 4267 | case 0x00: | |
| 4268 | set_nt_mirroring(PPU_MIRROR_HORZ); | |
| 4267 | case 0x00: | |
| 4268 | set_nt_mirroring(PPU_MIRROR_HORZ); | |
| 4269 | 4269 | break; |
| 4270 | case 0x01: | |
| 4271 | set_nt_mirroring(PPU_MIRROR_VERT); | |
| 4270 | case 0x01: | |
| 4271 | set_nt_mirroring(PPU_MIRROR_VERT); | |
| 4272 | 4272 | break; |
| 4273 | case 0x02: | |
| 4274 | set_nt_mirroring(PPU_MIRROR_LOW); | |
| 4273 | case 0x02: | |
| 4274 | set_nt_mirroring(PPU_MIRROR_LOW); | |
| 4275 | 4275 | break; |
| 4276 | case 0x03: | |
| 4277 | set_nt_mirroring(PPU_MIRROR_HIGH); | |
| 4276 | case 0x03: | |
| 4277 | set_nt_mirroring(PPU_MIRROR_HIGH); | |
| 4278 | 4278 | break; |
| 4279 | 4279 | case 0x10: |
| 4280 | 4280 | set_nt_page(0, ROM, m0 | 0x80, 0); //(m0 << 10) + M68_OFFSET); |
| r5931 | r5932 | |
| 4355 | 4355 | |
| 4356 | 4356 | Known Boards: JLROM, JSROM, Sunsoft 5B, Sunsoft FME7 and |
| 4357 | 4357 | Custom |
| 4358 | Games: Barcode World, Batman - Return of the Joker, Gimmick!, | |
| 4358 | Games: Barcode World, Batman - Return of the Joker, Gimmick!, | |
| 4359 | 4359 | Splatter House - Wanpaku Graffiti |
| 4360 | 4360 | |
| 4361 | 4361 | In MESS: Supported. |
| r5931 | r5932 | |
| 4450 | 4450 | Mapper 70 |
| 4451 | 4451 | |
| 4452 | 4452 | Known Boards: Discrete Logic Board |
| 4453 | Games: Space Shadow, Family Trainer Manhattan Police, | |
| 4453 | Games: Space Shadow, Family Trainer Manhattan Police, | |
| 4454 | 4454 | Kamen Rider Club |
| 4455 | 4455 | |
| 4456 | 4456 | Same board as mapper 152, but no NT mirroring |
| r5931 | r5932 | |
| 4474 | 4474 | Mapper 71 |
| 4475 | 4475 | |
| 4476 | 4476 | Known Boards: Camerica Boards (BF9093, BF9097, BF909X, ALGNV11) |
| 4477 | Games: Linus Spacehead's Cosmic Crusade, Micro Machines, | |
| 4477 | Games: Linus Spacehead's Cosmic Crusade, Micro Machines, | |
| 4478 | 4478 | Mig-29, Stunt Kids |
| 4479 | 4479 | |
| 4480 | We currently do not emulate NT mirroring for BF9097 board | |
| 4480 | We currently do not emulate NT mirroring for BF9097 board | |
| 4481 | 4481 | (missing in BF9093). As a result Fire Hawk is broken. |
| 4482 | 4482 | |
| 4483 | 4483 | In MESS: Partially Supported. |
| r5931 | r5932 | |
| 4504 | 4504 | Mapper 72 |
| 4505 | 4505 | |
| 4506 | 4506 | Known Boards: Jaleco JF17, JF26 and JF28 |
| 4507 | Games: Moero!! Juudou Warriors, Moero!! Pro Tennis, Pinball | |
| 4507 | Games: Moero!! Juudou Warriors, Moero!! Pro Tennis, Pinball | |
| 4508 | 4508 | Quest Jpn |
| 4509 | 4509 | |
| 4510 | 4510 | In MESS: Supported. |
| r5931 | r5932 | |
| 4569 | 4569 | Mapper 74 |
| 4570 | 4570 | |
| 4571 | 4571 | Known Boards: Type A by Waixing |
| 4572 | Games: Columbus - Ougon no Yoake (C), Ji Jia Zhan Shi, | |
| 4572 | Games: Columbus - Ougon no Yoake (C), Ji Jia Zhan Shi, | |
| 4573 | 4573 | Jia A Fung Yun, Wei Luo Chuan Qi |
| 4574 | 4574 | |
| 4575 | 4575 | In MESS: Partially Supported, but we ignore accesses to 0x5000 / 0x6000 atm |
| 4576 | ||
| 4576 | (is this the reason for missing graphics?) | |
| 4577 | 4577 | |
| 4578 | 4578 | *************************************************************/ |
| 4579 | 4579 | |
| r5931 | r5932 | |
| 4727 | 4727 | Mapper 78 |
| 4728 | 4728 | |
| 4729 | 4729 | Known Boards: Jaleco JF16 and Irem |
| 4730 | Games: Holy Diver, Portopia Renzoku Satsujin Jiken, | |
| 4730 | Games: Holy Diver, Portopia Renzoku Satsujin Jiken, | |
| 4731 | 4731 | Uchuusen - Cosmo Carrier |
| 4732 | 4732 | |
| 4733 | 4733 | In MESS: Partially Supported. |
| r5931 | r5932 | |
| 4749 | 4749 | Mapper 79 |
| 4750 | 4750 | |
| 4751 | 4751 | Known Boards: NINA03, NINA06 by AVE |
| 4752 | Games: Krazy Kreatures, Poke Block, Puzzle, Pyramid, | |
| 4752 | Games: Krazy Kreatures, Poke Block, Puzzle, Pyramid, | |
| 4753 | 4753 | Solitaire, Ultimate League Soccer |
| 4754 | 4754 | |
| 4755 | 4755 | In MESS: Supported. |
| r5931 | r5932 | |
| 4772 | 4772 | Mapper 80 |
| 4773 | 4773 | |
| 4774 | 4774 | Known Boards: Taito X1-005 Ver. A |
| 4775 | Games: Bakushou!! Jinsei Gekijou 2, Kyonshiizu 2, Minelvaton | |
| 4775 | Games: Bakushou!! Jinsei Gekijou 2, Kyonshiizu 2, Minelvaton | |
| 4776 | 4776 | Saga, Taito Grand Prix |
| 4777 | 4777 | |
| 4778 | Registers are at 0x7ef0-0x7eff. first six ones choose chr | |
| 4779 | (2x2k + 4x1k) banks, the seventh sets NT mirroring, the | |
| 4778 | Registers are at 0x7ef0-0x7eff. first six ones choose chr | |
| 4779 | (2x2k + 4x1k) banks, the seventh sets NT mirroring, the | |
| 4780 | 4780 | remaining ones chose prg banks. |
| 4781 | 4781 | |
| 4782 | 4782 | In MESS: Supported. |
| r5931 | r5932 | |
| 4816 | 4816 | case 0x1ef6: |
| 4817 | 4817 | set_nt_mirroring((data & 0x01) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); |
| 4818 | 4818 | break; |
| 4819 | case 0x1efa: | |
| 4819 | case 0x1efa: | |
| 4820 | 4820 | case 0x1efb: |
| 4821 | 4821 | /* Switch 8k ROM at $8000 */ |
| 4822 | 4822 | prg8_89(space->machine, data); |
| 4823 | 4823 | break; |
| 4824 | case 0x1efc: | |
| 4824 | case 0x1efc: | |
| 4825 | 4825 | case 0x1efd: |
| 4826 | 4826 | /* Switch 8k ROM at $a000 */ |
| 4827 | 4827 | prg8_ab(space->machine, data); |
| 4828 | 4828 | break; |
| 4829 | case 0x1efe: | |
| 4829 | case 0x1efe: | |
| 4830 | 4830 | case 0x1eff: |
| 4831 | 4831 | /* Switch 8k ROM at $c000 */ |
| 4832 | 4832 | prg8_cd(space->machine, data); |
| r5931 | r5932 | |
| 4853 | 4853 | Mapper 82 |
| 4854 | 4854 | |
| 4855 | 4855 | Known Boards: Taito X1017 |
| 4856 | Games: Kyuukyoku Harikiri Koushien, Kyuukyoku Harikiri | |
| 4856 | Games: Kyuukyoku Harikiri Koushien, Kyuukyoku Harikiri | |
| 4857 | 4857 | Stadium, SD Keiji - Blader |
| 4858 | 4858 | |
| 4859 | 4859 | In MESS: Supported. |
| r5931 | r5932 | |
| 4933 | 4933 | Mapper 83 |
| 4934 | 4934 | |
| 4935 | 4935 | Known Boards: Unknown Multigame Bootleg Board |
| 4936 | Games: Dragon Ball Party, Fatal Fury 2, Street Blaster II | |
| 4936 | Games: Dragon Ball Party, Fatal Fury 2, Street Blaster II | |
| 4937 | 4937 | Pro, World Heroes 2 |
| 4938 | 4938 | |
| 4939 | 4939 | In MESS: Supported. |
| r5931 | r5932 | |
| 5065 | 5065 | /* Switch 8k bank at $8000 */ |
| 5066 | 5066 | prg8_89(space->machine, data); |
| 5067 | 5067 | break; |
| 5068 | case 0x0008: | |
| 5069 | case 0x0010: | |
| 5068 | case 0x0008: | |
| 5069 | case 0x0010: | |
| 5070 | 5070 | case 0x0018: |
| 5071 | 5071 | /* Switch 8k bank at $a000 */ |
| 5072 | 5072 | prg8_ab(space->machine, data); |
| r5931 | r5932 | |
| 5165 | 5165 | |
| 5166 | 5166 | Mapper 87 |
| 5167 | 5167 | |
| 5168 | Known Boards: Jaleco JF05, JF06, JF07, JF08, JF09, JF10 and | |
| 5168 | Known Boards: Jaleco JF05, JF06, JF07, JF08, JF09, JF10 and | |
| 5169 | 5169 | Discrete Logic Board |
| 5170 | Games: The Goonies, Hyper Olympics, Jajamaru no Daibouken, | |
| 5170 | Games: The Goonies, Hyper Olympics, Jajamaru no Daibouken, | |
| 5171 | 5171 | Legend of Kage, Twin Bee |
| 5172 | 5172 | |
| 5173 | 5173 | In MESS: Supported. |
| r5931 | r5932 | |
| 5251 | 5251 | Known Boards: Type A by J.Y. Company |
| 5252 | 5252 | Games: Aladdin, Final Fight 3, Super Mario World, Tekken 2 |
| 5253 | 5253 | |
| 5254 | In MESS: Unsupported. | |
| 5254 | In MESS: Unsupported. | |
| 5255 | 5255 | |
| 5256 | 5256 | *************************************************************/ |
| 5257 | 5257 | |
| r5931 | r5932 | |
| 5260 | 5260 | Mapper 91 |
| 5261 | 5261 | |
| 5262 | 5262 | Known Boards: Unknown Bootleg Board |
| 5263 | Games: Mortal Kombat II, Street Fighter III, Super Mario | |
| 5263 | Games: Mortal Kombat II, Street Fighter III, Super Mario | |
| 5264 | 5264 | Kart Rider |
| 5265 | 5265 | |
| 5266 | 5266 | In MESS: Partially supported. |
| r5931 | r5932 | |
| 5365 | 5365 | Known Boards: Namcot 3425 |
| 5366 | 5366 | Games: Dragon Buster |
| 5367 | 5367 | |
| 5368 | Quite similar to other Namco boards, but with a peculiar | |
| 5368 | Quite similar to other Namco boards, but with a peculiar | |
| 5369 | 5369 | NT mirroring. |
| 5370 | 5370 | |
| 5371 | 5371 | In MESS: Supported. |
| r5931 | r5932 | |
| 5389 | 5389 | { |
| 5390 | 5390 | switch (mmc_cmd1 & 0x07) |
| 5391 | 5391 | { |
| 5392 | case 0: | |
| 5393 | case 1: | |
| 5392 | case 0: | |
| 5393 | case 1: | |
| 5394 | 5394 | chr2_x(space->machine, mmc_cmd1 ? 2 : 0, (data >> 1) & 0x1f, CHRROM); |
| 5395 | 5395 | break; |
| 5396 | case 2: | |
| 5397 | case 3: | |
| 5398 | case 4: | |
| 5399 | case 5: | |
| 5396 | case 2: | |
| 5397 | case 3: | |
| 5398 | case 4: | |
| 5399 | case 5: | |
| 5400 | 5400 | chr1_x(space->machine, 2 + mmc_cmd1, data & 0x1f, CHRROM); |
| 5401 | 5401 | map95_reg[mmc_cmd1 - 2] = data & 0x20; |
| 5402 | 5402 | if (!(mmc_cmd1 & 0x80)) |
| r5931 | r5932 | |
| 5409 | 5409 | else |
| 5410 | 5410 | set_nt_mirroring(PPU_MIRROR_HORZ); |
| 5411 | 5411 | break; |
| 5412 | case 6: | |
| 5413 | prg8_89(space->machine,data & 0x1f); | |
| 5412 | case 6: | |
| 5413 | prg8_89(space->machine,data & 0x1f); | |
| 5414 | 5414 | break; |
| 5415 | case 7: | |
| 5415 | case 7: | |
| 5416 | 5416 | prg8_ab(space->machine,data & 0x1f); |
| 5417 | 5417 | break; |
| 5418 | 5418 | } |
| r5931 | r5932 | |
| 5426 | 5426 | Mapper 96 |
| 5427 | 5427 | |
| 5428 | 5428 | Known Boards: Bandai Oeka Kids Board |
| 5429 | Games: Oeka Kids - Anpanman no Hiragana Daisuki, Oeka | |
| 5429 | Games: Oeka Kids - Anpanman no Hiragana Daisuki, Oeka | |
| 5430 | 5430 | Kids - Anpanman to Oekaki Shiyou!! |
| 5431 | 5431 | |
| 5432 | 5432 | In MESS: Preliminary Support. |
| r5931 | r5932 | |
| 5549 | 5549 | Known Boards: Camerica Golden Five |
| 5550 | 5550 | Games: Pegasus 5 in 1 |
| 5551 | 5551 | |
| 5552 | In MESS: Supported. | |
| 5552 | In MESS: Supported. | |
| 5553 | 5553 | |
| 5554 | 5554 | *************************************************************/ |
| 5555 | 5555 | |
| r5931 | r5932 | |
| 5565 | 5565 | prg16_89ab(space->machine, mmc_bank_latch1); |
| 5566 | 5566 | prg16_cdef(space->machine, ((data & 0x07) << 4) | 0x0f); |
| 5567 | 5567 | } |
| 5568 | ||
| 5568 | ||
| 5569 | 5569 | } |
| 5570 | 5570 | else |
| 5571 | 5571 | { |
| r5931 | r5932 | |
| 5581 | 5581 | Known Boards: Custom Board |
| 5582 | 5582 | Games: Nintendo World Championships 1990 |
| 5583 | 5583 | |
| 5584 | In MESS: Unsupported. | |
| 5584 | In MESS: Unsupported. | |
| 5585 | 5585 | |
| 5586 | 5586 | *************************************************************/ |
| 5587 | 5587 | |
| r5931 | r5932 | |
| 5592 | 5592 | Known Boards: Unknown Bootleg Board |
| 5593 | 5593 | Games: Super Mario Bros. 3 Pirate |
| 5594 | 5594 | |
| 5595 | In MESS: Unsupported. | |
| 5595 | In MESS: Unsupported. | |
| 5596 | 5596 | |
| 5597 | 5597 | *************************************************************/ |
| 5598 | 5598 | |
| r5931 | r5932 | |
| 5663 | 5663 | |
| 5664 | 5664 | No info avaliable |
| 5665 | 5665 | |
| 5666 | In MESS: Unsupported. | |
| 5666 | In MESS: Unsupported. | |
| 5667 | 5667 | |
| 5668 | 5668 | *************************************************************/ |
| 5669 | 5669 | |
| r5931 | r5932 | |
| 5672 | 5672 | Mapper 112 |
| 5673 | 5673 | |
| 5674 | 5674 | Known Boards: Bootleg Board NTDEC ASDER |
| 5675 | Games: Cobra Mission, Fighting Hero III, Huang Di, Master | |
| 5675 | Games: Cobra Mission, Fighting Hero III, Huang Di, Master | |
| 5676 | 5676 | Shooter |
| 5677 | 5677 | |
| 5678 | 5678 | In MESS: Supported. |
| r5931 | r5932 | |
| 5732 | 5732 | Mapper 113 |
| 5733 | 5733 | |
| 5734 | 5734 | Known Boards: Bootleg Board by HES (also used by others) |
| 5735 | Games: AV Hanafuda Club, AV Soccer, Papillon, Sidewinder, | |
| 5735 | Games: AV Hanafuda Club, AV Soccer, Papillon, Sidewinder, | |
| 5736 | 5736 | Total Funpack |
| 5737 | 5737 | |
| 5738 | 5738 | In MESS: Supported. |
| r5931 | r5932 | |
| 5759 | 5759 | |
| 5760 | 5760 | MMC3 clone |
| 5761 | 5761 | |
| 5762 | In MESS: Unsupported. | |
| 5762 | In MESS: Unsupported. | |
| 5763 | 5763 | |
| 5764 | 5764 | *************************************************************/ |
| 5765 | 5765 | |
| r5931 | r5932 | |
| 5767 | 5767 | |
| 5768 | 5768 | Mapper 115 (formerly 248) |
| 5769 | 5769 | |
| 5770 | Known Boards: Unknown Bootleg Board by Kasing | |
| 5771 | Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2, | |
| 5770 | Known Boards: Unknown Bootleg Board by Kasing | |
| 5771 | Games: AV Jiu Ji Mahjong, Bao Qing Tian, Thunderbolt 2, | |
| 5772 | 5772 | Shisen Mahjong 2 |
| 5773 | 5773 | |
| 5774 | 5774 | MMC3 clone |
| r5931 | r5932 | |
| 5871 | 5871 | |
| 5872 | 5872 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 5873 | 5873 | { |
| 5874 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, | |
| 5874 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, | |
| 5875 | 5875 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 5876 | 5876 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 5877 | 5877 | } |
| r5931 | r5932 | |
| 5885 | 5885 | Known Boards: Unknown Bootleg Board (Someri?!?) |
| 5886 | 5886 | Games: AV Mei Shao Nv Zhan Shi, Chuugoku Taitei |
| 5887 | 5887 | |
| 5888 | In MESS: Unsupported. | |
| 5888 | In MESS: Unsupported. | |
| 5889 | 5889 | |
| 5890 | 5890 | *************************************************************/ |
| 5891 | 5891 | |
| r5931 | r5932 | |
| 5896 | 5896 | Known Boards: Bootleg Board by Future Media |
| 5897 | 5897 | Games: Crayon Shin-chan (C), San Guo Zhi 4 - Chi Bi Feng Yun |
| 5898 | 5898 | |
| 5899 | In MESS: Unsupported. | |
| 5899 | In MESS: Unsupported. | |
| 5900 | 5900 | |
| 5901 | 5901 | *************************************************************/ |
| 5902 | 5902 | |
| r5931 | r5932 | |
| 5905 | 5905 | Mapper 118 |
| 5906 | 5906 | |
| 5907 | 5907 | Known Boards: TKSROM, TLSROM |
| 5908 | Games: Armadillo, Play Action Football, Pro Hockey, RPG | |
| 5908 | Games: Armadillo, Play Action Football, Pro Hockey, RPG | |
| 5909 | 5909 | Jinsei Game, Y's 3 |
| 5910 | 5910 | |
| 5911 | 5911 | In MESS: Supported. It also uses mapper4_irq. |
| r5931 | r5932 | |
| 6149 | 6149 | Known Boards: Unknown Bootleg Board |
| 6150 | 6150 | Games: Tobidase Daisakusen (FDS Conversion) |
| 6151 | 6151 | |
| 6152 | In MESS: Unsupported. | |
| 6152 | In MESS: Unsupported. | |
| 6153 | 6153 | |
| 6154 | 6154 | *************************************************************/ |
| 6155 | 6155 | |
| r5931 | r5932 | |
| 6162 | 6162 | |
| 6163 | 6163 | MMC3 clone |
| 6164 | 6164 | |
| 6165 | In MESS: Unsupported. | |
| 6165 | In MESS: Unsupported. | |
| 6166 | 6166 | |
| 6167 | 6167 | *************************************************************/ |
| 6168 | 6168 | |
| r5931 | r5932 | |
| 6184 | 6184 | Known Boards: Bootleg Board ??? |
| 6185 | 6185 | Games: [no games in nes.hsi] |
| 6186 | 6186 | |
| 6187 | In MESS: Unsupported. | |
| 6187 | In MESS: Unsupported. | |
| 6188 | 6188 | |
| 6189 | 6189 | *************************************************************/ |
| 6190 | 6190 | |
| r5931 | r5932 | |
| 6217 | 6217 | Known Boards: Unknown Multigame Bootleg Board |
| 6218 | 6218 | Games: [no games in nes.hsi] |
| 6219 | 6219 | |
| 6220 | In MESS: Unsupported. | |
| 6220 | In MESS: Unsupported. | |
| 6221 | 6221 | |
| 6222 | 6222 | *************************************************************/ |
| 6223 | 6223 | |
| r5931 | r5932 | |
| 6283 | 6283 | Known Boards: Bootleg Board by TXC (T22211A) |
| 6284 | 6284 | Games: Creatom |
| 6285 | 6285 | |
| 6286 | Info from NEStopia: this mapper features write to four | |
| 6287 | registers (0x4100-0x4103). The third one is used to select | |
| 6286 | Info from NEStopia: this mapper features write to four | |
| 6287 | registers (0x4100-0x4103). The third one is used to select | |
| 6288 | 6288 | PRG and CHR banks. |
| 6289 | 6289 | |
| 6290 | In MESS: Supported. | |
| 6290 | In MESS: Supported. | |
| 6291 | 6291 | |
| 6292 | 6292 | *************************************************************/ |
| 6293 | 6293 | |
| r5931 | r5932 | |
| 6308 | 6308 | if (offset == 0x0000) |
| 6309 | 6309 | return (txc_reg[1] ^ txc_reg[2]) | 0x40; |
| 6310 | 6310 | |
| 6311 | else | |
| 6311 | else | |
| 6312 | 6312 | return 0x00; |
| 6313 | 6313 | } |
| 6314 | 6314 | |
| r5931 | r5932 | |
| 6348 | 6348 | |
| 6349 | 6349 | MMC3 clone |
| 6350 | 6350 | |
| 6351 | In MESS: Unsupported. | |
| 6351 | In MESS: Unsupported. | |
| 6352 | 6352 | |
| 6353 | 6353 | *************************************************************/ |
| 6354 | 6354 | |
| r5931 | r5932 | |
| 6435 | 6435 | { |
| 6436 | 6436 | LOG_MMC(("mapper137_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6437 | 6437 | |
| 6438 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6439 | but 0x4100 is offset = 0 */ | |
| 6438 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6439 | but 0x4100 is offset = 0 */ | |
| 6440 | 6440 | if (!(offset & 0x100)) |
| 6441 | 6441 | { |
| 6442 | 6442 | if (!(offset & 0x01)) |
| r5931 | r5932 | |
| 6490 | 6490 | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6491 | 6491 | LOG_MMC(("mapper138_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6492 | 6492 | |
| 6493 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6494 | but 0x4100 is offset = 0 */ | |
| 6493 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6494 | but 0x4100 is offset = 0 */ | |
| 6495 | 6495 | if (!(offset & 0x100)) |
| 6496 | 6496 | { |
| 6497 | 6497 | if (!(offset & 0x01)) |
| r5931 | r5932 | |
| 6499 | 6499 | else |
| 6500 | 6500 | { |
| 6501 | 6501 | sachen_regs[mmc_cmd1] = data; |
| 6502 | ||
| 6502 | ||
| 6503 | 6503 | switch (mmc_cmd1) |
| 6504 | 6504 | { |
| 6505 | 6505 | case 0x05: |
| r5931 | r5932 | |
| 6547 | 6547 | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6548 | 6548 | LOG_MMC(("mapper139_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6549 | 6549 | |
| 6550 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6551 | but 0x4100 is offset = 0 */ | |
| 6550 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6551 | but 0x4100 is offset = 0 */ | |
| 6552 | 6552 | if (!(offset & 0x100)) |
| 6553 | 6553 | { |
| 6554 | 6554 | if (!(offset & 0x01)) |
| r5931 | r5932 | |
| 6556 | 6556 | else |
| 6557 | 6557 | { |
| 6558 | 6558 | sachen_regs[mmc_cmd1] = data; |
| 6559 | ||
| 6559 | ||
| 6560 | 6560 | switch (mmc_cmd1) |
| 6561 | 6561 | { |
| 6562 | 6562 | case 0x05: |
| r5931 | r5932 | |
| 6570 | 6570 | { |
| 6571 | 6571 | bank_helper1 = sachen_regs[7] & 0x01; |
| 6572 | 6572 | bank_helper2 = (sachen_regs[4] & 0x07) << 3; |
| 6573 | chr2_0(space->machine, ((sachen_regs[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << 2, CHRROM); | |
| 6573 | chr2_0(space->machine, ((sachen_regs[bank_helper1 ? 0 : 0] & 0x07) | bank_helper2) << 2, CHRROM); | |
| 6574 | 6574 | chr2_2(space->machine, ((sachen_regs[bank_helper1 ? 0 : 1] & 0x07) | bank_helper2) << 2 | 0x01, CHRROM); |
| 6575 | 6575 | chr2_4(space->machine, ((sachen_regs[bank_helper1 ? 0 : 2] & 0x07) | bank_helper2) << 2 | 0x02, CHRROM) ; |
| 6576 | 6576 | chr2_6(space->machine, ((sachen_regs[bank_helper1 ? 0 : 3] & 0x07) | bank_helper2) << 2 | 0x03, CHRROM); |
| r5931 | r5932 | |
| 6612 | 6612 | Mapper 141 |
| 6613 | 6613 | |
| 6614 | 6614 | Known Boards: Bootleg Board by Sachen (8259A) |
| 6615 | Games: Po Po Team, Poker Mahjong, Q Boy, Rockball, | |
| 6615 | Games: Po Po Team, Poker Mahjong, Q Boy, Rockball, | |
| 6616 | 6616 | Super Cartridge (several versions), Super Pang (1 & 2) |
| 6617 | 6617 | |
| 6618 | 6618 | In MESS: Supported. |
| r5931 | r5932 | |
| 6624 | 6624 | UINT8 bank_helper1 = 0, bank_helper2 = 0; |
| 6625 | 6625 | LOG_MMC(("mapper141_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6626 | 6626 | |
| 6627 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6628 | but 0x4100 is offset = 0 */ | |
| 6627 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6628 | but 0x4100 is offset = 0 */ | |
| 6629 | 6629 | if (!(offset & 0x100)) |
| 6630 | 6630 | { |
| 6631 | 6631 | if (!(offset & 0x01)) |
| r5931 | r5932 | |
| 6691 | 6691 | { |
| 6692 | 6692 | LOG_MMC(("mapper143_l_r, offset: %04x\n", offset)); |
| 6693 | 6693 | |
| 6694 | /* the address is read only if we are at 0x4100 + k * 0x200, | |
| 6695 | but 0x4100 is offset = 0 */ | |
| 6694 | /* the address is read only if we are at 0x4100 + k * 0x200, | |
| 6695 | but 0x4100 is offset = 0 */ | |
| 6696 | 6696 | if (!(offset & 0x100)) |
| 6697 | 6697 | return (~offset & 0x3f) | 0x40; |
| 6698 | 6698 | else |
| r5931 | r5932 | |
| 6706 | 6706 | Known Boards: Bootleg Board by AGCI (50282) |
| 6707 | 6707 | Games: Death Race |
| 6708 | 6708 | |
| 6709 | Just like mapper 11, except bit 0 taken from ROM and 0x8000 | |
| 6709 | Just like mapper 11, except bit 0 taken from ROM and 0x8000 | |
| 6710 | 6710 | ignored? |
| 6711 | 6711 | |
| 6712 | 6712 | In MESS: Supported. |
| r5931 | r5932 | |
| 6756 | 6756 | Mapper 146 |
| 6757 | 6757 | |
| 6758 | 6758 | Known Boards: Bootleg Board by Sachen (SA0161M) |
| 6759 | Games: Galactic Crusader, Lucky 777, Metal Fighter, | |
| 6759 | Games: Galactic Crusader, Lucky 777, Metal Fighter, | |
| 6760 | 6760 | Millionaire, Pyramid II |
| 6761 | 6761 | |
| 6762 | 6762 | This is basically the same as Nina-006 (Mapper 79) |
| r5931 | r5932 | |
| 6810 | 6810 | Known Boards: Bootleg Board by Sachen (SA0037) |
| 6811 | 6811 | Games: Mahjong World, Shisen Mahjong |
| 6812 | 6812 | |
| 6813 | Very simple mapper: writes to 0x8000-0xffff set pgr32 and chr8 | |
| 6813 | Very simple mapper: writes to 0x8000-0xffff set pgr32 and chr8 | |
| 6814 | 6814 | banks |
| 6815 | 6815 | |
| 6816 | 6816 | In MESS: Supported. |
| r5931 | r5932 | |
| 6850 | 6850 | Mapper 150 |
| 6851 | 6851 | |
| 6852 | 6852 | Known Boards: Bootleg Board by Sachen (74SL374B) |
| 6853 | Games: Chess Academy, Chinese Checkers Jpn, Mahjong Academy, | |
| 6853 | Games: Chess Academy, Chinese Checkers Jpn, Mahjong Academy, | |
| 6854 | 6854 | Olympic IQ, Poker II, Tasac |
| 6855 | 6855 | |
| 6856 | 6856 | Still investigating this mapper... |
| r5931 | r5932 | |
| 6863 | 6863 | { |
| 6864 | 6864 | LOG_MMC(("mapper150_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 6865 | 6865 | |
| 6866 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6867 | but 0x4100 is offset = 0 */ | |
| 6866 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 6867 | but 0x4100 is offset = 0 */ | |
| 6868 | 6868 | if (!(offset & 0x100)) |
| 6869 | 6869 | { |
| 6870 | 6870 | if (!(offset & 0x01)) |
| r5931 | r5932 | |
| 6900 | 6900 | { |
| 6901 | 6901 | LOG_MMC(("mapper150_l_r, offset: %04x", offset)); |
| 6902 | 6902 | |
| 6903 | /* read happens only if we are at 0x4100 + k * 0x200, | |
| 6904 | but 0x4100 is offset = 0 */ | |
| 6903 | /* read happens only if we are at 0x4100 + k * 0x200, | |
| 6904 | but 0x4100 is offset = 0 */ | |
| 6905 | 6905 | if (!(offset & 0x100)) |
| 6906 | 6906 | return (~mmc_cmd1 & 0x3f) /* ^ dips*/; // we would need to check the Dips here |
| 6907 | else | |
| 6907 | else | |
| 6908 | 6908 | return 0; |
| 6909 | 6909 | } |
| 6910 | 6910 | |
| r5931 | r5932 | |
| 6952 | 6952 | Mapper 153 |
| 6953 | 6953 | |
| 6954 | 6954 | Known Boards: Bandai Board |
| 6955 | Games: Dragon Ball, Dragon Ball 3, Famicom Jump, Famicom | |
| 6955 | Games: Dragon Ball, Dragon Ball 3, Famicom Jump, Famicom | |
| 6956 | 6956 | Jump II |
| 6957 | 6957 | |
| 6958 | 6958 | In MESS: Unsupported. |
| r5931 | r5932 | |
| 7063 | 7063 | |
| 7064 | 7064 | Mapper 157 |
| 7065 | 7065 | |
| 7066 | Known Boards: Bandai Datach Board | |
| 7066 | Known Boards: Bandai Datach Board | |
| 7067 | 7067 | Games: Datach Games |
| 7068 | 7068 | |
| 7069 | 7069 | In MESS: Unsupported. Needs reads from 0x6000-0x7fff for the |
| r5931 | r5932 | |
| 7131 | 7131 | Mapper 163 |
| 7132 | 7132 | |
| 7133 | 7133 | Known Boards: Bootleg Board by Nanjing |
| 7134 | Games: Diablo, Final Fantasy VII, Harvest Moon, He Xin Wei | |
| 7134 | Games: Diablo, Final Fantasy VII, Harvest Moon, He Xin Wei | |
| 7135 | 7135 | Ji, Yu-Gi-Oh, Zelda - Shen Qi De Mao Zi and other |
| 7136 | 7136 | |
| 7137 | 7137 | In MESS: Unsupported. |
| r5931 | r5932 | |
| 7143 | 7143 | Mapper 164 |
| 7144 | 7144 | |
| 7145 | 7145 | Known Boards: Bootleg Board by Waixing |
| 7146 | Games: Darkseed, Digital Dragon, Final Fantasy V, Pocket | |
| 7146 | Games: Darkseed, Digital Dragon, Final Fantasy V, Pocket | |
| 7147 | 7147 | Monster Red |
| 7148 | 7148 | |
| 7149 | 7149 | In MESS: Supported. |
| r5931 | r5932 | |
| 7409 | 7409 | Known Boards: Unknown Bootleg Board |
| 7410 | 7410 | Games: Shu Qi Yu - Zhi Li Xiao Zhuan Yuan |
| 7411 | 7411 | |
| 7412 | Very simple mapper: writes to 0x5ff1 set prg32 (to data>>1), | |
| 7412 | Very simple mapper: writes to 0x5ff1 set prg32 (to data>>1), | |
| 7413 | 7413 | while writes to 0x5ff2 set chr8 |
| 7414 | 7414 | |
| 7415 | 7415 | In MESS: Supported. |
| r5931 | r5932 | |
| 7436 | 7436 | Mapper 177 |
| 7437 | 7437 | |
| 7438 | 7438 | Known Boards: Bootleg Board by Henggedianzi |
| 7439 | Games: Mei Guo Fu Hao, Shang Gu Shen Jian , Wang Zi Fu | |
| 7439 | Games: Mei Guo Fu Hao, Shang Gu Shen Jian , Wang Zi Fu | |
| 7440 | 7440 | Chou Ji, Xing He Zhan Shi |
| 7441 | 7441 | |
| 7442 | 7442 | Writes to 0x8000-0xffff set prg32. Moreover, data&0x20 sets |
| r5931 | r5932 | |
| 7459 | 7459 | Mapper 178 |
| 7460 | 7460 | |
| 7461 | 7461 | Known Boards: Bootleg Board by Waixing |
| 7462 | Games: Fan Kong Jing Ying, San Guo Zhong Lie Zhuan, Xing | |
| 7462 | Games: Fan Kong Jing Ying, San Guo Zhong Lie Zhuan, Xing | |
| 7463 | 7463 | Ji Zheng Ba |
| 7464 | 7464 | |
| 7465 | 7465 | In MESS: Supported. |
| r5931 | r5932 | |
| 7621 | 7621 | |
| 7622 | 7622 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 7623 | 7623 | { |
| 7624 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, | |
| 7624 | LOG_MMC(("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, | |
| 7625 | 7625 | video_screen_get_vpos(device->machine->primary_screen), video_screen_get_hpos(device->machine->primary_screen))); |
| 7626 | 7626 | cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, HOLD_LINE); |
| 7627 | 7627 | } |
| r5931 | r5932 | |
| 7644 | 7644 | Mapper 184 |
| 7645 | 7645 | |
| 7646 | 7646 | Known Boards: Sunsoft 1 |
| 7647 | Games: Atlantis no Nazo, Kanshakudama Nage Kantarou no | |
| 7647 | Games: Atlantis no Nazo, Kanshakudama Nage Kantarou no | |
| 7648 | 7648 | Toukaidou Gojuusan Tsugi, Wing of Madoola |
| 7649 | 7649 | |
| 7650 | 7650 | Very simple mapper: writes to 0x6000-0x7fff set chr banks |
| r5931 | r5932 | |
| 7819 | 7819 | Mapper 195 |
| 7820 | 7820 | |
| 7821 | 7821 | Known Boards: Type E by Waixing |
| 7822 | Games: Captain Tsubasa Vol. II (C), Chaos World, God | |
| 7822 | Games: Captain Tsubasa Vol. II (C), Chaos World, God | |
| 7823 | 7823 | Slayer (C), Zu Qiu Xiao Jiang |
| 7824 | 7824 | |
| 7825 | 7825 | MMC3 clone |
| r5931 | r5932 | |
| 7835 | 7835 | Known Boards: Unknown Bootleg Board |
| 7836 | 7836 | Games: Super Mario Bros. 11, Super Mario Bros. 17 |
| 7837 | 7837 | |
| 7838 | This acts basically like a MMC3 with different use of write | |
| 7839 | address. | |
| 7838 | This acts basically like a MMC3 with different use of write | |
| 7839 | address. | |
| 7840 | 7840 | |
| 7841 | 7841 | In MESS: Supported. |
| 7842 | 7842 | |
| r5931 | r5932 | |
| 7908 | 7908 | Mapper 199 |
| 7909 | 7909 | |
| 7910 | 7910 | Known Boards: Type G by Waixing |
| 7911 | Games: San Guo Zhi 2, Dragon Ball Z Gaiden (C), Dragon | |
| 7911 | Games: San Guo Zhi 2, Dragon Ball Z Gaiden (C), Dragon | |
| 7912 | 7912 | Ball Z II (C) |
| 7913 | 7913 | |
| 7914 | 7914 | MMC3 clone |
| r5931 | r5932 | |
| 8043 | 8043 | |
| 8044 | 8044 | Mapper 206 |
| 8045 | 8045 | |
| 8046 | Known Boards: Namcot 34x3 boards, DEROM, DE1ROM, DRROM and | |
| 8046 | Known Boards: Namcot 34x3 boards, DEROM, DE1ROM, DRROM and | |
| 8047 | 8047 | Tengen 800002, 800004, 800030 boards |
| 8048 | Games: Babel no Tou, Dragon Buster II, Family Circuit, | |
| 8049 | Family Tennis, Fantasy Zone, Gauntlet, Karnov, | |
| 8048 | Games: Babel no Tou, Dragon Buster II, Family Circuit, | |
| 8049 | Family Tennis, Fantasy Zone, Gauntlet, Karnov, | |
| 8050 | 8050 | Mappy Land, Pac-Mania, R.B.I. Baseball, Super Sprint |
| 8051 | 8051 | |
| 8052 | 8052 | In MESS: Supported. |
| r5931 | r5932 | |
| 8109 | 8109 | /* Switch 1k VROM at $1c00 */ |
| 8110 | 8110 | chr1_7(space->machine, data, CHRROM); |
| 8111 | 8111 | break; |
| 8112 | case 0x1efa: | |
| 8112 | case 0x1efa: | |
| 8113 | 8113 | case 0x1efb: |
| 8114 | 8114 | /* Switch 8k ROM at $8000 */ |
| 8115 | 8115 | prg8_89(space->machine, data); |
| 8116 | 8116 | break; |
| 8117 | case 0x1efc: | |
| 8117 | case 0x1efc: | |
| 8118 | 8118 | case 0x1efd: |
| 8119 | 8119 | /* Switch 8k ROM at $a000 */ |
| 8120 | 8120 | prg8_ab(space->machine, data); |
| 8121 | 8121 | break; |
| 8122 | case 0x1efe: | |
| 8122 | case 0x1efe: | |
| 8123 | 8123 | case 0x1eff: |
| 8124 | 8124 | /* Switch 8k ROM at $c000 */ |
| 8125 | 8125 | prg8_cd(space->machine, data); |
| r5931 | r5932 | |
| 8148 | 8148 | Mapper 209 |
| 8149 | 8149 | |
| 8150 | 8150 | Known Boards: Type B by J.Y. Company |
| 8151 | Games: Power Rangers 3, Power Rangers 4, Shin Samurai | |
| 8151 | Games: Power Rangers 3, Power Rangers 4, Shin Samurai | |
| 8152 | 8152 | Spirits 2 |
| 8153 | 8153 | |
| 8154 | 8154 | In MESS: Unsupported. |
| r5931 | r5932 | |
| 8398 | 8398 | |
| 8399 | 8399 | MMC3 clone according to NEStopia |
| 8400 | 8400 | |
| 8401 | In MESS: Unsupported. | |
| 8401 | In MESS: Unsupported. | |
| 8402 | 8402 | |
| 8403 | 8403 | *************************************************************/ |
| 8404 | 8404 | |
| r5931 | r5932 | |
| 8820 | 8820 | Known Boards: Bootleg Board by C&E |
| 8821 | 8821 | Games: Jing Ke Xin Zhuan, Sheng Huo Lie Zhuan |
| 8822 | 8822 | |
| 8823 | Simple Mapper: writes to 0x4020-0x5fff sets prg32 to | |
| 8823 | Simple Mapper: writes to 0x4020-0x5fff sets prg32 to | |
| 8824 | 8824 | data>>4 and chr8 to data&f. We currently do not map |
| 8825 | writes to 0x4020-0x40ff (to do: verify if this produces | |
| 8825 | writes to 0x4020-0x40ff (to do: verify if this produces | |
| 8826 | 8826 | issues) |
| 8827 | 8827 | |
| 8828 | 8828 | In MESS: Supported. |
| r5931 | r5932 | |
| 8842 | 8842 | Mapper 241 |
| 8843 | 8843 | |
| 8844 | 8844 | Known Boards: Bootleg Board by TXC |
| 8845 | Games: Commandos, Journey to the West, Ma Bu Mi Zhen & | |
| 8845 | Games: Commandos, Journey to the West, Ma Bu Mi Zhen & | |
| 8846 | 8846 | Qu Wei Cheng Yu Wu, Si Lu Chuan Qi |
| 8847 | 8847 | |
| 8848 | 8848 | Simple Mapper: writes to 0x8000-0xffff sets the prg32 bank. |
| r5931 | r5932 | |
| 8872 | 8872 | Games: Wai Xing Zhan Shi, Dragon Quest VIII |
| 8873 | 8873 | |
| 8874 | 8874 | Simple mapper: writes to 0x8000-0xffff sets prg32 banks to |
| 8875 | (offset>>3)&f. written data&3 sets the mirroring (with | |
| 8876 | switched high/low compared to the standard one). However, | |
| 8877 | a second variant DQ7 and requires no NT mirroring. | |
| 8875 | (offset>>3)&f. written data&3 sets the mirroring (with | |
| 8876 | switched high/low compared to the standard one). However, | |
| 8877 | a second variant DQ7 and requires no NT mirroring. | |
| 8878 | 8878 | Currently, we do not support this variant. |
| 8879 | 8879 | |
| 8880 | 8880 | In MESS: Partial Support. |
| r5931 | r5932 | |
| 8908 | 8908 | { |
| 8909 | 8909 | LOG_MMC(("mapper243_l_w, offset: %04x, data: %02x\n", offset, data)); |
| 8910 | 8910 | |
| 8911 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 8912 | but 0x4100 is offset = 0 */ | |
| 8911 | /* write happens only if we are at 0x4100 + k * 0x200, | |
| 8912 | but 0x4100 is offset = 0 */ | |
| 8913 | 8913 | if (!(offset & 0x100)) |
| 8914 | 8914 | { |
| 8915 | 8915 | if (!(offset & 0x01)) |
| r5931 | r5932 | |
| 8996 | 8996 | Games: Fong Shen Bang - Zhu Lu Zhi Zhan |
| 8997 | 8997 | |
| 8998 | 8998 | Simple mapper: writes to 0x6000-0x67ff set PRG and CHR banks. |
| 8999 | Namely, 0x6000->0x6003 select resp. prg8_89, prg8_ab, prg8_cd | |
| 8999 | Namely, 0x6000->0x6003 select resp. prg8_89, prg8_ab, prg8_cd | |
| 9000 | 9000 | and prg8_ef. 0x6004->0x6007 select resp. crh2_0, chr2_2, |
| 9001 | 9001 | chr2_4 and chr2_6. In 0x6800-0x7fff lies WRAM. |
| 9002 | 9002 | |
| r5931 | r5932 | |
| 9070 | 9070 | |
| 9071 | 9071 | Known Boards: Waixing Security 0 & 1 |
| 9072 | 9072 | Games: Duo Bao Xiao Ying Hao - Guang Ming yu An Hei Chuan Shuo, |
| 9073 | Myth Struggle, San Shi Liu Ji, Shui Hu Zhuan | |
| 9073 | Myth Struggle, San Shi Liu Ji, Shui Hu Zhuan | |
| 9074 | 9074 | |
| 9075 | 9075 | MMC3 clone |
| 9076 | 9076 | |
| r5931 | r5932 | |
| 9083 | 9083 | Mapper 250 |
| 9084 | 9084 | |
| 9085 | 9085 | Known Boards: Unknown Bootleg Board by Nitra |
| 9086 | Games: Time Diver Avenger | |
| 9086 | Games: Time Diver Avenger | |
| 9087 | 9087 | |
| 9088 | This acts basically like a MMC3 with different use of write | |
| 9088 | This acts basically like a MMC3 with different use of write | |
| 9089 | 9089 | address. According to NEStopia, there is also a slightly |
| 9090 | 9090 | different way to set NT mirroring (see below). |
| 9091 | 9091 | |
| r5931 | r5932 | |
| 9113 | 9113 | Mapper 251 |
| 9114 | 9114 | |
| 9115 | 9115 | Known Boards: Undocumented |
| 9116 | Games: Super 8-in-1 99 King Fighter | |
| 9116 | Games: Super 8-in-1 99 King Fighter | |
| 9117 | 9117 | |
| 9118 | 9118 | In MESS: Unsupported. |
| 9119 | 9119 | |
| r5931 | r5932 | |
| 9575 | 9575 | mmc_cmd1 = 0; |
| 9576 | 9576 | prg16_89ab(space->machine, 0); |
| 9577 | 9577 | prg16_cdef(space->machine, nes.prg_chunks - 1); |
| 9578 | // | |
| 9578 | // set_nt_mirroring(PPU_MIRROR_HIGH); // this would be needed for Major League | |
| 9579 | 9579 | break; |
| 9580 | 9580 | case 24: |
| 9581 | 9581 | case 26: |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | multcart.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Multi-cartridge handling code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | snapquik.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Snapshots and quickloads | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cococart.h | |
| 4 | 4 | |
| 5 | ||
| 5 | CoCo/Dragon cartridge management | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | Code to interface the MESS image code with MAME's harddisk core. | |
| 4 | 4 | |
| 5 | We do not support diff files as it will involve some changes in | |
| 6 | the MESS image code. Additionally, the need for diff files comes | |
| 7 | from MAME's need for "cannonical" hard drive images. | |
| 5 | We do not support diff files as it will involve some changes in | |
| 6 | the MESS image code. Additionally, the need for diff files comes | |
| 7 | from MAME's need for "cannonical" hard drive images. | |
| 8 | 8 | |
| 9 | ||
| 9 | Raphael Nabet 2003 | |
| 10 | 10 | |
| 11 | Update: 23-Feb-2004 - Unlike floppy disks, for which we support | |
| 12 | myriad formats on many systems, it is my intention for MESS to | |
| 13 | standardize on the CHD file format for hard drives so I made a few | |
| 14 | changes to support this | |
| 11 | Update: 23-Feb-2004 - Unlike floppy disks, for which we support | |
| 12 | myriad formats on many systems, it is my intention for MESS to | |
| 13 | standardize on the CHD file format for hard drives so I made a few | |
| 14 | changes to support this | |
| 15 | 15 | |
| 16 | 16 | *********************************************************************/ |
| 17 | 17 | |
| r5931 | r5932 | |
| 88 | 88 | |
| 89 | 89 | /************************************* |
| 90 | 90 | * |
| 91 | * | |
| 91 | * DEVICE_IMAGE_LOAD(mess_hd) | |
| 92 | 92 | * DEVICE_IMAGE_CREATE(mess_hd) |
| 93 | 93 | * |
| 94 | * | |
| 94 | * Device load and create | |
| 95 | 95 | * |
| 96 | 96 | *************************************/ |
| 97 | 97 | |
| r5931 | r5932 | |
| 109 | 109 | err = chd_open_file(image_core_file(image), is_writeable ? CHD_OPEN_READWRITE : CHD_OPEN_READ, NULL, &harddisk->chd); |
| 110 | 110 | |
| 111 | 111 | /* special case; if we get CHDERR_FILE_NOT_WRITEABLE, make the |
| 112 | ||
| 112 | * image read only and repeat */ | |
| 113 | 113 | if (err == CHDERR_FILE_NOT_WRITEABLE) |
| 114 | 114 | image_make_readonly(image); |
| 115 | 115 | } |
| r5931 | r5932 | |
| 195 | 195 | |
| 196 | 196 | /************************************* |
| 197 | 197 | * |
| 198 | * | |
| 198 | * DEVICE_IMAGE_UNLOAD(mess_hd) | |
| 199 | 199 | * |
| 200 | * | |
| 200 | * Device unload | |
| 201 | 201 | * |
| 202 | 202 | *************************************/ |
| 203 | 203 | |
| r5931 | r5932 | |
| 242 | 242 | |
| 243 | 243 | /************************************* |
| 244 | 244 | * |
| 245 | * | |
| 245 | * Get the MESS/MAME CHD file (from the src/chd.c core) | |
| 246 | 246 | * after an image has been opened with the mess_hd core |
| 247 | 247 | * |
| 248 | 248 | *************************************/ |
| r5931 | r5932 | |
| 425 | 425 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(mess_ide); break; |
| 426 | 426 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(mess_ide); break; |
| 427 | 427 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(mess_ide); break; |
| 428 | // | |
| 428 | // case DEVINFO_FCT_IMAGE_VERIFY: info->f = (genf *) ide_hd_validity_check; break; | |
| 429 | 429 | |
| 430 | 430 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 431 | 431 | case DEVINFO_STR_NAME: strcpy(info->s, "IDE harddisk"); break; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | orch90.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for emulating the CoCo Orch-90 (Orchestra 90) sound cartridge | |
| 6 | 6 | |
| 7 | The Orch-90 was a simple sound cartridge; it had two 8-bit DACs | |
| 8 | supporting stereo sound. The left channel was at $FF7A, and the right | |
| 9 | channel was at $FF7B | |
| 7 | The Orch-90 was a simple sound cartridge; it had two 8-bit DACs | |
| 8 | supporting stereo sound. The left channel was at $FF7A, and the right | |
| 9 | channel was at $FF7B | |
| 10 | 10 | |
| 11 | 11 | ***************************************************************************/ |
| 12 | 12 | |
| r5931 | r5932 | |
| 85 | 85 | |
| 86 | 86 | /*------------------------------------------------- |
| 87 | 87 | DEVICE_GET_INFO(coco_cartridge_pcb_orch90) - |
| 88 | ||
| 88 | get info function for the Orch-90 | |
| 89 | 89 | -------------------------------------------------*/ |
| 90 | 90 | |
| 91 | 91 | DEVICE_GET_INFO(coco_cartridge_pcb_orch90) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | harddriv.h | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS interface to the MAME CHD code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | ti99cart.c | |
| 4 | 4 | |
| 5 | ||
| 5 | TI99 family cartridge management | |
| 6 | 6 | |
| 7 | Michael Zapf, 2009 | |
| 8 | ||
| 7 | Michael Zapf, 2009 | |
| 8 | ||
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | #include "driver.h" |
| 11 | 11 | #include "ti99cart.h" |
| r5931 | r5932 | |
| 39 | 39 | struct _ti99_multicart_t |
| 40 | 40 | { |
| 41 | 41 | /* Reserves space for all cartridges. This is also used in the legacy |
| 42 | ||
| 42 | cartridge system, but only for slot 0. */ | |
| 43 | 43 | cartridge_t cartridge[NUMBER_OF_CARTRIDGE_SLOTS]; |
| 44 | 44 | |
| 45 | 45 | /* Determines which slot is currently active. This value is changed when there |
| 46 | ||
| 46 | are accesses to other GROM base addresses. */ | |
| 47 | 47 | int active_slot; |
| 48 | ||
| 49 | /* Used in order to enforce a special slot. This value is retrieved | |
| 50 | from the dipswitch setting. A value of -1 means automatic, that is, | |
| 51 | the grom base switch is used. Values 0 .. max refer to the | |
| 52 | respective slot. */ | |
| 48 | ||
| 49 | /* Used in order to enforce a special slot. This value is retrieved | |
| 50 | from the dipswitch setting. A value of -1 means automatic, that is, | |
| 51 | the grom base switch is used. Values 0 .. max refer to the | |
| 52 | respective slot. */ | |
| 53 | 53 | int fixed_slot; |
| 54 | 54 | |
| 55 | /* Holds the highest index of a cartridge being plugged in plus one. | |
| 56 | If we only have one cartridge inserted, we don't want to get a | |
| 57 | selection option, so we just mirror the memory contents. */ | |
| 55 | /* Holds the highest index of a cartridge being plugged in plus one. | |
| 56 | If we only have one cartridge inserted, we don't want to get a | |
| 57 | selection option, so we just mirror the memory contents. */ | |
| 58 | 58 | int next_free_slot; |
| 59 | ||
| 60 | /* Counts the number of slots which currently contain legacy format | |
| 61 | cartridge images. */ | |
| 59 | ||
| 60 | /* Counts the number of slots which currently contain legacy format | |
| 61 | cartridge images. */ | |
| 62 | 62 | int legacy_slots; |
| 63 | 63 | |
| 64 | /* Counts the number of slots which currently contain new format | |
| 65 | cartridge images. */ | |
| 64 | /* Counts the number of slots which currently contain new format | |
| 65 | cartridge images. */ | |
| 66 | 66 | int multi_slots; |
| 67 | 67 | |
| 68 | /* Legacy mode. Stores the slot number where the cartridge part is mounted. | |
| 69 | Index is from slotc_type_t. */ | |
| 68 | /* Legacy mode. Stores the slot number where the cartridge part is mounted. | |
| 69 | Index is from slotc_type_t. */ | |
| 70 | 70 | int legacy_slotnumber[5]; |
| 71 | 71 | }; |
| 72 | 72 | typedef struct _ti99_multicart_t ti99_multicart_t; |
| 73 | 73 | |
| 74 | 74 | #define AUTO -1 |
| 75 | 75 | |
| 76 | typedef enum _slotc_type_t | |
| 77 | { | |
| 78 | SLOTC_EMPTY = -1, | |
| 79 | SLOTC_GROM = 0, | |
| 80 | SLOTC_CROM = 1, | |
| 81 | SLOTC_DROM = 2, | |
| 82 | SLOTC_MINIMEM = 3, | |
| 83 | SLOTC_MBX = 4 | |
| 76 | typedef enum _slotc_type_t | |
| 77 | { | |
| 78 | SLOTC_EMPTY = -1, | |
| 79 | SLOTC_GROM = 0, | |
| 80 | SLOTC_CROM = 1, | |
| 81 | SLOTC_DROM = 2, | |
| 82 | SLOTC_MINIMEM = 3, | |
| 83 | SLOTC_MBX = 4 | |
| 84 | 84 | } slotc_type_t; |
| 85 | 85 | |
| 86 | 86 | /* Function declaration; the function itself is in the later part of this file. */ |
| r5931 | r5932 | |
| 93 | 93 | { |
| 94 | 94 | /* Read function for this cartridge. */ |
| 95 | 95 | read16_device_func read; |
| 96 | ||
| 96 | ||
| 97 | 97 | /* Write function for this cartridge. */ |
| 98 | 98 | write16_device_func write; |
| 99 | ||
| 99 | ||
| 100 | 100 | /* Read function for this cartridge, TI-99/8. */ |
| 101 | 101 | read8_device_func read8; |
| 102 | ||
| 102 | ||
| 103 | 103 | /* Write function for this cartridge, TI-99/8. */ |
| 104 | 104 | write8_device_func write8; |
| 105 | 105 | |
| 106 | 106 | /* Read function for this cartridge, CRU. */ |
| 107 | 107 | read8_device_func cruread; |
| 108 | ||
| 108 | ||
| 109 | 109 | /* Write function for this cartridge, CRU. */ |
| 110 | 110 | write8_device_func cruwrite; |
| 111 | ||
| 111 | ||
| 112 | 112 | /* Link up to the cartridge structure which contains this pcb. */ |
| 113 | 113 | cartridge_t *cartridge; |
| 114 | ||
| 114 | ||
| 115 | 115 | /* Function to assemble this cartridge. */ |
| 116 | 116 | assmfct *assemble; |
| 117 | ||
| 117 | ||
| 118 | 118 | /* Function to disassemble this cartridge. */ |
| 119 | 119 | assmfct *disassemble; |
| 120 | 120 | }; |
| r5931 | r5932 | |
| 128 | 128 | return FALSE; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | /* | |
| 132 | Activates a slot in the multi-cartridge extender. | |
| 133 | Setting the slot is done by accessing the GROM ports using a | |
| 134 | specific address: | |
| 135 | ||
| 136 | slot n: read data (read address, write data, write address) | |
| 137 | ||
| 138 | slot 0: 0x9800 (0x9802, 0x9c00, 0x9c02) : cartridge1 | |
| 139 | slot 1: 0x9804 (0x9806, 0x9c04, 0x9c06) : cartridge2 | |
| 140 | ... | |
| 141 | slot 15: 0x983c (0x983e, 0x9c3c, 0x9c3e) : cartridge16 | |
| 131 | /* | |
| 132 | Activates a slot in the multi-cartridge extender. | |
| 133 | Setting the slot is done by accessing the GROM ports using a | |
| 134 | specific address: | |
| 142 | 135 | |
| 143 | The following addresses are theoretically available, but the | |
| 144 | built-in OS does not use them; i.e. cartridges will not be | |
| 145 | included in the selection list, and their features will not be | |
| 146 | found by lookup, but they could be accessed directly by user | |
| 147 | programs. | |
| 148 | slot 16: 0x9840 (0x9842, 0x9c40, 0x9c42) | |
| 149 | ... | |
| 150 | slot 255: 0x9bfc (0x9bfe, 0x9ffc, 0x9ffe) | |
| 151 | ||
| 152 | Setting the GROM base should select one cartridge, but the ROMs in the | |
| 153 | CPU space must also be switched. As there is no known special mechanism | |
| 154 | we assume that by switching the GROM base, the ROM is automatically | |
| 155 | switched. | |
| 156 | ||
| 157 | Caution: This means that cartridges which do not have at least one | |
| 158 | GROM cannot be switched with this mechanism. | |
| 159 | ||
| 160 | We assume that the slot number is already calculated in the caller: | |
| 161 | slotnumber>=0 && slotnumber<=255 | |
| 162 | ||
| 163 | NOTE: The OS will stop searching when it finds slots 1 and 2 empty. | |
| 164 | Interestingly, cartridge subroutines are found nevertheless, even when | |
| 165 | the cartridge is plugged into a higher slot. | |
| 136 | slot n: read data (read address, write data, write address) | |
| 137 | ||
| 138 | slot 0: 0x9800 (0x9802, 0x9c00, 0x9c02) : cartridge1 | |
| 139 | slot 1: 0x9804 (0x9806, 0x9c04, 0x9c06) : cartridge2 | |
| 140 | ... | |
| 141 | slot 15: 0x983c (0x983e, 0x9c3c, 0x9c3e) : cartridge16 | |
| 142 | ||
| 143 | The following addresses are theoretically available, but the | |
| 144 | built-in OS does not use them; i.e. cartridges will not be | |
| 145 | included in the selection list, and their features will not be | |
| 146 | found by lookup, but they could be accessed directly by user | |
| 147 | programs. | |
| 148 | slot 16: 0x9840 (0x9842, 0x9c40, 0x9c42) | |
| 149 | ... | |
| 150 | slot 255: 0x9bfc (0x9bfe, 0x9ffc, 0x9ffe) | |
| 151 | ||
| 152 | Setting the GROM base should select one cartridge, but the ROMs in the | |
| 153 | CPU space must also be switched. As there is no known special mechanism | |
| 154 | we assume that by switching the GROM base, the ROM is automatically | |
| 155 | switched. | |
| 156 | ||
| 157 | Caution: This means that cartridges which do not have at least one | |
| 158 | GROM cannot be switched with this mechanism. | |
| 159 | ||
| 160 | We assume that the slot number is already calculated in the caller: | |
| 161 | slotnumber>=0 && slotnumber<=255 | |
| 162 | ||
| 163 | NOTE: The OS will stop searching when it finds slots 1 and 2 empty. | |
| 164 | Interestingly, cartridge subroutines are found nevertheless, even when | |
| 165 | the cartridge is plugged into a higher slot. | |
| 166 | 166 | */ |
| 167 | 167 | void cartridge_slot_set(const device_config *cartsys, int slotnumber) |
| 168 | 168 | { |
| 169 | 169 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 170 | 170 | assert(slotnumber>=0 && slotnumber<=255); |
| 171 | // | |
| 171 | // if (cartslots->active_slot != slotnumber) printf("Setting cartslot to %d\n", slotnumber); | |
| 172 | 172 | if (cartslots->fixed_slot==AUTO) |
| 173 | 173 | cartslots->active_slot = slotnumber; |
| 174 | 174 | else |
| r5931 | r5932 | |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /* |
| 179 | Allows to manually lock the cartslot system to a specific slot. | |
| 180 | Called from the machine driver, taking the dipswitch setting. | |
| 181 | We take slot numbers from 0 (automatic mode) to the maximum. | |
| 179 | Allows to manually lock the cartslot system to a specific slot. | |
| 180 | Called from the machine driver, taking the dipswitch setting. | |
| 181 | We take slot numbers from 0 (automatic mode) to the maximum. | |
| 182 | 182 | */ |
| 183 | 183 | void lock_cartridge_slot(const device_config *cartsys, int slotnumber) |
| 184 | 184 | { |
| r5931 | r5932 | |
| 207 | 207 | cart = &cartslots->cartridge[slotnumber]; |
| 208 | 208 | |
| 209 | 209 | cart->rom_size = cart->ram_size = cart->grom_size = 0; |
| 210 | cart->rom_ptr = NULL; | |
| 211 | cart->rom2_ptr = NULL; | |
| 210 | cart->rom_ptr = NULL; | |
| 211 | cart->rom2_ptr = NULL; | |
| 212 | 212 | cart->ram_ptr = NULL; |
| 213 | cart->grom_ptr = NULL; | |
| 213 | cart->grom_ptr = NULL; | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | /* | |
| 217 | GROM access. Accesses the GROMs in the cartridge. GROM memory is | |
| 218 | accessed serially via a set of ports. The GRMWA port (bank 0: 0x9c02) | |
| 219 | takes two consecutive byte writes which represent the high and low byte | |
| 220 | of the memory address in the GROM space. Once set, bytes can be read | |
| 221 | by repeated read accesses on the GRMRD port (bank 0: 0x9800). The | |
| 222 | address pointer advances on each read. The pointer wraps at the end | |
| 223 | of each GROM chip memory space, i.e. every 8KiB. | |
| 224 | This function takes the current GROM address minus 0x6000 which is the | |
| 225 | lowest address for cartridge GROMs. Lower addresses access GROMs in the | |
| 226 | console only, which appear in all banks. | |
| 227 | Note that the GROM access mechanism is identical for all cartridge | |
| 228 | types. | |
| 216 | /* | |
| 217 | GROM access. Accesses the GROMs in the cartridge. GROM memory is | |
| 218 | accessed serially via a set of ports. The GRMWA port (bank 0: 0x9c02) | |
| 219 | takes two consecutive byte writes which represent the high and low byte | |
| 220 | of the memory address in the GROM space. Once set, bytes can be read | |
| 221 | by repeated read accesses on the GRMRD port (bank 0: 0x9800). The | |
| 222 | address pointer advances on each read. The pointer wraps at the end | |
| 223 | of each GROM chip memory space, i.e. every 8KiB. | |
| 224 | This function takes the current GROM address minus 0x6000 which is the | |
| 225 | lowest address for cartridge GROMs. Lower addresses access GROMs in the | |
| 226 | console only, which appear in all banks. | |
| 227 | Note that the GROM access mechanism is identical for all cartridge | |
| 228 | types. | |
| 229 | 229 | */ |
| 230 | UINT8 cartridge_grom_read(const device_config *device, int cart_offset) | |
| 230 | UINT8 cartridge_grom_read(const device_config *device, int cart_offset) | |
| 231 | 231 | { |
| 232 | 232 | UINT8 value; |
| 233 | int slot; | |
| 233 | int slot; | |
| 234 | 234 | cartridge_t *cartridge; |
| 235 | 235 | ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token; |
| 236 | ||
| 236 | ||
| 237 | 237 | /* Handle the legacy mode. */ |
| 238 | 238 | if (in_legacy_mode(device)) |
| 239 | 239 | return cartridge_grom_read_legacy(device, cart_offset); |
| 240 | ||
| 240 | ||
| 241 | 241 | slot = cartslots->active_slot; |
| 242 | 242 | /* |
| 243 | This fixes a minor issue: The selection mechanism of the console | |
| 244 | concludes that there are multiple cartridges plugged in when it | |
| 245 | checks the different GROM bases and finds different data. Empty | |
| 246 | slots should return 0 at all addresses, but when we have only | |
| 247 | one cartridge, this entails that the second cartridge is | |
| 248 | different (all zeros), and so we get a meaningless selection | |
| 249 | option between cartridge 1 and 1 and 1 ... | |
| 250 | ||
| 251 | So if next_free_slot==1, we have one cartridge in slot 0. | |
| 252 | In that case we trick the OS to believe that the addressed | |
| 253 | cartridge appears at all locations which causes it to assume a | |
| 254 | standard single cartslot. | |
| 255 | */ | |
| 243 | This fixes a minor issue: The selection mechanism of the console | |
| 244 | concludes that there are multiple cartridges plugged in when it | |
| 245 | checks the different GROM bases and finds different data. Empty | |
| 246 | slots should return 0 at all addresses, but when we have only | |
| 247 | one cartridge, this entails that the second cartridge is | |
| 248 | different (all zeros), and so we get a meaningless selection | |
| 249 | option between cartridge 1 and 1 and 1 ... | |
| 250 | ||
| 251 | So if next_free_slot==1, we have one cartridge in slot 0. | |
| 252 | In that case we trick the OS to believe that the addressed | |
| 253 | cartridge appears at all locations which causes it to assume a | |
| 254 | standard single cartslot. | |
| 255 | */ | |
| 256 | 256 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 257 | 257 | slot=0; |
| 258 | 258 | |
| 259 | 259 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) |
| 260 | 260 | value = 0; |
| 261 | else | |
| 261 | else | |
| 262 | 262 | { |
| 263 | 263 | cartridge = &cartslots->cartridge[slot]; |
| 264 | ||
| 264 | ||
| 265 | 265 | if ((cartridge->grom_size>0) && (cartridge->pcb!=NULL)) |
| 266 | 266 | { |
| 267 | /* This is the reason why we need the image size: Read | |
| 268 | access beyond the image size must be detected. */ | |
| 269 | if (cart_offset > cartridge->grom_size) | |
| 267 | /* This is the reason why we need the image size: Read | |
| 268 | access beyond the image size must be detected. */ | |
| 269 | if (cart_offset > cartridge->grom_size) | |
| 270 | 270 | return 0; |
| 271 | 271 | |
| 272 | 272 | value = (UINT8)cartridge->grom_buffer; |
| r5931 | r5932 | |
| 280 | 280 | logerror("Empty socket at address G(%d)>%04x\n", slot, 0x6000 + cart_offset); |
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | // | |
| 283 | // printf("grom access(port = %x, address = %04x) = %02x\n", slot, 0x6000 + cart_offset*2, value); | |
| 284 | 284 | return value; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | /* | |
| 288 | Find the index of the cartridge name. We assume the format | |
| 289 | <name><number>, i.e. the number is the longest string from the right | |
| 290 | which can be interpreted as a number. | |
| 287 | /* | |
| 288 | Find the index of the cartridge name. We assume the format | |
| 289 | <name><number>, i.e. the number is the longest string from the right | |
| 290 | which can be interpreted as a number. | |
| 291 | 291 | */ |
| 292 | 292 | static int get_index_from_tagname(const device_config *image) |
| 293 | 293 | { |
| r5931 | r5932 | |
| 295 | 295 | int maxlen = strlen(tag); |
| 296 | 296 | int i; |
| 297 | 297 | for (i=maxlen-1; i >=0; i--) |
| 298 | if (tag[i] < 48 || tag[i] > 57) break; | |
| 298 | if (tag[i] < 48 || tag[i] > 57) break; | |
| 299 | 299 | |
| 300 | 300 | return atoi(tag+i+1); |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /* |
| 304 | ||
| 304 | Common routine to assemble cartridges from resources. | |
| 305 | 305 | */ |
| 306 | 306 | static cartridge_t *assemble_common(const device_config *cartslot) |
| 307 | 307 | { |
| r5931 | r5932 | |
| 309 | 309 | cartridge_t *cartridge; |
| 310 | 310 | const device_config *cartsys = cartslot->owner; |
| 311 | 311 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 312 | ||
| 312 | ||
| 313 | 313 | void *socketcont; |
| 314 | 314 | int reslength; |
| 315 | 315 | int i; |
| r5931 | r5932 | |
| 318 | 318 | assert(slotnumber>=0 && slotnumber<NUMBER_OF_CARTRIDGE_SLOTS); |
| 319 | 319 | |
| 320 | 320 | /* There is a cartridge in this slot, check the maximum slot number. */ |
| 321 | if (cartslots->next_free_slot <= slotnumber) | |
| 321 | if (cartslots->next_free_slot <= slotnumber) | |
| 322 | 322 | { |
| 323 | 323 | cartslots->next_free_slot = slotnumber+1; |
| 324 | 324 | } |
| 325 | 325 | cartridge = &cartslots->cartridge[slotnumber]; |
| 326 | 326 | |
| 327 | /* Get the socket which is retrieved by the multicart instance in | |
| 328 | the state of the cartslot instance. */ | |
| 327 | /* Get the socket which is retrieved by the multicart instance in | |
| 328 | the state of the cartslot instance. */ | |
| 329 | 329 | socketcont = cartslot_get_socket(cartslot, "grom_socket"); |
| 330 | 330 | reslength = cartslot_get_resource_length(cartslot, "grom_socket"); |
| 331 | 331 | if (socketcont != NULL) |
| r5931 | r5932 | |
| 333 | 333 | cartridge->grom_ptr = (UINT8 *)socketcont; |
| 334 | 334 | cartridge->grom_size = reslength; |
| 335 | 335 | } |
| 336 | ||
| 336 | ||
| 337 | 337 | socketcont = cartslot_get_socket(cartslot, "rom_socket"); |
| 338 | 338 | reslength = cartslot_get_resource_length(cartslot, "rom_socket"); |
| 339 | 339 | if (socketcont != NULL) |
| r5931 | r5932 | |
| 348 | 348 | cont16b[i] = BIG_ENDIANIZE_INT16(cont16b[i]); |
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | ||
| 351 | ||
| 352 | 352 | socketcont = cartslot_get_socket(cartslot, "rom2_socket"); |
| 353 | // | |
| 353 | // reslength = cartslot_get_resource_length(cartslot, "rom2_socket"); /* cannot differ from rom_socket */ | |
| 354 | 354 | if (socketcont != NULL) |
| 355 | 355 | { |
| 356 | 356 | cartridge->rom2_ptr = (UINT16 *)socketcont; |
| r5931 | r5932 | |
| 383 | 383 | |
| 384 | 384 | static void set_pointers(const device_config *pcb, int index) |
| 385 | 385 | { |
| 386 | const device_config *cartsys = pcb->owner->owner; | |
| 386 | const device_config *cartsys = pcb->owner->owner; | |
| 387 | 387 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 388 | 388 | ti99_pcb_t *pcb_def = (ti99_pcb_t *)pcb->token; |
| 389 | 389 | |
| r5931 | r5932 | |
| 393 | 393 | pcb_def->write8 = (write8_device_func) device_get_info_fct(pcb, TI99CARTINFO_FCT_6000_W8); |
| 394 | 394 | pcb_def->cruread = (read8_device_func) device_get_info_fct(pcb, TI99CARTINFO_FCT_CRU_R); |
| 395 | 395 | pcb_def->cruwrite = (write8_device_func) device_get_info_fct(pcb, TI99CARTINFO_FCT_CRU_W); |
| 396 | ||
| 396 | ||
| 397 | 397 | pcb_def->assemble = (assmfct *)device_get_info_fct(pcb, TI99CART_FCT_ASSM); |
| 398 | 398 | pcb_def->disassemble = (assmfct *)device_get_info_fct(pcb, TI99CART_FCT_DISASSM); |
| 399 | ||
| 399 | ||
| 400 | 400 | pcb_def->cartridge = &cartslots->cartridge[index]; |
| 401 | 401 | pcb_def->cartridge->pcb = pcb; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /***************************************************************************** |
| 405 | 405 | Cartridge type: None |
| 406 | This PCB device is just a pseudo device; the legacy mode is handled | |
| 407 | by dedicated functions. | |
| 406 | This PCB device is just a pseudo device; the legacy mode is handled | |
| 407 | by dedicated functions. | |
| 408 | 408 | ******************************************************************************/ |
| 409 | 409 | static DEVICE_START(ti99_pcb_none) |
| 410 | 410 | { |
| 411 | 411 | /* device is ti99_cartslot:cartridge:pcb */ |
| 412 | // | |
| 412 | // printf("DEVICE_START(ti99_pcb_none), tag of device=%s\n", device->tag); | |
| 413 | 413 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | /***************************************************************************** |
| 417 | 417 | Cartridge type: Standard |
| 418 | Most cartridges are built in this type. Every cartridge may contain | |
| 419 | GROM between 0 and 40 KiB, and ROM with 8 KiB length, no banking. | |
| 418 | Most cartridges are built in this type. Every cartridge may contain | |
| 419 | GROM between 0 and 40 KiB, and ROM with 8 KiB length, no banking. | |
| 420 | 420 | ******************************************************************************/ |
| 421 | 421 | |
| 422 | 422 | static DEVICE_START(ti99_pcb_std) |
| 423 | 423 | { |
| 424 | 424 | /* device is ti99_cartslot:cartridge:pcb */ |
| 425 | // | |
| 425 | // printf("DEVICE_START(ti99_pcb_std), tag of device=%s\n", device->tag); | |
| 426 | 426 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | /* | |
| 430 | Read handler for the CPU address space of the cartridge | |
| 431 | Images for this area are found in the rom_sockets. | |
| 429 | /* | |
| 430 | Read handler for the CPU address space of the cartridge | |
| 431 | Images for this area are found in the rom_sockets. | |
| 432 | 432 | */ |
| 433 | 433 | static READ16_DEVICE_HANDLER( read_cart_std ) |
| 434 | 434 | { |
| r5931 | r5932 | |
| 436 | 436 | UINT16 value; |
| 437 | 437 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 438 | 438 | cartridge_t *cartridge = pcb->cartridge; |
| 439 | ||
| 439 | ||
| 440 | 440 | if (cartridge->rom_ptr==NULL) |
| 441 | 441 | { |
| 442 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 443 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 442 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 443 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 444 | 444 | value = 0; |
| 445 | 445 | } |
| 446 | 446 | else |
| 447 | 447 | { |
| 448 | 448 | value = ((UINT16 *)cartridge->rom_ptr)[offset]; |
| 449 | // | |
| 449 | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); | |
| 450 | 450 | } |
| 451 | // | |
| 451 | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", 0, 0x6000+offset*2, value); | |
| 452 | 452 | return value; |
| 453 | 453 | } |
| 454 | 454 | |
| r5931 | r5932 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /* |
| 461 | TI-99/8 support: | |
| 462 | Read handler for the CPU address space of the cartridge | |
| 463 | Images for this area are found in the rom_sockets. | |
| 464 | For comments see the READ16 handler. | |
| 461 | TI-99/8 support: | |
| 462 | Read handler for the CPU address space of the cartridge | |
| 463 | Images for this area are found in the rom_sockets. | |
| 464 | For comments see the READ16 handler. | |
| 465 | 465 | */ |
| 466 | 466 | static READ8_DEVICE_HANDLER( read_cart_std8 ) |
| 467 | 467 | { |
| 468 | 468 | UINT8 value; |
| 469 | 469 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 470 | 470 | cartridge_t *cartridge = pcb->cartridge; |
| 471 | ||
| 471 | ||
| 472 | 472 | if (cartridge->rom_ptr==NULL) |
| 473 | 473 | value = 0; |
| 474 | 474 | else |
| r5931 | r5932 | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /* |
| 480 | TI-99/8 support: | |
| 481 | Write handler. No writes are allowed to standard cartridges. | |
| 480 | TI-99/8 support: | |
| 481 | Write handler. No writes are allowed to standard cartridges. | |
| 482 | 482 | */ |
| 483 | 483 | static WRITE8_DEVICE_HANDLER( write_cart_std8 ) |
| 484 | 484 | { |
| r5931 | r5932 | |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /* |
| 489 | The standard cartridge assemble routine. We just call the common | |
| 490 | function here. | |
| 489 | The standard cartridge assemble routine. We just call the common | |
| 490 | function here. | |
| 491 | 491 | */ |
| 492 | 492 | static int assemble_std(const device_config *image) |
| 493 | 493 | { |
| 494 | 494 | cartridge_t *cart; |
| 495 | // | |
| 495 | // printf("assemble_std, %s\n", image->tag); | |
| 496 | 496 | cart = assemble_common(image); |
| 497 | ||
| 497 | ||
| 498 | 498 | return INIT_PASS; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /* |
| 502 | Removes pointers and restores the state before plugging in the | |
| 503 | cartridge. | |
| 504 | The pointer to the location after the last cartridge is adjusted. | |
| 505 | As it seems, we can use the same function for the disassembling of all | |
| 506 | cartridge types. | |
| 502 | Removes pointers and restores the state before plugging in the | |
| 503 | cartridge. | |
| 504 | The pointer to the location after the last cartridge is adjusted. | |
| 505 | As it seems, we can use the same function for the disassembling of all | |
| 506 | cartridge types. | |
| 507 | 507 | */ |
| 508 | 508 | static int disassemble_std(const device_config *image) |
| 509 | 509 | { |
| r5931 | r5932 | |
| 514 | 514 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 515 | 515 | |
| 516 | 516 | slotnumber = get_index_from_tagname(image)-1; |
| 517 | // | |
| 517 | // printf("Disassemble cartridge %d\n", slotnumber); | |
| 518 | 518 | |
| 519 | 519 | /* Search the highest remaining cartridge. */ |
| 520 | 520 | cartslots->next_free_slot = 0; |
| 521 | 521 | for (i=NUMBER_OF_CARTRIDGE_SLOTS-1; i >= 0; i--) |
| 522 | 522 | { |
| 523 | if (i != slotnumber) | |
| 523 | if (i != slotnumber) | |
| 524 | 524 | { |
| 525 | 525 | if (!slot_is_empty(cartsys, i)) |
| 526 | 526 | { |
| 527 | 527 | cartslots->next_free_slot = i+1; |
| 528 | // | |
| 528 | // printf("Setting new next_free_slot to %d\n", cartslots->next_free_slot); | |
| 529 | 529 | break; |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | ||
| 533 | ||
| 534 | 534 | /* Do we have RAM? If so, swap the bytes (undo the BIG_ENDIANIZE) */ |
| 535 | 535 | cart = &cartslots->cartridge[slotnumber]; |
| 536 | 536 | if (!is_99_8()) |
| r5931 | r5932 | |
| 538 | 538 | for (i = 0; i < cart->ram_size/2; i++) |
| 539 | 539 | ((UINT16 *)cart->ram_ptr)[i] = BIG_ENDIANIZE_INT16(((UINT16 *)cart->ram_ptr)[i]); |
| 540 | 540 | } |
| 541 | ||
| 541 | ||
| 542 | 542 | clear_slot(cartsys, slotnumber); |
| 543 | 543 | |
| 544 | 544 | return INIT_PASS; |
| r5931 | r5932 | |
| 546 | 546 | |
| 547 | 547 | /***************************************************************************** |
| 548 | 548 | Cartridge type: Paged (Extended Basic) |
| 549 | This cartridge consists of GROM memory and 2 pages of standard ROM. | |
| 550 | The page is set by writing any value to a location in | |
| 551 | the address area, where an even word offset sets the page to 0 and an | |
| 552 | odd word offset sets the page to 1 (e.g. 6000 = bank 0, and | |
| 553 | 6002 = bank 1). | |
| 549 | This cartridge consists of GROM memory and 2 pages of standard ROM. | |
| 550 | The page is set by writing any value to a location in | |
| 551 | the address area, where an even word offset sets the page to 0 and an | |
| 552 | odd word offset sets the page to 1 (e.g. 6000 = bank 0, and | |
| 553 | 6002 = bank 1). | |
| 554 | 554 | ******************************************************************************/ |
| 555 | 555 | |
| 556 | 556 | static DEVICE_START(ti99_pcb_paged) |
| 557 | 557 | { |
| 558 | 558 | /* device is ti99_cartslot:cartridge:pcb */ |
| 559 | // | |
| 559 | // printf("DEVICE_START(ti99_pcb_paged), tag of device=%s\n", device->tag); | |
| 560 | 560 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | /* | |
| 564 | Read handler for the CPU address space of the cartridge | |
| 565 | Images for this area are found in the rom_sockets. | |
| 563 | /* | |
| 564 | Read handler for the CPU address space of the cartridge | |
| 565 | Images for this area are found in the rom_sockets. | |
| 566 | 566 | */ |
| 567 | 567 | static READ16_DEVICE_HANDLER( read_cart_paged ) |
| 568 | 568 | { |
| r5931 | r5932 | |
| 571 | 571 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 572 | 572 | cartridge_t *cartridge = pcb->cartridge; |
| 573 | 573 | UINT16 *rombank; |
| 574 | ||
| 574 | ||
| 575 | 575 | if (cartridge->rom_page==0) |
| 576 | 576 | rombank = cartridge->rom_ptr; |
| 577 | 577 | else |
| 578 | 578 | rombank = cartridge->rom2_ptr; |
| 579 | ||
| 579 | ||
| 580 | 580 | if (rombank==NULL) |
| 581 | 581 | { |
| 582 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 583 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 582 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 583 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 584 | 584 | /* TODO: Check for consistency with the GROM memory handling. */ |
| 585 | 585 | value = 0; |
| 586 | 586 | } |
| 587 | 587 | else |
| 588 | 588 | { |
| 589 | 589 | value = rombank[offset]; |
| 590 | // | |
| 590 | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); | |
| 591 | 591 | } |
| 592 | // | |
| 592 | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", rompage, 0x6000+offset*2, value); | |
| 593 | 593 | return value; |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | |
| 597 | /* | |
| 598 | Handle paging. Extended Basic switches between ROM banks by | |
| 599 | using the value of the LSB of the address where any value | |
| 600 | is written to. | |
| 597 | /* | |
| 598 | Handle paging. Extended Basic switches between ROM banks by | |
| 599 | using the value of the LSB of the address where any value | |
| 600 | is written to. | |
| 601 | 601 | */ |
| 602 | 602 | static WRITE16_DEVICE_HANDLER( write_cart_paged ) |
| 603 | 603 | { |
| 604 | 604 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 605 | 605 | cartridge_t *cartridge = pcb->cartridge; |
| 606 | 606 | cartridge->rom_page = offset & 1; |
| 607 | // | |
| 607 | // printf("setting rompage to %d\n", cartridge->rom_page); | |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | /* | |
| 611 | TI-99/8 support: | |
| 612 | Read handler for the CPU address space of the cartridge. | |
| 613 | Images for this area are found in the rom_sockets. | |
| 610 | /* | |
| 611 | TI-99/8 support: | |
| 612 | Read handler for the CPU address space of the cartridge. | |
| 613 | Images for this area are found in the rom_sockets. | |
| 614 | 614 | */ |
| 615 | 615 | static READ8_DEVICE_HANDLER( read_cart_paged8 ) |
| 616 | 616 | { |
| r5931 | r5932 | |
| 618 | 618 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 619 | 619 | cartridge_t *cartridge = pcb->cartridge; |
| 620 | 620 | UINT8 *rombank; |
| 621 | ||
| 621 | ||
| 622 | 622 | if (cartridge->rom_page==0) |
| 623 | 623 | rombank = cartridge->rom_ptr; |
| 624 | 624 | else |
| 625 | 625 | rombank = cartridge->rom2_ptr; |
| 626 | ||
| 626 | ||
| 627 | 627 | if (rombank==NULL) |
| 628 | 628 | value = 0; |
| 629 | 629 | else |
| r5931 | r5932 | |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | |
| 636 | /* | |
| 637 | TI-99/8 support: | |
| 638 | Handle paging. Extended Basic switches between ROM banks by | |
| 639 | using the value of the LSB of the address where any value | |
| 640 | is written to. This is the TI-99/8 support. | |
| 641 | Note that we need to check whether offset/2 is even or odd. | |
| 642 | ||
| 643 | FIXME: Extended Basic crashes with TI-99/8 when changing the rom page. | |
| 644 | This may be an incompatibility of Extended Basic and TI-99/8. | |
| 636 | /* | |
| 637 | TI-99/8 support: | |
| 638 | Handle paging. Extended Basic switches between ROM banks by | |
| 639 | using the value of the LSB of the address where any value | |
| 640 | is written to. This is the TI-99/8 support. | |
| 641 | Note that we need to check whether offset/2 is even or odd. | |
| 642 | ||
| 643 | FIXME: Extended Basic crashes with TI-99/8 when changing the rom page. | |
| 644 | This may be an incompatibility of Extended Basic and TI-99/8. | |
| 645 | 645 | */ |
| 646 | 646 | static WRITE8_DEVICE_HANDLER( write_cart_paged8 ) |
| 647 | 647 | { |
| 648 | 648 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 649 | 649 | cartridge_t *cartridge = pcb->cartridge; |
| 650 | // | |
| 650 | // printf("offset = %04x\n", offset); | |
| 651 | 651 | cartridge->rom_page = (offset>>1) & 1; |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /* |
| 655 | ||
| 655 | We require paged modules to have at least those two rom banks. | |
| 656 | 656 | */ |
| 657 | 657 | static int assemble_paged(const device_config *image) |
| 658 | 658 | { |
| 659 | 659 | cartridge_t *cart; |
| 660 | ||
| 661 | // printf("assemble_paged, %s\n", image->tag); | |
| 660 | ||
| 661 | // printf("assemble_paged, %s\n", image->tag); | |
| 662 | 662 | cart = assemble_common(image); |
| 663 | 663 | if (cart->rom_ptr==NULL) |
| 664 | 664 | { |
| r5931 | r5932 | |
| 676 | 676 | |
| 677 | 677 | /***************************************************************************** |
| 678 | 678 | Cartridge type: Mini Memory |
| 679 | GROM: 6 KiB (occupies G>6000 to G>7800) | |
| 680 | ROM: 4 KiB (romfile is actually 8 K long, half with zeros, 0x6000-0x6fff) | |
| 681 | persistent RAM: 4 KiB (0x7000-0x7fff) | |
| 679 | GROM: 6 KiB (occupies G>6000 to G>7800) | |
| 680 | ROM: 4 KiB (romfile is actually 8 K long, half with zeros, 0x6000-0x6fff) | |
| 681 | persistent RAM: 4 KiB (0x7000-0x7fff) | |
| 682 | 682 | ******************************************************************************/ |
| 683 | 683 | |
| 684 | 684 | static DEVICE_START(ti99_pcb_minimem) |
| 685 | 685 | { |
| 686 | // | |
| 686 | // printf("TI99 pcb minimem start\n"); | |
| 687 | 687 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 688 | 688 | } |
| 689 | 689 | |
| r5931 | r5932 | |
| 693 | 693 | UINT16 value; |
| 694 | 694 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 695 | 695 | cartridge_t *cartridge = pcb->cartridge; |
| 696 | ||
| 696 | ||
| 697 | 697 | if (offset < 0x800) |
| 698 | 698 | { |
| 699 | 699 | if (cartridge->rom_ptr==NULL) |
| 700 | 700 | { |
| 701 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 702 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 701 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 702 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 703 | 703 | value = 0; |
| 704 | 704 | } |
| 705 | 705 | else |
| 706 | 706 | { |
| 707 | 707 | value = ((UINT16 *)cartridge->rom_ptr)[offset]; |
| 708 | // | |
| 708 | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); | |
| 709 | 709 | } |
| 710 | // | |
| 710 | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", rompage, 0x6000+offset*2, value); | |
| 711 | 711 | } |
| 712 | else | |
| 712 | else | |
| 713 | 713 | { |
| 714 | 714 | if (cartridge->ram_ptr==NULL) |
| 715 | 715 | { |
| 716 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 717 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 716 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 717 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 718 | 718 | value = 0; |
| 719 | 719 | } |
| 720 | 720 | else |
| 721 | 721 | { |
| 722 | 722 | value = ((UINT16 *)cartridge->ram_ptr)[offset-0x800]; |
| 723 | // | |
| 723 | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); | |
| 724 | 724 | } |
| 725 | // | |
| 725 | // printf("accessed cartridge rom[%02x:%04x] = %04x\n", rompage, 0x6000+offset*2, value); | |
| 726 | 726 | } |
| 727 | 727 | return value; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | /* | |
| 731 | Mini Memory cartridge write operation. RAM is located at offset + 4 KiB | |
| 730 | /* | |
| 731 | Mini Memory cartridge write operation. RAM is located at offset + 4 KiB | |
| 732 | 732 | */ |
| 733 | 733 | static WRITE16_DEVICE_HANDLER( write_cart_minimem ) |
| 734 | 734 | { |
| 735 | 735 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 736 | 736 | cartridge_t *cartridge = pcb->cartridge; |
| 737 | 737 | UINT16 *pos; |
| 738 | ||
| 738 | ||
| 739 | 739 | if (offset < 0x800) |
| 740 | 740 | { |
| 741 | 741 | logerror("Write access to cartridge ROM at address %04x ignored", 0x6000 + 2*offset); |
| 742 | 742 | } |
| 743 | else | |
| 743 | else | |
| 744 | 744 | { |
| 745 | 745 | if (cartridge->ram_ptr==NULL) |
| 746 | 746 | { |
| 747 | 747 | logerror("No cartridge RAM at address %04x", 0x6000 + 2*offset); |
| 748 | 748 | |
| 749 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 750 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 749 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 750 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 751 | 751 | /* TODO: Check for consistency with the GROM memory handling. */ |
| 752 | 752 | } |
| 753 | 753 | else |
| r5931 | r5932 | |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | /* |
| 762 | ||
| 762 | Read handler for MiniMemory in TI-99/8. | |
| 763 | 763 | */ |
| 764 | 764 | static READ8_DEVICE_HANDLER( read_cart_minimem8 ) |
| 765 | 765 | { |
| r5931 | r5932 | |
| 767 | 767 | UINT8 value; |
| 768 | 768 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 769 | 769 | cartridge_t *cartridge = pcb->cartridge; |
| 770 | ||
| 770 | ||
| 771 | 771 | if (offset < 0x1000) |
| 772 | 772 | { |
| 773 | 773 | if (cartridge->rom_ptr==NULL) |
| r5931 | r5932 | |
| 779 | 779 | value = ((UINT8 *)cartridge->rom_ptr)[offset]; |
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | else | |
| 782 | else | |
| 783 | 783 | { |
| 784 | 784 | if (cartridge->ram_ptr==NULL) |
| 785 | 785 | { |
| r5931 | r5932 | |
| 793 | 793 | return value; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | /* | |
| 797 | Mini Memory cartridge write operation. RAM is located at offset + 4 KiB. | |
| 798 | This is the TI-99/8 support. | |
| 796 | /* | |
| 797 | Mini Memory cartridge write operation. RAM is located at offset + 4 KiB. | |
| 798 | This is the TI-99/8 support. | |
| 799 | 799 | */ |
| 800 | 800 | static WRITE8_DEVICE_HANDLER( write_cart_minimem8 ) |
| 801 | 801 | { |
| 802 | 802 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 803 | 803 | cartridge_t *cartridge = pcb->cartridge; |
| 804 | ||
| 804 | ||
| 805 | 805 | if (offset < 0x1000) |
| 806 | 806 | { |
| 807 | 807 | logerror("Write access to cartridge ROM at address %04x ignored", 0x6000 + offset); |
| 808 | 808 | } |
| 809 | else | |
| 809 | else | |
| 810 | 810 | { |
| 811 | 811 | if (cartridge->ram_ptr==NULL) |
| 812 | 812 | { |
| 813 | 813 | logerror("No cartridge RAM at address %04x", 0x6000 + offset); |
| 814 | 814 | |
| 815 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 816 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 815 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 816 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 817 | 817 | /* TODO: Check for consistency with the GROM memory handling. */ |
| 818 | 818 | } |
| 819 | 819 | else |
| r5931 | r5932 | |
| 828 | 828 | { |
| 829 | 829 | cartridge_t *cart; |
| 830 | 830 | |
| 831 | // | |
| 831 | // printf("assemble_minimem, %s\n", image->tag); | |
| 832 | 832 | cart = assemble_common(image); |
| 833 | 833 | if (cart->grom_size==0) |
| 834 | 834 | { |
| r5931 | r5932 | |
| 845 | 845 | logerror("Missing RAM for Mini Memory"); |
| 846 | 846 | return INIT_FAIL; |
| 847 | 847 | } |
| 848 | ||
| 848 | ||
| 849 | 849 | return INIT_PASS; |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | |
| 853 | 853 | /***************************************************************************** |
| 854 | 854 | Cartridge type: SuperSpace II |
| 855 | SuperSpace cartridge type. SuperSpace is intended as a user-definable | |
| 856 | blank cartridge containing buffered RAM | |
| 857 | It has an Editor/Assembler GROM which helps the user to load | |
| 858 | the user program into the cartridge. If the user program has a suitable | |
| 859 | header, the console recognizes the cartridge as runnable, and | |
| 860 | assigns a number in the selection screen. | |
| 861 | Switching the RAM banks in this cartridge is achieved by setting | |
| 862 | CRU bits (the system serial interface). | |
| 855 | SuperSpace cartridge type. SuperSpace is intended as a user-definable | |
| 856 | blank cartridge containing buffered RAM | |
| 857 | It has an Editor/Assembler GROM which helps the user to load | |
| 858 | the user program into the cartridge. If the user program has a suitable | |
| 859 | header, the console recognizes the cartridge as runnable, and | |
| 860 | assigns a number in the selection screen. | |
| 861 | Switching the RAM banks in this cartridge is achieved by setting | |
| 862 | CRU bits (the system serial interface). | |
| 863 | 863 | |
| 864 | GROM: Editor/Assembler GROM | |
| 865 | ROM: none | |
| 866 | persistent RAM: 32 KiB (0x6000-0x7fff, 4 banks) | |
| 867 | Switching the bank is done via CRU write | |
| 864 | GROM: Editor/Assembler GROM | |
| 865 | ROM: none | |
| 866 | persistent RAM: 32 KiB (0x6000-0x7fff, 4 banks) | |
| 867 | Switching the bank is done via CRU write | |
| 868 | 868 | ******************************************************************************/ |
| 869 | 869 | |
| 870 | 870 | static DEVICE_START(ti99_pcb_super) |
| 871 | 871 | { |
| 872 | // | |
| 872 | // printf("TI99 pcb super start\n"); | |
| 873 | 873 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | /* |
| 877 | The CRU read handler. The CRU is a serial interface in the console. | |
| 878 | Using the CRU we can switch the banks in the SuperSpace cartridge. | |
| 877 | The CRU read handler. The CRU is a serial interface in the console. | |
| 878 | Using the CRU we can switch the banks in the SuperSpace cartridge. | |
| 879 | 879 | */ |
| 880 | 880 | static READ8_DEVICE_HANDLER( read_cart_cru ) |
| 881 | 881 | { |
| r5931 | r5932 | |
| 886 | 886 | int reply = 0; |
| 887 | 887 | |
| 888 | 888 | /* ram_page contains the bank number. We have a maximum of |
| 889 | 4 banks; the Super Space II manual says: | |
| 890 | ||
| 891 | Banks are selected by writing a bit pattern to CRU address >0800: | |
| 892 | ||
| 893 | Bank # Value | |
| 894 | 0 >02 = 0000 0010 | |
| 895 | 1 >08 = 0000 1000 | |
| 896 | 2 >20 = 0010 0000 | |
| 897 | 3 >80 = 1000 0000 | |
| 898 | ||
| 899 | With the bank number (0, 1, 2, or 3) in R0: | |
| 900 | ||
| 901 | BNKSW LI R12,>0800 Set CRU address | |
| 902 | LI R1,2 Load Shift Bit | |
| 903 | SLA R0,1 Align Bank Number | |
| 904 | JEQ BNKS1 Skip shift if Bank 0 | |
| 905 | SLA R1,0 Align Shift Bit | |
| 906 | BNKS1 LDCR R1,0 Switch Banks | |
| 907 | SRL R0,1 Restore Bank Number (optional) | |
| 908 | RT | |
| 909 | */ | |
| 889 | 4 banks; the Super Space II manual says: | |
| 890 | ||
| 891 | Banks are selected by writing a bit pattern to CRU address >0800: | |
| 892 | ||
| 893 | Bank # Value | |
| 894 | 0 >02 = 0000 0010 | |
| 895 | 1 >08 = 0000 1000 | |
| 896 | 2 >20 = 0010 0000 | |
| 897 | 3 >80 = 1000 0000 | |
| 898 | ||
| 899 | With the bank number (0, 1, 2, or 3) in R0: | |
| 900 | ||
| 901 | BNKSW LI R12,>0800 Set CRU address | |
| 902 | LI R1,2 Load Shift Bit | |
| 903 | SLA R0,1 Align Bank Number | |
| 904 | JEQ BNKS1 Skip shift if Bank 0 | |
| 905 | SLA R1,0 Align Shift Bit | |
| 906 | BNKS1 LDCR R1,0 Switch Banks | |
| 907 | SRL R0,1 Restore Bank Number (optional) | |
| 908 | RT | |
| 909 | */ | |
| 910 | 910 | if ((offset & 1) == 0 || offset > 7) |
| 911 | 911 | reply = 0; |
| 912 | ||
| 913 | /* CRU addresses are only 1 bit wide. Bytes are transferred from LSB | |
| 914 | to MSB. That is, 8 bit are eight consecutive addresses. */ | |
| 912 | ||
| 913 | /* CRU addresses are only 1 bit wide. Bytes are transferred from LSB | |
| 914 | to MSB. That is, 8 bit are eight consecutive addresses. */ | |
| 915 | 915 | reply = (cartridge->ram_page == (offset-1)/2); |
| 916 | 916 | |
| 917 | 917 | return reply; |
| r5931 | r5932 | |
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | /* |
| 934 | SuperSpace RAM read operation. RAM is located at 0x6000 to 0x7fff | |
| 935 | as 4 banks of 8 KiB each | |
| 934 | SuperSpace RAM read operation. RAM is located at 0x6000 to 0x7fff | |
| 935 | as 4 banks of 8 KiB each | |
| 936 | 936 | */ |
| 937 | 937 | static READ16_DEVICE_HANDLER( read_cart_super ) |
| 938 | 938 | { |
| r5931 | r5932 | |
| 941 | 941 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 942 | 942 | cartridge_t *cartridge = pcb->cartridge; |
| 943 | 943 | offs_t boffset; |
| 944 | ||
| 944 | ||
| 945 | 945 | if (cartridge->ram_ptr==NULL) |
| 946 | 946 | { |
| 947 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 948 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 947 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 948 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 949 | 949 | value = 0; |
| 950 | 950 | } |
| 951 | 951 | else |
| 952 | 952 | { |
| 953 | boffset = cartridge->ram_page * 0x1000 + offset; | |
| 953 | boffset = cartridge->ram_page * 0x1000 + offset; | |
| 954 | 954 | value = ((UINT16 *)cartridge->ram_ptr)[boffset]; |
| 955 | // | |
| 955 | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); | |
| 956 | 956 | } |
| 957 | // | |
| 957 | // printf("accessed cartridge ram[%02x:%04x] = %04x\n", cartridge->ram_page, 0x6000+offset*2, value); | |
| 958 | 958 | return value; |
| 959 | 959 | } |
| 960 | 960 | |
| 961 | 961 | /* |
| 962 | SuperSpace RAM write operation. RAM is located at 0x6000 to 0x7fff | |
| 963 | as 4 banks of 8 KiB each | |
| 962 | SuperSpace RAM write operation. RAM is located at 0x6000 to 0x7fff | |
| 963 | as 4 banks of 8 KiB each | |
| 964 | 964 | */ |
| 965 | 965 | static WRITE16_DEVICE_HANDLER( write_cart_super ) |
| 966 | 966 | { |
| r5931 | r5932 | |
| 968 | 968 | cartridge_t *cartridge = pcb->cartridge; |
| 969 | 969 | UINT16 *pos; |
| 970 | 970 | offs_t boffset; |
| 971 | ||
| 971 | ||
| 972 | 972 | if (cartridge->ram_ptr==NULL) |
| 973 | 973 | { |
| 974 | 974 | logerror("No cartridge RAM at address %04x", 0x6000 + 2*offset); |
| 975 | ||
| 976 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 977 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 975 | ||
| 976 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 977 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 978 | 978 | } |
| 979 | 979 | else |
| 980 | 980 | { |
| 981 | boffset = cartridge->ram_page * 0x1000 + offset; | |
| 981 | boffset = cartridge->ram_page * 0x1000 + offset; | |
| 982 | 982 | pos = ((UINT16 *)cartridge->ram_ptr) + boffset; |
| 983 | 983 | COMBINE_DATA(pos); |
| 984 | 984 | } |
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | /* |
| 988 | SuperSpace RAM read operation. RAM is located at 0x6000 to 0x7fff | |
| 989 | as 4 banks of 8 KiB each. This is the TI-99/8 support. | |
| 988 | SuperSpace RAM read operation. RAM is located at 0x6000 to 0x7fff | |
| 989 | as 4 banks of 8 KiB each. This is the TI-99/8 support. | |
| 990 | 990 | */ |
| 991 | 991 | static READ8_DEVICE_HANDLER( read_cart_super8 ) |
| 992 | 992 | { |
| r5931 | r5932 | |
| 995 | 995 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 996 | 996 | cartridge_t *cartridge = pcb->cartridge; |
| 997 | 997 | offs_t boffset; |
| 998 | ||
| 998 | ||
| 999 | 999 | if (cartridge->ram_ptr==NULL) |
| 1000 | 1000 | { |
| 1001 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 1002 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 1001 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 1002 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 1003 | 1003 | value = 0; |
| 1004 | 1004 | } |
| 1005 | 1005 | else |
| 1006 | 1006 | { |
| 1007 | boffset = cartridge->ram_page * 0x2000 + offset; | |
| 1007 | boffset = cartridge->ram_page * 0x2000 + offset; | |
| 1008 | 1008 | value = ((UINT8 *)cartridge->ram_ptr)[boffset]; |
| 1009 | // | |
| 1009 | // printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value); | |
| 1010 | 1010 | } |
| 1011 | // | |
| 1011 | // printf("accessed cartridge ram[%02x:%04x] = %04x\n", cartridge->ram_page, 0x6000+offset*2, value); | |
| 1012 | 1012 | return value; |
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | /* |
| 1016 | SuperSpace RAM write operation. RAM is located at 0x6000 to 0x7fff | |
| 1017 | as 4 banks of 8 KiB each. This is the TI-99/8 support. | |
| 1016 | SuperSpace RAM write operation. RAM is located at 0x6000 to 0x7fff | |
| 1017 | as 4 banks of 8 KiB each. This is the TI-99/8 support. | |
| 1018 | 1018 | */ |
| 1019 | 1019 | static WRITE8_DEVICE_HANDLER( write_cart_super8 ) |
| 1020 | 1020 | { |
| 1021 | 1021 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1022 | 1022 | cartridge_t *cartridge = pcb->cartridge; |
| 1023 | 1023 | offs_t boffset; |
| 1024 | ||
| 1024 | ||
| 1025 | 1025 | if (cartridge->ram_ptr==NULL) |
| 1026 | 1026 | { |
| 1027 | 1027 | logerror("No cartridge RAM at address %04x", 0x6000 + offset); |
| 1028 | ||
| 1029 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 1030 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 1028 | ||
| 1029 | // printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot); | |
| 1030 | // printf("Cartridge address = %lx\n", (long)pcb->cartridge); | |
| 1031 | 1031 | } |
| 1032 | 1032 | else |
| 1033 | 1033 | { |
| 1034 | boffset = cartridge->ram_page * 0x2000 + offset; | |
| 1034 | boffset = cartridge->ram_page * 0x2000 + offset; | |
| 1035 | 1035 | ((UINT8 *)cartridge->ram_ptr)[boffset] = data; |
| 1036 | 1036 | } |
| 1037 | 1037 | } |
| r5931 | r5932 | |
| 1040 | 1040 | static int assemble_super(const device_config *image) |
| 1041 | 1041 | { |
| 1042 | 1042 | cartridge_t *cart; |
| 1043 | // printf("assemble_super, %s\n", image->tag); | |
| 1044 | ||
| 1043 | // printf("assemble_super, %s\n", image->tag); | |
| 1044 | ||
| 1045 | 1045 | cart = assemble_common(image); |
| 1046 | 1046 | if (cart->ram_size==0) |
| 1047 | 1047 | { |
| r5931 | r5932 | |
| 1053 | 1053 | |
| 1054 | 1054 | /***************************************************************************** |
| 1055 | 1055 | Cartridge type: MBX |
| 1056 | GROM: up to 40 KiB | |
| 1057 | ROM: up to 16 KiB (in up to 2 banks of 8KiB each) | |
| 1058 | RAM: 1022 B (0x6c00-0x6ffd, overrides ROM in that area) | |
| 1059 | ROM mapper: 6ffe | |
| 1056 | GROM: up to 40 KiB | |
| 1057 | ROM: up to 16 KiB (in up to 2 banks of 8KiB each) | |
| 1058 | RAM: 1022 B (0x6c00-0x6ffd, overrides ROM in that area) | |
| 1059 | ROM mapper: 6ffe | |
| 1060 | 1060 | ******************************************************************************/ |
| 1061 | 1061 | |
| 1062 | 1062 | static DEVICE_START(ti99_pcb_mbx) |
| 1063 | 1063 | { |
| 1064 | // | |
| 1064 | // printf("TI99 pcb mbx start\n"); | |
| 1065 | 1065 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| r5931 | r5932 | |
| 1071 | 1071 | UINT16 value = 0; |
| 1072 | 1072 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1073 | 1073 | cartridge_t *cartridge = pcb->cartridge; |
| 1074 | ||
| 1074 | ||
| 1075 | 1075 | if ((offset >= 0x0600) && (offset <= 0x07fe)) |
| 1076 | 1076 | { |
| 1077 | 1077 | /* This is the RAM area which overrides any ROM. There is no |
| 1078 | known banking behavior for the RAM, so we must assume that | |
| 1079 | there is only one bank. */ | |
| 1078 | known banking behavior for the RAM, so we must assume that | |
| 1079 | there is only one bank. */ | |
| 1080 | 1080 | if (cartridge->ram_ptr != NULL) |
| 1081 | 1081 | value = ((UINT16 *)cartridge->ram_ptr)[offset - 0x0600]; |
| 1082 | 1082 | } |
| r5931 | r5932 | |
| 1088 | 1088 | return value; |
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | /* | |
| 1092 | MBX write operation. | |
| 1091 | /* | |
| 1092 | MBX write operation. | |
| 1093 | 1093 | */ |
| 1094 | 1094 | static WRITE16_DEVICE_HANDLER( write_cart_mbx ) |
| 1095 | 1095 | { |
| r5931 | r5932 | |
| 1099 | 1099 | |
| 1100 | 1100 | if ((offset >= 0x0600) && (offset <= 0x07fe)) |
| 1101 | 1101 | { |
| 1102 | if (cartridge->ram_ptr == NULL) | |
| 1102 | if (cartridge->ram_ptr == NULL) | |
| 1103 | 1103 | return; |
| 1104 | 1104 | pos = ((UINT16 *)cartridge->ram_ptr) + offset - 0x0600; |
| 1105 | 1105 | COMBINE_DATA(pos); |
| 1106 | 1106 | } |
| 1107 | 1107 | else if ((offset == 0x07ff) && ACCESSING_BITS_8_15) |
| 1108 | 1108 | { |
| 1109 | if (cartridge->rom_ptr==NULL) | |
| 1109 | if (cartridge->rom_ptr==NULL) | |
| 1110 | 1110 | return; |
| 1111 | 1111 | cartridge->rom_page = ((data >> 8) & 1); |
| 1112 | 1112 | } |
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | 1115 | /* |
| 1116 | ||
| 1116 | TI-99/8 support | |
| 1117 | 1117 | */ |
| 1118 | 1118 | static READ8_DEVICE_HANDLER( read_cart_mbx8 ) |
| 1119 | 1119 | { |
| r5931 | r5932 | |
| 1121 | 1121 | UINT8 value = 0; |
| 1122 | 1122 | ti99_pcb_t *pcb = (ti99_pcb_t *)device->token; |
| 1123 | 1123 | cartridge_t *cartridge = pcb->cartridge; |
| 1124 | ||
| 1124 | ||
| 1125 | 1125 | if ((offset >= 0x0c00) && (offset <= 0x0ffd)) |
| 1126 | 1126 | { |
| 1127 | 1127 | /* This is the RAM area which overrides any ROM. There is no |
| 1128 | known banking behavior for the RAM, so we must assume that | |
| 1129 | there is only one bank. */ | |
| 1128 | known banking behavior for the RAM, so we must assume that | |
| 1129 | there is only one bank. */ | |
| 1130 | 1130 | if (cartridge->ram_ptr != NULL) |
| 1131 | 1131 | value = ((UINT8 *)cartridge->ram_ptr)[offset - 0x0c00]; |
| 1132 | 1132 | } |
| r5931 | r5932 | |
| 1138 | 1138 | return value; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | /* | |
| 1142 | MBX write operation (TI-99/8) | |
| 1141 | /* | |
| 1142 | MBX write operation (TI-99/8) | |
| 1143 | 1143 | */ |
| 1144 | 1144 | static WRITE8_DEVICE_HANDLER( write_cart_mbx8 ) |
| 1145 | 1145 | { |
| r5931 | r5932 | |
| 1148 | 1148 | |
| 1149 | 1149 | if ((offset >= 0x0c00) && (offset <= 0x0ffd)) |
| 1150 | 1150 | { |
| 1151 | if (cartridge->ram_ptr == NULL) | |
| 1151 | if (cartridge->ram_ptr == NULL) | |
| 1152 | 1152 | return; |
| 1153 | 1153 | ((UINT8 *)cartridge->ram_ptr)[offset - 0x0c00] = data; |
| 1154 | 1154 | } |
| 1155 | 1155 | else if (offset == 0x0ffe || offset == 0x0fff) |
| 1156 | 1156 | { |
| 1157 | if (cartridge->rom_ptr==NULL) | |
| 1157 | if (cartridge->rom_ptr==NULL) | |
| 1158 | 1158 | return; |
| 1159 | cartridge->rom_page = (data & 1); /* TODO: Check */ | |
| 1159 | cartridge->rom_page = (data & 1); /* TODO: Check */ | |
| 1160 | 1160 | } |
| 1161 | 1161 | } |
| 1162 | 1162 | |
| r5931 | r5932 | |
| 1165 | 1165 | { |
| 1166 | 1166 | cartridge_t *cart; |
| 1167 | 1167 | |
| 1168 | // printf("assemble_mbx, %s\n", image->tag); | |
| 1169 | cart = assemble_common(image); | |
| 1168 | // printf("assemble_mbx, %s\n", image->tag); | |
| 1169 | cart = assemble_common(image); | |
| 1170 | 1170 | return INIT_PASS; |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| r5931 | r5932 | |
| 1221 | 1221 | break; |
| 1222 | 1222 | |
| 1223 | 1223 | case TI99CART_FCT_ASSM: |
| 1224 | info->f = (genf *) assemble_std; | |
| 1224 | info->f = (genf *) assemble_std; | |
| 1225 | 1225 | break; |
| 1226 | 1226 | |
| 1227 | 1227 | case TI99CART_FCT_DISASSM: |
| 1228 | info->f = (genf *) disassemble_std; | |
| 1228 | info->f = (genf *) disassemble_std; | |
| 1229 | 1229 | break; |
| 1230 | ||
| 1230 | ||
| 1231 | 1231 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1232 | 1232 | case DEVINFO_STR_NAME: |
| 1233 | 1233 | strcpy(info->s, "TI99 standard cartridge pcb"); |
| r5931 | r5932 | |
| 1282 | 1282 | info->f = (genf *) assemble_paged; break; |
| 1283 | 1283 | |
| 1284 | 1284 | case TI99CARTINFO_FCT_6000_R: |
| 1285 | info->f = (genf *) read_cart_paged; | |
| 1285 | info->f = (genf *) read_cart_paged; | |
| 1286 | 1286 | break; |
| 1287 | 1287 | |
| 1288 | 1288 | case TI99CARTINFO_FCT_6000_W: |
| 1289 | info->f = (genf *) write_cart_paged; | |
| 1289 | info->f = (genf *) write_cart_paged; | |
| 1290 | 1290 | break; |
| 1291 | 1291 | |
| 1292 | 1292 | case TI99CARTINFO_FCT_6000_R8: |
| 1293 | info->f = (genf *) read_cart_paged8; | |
| 1293 | info->f = (genf *) read_cart_paged8; | |
| 1294 | 1294 | break; |
| 1295 | 1295 | |
| 1296 | 1296 | case TI99CARTINFO_FCT_6000_W8: |
| 1297 | info->f = (genf *) write_cart_paged8; | |
| 1297 | info->f = (genf *) write_cart_paged8; | |
| 1298 | 1298 | break; |
| 1299 | 1299 | |
| 1300 | 1300 | case DEVINFO_STR_NAME: |
| r5931 | r5932 | |
| 1316 | 1316 | break; |
| 1317 | 1317 | |
| 1318 | 1318 | case TI99CART_FCT_ASSM: |
| 1319 | info->f = (genf *) assemble_minimem; | |
| 1319 | info->f = (genf *) assemble_minimem; | |
| 1320 | 1320 | break; |
| 1321 | 1321 | case TI99CARTINFO_FCT_6000_R: |
| 1322 | info->f = (genf *) read_cart_minimem; | |
| 1322 | info->f = (genf *) read_cart_minimem; | |
| 1323 | 1323 | break; |
| 1324 | 1324 | case TI99CARTINFO_FCT_6000_W: |
| 1325 | info->f = (genf *) write_cart_minimem; | |
| 1325 | info->f = (genf *) write_cart_minimem; | |
| 1326 | 1326 | break; |
| 1327 | 1327 | case TI99CARTINFO_FCT_6000_R8: |
| 1328 | info->f = (genf *) read_cart_minimem8; | |
| 1328 | info->f = (genf *) read_cart_minimem8; | |
| 1329 | 1329 | break; |
| 1330 | 1330 | case TI99CARTINFO_FCT_6000_W8: |
| 1331 | info->f = (genf *) write_cart_minimem8; | |
| 1331 | info->f = (genf *) write_cart_minimem8; | |
| 1332 | 1332 | break; |
| 1333 | 1333 | |
| 1334 | 1334 | case DEVINFO_STR_NAME: |
| r5931 | r5932 | |
| 1350 | 1350 | break; |
| 1351 | 1351 | |
| 1352 | 1352 | case TI99CART_FCT_ASSM: |
| 1353 | info->f = (genf *) assemble_super; | |
| 1353 | info->f = (genf *) assemble_super; | |
| 1354 | 1354 | break; |
| 1355 | 1355 | case TI99CARTINFO_FCT_6000_R: |
| 1356 | info->f = (genf *) read_cart_super; | |
| 1356 | info->f = (genf *) read_cart_super; | |
| 1357 | 1357 | break; |
| 1358 | 1358 | case TI99CARTINFO_FCT_6000_W: |
| 1359 | info->f = (genf *) write_cart_super; | |
| 1359 | info->f = (genf *) write_cart_super; | |
| 1360 | 1360 | break; |
| 1361 | 1361 | case TI99CARTINFO_FCT_6000_R8: |
| 1362 | info->f = (genf *) read_cart_super8; | |
| 1362 | info->f = (genf *) read_cart_super8; | |
| 1363 | 1363 | break; |
| 1364 | 1364 | case TI99CARTINFO_FCT_6000_W8: |
| 1365 | info->f = (genf *) write_cart_super8; | |
| 1365 | info->f = (genf *) write_cart_super8; | |
| 1366 | 1366 | break; |
| 1367 | 1367 | case TI99CARTINFO_FCT_CRU_R: |
| 1368 | info->f = (genf *) read_cart_cru; | |
| 1368 | info->f = (genf *) read_cart_cru; | |
| 1369 | 1369 | break; |
| 1370 | 1370 | case TI99CARTINFO_FCT_CRU_W: |
| 1371 | info->f = (genf *) write_cart_cru; | |
| 1371 | info->f = (genf *) write_cart_cru; | |
| 1372 | 1372 | break; |
| 1373 | 1373 | |
| 1374 | 1374 | case DEVINFO_STR_NAME: |
| r5931 | r5932 | |
| 1390 | 1390 | break; |
| 1391 | 1391 | |
| 1392 | 1392 | case TI99CART_FCT_ASSM: |
| 1393 | info->f = (genf *) assemble_mbx; | |
| 1393 | info->f = (genf *) assemble_mbx; | |
| 1394 | 1394 | break; |
| 1395 | 1395 | case TI99CARTINFO_FCT_6000_R: |
| 1396 | info->f = (genf *) read_cart_mbx; | |
| 1396 | info->f = (genf *) read_cart_mbx; | |
| 1397 | 1397 | break; |
| 1398 | 1398 | case TI99CARTINFO_FCT_6000_W: |
| 1399 | info->f = (genf *) write_cart_mbx; | |
| 1399 | info->f = (genf *) write_cart_mbx; | |
| 1400 | 1400 | break; |
| 1401 | 1401 | case TI99CARTINFO_FCT_6000_R8: |
| 1402 | info->f = (genf *) read_cart_mbx8; | |
| 1402 | info->f = (genf *) read_cart_mbx8; | |
| 1403 | 1403 | break; |
| 1404 | 1404 | case TI99CARTINFO_FCT_6000_W8: |
| 1405 | info->f = (genf *) write_cart_mbx8; | |
| 1405 | info->f = (genf *) write_cart_mbx8; | |
| 1406 | 1406 | break; |
| 1407 | 1407 | |
| 1408 | 1408 | |
| r5931 | r5932 | |
| 1418 | 1418 | |
| 1419 | 1419 | |
| 1420 | 1420 | /***************************************************************************** |
| 1421 | The cartridge handling of the multi-cartridge system. | |
| 1421 | The cartridge handling of the multi-cartridge system. | |
| 1422 | 1422 | Every cartridge contains a PCB device. The memory handlers delegate the calls |
| 1423 | 1423 | to the respective handlers of the cartridges. |
| 1424 | 1424 | ******************************************************************************/ |
| 1425 | 1425 | /* |
| 1426 | ||
| 1426 | Initialize a cartridge. Each cartridge contains a PCB device. | |
| 1427 | 1427 | */ |
| 1428 | 1428 | static DEVICE_START( ti99_cartridge ) |
| 1429 | 1429 | { |
| 1430 | 1430 | cartslot_t *cart = device->token; |
| 1431 | 1431 | astring *tempstring = astring_alloc(); |
| 1432 | ||
| 1432 | ||
| 1433 | 1433 | /* find the PCB device */ |
| 1434 | 1434 | cart->pcb_device = devtag_get_device( |
| 1435 | 1435 | device->machine, |
| r5931 | r5932 | |
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | 1440 | /* |
| 1441 | Load the cartridge image files. Apart from reading, we set pointers | |
| 1442 | to the image files so that during runtime we do not need search | |
| 1443 | operations. | |
| 1441 | Load the cartridge image files. Apart from reading, we set pointers | |
| 1442 | to the image files so that during runtime we do not need search | |
| 1443 | operations. | |
| 1444 | 1444 | */ |
| 1445 | 1445 | static DEVICE_IMAGE_LOAD( ti99_cartridge ) |
| 1446 | { | |
| 1446 | { | |
| 1447 | 1447 | const device_config *pcbdev = cartslot_get_pcb(image); |
| 1448 | 1448 | const device_config *cartsys = image->owner; |
| 1449 | 1449 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 1450 | 1450 | |
| 1451 | 1451 | int result; |
| 1452 | ||
| 1452 | ||
| 1453 | 1453 | result = load_legacy(image); |
| 1454 | ||
| 1454 | ||
| 1455 | 1455 | if (result != INIT_FAIL) |
| 1456 | 1456 | cartslots->legacy_slots++; |
| 1457 | else | |
| 1457 | else | |
| 1458 | 1458 | { |
| 1459 | 1459 | if (pcbdev != NULL) |
| 1460 | 1460 | { |
| 1461 | 1461 | /* If we are here, we have a multicart. */ |
| 1462 | 1462 | ti99_pcb_t *pcb = (ti99_pcb_t *)pcbdev->token; |
| 1463 | 1463 | cartslot_t *cart = (cartslot_t *)image->token; |
| 1464 | ||
| 1464 | ||
| 1465 | 1465 | /* try opening this as a multicart */ |
| 1466 | 1466 | /* This line requires that cartslot_t be included in cartslot.h, |
| 1467 | otherwise one cannot make use of multicart handling within such a | |
| 1468 | custom LOAD function. */ | |
| 1467 | otherwise one cannot make use of multicart handling within such a | |
| 1468 | custom LOAD function. */ | |
| 1469 | 1469 | multicart_open_error me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); |
| 1470 | ||
| 1470 | ||
| 1471 | 1471 | /* Now that we have loaded the image files, let the PCB put them all |
| 1472 | together. This means we put the images in a structure which allows | |
| 1473 | for a quick access by the memory handlers. Every PCB defines an | |
| 1474 | own assembly method. */ | |
| 1472 | together. This means we put the images in a structure which allows | |
| 1473 | for a quick access by the memory handlers. Every PCB defines an | |
| 1474 | own assembly method. */ | |
| 1475 | 1475 | if (me == MCERR_NONE) |
| 1476 | 1476 | result = pcb->assemble(image); |
| 1477 | else | |
| 1477 | else | |
| 1478 | 1478 | fatalerror("Error loading multicart: %s\n", mc_error_text(me)); |
| 1479 | ||
| 1479 | ||
| 1480 | 1480 | /* This is for legacy support. If we have no multicart left |
| 1481 | ||
| 1481 | but there are still legacy dumps, we switch to legacy mode. */ | |
| 1482 | 1482 | if (result != INIT_FAIL) |
| 1483 | 1483 | cartslots->multi_slots++; |
| 1484 | 1484 | } |
| r5931 | r5932 | |
| 1486 | 1486 | { |
| 1487 | 1487 | fatalerror("Error loading multicart: no pcb found.\n"); |
| 1488 | 1488 | } |
| 1489 | } | |
| 1489 | } | |
| 1490 | 1490 | return result; |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | /* |
| 1494 | This is called when the cartridge is unplugged (or the emulator is | |
| 1495 | stopped). | |
| 1494 | This is called when the cartridge is unplugged (or the emulator is | |
| 1495 | stopped). | |
| 1496 | 1496 | */ |
| 1497 | 1497 | static DEVICE_IMAGE_UNLOAD( ti99_cartridge ) |
| 1498 | { | |
| 1498 | { | |
| 1499 | 1499 | const device_config *pcbdev; |
| 1500 | 1500 | ti99_multicart_t *cartslots = (ti99_multicart_t *)image->owner->token; |
| 1501 | 1501 | |
| 1502 | 1502 | if (image->token == NULL) |
| 1503 | 1503 | { |
| 1504 | /* This means something went wrong during the pcb | |
| 1505 | identification (e.g. one of the cartridge files was not | |
| 1506 | found). We do not need to (and cannot) unload | |
| 1507 | the cartridge. */ | |
| 1504 | /* This means something went wrong during the pcb | |
| 1505 | identification (e.g. one of the cartridge files was not | |
| 1506 | found). We do not need to (and cannot) unload | |
| 1507 | the cartridge. */ | |
| 1508 | 1508 | return; |
| 1509 | 1509 | } |
| 1510 | 1510 | pcbdev = cartslot_get_pcb(image); |
| r5931 | r5932 | |
| 1513 | 1513 | { |
| 1514 | 1514 | ti99_pcb_t *pcb = (ti99_pcb_t *)pcbdev->token; |
| 1515 | 1515 | cartslot_t *cart = (cartslot_t *)image->token; |
| 1516 | ||
| 1517 | // printf("unload\n"); | |
| 1516 | ||
| 1517 | // printf("unload\n"); | |
| 1518 | 1518 | if (cart->mc != NULL) |
| 1519 | 1519 | { |
| 1520 | 1520 | /* Remove pointers and de-big-endianize RAM contents. */ |
| 1521 | pcb->disassemble(image); | |
| 1522 | ||
| 1523 | /* Close the multicart; all RAM resources will be | |
| 1524 | written to disk */ | |
| 1521 | pcb->disassemble(image); | |
| 1522 | ||
| 1523 | /* Close the multicart; all RAM resources will be | |
| 1524 | written to disk */ | |
| 1525 | 1525 | multicart_close(cart->mc); |
| 1526 | 1526 | cart->mc = NULL; |
| 1527 | ||
| 1527 | ||
| 1528 | 1528 | /* See above: Legacy support. */ |
| 1529 | 1529 | cartslots->multi_slots--; |
| 1530 | 1530 | } |
| 1531 | // else | |
| 1532 | // fatalerror("Lost pointer to multicart in cartridge. Report bug.\n"); | |
| 1531 | // else | |
| 1532 | // fatalerror("Lost pointer to multicart in cartridge. Report bug.\n"); | |
| 1533 | 1533 | } |
| 1534 | 1534 | else |
| 1535 | 1535 | { |
| r5931 | r5932 | |
| 1540 | 1540 | |
| 1541 | 1541 | /***************************************************************************** |
| 1542 | 1542 | The legacy cartridge slot system. |
| 1543 | ||
| 1543 | ||
| 1544 | 1544 | This is the system which was used for the TI family until MESS 0.130. |
| 1545 | 1545 | Here, plain ROM dumps were mounted on the slots, e.g. the GROM on slot 1, |
| 1546 | 1546 | ROM on slot 2. No multiple cartridges were supported. |
| 1547 | ||
| 1548 | This functionality is deprecated. | |
| 1549 | ||
| 1547 | ||
| 1548 | This functionality is deprecated. | |
| 1549 | ||
| 1550 | 1550 | In order to allow for a smooth transition, this feature is included in this |
| 1551 | 1551 | version. It is strongly recommmended to create suitable multicart packs. |
| 1552 | ||
| 1552 | ||
| 1553 | 1553 | This implementation tolerates both cartridge systems in the following way: |
| 1554 | 1554 | - If there are only single ROM dumps, the system switched to legacy mode. |
| 1555 | 1555 | - If there is at least one multicart pack in any slot, the system switches |
| r5931 | r5932 | |
| 1565 | 1565 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 1566 | 1566 | |
| 1567 | 1567 | UINT8 value; |
| 1568 | ||
| 1568 | ||
| 1569 | 1569 | /* Get the GROM slot number. */ |
| 1570 | 1570 | slot = cartslots->legacy_slotnumber[SLOTC_GROM]; |
| 1571 | 1571 | if (slot<0) |
| r5931 | r5932 | |
| 1573 | 1573 | return 0; |
| 1574 | 1574 | |
| 1575 | 1575 | cartridge = &cartslots->cartridge[slot]; |
| 1576 | ||
| 1576 | ||
| 1577 | 1577 | if (cartridge->grom_size>0) |
| 1578 | 1578 | { |
| 1579 | /* This is the reason why we need the image size: Read | |
| 1580 | access beyond the image size must be detected. */ | |
| 1581 | if (cart_offset > cartridge->grom_size) | |
| 1579 | /* This is the reason why we need the image size: Read | |
| 1580 | access beyond the image size must be detected. */ | |
| 1581 | if (cart_offset > cartridge->grom_size) | |
| 1582 | 1582 | return 0; |
| 1583 | ||
| 1583 | ||
| 1584 | 1584 | value = (UINT8)cartridge->grom_buffer; |
| 1585 | 1585 | /* read ahead */ |
| 1586 | 1586 | cartridge->grom_buffer = cartridge->grom_ptr[cart_offset]; |
| r5931 | r5932 | |
| 1592 | 1592 | logerror("Empty socket at address G(%d)>%04x\n", slot, 0x6000 + cart_offset); |
| 1593 | 1593 | } |
| 1594 | 1594 | |
| 1595 | // | |
| 1595 | // printf("grom access(port = %x, address = %04x) = %02x\n", slot, 0x6000 + cart_offset*2, value); | |
| 1596 | 1596 | return value; |
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | 1599 | static READ16_DEVICE_HANDLER( ti99_cart_r_legacy ) |
| 1600 | 1600 | { |
| 1601 | /* if (hsgpl_crdena) | |
| 1602 | return ti99_hsgpl_rom6_r(space, offset, mem_mask); | |
| 1601 | /* if (hsgpl_crdena) | |
| 1602 | return ti99_hsgpl_rom6_r(space, offset, mem_mask); | |
| 1603 | 1603 | */ |
| 1604 | 1604 | int slotmbx, slotmini, slotebr2, slotrom; |
| 1605 | 1605 | ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token; |
| r5931 | r5932 | |
| 1611 | 1611 | /* We are in the RAM area of MBX cartridges. */ |
| 1612 | 1612 | return ((UINT16 *)(cartslots->cartridge[slotmbx].ram_ptr))[offset-0x0600]; |
| 1613 | 1613 | } |
| 1614 | ||
| 1614 | ||
| 1615 | 1615 | slotmini = cartslots->legacy_slotnumber[SLOTC_MINIMEM]; |
| 1616 | 1616 | if ((slotmini != -1) && (offset >= 0x0800) && (offset <= 0x0fff)) |
| 1617 | 1617 | { |
| r5931 | r5932 | |
| 1623 | 1623 | slotrom = cartslots->legacy_slotnumber[SLOTC_CROM]; |
| 1624 | 1624 | if (slotrom < 0) |
| 1625 | 1625 | return 0; |
| 1626 | ||
| 1626 | ||
| 1627 | 1627 | slotebr2 = cartslots->legacy_slotnumber[SLOTC_DROM]; |
| 1628 | 1628 | if (slotebr2 < 0) |
| 1629 | 1629 | return (((UINT16 *)cartslots->cartridge[slotrom].rom_ptr)[offset]); |
| r5931 | r5932 | |
| 1640 | 1640 | |
| 1641 | 1641 | static WRITE16_DEVICE_HANDLER( ti99_cart_w_legacy ) |
| 1642 | 1642 | { |
| 1643 | ||
| 1644 | /* if (hsgpl_crdena) | |
| 1645 | ti99_hsgpl_rom6_w(space, offset, data, mem_mask); | |
| 1646 | return; | |
| 1647 | */ | |
| 1643 | ||
| 1644 | /* if (hsgpl_crdena) | |
| 1645 | ti99_hsgpl_rom6_w(space, offset, data, mem_mask); | |
| 1646 | return; | |
| 1647 | */ | |
| 1648 | 1648 | int slotmbx, slotmini, slotebr2, slotrom; |
| 1649 | 1649 | ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token; |
| 1650 | 1650 | |
| r5931 | r5932 | |
| 1652 | 1652 | slotrom = cartslots->legacy_slotnumber[SLOTC_CROM]; |
| 1653 | 1653 | slotebr2 = cartslots->legacy_slotnumber[SLOTC_DROM]; |
| 1654 | 1654 | slotmini = cartslots->legacy_slotnumber[SLOTC_MINIMEM]; |
| 1655 | ||
| 1655 | ||
| 1656 | 1656 | if (slotmbx != -1) |
| 1657 | 1657 | { |
| 1658 | 1658 | if ((offset >= 0x0600) && (offset <= 0x07fe)) |
| r5931 | r5932 | |
| 1661 | 1661 | /* RAM in 0x6c00-0x6ffd (presumably non-paged) */ |
| 1662 | 1662 | /* mapper at 0x6ffe */ |
| 1663 | 1663 | COMBINE_DATA(((UINT16 *)cartslots->cartridge[slotmbx].ram_ptr) + offset - 0x0600); |
| 1664 | } | |
| 1664 | } | |
| 1665 | 1665 | else |
| 1666 | 1666 | { |
| 1667 | 1667 | if ((offset == 0x07ff) && ACCESSING_BITS_8_15) |
| r5931 | r5932 | |
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | 1690 | /* |
| 1691 | ||
| 1691 | TI-99/8 support. | |
| 1692 | 1692 | */ |
| 1693 | 1693 | static READ8_DEVICE_HANDLER( ti99_cart_r_legacy8 ) |
| 1694 | 1694 | { |
| 1695 | /* if (hsgpl_crdena) | |
| 1696 | return ti99_hsgpl_rom6_r(space, offset, mem_mask); | |
| 1695 | /* if (hsgpl_crdena) | |
| 1696 | return ti99_hsgpl_rom6_r(space, offset, mem_mask); | |
| 1697 | 1697 | */ |
| 1698 | 1698 | int slotmbx, slotmini, slotebr2, slotrom; |
| 1699 | 1699 | ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token; |
| r5931 | r5932 | |
| 1705 | 1705 | /* We are in the RAM area of MBX cartridges. */ |
| 1706 | 1706 | return ((UINT8 *)(cartslots->cartridge[slotmbx].ram_ptr))[offset-0x0c00]; |
| 1707 | 1707 | } |
| 1708 | ||
| 1708 | ||
| 1709 | 1709 | slotmini = cartslots->legacy_slotnumber[SLOTC_MINIMEM]; |
| 1710 | 1710 | if ((slotmini != -1) && (offset >= 0x1000) && (offset <= 0x1fff)) |
| 1711 | 1711 | { |
| r5931 | r5932 | |
| 1717 | 1717 | slotrom = cartslots->legacy_slotnumber[SLOTC_CROM]; |
| 1718 | 1718 | if (slotrom < 0) |
| 1719 | 1719 | return 0; |
| 1720 | ||
| 1720 | ||
| 1721 | 1721 | slotebr2 = cartslots->legacy_slotnumber[SLOTC_DROM]; |
| 1722 | 1722 | if (slotebr2 < 0) |
| 1723 | 1723 | return (((UINT8 *)cartslots->cartridge[slotrom].rom_ptr)[offset]); |
| r5931 | r5932 | |
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | 1735 | /* |
| 1736 | ||
| 1736 | TI-99/8 support. | |
| 1737 | 1737 | */ |
| 1738 | 1738 | static WRITE8_DEVICE_HANDLER( ti99_cart_w_legacy8 ) |
| 1739 | 1739 | { |
| 1740 | ||
| 1741 | /* if (hsgpl_crdena) | |
| 1742 | ti99_hsgpl_rom6_w(space, offset, data, mem_mask); | |
| 1743 | return; | |
| 1744 | */ | |
| 1740 | ||
| 1741 | /* if (hsgpl_crdena) | |
| 1742 | ti99_hsgpl_rom6_w(space, offset, data, mem_mask); | |
| 1743 | return; | |
| 1744 | */ | |
| 1745 | 1745 | int slotmbx, slotmini, slotebr2, slotrom; |
| 1746 | 1746 | ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token; |
| 1747 | 1747 | |
| r5931 | r5932 | |
| 1749 | 1749 | slotrom = cartslots->legacy_slotnumber[SLOTC_CROM]; |
| 1750 | 1750 | slotebr2 = cartslots->legacy_slotnumber[SLOTC_DROM]; |
| 1751 | 1751 | slotmini = cartslots->legacy_slotnumber[SLOTC_MINIMEM]; |
| 1752 | ||
| 1752 | ||
| 1753 | 1753 | if (slotmbx != -1) |
| 1754 | 1754 | { |
| 1755 | 1755 | if ((offset >= 0x0c00) && (offset <= 0x0ffd)) |
| r5931 | r5932 | |
| 1791 | 1791 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 1792 | 1792 | |
| 1793 | 1793 | /* Some comments originally in machine/ti99_4x.c */ |
| 1794 | ||
| 1794 | ||
| 1795 | 1795 | /* We identify file types according to their extension */ |
| 1796 | 1796 | /* Note that if we do not recognize the extension, we revert to the slot location <-> type |
| 1797 | scheme. */ | |
| 1798 | int id = 0; | |
| 1797 | scheme. */ | |
| 1798 | int id = 0; | |
| 1799 | 1799 | int i; |
| 1800 | 1800 | int filesize; |
| 1801 | 1801 | int maxrom = 0x2000; |
| 1802 | 1802 | slotc_type_t type; |
| 1803 | 1803 | int savembx; |
| 1804 | ||
| 1804 | ||
| 1805 | 1805 | const char *ch, *ch2; |
| 1806 | 1806 | const char *name = image_filename(image); |
| 1807 | 1807 | |
| r5931 | r5932 | |
| 1813 | 1813 | |
| 1814 | 1814 | UINT16 *cartmbx; |
| 1815 | 1815 | UINT8 *cartmbx8; |
| 1816 | ||
| 1816 | ||
| 1817 | 1817 | type = SLOTC_EMPTY; |
| 1818 | ||
| 1818 | ||
| 1819 | 1819 | /* There is a circuitry in TI99/4(a) that resets the console when a |
| 1820 | cartridge is inserted or removed. We emulate this instead of resetting the | |
| 1821 | emulator (which is the default in MESS). */ | |
| 1820 | cartridge is inserted or removed. We emulate this instead of resetting the | |
| 1821 | emulator (which is the default in MESS). */ | |
| 1822 | 1822 | /*cpu_set_input_line(machine->firstcpu, INPUT_LINE_RESET, PULSE_LINE); |
| 1823 | tms9901_reset(0); | |
| 1824 | if (! has_evpc) | |
| 1825 | TMS9928A_reset(); | |
| 1826 | if (has_evpc) | |
| 1827 | v9938_reset(0);*/ | |
| 1823 | tms9901_reset(0); | |
| 1824 | if (! has_evpc) | |
| 1825 | TMS9928A_reset(); | |
| 1826 | if (has_evpc) | |
| 1827 | v9938_reset(0);*/ | |
| 1828 | 1828 | |
| 1829 | 1829 | ch = strrchr(name, '.'); |
| 1830 | 1830 | ch2 = (ch-1 >= name) ? ch-1 : ""; |
| r5931 | r5932 | |
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | id = get_index_from_tagname(image)-1; |
| 1867 | ||
| 1867 | ||
| 1868 | 1868 | /* Remember where the cartridge part is plugged in. */ |
| 1869 | 1869 | cartslots->legacy_slotnumber[type] = id; |
| 1870 | ||
| 1870 | ||
| 1871 | 1871 | savembx = FALSE; |
| 1872 | ||
| 1872 | ||
| 1873 | 1873 | /* We will use the already allocated buffers in the memory regions, |
| 1874 | ||
| 1874 | and the pointers in the cartridge structure will point to them. */ | |
| 1875 | 1875 | switch (type) |
| 1876 | 1876 | { |
| 1877 | 1877 | case SLOTC_EMPTY: |
| r5931 | r5932 | |
| 1889 | 1889 | if (cartslots->legacy_slotnumber[SLOTC_MINIMEM] != -1) |
| 1890 | 1890 | { |
| 1891 | 1891 | /* This means the NVRAM has already been loaded. So we just |
| 1892 | ||
| 1892 | load 4K of ROM to avoid overwriting the NVRAM. */ | |
| 1893 | 1893 | maxrom = 0x1000; |
| 1894 | 1894 | } |
| 1895 | 1895 | |
| 1896 | 1896 | if (cartslots->legacy_slotnumber[SLOTC_MBX] != -1) |
| 1897 | 1897 | { |
| 1898 | 1898 | /* This means the NVRAM has already been loaded. |
| 1899 | We need to temporarily save the RAM contents and | |
| 1900 | write them back because the RAM overrides the | |
| 1901 | ROM in an intermediate area. */ | |
| 1899 | We need to temporarily save the RAM contents and | |
| 1900 | write them back because the RAM overrides the | |
| 1901 | ROM in an intermediate area. */ | |
| 1902 | 1902 | savembx = TRUE; |
| 1903 | 1903 | } |
| 1904 | 1904 | |
| r5931 | r5932 | |
| 1934 | 1934 | for (i = 0; i < maxrom/2; i++) |
| 1935 | 1935 | ((UINT16 *)cartrom)[i] = BIG_ENDIANIZE_INT16(((UINT16 *)cartrom)[i]); |
| 1936 | 1936 | cartslots->cartridge[id].rom_ptr = cartrom; |
| 1937 | cartslots->cartridge[id].rom_size = filesize; | |
| 1937 | cartslots->cartridge[id].rom_size = filesize; | |
| 1938 | 1938 | } |
| 1939 | 1939 | // printf("loaded ROM, size = %d\n", filesize); |
| 1940 | 1940 | break; |
| 1941 | ||
| 1941 | ||
| 1942 | 1942 | case SLOTC_MINIMEM: |
| 1943 | 1943 | /* Load the NVRAM. Need to BIG_ENDIANIZE it. |
| 1944 | ||
| 1944 | MiniMemory has only one cartridge page. */ | |
| 1945 | 1945 | if (is_99_8()) |
| 1946 | 1946 | { |
| 1947 | 1947 | // printf("** is 99/8\n"); |
| r5931 | r5932 | |
| 1949 | 1949 | cartslots->cartridge[id].ram_ptr = cart8rom + 0x1000; |
| 1950 | 1950 | } |
| 1951 | 1951 | else |
| 1952 | { | |
| 1952 | { | |
| 1953 | 1953 | image_battery_load(image, cartrom+0x800,0x1000); |
| 1954 | 1954 | for (i = 0x800; i < 0x1000; i++) |
| 1955 | 1955 | cartrom[i] = BIG_ENDIANIZE_INT16(cartrom[i]); |
| 1956 | 1956 | cartslots->cartridge[id].ram_ptr = (UINT16 *)cartrom + 0x800; |
| 1957 | 1957 | } |
| 1958 | cartslots->cartridge[id].ram_size = 0x1000; | |
| 1958 | cartslots->cartridge[id].ram_size = 0x1000; | |
| 1959 | 1959 | // printf("loaded NVRAM\n"); |
| 1960 | 1960 | break; |
| 1961 | 1961 | |
| r5931 | r5932 | |
| 1974 | 1974 | cartrom[i] = BIG_ENDIANIZE_INT16(cartrom[i]); |
| 1975 | 1975 | cartslots->cartridge[id].ram_ptr = (UINT16 *)cartrom + 0x600; |
| 1976 | 1976 | } |
| 1977 | cartslots->cartridge[id].ram_size = 0x0400; | |
| 1977 | cartslots->cartridge[id].ram_size = 0x0400; | |
| 1978 | 1978 | // printf("loaded NVRAM\n"); |
| 1979 | 1979 | break; |
| 1980 | 1980 | |
| r5931 | r5932 | |
| 1993 | 1993 | cartrom2[i] = BIG_ENDIANIZE_INT16(cartrom2[i]); |
| 1994 | 1994 | cartslots->cartridge[id].rom2_ptr = cartrom2; |
| 1995 | 1995 | } |
| 1996 | cartslots->cartridge[id].rom_size = filesize; | |
| 1996 | cartslots->cartridge[id].rom_size = filesize; | |
| 1997 | 1997 | // printf("loaded second ROM, size = %d\n", filesize); |
| 1998 | 1998 | break; |
| 1999 | 1999 | } |
| r5931 | r5932 | |
| 2007 | 2007 | |
| 2008 | 2008 | ti99_multicart_t *cartslots = (ti99_multicart_t *)cartsys->token; |
| 2009 | 2009 | |
| 2010 | slotc_type_t type = SLOTC_EMPTY; | |
| 2010 | slotc_type_t type = SLOTC_EMPTY; | |
| 2011 | 2011 | int slot = get_index_from_tagname(image)-1; |
| 2012 | ||
| 2012 | ||
| 2013 | 2013 | // printf("non-rpk unload\n"); |
| 2014 | ||
| 2014 | ||
| 2015 | 2015 | for (i=0; (i < 5) && (type==SLOTC_EMPTY); i++) |
| 2016 | 2016 | { |
| 2017 | 2017 | if (cartslots->legacy_slotnumber[i]==slot) |
| r5931 | r5932 | |
| 2029 | 2029 | case SLOTC_GROM: |
| 2030 | 2030 | memset(cartslots->cartridge[slot].grom_ptr, 0, 0xA000); |
| 2031 | 2031 | break; |
| 2032 | ||
| 2032 | ||
| 2033 | 2033 | case SLOTC_MINIMEM: |
| 2034 | if (is_99_8()) | |
| 2034 | if (is_99_8()) | |
| 2035 | 2035 | { |
| 2036 | 2036 | // printf("** is 99/8\n"); |
| 2037 | image_battery_save(image, cartslots->cartridge[slot].ram_ptr, 0x1000); | |
| 2037 | image_battery_save(image, cartslots->cartridge[slot].ram_ptr, 0x1000); | |
| 2038 | 2038 | memset(cartslots->cartridge[slot].ram_ptr, 0, 0x1000); |
| 2039 | 2039 | } |
| 2040 | else | |
| 2040 | else | |
| 2041 | 2041 | { |
| 2042 | 2042 | /* We BIG_ENDIANIZE before saving. This is consistent |
| 2043 | ||
| 2043 | with the cartridge save format. */ | |
| 2044 | 2044 | UINT16 *ramcont = (UINT16 *)cartslots->cartridge[slot].ram_ptr; |
| 2045 | 2045 | for (i = 0; i < 0x0800; i++) |
| 2046 | 2046 | ramcont[i] = BIG_ENDIANIZE_INT16(ramcont[i]); |
| r5931 | r5932 | |
| 2049 | 2049 | } |
| 2050 | 2050 | break; |
| 2051 | 2051 | case SLOTC_MBX: |
| 2052 | if (is_99_8()) | |
| 2052 | if (is_99_8()) | |
| 2053 | 2053 | { |
| 2054 | 2054 | // printf("** is 99/8\n"); |
| 2055 | image_battery_save(image, cartslots->cartridge[slot].ram_ptr, 0x0400); | |
| 2056 | memset(cartslots->cartridge[slot].ram_ptr, 0, 0x0400); | |
| 2055 | image_battery_save(image, cartslots->cartridge[slot].ram_ptr, 0x0400); | |
| 2056 | memset(cartslots->cartridge[slot].ram_ptr, 0, 0x0400); | |
| 2057 | 2057 | } |
| 2058 | else | |
| 2058 | else | |
| 2059 | 2059 | { |
| 2060 | 2060 | /* We BIG_ENDIANIZE before saving. This is consistent |
| 2061 | ||
| 2061 | with the cartridge save format. */ | |
| 2062 | 2062 | UINT16 *ramcont = (UINT16 *)cartslots->cartridge[slot].ram_ptr; |
| 2063 | 2063 | for (i = 0; i < 0x0200; i++) |
| 2064 | 2064 | ramcont[i] = BIG_ENDIANIZE_INT16(ramcont[i]); |
| 2065 | 2065 | image_battery_save(image, ramcont, 0x0400); |
| 2066 | 2066 | memset(ramcont, 0, 0x0400); |
| 2067 | } | |
| 2067 | } | |
| 2068 | 2068 | break; |
| 2069 | 2069 | case SLOTC_CROM: |
| 2070 | 2070 | if (cartslots->legacy_slotnumber[SLOTC_MINIMEM]!=-1) |
| r5931 | r5932 | |
| 2073 | 2073 | else |
| 2074 | 2074 | memset(cartslots->cartridge[slot].rom_ptr, 0, 0x2000); |
| 2075 | 2075 | break; |
| 2076 | ||
| 2076 | ||
| 2077 | 2077 | case SLOTC_DROM: |
| 2078 | 2078 | cartslots->cartridge[slot].rom_page = 0; |
| 2079 | 2079 | memset(cartslots->cartridge[slot].rom2_ptr, 0, 0x2000); |
| r5931 | r5932 | |
| 2084 | 2084 | } |
| 2085 | 2085 | |
| 2086 | 2086 | /***************************************************************************** |
| 2087 | The overall multi-cartridge slot system. It contains instances of | |
| 2087 | The overall multi-cartridge slot system. It contains instances of | |
| 2088 | 2088 | cartridges which contain PCB devices. The memory handlers delegate the calls |
| 2089 | 2089 | to the respective handlers of the cartridges. |
| 2090 | ||
| 2090 | ||
| 2091 | 2091 | Note that the term "multi-cartridge system" and "multicart" are not the same: |
| 2092 | 2092 | A "multicart" may contain multiple resources, organized on a PCB. The multi- |
| 2093 | 2093 | cart system may thus host multiple multicarts. |
| 2094 | ||
| 2094 | ||
| 2095 | 2095 | Actually, the name of the device should be changed (however, the device name |
| 2096 | 2096 | length is limited) |
| 2097 | 2097 | ******************************************************************************/ |
| 2098 | 2098 | /* |
| 2099 | ||
| 2099 | Instantiation of a multicart system for the TI family. | |
| 2100 | 2100 | */ |
| 2101 | 2101 | static DEVICE_START(ti99_multicart) |
| 2102 | 2102 | { |
| 2103 | 2103 | int i; |
| 2104 | // | |
| 2104 | // printf("DEVICE_START(ti99_multicart)\n"); | |
| 2105 | 2105 | ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token; |
| 2106 | 2106 | |
| 2107 | 2107 | /* Save this in the shortcut; we don't want to look for it each time |
| 2108 | that we have a memory access. And currently we do not plan for | |
| 2109 | multiple multicart instances. */ | |
| 2108 | that we have a memory access. And currently we do not plan for | |
| 2109 | multiple multicart instances. */ | |
| 2110 | 2110 | cartslots->active_slot = 0; |
| 2111 | 2111 | cartslots->next_free_slot = 0; |
| 2112 | ||
| 2112 | ||
| 2113 | 2113 | for (i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++) |
| 2114 | 2114 | { |
| 2115 | 2115 | cartslots->cartridge[i].pcb = NULL; |
| 2116 | 2116 | clear_slot(device, i); |
| 2117 | 2117 | } |
| 2118 | ||
| 2118 | ||
| 2119 | 2119 | /* Initialize the legacy system. */ |
| 2120 | 2120 | cartslots->legacy_slotnumber[SLOTC_GROM] = -1; |
| 2121 | 2121 | cartslots->legacy_slotnumber[SLOTC_CROM] = -1; |
| 2122 | 2122 | cartslots->legacy_slotnumber[SLOTC_DROM] = -1; |
| 2123 | 2123 | cartslots->legacy_slotnumber[SLOTC_MINIMEM] = -1; |
| 2124 | 2124 | cartslots->legacy_slotnumber[SLOTC_MBX] = -1; |
| 2125 | ||
| 2125 | ||
| 2126 | 2126 | cartslots->legacy_slots = 0; |
| 2127 | 2127 | cartslots->multi_slots = 0; |
| 2128 | ||
| 2129 | /* The cartslot system is initialized now. The cartridges themselves | |
| 2130 | need to check whether their parts are available. */ | |
| 2128 | ||
| 2129 | /* The cartslot system is initialized now. The cartridges themselves | |
| 2130 | need to check whether their parts are available. */ | |
| 2131 | 2131 | } |
| 2132 | ||
| 2132 | ||
| 2133 | 2133 | static DEVICE_STOP(ti99_multicart) |
| 2134 | 2134 | { |
| 2135 | // | |
| 2135 | // printf("DEVICE_STOP(ti99_multicart)\n"); | |
| 2136 | 2136 | } |
| 2137 | 2137 | /* |
| 2138 | Accesses the ROM regions of the cartridge for reading. | |
| 2139 | This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible | |
| 2140 | for all kinds of magic which is done inside this area, like swapping | |
| 2141 | banks or doing other control actions. These activities beyond simple | |
| 2142 | reading are cartridge-specific. Each kind of cartridge requires a | |
| 2143 | new type. | |
| 2144 | The currently set GROM bank determines which cartridge is actually | |
| 2145 | accessed, also for ROM reads. | |
| 2138 | Accesses the ROM regions of the cartridge for reading. | |
| 2139 | This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible | |
| 2140 | for all kinds of magic which is done inside this area, like swapping | |
| 2141 | banks or doing other control actions. These activities beyond simple | |
| 2142 | reading are cartridge-specific. Each kind of cartridge requires a | |
| 2143 | new type. | |
| 2144 | The currently set GROM bank determines which cartridge is actually | |
| 2145 | accessed, also for ROM reads. | |
| 2146 | 2146 | */ |
| 2147 | 2147 | READ16_DEVICE_HANDLER( ti99_multicart_r ) |
| 2148 | 2148 | { |
| 2149 | 2149 | ti99_multicart_t *cartslots = (ti99_multicart_t *) device->token; |
| 2150 | int slot = cartslots->active_slot; | |
| 2150 | int slot = cartslots->active_slot; | |
| 2151 | 2151 | cartridge_t *cart; |
| 2152 | ||
| 2152 | ||
| 2153 | 2153 | /* Sanity check. Higher slots are always empty. */ |
| 2154 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2154 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2155 | 2155 | return 0; |
| 2156 | ||
| 2156 | ||
| 2157 | 2157 | /* Same as above (GROM read): If there is only one cartridge there |
| 2158 | is no use of trying other banks. There is one issue with the | |
| 2159 | selection mechanism: When the console probes the GROM banks and | |
| 2160 | we have a ROM-only cartridge plugged in, it checks bank 0 and bank 1, | |
| 2161 | finds no GROM, and then fails to dummy-check bank 0 again which would | |
| 2162 | have set our cartridge expander to slot 0. But in slot 1 there is no | |
| 2163 | ROM cartridge, so nothing shows up in the selection list. We work | |
| 2164 | around this with the following line. */ | |
| 2158 | is no use of trying other banks. There is one issue with the | |
| 2159 | selection mechanism: When the console probes the GROM banks and | |
| 2160 | we have a ROM-only cartridge plugged in, it checks bank 0 and bank 1, | |
| 2161 | finds no GROM, and then fails to dummy-check bank 0 again which would | |
| 2162 | have set our cartridge expander to slot 0. But in slot 1 there is no | |
| 2163 | ROM cartridge, so nothing shows up in the selection list. We work | |
| 2164 | around this with the following line. */ | |
| 2165 | 2165 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2166 | 2166 | slot=0; |
| 2167 | 2167 | |
| r5931 | r5932 | |
| 2173 | 2173 | // Alternatively: |
| 2174 | 2174 | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); |
| 2175 | 2175 | |
| 2176 | // | |
| 2176 | // printf("rpk = %d, bin = %d\n", cartslots->multi_slots,cartslots->legacy_slots); | |
| 2177 | 2177 | |
| 2178 | 2178 | /* Handle legacy mode. */ |
| 2179 | 2179 | if (in_legacy_mode(device)) |
| 2180 | 2180 | { |
| 2181 | 2181 | return ti99_cart_r_legacy(device, offset, mem_mask); |
| 2182 | } | |
| 2183 | ||
| 2182 | } | |
| 2183 | ||
| 2184 | 2184 | if (!slot_is_empty(device, slot)) |
| 2185 | 2185 | { |
| 2186 | // | |
| 2186 | // printf("accessing cartridge in slot %d\n", slot); | |
| 2187 | 2187 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)cart->pcb->token; |
| 2188 | // | |
| 2188 | // printf("address=%lx, offset=%lx\n", pcbdef, offset); | |
| 2189 | 2189 | return (*pcbdef->read)(cart->pcb, offset, mem_mask); |
| 2190 | 2190 | } |
| 2191 | else | |
| 2191 | else | |
| 2192 | 2192 | { |
| 2193 | // | |
| 2193 | // printf("No cartridge in slot %d\n", slot); | |
| 2194 | 2194 | return 0; |
| 2195 | 2195 | } |
| 2196 | 2196 | } |
| 2197 | 2197 | |
| 2198 | 2198 | /* |
| 2199 | Accesses the ROM regions of the cartridge for writing. | |
| 2200 | This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible | |
| 2201 | for all kinds of magic which is done inside this area. Specifically, | |
| 2202 | writing is often used to swap banks for subsequent reads. The actual | |
| 2203 | effect of writing (beyond setting values in a RAM chip) are | |
| 2204 | cartridge-specific and must be handled within the cartridge pcb. | |
| 2205 | The currently set GROM bank determines which cartridge is actually | |
| 2206 | accessed, also for ROM reads. | |
| 2199 | Accesses the ROM regions of the cartridge for writing. | |
| 2200 | This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible | |
| 2201 | for all kinds of magic which is done inside this area. Specifically, | |
| 2202 | writing is often used to swap banks for subsequent reads. The actual | |
| 2203 | effect of writing (beyond setting values in a RAM chip) are | |
| 2204 | cartridge-specific and must be handled within the cartridge pcb. | |
| 2205 | The currently set GROM bank determines which cartridge is actually | |
| 2206 | accessed, also for ROM reads. | |
| 2207 | 2207 | */ |
| 2208 | 2208 | WRITE16_DEVICE_HANDLER( ti99_multicart_w ) |
| 2209 | 2209 | { |
| 2210 | 2210 | ti99_multicart_t *cartslots = (ti99_multicart_t *) device->token; |
| 2211 | 2211 | int slot = cartslots->active_slot; |
| 2212 | 2212 | cartridge_t *cart; |
| 2213 | ||
| 2213 | ||
| 2214 | 2214 | /* Sanity check. Higher slots are always empty. */ |
| 2215 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2215 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2216 | 2216 | return; |
| 2217 | ||
| 2217 | ||
| 2218 | 2218 | /* Same as above (READ16). */ |
| 2219 | 2219 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2220 | 2220 | slot=0; |
| 2221 | 2221 | |
| 2222 | 2222 | cart = &cartslots->cartridge[slot]; |
| 2223 | ||
| 2223 | ||
| 2224 | 2224 | /* Idle the CPU */ |
| 2225 | 2225 | cpu_adjust_icount(cputag_get_cpu(device->machine, "maincpu"),-4); |
| 2226 | // | |
| 2226 | // cpu_spinuntil_time(device->machine->firstcpu, ATTOTIME_IN_USEC(6)); | |
| 2227 | 2227 | |
| 2228 | 2228 | /* Handle legacy mode. */ |
| 2229 | 2229 | if (in_legacy_mode(device)) |
| 2230 | 2230 | { |
| 2231 | 2231 | ti99_cart_w_legacy(device, offset, data, mem_mask); |
| 2232 | } | |
| 2233 | else | |
| 2232 | } | |
| 2233 | else | |
| 2234 | 2234 | { |
| 2235 | 2235 | if (!slot_is_empty(device, slot)) |
| 2236 | 2236 | { |
| 2237 | // | |
| 2237 | // printf("writing to cartridge in slot %d\n", slot); | |
| 2238 | 2238 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)cart->pcb->token; |
| 2239 | 2239 | (*pcbdef->write)(cart->pcb, offset, data, mem_mask); |
| 2240 | 2240 | } |
| r5931 | r5932 | |
| 2250 | 2250 | { |
| 2251 | 2251 | ti99_multicart_t *cartslots = (ti99_multicart_t *) device->token; |
| 2252 | 2252 | cartridge_t *cart; |
| 2253 | ||
| 2253 | ||
| 2254 | 2254 | int slot = cartslots->active_slot; |
| 2255 | ||
| 2255 | ||
| 2256 | 2256 | /* Sanity check. Higher slots are always empty. */ |
| 2257 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2257 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2258 | 2258 | return 0; |
| 2259 | ||
| 2259 | ||
| 2260 | 2260 | /* Same as above (READ16). */ |
| 2261 | 2261 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2262 | 2262 | slot=0; |
| 2263 | 2263 | |
| 2264 | 2264 | cart = &cartslots->cartridge[slot]; |
| 2265 | ||
| 2265 | ||
| 2266 | 2266 | if (!slot_is_empty(device, slot)) |
| 2267 | 2267 | { |
| 2268 | 2268 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)cart->pcb->token; |
| r5931 | r5932 | |
| 2270 | 2270 | return (*pcbdef->cruread)(cart->pcb, offset); |
| 2271 | 2271 | } |
| 2272 | 2272 | return 0; |
| 2273 | } | |
| 2274 | ||
| 2273 | } | |
| 2274 | ||
| 2275 | 2275 | /* |
| 2276 | 2276 | Write cartridge mapper CRU interface (SuperSpace) |
| 2277 | 2277 | */ |
| r5931 | r5932 | |
| 2279 | 2279 | { |
| 2280 | 2280 | ti99_multicart_t *cartslots = (ti99_multicart_t *) device->token; |
| 2281 | 2281 | cartridge_t *cart; |
| 2282 | ||
| 2282 | ||
| 2283 | 2283 | int slot = cartslots->active_slot; |
| 2284 | ||
| 2284 | ||
| 2285 | 2285 | /* Sanity check. Higher slots are always empty. */ |
| 2286 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2286 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2287 | 2287 | return; |
| 2288 | ||
| 2288 | ||
| 2289 | 2289 | /* Same as above (READ16). */ |
| 2290 | 2290 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2291 | 2291 | slot=0; |
| r5931 | r5932 | |
| 2301 | 2301 | } |
| 2302 | 2302 | |
| 2303 | 2303 | /* |
| 2304 | TI-99/8 support. We have only 8 bit memory access, so we adapt all | |
| 2305 | functions to this width. | |
| 2304 | TI-99/8 support. We have only 8 bit memory access, so we adapt all | |
| 2305 | functions to this width. | |
| 2306 | 2306 | */ |
| 2307 | 2307 | READ8_DEVICE_HANDLER(ti99_multicart8_r) |
| 2308 | 2308 | { |
| 2309 | 2309 | ti99_multicart_t *cartslots = (ti99_multicart_t *) device->token; |
| 2310 | 2310 | cartridge_t *cart; |
| 2311 | ||
| 2311 | ||
| 2312 | 2312 | int slot = cartslots->active_slot; |
| 2313 | ||
| 2313 | ||
| 2314 | 2314 | /* Sanity check. Higher slots are always empty. */ |
| 2315 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2315 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2316 | 2316 | return 0; |
| 2317 | ||
| 2317 | ||
| 2318 | 2318 | /* Same as above (READ16). */ |
| 2319 | 2319 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2320 | 2320 | slot=0; |
| r5931 | r5932 | |
| 2328 | 2328 | if (in_legacy_mode(device)) |
| 2329 | 2329 | { |
| 2330 | 2330 | return ti99_cart_r_legacy8(device, offset); |
| 2331 | } | |
| 2332 | ||
| 2331 | } | |
| 2332 | ||
| 2333 | 2333 | if (!slot_is_empty(device, slot)) |
| 2334 | 2334 | { |
| 2335 | // | |
| 2335 | // printf("accessing cartridge in slot %d\n", slot); | |
| 2336 | 2336 | ti99_pcb_t *pcbdef = (ti99_pcb_t *)cart->pcb->token; |
| 2337 | 2337 | return (*pcbdef->read8)(cart->pcb, offset); |
| 2338 | 2338 | } |
| 2339 | else | |
| 2339 | else | |
| 2340 | 2340 | { |
| 2341 | // | |
| 2341 | // printf("No cartridge in slot %d\n", slot); | |
| 2342 | 2342 | return 0; |
| 2343 | 2343 | } |
| 2344 | 2344 | } |
| r5931 | r5932 | |
| 2347 | 2347 | { |
| 2348 | 2348 | ti99_multicart_t *cartslots = (ti99_multicart_t *) device->token; |
| 2349 | 2349 | cartridge_t *cart; |
| 2350 | ||
| 2350 | ||
| 2351 | 2351 | int slot = cartslots->active_slot; |
| 2352 | ||
| 2352 | ||
| 2353 | 2353 | /* Sanity check. Higher slots are always empty. */ |
| 2354 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2354 | if (slot >= NUMBER_OF_CARTRIDGE_SLOTS) | |
| 2355 | 2355 | return; |
| 2356 | ||
| 2356 | ||
| 2357 | 2357 | /* Same as above (READ16). */ |
| 2358 | 2358 | if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1) |
| 2359 | 2359 | slot=0; |
| r5931 | r5932 | |
| 2362 | 2362 | |
| 2363 | 2363 | /* Idle the CPU. TODO: Check whether this is correct for this machine. */ |
| 2364 | 2364 | cpu_adjust_icount(cputag_get_cpu(device->machine, "maincpu"),-4); |
| 2365 | ||
| 2365 | ||
| 2366 | 2366 | /* Handle legacy mode. */ |
| 2367 | 2367 | if (in_legacy_mode(device)) |
| 2368 | 2368 | { |
| 2369 | 2369 | ti99_cart_w_legacy8(device, offset, data); |
| 2370 | } | |
| 2371 | else | |
| 2370 | } | |
| 2371 | else | |
| 2372 | 2372 | { |
| 2373 | 2373 | if (!slot_is_empty(device, slot)) |
| 2374 | 2374 | { |
| r5931 | r5932 | |
| 2387 | 2387 | MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM) |
| 2388 | 2388 | MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER) |
| 2389 | 2389 | MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX) |
| 2390 | ||
| 2390 | ||
| 2391 | 2391 | MDRV_CARTSLOT_START(ti99_cartridge) |
| 2392 | 2392 | MDRV_CARTSLOT_LOAD(ti99_cartridge) |
| 2393 | 2393 | MDRV_CARTSLOT_UNLOAD(ti99_cartridge) |
| 2394 | ||
| 2394 | ||
| 2395 | 2395 | MDRV_CARTSLOT_ADD("cartridge2") |
| 2396 | 2396 | MDRV_CARTSLOT_EXTENSION_LIST("rpk,bin") |
| 2397 | 2397 | MDRV_CARTSLOT_PCBTYPE(0, "none", TI99_CARTRIDGE_PCB_NONE) |
| r5931 | r5932 | |
| 2452 | 2452 | case DEVINFO_INT_CLASS: |
| 2453 | 2453 | info->i = DEVICE_CLASS_PERIPHERAL; |
| 2454 | 2454 | break; |
| 2455 | ||
| 2455 | ||
| 2456 | 2456 | case DEVINFO_STR_FAMILY: |
| 2457 | 2457 | strcpy(info->s, "Multi-cartridge system"); |
| 2458 | 2458 | break; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | z80bin.c | |
| 4 | 4 | |
| 5 | A binary quickload format used by the Microbee, the Exidy Sorcerer | |
| 6 | VZ200/300 and the Super 80 | |
| 5 | A binary quickload format used by the Microbee, the Exidy Sorcerer | |
| 6 | VZ200/300 and the Super 80 | |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| r5931 | r5932 | |
| 23 | 23 | |
| 24 | 24 | /*------------------------------------------------- |
| 25 | 25 | z80bin_load_file - load a z80bin file into |
| 26 | ||
| 26 | memory | |
| 27 | 27 | -------------------------------------------------*/ |
| 28 | 28 | |
| 29 | 29 | static int z80bin_load_file(const device_config *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr ) |
| r5931 | r5932 | |
| 122 | 122 | else |
| 123 | 123 | { |
| 124 | 124 | if (autorun) |
| 125 | cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), REG_GENPC, exec_addr); | |
| 125 | cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), REG_GENPC, exec_addr); | |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cassette.c | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS interface to the cassette image abstraction code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | /********************************************************************* |
| 59 | ||
| 59 | cassette IO | |
| 60 | 60 | *********************************************************************/ |
| 61 | 61 | |
| 62 | 62 | INLINE int cassette_is_motor_on(const device_config *device) |
| r5931 | r5932 | |
| 227 | 227 | |
| 228 | 228 | |
| 229 | 229 | /********************************************************************* |
| 230 | ||
| 230 | cassette device init/load/unload/specify | |
| 231 | 231 | *********************************************************************/ |
| 232 | 232 | |
| 233 | 233 | static DEVICE_START( cassette ) |
| r5931 | r5932 | |
| 317 | 317 | |
| 318 | 318 | |
| 319 | 319 | /* |
| 320 | ||
| 320 | display a small tape icon, with the current position in the tape image | |
| 321 | 321 | */ |
| 322 | 322 | static void device_display_cassette(const device_config *image) |
| 323 | 323 | { |
| r5931 | r5932 | |
|---|---|---|
| 33 | 33 | struct _floppy_drive |
| 34 | 34 | { |
| 35 | 35 | const floppy_config *config; |
| 36 | ||
| 36 | ||
| 37 | 37 | /* flags */ |
| 38 | 38 | int flags; |
| 39 | 39 | /* maximum track allowed */ |
| r5931 | r5932 | |
| 247 | 247 | |
| 248 | 248 | /* this is called on device init */ |
| 249 | 249 | void floppy_drive_init(const device_config *img) |
| 250 | { | |
| 250 | { | |
| 251 | 251 | floppy_drive *pDrive = get_safe_token( img ); |
| 252 | 252 | |
| 253 | 253 | /* initialise flags */ |
| r5931 | r5932 | |
| 268 | 268 | pDrive->rpm = 300; |
| 269 | 269 | |
| 270 | 270 | pDrive->controller = NULL; |
| 271 | ||
| 271 | ||
| 272 | 272 | pDrive->custom_data = NULL; |
| 273 | ||
| 273 | ||
| 274 | 274 | pDrive->floppy_drive_type = FLOPPY_TYPE_REGULAR; |
| 275 | 275 | } |
| 276 | 276 | |
| r5931 | r5932 | |
| 770 | 770 | case 0 : return devtag_get_device(machine,FLOPPY_0); |
| 771 | 771 | case 1 : return devtag_get_device(machine,FLOPPY_1); |
| 772 | 772 | case 2 : return devtag_get_device(machine,FLOPPY_2); |
| 773 | case 3 : return devtag_get_device(machine,FLOPPY_3); | |
| 773 | case 3 : return devtag_get_device(machine,FLOPPY_3); | |
| 774 | 774 | } |
| 775 | 775 | return NULL; |
| 776 | 776 | } |
| r5931 | r5932 | |
| 799 | 799 | } |
| 800 | 800 | cnt++; |
| 801 | 801 | } |
| 802 | } | |
| 802 | } | |
| 803 | 803 | return NULL; |
| 804 | 804 | } |
| 805 | 805 | |
| r5931 | r5932 | |
| 822 | 822 | if (image==disk) { |
| 823 | 823 | return drive; |
| 824 | 824 | } |
| 825 | drive++; | |
| 825 | drive++; | |
| 826 | 826 | } |
| 827 | } | |
| 827 | } | |
| 828 | 828 | return drive; |
| 829 | 829 | } |
| 830 | 830 | |
| r5931 | r5932 | |
| 834 | 834 | if (devtag_get_device(machine,FLOPPY_0)) cnt++; |
| 835 | 835 | if (devtag_get_device(machine,FLOPPY_1)) cnt++; |
| 836 | 836 | if (devtag_get_device(machine,FLOPPY_2)) cnt++; |
| 837 | if (devtag_get_device(machine,FLOPPY_3)) cnt++; | |
| 837 | if (devtag_get_device(machine,FLOPPY_3)) cnt++; | |
| 838 | 838 | return cnt; |
| 839 | 839 | } |
| 840 | 840 | |
| r5931 | r5932 | |
| 863 | 863 | case DEVINFO_INT_IMAGE_TYPE: info->i = IO_FLOPPY; break; |
| 864 | 864 | case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break; |
| 865 | 865 | case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 1; break; |
| 866 | case DEVINFO_INT_IMAGE_CREATABLE: { | |
| 866 | case DEVINFO_INT_IMAGE_CREATABLE: { | |
| 867 | 867 | int cnt = 0; |
| 868 | 868 | if ( device && device->static_config ) |
| 869 | 869 | { |
| r5931 | r5932 | |
| 871 | 871 | int i; |
| 872 | 872 | for ( i = 0; floppy_options[i].construct; i++ ) { |
| 873 | 873 | if(floppy_options[i].param_guidelines) cnt++; |
| 874 | } | |
| 875 | } | |
| 874 | } | |
| 875 | } | |
| 876 | 876 | info->i = (cnt>0) ? 1 : 0; |
| 877 | 877 | } |
| 878 | 878 | break; |
| r5931 | r5932 | |
| 884 | 884 | case DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE: info->p = (void *)floppy_option_guide; break; |
| 885 | 885 | case DEVINFO_INT_IMAGE_CREATE_OPTCOUNT: { |
| 886 | 886 | const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config)->formats; |
| 887 | int count; | |
| 887 | int count; | |
| 888 | 888 | for (count = 0; floppy_options[count].construct; count++) |
| 889 | 889 | ; |
| 890 | 890 | info->i = count; |
| r5931 | r5932 | |
| 895 | 895 | case DEVINFO_STR_NAME: strcpy(info->s, "Floppy Disk"); break; |
| 896 | 896 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Floppy Disk"); break; |
| 897 | 897 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 898 | case DEVINFO_STR_IMAGE_FILE_EXTENSIONS: | |
| 898 | case DEVINFO_STR_IMAGE_FILE_EXTENSIONS: | |
| 899 | 899 | if ( device && device->static_config ) |
| 900 | 900 | { |
| 901 | 901 | const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config)->formats; |
| r5931 | r5932 | |
| 906 | 906 | specify_extension( info->s, 256, floppy_options[i].extensions ); |
| 907 | 907 | } |
| 908 | 908 | break; |
| 909 | default: | |
| 910 | { | |
| 909 | default: | |
| 910 | { | |
| 911 | 911 | if ( device && device->static_config ) |
| 912 | 912 | { |
| 913 | 913 | const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config)->formats; |
| 914 | 914 | if ((state >= DEVINFO_PTR_IMAGE_CREATE_OPTSPEC) && (state < DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + DEVINFO_CREATE_OPTMAX)) { |
| 915 | info->p = (void *) floppy_options[state - DEVINFO_PTR_IMAGE_CREATE_OPTSPEC].param_guidelines; | |
| 915 | info->p = (void *) floppy_options[state - DEVINFO_PTR_IMAGE_CREATE_OPTSPEC].param_guidelines; | |
| 916 | 916 | } else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTNAME) && (state < DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX)) { |
| 917 | 917 | safe_strcpy(info->s,floppy_options[state - DEVINFO_STR_IMAGE_CREATE_OPTNAME].name); |
| 918 | } | |
| 918 | } | |
| 919 | 919 | else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTDESC) && (state < DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX)) { |
| 920 | 920 | safe_strcpy(info->s,floppy_options[state - DEVINFO_STR_IMAGE_CREATE_OPTDESC].description); |
| 921 | } | |
| 921 | } | |
| 922 | 922 | else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTEXTS) && (state < DEVINFO_STR_IMAGE_CREATE_OPTEXTS + DEVINFO_CREATE_OPTMAX)) { |
| 923 | 923 | safe_strcpy(info->s,floppy_options[state - DEVINFO_STR_IMAGE_CREATE_OPTEXTS].extensions); |
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | } |
| 927 | ||
| 928 | break; | |
| 927 | ||
| 928 | break; | |
| 929 | 929 | } |
| 930 | 930 | } |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | sonydriv.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple/Sony 3.5" floppy drive emulation (to be interfaced with iwm.c) | |
| 6 | 6 | |
| 7 | ||
| 7 | Nate Woods, Raphael Nabet | |
| 8 | 8 | |
| 9 | This floppy drive was present in all variants of Lisa 2 (including Mac XL), | |
| 10 | and in all Macintosh in production before 1988, when SIWM and superdrive | |
| 11 | were introduced. | |
| 9 | This floppy drive was present in all variants of Lisa 2 (including Mac XL), | |
| 10 | and in all Macintosh in production before 1988, when SIWM and superdrive | |
| 11 | were introduced. | |
| 12 | 12 | |
| 13 | There were two variants : | |
| 14 | - A single-sided 400k unit which was used on Lisa 2/Mac XL, and Macintosh | |
| 15 | 128k/512k. This unit needs the computer to send the proper pulses to | |
| 16 | control the drive motor rotation. It can be connected to all early | |
| 17 | Macintosh (but not Mac Classic?) as an external unit. | |
| 18 | - A double-sided 800k unit which was used on Macintosh Plus, 512ke, and | |
| 19 | early SE and II*. This unit generates its own drive motor rotation | |
| 20 | control signals. It can be connected to earlier (and later) Macintosh as | |
| 21 | an external or internal unit. Some Lisa2/10 and Mac XL were upgraded to | |
| 22 | use it, too, but a fdc ROM upgrade was required. | |
| 13 | There were two variants : | |
| 14 | - A single-sided 400k unit which was used on Lisa 2/Mac XL, and Macintosh | |
| 15 | 128k/512k. This unit needs the computer to send the proper pulses to | |
| 16 | control the drive motor rotation. It can be connected to all early | |
| 17 | Macintosh (but not Mac Classic?) as an external unit. | |
| 18 | - A double-sided 800k unit which was used on Macintosh Plus, 512ke, and | |
| 19 | early SE and II*. This unit generates its own drive motor rotation | |
| 20 | control signals. It can be connected to earlier (and later) Macintosh as | |
| 21 | an external or internal unit. Some Lisa2/10 and Mac XL were upgraded to | |
| 22 | use it, too, but a fdc ROM upgrade was required. | |
| 23 | 23 | |
| 24 | * Note: I don't know for sure whether some Mac II were actually produced | |
| 25 | with a Superdrive unit, though Apple did sell an upgrade kit, made of | |
| 26 | a Superdrive unit, a SIWM controller and upgraded systems ROMs, which | |
| 27 | added HD and MFM support to existing Macintosh II. | |
| 24 | * Note: I don't know for sure whether some Mac II were actually produced | |
| 25 | with a Superdrive unit, though Apple did sell an upgrade kit, made of | |
| 26 | a Superdrive unit, a SIWM controller and upgraded systems ROMs, which | |
| 27 | added HD and MFM support to existing Macintosh II. | |
| 28 | 28 | |
| 29 | TODO : | |
| 30 | * bare images are supposed to be in Macintosh format (look for formatByte | |
| 31 | in sony_floppy_init(), and you will understand). We need to support | |
| 32 | Lisa, Apple II... | |
| 33 | * support for other image formats? | |
| 34 | * should we support more than 2 floppy disk units? (Mac SE *MAY* have | |
| 35 | supported 3 drives) | |
| 29 | TODO : | |
| 30 | * bare images are supposed to be in Macintosh format (look for formatByte | |
| 31 | in sony_floppy_init(), and you will understand). We need to support | |
| 32 | Lisa, Apple II... | |
| 33 | * support for other image formats? | |
| 34 | * should we support more than 2 floppy disk units? (Mac SE *MAY* have | |
| 35 | supported 3 drives) | |
| 36 | 36 | |
| 37 | 37 | *********************************************************************/ |
| 38 | 38 | |
| r5931 | r5932 | |
| 52 | 52 | #endif |
| 53 | 53 | |
| 54 | 54 | /* |
| 55 | ||
| 55 | These lines are normally connected to the PHI0-PHI3 lines of the IWM | |
| 56 | 56 | */ |
| 57 | 57 | enum |
| 58 | 58 | { |
| r5931 | r5932 | |
| 71 | 71 | static unsigned int rotation_speed; /* drive rotation speed - ignored if ext_speed_control == 0 */ |
| 72 | 72 | |
| 73 | 73 | /* |
| 74 | Structure that describes the state of a floppy drive, and the associated | |
| 75 | disk image | |
| 74 | Structure that describes the state of a floppy drive, and the associated | |
| 75 | disk image | |
| 76 | 76 | */ |
| 77 | 77 | typedef struct |
| 78 | 78 | { |
| r5931 | r5932 | |
| 192 | 192 | int result = 0; |
| 193 | 193 | |
| 194 | 194 | /* |
| 195 | * The Mac floppy controller was interesting in that its speed was adjusted | |
| 196 | * while the thing was running. On the tracks closer to the rim, it was | |
| 197 | * sped up so that more data could be placed on it. Hence, this function | |
| 198 | * has different results depending on the track number | |
| 199 | * | |
| 200 | * The Mac Plus (and probably the other Macs that use the IWM) verify that | |
| 201 | * the speed of the floppy drive is within a certain range depending on | |
| 202 | * what track the floppy is at. These RPM values are just guesses and are | |
| 203 | * probably not fully accurate, but they are within the range that the Mac | |
| 204 | * Plus expects and thus are probably in the right ballpark. | |
| 205 | * | |
| 206 | * Note - the timing values are the values returned by the Mac Plus routine | |
| 207 | * that calculates the speed; I'm not sure what units they are in | |
| 208 | */ | |
| 195 | * The Mac floppy controller was interesting in that its speed was adjusted | |
| 196 | * while the thing was running. On the tracks closer to the rim, it was | |
| 197 | * sped up so that more data could be placed on it. Hence, this function | |
| 198 | * has different results depending on the track number | |
| 199 | * | |
| 200 | * The Mac Plus (and probably the other Macs that use the IWM) verify that | |
| 201 | * the speed of the floppy drive is within a certain range depending on | |
| 202 | * what track the floppy is at. These RPM values are just guesses and are | |
| 203 | * probably not fully accurate, but they are within the range that the Mac | |
| 204 | * Plus expects and thus are probably in the right ballpark. | |
| 205 | * | |
| 206 | * Note - the timing values are the values returned by the Mac Plus routine | |
| 207 | * that calculates the speed; I'm not sure what units they are in | |
| 208 | */ | |
| 209 | 209 | |
| 210 | 210 | if (f->ext_speed_control) |
| 211 | 211 | { |
| r5931 | r5932 | |
| 217 | 217 | #if 1 /* Mac Plus */ |
| 218 | 218 | static const int speeds[] = |
| 219 | 219 | { |
| 220 | 500, /* 00-15: timing value 117B (acceptable range {1135-11E9} */ | |
| 221 | 550, /* 16-31: timing value ???? (acceptable range {12C6-138A} */ | |
| 222 | 600, /* 32-47: timing value ???? (acceptable range {14A7-157F} */ | |
| 223 | 675, /* 48-63: timing value ???? (acceptable range {16F2-17E2} */ | |
| 224 | 750 /* 64-79: timing value ???? (acceptable range {19D0-1ADE} */ | |
| 220 | 500, /* 00-15: timing value 117B (acceptable range {1135-11E9} */ | |
| 221 | 550, /* 16-31: timing value ???? (acceptable range {12C6-138A} */ | |
| 222 | 600, /* 32-47: timing value ???? (acceptable range {14A7-157F} */ | |
| 223 | 675, /* 48-63: timing value ???? (acceptable range {16F2-17E2} */ | |
| 224 | 750 /* 64-79: timing value ???? (acceptable range {19D0-1ADE} */ | |
| 225 | 225 | }; |
| 226 | 226 | #else /* Lisa 2 */ |
| 227 | 227 | /* 237 + 1.3*(256-reg) */ |
| 228 | 228 | static const int speeds[] = |
| 229 | 229 | { |
| 230 | 293, /* 00-15: timing value ???? (acceptable range {0330-0336} */ | |
| 231 | 322, /* 16-31: timing value ???? (acceptable range {02ED-02F3} */ | |
| 232 | 351, /* 32-47: timing value ???? (acceptable range {02A7-02AD} */ | |
| 233 | 394, /* 48-63: timing value ???? (acceptable range {0262-0266} */ | |
| 234 | 439 /* 64-79: timing value ???? (acceptable range {021E-0222} */ | |
| 230 | 293, /* 00-15: timing value ???? (acceptable range {0330-0336} */ | |
| 231 | 322, /* 16-31: timing value ???? (acceptable range {02ED-02F3} */ | |
| 232 | 351, /* 32-47: timing value ???? (acceptable range {02A7-02AD} */ | |
| 233 | 394, /* 48-63: timing value ???? (acceptable range {0262-0266} */ | |
| 234 | 439 /* 64-79: timing value ???? (acceptable range {021E-0222} */ | |
| 235 | 235 | }; |
| 236 | 236 | #endif |
| 237 | 237 | if (cur_image && image_exists(cur_image)) |
| r5931 | r5932 | |
| 321 | 321 | break; |
| 322 | 322 | case 0x0d: /* Unknown */ |
| 323 | 323 | /* I'm not sure what this one does, but the Mac Plus executes the |
| 324 | * following code that uses this status: | |
| 325 | * | |
| 326 | * 417E52: moveq #$d, D0 ; Status 0x0d | |
| 327 | * 417E54: bsr 4185fe ; Query IWM status | |
| 328 | * 417E58: bmi 417e82 ; If result=1, then skip | |
| 329 | * | |
| 330 | * This code is called in the Sony driver's open method, and | |
| 331 | * _AddDrive does not get called if this status 0x0d returns 1. | |
| 332 | * Hence, we are returning 0 | |
| 333 | */ | |
| 324 | * following code that uses this status: | |
| 325 | * | |
| 326 | * 417E52: moveq #$d, D0 ; Status 0x0d | |
| 327 | * 417E54: bsr 4185fe ; Query IWM status | |
| 328 | * 417E58: bmi 417e82 ; If result=1, then skip | |
| 329 | * | |
| 330 | * This code is called in the Sony driver's open method, and | |
| 331 | * _AddDrive does not get called if this status 0x0d returns 1. | |
| 332 | * Hence, we are returning 0 | |
| 333 | */ | |
| 334 | 334 | result = 0; |
| 335 | 335 | break; |
| 336 | 336 | case 0x0e: /* Tachometer */ |
| r5931 | r5932 | |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | static DEVICE_START( sonydriv_floppy ) |
| 469 | { | |
| 469 | { | |
| 470 | 470 | |
| 471 | 471 | DEVICE_START_CALL(floppy); |
| 472 | 472 | floppy_set_type(device,FLOPPY_TYPE_SONY); |
| r5931 | r5932 | |
| 480 | 480 | /* locate the FDC */ |
| 481 | 481 | fdc = devtag_get_device(image->machine, "fdc"); |
| 482 | 482 | |
| 483 | id = floppy_get_drive_by_type(image,FLOPPY_TYPE_SONY); | |
| 483 | id = floppy_get_drive_by_type(image,FLOPPY_TYPE_SONY); | |
| 484 | 484 | save_track_data(fdc, id); |
| 485 | 485 | memset(&sony_floppy[id], 0, sizeof(sony_floppy[id])); |
| 486 | 486 | |
| 487 | DEVICE_IMAGE_UNLOAD_NAME(floppy)(image); | |
| 487 | DEVICE_IMAGE_UNLOAD_NAME(floppy)(image); | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | DEVICE_GET_INFO( sonydriv ) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ti99cart.h | |
| 4 | 4 | |
| 5 | ||
| 5 | TI99 family cartridge management | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 21 | 21 | #define TI99_CARTRIDGE_PCB_SUPER DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_super) |
| 22 | 22 | #define TI99_CARTRIDGE_PCB_MBX DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_mbx) |
| 23 | 23 | |
| 24 | /* We set the number of slots to 8, although we may have up to 16. From a | |
| 24 | /* We set the number of slots to 8, although we may have up to 16. From a | |
| 25 | 25 | logical point of view we could have 256, but the operating system only checks |
| 26 | 26 | the first 16 banks. */ |
| 27 | 27 | #define NUMBER_OF_CARTRIDGE_SLOTS 8 |
| r5931 | r5932 | |
| 36 | 36 | /* GROM data buffer */ |
| 37 | 37 | UINT8 buf; |
| 38 | 38 | /* internal flip-flops that are set after the first access to the GROM |
| 39 | address so that next access is mapped to the LSB, and cleared after each | |
| 40 | data access */ | |
| 39 | address so that next access is mapped to the LSB, and cleared after each | |
| 40 | data access */ | |
| 41 | 41 | char raddr_LSB, waddr_LSB; |
| 42 | 42 | }; |
| 43 | 43 | typedef struct _GROM_port_t GROM_port_t; |
| r5931 | r5932 | |
| 47 | 47 | { |
| 48 | 48 | /* PCB device associated to this cartridge. If NULL, the slot is empty. */ |
| 49 | 49 | const device_config *pcb; |
| 50 | ||
| 50 | ||
| 51 | 51 | /* GROM buffer size. */ |
| 52 | 52 | int grom_size; |
| 53 | 53 | |
| r5931 | r5932 | |
| 67 | 67 | /* GROM buffered data output. */ |
| 68 | 68 | UINT8 grom_buffer; |
| 69 | 69 | |
| 70 | /* ROM buffer. We are using this for both 16 bit (99/4a) and 8 bit | |
| 71 | (99/8) access. */ | |
| 70 | /* ROM buffer. We are using this for both 16 bit (99/4a) and 8 bit | |
| 71 | (99/8) access. */ | |
| 72 | 72 | void *rom_ptr; |
| 73 | ||
| 74 | /* ROM buffer for the second bank of paged cartridges. Other cartridges | |
| 75 | usually store their ROM in one large file. */ | |
| 73 | ||
| 74 | /* ROM buffer for the second bank of paged cartridges. Other cartridges | |
| 75 | usually store their ROM in one large file. */ | |
| 76 | 76 | void *rom2_ptr; |
| 77 | 77 | |
| 78 | 78 | /* RAM buffer. The persistence service is done by the cartridge system. |
| 79 | ||
| 79 | The RAM space is a consecutive space; all banks are in one buffer. */ | |
| 80 | 80 | void *ram_ptr; |
| 81 | 81 | }; |
| 82 | 82 | typedef struct _cartridge_t cartridge_t; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | coco_pak.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for emulating standard CoCo cartridges | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 61 | 61 | { |
| 62 | 62 | coco_pak_pcb_t *pak_pcb = get_token(device); |
| 63 | 63 | cococart_line_value cart_line; |
| 64 | ||
| 64 | ||
| 65 | 65 | cart_line = input_port_read_safe(device->machine, "CARTAUTO", 0x01) |
| 66 | 66 | ? COCOCART_LINE_VALUE_Q |
| 67 | 67 | : COCOCART_LINE_VALUE_CLEAR; |
| r5931 | r5932 | |
| 76 | 76 | |
| 77 | 77 | /*------------------------------------------------- |
| 78 | 78 | DEVICE_GET_INFO(coco_cartridge_pcb_pak) - get |
| 79 | ||
| 79 | info function for standard CoCo cartridges | |
| 80 | 80 | -------------------------------------------------*/ |
| 81 | 81 | |
| 82 | 82 | DEVICE_GET_INFO(coco_cartridge_pcb_pak) |
| r5931 | r5932 | |
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | /*************************************************************************** |
| 108 | ||
| 108 | BANKED CARTRIDGES | |
| 109 | 109 | ***************************************************************************/ |
| 110 | 110 | |
| 111 | 111 | /*------------------------------------------------- |
| r5931 | r5932 | |
| 119 | 119 | UINT32 i; |
| 120 | 120 | UINT8 *rom = memory_region(device->machine, "cart"); |
| 121 | 121 | UINT32 rom_length = memory_region_length(device->machine, "cart"); |
| 122 | ||
| 122 | ||
| 123 | 123 | pos = (bank * 0x4000) % image_length(pak_pcb->cart); |
| 124 | 124 | |
| 125 | 125 | for (i = 0; i < rom_length / 0x4000; i++) |
| r5931 | r5932 | |
| 164 | 164 | |
| 165 | 165 | /*------------------------------------------------- |
| 166 | 166 | DEVICE_GET_INFO(coco_cartridge_pcb_pak_banked16k) - |
| 167 | ||
| 167 | get info function for banked CoCo cartridges | |
| 168 | 168 | -------------------------------------------------*/ |
| 169 | 169 | |
| 170 | 170 | DEVICE_GET_INFO(coco_cartridge_pcb_pak_banked16k) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | z80bin.h | |
| 4 | 4 | |
| 5 | A binary quickload format used by the Microbee, the Exidy Sorcerer | |
| 6 | VZ200/300 and the Super 80 | |
| 5 | A binary quickload format used by the Microbee, the Exidy Sorcerer | |
| 6 | VZ200/300 and the Super 80 | |
| 7 | 7 | |
| 8 | 8 | *********************************************************************/ |
| 9 | 9 | |
| r5931 | r5932 | |
| 37 | 37 | struct _z80bin_config |
| 38 | 38 | { |
| 39 | 39 | snapquick_config base; |
| 40 | z80bin_execute_func execute; | |
| 40 | z80bin_execute_func execute; | |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | 43 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cassette.h | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS interface to the cassette image abstraction code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 33 | 33 | { |
| 34 | 34 | floppy_type floppy_type; |
| 35 | 35 | const struct FloppyFormat *formats; |
| 36 | keep_geometry keep_drive_geometry; | |
| 36 | keep_geometry keep_drive_geometry; | |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | 39 | /* sector has a deleted data address mark */ |
| r5931 | r5932 | |
| 161 | 161 | MDRV_DEVICE_ADD(FLOPPY_2, FLOPPY, 0) \ |
| 162 | 162 | MDRV_DEVICE_CONFIG(_config) \ |
| 163 | 163 | MDRV_DEVICE_ADD(FLOPPY_3, FLOPPY, 0) \ |
| 164 | MDRV_DEVICE_CONFIG(_config) | |
| 164 | MDRV_DEVICE_CONFIG(_config) | |
| 165 | 165 | |
| 166 | 166 | #define MDRV_FLOPPY_4_DRIVES_MODIFY(_config) \ |
| 167 | 167 | MDRV_DEVICE_MODIFY(FLOPPY_0) \ |
| r5931 | r5932 | |
| 171 | 171 | MDRV_DEVICE_MODIFY(FLOPPY_2) \ |
| 172 | 172 | MDRV_DEVICE_CONFIG(_config) \ |
| 173 | 173 | MDRV_DEVICE_MODIFY(FLOPPY_3) \ |
| 174 | MDRV_DEVICE_CONFIG(_config) | |
| 174 | MDRV_DEVICE_CONFIG(_config) | |
| 175 | 175 | |
| 176 | 176 | #define MDRV_FLOPPY_4_DRIVES_REMOVE() \ |
| 177 | 177 | MDRV_DEVICE_REMOVE(FLOPPY_0) \ |
| 178 | 178 | MDRV_DEVICE_REMOVE(FLOPPY_1) \ |
| 179 | 179 | MDRV_DEVICE_REMOVE(FLOPPY_2) \ |
| 180 | MDRV_DEVICE_REMOVE(FLOPPY_3) | |
| 181 | ||
| 180 | MDRV_DEVICE_REMOVE(FLOPPY_3) | |
| 181 | ||
| 182 | 182 | #define MDRV_FLOPPY_2_DRIVES_ADD(_config) \ |
| 183 | 183 | MDRV_DEVICE_ADD(FLOPPY_0, FLOPPY, 0) \ |
| 184 | 184 | MDRV_DEVICE_CONFIG(_config) \ |
| 185 | 185 | MDRV_DEVICE_ADD(FLOPPY_1, FLOPPY, 0) \ |
| 186 | MDRV_DEVICE_CONFIG(_config) | |
| 186 | MDRV_DEVICE_CONFIG(_config) | |
| 187 | 187 | |
| 188 | 188 | #define MDRV_FLOPPY_2_DRIVES_MODIFY(_config) \ |
| 189 | 189 | MDRV_DEVICE_MODIFY(FLOPPY_0) \ |
| 190 | 190 | MDRV_DEVICE_CONFIG(_config) \ |
| 191 | 191 | MDRV_DEVICE_MODIFY(FLOPPY_1) \ |
| 192 | MDRV_DEVICE_CONFIG(_config) | |
| 192 | MDRV_DEVICE_CONFIG(_config) | |
| 193 | 193 | |
| 194 | 194 | #define MDRV_FLOPPY_2_DRIVES_REMOVE() \ |
| 195 | 195 | MDRV_DEVICE_REMOVE(FLOPPY_0) \ |
| 196 | MDRV_DEVICE_REMOVE(FLOPPY_1) | |
| 197 | ||
| 196 | MDRV_DEVICE_REMOVE(FLOPPY_1) | |
| 197 | ||
| 198 | 198 | #endif /* FLOPDRV_H */ |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | sonydriv.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple/Sony 3.5" floppy drive emulation (to be interfaced with applefdc.c) | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 15 | 15 | |
| 16 | 16 | /*enum |
| 17 | 17 | { |
| 18 | SONY_FLOPPY_ALLOW400K = 0x0001, | |
| 19 | SONY_FLOPPY_ALLOW800K = 0x0002, | |
| 18 | SONY_FLOPPY_ALLOW400K = 0x0001, | |
| 19 | SONY_FLOPPY_ALLOW800K = 0x0002, | |
| 20 | 20 | |
| 21 | SONY_FLOPPY_SUPPORT2IMG = 0x4000, | |
| 22 | SONY_FLOPPY_EXT_SPEED_CONTROL = 0x8000 // means the speed is controlled by computer | |
| 21 | SONY_FLOPPY_SUPPORT2IMG = 0x4000, | |
| 22 | SONY_FLOPPY_EXT_SPEED_CONTROL = 0x8000 // means the speed is controlled by computer | |
| 23 | 23 | }; |
| 24 | 24 | |
| 25 | 25 | */ |
| r5931 | r5932 | |
| 42 | 42 | MDRV_DEVICE_ADD(FLOPPY_0, FLOPPY_SONY, 0) \ |
| 43 | 43 | MDRV_DEVICE_CONFIG(_config) \ |
| 44 | 44 | MDRV_DEVICE_ADD(FLOPPY_1, FLOPPY_SONY, 0) \ |
| 45 | MDRV_DEVICE_CONFIG(_config) | |
| 45 | MDRV_DEVICE_CONFIG(_config) | |
| 46 | 46 | |
| 47 | 47 | #define MDRV_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(_config) \ |
| 48 | 48 | MDRV_DEVICE_ADD(FLOPPY_2, FLOPPY_SONY, 0) \ |
| 49 | 49 | MDRV_DEVICE_CONFIG(_config) \ |
| 50 | 50 | MDRV_DEVICE_ADD(FLOPPY_3, FLOPPY_SONY, 0) \ |
| 51 | MDRV_DEVICE_CONFIG(_config) | |
| 51 | MDRV_DEVICE_CONFIG(_config) | |
| 52 | 52 | |
| 53 | 53 | #define MDRV_FLOPPY_SONY_2_DRIVES_MODIFY(_config) \ |
| 54 | 54 | MDRV_DEVICE_MODIFY(FLOPPY_0) \ |
| 55 | 55 | MDRV_DEVICE_CONFIG(_config) \ |
| 56 | 56 | MDRV_DEVICE_MODIFY(FLOPPY_1) \ |
| 57 | MDRV_DEVICE_CONFIG(_config) | |
| 57 | MDRV_DEVICE_CONFIG(_config) | |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | microdrv.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for handling Microdrive devices | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 44 | 44 | <-- <ACK> |
| 45 | 45 | |
| 46 | 46 | and packet is: <SOH> <id> <0xff-id> <data0> ... <data127> <checksum> |
| 47 | ||
| 47 | ||
| 48 | 48 | <id> is 1 for the first packet, 2 for the 2d, etc... |
| 49 | 49 | <checksum> is the sum of <data0> to <data127> modulo 256 |
| 50 | 50 | |
| 51 | there are always 128 bytes of data in a packet, so, any file transfered is | |
| 51 | there are always 128 bytes of data in a packet, so, any file transfered is | |
| 52 | 52 | rounded to a multiple of 128 bytes, using 0-filler |
| 53 | 53 | */ |
| 54 | 54 | |
| r5931 | r5932 | |
| 65 | 65 | UINT32 id; /* block id, starting at 1 */ |
| 66 | 66 | UINT16 pos; /* position in block, including header */ |
| 67 | 67 | UINT8 state; /* one of XMODEM_ */ |
| 68 | ||
| 68 | ||
| 69 | 69 | const device_config* image; /* underlying image */ |
| 70 | 70 | |
| 71 | 71 | emu_timer* timer; /* used to send periodic NAKs */ |
| r5931 | r5932 | |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /* fills state->block with the data for packet number state->id |
| 91 | returns != 0 if fail or end of file | |
| 91 | returns != 0 if fail or end of file | |
| 92 | 92 | */ |
| 93 | 93 | static int xmodem_make_send_block( xmodem* state ) |
| 94 | 94 | { |
| r5931 | r5932 | |
| 103 | 103 | return 0; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | /* checks the received state->block packet and stores the data in the image | |
| 106 | /* checks the received state->block packet and stores the data in the image | |
| 107 | 107 | returns != 0 if fail (bad packet or bad image) |
| 108 | 108 | */ |
| 109 | 109 | static int xmodem_get_receive_block( xmodem* state ) |
| r5931 | r5932 | |
| 123 | 123 | /* the outside (us) sends a byte to the emulated machine */ |
| 124 | 124 | static void xmodem_send_byte( xmodem* state, UINT8 data ) |
| 125 | 125 | { |
| 126 | if ( state->conf && state->conf->send ) | |
| 126 | if ( state->conf && state->conf->send ) | |
| 127 | 127 | { |
| 128 | 128 | state->conf->send( state->machine, data ); |
| 129 | 129 | } |
| r5931 | r5932 | |
| 152 | 152 | state->id = 0; |
| 153 | 153 | state->pos = 0; |
| 154 | 154 | /* When idle, we send NAK periodically to tell the emulated machine that we are |
| 155 | always ready to receive. | |
| 156 | The 2 sec start time is here so that the machine does not get NAK instead of | |
| 157 | ACK or EOT as the last byte of a transfer. | |
| 158 | */ | |
| 155 | always ready to receive. | |
| 156 | The 2 sec start time is here so that the machine does not get NAK instead of | |
| 157 | ACK or EOT as the last byte of a transfer. | |
| 158 | */ | |
| 159 | 159 | timer_adjust_periodic( state->timer, ATTOTIME_IN_SEC( 2 ), 0, ATTOTIME_IN_SEC( 2 ) ); |
| 160 | 160 | } |
| 161 | 161 | |
| r5931 | r5932 | |
| 277 | 277 | LOG(( "xmodem: packet is invalid, sending NAK\n" )); |
| 278 | 278 | xmodem_send_byte( state, XMODEM_NAK ); |
| 279 | 279 | } |
| 280 | else | |
| 280 | else | |
| 281 | 281 | { |
| 282 | 282 | /* ok */ |
| 283 | 283 | LOG(( "xmodem: packet is valid, sending ACK\n" )); |
| r5931 | r5932 | |
|---|---|---|
| 2 | 2 | |
| 3 | 3 | cartslot.c |
| 4 | 4 | |
| 5 | ||
| 5 | Cartridge device | |
| 6 | 6 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 150 | 150 | while(!ROMENTRY_ISREGIONEND(roment)) |
| 151 | 151 | { |
| 152 | 152 | if (ROMENTRY_GETTYPE(roment) == ROMENTRYTYPE_CARTRIDGE) |
| 153 | { | |
| 153 | { | |
| 154 | 154 | if (strcmp(roment->_hashdata,image->tag)==0) |
| 155 | { | |
| 155 | { | |
| 156 | 156 | result = load_cartridge(image, romrgn, roment, mode); |
| 157 | 157 | if (!result) |
| 158 | 158 | return result; |
| r5931 | r5932 | |
| 222 | 222 | break; |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | if (socket != NULL) | |
| 225 | if (socket != NULL) | |
| 226 | 226 | result = socket->resource->length; |
| 227 | 227 | } |
| 228 | else | |
| 228 | else | |
| 229 | 229 | result = 0; |
| 230 | 230 | |
| 231 | 231 | return result; |
| r5931 | r5932 | |
| 248 | 248 | (*config->device_start)(device); |
| 249 | 249 | goto done; |
| 250 | 250 | } |
| 251 | ||
| 251 | ||
| 252 | 252 | /* find the PCB (if there is one) */ |
| 253 | 253 | cart->pcb_device = devtag_get_device( |
| 254 | 254 | device->machine, |
| r5931 | r5932 | |
| 264 | 264 | -------------------------------------------------*/ |
| 265 | 265 | |
| 266 | 266 | static DEVICE_IMAGE_LOAD( cartslot ) |
| 267 | { | |
| 267 | { | |
| 268 | 268 | int result; |
| 269 | 269 | cartslot_t *cart = get_token(image); |
| 270 | 270 | const cartslot_config *config = get_config(image); |
| r5931 | r5932 | |
| 355 | 355 | break; |
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | ||
| 358 | ||
| 359 | 359 | /* check for unknown PCB type */ |
| 360 | 360 | if ((mc != NULL) && (pcb_type == NULL)) |
| 361 | 361 | fatalerror("Unknown PCB type \"%s\"\n", astring_c(pcb_name)); |
| r5931 | r5932 | |
| 400 | 400 | -------------------------------------------------*/ |
| 401 | 401 | |
| 402 | 402 | DEVICE_GET_INFO( cartslot ) |
| 403 | { | |
| 403 | { | |
| 404 | 404 | switch(state) |
| 405 | 405 | { |
| 406 | 406 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| r5931 | r5932 | |
| 413 | 413 | case DEVINFO_INT_IMAGE_CREATABLE: info->i = 0; break; |
| 414 | 414 | case DEVINFO_INT_IMAGE_RESET_ON_LOAD: info->i = 1; break; |
| 415 | 415 | case DEVINFO_INT_IMAGE_MUST_BE_LOADED: if ( device && device->inline_config) { |
| 416 | info->i = get_config(device)->must_be_loaded; | |
| 416 | info->i = get_config(device)->must_be_loaded; | |
| 417 | 417 | } else { |
| 418 | info->i = 0; | |
| 418 | info->i = 0; | |
| 419 | 419 | } |
| 420 | 420 | break; |
| 421 | 421 | |
| 422 | 422 | /* --- the following bits of info are returned as pointers to functions --- */ |
| 423 | 423 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cartslot); break; |
| 424 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cartslot); break; | |
| 425 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cartslot); break; | |
| 424 | case DEVINFO_FCT_IMAGE_LOAD: info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(cartslot); break; | |
| 425 | case DEVINFO_FCT_IMAGE_UNLOAD: info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(cartslot); break; | |
| 426 | 426 | case DEVINFO_FCT_GET_IMAGE_DEVICES: info->f = (genf *) DEVICE_GET_IMAGE_DEVICES_NAME(cartslot); break; |
| 427 | 427 | case DEVINFO_FCT_IMAGE_PARTIAL_HASH: if ( device && device->inline_config && get_config(device)->device_partialhash) { |
| 428 | info->f = (genf *) get_config(device)->device_partialhash; | |
| 428 | info->f = (genf *) get_config(device)->device_partialhash; | |
| 429 | 429 | } else { |
| 430 | info->f = NULL; | |
| 430 | info->f = NULL; | |
| 431 | 431 | } |
| 432 | break; | |
| 432 | break; | |
| 433 | 433 | |
| 434 | 434 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 435 | 435 | case DEVINFO_STR_NAME: strcpy(info->s, "Cartslot"); break; |
| r5931 | r5932 | |
|---|---|---|
| 89 | 89 | UINT16 posin; /* position in pin */ |
| 90 | 90 | UINT16 posout; /* position in pout */ |
| 91 | 91 | UINT16 nbout; /* size of pout */ |
| 92 | ||
| 92 | ||
| 93 | 93 | UINT8 state; /* current protocol state */ |
| 94 | 94 | UINT8 retries; /* packet retries remaining */ |
| 95 | 95 | |
| r5931 | r5932 | |
| 156 | 156 | static void kermit_start_sending( kermit* state ) |
| 157 | 157 | { |
| 158 | 158 | int i; |
| 159 | ||
| 160 | for (i=1;i<state->nbout;i++) | |
| 161 | if (kermit_is_ctl(state->pout[i])) | |
| 159 | ||
| 160 | for (i=1;i<state->nbout;i++) | |
| 161 | if (kermit_is_ctl(state->pout[i])) | |
| 162 | 162 | logerror( "send: not char %i at pos %i\n", state->pout[i], i ); |
| 163 | 163 | |
| 164 | 164 | if ( state->nbout <= 0 ) return; |
| r5931 | r5932 | |
| 187 | 187 | |
| 188 | 188 | static void kermit_resend( kermit* state ) |
| 189 | 189 | { |
| 190 | if ( state->conf && state->conf->send ) | |
| 190 | if ( state->conf && state->conf->send ) | |
| 191 | 191 | { |
| 192 | 192 | /* retry */ |
| 193 | 193 | if ( state->nbout == 0 ) return; |
| r5931 | r5932 | |
| 196 | 196 | kermit_reset( state ); |
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | ||
| 199 | ||
| 200 | 200 | state->conf->send( state->machine, state->pout[ 0 ] ); |
| 201 | 201 | |
| 202 | 202 | state->posout = 1; |
| r5931 | r5932 | |
| 229 | 229 | { |
| 230 | 230 | /* escape control char */ |
| 231 | 231 | state->pout[ 2 + len ] = state->qctl; |
| 232 | len++; | |
| 232 | len++; | |
| 233 | 233 | state->pout[ 2 + len ] = kermit_ctl( c ); |
| 234 | 234 | } |
| 235 | 235 | else if ( (c & 0x7f) == state->qctl ) |
| 236 | 236 | { |
| 237 | 237 | /* escape escape char */ |
| 238 | 238 | state->pout[ 2 + len ] = state->qctl; |
| 239 | len++; | |
| 239 | len++; | |
| 240 | 240 | state->pout[ 2 + len ] = c; |
| 241 | 241 | } |
| 242 | 242 | else |
| r5931 | r5932 | |
| 296 | 296 | if ( len >= 7 ) state->padc = kermit_ctl( state->pin[ 7 ] ); |
| 297 | 297 | if ( len >= 8 ) state->eol = kermit_unchar( state->pin[ 8 ] ); |
| 298 | 298 | if ( len >= 9 ) state->qctl = state->pin[ 9 ]; |
| 299 | ||
| 299 | ||
| 300 | 300 | LOG(( "kermit: get conf: len=%i, maxl=%i, npad=%i, padc=%i, eol=%i, qctl=%i\n", |
| 301 | 301 | len, state->maxl, state->npad, state->padc, state->eol, state->qctl )); |
| 302 | 302 | |
| r5931 | r5932 | |
| 389 | 389 | state->state = KERMIT_IDLE; |
| 390 | 390 | state->seq = 0; |
| 391 | 391 | |
| 392 | if ( state->image ) | |
| 392 | if ( state->image ) | |
| 393 | 393 | { |
| 394 | 394 | image_fseek( state->image, SEEK_SET, 0 ); |
| 395 | 395 | } |
| r5931 | r5932 | |
| 402 | 402 | void kermit_receive_byte( const device_config *device, UINT8 data ) |
| 403 | 403 | { |
| 404 | 404 | kermit* state = (kermit*) device->token; |
| 405 | ||
| 405 | ||
| 406 | 406 | LOG(( "get %i %2x %c (%i)\n", data, data, data, state->posin )); |
| 407 | ||
| 407 | ||
| 408 | 408 | /* get SOH */ |
| 409 | if ( (data == KERMIT_SOH) && (state->posin <= 1) ) | |
| 409 | if ( (data == KERMIT_SOH) && (state->posin <= 1) ) | |
| 410 | 410 | { |
| 411 | 411 | state->pin[ 0 ] = data; |
| 412 | state->posin = 1; | |
| 412 | state->posin = 1; | |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | /* get packet contents */ |
| 416 | 416 | else if ( state->posin > 0 ) |
| 417 | 417 | { |
| 418 | if ( state->posin >= sizeof( state->pout ) ) | |
| 418 | if ( state->posin >= sizeof( state->pout ) ) | |
| 419 | 419 | { |
| 420 | 420 | LOG(( "kermit: too many bytes received\n" )); |
| 421 | 421 | state->posin = 0; |
| r5931 | r5932 | |
| 429 | 429 | state->pin[ state->posin ] = data; |
| 430 | 430 | state->posin++; |
| 431 | 431 | |
| 432 | if ( state->posin > 5 ) | |
| 432 | if ( state->posin > 5 ) | |
| 433 | 433 | { |
| 434 | 434 | int len, seq, typ; |
| 435 | if ( !kermit_is_char( state->pin[1] ) || | |
| 435 | if ( !kermit_is_char( state->pin[1] ) || | |
| 436 | 436 | (kermit_unchar( state->pin[1] ) < 3) || |
| 437 | 437 | (kermit_unchar( state->pin[1] ) > state->maxl) ) |
| 438 | 438 | { |
| r5931 | r5932 | |
| 447 | 447 | { |
| 448 | 448 | /* got packet! */ |
| 449 | 449 | state->posin = 0; |
| 450 | if ( kermit_validate_packet( state ) ) | |
| 450 | if ( kermit_validate_packet( state ) ) | |
| 451 | 451 | { |
| 452 | 452 | LOG(( "kermit: invalid packet\n" )); |
| 453 | 453 | kermit_resend( state ); |
| r5931 | r5932 | |
| 540 | 540 | /* send next packet */ |
| 541 | 541 | |
| 542 | 542 | state->seq = state->seq + 1; |
| 543 | ||
| 543 | ||
| 544 | 544 | switch ( state->state ) |
| 545 | 545 | { |
| 546 | 546 | case KERMIT_IDLE: |
| r5931 | r5932 | |
| 549 | 549 | kermit_send_string_packet( state, KERMIT_FILE, image_basename( state->image ) ); |
| 550 | 550 | state->state = KERMIT_SEND_DATA;; |
| 551 | 551 | break; |
| 552 | ||
| 552 | ||
| 553 | 553 | case KERMIT_SEND_DATA: |
| 554 | 554 | /* send next data packet or EOF */ |
| 555 | 555 | if ( image_feof( state->image ) ) |
| r5931 | r5932 | |
| 559 | 559 | } |
| 560 | 560 | else |
| 561 | 561 | { |
| 562 | kermit_send_data_packet( state ); | |
| 562 | kermit_send_data_packet( state ); | |
| 563 | 563 | } |
| 564 | 564 | break; |
| 565 | ||
| 565 | ||
| 566 | 566 | case KERMIT_SEND_EOF: |
| 567 | 567 | /* send EOT */ |
| 568 | 568 | kermit_send_simple_packet( state, KERMIT_EOT ); |
| 569 | 569 | state->state = KERMIT_SEND_EOT; |
| 570 | 570 | break; |
| 571 | ||
| 571 | ||
| 572 | 572 | case KERMIT_SEND_EOT: |
| 573 | 573 | /* reset */ |
| 574 | 574 | kermit_reset( state ); |
| 575 | 575 | state->state = KERMIT_RESET; |
| 576 | 576 | break; |
| 577 | ||
| 577 | ||
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | |
| r5931 | r5932 | |
| 590 | 590 | kermit_reset( state ); |
| 591 | 591 | } |
| 592 | 592 | break; |
| 593 | ||
| 593 | ||
| 594 | 594 | /* errors */ |
| 595 | 595 | |
| 596 | 596 | case KERMIT_ERR: |
| r5931 | r5932 | |
| 599 | 599 | kermit_reset( state ); |
| 600 | 600 | break; |
| 601 | 601 | |
| 602 | default: | |
| 602 | default: | |
| 603 | 603 | LOG(( "kermit: ignoring packet type %c\n", state->pin[ 3 ] )); |
| 604 | 604 | /* no abort, just ignoring */ |
| 605 | 605 | } |
| r5931 | r5932 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | /* called by XMODEM when it wants to send a byte to the emulated machine */ |
| 21 | 21 | void (*send)( running_machine *machine, UINT8 data ); |
| 22 | ||
| 22 | ||
| 23 | 23 | } xmodem_config; |
| 24 | 24 | |
| 25 | 25 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | coco_fdc.c | |
| 4 | 4 | |
| 5 | ||
| 5 | CoCo/Dragon FDC | |
| 6 | 6 | |
| 7 | The CoCo and Dragon both use the Western Digital floppy disk controllers. | |
| 8 | The CoCo uses either the WD1793 or the WD1773, the Dragon uses the WD2797, | |
| 9 | which mostly uses the same command set with some subtle differences, most | |
| 10 | notably the 2797 handles disk side select internally. The Dragon Alpha also | |
| 11 | uses the WD2797, however as this is a built in interface and not an external | |
| 12 | cartrige, it is dealt with in the main coco.c file. | |
| 7 | The CoCo and Dragon both use the Western Digital floppy disk controllers. | |
| 8 | The CoCo uses either the WD1793 or the WD1773, the Dragon uses the WD2797, | |
| 9 | which mostly uses the same command set with some subtle differences, most | |
| 10 | notably the 2797 handles disk side select internally. The Dragon Alpha also | |
| 11 | uses the WD2797, however as this is a built in interface and not an external | |
| 12 | cartrige, it is dealt with in the main coco.c file. | |
| 13 | 13 | |
| 14 | The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43 | |
| 15 | on the Dragon. In addition, there is another register | |
| 16 | called DSKREG that controls the interface with the wd1793. DSKREG is | |
| 17 | detailed below: But they appear to be | |
| 14 | The wd's variables are mapped to $FF48-$FF4B on the CoCo and on $FF40-$FF43 | |
| 15 | on the Dragon. In addition, there is another register | |
| 16 | called DSKREG that controls the interface with the wd1793. DSKREG is | |
| 17 | detailed below: But they appear to be | |
| 18 | 18 | |
| 19 | References: | |
| 20 | CoCo: Disk Basic Unravelled | |
| 21 | Dragon: Inferences from the PC-Dragon source code | |
| 22 | DragonDos Controller, Disk and File Formats by Graham E Kinns | |
| 19 | References: | |
| 20 | CoCo: Disk Basic Unravelled | |
| 21 | Dragon: Inferences from the PC-Dragon source code | |
| 22 | DragonDos Controller, Disk and File Formats by Graham E Kinns | |
| 23 | 23 | |
| 24 | ||
| 24 | --------------------------------------------------------------------------- | |
| 25 | 25 | |
| 26 | DSKREG - the control register | |
| 27 | CoCo ($FF40) Dragon ($FF48) | |
| 26 | DSKREG - the control register | |
| 27 | CoCo ($FF40) Dragon ($FF48) | |
| 28 | 28 | |
| 29 | Bit Bit | |
| 30 | 7 halt enable flag 7 not used | |
| 31 | 6 drive select #3 6 not used | |
| 32 | 5 density (0=single, 1=double) 5 NMI enable flag | |
| 33 | and NMI enable flag | |
| 34 | 4 write precompensation 4 write precompensation | |
| 35 | 3 drive motor activation 3 single density enable | |
| 36 | 2 drive select #2 2 drive motor activation | |
| 37 | 1 drive select #1 1 drive select high bit | |
| 38 | 0 drive select #0 0 drive select low bit | |
| 29 | Bit Bit | |
| 30 | 7 halt enable flag 7 not used | |
| 31 | 6 drive select #3 6 not used | |
| 32 | 5 density (0=single, 1=double) 5 NMI enable flag | |
| 33 | and NMI enable flag | |
| 34 | 4 write precompensation 4 write precompensation | |
| 35 | 3 drive motor activation 3 single density enable | |
| 36 | 2 drive select #2 2 drive motor activation | |
| 37 | 1 drive select #1 1 drive select high bit | |
| 38 | 0 drive select #0 0 drive select low bit | |
| 39 | 39 | |
| 40 | ||
| 40 | Reading from $FF48-$FF4F clears bit 7 of DSKREG ($FF40) | |
| 41 | 41 | |
| 42 | ||
| 42 | --------------------------------------------------------------------------- | |
| 43 | 43 | |
| 44 | ||
| 44 | 2007-02-22, P.Harvey-Smith | |
| 45 | 45 | |
| 46 | Began implementing the Dragon Delta Dos controler, this was actually the first | |
| 47 | Dragon disk controler to market, beating Dragon Data's by a couple of months, | |
| 48 | it is based around the WD2791 FDC, which is compatible with the WD1793/WD2797 used | |
| 49 | by the standard CoCo and Dragon disk controlers except that it used an inverted | |
| 50 | data bus, which is the reason the read/write handlers invert the data. This | |
| 51 | controler like, the DragonDos WD2797 is mapped at $FF40-$FF43, in the normal | |
| 52 | register order. | |
| 46 | Began implementing the Dragon Delta Dos controler, this was actually the first | |
| 47 | Dragon disk controler to market, beating Dragon Data's by a couple of months, | |
| 48 | it is based around the WD2791 FDC, which is compatible with the WD1793/WD2797 used | |
| 49 | by the standard CoCo and Dragon disk controlers except that it used an inverted | |
| 50 | data bus, which is the reason the read/write handlers invert the data. This | |
| 51 | controler like, the DragonDos WD2797 is mapped at $FF40-$FF43, in the normal | |
| 52 | register order. | |
| 53 | 53 | |
| 54 | The Delta cart also has a register (74LS174 hex flipflop) at $FF44 encoded as | |
| 55 | follows :- | |
| 54 | The Delta cart also has a register (74LS174 hex flipflop) at $FF44 encoded as | |
| 55 | follows :- | |
| 56 | 56 | |
| 57 | Bit | |
| 58 | 7 not used | |
| 59 | 6 not used | |
| 60 | 5 not used | |
| 61 | 4 Single (0) / Double (1) density select | |
| 62 | 3 5.25"(0) / 8"(1) Clock select | |
| 63 | 2 Side select | |
| 64 | 1 Drive select ms bit | |
| 65 | 0 Drive select ls bit | |
| 57 | Bit | |
| 58 | 7 not used | |
| 59 | 6 not used | |
| 60 | 5 not used | |
| 61 | 4 Single (0) / Double (1) density select | |
| 62 | 3 5.25"(0) / 8"(1) Clock select | |
| 63 | 2 Side select | |
| 64 | 1 Drive select ms bit | |
| 65 | 0 Drive select ls bit | |
| 66 | 66 | |
| 67 | 67 | *********************************************************************/ |
| 68 | 68 | |
| r5931 | r5932 | |
| 178 | 178 | { |
| 179 | 179 | rtc_type_t result; |
| 180 | 180 | fdc_t *fdc = get_token(device); |
| 181 | ||
| 181 | ||
| 182 | 182 | result = (int) input_port_read_safe(device->machine, "real_time_clock", RTC_NONE); |
| 183 | 183 | |
| 184 | 184 | /* check to make sure we don't have any invalid values */ |
| r5931 | r5932 | |
| 291 | 291 | |
| 292 | 292 | /*------------------------------------------------- |
| 293 | 293 | fdc_coco_update_lines - CoCo specific disk |
| 294 | ||
| 294 | controller lines | |
| 295 | 295 | -------------------------------------------------*/ |
| 296 | 296 | |
| 297 | 297 | static void fdc_coco_update_lines(const device_config *device) |
| r5931 | r5932 | |
| 319 | 319 | |
| 320 | 320 | /*------------------------------------------------- |
| 321 | 321 | fdc_coco_dskreg_w - function to write to CoCo |
| 322 | ||
| 322 | dskreg | |
| 323 | 323 | -------------------------------------------------*/ |
| 324 | 324 | |
| 325 | 325 | static void fdc_coco_dskreg_w(const device_config *device, UINT8 data) |
| r5931 | r5932 | |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /* An email from John Kowalski informed me that if the DS3 is |
| 346 | * high, and one of the other drive bits is selected (DS0-DS2), then the | |
| 347 | * second side of DS0, DS1, or DS2 is selected. If multiple bits are | |
| 348 | * selected in other situations, then both drives are selected, and any | |
| 349 | * read signals get yucky. | |
| 350 | */ | |
| 346 | * high, and one of the other drive bits is selected (DS0-DS2), then the | |
| 347 | * second side of DS0, DS1, or DS2 is selected. If multiple bits are | |
| 348 | * selected in other situations, then both drives are selected, and any | |
| 349 | * read signals get yucky. | |
| 350 | */ | |
| 351 | 351 | |
| 352 | 352 | if (data & 0x04) |
| 353 | 353 | drive = 2; |
| r5931 | r5932 | |
| 470 | 470 | |
| 471 | 471 | /*------------------------------------------------- |
| 472 | 472 | DEVICE_GET_INFO(coco_cartridge_pcb_fdc_coco) - |
| 473 | ||
| 473 | get info function for the CoCo FDC | |
| 474 | 474 | -------------------------------------------------*/ |
| 475 | 475 | |
| 476 | 476 | DEVICE_GET_INFO(coco_cartridge_pcb_fdc_coco) |
| r5931 | r5932 | |
| 481 | 481 | MDRV_DS1315_ADD(CLOUD9_TAG) |
| 482 | 482 | MACHINE_DRIVER_END |
| 483 | 483 | |
| 484 | static const fdc_hardware_type hwtype = | |
| 484 | static const fdc_hardware_type hwtype = | |
| 485 | 485 | { |
| 486 | 486 | "CoCo FDC", |
| 487 | 487 | fdc_coco_update_lines, |
| r5931 | r5932 | |
| 502 | 502 | |
| 503 | 503 | /*------------------------------------------------- |
| 504 | 504 | fdc_dragon_update_lines - Dragon specific disk |
| 505 | ||
| 505 | controller lines | |
| 506 | 506 | -------------------------------------------------*/ |
| 507 | 507 | |
| 508 | 508 | static void fdc_dragon_update_lines(const device_config *device) |
| r5931 | r5932 | |
| 525 | 525 | |
| 526 | 526 | /*------------------------------------------------- |
| 527 | 527 | fdc_dragon_dskreg_w - function to write to |
| 528 | ||
| 528 | Dragon dskreg | |
| 529 | 529 | -------------------------------------------------*/ |
| 530 | 530 | |
| 531 | 531 | static void fdc_dragon_dskreg_w(const device_config *device, UINT8 data) |
| r5931 | r5932 | |
| 622 | 622 | |
| 623 | 623 | /*------------------------------------------------- |
| 624 | 624 | DEVICE_GET_INFO(coco_cartridge_pcb_fdc_dragon) - |
| 625 | ||
| 625 | get info function for the CoCo FDC | |
| 626 | 626 | -------------------------------------------------*/ |
| 627 | 627 | |
| 628 | 628 | DEVICE_GET_INFO(coco_cartridge_pcb_fdc_dragon) |
| r5931 | r5932 | |
| 631 | 631 | MDRV_WD179X_ADD(WD_TAG, coco_wd17xx_interface) |
| 632 | 632 | MACHINE_DRIVER_END |
| 633 | 633 | |
| 634 | static const fdc_hardware_type hwtype = | |
| 634 | static const fdc_hardware_type hwtype = | |
| 635 | 635 | { |
| 636 | 636 | "Dragon FDC", |
| 637 | 637 | fdc_dragon_update_lines, |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | Cartrige loading | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| r5931 | r5932 | |
| 57 | 57 | int must_be_loaded; |
| 58 | 58 | device_start_func device_start; |
| 59 | 59 | device_image_load_func device_load; |
| 60 | device_image_unload_func device_unload; | |
| 60 | device_image_unload_func device_unload; | |
| 61 | 61 | device_image_partialhash_func device_partialhash; |
| 62 | 62 | cartslot_pcb_type pcb_types[8]; |
| 63 | 63 | }; |
| r5931 | r5932 | |
|---|---|---|
| 19 | 19 | |
| 20 | 20 | /* called by Kermit when it wants to send a byte to the emulated machine */ |
| 21 | 21 | void (*send)( running_machine *machine, UINT8 data ); |
| 22 | ||
| 22 | ||
| 23 | 23 | } kermit_config; |
| 24 | 24 | |
| 25 | 25 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | Code to interface the MESS image code with MAME's CHD-CD core. | |
| 4 | 4 | |
| 5 | ||
| 5 | Based on harddriv.c by Raphael Nabet 2003 | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 53 | 53 | |
| 54 | 54 | /*------------------------------------------------- |
| 55 | 55 | parse_string - convert a ram string to an |
| 56 | ||
| 56 | integer value | |
| 57 | 57 | -------------------------------------------------*/ |
| 58 | 58 | |
| 59 | 59 | static UINT32 parse_string(const char *s) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | coco_232.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for emulating the CoCo RS-232 PAK | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 77 | 77 | |
| 78 | 78 | if ((offset >= 0x28) && (offset <= 0x2F)) |
| 79 | 79 | result = acia_6551_r(pak_pcb->uart, offset - 0x28); |
| 80 | ||
| 80 | ||
| 81 | 81 | return result; |
| 82 | 82 | } |
| 83 | 83 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | chd_cd.h | |
| 4 | 4 | |
| 5 | ||
| 5 | MESS interface to the MAME CHD CDROM code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | appldriv.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | #include "driver.h" |
| r5931 | r5932 | |
| 141 | 141 | if (devtag_get_device(machine,FLOPPY_3)!=NULL && flopimg_get_custom_data(devtag_get_device(machine,FLOPPY_3))!=NULL) cnt++; |
| 142 | 142 | return cnt; |
| 143 | 143 | } |
| 144 | ||
| 144 | ||
| 145 | 145 | void apple525_set_lines(const device_config *device,UINT8 lines) |
| 146 | 146 | { |
| 147 | 147 | int i, count; |
| r5931 | r5932 | |
| 151 | 151 | for (i = 0; i < count; i++) |
| 152 | 152 | { |
| 153 | 153 | if (apple525_enable_mask & (1 << i)) |
| 154 | { | |
| 154 | { | |
| 155 | 155 | image = floppy_get_device_by_type(device->machine, FLOPPY_TYPE_APPLE, i); |
| 156 | 156 | if (image) |
| 157 | 157 | apple525_disk_set_lines(device,image, lines); |
| r5931 | r5932 | |
| 212 | 212 | static const device_config *apple525_selected_image(running_machine *machine) |
| 213 | 213 | { |
| 214 | 214 | int i,count; |
| 215 | ||
| 215 | ||
| 216 | 216 | count = apple525_get_count(machine); |
| 217 | ||
| 217 | ||
| 218 | 218 | for (i = 0; i < count; i++) |
| 219 | 219 | { |
| 220 | 220 | if (apple525_enable_mask & (1 << i)) |
| r5931 | r5932 | |
| 242 | 242 | { |
| 243 | 243 | int i, count, result = 0; |
| 244 | 244 | const device_config *image; |
| 245 | ||
| 245 | ||
| 246 | 246 | count = apple525_get_count(device->machine); |
| 247 | ||
| 247 | ||
| 248 | 248 | for (i = 0; i < count; i++) |
| 249 | 249 | { |
| 250 | 250 | if (apple525_enable_mask & (1 << i)) |
| r5931 | r5932 | |
| 260 | 260 | /* ----------------------------------------------------------------------- */ |
| 261 | 261 | |
| 262 | 262 | static DEVICE_START( apple525_floppy ) |
| 263 | { | |
| 263 | { | |
| 264 | 264 | |
| 265 | 265 | DEVICE_START_CALL(floppy); |
| 266 | flopimg_alloc_custom_data(device,auto_alloc_clear(device->machine,struct apple525_disk)); | |
| 266 | flopimg_alloc_custom_data(device,auto_alloc_clear(device->machine,struct apple525_disk)); | |
| 267 | 267 | floppy_set_type(device,FLOPPY_TYPE_APPLE); |
| 268 | 268 | } |
| 269 | 269 | |
| r5931 | r5932 | |
| 279 | 279 | { |
| 280 | 280 | apple525_save_current_track(image, TRUE); |
| 281 | 281 | |
| 282 | DEVICE_IMAGE_UNLOAD_NAME(floppy)(image); | |
| 282 | DEVICE_IMAGE_UNLOAD_NAME(floppy)(image); | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | DEVICE_GET_INFO( apple525 ) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | aescart.c | |
| 4 | 4 | |
| 5 | Neo-Geo AES cartridge management | |
| 6 | R. Belmont, 2009 | |
| 5 | Neo-Geo AES cartridge management | |
| 6 | R. Belmont, 2009 | |
| 7 | 7 | |
| 8 | ||
| 8 | Based on ti99cart.c by Michael Zapf | |
| 9 | 9 | |
| 10 | We leave the support in place for multiple slots in case MAME | |
| 11 | uses this at some future point for MVS multi-cart. | |
| 12 | ||
| 10 | We leave the support in place for multiple slots in case MAME | |
| 11 | uses this at some future point for MVS multi-cart. | |
| 12 | ||
| 13 | 13 | *********************************************************************/ |
| 14 | 14 | #include "driver.h" |
| 15 | 15 | #include "aescart.h" |
| r5931 | r5932 | |
| 28 | 28 | struct _aes_multicart_t |
| 29 | 29 | { |
| 30 | 30 | /* Reserves space for all cartridges. This is also used in the legacy |
| 31 | ||
| 31 | cartridge system, but only for slot 0. */ | |
| 32 | 32 | aescartridge_t cartridge[AES_NUMBER_OF_CARTRIDGE_SLOTS]; |
| 33 | 33 | |
| 34 | 34 | /* Determines which slot is currently active. This value is changed when there |
| 35 | ||
| 35 | are accesses to other GROM base addresses. */ | |
| 36 | 36 | int active_slot; |
| 37 | ||
| 38 | /* Used in order to enforce a special slot. This value is retrieved | |
| 39 | from the dipswitch setting. A value of -1 means automatic, that is, | |
| 40 | the grom base switch is used. Values 0 .. max refer to the | |
| 41 | respective slot. */ | |
| 37 | ||
| 38 | /* Used in order to enforce a special slot. This value is retrieved | |
| 39 | from the dipswitch setting. A value of -1 means automatic, that is, | |
| 40 | the grom base switch is used. Values 0 .. max refer to the | |
| 41 | respective slot. */ | |
| 42 | 42 | int fixed_slot; |
| 43 | 43 | |
| 44 | /* Holds the highest index of a cartridge being plugged in plus one. | |
| 45 | If we only have one cartridge inserted, we don't want to get a | |
| 46 | selection option, so we just mirror the memory contents. */ | |
| 44 | /* Holds the highest index of a cartridge being plugged in plus one. | |
| 45 | If we only have one cartridge inserted, we don't want to get a | |
| 46 | selection option, so we just mirror the memory contents. */ | |
| 47 | 47 | int next_free_slot; |
| 48 | ||
| 49 | /* Counts the number of slots which currently contain legacy format | |
| 50 | cartridge images. */ | |
| 48 | ||
| 49 | /* Counts the number of slots which currently contain legacy format | |
| 50 | cartridge images. */ | |
| 51 | 51 | int legacy_slots; |
| 52 | 52 | |
| 53 | /* Counts the number of slots which currently contain new format | |
| 54 | cartridge images. */ | |
| 53 | /* Counts the number of slots which currently contain new format | |
| 54 | cartridge images. */ | |
| 55 | 55 | int multi_slots; |
| 56 | 56 | }; |
| 57 | 57 | typedef struct _aes_multicart_t aes_multicart_t; |
| r5931 | r5932 | |
| 63 | 63 | { |
| 64 | 64 | /* Link up to the cartridge structure which contains this pcb. */ |
| 65 | 65 | aescartridge_t *cartridge; |
| 66 | ||
| 66 | ||
| 67 | 67 | /* Function to assemble this cartridge. */ |
| 68 | 68 | assmfct *assemble; |
| 69 | ||
| 69 | ||
| 70 | 70 | /* Function to disassemble this cartridge. */ |
| 71 | 71 | assmfct *disassemble; |
| 72 | 72 | }; |
| 73 | 73 | typedef struct _aes_pcb_t aes_pcb_t; |
| 74 | 74 | |
| 75 | /* | |
| 76 | Find the index of the cartridge name. We assume the format | |
| 77 | <name><number>, i.e. the number is the longest string from the right | |
| 78 | which can be interpreted as a number. | |
| 75 | /* | |
| 76 | Find the index of the cartridge name. We assume the format | |
| 77 | <name><number>, i.e. the number is the longest string from the right | |
| 78 | which can be interpreted as a number. | |
| 79 | 79 | */ |
| 80 | 80 | static int get_index_from_tagname(const device_config *image) |
| 81 | 81 | { |
| r5931 | r5932 | |
| 83 | 83 | int maxlen = strlen(tag); |
| 84 | 84 | int i; |
| 85 | 85 | for (i=maxlen-1; i >=0; i--) |
| 86 | if (tag[i] < 48 || tag[i] > 57) break; | |
| 86 | if (tag[i] < 48 || tag[i] > 57) break; | |
| 87 | 87 | |
| 88 | 88 | return atoi(tag+i+1); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /* |
| 92 | ||
| 92 | Common routine to assemble cartridges from resources. | |
| 93 | 93 | */ |
| 94 | 94 | static aescartridge_t *assemble_common(running_machine *machine, const device_config *cartslot) |
| 95 | 95 | { |
| r5931 | r5932 | |
| 105 | 105 | assert(slotnumber>=0 && slotnumber<AES_NUMBER_OF_CARTRIDGE_SLOTS); |
| 106 | 106 | |
| 107 | 107 | /* There is a cartridge in this slot, check the maximum slot number. */ |
| 108 | if (cartslots->next_free_slot <= slotnumber) | |
| 108 | if (cartslots->next_free_slot <= slotnumber) | |
| 109 | 109 | { |
| 110 | 110 | cartslots->next_free_slot = slotnumber+1; |
| 111 | 111 | } |
| 112 | 112 | cartridge = &cartslots->cartridge[slotnumber]; |
| 113 | 113 | |
| 114 | 114 | // check for up to 4 program ROMs |
| 115 | romrgn = (UINT8 *)memory_region(machine, "maincpu"); | |
| 115 | romrgn = (UINT8 *)memory_region(machine, "maincpu"); | |
| 116 | 116 | blockofs = 0; |
| 117 | 117 | for (i = 0; i < 4; i++) |
| 118 | 118 | { |
| r5931 | r5932 | |
| 133 | 133 | reslength = cartslot_get_resource_length(cartslot, "m1"); |
| 134 | 134 | if (socketcont != NULL) |
| 135 | 135 | { |
| 136 | romrgn = (UINT8 *)memory_region(machine, "audiocpu"); | |
| 136 | romrgn = (UINT8 *)memory_region(machine, "audiocpu"); | |
| 137 | 137 | |
| 138 | 138 | memcpy(romrgn, socketcont, reslength); |
| 139 | 139 | // mirror (how does this really work?) |
| r5931 | r5932 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // up to 8 YM sample ROMs |
| 144 | romrgn = (UINT8 *)memory_region(machine, "ym"); | |
| 144 | romrgn = (UINT8 *)memory_region(machine, "ym"); | |
| 145 | 145 | blockofs = 0; |
| 146 | 146 | for (i = 0; i < 8; i++) |
| 147 | 147 | { |
| r5931 | r5932 | |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // up to 8 YM delta-T sample ROMs |
| 161 | romrgn = (UINT8 *)memory_region(machine, "ym.deltat"); | |
| 161 | romrgn = (UINT8 *)memory_region(machine, "ym.deltat"); | |
| 162 | 162 | blockofs = 0; |
| 163 | 163 | for (i = 0; i < 8; i++) |
| 164 | 164 | { |
| r5931 | r5932 | |
| 179 | 179 | reslength = cartslot_get_resource_length(cartslot, "s1"); |
| 180 | 180 | if (socketcont != NULL) |
| 181 | 181 | { |
| 182 | romrgn = (UINT8 *)memory_region(machine, "fixed"); | |
| 182 | romrgn = (UINT8 *)memory_region(machine, "fixed"); | |
| 183 | 183 | |
| 184 | 184 | memcpy(romrgn, socketcont, reslength); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | // up to 8 sprite ROMs in byte-interleaved pairs |
| 188 | romrgn = (UINT8 *)memory_region(machine, "sprites"); | |
| 188 | romrgn = (UINT8 *)memory_region(machine, "sprites"); | |
| 189 | 189 | blockofs = 0; |
| 190 | 190 | for (i = 0; i < 8; i+=2) |
| 191 | 191 | { |
| r5931 | r5932 | |
| 216 | 216 | |
| 217 | 217 | static void set_pointers(const device_config *pcb, int index) |
| 218 | 218 | { |
| 219 | const device_config *cartsys = pcb->owner->owner; | |
| 219 | const device_config *cartsys = pcb->owner->owner; | |
| 220 | 220 | aes_multicart_t *cartslots = (aes_multicart_t *)cartsys->token; |
| 221 | 221 | aes_pcb_t *pcb_def = (aes_pcb_t *)pcb->token; |
| 222 | 222 | |
| 223 | 223 | pcb_def->assemble = (assmfct *)device_get_info_fct(pcb, AESCART_FCT_ASSM); |
| 224 | 224 | pcb_def->disassemble = (assmfct *)device_get_info_fct(pcb, AESCART_FCT_DISASSM); |
| 225 | ||
| 225 | ||
| 226 | 226 | pcb_def->cartridge = &cartslots->cartridge[index]; |
| 227 | 227 | pcb_def->cartridge->pcb = pcb; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /***************************************************************************** |
| 231 | 231 | Cartridge type: None |
| 232 | This PCB device is just a pseudo device; the legacy mode is handled | |
| 233 | by dedicated functions. | |
| 232 | This PCB device is just a pseudo device; the legacy mode is handled | |
| 233 | by dedicated functions. | |
| 234 | 234 | ******************************************************************************/ |
| 235 | 235 | static DEVICE_START(aes_pcb_none) |
| 236 | 236 | { |
| 237 | 237 | /* device is aes_cartslot:cartridge:pcb */ |
| 238 | // | |
| 238 | // printf("DEVICE_START(aes_pcb_none), tag of device=%s\n", device->tag); | |
| 239 | 239 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /***************************************************************************** |
| 243 | 243 | Cartridge type: Standard |
| 244 | Most cartridges are built in this type. This includes word-swapped program, | |
| 245 | z80 program, YM samples, delta-T samples, sprites, and sfix. | |
| 244 | Most cartridges are built in this type. This includes word-swapped program, | |
| 245 | z80 program, YM samples, delta-T samples, sprites, and sfix. | |
| 246 | 246 | ******************************************************************************/ |
| 247 | 247 | |
| 248 | 248 | static DEVICE_START(aes_pcb_std) |
| 249 | 249 | { |
| 250 | 250 | /* device is aes_cartslot:cartridge:pcb */ |
| 251 | // | |
| 251 | // printf("DEVICE_START(aes_pcb_std), tag of device=%s\n", device->tag); | |
| 252 | 252 | set_pointers(device, get_index_from_tagname(device->owner)-1); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /* |
| 256 | The standard cartridge assemble routine. We just call the common | |
| 257 | function here. | |
| 256 | The standard cartridge assemble routine. We just call the common | |
| 257 | function here. | |
| 258 | 258 | */ |
| 259 | 259 | static int assemble_std(running_machine *machine, const device_config *image) |
| 260 | 260 | { |
| 261 | 261 | aescartridge_t *cart; |
| 262 | // | |
| 262 | // printf("assemble_std, %s\n", image->tag); | |
| 263 | 263 | cart = assemble_common(machine, image); |
| 264 | ||
| 264 | ||
| 265 | 265 | return INIT_PASS; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /* |
| 269 | Removes pointers and restores the state before plugging in the | |
| 270 | cartridge. | |
| 271 | The pointer to the location after the last cartridge is adjusted. | |
| 272 | As it seems, we can use the same function for the disassembling of all | |
| 273 | cartridge types. | |
| 269 | Removes pointers and restores the state before plugging in the | |
| 270 | cartridge. | |
| 271 | The pointer to the location after the last cartridge is adjusted. | |
| 272 | As it seems, we can use the same function for the disassembling of all | |
| 273 | cartridge types. | |
| 274 | 274 | */ |
| 275 | 275 | static int disassemble_std(const device_config *image) |
| 276 | 276 | { |
| 277 | 277 | int slotnumber; |
| 278 | // | |
| 278 | // int i; | |
| 279 | 279 | aescartridge_t *cart; |
| 280 | 280 | const device_config *cartsys = image->owner; |
| 281 | 281 | aes_multicart_t *cartslots = (aes_multicart_t *)cartsys->token; |
| 282 | 282 | |
| 283 | 283 | slotnumber = get_index_from_tagname(image)-1; |
| 284 | // | |
| 284 | // printf("Disassemble cartridge %d\n", slotnumber); | |
| 285 | 285 | #if 0 |
| 286 | 286 | /* Search the highest remaining cartridge. */ |
| 287 | 287 | cartslots->next_free_slot = 0; |
| 288 | 288 | for (i=AES_NUMBER_OF_CARTRIDGE_SLOTS-1; i >= 0; i--) |
| 289 | 289 | { |
| 290 | if (i != slotnumber) | |
| 290 | if (i != slotnumber) | |
| 291 | 291 | { |
| 292 | if (0) //!slot_is_empty(cartsys, i)) | |
| 292 | if (0) //!slot_is_empty(cartsys, i)) (for future use?) | |
| 293 | 293 | { |
| 294 | 294 | cartslots->next_free_slot = i+1; |
| 295 | // | |
| 295 | // printf("Setting new next_free_slot to %d\n", cartslots->next_free_slot); | |
| 296 | 296 | break; |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | #endif | |
| 300 | #endif | |
| 301 | 301 | /* Do we have RAM? If so, swap the bytes (undo the BIG_ENDIANIZE) */ |
| 302 | 302 | cart = &cartslots->cartridge[slotnumber]; |
| 303 | ||
| 304 | // clear_slot(cartsys, slotnumber); | |
| 305 | 303 | |
| 304 | // clear_slot(cartsys, slotnumber); | |
| 305 | ||
| 306 | 306 | return INIT_PASS; |
| 307 | 307 | } |
| 308 | 308 | |
| r5931 | r5932 | |
| 337 | 337 | break; |
| 338 | 338 | |
| 339 | 339 | case AESCART_FCT_ASSM: |
| 340 | info->f = (genf *) assemble_std; | |
| 340 | info->f = (genf *) assemble_std; | |
| 341 | 341 | break; |
| 342 | 342 | |
| 343 | 343 | case AESCART_FCT_DISASSM: |
| 344 | info->f = (genf *) disassemble_std; | |
| 344 | info->f = (genf *) disassemble_std; | |
| 345 | 345 | break; |
| 346 | ||
| 346 | ||
| 347 | 347 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 348 | 348 | case DEVINFO_STR_NAME: |
| 349 | 349 | strcpy(info->s, "AES standard cartridge pcb"); |
| r5931 | r5932 | |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | /***************************************************************************** |
| 390 | The cartridge handling of the multi-cartridge system. | |
| 390 | The cartridge handling of the multi-cartridge system. | |
| 391 | 391 | Every cartridge contains a PCB device. The memory handlers delegate the calls |
| 392 | 392 | to the respective handlers of the cartridges. |
| 393 | 393 | ******************************************************************************/ |
| 394 | 394 | /* |
| 395 | ||
| 395 | Initialize a cartridge. Each cartridge contains a PCB device. | |
| 396 | 396 | */ |
| 397 | 397 | static DEVICE_START( aes_cartridge ) |
| 398 | 398 | { |
| 399 | 399 | cartslot_t *cart = device->token; |
| 400 | 400 | astring *tempstring = astring_alloc(); |
| 401 | ||
| 401 | ||
| 402 | 402 | /* find the PCB device */ |
| 403 | 403 | cart->pcb_device = devtag_get_device( |
| 404 | 404 | device->machine, |
| r5931 | r5932 | |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /* |
| 410 | Load the cartridge image files. Apart from reading, we set pointers | |
| 411 | to the image files so that during runtime we do not need search | |
| 412 | operations. | |
| 410 | Load the cartridge image files. Apart from reading, we set pointers | |
| 411 | to the image files so that during runtime we do not need search | |
| 412 | operations. | |
| 413 | 413 | */ |
| 414 | 414 | static DEVICE_IMAGE_LOAD( aes_cartridge ) |
| 415 | { | |
| 415 | { | |
| 416 | 416 | const device_config *pcbdev = cartslot_get_pcb(image); |
| 417 | 417 | int result; |
| 418 | ||
| 418 | ||
| 419 | 419 | if (pcbdev != NULL) |
| 420 | 420 | { |
| 421 | 421 | /* If we are here, we have a multicart. */ |
| 422 | 422 | aes_pcb_t *pcb = (aes_pcb_t *)pcbdev->token; |
| 423 | 423 | cartslot_t *cart = (cartslot_t *)image->token; |
| 424 | ||
| 424 | ||
| 425 | 425 | /* try opening this as a multicart */ |
| 426 | 426 | /* This line requires that cartslot_t be included in cartslot.h, |
| 427 | otherwise one cannot make use of multicart handling within such a | |
| 428 | custom LOAD function. */ | |
| 427 | otherwise one cannot make use of multicart handling within such a | |
| 428 | custom LOAD function. */ | |
| 429 | 429 | multicart_open_error me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc); |
| 430 | ||
| 430 | ||
| 431 | 431 | /* Now that we have loaded the image files, let the PCB put them all |
| 432 | together. This means we put the images in a structure which allows | |
| 433 | for a quick access by the memory handlers. Every PCB defines an | |
| 434 | own assembly method. */ | |
| 432 | together. This means we put the images in a structure which allows | |
| 433 | for a quick access by the memory handlers. Every PCB defines an | |
| 434 | own assembly method. */ | |
| 435 | 435 | if (me == MCERR_NONE) |
| 436 | 436 | result = pcb->assemble(pcbdev->machine, image); |
| 437 | else | |
| 437 | else | |
| 438 | 438 | fatalerror("Error loading multicart: %s\n", mc_error_text(me)); |
| 439 | 439 | } |
| 440 | 440 | else |
| r5931 | r5932 | |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | /* |
| 448 | This is called when the cartridge is unplugged (or the emulator is | |
| 449 | stopped). | |
| 448 | This is called when the cartridge is unplugged (or the emulator is | |
| 449 | stopped). | |
| 450 | 450 | */ |
| 451 | 451 | static DEVICE_IMAGE_UNLOAD( aes_cartridge ) |
| 452 | { | |
| 452 | { | |
| 453 | 453 | const device_config *pcbdev; |
| 454 | 454 | |
| 455 | 455 | if (image->token == NULL) |
| 456 | 456 | { |
| 457 | /* This means something went wrong during the pcb | |
| 458 | identification (e.g. one of the cartridge files was not | |
| 459 | found). We do not need to (and cannot) unload | |
| 460 | the cartridge. */ | |
| 457 | /* This means something went wrong during the pcb | |
| 458 | identification (e.g. one of the cartridge files was not | |
| 459 | found). We do not need to (and cannot) unload | |
| 460 | the cartridge. */ | |
| 461 | 461 | return; |
| 462 | 462 | } |
| 463 | 463 | pcbdev = cartslot_get_pcb(image); |
| r5931 | r5932 | |
| 466 | 466 | { |
| 467 | 467 | aes_pcb_t *pcb = (aes_pcb_t *)pcbdev->token; |
| 468 | 468 | cartslot_t *cart = (cartslot_t *)image->token; |
| 469 | ||
| 470 | // printf("unload\n"); | |
| 469 | ||
| 470 | // printf("unload\n"); | |
| 471 | 471 | if (cart->mc != NULL) |
| 472 | 472 | { |
| 473 | 473 | /* Remove pointers and de-big-endianize RAM contents. */ |
| 474 | pcb->disassemble(pcbdev->machine, image); | |
| 475 | ||
| 476 | /* Close the multicart; all RAM resources will be | |
| 477 | written to disk */ | |
| 474 | pcb->disassemble(pcbdev->machine, image); | |
| 475 | ||
| 476 | /* Close the multicart; all RAM resources will be | |
| 477 | written to disk */ | |
| 478 | 478 | multicart_close(cart->mc); |
| 479 | 479 | cart->mc = NULL; |
| 480 | 480 | } |
| 481 | // else | |
| 482 | // fatalerror("Lost pointer to multicart in cartridge. Report bug.\n"); | |
| 481 | // else | |
| 482 | // fatalerror("Lost pointer to multicart in cartridge. Report bug.\n"); | |
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /***************************************************************************** |
| 487 | The overall multi-cartridge slot system. It contains instances of | |
| 487 | The overall multi-cartridge slot system. It contains instances of | |
| 488 | 488 | cartridges which contain PCB devices. The memory handlers delegate the calls |
| 489 | 489 | to the respective handlers of the cartridges. |
| 490 | ||
| 490 | ||
| 491 | 491 | Note that the term "multi-cartridge system" and "multicart" are not the same: |
| 492 | 492 | A "multicart" may contain multiple resources, organized on a PCB. The multi- |
| 493 | 493 | cart system may thus host multiple multicarts. |
| 494 | ||
| 494 | ||
| 495 | 495 | Actually, the name of the device should be changed (however, the device name |
| 496 | 496 | length is limited) |
| 497 | 497 | ******************************************************************************/ |
| 498 | 498 | /* |
| 499 | ||
| 499 | Instantiation of a multicart system for the Neo Geo AES. | |
| 500 | 500 | */ |
| 501 | 501 | static DEVICE_START(aes_multicart) |
| 502 | 502 | { |
| 503 | 503 | int i; |
| 504 | // | |
| 504 | // printf("DEVICE_START(aes_multicart)\n"); | |
| 505 | 505 | aes_multicart_t *cartslots = (aes_multicart_t *)device->token; |
| 506 | 506 | |
| 507 | 507 | /* Save this in the shortcut; we don't want to look for it each time |
| 508 | that we have a memory access. And currently we do not plan for | |
| 509 | multiple multicart instances. */ | |
| 508 | that we have a memory access. And currently we do not plan for | |
| 509 | multiple multicart instances. */ | |
| 510 | 510 | cartslots->active_slot = 0; |
| 511 | 511 | cartslots->next_free_slot = 0; |
| 512 | ||
| 512 | ||
| 513 | 513 | for (i=0; i < AES_NUMBER_OF_CARTRIDGE_SLOTS; i++) |
| 514 | 514 | { |
| 515 | 515 | cartslots->cartridge[i].pcb = NULL; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | cartslots->multi_slots = 0; |
| 519 | ||
| 520 | /* The cartslot system is initialized now. The cartridges themselves | |
| 521 | need to check whether their parts are available. */ | |
| 519 | ||
| 520 | /* The cartslot system is initialized now. The cartridges themselves | |
| 521 | need to check whether their parts are available. */ | |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | static DEVICE_STOP(aes_multicart) |
| 525 | 525 | { |
| 526 | // | |
| 526 | // printf("DEVICE_STOP(aes_multicart)\n"); | |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | static MACHINE_DRIVER_START(aes_multicart) |
| r5931 | r5932 | |
| 531 | 531 | MDRV_CARTSLOT_EXTENSION_LIST("rpk,bin") |
| 532 | 532 | MDRV_CARTSLOT_PCBTYPE(0, "none", AES_CARTRIDGE_PCB_NONE) |
| 533 | 533 | MDRV_CARTSLOT_PCBTYPE(1, "standard", AES_CARTRIDGE_PCB_STD) |
| 534 | ||
| 534 | ||
| 535 | 535 | MDRV_CARTSLOT_START(aes_cartridge) |
| 536 | 536 | MDRV_CARTSLOT_LOAD(aes_cartridge) |
| 537 | 537 | MDRV_CARTSLOT_UNLOAD(aes_cartridge) |
| r5931 | r5932 | |
| 558 | 558 | case DEVINFO_INT_CLASS: |
| 559 | 559 | info->i = DEVICE_CLASS_PERIPHERAL; |
| 560 | 560 | break; |
| 561 | ||
| 561 | ||
| 562 | 562 | case DEVINFO_STR_FAMILY: |
| 563 | 563 | strcpy(info->s, "Cartridge slot"); |
| 564 | 564 | break; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | printer.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for handling printer devices | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 16 | 16 | ***************************************************************************/ |
| 17 | 17 | |
| 18 | 18 | /*------------------------------------------------- |
| 19 | printer_is_ready - checks to see if a printer | |
| 20 | is ready | |
| 19 | printer_is_ready - checks to see if a printer | |
| 20 | is ready | |
| 21 | 21 | -------------------------------------------------*/ |
| 22 | 22 | |
| 23 | 23 | int printer_is_ready(const device_config *printer) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | coco_vhd.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Color Computer Virtual Hard Drives | |
| 6 | 6 | |
| 7 | 7 | **************************************************************************** |
| 8 | 8 | |
| 9 | ||
| 9 | Technical specs on the Virtual Hard Disk interface | |
| 10 | 10 | |
| 11 | Address Description | |
| 12 | ------- ----------- | |
| 13 | FF80 Logical record number (high byte) | |
| 14 | FF81 Logical record number (middle byte) | |
| 15 | FF82 Logical record number (low byte) | |
| 16 | FF83 Command/status register | |
| 17 | FF84 Buffer address (high byte) | |
| 18 | FF85 Buffer address (low byte) | |
| 11 | Address Description | |
| 12 | ------- ----------- | |
| 13 | FF80 Logical record number (high byte) | |
| 14 | FF81 Logical record number (middle byte) | |
| 15 | FF82 Logical record number (low byte) | |
| 16 | FF83 Command/status register | |
| 17 | FF84 Buffer address (high byte) | |
| 18 | FF85 Buffer address (low byte) | |
| 19 | 19 | |
| 20 | ||
| 20 | Set the other registers, and then issue a command to FF83 as follows: | |
| 21 | 21 | |
| 22 | 0 = read 256-byte sector at LRN | |
| 23 | 1 = write 256-byte sector at LRN | |
| 24 | 2 = flush write cache (Closes and then opens the image file) | |
| 22 | 0 = read 256-byte sector at LRN | |
| 23 | 1 = write 256-byte sector at LRN | |
| 24 | 2 = flush write cache (Closes and then opens the image file) | |
| 25 | 25 | |
| 26 | ||
| 26 | Error values: | |
| 27 | 27 | |
| 28 | 0 = no error | |
| 29 | -1 = power-on state (before the first command is recieved) | |
| 30 | -2 = invalid command | |
| 31 | 2 = VHD image does not exist | |
| 32 | 4 = Unable to open VHD image file | |
| 33 | 5 = access denied (may not be able to write to VHD image) | |
| 28 | 0 = no error | |
| 29 | -1 = power-on state (before the first command is recieved) | |
| 30 | -2 = invalid command | |
| 31 | 2 = VHD image does not exist | |
| 32 | 4 = Unable to open VHD image file | |
| 33 | 5 = access denied (may not be able to write to VHD image) | |
| 34 | 34 | |
| 35 | ||
| 35 | IMPORTANT: The I/O buffer must NOT cross an 8K MMU bank boundary. | |
| 36 | 36 | |
| 37 | 37 | ***************************************************************************/ |
| 38 | 38 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | appldriv.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple 5.25" floppy drive emulation (to be interfaced with applefdc.c) | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 57 | 57 | MDRV_FLOPPY_APPLE_PARAMS(_dividend,_divisor) \ |
| 58 | 58 | MDRV_DEVICE_ADD(FLOPPY_3, FLOPPY_APPLE, 0) \ |
| 59 | 59 | MDRV_DEVICE_CONFIG(_config) \ |
| 60 | MDRV_FLOPPY_APPLE_PARAMS(_dividend,_divisor) | |
| 60 | MDRV_FLOPPY_APPLE_PARAMS(_dividend,_divisor) | |
| 61 | 61 | |
| 62 | 62 | #define MDRV_FLOPPY_APPLE_2_DRIVES_REMOVE() \ |
| 63 | 63 | MDRV_DEVICE_REMOVE(FLOPPY_0) \ |
| 64 | MDRV_DEVICE_REMOVE(FLOPPY_1) | |
| 64 | MDRV_DEVICE_REMOVE(FLOPPY_1) | |
| 65 | 65 | |
| 66 | 66 | #endif /* APPLDRIV_H */ |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | aescart.h | |
| 4 | 4 | |
| 5 | ||
| 5 | AES cartridge management | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | bitbngr.c | |
| 4 | 4 | |
| 5 | ||
| 5 | TRS style "bitbanger" serial port | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 186 | 186 | |
| 187 | 187 | /*------------------------------------------------- |
| 188 | 188 | bitbanger_output - outputs data to a bitbanger |
| 189 | ||
| 189 | port | |
| 190 | 190 | -------------------------------------------------*/ |
| 191 | 191 | |
| 192 | 192 | void bitbanger_output(const device_config *device, int value) |
| r5931 | r5932 | |
| 225 | 225 | |
| 226 | 226 | /*------------------------------------------------- |
| 227 | 227 | DEVICE_GET_INFO(bitbanger) - device getinfo |
| 228 | ||
| 228 | function | |
| 229 | 229 | -------------------------------------------------*/ |
| 230 | 230 | |
| 231 | 231 | DEVICE_GET_INFO(bitbanger) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /**************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | printer.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Code for handling printer devices | |
| 6 | 6 | |
| 7 | 7 | ****************************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 271 | 271 | static READ8_HANDLER ( to7_5p14_r ) |
| 272 | 272 | { |
| 273 | 273 | const device_config *fdc = devtag_get_device(space->machine, "wd2793"); |
| 274 | ||
| 274 | ||
| 275 | 275 | if ( offset < 4 ) |
| 276 | 276 | return wd17xx_r( fdc, offset ); |
| 277 | 277 | else if ( offset == 8 ) |
| r5931 | r5932 | |
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | /* in real life, to keep the motor running, it is sufficient to |
| 1464 | set motor to 1 every few seconds. | |
| 1465 | instead of counting, we assume the motor is always running... | |
| 1466 | */ | |
| 1464 | set motor to 1 every few seconds. | |
| 1465 | instead of counting, we assume the motor is always running... | |
| 1466 | */ | |
| 1467 | 1467 | floppy_drive_set_motor_state( img, 1 /* motor */ ); |
| 1468 | 1468 | } |
| 1469 | 1469 | break; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | coco_vhd.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Color Computer Virtual Hard Drives | |
| 6 | 6 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 20 | 20 | |
| 21 | 21 | #define MDRV_COCO_VHD_ADD(_tag) \ |
| 22 | 22 | MDRV_DEVICE_ADD(_tag, COCO_VHD, 0) \ |
| 23 | ||
| 23 | ||
| 24 | 24 | #endif /* COCOVHD_H */ |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | multcart.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Multi-cartridge handling code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 38 | 38 | multicart_socket * sockets; |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | static const char multicart_error_text[14][30] = | |
| 41 | static const char multicart_error_text[14][30] = | |
| 42 | 42 | { |
| 43 | 43 | "no error", |
| 44 | 44 | "not a multicart", |
| r5931 | r5932 | |
| 95 | 95 | { |
| 96 | 96 | return header; |
| 97 | 97 | } |
| 98 | } | |
| 98 | } | |
| 99 | 99 | return NULL; |
| 100 | 100 | } |
| 101 | 101 | |
| r5931 | r5932 | |
| 220 | 220 | const char *ram_filename; |
| 221 | 221 | |
| 222 | 222 | astring *ram_pathname; |
| 223 | ||
| 223 | ||
| 224 | 224 | /* locate the 'length' attribute */ |
| 225 | 225 | length_string = xml_get_attribute_string(resource_node, "length", NULL); |
| 226 | 226 | if (length_string == NULL) |
| 227 | 227 | return MCERR_MISSING_RAM_LENGTH; |
| 228 | ||
| 228 | ||
| 229 | 229 | /* ...and parse it */ |
| 230 | 230 | resource->length = ram_parse_string(length_string); |
| 231 | 231 | if (resource->length <= 0) |
| 232 | 232 | return MCERR_INVALID_RAM_SPEC; |
| 233 | ||
| 233 | ||
| 234 | 234 | /* allocate bytes for this resource */ |
| 235 | 235 | resource->ptr = pool_malloc(state->multicart->data->pool, resource->length); |
| 236 | 236 | if (resource->ptr == NULL) |
| 237 | 237 | return MCERR_OUT_OF_MEMORY; |
| 238 | ||
| 238 | ||
| 239 | 239 | /* Is this a persistent RAM resource? Then try to load it. */ |
| 240 | 240 | ram_type = xml_get_attribute_string(resource_node, "type", NULL); |
| 241 | 241 | if (ram_type != NULL) |
| r5931 | r5932 | |
| 246 | 246 | ram_filename = xml_get_attribute_string(resource_node, "file", NULL); |
| 247 | 247 | if (ram_filename==NULL) |
| 248 | 248 | return MCERR_XML_ERROR; |
| 249 | ||
| 249 | ||
| 250 | 250 | ram_pathname = astring_assemble_3(astring_alloc(), state->multicart->gamedrv_name, PATH_SEPARATOR, ram_filename); |
| 251 | ||
| 252 | /* Save the file name so that we can write the contents on unloading. | |
| 253 | If the RAM resource has no filename, we know that it was volatile only. */ | |
| 251 | ||
| 252 | /* Save the file name so that we can write the contents on unloading. | |
| 253 | If the RAM resource has no filename, we know that it was volatile only. */ | |
| 254 | 254 | resource->filename = pool_strdup(state->multicart->data->pool, astring_c(ram_pathname)); |
| 255 | 255 | if (resource->filename == NULL) |
| 256 | 256 | return MCERR_OUT_OF_MEMORY; |
| 257 | ||
| 257 | ||
| 258 | 258 | astring_free(ram_pathname); |
| 259 | ||
| 259 | ||
| 260 | 260 | image_battery_load_by_name(resource->filename, resource->ptr, resource->length); |
| 261 | 261 | } |
| 262 | /* else this type is volatile, in which case we just have | |
| 263 | a memory expansion */ | |
| 262 | /* else this type is volatile, in which case we just have | |
| 263 | a memory expansion */ | |
| 264 | 264 | } |
| 265 | 265 | return MCERR_NONE; |
| 266 | 266 | } |
| r5931 | r5932 | |
| 310 | 310 | break; |
| 311 | 311 | |
| 312 | 312 | default: |
| 313 | return MCERR_UNKNOWN_RESOURCE_TYPE; | |
| 313 | return MCERR_UNKNOWN_RESOURCE_TYPE; | |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | /* append the resource */ |
| r5931 | r5932 | |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /*------------------------------------------------- |
| 351 | save_ram_resources. This is important for persistent RAM. All | |
| 351 | save_ram_resources. This is important for persistent RAM. All | |
| 352 | 352 | resources were allocated within the memory pool of this device and will |
| 353 | 353 | be freed on multicart_close. |
| 354 | 354 | -------------------------------------------------*/ |
| r5931 | r5932 | |
| 356 | 356 | static multicart_open_error save_ram_resources(multicart *cart) |
| 357 | 357 | { |
| 358 | 358 | const multicart_resource *resource; |
| 359 | ||
| 359 | ||
| 360 | 360 | for (resource = cart->resources; resource != NULL; resource = resource->next) |
| 361 | 361 | { |
| 362 | 362 | if ((resource->type == MULTICART_RESOURCE_TYPE_RAM) && (resource->filename != NULL)) |
| r5931 | r5932 | |
| 560 | 560 | err = MCERR_OUT_OF_MEMORY; |
| 561 | 561 | goto done; |
| 562 | 562 | } |
| 563 | ||
| 563 | ||
| 564 | 564 | /* do we have to load resources? */ |
| 565 | 565 | if (load_flags & MULTICART_FLAGS_LOAD_RESOURCES) |
| 566 | 566 | { |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | snapquik.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Snapshots and quickloads | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 31 | 31 | |
| 32 | 32 | /*------------------------------------------------- |
| 33 | 33 | assert_is_snapshot_or_quickload - asserts/confirms |
| 34 | ||
| 34 | that a given device is a snapshot or quickload | |
| 35 | 35 | -------------------------------------------------*/ |
| 36 | 36 | |
| 37 | 37 | INLINE void assert_is_snapshot_or_quickload(const device_config *device) |
| r5931 | r5932 | |
| 131 | 131 | |
| 132 | 132 | /*------------------------------------------------- |
| 133 | 133 | DEVICE_GET_INFO(snapquick) - device getinfo |
| 134 | ||
| 134 | function | |
| 135 | 135 | -------------------------------------------------*/ |
| 136 | 136 | |
| 137 | 137 | static DEVICE_GET_INFO(snapquick) |
| r5931 | r5932 | |
| 161 | 161 | |
| 162 | 162 | /*------------------------------------------------- |
| 163 | 163 | DEVICE_GET_INFO(snapshot) - device getinfo |
| 164 | ||
| 164 | function | |
| 165 | 165 | -------------------------------------------------*/ |
| 166 | 166 | |
| 167 | 167 | DEVICE_GET_INFO(snapshot) |
| r5931 | r5932 | |
| 183 | 183 | |
| 184 | 184 | /*------------------------------------------------- |
| 185 | 185 | DEVICE_GET_INFO(quickload) - device getinfo |
| 186 | ||
| 186 | function | |
| 187 | 187 | -------------------------------------------------*/ |
| 188 | 188 | |
| 189 | 189 | DEVICE_GET_INFO(quickload) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | bitbngr.h | |
| 4 | 4 | |
| 5 | ||
| 5 | TRS style "bitbanger" serial port | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cococart.c | |
| 4 | 4 | |
| 5 | ||
| 5 | CoCo/Dragon cartridge management | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 83 | 83 | { |
| 84 | 84 | const device_config *cartslot; |
| 85 | 85 | coco_cartridge_t *cococart = get_token(device); |
| 86 | const cococart_config *config = (const cococart_config *) device->inline_config; | |
| 86 | const cococart_config *config = (const cococart_config *) device->inline_config; | |
| 87 | 87 | astring *tempstring = astring_alloc(); |
| 88 | 88 | |
| 89 | 89 | /* initialize */ |
| r5931 | r5932 | |
| 187 | 187 | |
| 188 | 188 | if (LOG_LINE) |
| 189 | 189 | logerror("[%s]: set_line(): %s <= %s", cpuexec_describe_context(device->machine), line_name, line_value_string(value)); |
| 190 | ||
| 190 | ||
| 191 | 191 | /* engage in a bit of gymnastics for this odious 'Q' value */ |
| 192 | 192 | switch(line->value) |
| 193 | 193 | { |
| r5931 | r5932 | |
| 249 | 249 | |
| 250 | 250 | |
| 251 | 251 | /*------------------------------------------------- |
| 252 | ||
| 252 | set_line_timer() | |
| 253 | 253 | -------------------------------------------------*/ |
| 254 | 254 | |
| 255 | 255 | static void set_line_timer(const device_config *device, coco_cartridge_line *line, cococart_line_value value) |
| r5931 | r5932 | |
| 279 | 279 | |
| 280 | 280 | /*------------------------------------------------- |
| 281 | 281 | coco_cartridge_twiddle_q_lines - hack to |
| 282 | ||
| 282 | support twiddling the Q line | |
| 283 | 283 | -------------------------------------------------*/ |
| 284 | 284 | |
| 285 | 285 | void coco_cartridge_twiddle_q_lines(const device_config *device) |
| r5931 | r5932 | |
| 357 | 357 | MDRV_CARTSLOT_PCBTYPE(1, "banked_16k", COCO_CARTRIDGE_PCB_PAK_BANKED16K) |
| 358 | 358 | MDRV_CARTSLOT_PCBTYPE(2, "orch90", COCO_CARTRIDGE_PCB_ORCH90) |
| 359 | 359 | MDRV_CARTSLOT_PCBTYPE(3, "rs232", COCO_CARTRIDGE_PCB_RS232) |
| 360 | //MDRV_CARTSLOT_PCBTYPE(4, "coco_ssc", | |
| 360 | //MDRV_CARTSLOT_PCBTYPE(4, "coco_ssc", COCO_CARTRIDGE_PCB_SSC) | |
| 361 | 361 | MDRV_CARTSLOT_PCBTYPE(4, "", COCO_CARTRIDGE_PCB_PAK) |
| 362 | 362 | MACHINE_DRIVER_END |
| 363 | 363 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/adam_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Coleco Adam disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | 2 | * D77 and D88 disk images |
| 3 | * | |
| 4 | * | |
| 3 | * | |
| 4 | * | |
| 5 | 5 | * Header (total size = 0x2b0 bytes): |
| 6 | 6 | * 0x00 - Disk label |
| 7 | 7 | * 0x1a - Write protect (bit 3) |
| r5931 | r5932 | |
| 11 | 11 | * |
| 12 | 12 | * Sectors (0x110 bytes each, typically) |
| 13 | 13 | * 0x00 - Sector info |
| 14 | * byte 0 - track number | |
| 15 | * byte 1 - side (0 or 1) | |
| 16 | * byte 2 - sector number | |
| 14 | * byte 0 - track number | |
| 15 | * byte 1 - side (0 or 1) | |
| 16 | * byte 2 - sector number | |
| 17 | 17 | * 0x10 - sector data |
| 18 | * | |
| 18 | * | |
| 19 | 19 | * Images can be concatenated together. |
| 20 | 20 | * Sectors can be in any order. |
| 21 | 21 | * Tracks are in the order: |
| 22 | * Track 0 side 0 | |
| 23 | * Track 0 side 1 | |
| 24 | * Track 1 side 0 | |
| 25 | * ... | |
| 26 | * | |
| 27 | * | |
| 22 | * Track 0 side 0 | |
| 23 | * Track 0 side 1 | |
| 24 | * Track 1 side 0 | |
| 25 | * ... | |
| 26 | * | |
| 27 | * | |
| 28 | 28 | */ |
| 29 | 29 | |
| 30 | 30 | #include "driver.h" |
| r5931 | r5932 | |
| 52 | 52 | UINT32 offset; |
| 53 | 53 | UINT8 sector_hdr[16]; |
| 54 | 54 | int x; |
| 55 | ||
| 56 | offset = tag->trackoffset[(track*2)+head]; | |
| 57 | 55 | |
| 56 | offset = tag->trackoffset[(track*2)+head]; | |
| 57 | ||
| 58 | 58 | if(offset == 0) |
| 59 | 59 | return 0; |
| 60 | 60 | |
| r5931 | r5932 | |
| 69 | 69 | floppy_image_read(floppy,sector_hdr,offset,16); |
| 70 | 70 | x++; |
| 71 | 71 | } |
| 72 | ||
| 72 | ||
| 73 | 73 | return sector_hdr[2]; |
| 74 | 74 | } |
| 75 | 75 | |
| r5931 | r5932 | |
| 88 | 88 | struct d88_tag* tag = get_d88_tag(floppy); |
| 89 | 89 | UINT32 offset; |
| 90 | 90 | UINT8 sector_hdr[16]; |
| 91 | ||
| 91 | ||
| 92 | 92 | offset = tag->trackoffset[(track*2)+head]; |
| 93 | 93 | |
| 94 | 94 | floppy_image_read(floppy,sector_hdr,offset,16); |
| 95 | ||
| 95 | ||
| 96 | 96 | return sector_hdr[4]; |
| 97 | 97 | } |
| 98 | ||
| 98 | ||
| 99 | 99 | static floperr_t d88_get_sector_length(floppy_image *floppy, int head, int track, int sector, UINT32 *sector_length) |
| 100 | 100 | { |
| 101 | 101 | struct d88_tag* tag = get_d88_tag(floppy); |
| r5931 | r5932 | |
| 103 | 103 | UINT8 sector_hdr[16]; |
| 104 | 104 | UINT32 len; |
| 105 | 105 | int count,secs; |
| 106 | ||
| 106 | ||
| 107 | 107 | offset = tag->trackoffset[(track*2)+head]; |
| 108 | ||
| 108 | ||
| 109 | 109 | floppy_image_read(floppy,sector_hdr,offset,16); |
| 110 | 110 | secs = sector_hdr[4]; |
| 111 | ||
| 111 | ||
| 112 | 112 | for(count=0;count<secs;count++) |
| 113 | 113 | { |
| 114 | 114 | floppy_image_read(floppy,sector_hdr,offset,16); |
| r5931 | r5932 | |
| 128 | 128 | |
| 129 | 129 | static floperr_t d88_read_track(floppy_image *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen) |
| 130 | 130 | { |
| 131 | // floperr_t err; | |
| 132 | ||
| 131 | // floperr_t err; | |
| 132 | ||
| 133 | 133 | return FLOPPY_ERROR_UNSUPPORTED; |
| 134 | 134 | } |
| 135 | 135 | |
| r5931 | r5932 | |
| 141 | 141 | UINT32 len; |
| 142 | 142 | UINT32 secs; |
| 143 | 143 | int count; |
| 144 | ||
| 144 | ||
| 145 | 145 | // get offset of the beginning of the track |
| 146 | 146 | offset = tag->trackoffset[(track*2)+head]; |
| 147 | 147 | |
| 148 | 148 | floppy_image_read(floppy,sector_hdr,offset,16); |
| 149 | 149 | secs = sector_hdr[4]; |
| 150 | ||
| 150 | ||
| 151 | 151 | for(count=0;count<secs;count++) |
| 152 | 152 | { |
| 153 | 153 | floppy_image_read(floppy,sector_hdr,offset,16); |
| r5931 | r5932 | |
| 170 | 170 | UINT32 offset; |
| 171 | 171 | UINT8 sector_hdr[16]; |
| 172 | 172 | int x; |
| 173 | ||
| 174 | offset = tag->trackoffset[(track*2)+head]; | |
| 175 | 173 | |
| 174 | offset = tag->trackoffset[(track*2)+head]; | |
| 175 | ||
| 176 | 176 | if(offset == 0) |
| 177 | 177 | return FLOPPY_ERROR_SEEKERROR; |
| 178 | ||
| 179 | 178 | |
| 179 | ||
| 180 | 180 | floppy_image_read(floppy,sector_hdr,offset,16); |
| 181 | 181 | |
| 182 | 182 | if(sector_index >= sector_hdr[4]) |
| r5931 | r5932 | |
| 191 | 191 | floppy_image_read(floppy,sector_hdr,offset,16); |
| 192 | 192 | x++; |
| 193 | 193 | } |
| 194 | ||
| 194 | ||
| 195 | 195 | if(offset > tag->image_size || offset == 0) |
| 196 | 196 | return FLOPPY_ERROR_SEEKERROR; |
| 197 | 197 | |
| r5931 | r5932 | |
| 205 | 205 | *sector = sector_hdr[2]; |
| 206 | 206 | if(flags) |
| 207 | 207 | *flags = 0; |
| 208 | ||
| 208 | ||
| 209 | 209 | return FLOPPY_ERROR_SUCCESS; |
| 210 | 210 | } |
| 211 | 211 | |
| r5931 | r5932 | |
| 213 | 213 | { |
| 214 | 214 | UINT64 offset; |
| 215 | 215 | UINT32 sector_length; |
| 216 | ||
| 216 | ||
| 217 | 217 | offset = d88_get_sector_offset(floppy,head,track,sector); |
| 218 | ||
| 218 | ||
| 219 | 219 | if(d88_get_sector_length(floppy,head,track,sector,§or_length) != FLOPPY_ERROR_SUCCESS) |
| 220 | 220 | return FLOPPY_ERROR_SEEKERROR; |
| 221 | ||
| 221 | ||
| 222 | 222 | if(offset == 0) |
| 223 | 223 | return FLOPPY_ERROR_SEEKERROR; |
| 224 | ||
| 224 | ||
| 225 | 225 | if(buflen > sector_length) |
| 226 | 226 | return FLOPPY_ERROR_INTERNAL; |
| 227 | ||
| 227 | ||
| 228 | 228 | floppy_image_read(floppy,buffer,offset,sector_length); |
| 229 | ||
| 229 | ||
| 230 | 230 | return FLOPPY_ERROR_SUCCESS; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | static floperr_t d88_read_indexed_sector(floppy_image *floppy, int head, int track, int sector, void *buffer, size_t buffer_len) |
| 234 | 234 | { |
| 235 | 235 | int sec; |
| 236 | ||
| 236 | ||
| 237 | 237 | sec = d88_get_sector_id(floppy,head,track,sector); |
| 238 | 238 | return d88_read_sector(floppy,head,track,sec,buffer,buffer_len); |
| 239 | 239 | } |
| r5931 | r5932 | |
| 242 | 242 | { |
| 243 | 243 | UINT8 header[D88_HEADER_LEN]; |
| 244 | 244 | int x,s; |
| 245 | ||
| 245 | ||
| 246 | 246 | floppy_image_read(floppy,header,0,D88_HEADER_LEN); |
| 247 | 247 | |
| 248 | 248 | if(prot) |
| r5931 | r5932 | |
| 275 | 275 | FLOPPY_IDENTIFY(d88_dsk_identify) |
| 276 | 276 | { |
| 277 | 277 | UINT32 size; |
| 278 | ||
| 279 | d88_get_header(floppy,&size,NULL,NULL,NULL); | |
| 280 | ||
| 278 | ||
| 279 | d88_get_header(floppy,&size,NULL,NULL,NULL); | |
| 280 | ||
| 281 | 281 | if(floppy_image_size(floppy) == size) |
| 282 | 282 | { |
| 283 | 283 | *vote = 100; |
| r5931 | r5932 | |
| 298 | 298 | UINT8 prot,type = 0; |
| 299 | 299 | UINT32 offs[164]; |
| 300 | 300 | int x; |
| 301 | ||
| 301 | ||
| 302 | 302 | if(params) |
| 303 | 303 | { |
| 304 | 304 | // create |
| r5931 | r5932 | |
| 309 | 309 | // load |
| 310 | 310 | d88_get_header(floppy,&size,&prot,&type,offs); |
| 311 | 311 | } |
| 312 | ||
| 312 | ||
| 313 | 313 | tag = floppy_create_tag(floppy,"d88tag",sizeof(struct d88_tag)); |
| 314 | 314 | if (!tag) |
| 315 | 315 | return FLOPPY_ERROR_OUTOFMEMORY; |
| 316 | ||
| 316 | ||
| 317 | 317 | tag->write_protect = prot; |
| 318 | 318 | tag->disk_type = type; |
| 319 | 319 | tag->image_size = size; |
| 320 | 320 | for(x=0;x<164;x++) |
| 321 | 321 | tag->trackoffset[x] = offs[x]; |
| 322 | ||
| 322 | ||
| 323 | 323 | callbacks = floppy_callbacks(floppy); |
| 324 | 324 | callbacks->read_track = d88_read_track; |
| 325 | 325 | callbacks->get_heads_per_disk = d88_get_heads_per_disk; |
| r5931 | r5932 | |
| 329 | 329 | callbacks->read_indexed_sector = d88_read_indexed_sector; |
| 330 | 330 | callbacks->get_indexed_sector_info = d88_get_indexed_sector_info; |
| 331 | 331 | callbacks->get_sectors_per_track = d88_get_sectors_per_track; |
| 332 | ||
| 333 | ||
| 332 | ||
| 333 | ||
| 334 | 334 | return FLOPPY_ERROR_SUCCESS; |
| 335 | 335 | } |
| r5931 | r5932 | |
|---|---|---|
| 25 | 25 | static const UINT8 UEF_HEADER[10] = { 0x55, 0x45, 0x46, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x21, 0x00 }; |
| 26 | 26 | |
| 27 | 27 | /* |
| 28 | bytes are stored as | |
| 29 | start bit 1 * 0 | |
| 30 | data bits 8 * X | |
| 31 | stop bit 1 * 1 | |
| 28 | bytes are stored as | |
| 29 | start bit 1 * 0 | |
| 30 | data bits 8 * X | |
| 31 | stop bit 1 * 1 | |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | /* gzip flag byte */ |
| r5931 | r5932 | |
| 81 | 81 | int Exponent; |
| 82 | 82 | |
| 83 | 83 | /* assume a four byte array named Float exists, where Float[0] |
| 84 | ||
| 84 | was the first byte read from the UEF, Float[1] the second, etc */ | |
| 85 | 85 | |
| 86 | 86 | /* decode mantissa */ |
| 87 | 87 | Mantissa = Float[0] | (Float[1] << 8) | ((Float[2]&0x7f)|0x80) << 16; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/ami_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Amiga disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 23 | 23 | { |
| 24 | 24 | UINT64 size; |
| 25 | 25 | UINT8 header[4]; |
| 26 | ||
| 26 | ||
| 27 | 27 | *vote = 100; |
| 28 | 28 | |
| 29 | 29 | /* get first 4 bytes */ |
| r5931 | r5932 | |
| 42 | 42 | if (header[3] > 5) |
| 43 | 43 | *vote = 0; |
| 44 | 44 | |
| 45 | return FLOPPY_ERROR_SUCCESS; | |
| 45 | return FLOPPY_ERROR_SUCCESS; | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| r5931 | r5932 | |
| 56 | 56 | geometry.tracks = 80; |
| 57 | 57 | geometry.first_sector_id = 0; |
| 58 | 58 | geometry.sector_length = 512; |
| 59 | ||
| 59 | ||
| 60 | 60 | if (params) |
| 61 | 61 | { |
| 62 | 62 | /* create */ |
| r5931 | r5932 | |
| 68 | 68 | UINT64 size = floppy_image_size(floppy); |
| 69 | 69 | geometry.sectors = size/512/80/2; |
| 70 | 70 | if (geometry.sectors != 11 && geometry.sectors != 22) |
| 71 | return FLOPPY_ERROR_INVALIDIMAGE; | |
| 71 | return FLOPPY_ERROR_INVALIDIMAGE; | |
| 72 | 72 | } |
| 73 | ||
| 73 | ||
| 74 | 74 | return basicdsk_construct(floppy, &geometry); |
| 75 | 75 | } |
| 76 | 76 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/adam_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Coleco Adam disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | fmsx_cas.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for MSX casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | uef_cas.h | |
| 3 | 3 | |
| 4 | ||
| 4 | Format code for uef cassette files | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #ifndef UEF_CAS_H |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/dim_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | DIM disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 30 | 30 | UINT8 format_tmp; |
| 31 | 31 | int x; |
| 32 | 32 | UINT16 temp; |
| 33 | ||
| 33 | ||
| 34 | 34 | if(params) |
| 35 | 35 | { |
| 36 | 36 | // create |
| r5931 | r5932 | |
| 82 | 82 | // TODO: expand on this basic implementation |
| 83 | 83 | |
| 84 | 84 | logerror("FDD: DIM image loaded - type %i, %i tracks, %i sectors per track, %i bytes per sector\n", format_tmp,tracks, sectors,sectorlen); |
| 85 | ||
| 85 | ||
| 86 | 86 | memset(&geometry, 0, sizeof(geometry)); |
| 87 | 87 | geometry.heads = heads; |
| 88 | 88 | geometry.first_sector_id = firstsector; |
| r5931 | r5932 | |
| 90 | 90 | geometry.tracks = tracks+1; |
| 91 | 91 | geometry.sectors = sectors; |
| 92 | 92 | geometry.offset = 0x100; |
| 93 | return basicdsk_construct(floppy, &geometry); | |
| 93 | return basicdsk_construct(floppy, &geometry); | |
| 94 | 94 | } |
| 95 | 95 |
| r5931 | r5932 | |
|---|---|---|
| 5 | 5 | TODO: |
| 6 | 6 | Add support for the remaining block types: |
| 7 | 7 | case 0x15: Direct Recording |
| 8 | case 0x18: CSW Recording | |
| 9 | case 0x19: Generalized Data Block | |
| 8 | case 0x18: CSW Recording | |
| 9 | case 0x19: Generalized Data Block | |
| 10 | 10 | case 0x21: Group Start |
| 11 | 11 | case 0x22: Group End |
| 12 | 12 | case 0x23: Jump To Block |
| r5931 | r5932 | |
| 16 | 16 | case 0x27: Return From Sequence |
| 17 | 17 | case 0x28: Select Block |
| 18 | 18 | case 0x2A: Stop Tape if in 48K Mode |
| 19 | ||
| 19 | case 0x2B: Set signal level | |
| 20 | 20 | case 0x5A: Merge Block |
| 21 | 21 | Add support for the deprecated block types? Only if there is some image which need them: |
| 22 | 22 | case 0x16: C64 ROM type data block |
| r5931 | r5932 | |
| 65 | 65 | static UINT8** blocks; |
| 66 | 66 | static float t_scale = 1; /* for scaling T-states to the 4MHz CPC */ |
| 67 | 67 | |
| 68 | static void toggle_wave_data(void) | |
| 68 | static void toggle_wave_data(void) | |
| 69 | 69 | { |
| 70 | if (wave_data == WAVE_LOW) | |
| 70 | if (wave_data == WAVE_LOW) | |
| 71 | 71 | { |
| 72 | 72 | wave_data = WAVE_HIGH; |
| 73 | } | |
| 74 | else | |
| 73 | } | |
| 74 | else | |
| 75 | 75 | { |
| 76 | 76 | wave_data = WAVE_LOW; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen ) | |
| 80 | static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen ) | |
| 81 | 81 | { |
| 82 | 82 | int pos = sizeof(TZX_HEADER) + 2; |
| 83 | 83 | int max_block_count = INITIAL_MAX_BLOCK_COUNT; |
| r5931 | r5932 | |
| 85 | 85 | blocks = alloc_array_clear_or_die(UINT8*, max_block_count); |
| 86 | 86 | block_count = 0; |
| 87 | 87 | |
| 88 | while (pos < caslen) | |
| 88 | while (pos < caslen) | |
| 89 | 89 | { |
| 90 | 90 | UINT32 datasize; |
| 91 | 91 | UINT8 blocktype = casdata[pos]; |
| 92 | 92 | |
| 93 | if (block_count == max_block_count) | |
| 93 | if (block_count == max_block_count) | |
| 94 | 94 | { |
| 95 | 95 | void *old_blocks = blocks; |
| 96 | 96 | int old_max_block_count = max_block_count; |
| r5931 | r5932 | |
| 104 | 104 | |
| 105 | 105 | pos += 1; |
| 106 | 106 | |
| 107 | switch (blocktype) | |
| 107 | switch (blocktype) | |
| 108 | 108 | { |
| 109 | 109 | case 0x10: |
| 110 | 110 | pos += 2; |
| r5931 | r5932 | |
| 186 | 186 | free(blocks); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | INLINE int millisec_to_samplecount( int millisec ) | |
| 189 | INLINE int millisec_to_samplecount( int millisec ) | |
| 190 | 190 | { |
| 191 | 191 | return (int) (millisec * ((double)TZX_WAV_FREQUENCY / 1000.0)); |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | INLINE int tcycles_to_samplecount( int tcycles ) | |
| 194 | INLINE int tcycles_to_samplecount( int tcycles ) | |
| 195 | 195 | { |
| 196 | 196 | return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * t_scale); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | static void tzx_output_wave( INT16 **buffer, int length ) | |
| 199 | static void tzx_output_wave( INT16 **buffer, int length ) | |
| 200 | 200 | { |
| 201 | if (buffer == NULL) | |
| 201 | if (buffer == NULL) | |
| 202 | 202 | { |
| 203 | 203 | return; |
| 204 | 204 | } |
| r5931 | r5932 | |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause, int data_size, int pilot, int pilot_length, int sync1, int sync2, int bit0, int bit1, int bits_in_last_byte ) | |
| 213 | static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause, int data_size, int pilot, int pilot_length, int sync1, int sync2, int bit0, int bit1, int bits_in_last_byte ) | |
| 214 | 214 | { |
| 215 | 215 | int pilot_samples = tcycles_to_samplecount(pilot); |
| 216 | 216 | int sync1_samples = tcycles_to_samplecount(sync1); |
| r5931 | r5932 | |
| 221 | 221 | int size = 0; |
| 222 | 222 | |
| 223 | 223 | /* Uncomment this to include into error.log a fully detailed analysis of each block */ |
| 224 | // | |
| 224 | // logerror("tzx_cas_block_size: pilot_length = %d, pilot_samples = %d, sync1_samples = %d, sync2_samples = %d, bit0_samples = %d, bit1_samples = %d\n", pilot_length, pilot_samples, sync1_samples, sync2_samples, bit0_samples, bit1_samples); | |
| 225 | 225 | |
| 226 | 226 | /* PILOT */ |
| 227 | for ( ; pilot_length > 0; pilot_length--) | |
| 227 | for ( ; pilot_length > 0; pilot_length--) | |
| 228 | 228 | { |
| 229 | 229 | tzx_output_wave(buffer, pilot_samples); |
| 230 | 230 | size += pilot_samples; |
| 231 | 231 | toggle_wave_data(); |
| 232 | 232 | } |
| 233 | 233 | /* SYNC1 */ |
| 234 | if (sync1_samples > 0) | |
| 234 | if (sync1_samples > 0) | |
| 235 | 235 | { |
| 236 | 236 | tzx_output_wave(buffer, sync1_samples); |
| 237 | 237 | size += sync1_samples; |
| 238 | 238 | toggle_wave_data(); |
| 239 | 239 | } |
| 240 | 240 | /* SYNC2 */ |
| 241 | if (sync2_samples > 0) | |
| 241 | if (sync2_samples > 0) | |
| 242 | 242 | { |
| 243 | 243 | tzx_output_wave(buffer, sync2_samples); |
| 244 | 244 | size += sync2_samples; |
| 245 | 245 | toggle_wave_data(); |
| 246 | 246 | } |
| 247 | 247 | /* data */ |
| 248 | for (data_index = 0; data_index < data_size; data_index++) | |
| 248 | for (data_index = 0; data_index < data_size; data_index++) | |
| 249 | 249 | { |
| 250 | 250 | UINT8 byte = bytes[data_index]; |
| 251 | 251 | int bits_to_go = (data_index == (data_size - 1)) ? bits_in_last_byte : 8; |
| 252 | 252 | |
| 253 | for ( ; bits_to_go > 0; byte <<= 1, bits_to_go--) | |
| 253 | for ( ; bits_to_go > 0; byte <<= 1, bits_to_go--) | |
| 254 | 254 | { |
| 255 | 255 | int bit_samples = (byte & 0x80) ? bit1_samples : bit0_samples; |
| 256 | 256 | tzx_output_wave(buffer, bit_samples); |
| r5931 | r5932 | |
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | /* pause */ |
| 265 | if (pause > 0) | |
| 265 | if (pause > 0) | |
| 266 | 266 | { |
| 267 | 267 | int start_pause_samples = millisec_to_samplecount(1); |
| 268 | 268 | int rest_pause_samples = millisec_to_samplecount(pause - 1); |
| r5931 | r5932 | |
| 306 | 306 | |
| 307 | 307 | /* Will go through blocks and calculate number of samples needed. |
| 308 | 308 | If buffer is not NULL the sample data will also be written. */ |
| 309 | static int tzx_cas_do_work( INT16 **buffer ) | |
| 309 | static int tzx_cas_do_work( INT16 **buffer ) | |
| 310 | 310 | { |
| 311 | 311 | int current_block = 0; |
| 312 | 312 | int size = 0; |
| r5931 | r5932 | |
| 323 | 323 | UINT8 block_type = cur_block[0]; |
| 324 | 324 | |
| 325 | 325 | /* Uncomment this to include into error.log a list of the types each block */ |
| 326 | // | |
| 326 | // logerror("tzx_cas_fill_wave: block %d, block_type %02x\n", current_block, block_type); | |
| 327 | 327 | |
| 328 | 328 | switch (block_type) |
| 329 | 329 | { |
| r5931 | r5932 | |
| 354 | 354 | current_block++; |
| 355 | 355 | break; |
| 356 | 356 | case 0x13: /* Sequence of Pulses of Different Lengths */ |
| 357 | for (data_size = 0; data_size < cur_block[1]; data_size++) | |
| 357 | for (data_size = 0; data_size < cur_block[1]; data_size++) | |
| 358 | 358 | { |
| 359 | 359 | pilot = cur_block[2 + 2 * data_size] + (cur_block[3 + 2 * data_size] << 8); |
| 360 | 360 | size += tzx_cas_handle_block(buffer, cur_block, 0, 0, pilot, 1, 0, 0, 0, 0, 0); |
| r5931 | r5932 | |
| 372 | 372 | break; |
| 373 | 373 | case 0x20: /* Pause (Silence) or 'Stop the Tape' Command */ |
| 374 | 374 | pause_time = cur_block[1] + (cur_block[2] << 8); |
| 375 | if (pause_time == 0) | |
| 375 | if (pause_time == 0) | |
| 376 | 376 | { |
| 377 | /* pause = 0 is used to let an emulator automagically stop the tape | |
| 378 | in MESS we do not do that, so we insert a 5 second pause. */ | |
| 377 | /* pause = 0 is used to let an emulator automagically stop the tape | |
| 378 | in MESS we do not do that, so we insert a 5 second pause. */ | |
| 379 | 379 | pause_time = 5000; |
| 380 | 380 | } |
| 381 | 381 | size += tzx_cas_handle_block(buffer, cur_block, pause_time, 0, 0, 0, 0, 0, 0, 0, 0); |
| r5931 | r5932 | |
| 480 | 480 | return size; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen ) | |
| 483 | static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen ) | |
| 484 | 484 | { |
| 485 | 485 | int size = 0; |
| 486 | 486 | |
| 487 | 487 | /* Header size plus major and minor version number */ |
| 488 | if (caslen < 10) | |
| 488 | if (caslen < 10) | |
| 489 | 489 | { |
| 490 | 490 | logerror("tzx_cas_to_wav_size: cassette image too small\n"); |
| 491 | 491 | goto cleanup; |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | /* Check for correct header */ |
| 495 | if (memcmp(casdata, TZX_HEADER, sizeof(TZX_HEADER))) | |
| 495 | if (memcmp(casdata, TZX_HEADER, sizeof(TZX_HEADER))) | |
| 496 | 496 | { |
| 497 | 497 | logerror("tzx_cas_to_wav_size: cassette image has incompatible header\n"); |
| 498 | 498 | goto cleanup; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /* Check major version number in header */ |
| 502 | if (casdata[0x08] > SUPPORTED_VERSION_MAJOR) | |
| 502 | if (casdata[0x08] > SUPPORTED_VERSION_MAJOR) | |
| 503 | 503 | { |
| 504 | 504 | logerror("tzx_cas_to_wav_size: unsupported version\n"); |
| 505 | 505 | goto cleanup; |
| r5931 | r5932 | |
| 509 | 509 | |
| 510 | 510 | logerror("tzx_cas_to_wav_size: %d blocks found\n", block_count); |
| 511 | 511 | |
| 512 | if (block_count == 0) | |
| 512 | if (block_count == 0) | |
| 513 | 513 | { |
| 514 | 514 | logerror("tzx_cas_to_wav_size: no blocks found!\n"); |
| 515 | 515 | goto cleanup; |
| r5931 | r5932 | |
| 523 | 523 | return -1; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | static int tzx_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 526 | static int tzx_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 527 | 527 | { |
| 528 | 528 | INT16 *p = buffer; |
| 529 | 529 | int size = 0; |
| r5931 | r5932 | |
| 532 | 532 | return size; |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | static int cdt_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 535 | static int cdt_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 536 | 536 | { |
| 537 | 537 | INT16 *p = buffer; |
| 538 | 538 | int size = 0; |
| r5931 | r5932 | |
| 541 | 541 | return size; |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen ) | |
| 544 | static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen ) | |
| 545 | 545 | { |
| 546 | 546 | int size = 0; |
| 547 | 547 | const UINT8 *p = casdata; |
| 548 | 548 | |
| 549 | while (p < casdata + caslen) | |
| 549 | while (p < casdata + caslen) | |
| 550 | 550 | { |
| 551 | 551 | int data_size = p[0] + (p[1] << 8); |
| 552 | 552 | int pilot_length = (p[2] == 0x00) ? 8064 : 3220; /* TZX specification */ |
| 553 | // | |
| 553 | // int pilot_length = (p[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */ | |
| 554 | 554 | logerror("tap_cas_to_wav_size: Handling TAP block containing 0x%X bytes", data_size); |
| 555 | 555 | p += 2; |
| 556 | 556 | size += tzx_cas_handle_block(NULL, p, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8); |
| r5931 | r5932 | |
| 560 | 560 | return size; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | static int tap_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 563 | static int tap_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 564 | 564 | { |
| 565 | 565 | INT16 *p = buffer; |
| 566 | 566 | int size = 0; |
| 567 | 567 | |
| 568 | while (size < length) | |
| 568 | while (size < length) | |
| 569 | 569 | { |
| 570 | 570 | int data_size = bytes[0] + (bytes[1] << 8); |
| 571 | 571 | int pilot_length = (bytes[2] == 0x00) ? 8064 : 3220; /* TZX specification */ |
| 572 | // | |
| 572 | // int pilot_length = (bytes[2] == 0x00) ? 8063 : 3223; /* worldofspectrum */ | |
| 573 | 573 | logerror("tap_cas_fill_wave: Handling TAP block containing 0x%X bytes\n", data_size); |
| 574 | 574 | bytes += 2; |
| 575 | 575 | size += tzx_cas_handle_block(&p, bytes, 1000, data_size, 2168, pilot_length, 667, 735, 855, 1710, 8); |
| r5931 | r5932 | |
| 578 | 578 | return size; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | static const struct CassetteLegacyWaveFiller tzx_legacy_fill_wave = | |
| 581 | static const struct CassetteLegacyWaveFiller tzx_legacy_fill_wave = | |
| 582 | 582 | { |
| 583 | 583 | tzx_cas_fill_wave, /* fill_wave */ |
| 584 | 584 | -1, /* chunk_size */ |
| r5931 | r5932 | |
| 589 | 589 | 0 /* trailer_samples */ |
| 590 | 590 | }; |
| 591 | 591 | |
| 592 | static const struct CassetteLegacyWaveFiller tap_legacy_fill_wave = | |
| 592 | static const struct CassetteLegacyWaveFiller tap_legacy_fill_wave = | |
| 593 | 593 | { |
| 594 | 594 | tap_cas_fill_wave, /* fill_wave */ |
| 595 | 595 | -1, /* chunk_size */ |
| r5931 | r5932 | |
| 600 | 600 | 0 /* trailer_samples */ |
| 601 | 601 | }; |
| 602 | 602 | |
| 603 | static const struct CassetteLegacyWaveFiller cdt_legacy_fill_wave = | |
| 603 | static const struct CassetteLegacyWaveFiller cdt_legacy_fill_wave = | |
| 604 | 604 | { |
| 605 | 605 | cdt_cas_fill_wave, /* fill_wave */ |
| 606 | 606 | -1, /* chunk_size */ |
| r5931 | r5932 | |
| 611 | 611 | 0 /* trailer_samples */ |
| 612 | 612 | }; |
| 613 | 613 | |
| 614 | static casserr_t tzx_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 614 | static casserr_t tzx_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 615 | 615 | { |
| 616 | 616 | return cassette_legacy_identify(cassette, opts, &tzx_legacy_fill_wave); |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | static casserr_t tap_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 619 | static casserr_t tap_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 620 | 620 | { |
| 621 | 621 | return cassette_legacy_identify(cassette, opts, &tap_legacy_fill_wave); |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | static casserr_t cdt_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 624 | static casserr_t cdt_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 625 | 625 | { |
| 626 | 626 | return cassette_legacy_identify(cassette, opts, &cdt_legacy_fill_wave); |
| 627 | 627 | } |
| 628 | 628 | |
| 629 | static casserr_t tzx_cassette_load( cassette_image *cassette ) | |
| 629 | static casserr_t tzx_cassette_load( cassette_image *cassette ) | |
| 630 | 630 | { |
| 631 | 631 | return cassette_legacy_construct(cassette, &tzx_legacy_fill_wave); |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | static casserr_t tap_cassette_load( cassette_image *cassette ) | |
| 634 | static casserr_t tap_cassette_load( cassette_image *cassette ) | |
| 635 | 635 | { |
| 636 | 636 | return cassette_legacy_construct(cassette, &tap_legacy_fill_wave); |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | static casserr_t cdt_cassette_load( cassette_image *cassette ) | |
| 639 | static casserr_t cdt_cassette_load( cassette_image *cassette ) | |
| 640 | 640 | { |
| 641 | 641 | return cassette_legacy_construct(cassette, &cdt_legacy_fill_wave); |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | static const struct CassetteFormat tzx_cassette_format = | |
| 644 | static const struct CassetteFormat tzx_cassette_format = | |
| 645 | 645 | { |
| 646 | 646 | "tzx", |
| 647 | 647 | tzx_cassette_identify, |
| r5931 | r5932 | |
| 649 | 649 | NULL |
| 650 | 650 | }; |
| 651 | 651 | |
| 652 | static const struct CassetteFormat tap_cassette_format = | |
| 652 | static const struct CassetteFormat tap_cassette_format = | |
| 653 | 653 | { |
| 654 | 654 | "tap", |
| 655 | 655 | tap_cassette_identify, |
| r5931 | r5932 | |
| 657 | 657 | NULL |
| 658 | 658 | }; |
| 659 | 659 | |
| 660 | static const struct CassetteFormat cdt_cassette_format = | |
| 660 | static const struct CassetteFormat cdt_cassette_format = | |
| 661 | 661 | { |
| 662 | 662 | "cdt", |
| 663 | 663 | cdt_cassette_identify, |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/ami_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Amiga disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | /********************************************************************* |
| 8 | ||
| 8 | ioprocs implementation on stdio | |
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | |
| 11 | 11 | static void stdio_closeproc(void *file) |
| r5931 | r5932 | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | /********************************************************************* |
| 64 | ||
| 64 | calls for accessing generic IO | |
| 65 | 65 | *********************************************************************/ |
| 66 | 66 | |
| 67 | 67 | static void io_generic_seek(struct io_generic *generic, UINT64 offset) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/trs_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | TRS-80 disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 16 | 16 | int sample_count = 0; |
| 17 | 17 | int x = 0; |
| 18 | 18 | int count = (data & 0x7fff); |
| 19 | ||
| 19 | ||
| 20 | 20 | if(data & 0x8000) |
| 21 | 21 | { |
| 22 | 22 | for(x=0;x<count;x++) |
| r5931 | r5932 | |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | sample_count += count; | |
| 37 | sample_count += count; | |
| 38 | 38 | return sample_count; |
| 39 | 39 | } |
| 40 | 40 | |
| r5931 | r5932 | |
| 42 | 42 | { |
| 43 | 43 | int sample_count = 0; |
| 44 | 44 | int data_pos = 16; |
| 45 | ||
| 45 | ||
| 46 | 46 | if(memcmp(casdata, "XM7 TAPE IMAGE 0",16)) // header check |
| 47 | 47 | return -1; |
| 48 | ||
| 48 | ||
| 49 | 49 | while(data_pos < cas_size) |
| 50 | 50 | { |
| 51 | 51 | sample_count += fm7_fill_wave(buffer,casdata[data_pos],casdata[data_pos+1],sample_count); |
| 52 | 52 | data_pos+=2; |
| 53 | 53 | } |
| 54 | ||
| 54 | ||
| 55 | 55 | return sample_count; |
| 56 | 56 | } |
| 57 | 57 | |
| r5931 | r5932 | |
| 61 | 61 | static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen) |
| 62 | 62 | { |
| 63 | 63 | cas_size = caslen; |
| 64 | ||
| 64 | ||
| 65 | 65 | return fm7_handle_t77(NULL,casdata); |
| 66 | 66 | } |
| 67 | 67 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/dim_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | DIM disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 5 | 5 | |
| 6 | 6 | #include "formats/cocopak.h" |
| 7 | 7 | |
| 8 | /* | |
| 8 | /* PAK files have the following format: | |
| 9 | 9 | * |
| 10 | * length (two bytes, little endian) | |
| 11 | * base address (two bytes, little endian, typically 0xc000) | |
| 12 | * ...data... (size is length) | |
| 13 | * optional trailer | |
| 10 | * length (two bytes, little endian) | |
| 11 | * base address (two bytes, little endian, typically 0xc000) | |
| 12 | * ...data... (size is length) | |
| 13 | * optional trailer | |
| 14 | 14 | * |
| 15 | * The format for PAK files just plain bites - the extra info is snapshot info | |
| 16 | * and it is loaded with internal state specific to Jeff's emulator. What ever | |
| 17 | * happened to desiging clean file formats that don't need to be changed with | |
| 18 | * every version of ones program? | |
| 15 | * The format for PAK files just plain bites - the extra info is snapshot info | |
| 16 | * and it is loaded with internal state specific to Jeff's emulator. What ever | |
| 17 | * happened to desiging clean file formats that don't need to be changed with | |
| 18 | * every version of ones program? | |
| 19 | 19 | * |
| 20 | * | |
| 20 | * For alignment purposes, some 16 bit values are divided into two UINT8s | |
| 21 | 21 | * |
| 22 | * The PAK file format's trailer defines the state of the machine other then | |
| 23 | * the core memory. This trailer comes in many variations. I have labeled | |
| 24 | * them in the following way (trailer sizes are in parentheses): | |
| 22 | * The PAK file format's trailer defines the state of the machine other then | |
| 23 | * the core memory. This trailer comes in many variations. I have labeled | |
| 24 | * them in the following way (trailer sizes are in parentheses): | |
| 25 | 25 | * |
| 26 | * V12 - The version in JeffV's emulator version 1.2 | |
| 27 | * V14 - The version in JeffV's emulator version 1.4 (457) | |
| 28 | * VOTHER - From some "other" version of JeffV's emulator | |
| 29 | * VLITE - From yet another version of JeffV's emulator (35) | |
| 26 | * V12 - The version in JeffV's emulator version 1.2 | |
| 27 | * V14 - The version in JeffV's emulator version 1.4 (457) | |
| 28 | * VOTHER - From some "other" version of JeffV's emulator | |
| 29 | * VLITE - From yet another version of JeffV's emulator (35) | |
| 30 | 30 | * |
| 31 | * | |
| 31 | * The following table shows what segments appear in each trailer variant: | |
| 32 | 32 | * |
| 33 | * Trailer Segment V12 V14 VOTHER VLITE | |
| 34 | * --------------- --- --- ------ ----- | |
| 35 | * pak_trailer1 1 1 1 1 | |
| 36 | * pak_trailer2 2 | |
| 37 | * pak_trailer3 3 2 2 2 | |
| 38 | * pak_trailer4 4 3 3 | |
| 39 | * pak_trailer5 5 | |
| 40 | * pak_trailer6 6 5 4 | |
| 41 | * pak_trailer7 7 5 | |
| 42 | * pak_trailer8 6 | |
| 43 | * pak_trailer9 8 7 6 | |
| 44 | * pak_trailer10 9 4 7 | |
| 45 | * pak_trailer11 10 8 8 | |
| 46 | * pak_trailer12 9 | |
| 47 | * pak_trailer13 11 9 | |
| 33 | * Trailer Segment V12 V14 VOTHER VLITE | |
| 34 | * --------------- --- --- ------ ----- | |
| 35 | * pak_trailer1 1 1 1 1 | |
| 36 | * pak_trailer2 2 | |
| 37 | * pak_trailer3 3 2 2 2 | |
| 38 | * pak_trailer4 4 3 3 | |
| 39 | * pak_trailer5 5 | |
| 40 | * pak_trailer6 6 5 4 | |
| 41 | * pak_trailer7 7 5 | |
| 42 | * pak_trailer8 6 | |
| 43 | * pak_trailer9 8 7 6 | |
| 44 | * pak_trailer10 9 4 7 | |
| 45 | * pak_trailer11 10 8 8 | |
| 46 | * pak_trailer12 9 | |
| 47 | * pak_trailer13 11 9 | |
| 48 | 48 | */ |
| 49 | 49 | |
| 50 | 50 | /* All versions */ |
| r5931 | r5932 | |
| 392 | 392 | |
| 393 | 393 | case PAK_VLITE_SIZE: |
| 394 | 394 | /* This is a "lite" format that gives no trailer information except |
| 395 | * for the program counter... I have to set everything up as default | |
| 396 | * including the stack pointer... arg this sucks... | |
| 397 | */ | |
| 395 | * for the program counter... I have to set everything up as default | |
| 396 | * including the stack pointer... arg this sucks... | |
| 397 | */ | |
| 398 | 398 | trailer->pia[2] = 0xff; |
| 399 | 399 | trailer->pia[3] = 0x34; |
| 400 | 400 | trailer->pia[6] = 0x00; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | #include "formats/vt_cas.h" |
| 2 | 2 | |
| 3 | 3 | /********************************************************************* |
| 4 | ||
| 4 | vtech 1/2 agnostic | |
| 5 | 5 | *********************************************************************/ |
| 6 | 6 | |
| 7 | 7 | #define SILENCE 8000 |
| r5931 | r5932 | |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | /********************************************************************* |
| 56 | ||
| 56 | vtech 1 | |
| 57 | 57 | *********************************************************************/ |
| 58 | 58 | |
| 59 | 59 | #define V1_LO -32768 |
| r5931 | r5932 | |
| 127 | 127 | CASSETTE_FORMATLIST_END |
| 128 | 128 | |
| 129 | 129 | /********************************************************************* |
| 130 | ||
| 130 | vtech 2 | |
| 131 | 131 | *********************************************************************/ |
| 132 | 132 | |
| 133 | 133 | #define VT2_LO -20000 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/cqm_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | CopyQM disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 23 | 23 | int sector_base; |
| 24 | 24 | int interleave; |
| 25 | 25 | int skew; |
| 26 | ||
| 26 | ||
| 27 | 27 | UINT8* buf; |
| 28 | 28 | UINT64 track_offsets[84*2]; /* offset within data for each track */ |
| 29 | 29 | }; |
| r5931 | r5932 | |
| 72 | 72 | UINT8 data; |
| 73 | 73 | INT16 len; |
| 74 | 74 | int s; |
| 75 | ||
| 75 | ||
| 76 | 76 | if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks) |
| 77 | 77 | || (sector < 0) ) |
| 78 | 78 | return FLOPPY_ERROR_SEEKERROR; |
| 79 | ||
| 80 | pos = cqm_get_track_offset(floppy,head,track); | |
| 79 | ||
| 80 | pos = cqm_get_track_offset(floppy,head,track); | |
| 81 | 81 | s = 0; |
| 82 | do { | |
| 82 | do { | |
| 83 | 83 | floppy_image_read(floppy, &len, pos, 2); |
| 84 | 84 | pos+=2; |
| 85 | if(len<0) { | |
| 86 | floppy_image_read(floppy, &data, pos, 1); | |
| 87 | memset(get_tag(floppy)->buf + s,data, -len); | |
| 85 | if(len<0) { | |
| 86 | floppy_image_read(floppy, &data, pos, 1); | |
| 87 | memset(get_tag(floppy)->buf + s,data, -len); | |
| 88 | 88 | pos++; |
| 89 | s += -len; | |
| 89 | s += -len; | |
| 90 | 90 | } else { |
| 91 | 91 | floppy_image_read(floppy, get_tag(floppy)->buf + s, pos, len); |
| 92 | pos+=len; | |
| 92 | pos+=len; | |
| 93 | 93 | s += len; |
| 94 | 94 | } |
| 95 | 95 | } while(s<get_tag(floppy)->sector_size*get_tag(floppy)->sector_per_track); |
| r5931 | r5932 | |
| 104 | 104 | static floperr_t internal_cqm_read_sector(floppy_image *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) |
| 105 | 105 | { |
| 106 | 106 | UINT64 offset; |
| 107 | floperr_t err; | |
| 108 | ||
| 107 | floperr_t err; | |
| 108 | ||
| 109 | 109 | // take sector offset |
| 110 | 110 | err = get_offset(floppy, head, track, sector, sector_is_index, &offset); |
| 111 | 111 | if (err) |
| r5931 | r5932 | |
| 132 | 132 | if (err) |
| 133 | 133 | return err; |
| 134 | 134 | |
| 135 | if (sector_length) { | |
| 135 | if (sector_length) { | |
| 136 | 136 | *sector_length = get_tag(floppy)->sector_size; |
| 137 | 137 | } |
| 138 | 138 | return FLOPPY_ERROR_SUCCESS; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | static floperr_t cqm_get_indexed_sector_info(floppy_image *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) |
| 142 | { | |
| 142 | { | |
| 143 | 143 | if (sector_index >= get_tag(floppy)->sector_per_track) return FLOPPY_ERROR_SEEKERROR; |
| 144 | ||
| 144 | ||
| 145 | 145 | if (cylinder) { |
| 146 | 146 | *cylinder = track; |
| 147 | 147 | } |
| r5931 | r5932 | |
| 164 | 164 | struct FloppyCallbacks *callbacks; |
| 165 | 165 | struct cqmdsk_tag *tag; |
| 166 | 166 | UINT8 header[CQM_HEADER_SIZE]; |
| 167 | UINT64 pos = 0; | |
| 167 | UINT64 pos = 0; | |
| 168 | 168 | INT16 len; |
| 169 | 169 | int head; |
| 170 | 170 | int track; |
| r5931 | r5932 | |
| 174 | 174 | // create |
| 175 | 175 | return FLOPPY_ERROR_UNSUPPORTED; |
| 176 | 176 | } |
| 177 | ||
| 177 | ||
| 178 | 178 | tag = (struct cqmdsk_tag *) floppy_create_tag(floppy, CQM_DSK_TAG, sizeof(struct cqmdsk_tag)); |
| 179 | 179 | if (!tag) |
| 180 | 180 | return FLOPPY_ERROR_OUTOFMEMORY; |
| r5931 | r5932 | |
| 184 | 184 | tag->sector_size = (header[0x04] << 8) + header[0x03]; |
| 185 | 185 | tag->sector_per_track = header[0x10]; |
| 186 | 186 | tag->heads = header[0x12]; |
| 187 | tag->tracks = header[0x5b]; | |
| 187 | tag->tracks = header[0x5b]; | |
| 188 | 188 | tag->sector_base = header[0x71] + 1; |
| 189 | 189 | tag->interleave = header[0x74]; |
| 190 | 190 | tag->skew = header[0x75]; |
| 191 | ||
| 191 | ||
| 192 | 192 | // header + comment size to position on first data block |
| 193 | ||
| 194 | pos = CQM_HEADER_SIZE + (header[0x70] << 8) + header[0x6f]; | |
| 193 | ||
| 194 | pos = CQM_HEADER_SIZE + (header[0x70] << 8) + header[0x6f]; | |
| 195 | 195 | track = 0; |
| 196 | 196 | head = 0; |
| 197 | 197 | tag->buf = malloc(tag->sector_size*tag->sector_per_track); |
| 198 | 198 | do { |
| 199 | 199 | tag->track_offsets[(track<<1) + head] = pos; |
| 200 | 200 | s = 0; |
| 201 | do { | |
| 201 | do { | |
| 202 | 202 | floppy_image_read(floppy, &len, pos, 2); |
| 203 | 203 | pos+=2; |
| 204 | if(len<0) { | |
| 204 | if(len<0) { | |
| 205 | 205 | pos++; |
| 206 | s += -len; | |
| 206 | s += -len; | |
| 207 | 207 | } else { |
| 208 | 208 | pos+=len; |
| 209 | 209 | s += len; |
| r5931 | r5932 | |
| 216 | 216 | track++; |
| 217 | 217 | } |
| 218 | 218 | } while(pos < floppy_image_size(floppy)); |
| 219 | ||
| 220 | ||
| 219 | ||
| 220 | ||
| 221 | 221 | callbacks = floppy_callbacks(floppy); |
| 222 | 222 | callbacks->read_sector = cqm_read_sector; |
| 223 | 223 | callbacks->read_indexed_sector = cqm_read_indexed_sector; |
| r5931 | r5932 | |
|---|---|---|
| 3 | 3 | ---------- |
| 4 | 4 | Header Description |
| 5 | 5 | |
| 6 | Offset Value Type Description | |
| 7 | 0x00 (note) ASCII 22 bytes "Compressed Square Wave" signature | |
| 8 | 0x16 0x1A BYTE Terminator code | |
| 9 | 0x17 0x02 BYTE CSW major revision number | |
| 10 | 0x18 0x00 BYTE CSW minor revision number | |
| 11 | 0x19 DWORD Sample rate | |
| 12 | 0x1D DWORD Total number of pulses (after decompression) | |
| 13 | 0x21 BYTE Compression type 0x01: RLE 0x02: Z-RLE | |
| 14 | 0x22 BYTE Flags b0: initial polarity: if set, the signal starts at logical high | |
| 15 | 0x23 HDR BYTE Header extension length in bytes (0x00) | |
| 16 | 0x24 ASCII 16 bytes free use | |
| 17 | 0x34 BYTE Start of Header is HDR>0 | |
| 6 | Offset Value Type Description | |
| 7 | 0x00 (note) ASCII 22 bytes "Compressed Square Wave" signature | |
| 8 | 0x16 0x1A BYTE Terminator code | |
| 9 | 0x17 0x02 BYTE CSW major revision number | |
| 10 | 0x18 0x00 BYTE CSW minor revision number | |
| 11 | 0x19 DWORD Sample rate | |
| 12 | 0x1D DWORD Total number of pulses (after decompression) | |
| 13 | 0x21 BYTE Compression type 0x01: RLE 0x02: Z-RLE | |
| 14 | 0x22 BYTE Flags b0: initial polarity: if set, the signal starts at logical high | |
| 15 | 0x23 HDR BYTE Header extension length in bytes (0x00) | |
| 16 | 0x24 ASCII 16 bytes free use | |
| 17 | 0x34 BYTE Start of Header is HDR>0 | |
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ioprocs.h | |
| 4 | 4 | |
| 5 | ||
| 5 | File IO abstraction layer | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 16 | 16 | |
| 17 | 17 | /*************************************************************************** |
| 18 | 18 | |
| 19 | ||
| 19 | Type definitions | |
| 20 | 20 | |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| r5931 | r5932 | |
| 41 | 41 | |
| 42 | 42 | /*************************************************************************** |
| 43 | 43 | |
| 44 | ||
| 44 | Globals | |
| 45 | 45 | |
| 46 | 46 | ***************************************************************************/ |
| 47 | 47 | |
| r5931 | r5932 | |
| 52 | 52 | |
| 53 | 53 | /*************************************************************************** |
| 54 | 54 | |
| 55 | ||
| 55 | Prototypes | |
| 56 | 56 | |
| 57 | 57 | ***************************************************************************/ |
| 58 | 58 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/coco_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Tandy Color Computer / Dragon disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 20 | 20 | * |
| 21 | 21 | * Used by Jeff Vavasour's CoCo Emulators |
| 22 | 22 | * |
| 23 | * Documentation taken from Tim Linder's web site: | |
| 24 | * http://home.netcom.com/~tlindner/JVC.html | |
| 23 | * Documentation taken from Tim Linder's web site: | |
| 24 | * http://home.netcom.com/~tlindner/JVC.html | |
| 25 | 25 | * |
| 26 | * A. Header length | |
| 27 | * The header length is determined by the file length modulo 256: | |
| 28 | * headerSize = fileLength % 256; | |
| 29 | * This means that the header is variable length and the minimum size | |
| 30 | * is zero bytes, and the maximum size of 255 bytes. | |
| 26 | * A. Header length | |
| 27 | * The header length is determined by the file length modulo 256: | |
| 28 | * headerSize = fileLength % 256; | |
| 29 | * This means that the header is variable length and the minimum size | |
| 30 | * is zero bytes, and the maximum size of 255 bytes. | |
| 31 | 31 | * |
| 32 | 32 | * B. Header |
| 33 | * Here is a description of the header bytes: | |
| 34 | * Byte Offset Description Default | |
| 35 | * ----------- ----------------- ------- | |
| 36 | * 0 Sectors per track 18 | |
| 33 | * Here is a description of the header bytes: | |
| 34 | * Byte Offset Description Default | |
| 35 | * ----------- ----------------- ------- | |
| 36 | * 0 Sectors per track 18 | |
| 37 | 37 | * 1 Side count 1 |
| 38 | 38 | * 2 Sector size code 1 |
| 39 | 39 | * 3 First sector ID 1 |
| r5931 | r5932 | |
| 42 | 42 | * If the sector attribute flag is zero then the track count is determined |
| 43 | 43 | * by the formula: |
| 44 | 44 | * |
| 45 | * (fileLength - headerSize) / (sectorsPerTrack * (128 << | |
| 46 | * sectorSizeCode)) / sideCount | |
| 45 | * (fileLength - headerSize) / (sectorsPerTrack * (128 << | |
| 46 | * sectorSizeCode)) / sideCount | |
| 47 | 47 | * |
| 48 | 48 | * If the sector attribute flag is non zero then the track count is |
| 49 | 49 | * determined by the more complex formula: |
| 50 | 50 | * |
| 51 | * (fileLength - headerSize) / (sectorsPerTrack * ((128 << | |
| 52 | * sectorSizeCode) + 1) ) / sideCount | |
| 51 | * (fileLength - headerSize) / (sectorsPerTrack * ((128 << | |
| 52 | * sectorSizeCode) + 1) ) / sideCount | |
| 53 | 53 | * |
| 54 | 54 | * If the length of the header is to short to contain the geometry desired, |
| 55 | 55 | * then the default values are assumed. If the header length is zero the all |
| r5931 | r5932 | |
| 61 | 61 | * is zero then the sector data is at the beginning file. |
| 62 | 62 | * |
| 63 | 63 | * C. Sectors per track |
| 64 | * This is the number of sectors per track (ones based). A value of 18 | |
| 65 | * means there are 18 sectors per track | |
| 64 | * This is the number of sectors per track (ones based). A value of 18 | |
| 65 | * means there are 18 sectors per track | |
| 66 | 66 | * |
| 67 | * D. Side Count | |
| 68 | * This is the number of sides in the disk image. Values of 1 or 2 are | |
| 69 | * acceptable. If there are two sides then the tracks are interleaved. | |
| 70 | * The first track in the image file is track zero side 1, the second | |
| 71 | * track in the image file is track zero side 2. | |
| 67 | * D. Side Count | |
| 68 | * This is the number of sides in the disk image. Values of 1 or 2 are | |
| 69 | * acceptable. If there are two sides then the tracks are interleaved. | |
| 70 | * The first track in the image file is track zero side 1, the second | |
| 71 | * track in the image file is track zero side 2. | |
| 72 | 72 | * |
| 73 | * E. Sector size | |
| 74 | * The is the same value that is stored in the wd179x ID field to | |
| 75 | * determine sector size: | |
| 73 | * E. Sector size | |
| 74 | * The is the same value that is stored in the wd179x ID field to | |
| 75 | * determine sector size: | |
| 76 | 76 | * |
| 77 | * 0x00 128 bytes | |
| 78 | * 0x01 256 bytes | |
| 79 | * 0x02 512 bytes | |
| 80 | * 0x03 1024 bytes | |
| 77 | * 0x00 128 bytes | |
| 78 | * 0x01 256 bytes | |
| 79 | * 0x02 512 bytes | |
| 80 | * 0x03 1024 bytes | |
| 81 | 81 | * |
| 82 | * Other values are undefined. Every sector in the disk image must be the | |
| 83 | * same size. | |
| 82 | * Other values are undefined. Every sector in the disk image must be the | |
| 83 | * same size. | |
| 84 | 84 | * |
| 85 | * F. First sector ID | |
| 86 | * This determines the first sector ID for each track. Each successive | |
| 87 | * sector adds one to the previous ID. If the first sector ID is 1, then | |
| 88 | * the second sector has an ID of 2, and the third has an ID of 3. | |
| 85 | * F. First sector ID | |
| 86 | * This determines the first sector ID for each track. Each successive | |
| 87 | * sector adds one to the previous ID. If the first sector ID is 1, then | |
| 88 | * the second sector has an ID of 2, and the third has an ID of 3. | |
| 89 | 89 | * |
| 90 | * G. Sector Attribute Flag | |
| 91 | * If this byte is non zero, then each sector contains an additional | |
| 92 | * byte prepended to the sector data. If the attribute flag is zero then | |
| 93 | * there are no extra bytes in front of the sector data. | |
| 90 | * G. Sector Attribute Flag | |
| 91 | * If this byte is non zero, then each sector contains an additional | |
| 92 | * byte prepended to the sector data. If the attribute flag is zero then | |
| 93 | * there are no extra bytes in front of the sector data. | |
| 94 | 94 | * |
| 95 | * H. Sector attribute byte | |
| 96 | * This byte is put at the begining of every sector if the header flag | |
| 97 | * is turned on. The information this byte contains is the same as the | |
| 98 | * status register (of the wd179x) would contain when a 'Read Sector' | |
| 99 | * command was issued. The bit fields are defined as: | |
| 95 | * H. Sector attribute byte | |
| 96 | * This byte is put at the begining of every sector if the header flag | |
| 97 | * is turned on. The information this byte contains is the same as the | |
| 98 | * status register (of the wd179x) would contain when a 'Read Sector' | |
| 99 | * command was issued. The bit fields are defined as: | |
| 100 | 100 | * |
| 101 | * Bit position: | |
| 102 | * --------------- | |
| 103 | * 7 6 5 4 3 2 1 0 | |
| 104 | * | | | | | | | | | |
| 105 | * | | | | | | | +--- Not used. Set to zero. | |
| 106 | * | | | | | | +----- Not used. Set to zero. | |
| 107 | * | | | | | +------- Not used. Set to zero. | |
| 108 | * | | | | +--------- Set on CRC error. | |
| 109 | * | | | +----------- Set if sector not found. | |
| 110 | * | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. | |
| 111 | * | +--------------- Not Used. Set to zero. | |
| 112 | * +----------------- Not Used. Set to zero. | |
| 101 | * Bit position: | |
| 102 | * --------------- | |
| 103 | * 7 6 5 4 3 2 1 0 | |
| 104 | * | | | | | | | | | |
| 105 | * | | | | | | | +--- Not used. Set to zero. | |
| 106 | * | | | | | | +----- Not used. Set to zero. | |
| 107 | * | | | | | +------- Not used. Set to zero. | |
| 108 | * | | | | +--------- Set on CRC error. | |
| 109 | * | | | +----------- Set if sector not found. | |
| 110 | * | | +------------- Record type: 1 - Deleted Data Mark, 0 - Data Mark. | |
| 111 | * | +--------------- Not Used. Set to zero. | |
| 112 | * +----------------- Not Used. Set to zero. | |
| 113 | 113 | * |
| 114 | 114 | * ----------------------------------------------------------------------- */ |
| 115 | 115 | |
| r5931 | r5932 | |
| 464 | 464 | * |
| 465 | 465 | * Used by Paul Burgin's PC-Dragon emulator |
| 466 | 466 | * |
| 467 | * Offset Bytes Field Description | |
| 468 | * ------ ----- ------------ ----------- | |
| 469 | * 0 1 magic1 Signature byte 1 ('d') | |
| 470 | * 1 1 magic2 Signature byte 2 ('k') | |
| 471 | * 2 2 header_len Total header length (little endian) | |
| 472 | * 4 1 ver_actual Version of the VDK format (0x10) | |
| 473 | * 5 1 ver_compat Backwards compatibility version (0x10) | |
| 474 | * 6 1 source_id Identify of the file source | |
| 475 | * 7 1 source_ver Version of the file source | |
| 476 | * 8 1 tracks Number of tracks | |
| 477 | * 9 1 sides Number of sides (1-2) | |
| 478 | * 10 1 flags Various flags | |
| 479 | * bit 0: Write protect | |
| 480 | * bit 1: A Lock | |
| 481 | * bit 2: F Lock | |
| 482 | * bit 3: Disk set | |
| 483 | * 11 1 compression Compression flags (bits 0-2) and name length | |
| 467 | * Offset Bytes Field Description | |
| 468 | * ------ ----- ------------ ----------- | |
| 469 | * 0 1 magic1 Signature byte 1 ('d') | |
| 470 | * 1 1 magic2 Signature byte 2 ('k') | |
| 471 | * 2 2 header_len Total header length (little endian) | |
| 472 | * 4 1 ver_actual Version of the VDK format (0x10) | |
| 473 | * 5 1 ver_compat Backwards compatibility version (0x10) | |
| 474 | * 6 1 source_id Identify of the file source | |
| 475 | * 7 1 source_ver Version of the file source | |
| 476 | * 8 1 tracks Number of tracks | |
| 477 | * 9 1 sides Number of sides (1-2) | |
| 478 | * 10 1 flags Various flags | |
| 479 | * bit 0: Write protect | |
| 480 | * bit 1: A Lock | |
| 481 | * bit 2: F Lock | |
| 482 | * bit 3: Disk set | |
| 483 | * 11 1 compression Compression flags (bits 0-2) and name length | |
| 484 | 484 | * ----------------------------------------------------------------------- */ |
| 485 | 485 | |
| 486 | 486 | |
| r5931 | r5932 | |
| 586 | 586 | * |
| 587 | 587 | * HEADER DESCRIPTION: |
| 588 | 588 | * |
| 589 | * Offset Bytes Field Description | |
| 590 | * ------ ----- ------------ ----------- | |
| 591 | * 0 1 write_prot 0xff = Writed Protected, 0x00 = R/W | |
| 589 | * Offset Bytes Field Description | |
| 590 | * ------ ----- ------------ ----------- | |
| 591 | * 0 1 write_prot 0xff = Writed Protected, 0x00 = R/W | |
| 592 | 592 | * 1 1 tracks Number of tracks |
| 593 | 593 | * 2 2 track_length Bytes per track (little endian) |
| 594 | 594 | * 4 1 disk_options Miscellaneous flags |
| 595 | * bit 0-3: Unused | |
| 596 | * bit 4: 1=single sided 0=dbl | |
| 597 | * bit 5: Unused | |
| 598 | * bit 6: Single density? | |
| 599 | * bit 6: Ignore density flags? | |
| 595 | * bit 0-3: Unused | |
| 596 | * bit 4: 1=single sided 0=dbl | |
| 597 | * bit 5: Unused | |
| 598 | * bit 6: Single density? | |
| 599 | * bit 6: Ignore density flags? | |
| 600 | 600 | * 5 7 reserved Reserved for future use |
| 601 | 601 | * 12 4 real_disk_code If this is 0x12345678 (little endian) |
| 602 | 602 | * then access a real disk drive |
| r5931 | r5932 | |
| 604 | 604 | * |
| 605 | 605 | * Each track begins with a track TOC, consisting of 64 little endian 16-bit |
| 606 | 606 | * integers. Each integer has the following format: |
| 607 | * bit 0-13: Offset from begining of track to 'FE' byte of IDAM | |
| 608 | * Note these are always sorted from first to last. All empty | |
| 609 | * entries are 0x00 | |
| 610 | * bit 14: Undefined (reserved) | |
| 611 | * bit 15: Sector double density (0=SD 1=DD) | |
| 607 | * bit 0-13: Offset from begining of track to 'FE' byte of IDAM | |
| 608 | * Note these are always sorted from first to last. All empty | |
| 609 | * entries are 0x00 | |
| 610 | * bit 14: Undefined (reserved) | |
| 611 | * bit 15: Sector double density (0=SD 1=DD) | |
| 612 | 612 | * ----------------------------------------------------------------------- */ |
| 613 | 613 | |
| 614 | 614 | struct dmk_tag |
| r5931 | r5932 | |
| 917 | 917 | { |
| 918 | 918 | /* check IDAM integrity and check for matching sector */ |
| 919 | 919 | if ((sector == dmk_idam_sector(&track_data[idam_offset])) |
| 920 | /* && (track == dmk_idam_track(&track_data[idam_offset])) */ | |
| 921 | /* && (head == dmk_idam_side(&track_data[idam_offset])) */ | |
| 920 | /* && (track == dmk_idam_track(&track_data[idam_offset])) */ | |
| 921 | /* && (head == dmk_idam_side(&track_data[idam_offset])) */ | |
| 922 | 922 | ) |
| 923 | 923 | break; |
| 924 | 924 | } |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | vt_cas.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for VTech casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 3 | Tape support for Orao TAP format | |
| 4 | ||
| 2 | ||
| 3 | Tape support for Orao TAP format | |
| 4 | ||
| 5 | 5 | */ |
| 6 | 6 | #include "driver.h" |
| 7 | 7 | #include "formats/orao_cas.h" |
| r5931 | r5932 | |
| 32 | 32 | static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) { |
| 33 | 33 | int i,j,size; |
| 34 | 34 | UINT8 b; |
| 35 | ||
| 35 | ||
| 36 | 36 | if (casdata == NULL) return -1; |
| 37 | 37 | if (caslen <= ORAO_HEADER_SIZE) { |
| 38 | 38 | return -1; |
| r5931 | r5932 | |
| 45 | 45 | size += 2*ORAO_WAVE_ZERO; |
| 46 | 46 | } else { |
| 47 | 47 | size += 2*ORAO_WAVE_ONE; |
| 48 | } | |
| 48 | } | |
| 49 | 49 | } |
| 50 | } | |
| 50 | } | |
| 51 | 51 | len = caslen; |
| 52 | return size; | |
| 52 | return size; | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | static int orao_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 55 | static int orao_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 56 | 56 | int i,j,size; |
| 57 | 57 | UINT8 b; |
| 58 | size = 0; | |
| 58 | size = 0; | |
| 59 | 59 | if (bytes == NULL) return -1; |
| 60 | 60 | for (i=ORAO_HEADER_SIZE;i<len-ORAO_HEADER_SIZE;i++) { |
| 61 | 61 | for (j=0;j<8;j++) { |
| 62 | 62 | b = (bytes[i] >> j) & 1; |
| 63 | if (b==0) { | |
| 63 | if (b==0) { | |
| 64 | 64 | wave_data = WAVE_LOW; |
| 65 | 65 | orao_output_wave(&buffer,ORAO_WAVE_ZERO); |
| 66 | 66 | wave_data = WAVE_HIGH; |
| 67 | 67 | orao_output_wave(&buffer,ORAO_WAVE_ZERO); |
| 68 | 68 | size += 2 *ORAO_WAVE_ZERO; |
| 69 | } else { | |
| 69 | } else { | |
| 70 | 70 | wave_data = WAVE_LOW; |
| 71 | 71 | orao_output_wave(&buffer,ORAO_WAVE_ONE); |
| 72 | 72 | wave_data = WAVE_HIGH; |
| 73 | 73 | orao_output_wave(&buffer,ORAO_WAVE_ONE); |
| 74 | 74 | size += 2 * ORAO_WAVE_ONE; |
| 75 | } | |
| 75 | } | |
| 76 | 76 | } |
| 77 | } | |
| 78 | ||
| 77 | } | |
| 78 | ||
| 79 | 79 | return size; |
| 80 | 80 | } |
| 81 | 81 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | csw_cas.h | |
| 3 | 3 | |
| 4 | ||
| 4 | Format code for csw cassette files | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #ifndef CSW_CAS_H |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/coco_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Tandy Color Computer / Dragon disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | * | |
| 2 | * | |
| 3 | 3 | * Sharp X1 TAP image format |
| 4 | * | |
| 4 | * | |
| 5 | 5 | * "New" header format: |
| 6 | 6 | * 0x00: Index - must be "TAPE" (4 bytes) |
| 7 | 7 | * 0x04: Image title. (null-terminated string, 17 bytes) |
| r5931 | r5932 | |
| 13 | 13 | * 0x20: Tape data size, in bits (4 bytes) |
| 14 | 14 | * 0x24: Tape position (4 bytes, usually 0) |
| 15 | 15 | * 0x28: Tape data (data size / 8) |
| 16 | * | |
| 16 | * | |
| 17 | 17 | * "Old" header format: |
| 18 | 18 | * 0x00: Sampling rate (4 bytes) |
| 19 | * | |
| 19 | * | |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | #include "driver.h" |
| r5931 | r5932 | |
| 32 | 32 | { |
| 33 | 33 | int x; |
| 34 | 34 | int sample_count = 0; |
| 35 | ||
| 35 | ||
| 36 | 36 | // one byte = 8 samples |
| 37 | 37 | for(x=0;x<8;x++) |
| 38 | 38 | { |
| 39 | 39 | if(buffer) |
| 40 | buffer[sample_pos+x] = (data & (1 << (7-x))) ? WAVE_HIGH : WAVE_LOW; | |
| 40 | buffer[sample_pos+x] = (data & (1 << (7-x))) ? WAVE_HIGH : WAVE_LOW; | |
| 41 | 41 | sample_count++; |
| 42 | 42 | } |
| 43 | ||
| 43 | ||
| 44 | 44 | return sample_count; |
| 45 | 45 | } |
| 46 | 46 | |
| r5931 | r5932 | |
| 59 | 59 | logerror("TAP: images that are not 8000Hz are not yet supported\n"); |
| 60 | 60 | return -1; |
| 61 | 61 | } |
| 62 | ||
| 62 | ||
| 63 | 63 | while(sample_count < cas_size) |
| 64 | 64 | { |
| 65 | 65 | sample_count += x1_fill_wave(buffer,casdata[data_pos],sample_count); |
| 66 | 66 | data_pos++; |
| 67 | 67 | } |
| 68 | ||
| 68 | ||
| 69 | 69 | return sample_count; |
| 70 | 70 | } |
| 71 | 71 | |
| r5931 | r5932 | |
| 75 | 75 | static int x1_cas_to_wav_size (const UINT8 *casdata, int caslen) |
| 76 | 76 | { |
| 77 | 77 | UINT32 ret; |
| 78 | ||
| 78 | ||
| 79 | 79 | ret = casdata[0x20] | (casdata[0x21] << 8) | (casdata[0x22] << 16) | (casdata[0x23] << 24); |
| 80 | 80 | cas_size = ret; |
| 81 | 81 | |
| 82 | 82 | samplerate = casdata[0x1c] | (casdata[0x1d] << 8) | (casdata[0x1e] << 16) | (casdata[0x1f] << 24); |
| 83 | ||
| 83 | ||
| 84 | 84 | return ret; |
| 85 | 85 | } |
| 86 | 86 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | wavfile.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for wave (*.wav) files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | /********************************************************************* |
| 242 | ||
| 242 | wavfile_testload() | |
| 243 | 243 | |
| 244 | This is a hokey function used to test the cassette wave loading | |
| 245 | system, specifically to test that when one loads a WAV file image | |
| 246 | that the resulting info queried will be the same data in the WAV. | |
| 244 | This is a hokey function used to test the cassette wave loading | |
| 245 | system, specifically to test that when one loads a WAV file image | |
| 246 | that the resulting info queried will be the same data in the WAV. | |
| 247 | 247 | |
| 248 | ||
| 248 | This code has already identified some rounding errors | |
| 249 | 249 | *********************************************************************/ |
| 250 | 250 | |
| 251 | 251 | #ifdef UNUSED_FUNCTION |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | flopimg.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Floppy disk image abstraction code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 66 | 66 | static void floppy_close_internal(floppy_image *floppy, int close_file); |
| 67 | 67 | |
| 68 | 68 | /********************************************************************* |
| 69 | ||
| 69 | opening, closing and creating of floppy images | |
| 70 | 70 | *********************************************************************/ |
| 71 | 71 | |
| 72 | 72 | /* basic floppy_image initialization common to floppy_open() and floppy_create() */ |
| r5931 | r5932 | |
| 320 | 320 | if (close_file) |
| 321 | 321 | io_generic_close(&floppy->io); |
| 322 | 322 | if (floppy->loaded_track_data) |
| 323 | free(floppy->loaded_track_data); | |
| 323 | free(floppy->loaded_track_data); | |
| 324 | 324 | tagpool_exit(&floppy->tags); |
| 325 | 325 | } |
| 326 | 326 | |
| r5931 | r5932 | |
| 337 | 337 | |
| 338 | 338 | |
| 339 | 339 | /********************************************************************* |
| 340 | ||
| 340 | functions useful in format constructors | |
| 341 | 341 | *********************************************************************/ |
| 342 | 342 | |
| 343 | 343 | struct FloppyCallbacks *floppy_callbacks(floppy_image *floppy) |
| r5931 | r5932 | |
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | /********************************************************************* |
| 381 | ||
| 381 | calls for accessing the raw disk image | |
| 382 | 382 | *********************************************************************/ |
| 383 | 383 | |
| 384 | 384 | void floppy_image_read(floppy_image *floppy, void *buffer, UINT64 offset, size_t length) |
| r5931 | r5932 | |
| 410 | 410 | |
| 411 | 411 | |
| 412 | 412 | /********************************************************************* |
| 413 | ||
| 413 | calls for accessing disk image data | |
| 414 | 414 | *********************************************************************/ |
| 415 | 415 | |
| 416 | 416 | static floperr_t floppy_readwrite_sector(floppy_image *floppy, int head, int track, int sector, int offset, |
| r5931 | r5932 | |
| 475 | 475 | if ((offset > 0) || (buffer_len < sector_length)) |
| 476 | 476 | { |
| 477 | 477 | /* we will be doing an partial read/write; in other words we |
| 478 | ||
| 478 | * will not be reading/writing a full sector */ | |
| 479 | 479 | new_alloc_buf = realloc(alloc_buf, sector_length); |
| 480 | 480 | if (!new_alloc_buf) |
| 481 | 481 | { |
| r5931 | r5932 | |
| 809 | 809 | |
| 810 | 810 | |
| 811 | 811 | /********************************************************************* |
| 812 | ||
| 812 | calls for track based IO | |
| 813 | 813 | *********************************************************************/ |
| 814 | 814 | |
| 815 | 815 | floperr_t floppy_load_track(floppy_image *floppy, int head, int track, int dirtify, void **track_data, size_t *track_length) |
| r5931 | r5932 | |
| 881 | 881 | |
| 882 | 882 | |
| 883 | 883 | /********************************************************************* |
| 884 | ||
| 884 | accessors for meta information about the image | |
| 885 | 885 | *********************************************************************/ |
| 886 | 886 | |
| 887 | 887 | const char *floppy_format_description(floppy_image *floppy) |
| r5931 | r5932 | |
| 892 | 892 | |
| 893 | 893 | |
| 894 | 894 | /********************************************************************* |
| 895 | ||
| 895 | misc calls | |
| 896 | 896 | *********************************************************************/ |
| 897 | 897 | |
| 898 | 898 | const char *floppy_error(floperr_t err) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | * | |
| 2 | * | |
| 3 | 3 | * Sharp X1 TAP image format |
| 4 | * | |
| 4 | * | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #ifndef X1_TAP_H_ |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | wavfile.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for wave (*.wav) files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | flopimg.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Floppy disk image abstraction code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 15 | 15 | |
| 16 | 16 | /*************************************************************************** |
| 17 | 17 | |
| 18 | ||
| 18 | Constants | |
| 19 | 19 | |
| 20 | 20 | ***************************************************************************/ |
| 21 | 21 | |
| r5931 | r5932 | |
| 26 | 26 | |
| 27 | 27 | /*************************************************************************** |
| 28 | 28 | |
| 29 | ||
| 29 | Type definitions | |
| 30 | 30 | |
| 31 | 31 | ***************************************************************************/ |
| 32 | 32 | |
| r5931 | r5932 | |
| 138 | 138 | |
| 139 | 139 | /*************************************************************************** |
| 140 | 140 | |
| 141 | ||
| 141 | Prototypes | |
| 142 | 142 | |
| 143 | 143 | ***************************************************************************/ |
| 144 | 144 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap_dsk35.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple 3.5" disk images | |
| 6 | 6 | |
| 7 | This code supports 3.5" 400k/800k disks used in early Macintoshes | |
| 8 | and the Apple IIgs. | |
| 7 | This code supports 3.5" 400k/800k disks used in early Macintoshes | |
| 8 | and the Apple IIgs. | |
| 9 | 9 | |
| 10 | ||
| 10 | These disks have the following properties: | |
| 11 | 11 | |
| 12 | 400k: 80 tracks, 1 head | |
| 13 | 800k: 80 tracks, 2 heads | |
| 12 | 400k: 80 tracks, 1 head | |
| 13 | 800k: 80 tracks, 2 heads | |
| 14 | 14 | |
| 15 | Tracks 0-15 have 12 sectors each | |
| 16 | Tracks 16-31 have 11 sectors each | |
| 17 | Tracks 32-47 have 10 sectors each | |
| 18 | Tracks 48-63 have 9 sectors each | |
| 19 | Tracks 64-79 have 8 sectors each | |
| 15 | Tracks 0-15 have 12 sectors each | |
| 16 | Tracks 16-31 have 11 sectors each | |
| 17 | Tracks 32-47 have 10 sectors each | |
| 18 | Tracks 48-63 have 9 sectors each | |
| 19 | Tracks 64-79 have 8 sectors each | |
| 20 | 20 | |
| 21 | 1440k disks are the exception; they are simply 80 tracks, 2 heads and | |
| 22 | 18 sectors per track. | |
| 21 | 1440k disks are the exception; they are simply 80 tracks, 2 heads and | |
| 22 | 18 sectors per track. | |
| 23 | 23 | |
| 24 | ||
| 24 | Each sector has 524 bytes, 512 of which are really used by the Macintosh | |
| 25 | 25 | |
| 26 | ||
| 26 | (80 tracks) * (avg of 10 sectors) * (512 bytes) * (2 sides) = 800 kB | |
| 27 | 27 | |
| 28 | ||
| 28 | Data is nibblized : 3 data bytes -> 4 bytes on disk. | |
| 29 | 29 | |
| 30 | In addition to 512 logical bytes, each sector contains 800 physical | |
| 31 | bytes. Here is the layout of the physical sector: | |
| 30 | In addition to 512 logical bytes, each sector contains 800 physical | |
| 31 | bytes. Here is the layout of the physical sector: | |
| 32 | 32 | |
| 33 | Pos | |
| 34 | 0 0xFF (pad byte where head is turned on ???) | |
| 35 | 1-35 self synch 0xFFs (7*5) (42 bytes actually written to media) | |
| 36 | 36 0xD5 | |
| 37 | 37 0xAA | |
| 38 | 38 0x96 | |
| 39 | 39 diskbytes[(track number) & 0x3F] | |
| 40 | 40 diskbytes[(sector number)] | |
| 41 | 41 diskbytes[("side")] | |
| 42 | 42 diskbytes[("format byte")] | |
| 43 | 43 diskbytes[("sum")] | |
| 44 | 44 0xDE | |
| 45 | 45 0xAA | |
| 46 | 46 pad byte where head is turned off/on (0xFF here) | |
| 47 | 47-51 self synch 0xFFs (6 bytes actually written to media) | |
| 48 | 52 0xD5 | |
| 49 | 53 0xAA | |
| 50 | 54 0xAD | |
| 51 | 55 spare byte, generally diskbytes[(sector number)] | |
| 52 | 56-754 "nibblized" sector data ... | |
| 53 | 755-758 checksum | |
| 54 | 759 0xDE | |
| 55 | 760 0xAA | |
| 56 | 761 pad byte where head is turned off (0xFF here) | |
| 33 | Pos | |
| 34 | 0 0xFF (pad byte where head is turned on ???) | |
| 35 | 1-35 self synch 0xFFs (7*5) (42 bytes actually written to media) | |
| 36 | 36 0xD5 | |
| 37 | 37 0xAA | |
| 38 | 38 0x96 | |
| 39 | 39 diskbytes[(track number) & 0x3F] | |
| 40 | 40 diskbytes[(sector number)] | |
| 41 | 41 diskbytes[("side")] | |
| 42 | 42 diskbytes[("format byte")] | |
| 43 | 43 diskbytes[("sum")] | |
| 44 | 44 0xDE | |
| 45 | 45 0xAA | |
| 46 | 46 pad byte where head is turned off/on (0xFF here) | |
| 47 | 47-51 self synch 0xFFs (6 bytes actually written to media) | |
| 48 | 52 0xD5 | |
| 49 | 53 0xAA | |
| 50 | 54 0xAD | |
| 51 | 55 spare byte, generally diskbytes[(sector number)] | |
| 52 | 56-754 "nibblized" sector data ... | |
| 53 | 755-758 checksum | |
| 54 | 759 0xDE | |
| 55 | 760 0xAA | |
| 56 | 761 pad byte where head is turned off (0xFF here) | |
| 57 | 57 | |
| 58 | Note : "Self synch refers to a technique whereby two zeroes are inserted | |
| 59 | between each synch byte written to the disk.", i.e. "0xFF, 0xFF, 0xFF, | |
| 60 | 0xFF, 0xFF" is actually "0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF" on disk. | |
| 61 | Since the IWM assumes the data transfer is complete when the MSBit of its | |
| 62 | shift register is 1, we do read 4 0xFF, even though they are not | |
| 63 | contiguous on the disk media. Some reflexion shows that 4 synch bytes | |
| 64 | allow the IWM to synchronize with the trailing data. | |
| 58 | Note : "Self synch refers to a technique whereby two zeroes are inserted | |
| 59 | between each synch byte written to the disk.", i.e. "0xFF, 0xFF, 0xFF, | |
| 60 | 0xFF, 0xFF" is actually "0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF" on disk. | |
| 61 | Since the IWM assumes the data transfer is complete when the MSBit of its | |
| 62 | shift register is 1, we do read 4 0xFF, even though they are not | |
| 63 | contiguous on the disk media. Some reflexion shows that 4 synch bytes | |
| 64 | allow the IWM to synchronize with the trailing data. | |
| 65 | 65 | |
| 66 | Format byte codes: | |
| 67 | 0x00 Apple II | |
| 68 | 0x01 Lisa | |
| 69 | 0x02 Mac MFS (single sided)? | |
| 70 | 0x22 Mac MFS (double sided)? | |
| 66 | Format byte codes: | |
| 67 | 0x00 Apple II | |
| 68 | 0x01 Lisa | |
| 69 | 0x02 Mac MFS (single sided)? | |
| 70 | 0x22 Mac MFS (double sided)? | |
| 71 | 71 | |
| 72 | 72 | *********************************************************************/ |
| 73 | 73 | |
| r5931 | r5932 | |
| 157 | 157 | static const UINT8 blk1[] = |
| 158 | 158 | { |
| 159 | 159 | /*0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 160 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 161 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 162 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 163 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 164 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 165 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 166 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 167 | 0xFF, 0xFF, 0xD5, 0xAA, 0x96*/ | |
| 160 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 161 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 162 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 163 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 164 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 165 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 166 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | |
| 167 | 0xFF, 0xFF, 0xD5, 0xAA, 0x96*/ | |
| 168 | 168 | 0xFF, |
| 169 | 169 | 0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF, |
| 170 | 170 | 0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF, |
| r5931 | r5932 | |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | /* |
| 215 | ||
| 215 | converts data to its nibblized representation, and generate checksum | |
| 216 | 216 | |
| 217 | ||
| 217 | now handles 524-byte-long sectors | |
| 218 | 218 | |
| 219 | ||
| 219 | tag data IS important, since it allows data recovery when the catalog is trashed | |
| 220 | 220 | */ |
| 221 | 221 | static void sony_nibblize35(const UINT8 *in, UINT8 *nib_ptr, UINT8 *csum) |
| 222 | 222 | { |
| r5931 | r5932 | |
| 227 | 227 | UINT8 b1[175], b2[175], b3[175]; |
| 228 | 228 | |
| 229 | 229 | /* Copy from the user's buffer to our buffer, while computing |
| 230 | * the three-byte data checksum | |
| 231 | */ | |
| 230 | * the three-byte data checksum | |
| 231 | */ | |
| 232 | 232 | |
| 233 | 233 | i = 0; |
| 234 | 234 | j = 0; |
| r5931 | r5932 | |
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | /* |
| 303 | ||
| 303 | does the reverse process of sony_nibblize35 | |
| 304 | 304 | */ |
| 305 | 305 | static void sony_denibblize35(UINT8 *out, const UINT8 *nib_ptr, UINT8 *checksum) |
| 306 | 306 | { |
| r5931 | r5932 | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /* Copy from the user's buffer to our buffer, while computing |
| 328 | * the three-byte data checksum | |
| 329 | */ | |
| 328 | * the three-byte data checksum | |
| 329 | */ | |
| 330 | 330 | |
| 331 | 331 | i = 0; |
| 332 | 332 | j = 0; |
| r5931 | r5932 | |
| 406 | 406 | while ((data & 0x80) == 0) |
| 407 | 407 | { |
| 408 | 408 | /* this code looks weird because it isn't simply rotating the new bit |
| 409 | * in, but for some reason it won't work if I rotate the bit in; I | |
| 410 | * have to match the algorithm used by the old code */ | |
| 409 | * in, but for some reason it won't work if I rotate the bit in; I | |
| 410 | * have to match the algorithm used by the old code */ | |
| 411 | 411 | data <<= 1; |
| 412 | 412 | data |= (buffer[*pos / 8] >> (8 - ((*pos % 8) + 1))); |
| 413 | 413 | (*pos)++; |
| r5931 | r5932 | |
| 857 | 857 | UINT8 disk_format; /* 0 = 400K, 1 = 800K, 2 = 720K, 3 = 1440K (other values reserved) */ |
| 858 | 858 | UINT8 format_byte; /* should be $00 Apple II, $01 Lisa, $02 Mac MFS ??? */ |
| 859 | 859 | /* $12 = 400K, $22 = >400K Macintosh (DiskCopy uses this value for |
| 860 | all Apple II disks not 800K in size, and even for some of those), | |
| 861 | $24 = 800K Apple II disk */ | |
| 860 | all Apple II disks not 800K in size, and even for some of those), | |
| 861 | $24 = 800K Apple II disk */ | |
| 862 | 862 | UINT16 magic; /* always $0100 (otherwise, the file may be in a different format. */ |
| 863 | 863 | }; |
| 864 | 864 |
| r5931 | r5932 | |
|---|---|---|
| 6 | 6 | #define VERBOSE 0 |
| 7 | 7 | #endif |
| 8 | 8 | |
| 9 | //#define LOG(N,M,A) | |
| 10 | // if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(machine)), (const char*)M ); logerror A; } | |
| 9 | //#define LOG(N,M,A) | |
| 10 | // if(VERBOSE>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(machine)), (const char*)M ); logerror A; } | |
| 11 | 11 | |
| 12 | 12 | #define LOG(N,M,A) \ |
| 13 | 13 | if(VERBOSE>=N){ if( M )logerror("%-24s",(const char*)M ); logerror A; } |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap_dsk35.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple 3.5" disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/comx35_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | COMX35 disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 22 | 22 | struct basicdsk_geometry geometry; |
| 23 | 23 | UINT8 header[1]; |
| 24 | 24 | int heads =1; |
| 25 | int cylinders =35; | |
| 26 | ||
| 25 | int cylinders =35; | |
| 26 | ||
| 27 | 27 | switch(floppy_image_size(floppy)) { |
| 28 | 28 | case 35*1*16*128: |
| 29 | 29 | heads = 1; |
| 30 | cylinders = 35; | |
| 30 | cylinders = 35; | |
| 31 | 31 | break; |
| 32 | 32 | |
| 33 | case 35*2*16*128: | |
| 33 | case 35*2*16*128: | |
| 34 | 34 | floppy_image_read( floppy, header, 0x12 , 1 ); |
| 35 | 35 | if (header[0] == 0x01) |
| 36 | { | |
| 36 | { | |
| 37 | 37 | heads = 1; |
| 38 | 38 | cylinders = 70; |
| 39 | 39 | } |
| r5931 | r5932 | |
| 42 | 42 | heads = 2; |
| 43 | 43 | cylinders = 35; |
| 44 | 44 | } |
| 45 | break; | |
| 45 | break; | |
| 46 | 46 | } |
| 47 | ||
| 47 | ||
| 48 | 48 | memset(&geometry, 0, sizeof(geometry)); |
| 49 | 49 | geometry.heads = heads; |
| 50 | 50 | geometry.first_sector_id = 0; |
| 51 | 51 | geometry.sector_length = 128; |
| 52 | 52 | geometry.tracks = cylinders; |
| 53 | 53 | geometry.sectors = 16; |
| 54 | return basicdsk_construct(floppy, &geometry); | |
| 54 | return basicdsk_construct(floppy, &geometry); | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /* ----------------------------------------------------------------------- */ |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | mz_cas.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for MZ700 casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap2_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple II disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/comx35_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | COMX35 disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | ap2_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Apple II disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 14 | 14 | |
| 15 | 15 | /*************************************************************************** |
| 16 | 16 | |
| 17 | ||
| 17 | Constants | |
| 18 | 18 | |
| 19 | 19 | ***************************************************************************/ |
| 20 | 20 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/trd_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | TRD disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 25 | 25 | UINT8 data[1]; |
| 26 | 26 | int heads; |
| 27 | 27 | int cylinders; |
| 28 | ||
| 28 | ||
| 29 | 29 | floppy_image_read( floppy, data, 0x8e3 , 1 ); |
| 30 | 30 | |
| 31 | 31 | /* guess geometry of disk */ |
| r5931 | r5932 | |
| 38 | 38 | geometry.sector_length = 256; |
| 39 | 39 | geometry.tracks = cylinders; |
| 40 | 40 | geometry.sectors = 16; |
| 41 | return basicdsk_construct(floppy, &geometry); | |
| 41 | return basicdsk_construct(floppy, &geometry); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | svi_cas.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for SVI casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | sord_cas.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for Sord M5 cassette files | |
| 6 | 6 | |
| 7 | 7 | **************************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/trd_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | TRD disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | sord_cas.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for Sord M5 cassette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 3 | Tape support for RK format | |
| 4 | ||
| 2 | ||
| 3 | Tape support for RK format | |
| 4 | ||
| 5 | 5 | */ |
| 6 | 6 | #include "driver.h" |
| 7 | 7 | #include "formats/rk_cas.h" |
| r5931 | r5932 | |
| 35 | 35 | if (b) |
| 36 | 36 | { |
| 37 | 37 | p = rk_emit_level (p, bitsize, WAVE_HIGH); |
| 38 | p = rk_emit_level (p, bitsize, WAVE_LOW); | |
| 39 | } | |
| 38 | p = rk_emit_level (p, bitsize, WAVE_LOW); | |
| 39 | } | |
| 40 | 40 | else |
| 41 | 41 | { |
| 42 | p = rk_emit_level (p, bitsize, WAVE_LOW); | |
| 43 | p = rk_emit_level (p, bitsize, WAVE_HIGH); | |
| 44 | ||
| 42 | p = rk_emit_level (p, bitsize, WAVE_LOW); | |
| 43 | p = rk_emit_level (p, bitsize, WAVE_HIGH); | |
| 44 | ||
| 45 | 45 | } |
| 46 | 46 | return p; |
| 47 | 47 | } |
| r5931 | r5932 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | static int rk20_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 59 | static int rk20_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 60 | 60 | data_size = caslen; |
| 61 | return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_20; | |
| 61 | return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_20; | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | static int rk22_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 64 | static int rk22_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 65 | 65 | data_size = caslen; |
| 66 | return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_22; | |
| 66 | return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_22; | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | static int rk60_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 69 | static int rk60_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 70 | 70 | data_size = caslen; |
| 71 | return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_60; | |
| 71 | return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_60; | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | static int gam_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 74 | static int gam_cas_to_wav_size( const UINT8 *casdata, int caslen ) { | |
| 75 | 75 | data_size = caslen; |
| 76 | return (RK_HEADER_LEN * 8 * 2 + caslen * 8 * 2) * RK_SIZE_20; | |
| 76 | return (RK_HEADER_LEN * 8 * 2 + caslen * 8 * 2) * RK_SIZE_20; | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | static int rk20_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 79 | static int rk20_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 80 | 80 | int i; |
| 81 | 81 | INT16 * p = buffer; |
| 82 | ||
| 82 | ||
| 83 | 83 | for (i=0; i<RK_HEADER_LEN; i++) { |
| 84 | p = rk_output_byte (p, 0x00, RK_SIZE_20 ); | |
| 84 | p = rk_output_byte (p, 0x00, RK_SIZE_20 ); | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | p = rk_output_byte (p, 0xE6, RK_SIZE_20); | |
| 88 | ||
| 87 | p = rk_output_byte (p, 0xE6, RK_SIZE_20); | |
| 88 | ||
| 89 | 89 | for (i=0; i<data_size; i++) |
| 90 | 90 | p = rk_output_byte (p, bytes[i], RK_SIZE_20); |
| 91 | 91 | |
| 92 | 92 | return p - buffer; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | static int rk22_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 95 | static int rk22_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 96 | 96 | int i; |
| 97 | 97 | INT16 * p = buffer; |
| 98 | ||
| 98 | ||
| 99 | 99 | for (i=0; i<RK_HEADER_LEN; i++) { |
| 100 | p = rk_output_byte (p, 0x00, RK_SIZE_22 ); | |
| 100 | p = rk_output_byte (p, 0x00, RK_SIZE_22 ); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | p = rk_output_byte (p, 0xE6, RK_SIZE_22); | |
| 104 | ||
| 103 | p = rk_output_byte (p, 0xE6, RK_SIZE_22); | |
| 104 | ||
| 105 | 105 | for (i=0; i<data_size; i++) |
| 106 | 106 | p = rk_output_byte (p, bytes[i], RK_SIZE_22); |
| 107 | 107 | |
| 108 | 108 | return p - buffer; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | static int rk60_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 111 | static int rk60_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 112 | 112 | int i; |
| 113 | 113 | INT16 * p = buffer; |
| 114 | ||
| 114 | ||
| 115 | 115 | for (i=0; i<RK_HEADER_LEN; i++) { |
| 116 | p = rk_output_byte (p, 0x00, RK_SIZE_60 ); | |
| 116 | p = rk_output_byte (p, 0x00, RK_SIZE_60 ); | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | p = rk_output_byte (p, 0xE6, RK_SIZE_60); | |
| 120 | ||
| 119 | p = rk_output_byte (p, 0xE6, RK_SIZE_60); | |
| 120 | ||
| 121 | 121 | for (i=0; i<data_size; i++) |
| 122 | 122 | p = rk_output_byte (p, bytes[i], RK_SIZE_60); |
| 123 | 123 | |
| 124 | 124 | return p - buffer; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | static int gam_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 127 | static int gam_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) { | |
| 128 | 128 | int i; |
| 129 | 129 | INT16 * p = buffer; |
| 130 | ||
| 130 | ||
| 131 | 131 | for (i=0; i<RK_HEADER_LEN; i++) { |
| 132 | p = rk_output_byte (p, 0x00, RK_SIZE_20 ); | |
| 132 | p = rk_output_byte (p, 0x00, RK_SIZE_20 ); | |
| 133 | 133 | } |
| 134 | ||
| 134 | ||
| 135 | 135 | for (i=0; i<data_size; i++) |
| 136 | 136 | p = rk_output_byte (p, bytes[i], RK_SIZE_20); |
| 137 | 137 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/pc_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | PC disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 60 | 60 | if (size >= 0x1a) |
| 61 | 61 | { |
| 62 | 62 | /* |
| 63 | * get info from boot sector. | |
| 64 | * not correct on all disks | |
| 65 | */ | |
| 63 | * get info from boot sector. | |
| 64 | * not correct on all disks | |
| 65 | */ | |
| 66 | 66 | UINT8 scl, spt, heads; |
| 67 | 67 | floppy_image_read(floppy, &scl, 0x0c, 1); |
| 68 | 68 | floppy_image_read(floppy, &spt, 0x18, 1); |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/atarist_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Atari ST disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 21 | 21 | { |
| 22 | 22 | struct basicdsk_geometry geometry; |
| 23 | 23 | int heads = 0; |
| 24 | int tracks = 0; | |
| 24 | int tracks = 0; | |
| 25 | 25 | int sectors = 0; |
| 26 | 26 | UINT8 bootsector[512]; |
| 27 | 27 | |
| r5931 | r5932 | |
| 29 | 29 | sectors = bootsector[0x18]; |
| 30 | 30 | heads = bootsector[0x1a]; |
| 31 | 31 | tracks = (bootsector[0x13] | (bootsector[0x14] << 8)) / sectors / heads; |
| 32 | ||
| 32 | ||
| 33 | 33 | memset(&geometry, 0, sizeof(geometry)); |
| 34 | 34 | geometry.heads = heads; |
| 35 | 35 | geometry.first_sector_id = 1; |
| 36 | 36 | geometry.sector_length = 512; |
| 37 | 37 | geometry.tracks = tracks; |
| 38 | 38 | geometry.sectors = sectors; |
| 39 | return basicdsk_construct(floppy, &geometry); | |
| 39 | return basicdsk_construct(floppy, &geometry); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /* ----------------------------------------------------------------------- */ |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/pc_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | PC disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/thom_dsk.c | |
| 4 | 4 | |
| 5 | Thomson disk images | |
| 6 | ||
| 7 | Based on work of Antoine Mine' | |
| 5 | Thomson disk images | |
| 8 | 6 | |
| 7 | Based on work of Antoine Mine' | |
| 8 | ||
| 9 | 9 | *********************************************************************/ |
| 10 | 10 | |
| 11 | 11 | #include <string.h> |
| r5931 | r5932 | |
| 50 | 50 | char header[0x100]; |
| 51 | 51 | floppy_image_read(floppy, header, 1, sizeof(sap_header)); |
| 52 | 52 | if (!memcmp( header, sap_header, sizeof(sap_header) ) ) |
| 53 | { | |
| 53 | { | |
| 54 | 54 | *vote= 100; |
| 55 | 55 | } else { |
| 56 | 56 | *vote = 0; |
| r5931 | r5932 | |
| 82 | 82 | return FLOPPY_ERROR_SEEKERROR; |
| 83 | 83 | |
| 84 | 84 | offs = 0x42 + track * ((get_tag(floppy)->sector_size + 6)* 16) + sector * (get_tag(floppy)->sector_size + 6) + 4; |
| 85 | if (offset) | |
| 85 | if (offset) | |
| 86 | 86 | *offset = offs; |
| 87 | 87 | return FLOPPY_ERROR_SUCCESS; |
| 88 | 88 | } |
| r5931 | r5932 | |
| 93 | 93 | { |
| 94 | 94 | UINT64 offset; |
| 95 | 95 | floperr_t err; |
| 96 | int i; | |
| 96 | int i; | |
| 97 | 97 | UINT8 *buf; |
| 98 | 98 | err = get_offset(floppy, head, track, sector, sector_is_index, &offset); |
| 99 | 99 | if (err) |
| r5931 | r5932 | |
| 171 | 171 | UINT64 offset = 0; |
| 172 | 172 | sector_index += 1; |
| 173 | 173 | err = get_offset(floppy, head, track, sector_index, FALSE, &offset); |
| 174 | ||
| 174 | ||
| 175 | 175 | floppy_image_read(floppy, header, offset-4, 4); |
| 176 | 176 | if (cylinder) |
| 177 | 177 | *cylinder = header[2]; |
| r5931 | r5932 | |
| 214 | 214 | callbacks->get_heads_per_disk = sap_get_heads_per_disk; |
| 215 | 215 | callbacks->get_tracks_per_disk = sap_get_tracks_per_disk; |
| 216 | 216 | callbacks->get_indexed_sector_info = sap_get_indexed_sector_info; |
| 217 | ||
| 218 | return FLOPPY_ERROR_SUCCESS; | |
| 217 | ||
| 218 | return FLOPPY_ERROR_SUCCESS; | |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | static FLOPPY_IDENTIFY(qdd_dsk_identify) |
| r5931 | r5932 | |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /* fixed interlacing map for QDDs */ |
| 228 | static int thom_qdd_map[400]; | |
| 228 | static int thom_qdd_map[400]; | |
| 229 | 229 | |
| 230 | 230 | static int qdd_translate_sector(floppy_image *floppy, int sector) |
| 231 | 231 | { |
| r5931 | r5932 | |
| 259 | 259 | static FLOPPY_CONSTRUCT(qdd_dsk_construct) |
| 260 | 260 | { |
| 261 | 261 | struct basicdsk_geometry geometry; |
| 262 | ||
| 262 | ||
| 263 | 263 | thom_qdd_compute_map(); |
| 264 | ||
| 264 | ||
| 265 | 265 | memset(&geometry, 0, sizeof(geometry)); |
| 266 | 266 | geometry.heads = 1; |
| 267 | 267 | geometry.first_sector_id = 1; |
| r5931 | r5932 | |
| 269 | 269 | geometry.tracks = 1; |
| 270 | 270 | geometry.sectors = 400; |
| 271 | 271 | geometry.translate_sector = qdd_translate_sector; |
| 272 | return basicdsk_construct(floppy, &geometry); | |
| 272 | return basicdsk_construct(floppy, &geometry); | |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
| 276 | 276 | /* ----------------------------------------------------------------------- */ |
| 277 | 277 | |
| 278 | 278 | FLOPPY_OPTIONS_START(thomson) |
| 279 | FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image", qdd_dsk_identify, qdd_dsk_construct, | |
| 279 | FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image", qdd_dsk_identify, qdd_dsk_construct, | |
| 280 | 280 | HEADS([1]) |
| 281 | 281 | TRACKS([1]) |
| 282 | 282 | SECTORS([400]) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /************************************************************************** |
| 2 | 2 | |
| 3 | ||
| 3 | coco_cas.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for CoCo CAS (*.cas) files | |
| 6 | 6 | |
| 7 | This is the actual code that processes the CAS data. CAS files are a | |
| 8 | problem because they are a legacy of previous CoCo emulators, and most | |
| 9 | of these emulators patch the system as a shortcut. Thus, the ones and | |
| 10 | zeroes in the file do not truly represent modulated pulses in the | |
| 11 | waveform, but what the BIOS reads and writes. | |
| 7 | This is the actual code that processes the CAS data. CAS files are a | |
| 8 | problem because they are a legacy of previous CoCo emulators, and most | |
| 9 | of these emulators patch the system as a shortcut. Thus, the ones and | |
| 10 | zeroes in the file do not truly represent modulated pulses in the | |
| 11 | waveform, but what the BIOS reads and writes. | |
| 12 | 12 | |
| 13 | In doing so, they make the CoCo more tolerant of short headers and lack | |
| 14 | of delays between blocks. This legacy is reflected in most CAS files in | |
| 13 | In doing so, they make the CoCo more tolerant of short headers and lack | |
| 14 | of delays between blocks. This legacy is reflected in most CAS files in | |
| 15 | 15 | use, and thus presents a problem for a pure hardware emulation like MESS. |
| 16 | 16 | |
| 17 | One alternative is to preprocess the data on the CAS, file by file, but | |
| 18 | this proves to be problematic because in the process, legitimate data | |
| 19 | that is unrecognized by the preprocessor may get dropped. | |
| 17 | One alternative is to preprocess the data on the CAS, file by file, but | |
| 18 | this proves to be problematic because in the process, legitimate data | |
| 19 | that is unrecognized by the preprocessor may get dropped. | |
| 20 | 20 | |
| 21 | The approach taken here is a hybrid approach - it retrieves the data | |
| 22 | block by block until an error occurs; be it the end of the CAS or a | |
| 23 | corrupt (?!) block. When "legitimate" blocks are done processing, the | |
| 24 | remainder of the data is added to the waveform in a traditional manner. | |
| 25 | The result has proven to work quite well. | |
| 21 | The approach taken here is a hybrid approach - it retrieves the data | |
| 22 | block by block until an error occurs; be it the end of the CAS or a | |
| 23 | corrupt (?!) block. When "legitimate" blocks are done processing, the | |
| 24 | remainder of the data is added to the waveform in a traditional manner. | |
| 25 | The result has proven to work quite well. | |
| 26 | 26 | |
| 27 | 2005-May-04, P.Harvey-Smith, improved handling of some "copy protected" | |
| 28 | Dragon games that have odd blocks in odd places, this has slightly | |
| 29 | increased loading time but does mean games like "Rommel's Revenge" will | |
| 30 | now load. | |
| 27 | 2005-May-04, P.Harvey-Smith, improved handling of some "copy protected" | |
| 28 | Dragon games that have odd blocks in odd places, this has slightly | |
| 29 | increased loading time but does mean games like "Rommel's Revenge" will | |
| 30 | now load. | |
| 31 | 31 | |
| 32 | 32 | **************************************************************************/ |
| 33 | 33 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | lviv_lvt.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for Lviv casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/imd_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | IMD disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 65 | 65 | UINT8 header[5]; |
| 66 | 66 | UINT8 sector_num; |
| 67 | 67 | int i; |
| 68 | ||
| 69 | ||
| 68 | ||
| 69 | ||
| 70 | 70 | if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks) |
| 71 | 71 | || (sector < 0) ) |
| 72 | 72 | return FLOPPY_ERROR_SEEKERROR; |
| 73 | ||
| 73 | ||
| 74 | 74 | offs = imd_get_track_offset(floppy,head,track); |
| 75 | 75 | floppy_image_read(floppy, header, offs, 5); |
| 76 | 76 | |
| r5931 | r5932 | |
| 79 | 79 | if(header[2] & 0x80) offs += sector_num; // skip cylinder numbering map |
| 80 | 80 | if(header[2] & 0x40) offs += sector_num; // skip head numbering map |
| 81 | 81 | get_tag(floppy)->sector_size = 1 << (header[4] + 7); |
| 82 | for(i=0;i<sector;i++) { | |
| 82 | for(i=0;i<sector;i++) { | |
| 83 | 83 | floppy_image_read(floppy, header, offs, 1); // take sector data type |
| 84 | 84 | switch(header[0]) { |
| 85 | 85 | case 0: offs++; break; |
| r5931 | r5932 | |
| 88 | 88 | case 5: |
| 89 | 89 | case 7: offs += get_tag(floppy)->sector_size + 1; break; |
| 90 | 90 | default: offs += 2; |
| 91 | } | |
| 92 | } | |
| 91 | } | |
| 92 | } | |
| 93 | 93 | if (offset) |
| 94 | 94 | *offset = offs; |
| 95 | 95 | return FLOPPY_ERROR_SUCCESS; |
| r5931 | r5932 | |
| 100 | 100 | static floperr_t internal_imd_read_sector(floppy_image *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) |
| 101 | 101 | { |
| 102 | 102 | UINT64 offset; |
| 103 | floperr_t err; | |
| 103 | floperr_t err; | |
| 104 | 104 | UINT8 header[1]; |
| 105 | ||
| 105 | ||
| 106 | 106 | // take sector offset |
| 107 | 107 | err = get_offset(floppy, head, track, sector, sector_is_index, &offset); |
| 108 | 108 | if (err) |
| 109 | 109 | return err; |
| 110 | ||
| 111 | floppy_image_read(floppy, header, offset, 1); | |
| 110 | ||
| 111 | floppy_image_read(floppy, header, offset, 1); | |
| 112 | 112 | switch(header[0]) { |
| 113 | 113 | case 0: break; |
| 114 | 114 | case 1: |
| 115 | 115 | case 3: |
| 116 | 116 | case 5: |
| 117 | case 7: | |
| 117 | case 7: | |
| 118 | 118 | floppy_image_read(floppy, buffer, offset+1, buflen); |
| 119 | 119 | break; |
| 120 | ||
| 120 | ||
| 121 | 121 | default: // all data same |
| 122 | 122 | floppy_image_read(floppy, header, offset+1, 1); |
| 123 | 123 | memset(buffer,header[0],buflen); |
| 124 | 124 | break; |
| 125 | } | |
| 126 | ||
| 125 | } | |
| 126 | ||
| 127 | 127 | return FLOPPY_ERROR_SUCCESS; |
| 128 | 128 | } |
| 129 | 129 | |
| r5931 | r5932 | |
| 145 | 145 | if (err) |
| 146 | 146 | return err; |
| 147 | 147 | |
| 148 | if (sector_length) { | |
| 148 | if (sector_length) { | |
| 149 | 149 | *sector_length = get_tag(floppy)->sector_size; |
| 150 | 150 | } |
| 151 | 151 | return FLOPPY_ERROR_SUCCESS; |
| r5931 | r5932 | |
| 159 | 159 | UINT8 tr; |
| 160 | 160 | UINT32 sector_size; |
| 161 | 161 | UINT8 sector_num; |
| 162 | ||
| 162 | ||
| 163 | 163 | offset = imd_get_track_offset(floppy,head,track); |
| 164 | 164 | floppy_image_read(floppy, header, offset, 5); |
| 165 | 165 | tr = header[1]; |
| r5931 | r5932 | |
| 196 | 196 | } |
| 197 | 197 | if (flags) { |
| 198 | 198 | UINT8 skip; |
| 199 | if (head & 0x40) { | |
| 199 | if (head & 0x40) { | |
| 200 | 200 | if (head & 0x80) { |
| 201 | skip = 3; | |
| 201 | skip = 3; | |
| 202 | 202 | } else { |
| 203 | 203 | skip = 2; |
| 204 | } | |
| 204 | } | |
| 205 | 205 | } else { |
| 206 | 206 | skip = 1; |
| 207 | } | |
| 207 | } | |
| 208 | 208 | floppy_image_read(floppy, header, offset + 5 + skip * sector_num, 1); |
| 209 | 209 | *flags = 0; |
| 210 | 210 | if ((header[0]-1) & 0x02) *flags |= ID_FLAG_DELETED_DATA; |
| 211 | if ((header[0]-1) & 0x04) *flags |= ID_FLAG_CRC_ERROR_IN_DATA_FIELD; | |
| 211 | if ((header[0]-1) & 0x04) *flags |= ID_FLAG_CRC_ERROR_IN_DATA_FIELD; | |
| 212 | 212 | } |
| 213 | 213 | return FLOPPY_ERROR_SUCCESS; |
| 214 | 214 | } |
| r5931 | r5932 | |
| 219 | 219 | struct FloppyCallbacks *callbacks; |
| 220 | 220 | struct imddsk_tag *tag; |
| 221 | 221 | UINT8 header[0x100]; |
| 222 | UINT64 pos = 0; | |
| 222 | UINT64 pos = 0; | |
| 223 | 223 | int sector_size = 0; |
| 224 | 224 | int sector_num; |
| 225 | 225 | int i; |
| r5931 | r5932 | |
| 228 | 228 | // create |
| 229 | 229 | return FLOPPY_ERROR_UNSUPPORTED; |
| 230 | 230 | } |
| 231 | ||
| 231 | ||
| 232 | 232 | tag = (struct imddsk_tag *) floppy_create_tag(floppy, IMD_DSK_TAG, sizeof(struct imddsk_tag)); |
| 233 | 233 | if (!tag) |
| 234 | 234 | return FLOPPY_ERROR_OUTOFMEMORY; |
| r5931 | r5932 | |
| 249 | 249 | if(header[2] & 0x80) pos += sector_num; // skip cylinder numbering map |
| 250 | 250 | if(header[2] & 0x40) pos += sector_num; // skip head numbering map |
| 251 | 251 | sector_size = 1 << (header[4] + 7); |
| 252 | for(i=0;i<sector_num;i++) { | |
| 252 | for(i=0;i<sector_num;i++) { | |
| 253 | 253 | floppy_image_read(floppy, header, pos, 1); // take sector data type |
| 254 | 254 | switch(header[0]) { |
| 255 | 255 | case 0: pos++; break; |
| r5931 | r5932 | |
| 258 | 258 | case 5: |
| 259 | 259 | case 7: pos += sector_size + 1; break; |
| 260 | 260 | default: pos += 2;break; |
| 261 | } | |
| 262 | } | |
| 263 | tag->tracks += 1; | |
| 261 | } | |
| 262 | } | |
| 263 | tag->tracks += 1; | |
| 264 | 264 | } while(pos < floppy_image_size(floppy)); |
| 265 | ||
| 265 | ||
| 266 | 266 | callbacks = floppy_callbacks(floppy); |
| 267 | 267 | callbacks->read_sector = imd_read_sector; |
| 268 | 268 | callbacks->read_indexed_sector = imd_read_indexed_sector; |
| r5931 | r5932 | |
|---|---|---|
| 16 | 16 | #define PRIMO_BIT_1_LENGTH (PRIMO_BIT_1_PERIOD*PRIMO_WAV_FREQUENCY) |
| 17 | 17 | #define PRIMO_BIT_0_LENGTH (PRIMO_BIT_0_PERIOD*PRIMO_WAV_FREQUENCY) |
| 18 | 18 | /* |
| 19 | #define PRIMO_BIT_1_LENGTH 6 | |
| 20 | #define PRIMO_BIT_0_LENGTH 16 | |
| 19 | #define PRIMO_BIT_1_LENGTH 6 | |
| 20 | #define PRIMO_BIT_0_LENGTH 16 | |
| 21 | 21 | */ |
| 22 | 22 | #define PRIMO_PAUSE_LENGTH 2000 |
| 23 | 23 | #define PRIMO_FILE_PILOT_LENGTH ((4*PRIMO_BIT_1_LENGTH + 4*PRIMO_BIT_0_LENGTH)*512) |
| r5931 | r5932 | |
| 102 | 102 | logerror ("File size (with header): %d\n", file_size); |
| 103 | 103 | |
| 104 | 104 | /* b is now set on the first data byte of file |
| 105 | ||
| 105 | it means first byte (type) of block */ | |
| 106 | 106 | |
| 107 | 107 | j = 0; |
| 108 | 108 | while (j < file_size-3) |
| r5931 | r5932 | |
| 173 | 173 | logerror ("File size: %d\n", file_size); |
| 174 | 174 | |
| 175 | 175 | /* b is now set on the first data byte of file |
| 176 | ||
| 176 | it means first byte (block type) of block header */ | |
| 177 | 177 | |
| 178 | 178 | j = 0; |
| 179 | 179 | while (j < file_size-3) |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/atarist_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | atarist disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | coco_cas.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for CoCo CAS (*.cas) files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | primoptp.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for Primo casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/dsk_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | DSK disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | pmd_pmd.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for PMD-85 casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cassimg.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Cassette tape image abstraction code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | /********************************************************************* |
| 32 | ||
| 32 | helper code | |
| 33 | 33 | *********************************************************************/ |
| 34 | 34 | |
| 35 | 35 | static double map_double(double d, UINT64 low, UINT64 high, UINT64 value) |
| r5931 | r5932 | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | /********************************************************************* |
| 55 | ||
| 55 | extrapolation and interpolation | |
| 56 | 56 | *********************************************************************/ |
| 57 | 57 | |
| 58 | 58 | static INT32 extrapolate8(INT8 value) |
| r5931 | r5932 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | /********************************************************************* |
| 81 | ||
| 81 | initialization and termination | |
| 82 | 82 | *********************************************************************/ |
| 83 | 83 | |
| 84 | 84 | static cassette_image *cassette_init(running_machine *machine,const struct CassetteFormat *format, void *file, const struct io_procs *procs, int flags) |
| r5931 | r5932 | |
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | /********************************************************************* |
| 304 | ||
| 304 | calls for accessing the raw cassette image | |
| 305 | 305 | *********************************************************************/ |
| 306 | 306 | |
| 307 | 307 | void cassette_image_read(cassette_image *cassette, void *buffer, UINT64 offset, size_t length) |
| r5931 | r5932 | |
| 326 | 326 | |
| 327 | 327 | |
| 328 | 328 | /********************************************************************* |
| 329 | ||
| 329 | waveform accesses | |
| 330 | 330 | *********************************************************************/ |
| 331 | 331 | |
| 332 | 332 | struct manipulation_ranges |
| r5931 | r5932 | |
| 433 | 433 | |
| 434 | 434 | |
| 435 | 435 | /********************************************************************* |
| 436 | ||
| 436 | waveform accesses | |
| 437 | 437 | *********************************************************************/ |
| 438 | 438 | |
| 439 | 439 | casserr_t cassette_get_samples(cassette_image *cassette, int channel, |
| r5931 | r5932 | |
| 598 | 598 | |
| 599 | 599 | |
| 600 | 600 | /********************************************************************* |
| 601 | ||
| 601 | waveform accesses to/from the raw image | |
| 602 | 602 | *********************************************************************/ |
| 603 | 603 | |
| 604 | 604 | casserr_t cassette_read_samples(cassette_image *cassette, int channels, double time_index, |
| r5931 | r5932 | |
| 682 | 682 | |
| 683 | 683 | |
| 684 | 684 | /********************************************************************* |
| 685 | ||
| 685 | waveform accesses to/from the raw image | |
| 686 | 686 | *********************************************************************/ |
| 687 | 687 | |
| 688 | 688 | static const INT8 *choose_wave(const struct CassetteModulation *modulation, size_t *wave_bytes_length) |
| r5931 | r5932 | |
| 868 | 868 | |
| 869 | 869 | |
| 870 | 870 | /********************************************************************* |
| 871 | ||
| 871 | waveform accesses to/from the raw image | |
| 872 | 872 | *********************************************************************/ |
| 873 | 873 | |
| 874 | 874 | casserr_t cassette_legacy_identify(cassette_image *cassette, struct CassetteOptions *opts, |
| r5931 | r5932 | |
| 1023 | 1023 | |
| 1024 | 1024 | |
| 1025 | 1025 | /********************************************************************* |
| 1026 | ||
| 1026 | cassette_dump | |
| 1027 | 1027 | |
| 1028 | ||
| 1028 | A debugging call to dump a casette image to a disk based wave file | |
| 1029 | 1029 | *********************************************************************/ |
| 1030 | 1030 | |
| 1031 | 1031 | void cassette_dump(cassette_image *image, const char *filename) |
| r5931 | r5932 | |
|---|---|---|
| 211 | 211 | static casserr_t zx81_p_load(cassette_image *cassette) |
| 212 | 212 | { |
| 213 | 213 | /* The filename of the file is used to create the wave stream for the emulated machine. Why is this information not |
| 214 | part of the image file itself? | |
| 215 | Hardcoding this to "cassette". | |
| 216 | */ | |
| 214 | part of the image file itself? | |
| 215 | Hardcoding this to "cassette". | |
| 216 | */ | |
| 217 | 217 | zx81_fill_file_name ("cassette" /*image_basename_noext(device_list_find_by_tag( Machine->config->devicelist, CASSETTE, "cassette" ))*/ ); |
| 218 | 218 | return cassette_legacy_construct(cassette, &zx81_legacy_fill_wave); |
| 219 | 219 | } |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/vt_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | VTech Laser/VZ disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cassimg.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Cassette tape image abstraction code | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 14 | 14 | |
| 15 | 15 | /*************************************************************************** |
| 16 | 16 | |
| 17 | ||
| 17 | Constants | |
| 18 | 18 | |
| 19 | 19 | ***************************************************************************/ |
| 20 | 20 | |
| r5931 | r5932 | |
| 49 | 49 | |
| 50 | 50 | /*************************************************************************** |
| 51 | 51 | |
| 52 | ||
| 52 | Type definitions | |
| 53 | 53 | |
| 54 | 54 | ***************************************************************************/ |
| 55 | 55 | |
| r5931 | r5932 | |
| 98 | 98 | struct sample_block *blocks; |
| 99 | 99 | size_t block_count; |
| 100 | 100 | size_t sample_count; |
| 101 | ||
| 101 | ||
| 102 | 102 | running_machine *machine; |
| 103 | 103 | }; |
| 104 | 104 | |
| r5931 | r5932 | |
| 159 | 159 | |
| 160 | 160 | /*************************************************************************** |
| 161 | 161 | |
| 162 | ||
| 162 | Prototypes | |
| 163 | 163 | |
| 164 | 164 | ***************************************************************************/ |
| 165 | 165 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/oric_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Oric disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 33 | 33 | int heads; |
| 34 | 34 | int geometry; |
| 35 | 35 | int tracksize; |
| 36 | int num_sectors; | |
| 36 | int num_sectors; | |
| 37 | 37 | struct mfm_disk_sector_info sector_data[32]; |
| 38 | 38 | }; |
| 39 | 39 | |
| r5931 | r5932 | |
| 49 | 49 | static FLOPPY_IDENTIFY(oric_dsk_identify) |
| 50 | 50 | { |
| 51 | 51 | UINT8 header[mfm_disk_header_size]; |
| 52 | ||
| 52 | ||
| 53 | 53 | floppy_image_read(floppy, header, 0, mfm_disk_header_size); |
| 54 | if ( memcmp( header, MFM_ID, 8 ) ==0) { | |
| 54 | if ( memcmp( header, MFM_ID, 8 ) ==0) { | |
| 55 | 55 | int heads = pick_integer_le(header, 8, 4); |
| 56 | 56 | int tracks = pick_integer_le(header, 12, 4); |
| 57 | ||
| 57 | ||
| 58 | 58 | if (floppy_image_size(floppy)==((tracks*heads*TRACK_SIZE_MFM)+mfm_disk_header_size)) { |
| 59 | 59 | *vote = 100; |
| 60 | 60 | } else { |
| r5931 | r5932 | |
| 65 | 65 | } |
| 66 | 66 | return FLOPPY_ERROR_SUCCESS; |
| 67 | 67 | } |
| 68 | static int oric_get_track_offset(floppy_image *floppy,int track, int head) | |
| 68 | static int oric_get_track_offset(floppy_image *floppy,int track, int head) | |
| 69 | 69 | { |
| 70 | if (get_tag(floppy)->geometry==1) { | |
| 70 | if (get_tag(floppy)->geometry==1) { | |
| 71 | 71 | return mfm_disk_header_size + (get_tag(floppy)->tracksize * track) + (head * get_tag(floppy)->tracksize * get_tag(floppy)->tracks); |
| 72 | 72 | } else { |
| 73 | 73 | return mfm_disk_header_size + (get_tag(floppy)->tracksize*((track * get_tag(floppy)->heads)+head)); |
| r5931 | r5932 | |
| 87 | 87 | static void mfm_info_cache_sector_info(floppy_image *floppy,int track,int head) |
| 88 | 88 | { |
| 89 | 89 | UINT8 track_data[TRACK_SIZE_MFM]; |
| 90 | ||
| 90 | ||
| 91 | 91 | /* initialise these with single density values if single density */ |
| 92 | 92 | UINT8 IdMark = 0x0fe; |
| 93 | 93 | UINT8 DataMark = 0x0fb; |
| r5931 | r5932 | |
| 100 | 100 | int track_offset = oric_get_track_offset(floppy,track,head); |
| 101 | 101 | floppy_image_read(floppy, track_data, track_offset, TRACK_SIZE_MFM); |
| 102 | 102 | SectorCount = 0; |
| 103 | ||
| 103 | ||
| 104 | 104 | do |
| 105 | 105 | { |
| 106 | 106 | switch (SearchCode) |
| r5931 | r5932 | |
| 160 | 160 | break; |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | while (ptr < TRACK_SIZE_MFM); | |
| 163 | while (ptr < TRACK_SIZE_MFM); | |
| 164 | 164 | get_tag(floppy)->num_sectors = SectorCount; |
| 165 | 165 | |
| 166 | 166 | } |
| r5931 | r5932 | |
| 168 | 168 | static floperr_t get_offset(floppy_image *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset) |
| 169 | 169 | { |
| 170 | 170 | UINT64 offs; |
| 171 | ||
| 171 | ||
| 172 | 172 | /* translate the sector to a raw sector */ |
| 173 | 173 | if (!sector_is_index) |
| 174 | 174 | { |
| 175 | 175 | sector -= 1; |
| 176 | 176 | } |
| 177 | 177 | mfm_info_cache_sector_info(floppy,track,head); |
| 178 | ||
| 178 | ||
| 179 | 179 | /* check to see if we are out of range */ |
| 180 | 180 | if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks) |
| 181 | 181 | || (sector < 0) || (sector >=get_tag(floppy)->num_sectors)) |
| 182 | 182 | return FLOPPY_ERROR_SEEKERROR; |
| 183 | ||
| 183 | ||
| 184 | 184 | offs = get_tag(floppy)->sector_data[sector].data_ptr; |
| 185 | 185 | if (offset) |
| 186 | 186 | *offset = offs; |
| r5931 | r5932 | |
| 192 | 192 | static floperr_t internal_oric_read_sector(floppy_image *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen) |
| 193 | 193 | { |
| 194 | 194 | UINT64 offset; |
| 195 | floperr_t err; | |
| 195 | floperr_t err; | |
| 196 | 196 | err = get_offset(floppy, head, track, sector, sector_is_index, &offset); |
| 197 | 197 | if (err) |
| 198 | 198 | return err; |
| r5931 | r5932 | |
| 239 | 239 | |
| 240 | 240 | static floperr_t oric_get_sector_length(floppy_image *floppy, int head, int track, int sector, UINT32 *sector_length) |
| 241 | 241 | { |
| 242 | floperr_t err; | |
| 242 | floperr_t err; | |
| 243 | 243 | err = get_offset(floppy, head, track, sector, FALSE, NULL); |
| 244 | 244 | if (err) |
| 245 | 245 | return err; |
| r5931 | r5932 | |
| 255 | 255 | static floperr_t oric_get_indexed_sector_info(floppy_image *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags) |
| 256 | 256 | { |
| 257 | 257 | floperr_t retVal; |
| 258 | ||
| 258 | ||
| 259 | 259 | sector_index += 1; |
| 260 | ||
| 260 | ||
| 261 | 261 | retVal = oric_get_sector_length(floppy, head, track, sector_index, sector_length); |
| 262 | if (sector_length!=NULL) { | |
| 262 | if (sector_length!=NULL) { | |
| 263 | 263 | *sector_length = get_tag(floppy)->sector_data[sector_index-1].sector_size; |
| 264 | 264 | } |
| 265 | 265 | if (cylinder) |
| r5931 | r5932 | |
| 267 | 267 | if (side) |
| 268 | 268 | *side = head; |
| 269 | 269 | if (sector) |
| 270 | *sector = sector_index; | |
| 270 | *sector = sector_index; | |
| 271 | 271 | if (flags) |
| 272 | 272 | *flags = get_tag(floppy)->sector_data[sector_index].ddam; |
| 273 | 273 | return retVal; |
| r5931 | r5932 | |
| 279 | 279 | struct FloppyCallbacks *callbacks; |
| 280 | 280 | struct oricdsk_tag *tag; |
| 281 | 281 | UINT8 header[mfm_disk_header_size]; |
| 282 | ||
| 282 | ||
| 283 | 283 | floppy_image_read(floppy, header, 0, mfm_disk_header_size); |
| 284 | ||
| 284 | ||
| 285 | 285 | tag = (struct oricdsk_tag *) floppy_create_tag(floppy, ORICDSK_TAG, sizeof(struct oricdsk_tag)); |
| 286 | 286 | if (!tag) |
| 287 | 287 | return FLOPPY_ERROR_OUTOFMEMORY; |
| 288 | ||
| 288 | ||
| 289 | 289 | tag->heads = pick_integer_le(header, 8, 4); |
| 290 | 290 | tag->tracks = pick_integer_le(header, 12, 4); |
| 291 | 291 | tag->geometry = pick_integer_le(header, 16, 4); |
| 292 | 292 | tag->tracksize = TRACK_SIZE_MFM; |
| 293 | 293 | memset(tag->sector_data,0,sizeof(tag->sector_data)); |
| 294 | ||
| 294 | ||
| 295 | 295 | callbacks = floppy_callbacks(floppy); |
| 296 | 296 | callbacks->read_sector = oric_read_sector; |
| 297 | 297 | callbacks->write_sector = oric_write_sector; |
| r5931 | r5932 | |
| 300 | 300 | callbacks->get_sector_length = oric_get_sector_length; |
| 301 | 301 | callbacks->get_heads_per_disk = oric_get_heads_per_disk; |
| 302 | 302 | callbacks->get_tracks_per_disk = oric_get_tracks_per_disk; |
| 303 | callbacks->get_indexed_sector_info = oric_get_indexed_sector_info; | |
| 304 | return FLOPPY_ERROR_SUCCESS; | |
| 303 | callbacks->get_indexed_sector_info = oric_get_indexed_sector_info; | |
| 304 | return FLOPPY_ERROR_SUCCESS; | |
| 305 | 305 | } |
| 306 | 306 | /* ----------------------------------------------------------------------- */ |
| 307 | 307 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | zx81_p.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for ZX-81 casette files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/cpis_dsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Telenova Compis disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/vt_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Tandy Color Computer / Dragon disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | /* | |
| 91 | /* each byte on cassette is stored as: | |
| 92 | 92 | |
| 93 | start bit 0 * 1 | |
| 94 | data bits 8 * x (x is 0 or 1, and depends on data-bit value) | |
| 95 | parity bit 1 * x (x is 0 or 1, and depends on the parity of the data bits) | |
| 96 | stop bits 1 * 3 | |
| 93 | start bit 0 * 1 | |
| 94 | data bits 8 * x (x is 0 or 1, and depends on data-bit value) | |
| 95 | parity bit 1 * x (x is 0 or 1, and depends on the parity of the data bits) | |
| 96 | stop bits 1 * 3 | |
| 97 | 97 | |
| 98 | if data has even parity, parity bit will be 1. | |
| 99 | if data has odd parity, parity bit will be 0. | |
| 98 | if data has even parity, parity bit will be 1. | |
| 99 | if data has odd parity, parity bit will be 0. | |
| 100 | 100 | */ |
| 101 | 101 | |
| 102 | 102 | /* |
| 103 | 512 * data byte 0x016 -> leader | |
| 104 | 1 * data byte 0x024 -> sync byte | |
| 105 | 9 * data byte -> header | |
| 106 | delay (of last pulse written) | |
| 107 | x * data byte -> length | |
| 103 | 512 * data byte 0x016 -> leader | |
| 104 | 1 * data byte 0x024 -> sync byte | |
| 105 | 9 * data byte -> header | |
| 106 | delay (of last pulse written) | |
| 107 | x * data byte -> length | |
| 108 | 108 | |
| 109 | 109 | |
| 110 | header structure: | |
| 111 | 3 * ? -> ??? | |
| 112 | 1 * ? -> ??? | |
| 113 | 1 * x -> end address high byte | |
| 114 | 1 * x -> end address low byte | |
| 115 | 1 * x -> start address high byte | |
| 116 | 1 * x -> start address low byte | |
| 117 | 1 * ? -> ??? | |
| 110 | header structure: | |
| 111 | 3 * ? -> ??? | |
| 112 | 1 * ? -> ??? | |
| 113 | 1 * x -> end address high byte | |
| 114 | 1 * x -> end address low byte | |
| 115 | 1 * x -> start address high byte | |
| 116 | 1 * x -> start address low byte | |
| 117 | 1 * ? -> ??? | |
| 118 | 118 | */ |
| 119 | 119 | |
| 120 | 120 | static int oric_calculate_byte_size_in_samples(UINT8 byte) |
| r5931 | r5932 | |
| 361 | 361 | |
| 362 | 362 | /* header and trailer act as pauses */ |
| 363 | 363 | /* the trailer is required so that the via sees the last bit of the last |
| 364 | ||
| 364 | byte */ | |
| 365 | 365 | if (bytes == CODE_HEADER) { |
| 366 | 366 | for (i = 0; i < ORIC_WAVESAMPLES_HEADER; i++) |
| 367 | 367 | *(p++) = WAVEENTRY_NULL; |
| r5931 | r5932 | |
| 449 | 449 | logerror("got end of filename\n"); |
| 450 | 450 | |
| 451 | 451 | /* oric includes a small delay, but I don't see |
| 452 | ||
| 452 | it being 1 bits */ | |
| 453 | 453 | for (i=0; i<100; i++) |
| 454 | 454 | { |
| 455 | 455 | p = oric_output_bit(p,1); |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/oric_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Oric disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/cpis_dsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Telenova Compis disk images | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 3 | Tape support for C16 / C64 / VIC20 TAP format | |
| 4 | 2 | |
| 3 | Tape support for C16 / C64 / VIC20 TAP format | |
| 5 | 4 | |
| 6 | Credits to: | |
| 7 | ||
| 8 | - Peter Schepers for the informations on C64 formats | |
| 9 | - Vice Team for the source of their very complete emulator | |
| 10 | - Attila G. for tap2wav (both the source and the actual tool) | |
| 11 | 5 | |
| 12 | ||
| 13 | TODO: | |
| 14 | * to verify and fix (if needed) support for .TAP v2 | |
| 15 | * to implement reading (and logging) the remaining part of the header | |
| 16 | * to verify if it is more accurate to use a different HIGH_WAVE value | |
| 17 | when the pulse corresponds to a 0x00 in the .TAP file | |
| 18 | (...) | |
| 19 | * (far away in the future) can this code be merged with TZX code? | |
| 6 | Credits to: | |
| 20 | 7 | |
| 8 | - Peter Schepers for the informations on C64 formats | |
| 9 | - Vice Team for the source of their very complete emulator | |
| 10 | - Attila G. for tap2wav (both the source and the actual tool) | |
| 11 | ||
| 12 | ||
| 13 | TODO: | |
| 14 | * to verify and fix (if needed) support for .TAP v2 | |
| 15 | * to implement reading (and logging) the remaining part of the header | |
| 16 | * to verify if it is more accurate to use a different HIGH_WAVE value | |
| 17 | when the pulse corresponds to a 0x00 in the .TAP file | |
| 18 | (...) | |
| 19 | * (far away in the future) can this code be merged with TZX code? | |
| 20 | ||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | /* Info based on http://ist.uwaterloo.ca/~schepers/formats/TAP.TXT */ | |
| 24 | /* Please refer to the webpage for the latest version and for a very | |
| 25 | complete listing of various cart types and their bankswitch tricks */ | |
| 23 | /* Info based on http://ist.uwaterloo.ca/~schepers/formats/TAP.TXT */ | |
| 24 | /* Please refer to the webpage for the latest version and for a very | |
| 25 | complete listing of various cart types and their bankswitch tricks */ | |
| 26 | 26 | /* |
| 27 | 27 | |
| 28 | 28 | Designed by Per Hakan Sundell (author of the CCS64 C64 emulator) in 1997, |
| r5931 | r5932 | |
| 86 | 86 | [ Additional notes on v.2: |
| 87 | 87 | |
| 88 | 88 | I found no documents about this around, but it seems an expansion of the |
| 89 | format specifically thought for C16 tapes. In a .TAP version 2, each byte | |
| 89 | format specifically thought for C16 tapes. In a .TAP version 2, each byte | |
| 90 | 90 | only stores informations on half of the wave... |
| 91 | 91 | Unfortunately, I have no such a .tap file to test, so my implementation |
| 92 | 92 | below could be not working. FP ] |
| r5931 | r5932 | |
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | /* This in fact gives the number of samples for half of the pulse */ |
| 135 | INLINE int tap_data_to_samplecount(int data, int frequency) | |
| 135 | INLINE int tap_data_to_samplecount(int data, int frequency) | |
| 136 | 136 | { |
| 137 | // | |
| 137 | // return (int) (0.5 * (0.5 + (((double)CBM_WAV_FREQUENCY / frequency) * (double)data))); // MESS TZX formula | |
| 138 | 138 | return (int) (0.5 * (((double)CBM_WAV_FREQUENCY / frequency) * (double)((data) + 0.5))); // tap2wav formula |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /* The version with parameters could be handy if we decide to implement a |
| 142 | 142 | different values for byte == 0x00 below (the WAVE_PAUSE) as tap2wav does. */ |
| 143 | 143 | #if 0 |
| 144 | static void toggle_wave_data(int low, int high) | |
| 144 | static void toggle_wave_data(int low, int high) | |
| 145 | 145 | { |
| 146 | 146 | wave_data = (wave_data == low) ? high : low; |
| 147 | 147 | } |
| 148 | 148 | #endif |
| 149 | 149 | |
| 150 | static void toggle_wave_data(void ) | |
| 150 | static void toggle_wave_data(void ) | |
| 151 | 151 | { |
| 152 | 152 | wave_data = (wave_data == WAVE_HIGH) ? WAVE_LOW : WAVE_HIGH; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | static void cbm_output_wave( INT16 **buffer, int length ) | |
| 155 | static void cbm_output_wave( INT16 **buffer, int length ) | |
| 156 | 156 | { |
| 157 | if (buffer == NULL) | |
| 157 | if (buffer == NULL) | |
| 158 | 158 | return; |
| 159 | ||
| 160 | for( ; length > 0; length-- ) | |
| 159 | ||
| 160 | for( ; length > 0; length-- ) | |
| 161 | 161 | { |
| 162 | 162 | **buffer = wave_data; |
| 163 | 163 | *buffer = *buffer + 1; |
| r5931 | r5932 | |
| 167 | 167 | |
| 168 | 168 | static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data ) |
| 169 | 169 | { |
| 170 | int i, j = 0; | |
| 170 | int i, j = 0; | |
| 171 | 171 | int size = 0; |
| 172 | 172 | |
| 173 | 173 | int version = data[0x0c]; |
| r5931 | r5932 | |
| 178 | 178 | int byte_samples = 0; |
| 179 | 179 | UINT8 over_pulse_bytes[3] = {0 , 0, 0 }; |
| 180 | 180 | int over_pulse_length = 0; |
| 181 | /* These waveamp_* values are currently stored but not used. | |
| 182 | Further investigations are needed to find real pulse amplitude | |
| 183 | in Commodore tapes. Implementation here would follow */ | |
| 181 | /* These waveamp_* values are currently stored but not used. | |
| 182 | Further investigations are needed to find real pulse amplitude | |
| 183 | in Commodore tapes. Implementation here would follow */ | |
| 184 | 184 | /* int waveamp_high, waveamp_low; */ |
| 185 | 185 | |
| 186 | 186 | /* Log .TAP info but only once */ |
| r5931 | r5932 | |
| 188 | 188 | { |
| 189 | 189 | logerror("TAP version : %d\n", version); |
| 190 | 190 | logerror("Machine type : %d\n", system); |
| 191 | logerror("Video standard : %d\n", video_standard); | |
| 191 | logerror("Video standard : %d\n", video_standard); | |
| 192 | 192 | logerror("Tape frequency : %d\n", (tap_frequency) << 3); |
| 193 | 193 | } |
| 194 | 194 | |
| r5931 | r5932 | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
| 226 | for (i = CBM_HEADER_SIZE; i < length; i++) | |
| 226 | for (i = CBM_HEADER_SIZE; i < length; i++) | |
| 227 | 227 | { |
| 228 | 228 | UINT8 byte = data[i]; |
| 229 | 229 | |
| 230 | 230 | /* .TAP v0 */ |
| 231 | /* Here is simple: | |
| 232 | if byte is != 0 -> length = byte | |
| 233 | otherwise -> length = 0x100 (i.e. 0xff + 1) */ | |
| 231 | /* Here is simple: | |
| 232 | if byte is != 0 -> length = byte | |
| 233 | otherwise -> length = 0x100 (i.e. 0xff + 1) */ | |
| 234 | 234 | if (!version) |
| 235 | 235 | { |
| 236 | if (byte != 0x00) | |
| 236 | if (byte != 0x00) | |
| 237 | 237 | { |
| 238 | 238 | byte_samples = tap_data_to_samplecount(byte, tap_frequency); |
| 239 | 239 | /* waveamp_high = WAVE_HIGH; */ |
| 240 | } | |
| 241 | else | |
| 240 | } | |
| 241 | else | |
| 242 | 242 | { |
| 243 | 243 | byte_samples = tap_data_to_samplecount(PAUSE, tap_frequency); // tap2wav value |
| 244 | // | |
| 244 | // byte_samples = tap_data_to_samplecount(0x100, tap_frequency); // vice value | |
| 245 | 245 | /* waveamp_high = WAVE_PAUSE; */ |
| 246 | 246 | } |
| 247 | 247 | /* waveamp_low = WAVE_LOW; */ |
| r5931 | r5932 | |
| 249 | 249 | |
| 250 | 250 | /* .TAP v1 & v2 */ |
| 251 | 251 | /* Here is a bit more complicate: |
| 252 | if byte is != 0 -> length = byte | |
| 253 | otherwise -> the length of the pulse is stored as a 24bit value in the 3 bytes after the 0. | |
| 254 | See below for comments on the implementation of this mechanism */ | |
| 252 | if byte is != 0 -> length = byte | |
| 253 | otherwise -> the length of the pulse is stored as a 24bit value in the 3 bytes after the 0. | |
| 254 | See below for comments on the implementation of this mechanism */ | |
| 255 | 255 | if (version) |
| 256 | 256 | { |
| 257 | 257 | if ((byte != 0x00) && !j) |
| 258 | 258 | { |
| 259 | 259 | byte_samples = tap_data_to_samplecount(byte, tap_frequency); |
| 260 | 260 | /* waveamp_high = WAVE_HIGH; */ |
| 261 | } | |
| 262 | else | |
| 261 | } | |
| 262 | else | |
| 263 | 263 | { |
| 264 | /* If we have a long pulse close to the end of the .TAP, check that bytes still | |
| 265 | to be read are enough to complete it. */ | |
| 264 | /* If we have a long pulse close to the end of the .TAP, check that bytes still | |
| 265 | to be read are enough to complete it. */ | |
| 266 | 266 | if (length - i + j >= 4) |
| 267 | { | |
| 267 | { | |
| 268 | 268 | /* Here we read the 3 following bytes, using an index j |
| 269 | j = 0 -> The 0x00 byte: we simply skip everything and go on | |
| 270 | j = 1,2 -> The 1st and 2nd bytes after 0x00: we store them and go on | |
| 271 | j = 3 -> The final byte of the pulse length: we store it, | |
| 272 | and then we pass to finally output the wave */ | |
| 269 | j = 0 -> The 0x00 byte: we simply skip everything and go on | |
| 270 | j = 1,2 -> The 1st and 2nd bytes after 0x00: we store them and go on | |
| 271 | j = 3 -> The final byte of the pulse length: we store it, | |
| 272 | and then we pass to finally output the wave */ | |
| 273 | 273 | if (j > 0) |
| 274 | 274 | { |
| 275 | 275 | over_pulse_bytes[j-1] = byte; |
| r5931 | r5932 | |
| 286 | 286 | else |
| 287 | 287 | { |
| 288 | 288 | j += 1; |
| 289 | logerror("Found a 00 byte close to the end of the .tap file.\n"); | |
| 289 | logerror("Found a 00 byte close to the end of the .tap file.\n"); | |
| 290 | 290 | logerror("This is not allowed by the format specs. \n"); |
| 291 | 291 | logerror("Check if your .tap file got corrupted when you created it!\n"); |
| 292 | 292 | } |
| r5931 | r5932 | |
| 300 | 300 | { |
| 301 | 301 | cbm_output_wave( buffer, byte_samples ); |
| 302 | 302 | size += byte_samples; |
| 303 | // | |
| 303 | // toggle_wave_data(waveamp_low, waveamp_high); | |
| 304 | 304 | toggle_wave_data(); |
| 305 | 305 | if (version < 2) |
| 306 | 306 | { |
| 307 | 307 | cbm_output_wave( buffer, byte_samples ); |
| 308 | 308 | size += byte_samples; |
| 309 | // | |
| 309 | // toggle_wave_data(waveamp_low, waveamp_high); | |
| 310 | 310 | toggle_wave_data(); |
| 311 | 311 | } |
| 312 | 312 | } |
| r5931 | r5932 | |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
| 319 | static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen ) | |
| 319 | static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen ) | |
| 320 | 320 | { |
| 321 | 321 | int size = cbm_tap_do_work(NULL, taplen, tapdata); |
| 322 | 322 | len = taplen; |
| 323 | ||
| 323 | ||
| 324 | 324 | return size; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | static int cbm_tap_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 328 | { | |
| 327 | static int cbm_tap_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) | |
| 328 | { | |
| 329 | 329 | INT16 *p = buffer; |
| 330 | 330 | |
| 331 | 331 | return cbm_tap_do_work(&p, len, (const UINT8 *)bytes); |
| r5931 | r5932 | |
| 345 | 345 | }; |
| 346 | 346 | |
| 347 | 347 | |
| 348 | static casserr_t cbm_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 348 | static casserr_t cbm_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) | |
| 349 | 349 | { |
| 350 | 350 | return cassette_legacy_identify( cassette, opts, &cbm_legacy_fill_wave ); |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
| 354 | static casserr_t cbm_cassette_load( cassette_image *cassette ) | |
| 354 | static casserr_t cbm_cassette_load( cassette_image *cassette ) | |
| 355 | 355 | { |
| 356 | 356 | return cassette_legacy_construct( cassette, &cbm_legacy_fill_wave ); |
| 357 | 357 | } |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | oric_tap.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for Oric TAP (*.tap) files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | cbm_tap.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Format code for CBM .tap files | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 98 | 98 | /* Handle a block of tape data */ |
| 99 | 99 | block_size = casdata[data_pos] + ( casdata[data_pos + 1] << 8 ); |
| 100 | 100 | data_pos += 2; |
| 101 | ||
| 101 | ||
| 102 | 102 | /* Make sure there are enough bytes left */ |
| 103 | 103 | if ( data_pos > cas_size ) |
| 104 | 104 | return -1; |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/basicdsk.c | |
| 4 | 4 | |
| 5 | ||
| 5 | Floppy format code for basic disks | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 | |
| r5931 | r5932 | |
| 248 | 248 | { |
| 249 | 249 | const struct basicdsk_geometry *geom; |
| 250 | 250 | geom = get_geometry(floppy); |
| 251 | ||
| 251 | ||
| 252 | 252 | sector_index += get_geometry(floppy)->first_sector_id; |
| 253 | 253 | if (cylinder) |
| 254 | 254 | *cylinder = track; |
| r5931 | r5932 | |
| 260 | 260 | /* TODO: read DAM or DDAM and determine flags */ |
| 261 | 261 | *flags = 0; |
| 262 | 262 | if (geom->get_ddam) |
| 263 | *flags = geom->get_ddam(floppy, geom, track, head, sector_index); | |
| 263 | *flags = geom->get_ddam(floppy, geom, track, head, sector_index); | |
| 264 | 264 | } |
| 265 | 265 | return basicdsk_get_sector_length(floppy, head, track, sector_index, sector_length); |
| 266 | 266 | } |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /* |
| 2 | ||
| 2 | a26_cas.h | |
| 3 | 3 | |
| 4 | ||
| 4 | Format code for a2600 SuperCharger cassette files | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #ifndef A26_CAS_H |
| r5931 | r5932 | |
|---|---|---|
| 1 | 1 | /********************************************************************* |
| 2 | 2 | |
| 3 | ||
| 3 | formats/basicdsk.h | |
| 4 | 4 | |
| 5 | ||
| 5 | Floppy format code for basic disks | |
| 6 | 6 | |
| 7 | 7 | *********************************************************************/ |
| 8 | 8 |
| r5931 | r5932 | |
|---|---|---|
| 243 | 243 | { |
| 244 | 244 | cassette_image_read( cass, &in, pos, 1 ); |
| 245 | 245 | /* actually, we are bit laxist and treat as 0xff bytes with at least |
| 246 | 5 bits out of 8 set to 1 | |
| 247 | */ | |
| 246 | 5 bits out of 8 set to 1 | |
| 247 | */ | |
| 248 | 248 | for ( i = 0; in; in >>= 1 ) |
| 249 | 249 | i += (in & 1); |
| 250 | 250 | if ( i < 5 ) |
| r5931 | r5932 | |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /* trailing data with invalid block structure |
| 316 | => dump it in a raw form, but stay alert for hidden block starts | |
| 317 | */ | |
| 316 | => dump it in a raw form, but stay alert for hidden block starts | |
| 317 | */ | |
| 318 | 318 | if ( pos < size ) |
| 319 | 319 | { |
| 320 | 320 | invalid++; |
| r5931 | r5932 | |
|---|---|---|
| 25 | 25 | - some bits I/O RAM not implemented |
| 26 | 26 | - printer |
| 27 | 27 | - more accurate timing (accurate SATURN cycles, speedup when screen is off) |
| 28 | - save-state: figure what RAM to store & where (currently, when exiting, | |
| 29 | base RAM is saved as nvram, RAM in expansion ports is saved as image, | |
| 30 | IO RAM is & CPU state are discarded; save-state saves base & IO RAM, | |
| 28 | - save-state: figure what RAM to store & where (currently, when exiting, | |
| 29 | base RAM is saved as nvram, RAM in expansion ports is saved as image, | |
| 30 | IO RAM is & CPU state are discarded; save-state saves base & IO RAM, | |
| 31 | 31 | CPU state, but not expansion port RAM) |
| 32 | 32 | - more accurate IRQ, NMI, sleep and wake-up handling |
| 33 | 33 | */ |
| r5931 | r5932 | |
| 69 | 69 | - clock speed: 2 MHz |
| 70 | 70 | - 256 KB ROM (various revisions, identical in S and SX) |
| 71 | 71 | |
| 72 | - S model specific: | |
| 72 | - S model specific: | |
| 73 | 73 | + Codename: Shorty |
| 74 | 74 | + 32 KB RAM base, not expandable (in theory) |
| 75 | 75 | + no expansion port |
| r5931 | r5932 | |
| 92 | 92 | |
| 93 | 93 | - GX model specific: |
| 94 | 94 | + Codename: Hammer |
| 95 | + 128 KB base RAM, expandable up to 4 MB (banked) | |
| 95 | + 128 KB base RAM, expandable up to 4 MB (banked) | |
| 96 | 96 | + 2 expansion ports |
| 97 | 97 | . port 1: up to 128 KB RAM, can be merged with base RAM |
| 98 | 98 | . port 2: up to 4 MB RAM, in 32 banks of 128 KB, cannot be merged |
| r5931 | r5932 | |
| 105 | 105 | */ |
| 106 | 106 | |
| 107 | 107 | |
| 108 | /* | |
| 108 | /* | |
| 109 | 109 | More about memory. |
| 110 | 110 | |
| 111 | The base RAM is treated as NVRAM: stored in a .nv file in your nvram | |
| 111 | The base RAM is treated as NVRAM: stored in a .nv file in your nvram | |
| 112 | 112 | directory. |
| 113 | 113 | When first starting the emulator, or after nvram file has been deleted, |
| 114 | 114 | you'll get a "Try to recover memory?". This is expected. |
| r5931 | r5932 | |
| 116 | 116 | system-reserved RAM part correctly. |
| 117 | 117 | If the emulator is shut down properly (i.e., when the calculator is |
| 118 | 118 | not busy), the message should not appear next time it is run. |
| 119 | All the variables and port 0 should be conserved (in the .nv file), | |
| 119 | All the variables and port 0 should be conserved (in the .nv file), | |
| 120 | 120 | but not the stack. |
| 121 | Stopping and restarting the emulator loosely corresponds to hitting the | |
| 121 | Stopping and restarting the emulator loosely corresponds to hitting the | |
| 122 | 122 | reset button. |
| 123 | 123 | |
| 124 | 124 | Expansion RAMs are treated as images, not NVRAM. |
| r5931 | r5932 | |
| 136 | 136 | kermit communication program (xmodem is also allowed for the G/GX). |
| 137 | 137 | We emulate both the serial link and the communication program. |
| 138 | 138 | Thus, the emulated HP48 can directly upload/download image files. |
| 139 | The -k image option corresponds to the kermit protocol (SEND and RECV | |
| 139 | The -k image option corresponds to the kermit protocol (SEND and RECV | |
| 140 | 140 | commands on the HP48). |
| 141 | The -x image option corresponds to the xmodem protocol (XSEND and XRECV | |
| 141 | The -x image option corresponds to the xmodem protocol (XSEND and XRECV | |
| 142 | 142 | commands on the HP48). |
| 143 | 143 | */ |
| 144 | 144 | |
| r5931 | r5932 | |
| 148 | 148 | |
| 149 | 149 | References: |
| 150 | 150 | |
| 151 | - Voyage au centre de la HP48 S/SX, by Paul Courbis & Sébastien Lalande | |
| 152 | (English version: HP48 machine language - a journey to the center | |
| 151 | - Voyage au centre de la HP48 S/SX, by Paul Courbis & S?bastien Lalande | |
| 152 | (English version: HP48 machine language - a journey to the center | |
| 153 | 153 | of the HP48 s/sx) |
| 154 | 154 | available at http://www.courbis.com |
| 155 | 155 | |
| r5931 | r5932 | |
| 177 | 177 | keyboard layout (all models) |
| 178 | 178 | |
| 179 | 179 | ------------------------------------------------- |
| 180 | | A | B | C | D | E | F | | |
| 180 | | A | B | C | D | E | F | | |
| 181 | 181 | |-------+-------+-------+-------+-------+-------| |
| 182 | | MTH | PRG | CST | VAR | up | NXT | | |
| 182 | | MTH | PRG | CST | VAR | up | NXT | | |
| 183 | 183 | |-------+-------+-------+-------+-------+-------| |
| 184 | | ' | STO | EVAL | left | down | right | | |
| 184 | | ' | STO | EVAL | left | down | right | | |
| 185 | 185 | |-------+-------+-------+-------+-------+-------| |
| 186 | | SIN | COS | TAN | sqrt | y^x | 1/x | | |
| 186 | | SIN | COS | TAN | sqrt | y^x | 1/x | | |
| 187 | 187 | |---------------+-------+-------+-------+-------| |
| 188 | | ENTER | +/- | EEX | DEL | <= | | |
| 188 | | ENTER | +/- | EEX | DEL | <= | | |
| 189 | 189 | |-----------------------------------------------| |
| 190 | | alpha | 7 | 8 | 9 | / | | |
| 190 | | alpha | 7 | 8 | 9 | / | | |
| 191 | 191 | |---------+--------+--------+---------+---------| |
| 192 | | red | 4 | 5 | 6 | * | | |
| 192 | | red | 4 | 5 | 6 | * | | |
| 193 | 193 | |---------+--------+--------+---------+---------| |
| 194 | | green | 1 | 2 | 3 | - | | |
| 194 | | green | 1 | 2 | 3 | - | | |
| 195 | 195 | |---------+--------+--------+---------+---------| |
| 196 | | ON | 0 | . | SPC | + | | |
| 196 | | ON | 0 | . | SPC | + | | |
| 197 | 197 | ------------------------------------------------- |
| 198 | 198 | |
| 199 | 199 | * 49 keys |
| r5931 | r5932 | |
| 203 | 203 | - a white alpha key (lower right) |
| 204 | 204 | |
| 205 | 205 | Difference between G and S series: a few red and blue shifted keys. |
| 206 | ||
| 206 | ||
| 207 | 207 | */ |
| 208 | 208 | |
| 209 | 209 | /* S/SX */ |
| r5931 | r5932 | |
| 903 | 903 | |
| 904 | 904 | /* In memory, nibbles are unpacked: one nibble at each address. |
| 905 | 905 | This is due to the way the SATURN emulation is done. |
| 906 | As a consequence only the 4 lower bits of each byte is used, the 4 higher | |
| 906 | As a consequence only the 4 lower bits of each byte is used, the 4 higher | |
| 907 | 907 | bits being zeros. |
| 908 | 908 | Another consequence is that ROMs must be unpacked before use. |
| 909 | 909 | |
| 910 | Because of the complex memory manager, actual address mapping is done at | |
| 910 | Because of the complex memory manager, actual address mapping is done at | |
| 911 | 911 | run-time. |
| 912 | 912 | */ |
| 913 | 913 | |
| 914 | 914 | static ADDRESS_MAP_START ( hp48, ADDRESS_SPACE_PROGRAM, 8 ) |
| 915 | ||
| 915 | ||
| 916 | 916 | AM_RANGE( 0x00000, 0xfffff ) AM_NOP /* configured at run-time */ |
| 917 | 917 | |
| 918 | 918 | ADDRESS_MAP_END |
| r5931 | r5932 | |
| 925 | 925 | { |
| 926 | 926 | hp48_reg_out, hp48_reg_in, |
| 927 | 927 | hp48_mem_reset, hp48_mem_config, hp48_mem_unconfig, hp48_mem_id, |
| 928 | hp48_mem_crc, | |
| 928 | hp48_mem_crc, | |
| 929 | 929 | hp48_rsi |
| 930 | 930 | }; |
| 931 | 931 | |
| r5931 | r5932 | |
| 949 | 949 | MDRV_CPU_ADD ( "maincpu", SATURN, 3937007 ) /* almost 4 MHz */ |
| 950 | 950 | MDRV_CPU_PROGRAM_MAP ( hp48) |
| 951 | 951 | MDRV_CPU_CONFIG( hp48_config ) |
| 952 | ||
| 952 | ||
| 953 | 953 | /* memory */ |
| 954 | 954 | MDRV_NVRAM_HANDLER( generic_0fill ) |
| 955 | 955 | |
| r5931 | r5932 | |
| 978 | 978 | /* expansion ports */ |
| 979 | 979 | MDRV_HP48_PORT_ADD ( "port1", hp48gx_port1_config ) |
| 980 | 980 | MDRV_HP48_PORT_ADD ( "port2", hp48gx_port2_config ) |
| 981 | ||
| 981 | ||
| 982 | 982 | /* serial I/O */ |
| 983 | 983 | MDRV_XMODEM_ADD( "rs232_x", hp48_xmodem_rs232_conf ) |
| 984 | 984 | MDRV_KERMIT_ADD( "rs232_k", hp48_kermit_rs232_conf ) |
| r5931 | r5932 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |
| 13 | 2008 - Driver Updates | |
| 13 | 2008 - Driver Updates | |
| 14 | 14 | --------------------- |
| 15 | 15 | |
| 16 | 16 | (most of the informations are taken from http://www.zimmers.net/cbmpics/ ) |
| r5931 | r5932 | |
| 20 | 20 | |
| 21 | 21 | * Commodore 65 (1989) |
| 22 | 22 | |
| 23 | Also known as C64 DX at early stages of the project. It was cancelled | |
| 24 | around 1990-1991. Only few units survive (they were sold after Commodore | |
| 23 | Also known as C64 DX at early stages of the project. It was cancelled | |
| 24 | around 1990-1991. Only few units survive (they were sold after Commodore | |
| 25 | 25 | liquidation in 1994). |
| 26 | 26 | |
| 27 | 27 | CPU: CSG 4510 (3.54 MHz) |
| 28 | 28 | RAM: 128 kilobytes, expandable to 8 megabytes |
| 29 | 29 | ROM: 128 kilobytes |
| 30 | Video: CSG 4569 "VIC-III" (6 Video modes; Resolutions from 320x200 to | |
| 31 | 1280x400; 80 columns text; Palette of 4096 colors) | |
| 32 | Sound: CSG 8580 "SID" x2 (6 voice stereo synthesizer/digital sound | |
| 33 | capabilities) | |
| 34 | Ports: CSG 4510 (2 Joystick/Mouse ports; CBM Serial port; CBM 'USER' | |
| 35 | port; CBM Monitor port; Power and reset switches; C65 bus drive | |
| 36 | port; RGBI video port; 2 RCA audio ports; RAM expansion port; C65 | |
| 37 | expansion port) | |
| 30 | Video: CSG 4569 "VIC-III" (6 Video modes; Resolutions from 320x200 to | |
| 31 | 1280x400; 80 columns text; Palette of 4096 colors) | |
| 32 | Sound: CSG 8580 "SID" x2 (6 voice stereo synthesizer/digital sound | |
| 33 | capabilities) | |
| 34 | Ports: CSG 4510 (2 Joystick/Mouse ports; CBM Serial port; CBM 'USER' | |
| 35 | port; CBM Monitor port; Power and reset switches; C65 bus drive | |
| 36 | port; RGBI video port; 2 RCA audio ports; RAM expansion port; C65 | |
| 37 | expansion port) | |
| 38 | 38 | Keyboard: Full-sized 77 key QWERTY (12 programmable function keys; |
| 39 | ||
| 39 | 4 direction cursor-pad) | |
| 40 | 40 | Additional Hardware: Built in 3.5" DD disk drive (1581 compatible) |
| 41 | 41 | Miscellaneous: Partially implemented Commodore 64 emulation |
| 42 | 42 | |
| 43 | 43 | [Notes] |
| 44 | 44 | |
| 45 | The datasette port was removed here. C65 supports an additional "dumb" | |
| 46 | drive externally. It also features, in addition to the standard CBM | |
| 47 | bus serial (available in all modes), a Fast and a Burst serial bus | |
| 45 | The datasette port was removed here. C65 supports an additional "dumb" | |
| 46 | drive externally. It also features, in addition to the standard CBM | |
| 47 | bus serial (available in all modes), a Fast and a Burst serial bus | |
| 48 | 48 | (both available in C65 mode only) |
| 49 | 49 | |
| 50 | 50 | */ |
| r5931 | r5932 | |
| 115 | 115 | PORT_INCLUDE( common_cbm_keyboard ) /* ROW0 -> ROW7 */ |
| 116 | 116 | |
| 117 | 117 | PORT_START("FUNCT") |
| 118 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) | |
| 119 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13 F14") PORT_CODE(KEYCODE_F11) | |
| 120 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11 F12") PORT_CODE(KEYCODE_F10) | |
| 121 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9 F10") PORT_CODE(KEYCODE_F9) | |
| 122 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F12) | |
| 118 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_F1) | |
| 119 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F13 F14") PORT_CODE(KEYCODE_F11) | |
| 120 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F11 F12") PORT_CODE(KEYCODE_F10) | |
| 121 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F9 F10") PORT_CODE(KEYCODE_F9) | |
| 122 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_F12) | |
| 123 | 123 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ALT") PORT_CODE(KEYCODE_F2) /* non blocking */ |
| 124 | 124 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) |
| 125 | 125 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NO SCRL") PORT_CODE(KEYCODE_F4) |
| r5931 | r5932 | |
| 132 | 132 | |
| 133 | 133 | static INPUT_PORTS_START( c65ger ) |
| 134 | 134 | PORT_INCLUDE( c65 ) |
| 135 | ||
| 135 | ||
| 136 | 136 | PORT_MODIFY( "ROW1" ) |
| 137 | 137 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z { Y }") PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') |
| 138 | 138 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 # { 3 Paragraph }") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') |
| r5931 | r5932 | |
| 242 | 242 | /* cia */ |
| 243 | 243 | MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c65_ntsc_cia0) |
| 244 | 244 | MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c65_ntsc_cia1) |
| 245 | ||
| 245 | ||
| 246 | 246 | /* floppy from serial bus */ |
| 247 | 247 | MDRV_IMPORT_FROM(simulated_drive) |
| 248 | 248 |
| r5931 | r5932 | |
|---|---|---|
| 93 | 93 | { |
| 94 | 94 | UINT8 lcd_data = data >> 8; |
| 95 | 95 | |
| 96 | if (led7 == 0) | |
| 96 | if (led7 == 0) | |
| 97 | 97 | output_set_digit_value(lcd_shift_counter, lcd_data); |
| 98 | 98 | |
| 99 | 99 | lcd_shift_counter--; |
| 100 | 100 | lcd_shift_counter &= 3; |
| 101 | // | |
| 101 | // logerror("LCD Offset = %d Data low = %x \n", offset, lcd_data); | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | static WRITE16_HANDLER( write_beeper ) |
| r5931 | r5932 | |
| 107 | 107 | |
| 108 | 108 | lcd_invert = 1; |
| 109 | 109 | beep_flag = data >> 8; |
| 110 | // | |
| 110 | // if ((beep_flag & 02) == 0) key_selector = 0; else key_selector = 1; | |
| 111 | 111 | logerror("Write Beeper = %x \n", data); |
| 112 | 112 | beeper = data; |
| 113 | 113 | } |
| r5931 | r5932 | |
| 128 | 128 | lcd_invert = 0; |
| 129 | 129 | lcd_flag=data >> 8; |
| 130 | 130 | //beep_set_state(0, lcd_flag & 1 ? 1 : 0); |
| 131 | if (lcd_flag == 0) | |
| 131 | if (lcd_flag == 0) | |
| 132 | 132 | key_selector = 1; |
| 133 | 133 | |
| 134 | 134 | // The key function in the rom expects after writing to |
| 135 | 135 | // the a value from the second key row; |
| 136 | if (lcd_flag != 0) | |
| 136 | if (lcd_flag != 0) | |
| 137 | 137 | led7 = 255; |
| 138 | else | |
| 138 | else | |
| 139 | 139 | led7 = 0; |
| 140 | 140 | |
| 141 | 141 | logerror("LCD Flag 16 = %x \n", data); |
| r5931 | r5932 | |
| 148 | 148 | |
| 149 | 149 | beep_set_state(speaker, lcd_flag & 1 ? 1 : 0); |
| 150 | 150 | |
| 151 | if (lcd_flag == 0) | |
| 151 | if (lcd_flag == 0) | |
| 152 | 152 | key_selector = 1; |
| 153 | 153 | |
| 154 | if (lcd_flag != 0) | |
| 154 | if (lcd_flag != 0) | |
| 155 | 155 | led7 = 255; |
| 156 | else | |
| 156 | else | |
| 157 | 157 | led7 = 0; |
| 158 | 158 | |
| 159 | // | |
| 159 | // logerror("LCD Flag gg = %x \n", lcd_flag); | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | static WRITE16_HANDLER( write_keys ) |
| 163 | 163 | { |
| 164 | 164 | key_select = data >> 8; |
| 165 | // | |
| 165 | // logerror("Write Key = %x \n", data); | |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | static READ16_HANDLER( read_board ) |
| r5931 | r5932 | |
| 176 | 176 | |
| 177 | 177 | board_value = board; |
| 178 | 178 | |
| 179 | if (board == 0xff) | |
| 179 | if (board == 0xff) | |
| 180 | 180 | key_selector = 0; |
| 181 | // The key function in the rom expects after writing to | |
| 182 | // the chess board a value from the first key row; | |
| 181 | // The key function in the rom expects after writing to | |
| 182 | // the chess board a value from the first key row; | |
| 183 | 183 | logerror("Write Board = %x \n", data >> 8); |
| 184 | 184 | } |
| 185 | 185 | |
| r5931 | r5932 | |
| 241 | 241 | { |
| 242 | 242 | UINT16 data; |
| 243 | 243 | |
| 244 | if (key_selector == 0) | |
| 244 | if (key_selector == 0) | |
| 245 | 245 | data = input_port_read(space->machine, "LINE0"); |
| 246 | else | |
| 246 | else | |
| 247 | 247 | data = input_port_read(space->machine, "LINE1"); |
| 248 | 248 | |
| 249 | 249 | logerror("read Keyboard Offset = %x Data = %x Select = %x \n", offset, data, key_selector); |
| r5931 | r5932 | |
| 274 | 274 | read_board_flag = TRUE; |
| 275 | 275 | logerror("read_board_data = %x \n", data); |
| 276 | 276 | |
| 277 | // | |
| 277 | // return 0xff00; // Mephisto need it for working | |
| 278 | 278 | |
| 279 | 279 | return data; |
| 280 | 280 | } |
| r5931 | r5932 | |
| 286 | 286 | UINT16 LineAH = 0; |
| 287 | 287 | UINT8 LED; |
| 288 | 288 | |
| 289 | // | |
| 289 | // logerror("Write Board = %x \n ",data); | |
| 290 | 290 | |
| 291 | 291 | LineAH = data >> 8; |
| 292 | 292 | |
| 293 | 293 | if (LineAH && Line18_LED) |
| 294 | 294 | { |
| 295 | // logerror("Line18_LED = %x \n ",Line18_LED); | |
| 296 | // logerror("LineAH = %x \n ",LineAH); | |
| 295 | // logerror("Line18_LED = %x \n ",Line18_LED); | |
| 296 | // logerror("LineAH = %x \n ",LineAH); | |
| 297 | 297 | |
| 298 | 298 | for (i_AH = 0; i_AH < 8; i_AH++) |
| 299 | 299 | { |
| r5931 | r5932 | |
| 303 | 303 | { |
| 304 | 304 | if (!(Line18_LED & (1 << i_18))) |
| 305 | 305 | { |
| 306 | // logerror("i_18 = %d \n ",i_18); | |
| 307 | // logerror("i_AH = %d \n ",i_AH); | |
| 308 | // logerror("LED an: = %d \n ",m_board[i_18][i_AH]); | |
| 306 | // logerror("i_18 = %d \n ",i_18); | |
| 307 | // logerror("i_AH = %d \n ",i_AH); | |
| 308 | // logerror("LED an: = %d \n ",m_board[i_18][i_AH]); | |
| 309 | 309 | |
| 310 | 310 | LED = m_board[i_18][i_AH].field; |
| 311 | 311 | output_set_led_value(LED, 1); |
| r5931 | r5932 | |
| 366 | 366 | |
| 367 | 367 | lcd_invert = 0; |
| 368 | 368 | |
| 369 | if (lcd_flag == 0) | |
| 369 | if (lcd_flag == 0) | |
| 370 | 370 | key_selector = 1; |
| 371 | 371 | |
| 372 | 372 | logerror("LCD Flag 32 = %x \n", lcd_flag); |
| 373 | 373 | //beep_set_state(0, lcd_flag & 1 ? 1 : 0); |
| 374 | 374 | |
| 375 | if (lcd_flag != 0) | |
| 375 | if (lcd_flag != 0) | |
| 376 | 376 | led7 = 255; |
| 377 | else | |
| 377 | else | |
| 378 | 378 | led7 = 0; |
| 379 | 379 | } |
| 380 | 380 | |
| r5931 | r5932 | |
| 390 | 390 | { |
| 391 | 391 | UINT32 data; |
| 392 | 392 | |
| 393 | if (key_selector == 0) | |
| 393 | if (key_selector == 0) | |
| 394 | 394 | data = input_port_read(space->machine, "LINE0"); |
| 395 | else | |
| 395 | else | |
| 396 | 396 | data = input_port_read(space->machine, "LINE1"); |
| 397 | 397 | //if (key_selector == 1) data = input_port_read(machine, "LINE0"); else data = 0; |
| 398 | 398 | logerror("read Keyboard Offset = %x Data = %x\n", offset, data); |
| r5931 | r5932 | |
| 418 | 418 | { |
| 419 | 419 | UINT8 board; |
| 420 | 420 | board = data >> 24; |
| 421 | if (board == 0xff) | |
| 421 | if (board == 0xff) | |
| 422 | 422 | key_selector = 0; |
| 423 | 423 | logerror("Write Board = %x \n", data); |
| 424 | 424 | } |
| r5931 | r5932 | |
| 571 | 571 | |
| 572 | 572 | /* video hardware */ |
| 573 | 573 | MDRV_DEFAULT_LAYOUT(layout_glasgow) |
| 574 | ||
| 574 | ||
| 575 | 575 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 576 | 576 | MDRV_SOUND_ADD("beep", BEEP, 0) |
| 577 | 577 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| r5931 | r5932 | |
|---|---|---|
| 644 | 644 | |
| 645 | 645 | /* ------------ config ------------ */ |
| 646 | 646 | |
| 647 | static SYSTEM_CONFIG_START ( to ) | |
| 647 | static SYSTEM_CONFIG_START ( to ) | |
| 648 | 648 | CONFIG_DEVICE ( thom_serial_getinfo ) |
| 649 | 649 | SYSTEM_CONFIG_END |
| 650 | 650 | |
| r5931 | r5932 | |
| 725 | 725 | MDRV_ACIA6850_ADD( "acia6850", to7_modem ) |
| 726 | 726 | |
| 727 | 727 | MDRV_WD2793_ADD("wd2793", default_wd17xx_interface ) |
| 728 | ||
| 728 | ||
| 729 | 729 | MDRV_FLOPPY_4_DRIVES_ADD(thomson_floppy_config) |
| 730 | 730 | |
| 731 | 731 | /* cartridge */ |
| r5931 | r5932 | |
| 1091 | 1091 | |
| 1092 | 1092 | /* ------------ config ------------ */ |
| 1093 | 1093 | |
| 1094 | static SYSTEM_CONFIG_START ( mo ) | |
| 1094 | static SYSTEM_CONFIG_START ( mo ) | |
| 1095 | 1095 | CONFIG_DEVICE ( thom_serial_getinfo ) |
| 1096 | 1096 | SYSTEM_CONFIG_END |
| 1097 | 1097 |
| r5931 | r5932 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |
| 13 | 2008 - Driver Updates | |
| 13 | 2008 - Driver Updates | |
| 14 | 14 | --------------------- |
| 15 | 15 | |
| 16 | 16 | (most of the informations are taken from http://www.zimmers.net/cbmpics/ ) |
| r5931 | r5932 | |
| 23 | 23 | CPU: CSG 8502 (1 or 2 MHz), Z80 (~3 MHz) |
| 24 | 24 | RAM: 128 kilobytes |
| 25 | 25 | ROM: 72 kilobytes expandable |
| 26 | Video: MOS 8564 "VIC-IIE", MOS 8563 "VDC" CTRC (40/80 columns text; Palette of 16 | |
| 27 | colors; Hires modes 320 x 200, 640 x 200, 16k of dedicated VDC RAM) | |
| 28 | Sound: MOS 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 29 | capabilities) | |
| 30 | Ports: MOS 6526 CIA x2 (2 Joystick/Mouse ports; CBM Serial port; CBM | |
| 31 | Datasette port; parallel programmable "User" port; CBM Monitor port; | |
| 32 | C64 expansion port; Warm reset switch; Keyboard port; Power switch) | |
| 33 | Keyboard: Full-sized 93 key QWERTY (14 key numeric keypad; 8 programmable | |
| 34 | function keys + HELP; 4 direction 4-key cursor-pad) | |
| 26 | Video: MOS 8564 "VIC-IIE", MOS 8563 "VDC" CTRC (40/80 columns text; Palette of 16 | |
| 27 | colors; Hires modes 320 x 200, 640 x 200, 16k of dedicated VDC RAM) | |
| 28 | Sound: MOS 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 29 | capabilities) | |
| 30 | Ports: MOS 6526 CIA x2 (2 Joystick/Mouse ports; CBM Serial port; CBM | |
| 31 | Datasette port; parallel programmable "User" port; CBM Monitor port; | |
| 32 | C64 expansion port; Warm reset switch; Keyboard port; Power switch) | |
| 33 | Keyboard: Full-sized 93 key QWERTY (14 key numeric keypad; 8 programmable | |
| 34 | function keys + HELP; 4 direction 4-key cursor-pad) | |
| 35 | 35 | |
| 36 | 36 | Upgrade kits were sold to upgrade the VDC RAM to 64k using a passthrough board |
| 37 | 37 | that the VDC sat in. |
| r5931 | r5932 | |
| 40 | 40 | * Commodore 128CR (prototype from June, 1986) |
| 41 | 41 | |
| 42 | 42 | Basically, a C128 in a redesigned board to reduce production costs. It's |
| 43 | not clear when it's been produced, nor if it has ever been produced on | |
| 43 | not clear when it's been produced, nor if it has ever been produced on | |
| 44 | 44 | large scale. Its BIOS is an intermediate revision between rev. 0 and rev. 1 |
| 45 | 45 | in the main C128. |
| 46 | 46 | A picture of the PCB can be found here: |
| r5931 | r5932 | |
| 53 | 53 | |
| 54 | 54 | * Commodore 128D (1985) |
| 55 | 55 | |
| 56 | Designed in the US, but only sold in Europe, it is a C128 in a desktop | |
| 56 | Designed in the US, but only sold in Europe, it is a C128 in a desktop | |
| 57 | 57 | case, with built-in 1571 disk drive (upgraded with a special software to |
| 58 | 58 | discourage pirating software). Some NTSC prototypes exist. |
| 59 | 59 | |
| 60 | 60 | CPU: CSG 8502 (1 or 2 MHz), Z80 (~3 MHz), 6502 (co-processor for disk |
| 61 | ||
| 61 | drive) | |
| 62 | 62 | RAM: 128 kilobytes |
| 63 | 63 | ROM: 72 kilobytes expandable |
| 64 | Video: MOS 8564 "VIC-IIE", MOS 8563 "VDC" CTRC (40/80 columns text; Palette of 16 | |
| 65 | colors; Hires modes 320 x 200, 640 x 200, 64k of dedicated VDC RAM) | |
| 66 | Sound: MOS 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 67 | capabilities) | |
| 68 | Ports: MOS 6526 CIA x2 (2 Joystick/Mouse ports; CBM Serial port; CBM | |
| 69 | Datasette port; parallel programmable "User" port; CBM Monitor port; | |
| 70 | C64 expansion port; Warm reset switch; Keyboard port; Power switch) | |
| 71 | Keyboard: Full-sized 93 key QWERTY (14 key numeric keypad; 8 programmable | |
| 72 | function keys + HELP; 4 direction 4-key cursor-pad) | |
| 73 | Additional Hardware: Internal 1571 disk drive (Double sided/Double Density | |
| 74 | 360k; capable of reading GCR and MFM formats) | |
| 64 | Video: MOS 8564 "VIC-IIE", MOS 8563 "VDC" CTRC (40/80 columns text; Palette of 16 | |
| 65 | colors; Hires modes 320 x 200, 640 x 200, 64k of dedicated VDC RAM) | |
| 66 | Sound: MOS 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 67 | capabilities) | |
| 68 | Ports: MOS 6526 CIA x2 (2 Joystick/Mouse ports; CBM Serial port; CBM | |
| 69 | Datasette port; parallel programmable "User" port; CBM Monitor port; | |
| 70 | C64 expansion port; Warm reset switch; Keyboard port; Power switch) | |
| 71 | Keyboard: Full-sized 93 key QWERTY (14 key numeric keypad; 8 programmable | |
| 72 | function keys + HELP; 4 direction 4-key cursor-pad) | |
| 73 | Additional Hardware: Internal 1571 disk drive (Double sided/Double Density | |
| 74 | 360k; capable of reading GCR and MFM formats) | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | * Commodore 128DCR (1986) |
| 78 | 78 | |
| 79 | 79 | Basically, a C128D in a redesigned board to reduce production costs. It's |
| 80 | the only model sold in the US, but it's quite possible that it came later | |
| 80 | the only model sold in the US, but it's quite possible that it came later | |
| 81 | 81 | in Europe as well (being cheaper to produce). |
| 82 | 82 | |
| 83 | 83 | |
| r5931 | r5932 | |
| 86 | 86 | NTSC prototype for an improved version of C128D, featuring a built-in 1581 |
| 87 | 87 | disk drive in place of the 1571 used in C128D / C128DCR. The prototype has no |
| 88 | 88 | given name, so C128D/81 is just a reasonable way to indicate it. The case is |
| 89 | from a PAL C128D and the board is a heavily modified PAL board with hand | |
| 89 | from a PAL C128D and the board is a heavily modified PAL board with hand | |
| 90 | 90 | soldered connections to make it NTSC. |
| 91 | 91 | |
| 92 | 92 | |
| r5931 | r5932 | |
| 104 | 104 | |
| 105 | 105 | * C128 Mode |
| 106 | 106 | |
| 107 | Various missing features (e.g. no cpu clock doubling; no internal function | |
| 108 | rom; serial bus doesn't support printer or other devices; no C128 cart | |
| 107 | Various missing features (e.g. no cpu clock doubling; no internal function | |
| 108 | rom; serial bus doesn't support printer or other devices; no C128 cart | |
| 109 | 109 | expansions are supported; no userport; no rs232/v.24 interface) |
| 110 | 110 | |
| 111 | 111 | * Informations / BIOS / Supported Sets: |
| 112 | 112 | |
| 113 | 113 | - Was C128D using rev. 1 BIOS in 4 ROMs? I guessed so because the board has the |
| 114 | same desing as a C128, and later C128DCR still used rev. 1 BIOS (only contained | |
| 114 | same desing as a C128, and later C128DCR still used rev. 1 BIOS (only contained | |
| 115 | 115 | in two ROMs) |
| 116 | 116 | |
| 117 | 117 | - Is it possible to track down and dump properly C128 PAL BIOSes? Current sets |
| 118 | are mostly tagged as bad dumps because obtained by extracting the content in | |
| 118 | are mostly tagged as bad dumps because obtained by extracting the content in | |
| 119 | 119 | pieces. I'd like to have confirmation that the common parts are really the same |
| 120 | 120 | before removing the flag. |
| 121 | 121 | |
| 122 | - PAL BIOSes are from C128? C128D? or C128DCR? Were there differences in the | |
| 123 | contents between them, except for being splitted in 2 or 4 parts? Were all | |
| 122 | - PAL BIOSes are from C128? C128D? or C128DCR? Were there differences in the | |
| 123 | contents between them, except for being splitted in 2 or 4 parts? Were all | |
| 124 | 124 | versions sold in each country? Right now we choose to support the following sets |
| 125 | 125 | (more to be added if BIOS content confirmed): |
| 126 | 126 | |
| r5931 | r5932 | |
| 128 | 128 | we support c128drde, c128drit and c128drsw. |
| 129 | 129 | |
| 130 | 130 | + We also have a dump of the German C128, therefore we support the c128ger, even |
| 131 | if it's not clear which BASIC version it was shipped with. We assumed the older | |
| 132 | kernal to be shipped with rev. 0 and the newer with rev. 1. | |
| 131 | if it's not clear which BASIC version it was shipped with. We assumed the older | |
| 132 | kernal to be shipped with rev. 0 and the newer with rev. 1. | |
| 133 | 133 | |
| 134 | + The Finnish, French and Norwegian dumps came with no notes (or these have been | |
| 135 | lost). Therefore we support only the c128 for these, i.e. c128fin, c128fre and | |
| 134 | + The Finnish, French and Norwegian dumps came with no notes (or these have been | |
| 135 | lost). Therefore we support only the c128 for these, i.e. c128fin, c128fre and | |
| 136 | 136 | c128nor. |
| 137 | 137 | |
| 138 | 138 | + Character ROM for Belgium, Italy and French was the same (I/F/B on the label, |
| r5931 | r5932 | |
| 148 | 148 | |
| 149 | 149 | c128 / c128d |
| 150 | 150 | |
| 151 | U18 (read compatible 2764?) 8kB c64 character rom, c128 character rom | |
| 152 | U32 23128 (read compatible 27128?) 16kB c64 Basic, c64 Kernel | |
| 153 | U33 23128 (read compatible 27128?) 16kB c128 Basic at 0x4000 | |
| 154 | U34 23128 (read compatible 27128?) 16kB c128 Basic at 0x8000 | |
| 155 | U35 23128 (read compatible 27128?) 16kB c128 Editor, Z80BIOS, c128 Kernel | |
| 151 | U18 (read compatible 2764?) 8kB c64 character rom, c128 character rom | |
| 152 | U32 23128 (read compatible 27128?) 16kB c64 Basic, c64 Kernel | |
| 153 | U33 23128 (read compatible 27128?) 16kB c128 Basic at 0x4000 | |
| 154 | U34 23128 (read compatible 27128?) 16kB c128 Basic at 0x8000 | |
| 155 | U35 23128 (read compatible 27128?) 16kB c128 Editor, Z80BIOS, c128 Kernel | |
| 156 | 156 | |
| 157 | 157 | c128cr / c128dcr |
| 158 | 158 | |
| 159 | U18 (read compatible 2764?) 8kB c64 character rom, c128 character rom | |
| 160 | U32 23256 (read compatible 27256?) 32kB c64 Basic + Kernel, c128 Editor, Z80BIOS, c128 Kernel | |
| 161 | U34 23256 (read compatible 27256?) 32kB c128 Basic | |
| 159 | U18 (read compatible 2764?) 8kB c64 character rom, c128 character rom | |
| 160 | U32 23256 (read compatible 27256?) 32kB c64 Basic + Kernel, c128 Editor, Z80BIOS, c128 Kernel | |
| 161 | U34 23256 (read compatible 27256?) 32kB c128 Basic | |
| 162 | 162 | |
| 163 | 163 | c128d / c128dcr also need: |
| 164 | 164 | |
| 165 | ||
| 165 | U102 23256 (read compatible 27256?) 32kB 1571 system rom | |
| 166 | 166 | |
| 167 | 167 | |
| 168 | It would be also possible to dump the BIOS in monitor, but it would be preferable | |
| 168 | It would be also possible to dump the BIOS in monitor, but it would be preferable | |
| 169 | 169 | to use an EEPROM reader, in order to obtain a dump of the whole content. |
| 170 | 170 | */ |
| 171 | 171 | |
| r5931 | r5932 | |
| 321 | 321 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) |
| 322 | 322 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) |
| 323 | 323 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Alt") PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(LALT)) |
| 324 | ||
| 324 | ||
| 325 | 325 | PORT_INCLUDE( c128_special ) /* SPECIAL */ |
| 326 | 326 | |
| 327 | 327 | PORT_INCLUDE( c64_controls ) /* CTRLSEL, JOY0, JOY1, PADDLE0 -> PADDLE3, TRACKX, TRACKY, LIGHTX, LIGHTY, OTHER */ |
| r5931 | r5932 | |
| 634 | 634 | /* cia */ |
| 635 | 635 | MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6567_CLOCK, c128_ntsc_cia0) |
| 636 | 636 | MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6567_CLOCK, c128_ntsc_cia1) |
| 637 | ||
| 637 | ||
| 638 | 638 | /* floppy from serial bus */ |
| 639 | 639 | MDRV_IMPORT_FROM(simulated_drive) |
| 640 | 640 | |
| r5931 | r5932 | |
| 730 | 730 | |
| 731 | 731 | ROM_START( c128cr ) |
| 732 | 732 | /* C128CR prototype, owned by Bo Zimmers |
| 733 | ||
| 733 | PCB markings: "COMMODORE 128CR REV.3 // PCB NO.252270" and "PCB ASSY NO.250783" | |
| 734 | 734 | Sticker on rom cart shield: "C128CR No.2 // ENG. SAMPLE // Jun/9/'86 KNT" |
| 735 | 3 ROMs (combined basic, combined c64/kernal, plain character rom) | |
| 736 | 6526A-1 CIAs | |
| 737 | ?prototype? 2568R1X VDC w/ 1186 datecode | |
| 738 | */ | |
| 735 | 3 ROMs (combined basic, combined c64/kernal, plain character rom) | |
| 736 | 6526A-1 CIAs | |
| 737 | ?prototype? 2568R1X VDC w/ 1186 datecode | |
| 738 | */ | |
| 739 | 739 | ROM_REGION( 0x132800, "maincpu", 0 ) |
| 740 | ROM_LOAD( "252343-03.u34", 0x100000, 0x8000, CRC(bc07ed87) SHA1(0eec437994a3f2212343a712847213a8a39f4a7b) ) // BASIC lo + hi, "252343-03 // U34" | |
| 741 | ROM_LOAD( "252343-04.u32", 0x108000, 0x8000, CRC(cc6bdb69) SHA1(36286b2e8bea79f7767639fd85e12c5447c7041b) ) // C64 OS ROM + Kernal, "252343-04 // US // U32" | |
| 740 | ROM_LOAD( "252343-03.u34", 0x100000, 0x8000, CRC(bc07ed87) SHA1(0eec437994a3f2212343a712847213a8a39f4a7b) ) // BASIC lo + hi, "252343-03 // U34" | |
| 741 | ROM_LOAD( "252343-04.u32", 0x108000, 0x8000, CRC(cc6bdb69) SHA1(36286b2e8bea79f7767639fd85e12c5447c7041b) ) // C64 OS ROM + Kernal, "252343-04 // US // U32" | |
| 742 | 742 | ROM_LOAD( "390059-01.u18", 0x120000, 0x2000, CRC(6aaaafe6) SHA1(29ed066d513f2d5c09ff26d9166ba23c2afb2b3f) ) // Character, "MOS // (C)1985 CBM // 390059-01 // M468613 8547H" |
| 743 | 743 | |
| 744 | 744 | ROM_REGION( 0x10000, "m8502", ROMREGION_ERASEFF ) |
| r5931 | r5932 | |
|---|---|---|
| 10 | 10 | |
| 11 | 11 | /* |
| 12 | 12 | |
| 13 | 2008 - Driver Updates | |
| 13 | 2008 - Driver Updates | |
| 14 | 14 | --------------------- |
| 15 | 15 | |
| 16 | 16 | (most of the informations are taken from http://www.zimmers.net/cbmpics/ ) |
| r5931 | r5932 | |
| 28 | 28 | RAM: 16 kilobytes (expandable to 64k internally) |
| 29 | 29 | ROM: 32 kilobytes |
| 30 | 30 | Video: MOS Technology 7360 "TED" (5 Video modes; Max. Resolution 320x200; |
| 31 | 40 columns text; Palette of 16 colors in 8 shades, for 128 colors) | |
| 32 | Sound: MOS Technology 7360 "TED" (2 voice tone-generating sound capabilities) | |
| 33 | Ports: MOS 7360 (2 Joystick/Mouse ports; CBM Serial port; 'TED' port; "TV" | |
| 34 | Port and switch; CBM Monitor port; Power and reset switches; Power | |
| 35 | connector) | |
| 36 | Keyboard: QWERTY 62 key "membrane" (8 programmable function keys; 4 direction | |
| 37 | cursor-pad) | |
| 31 | 40 columns text; Palette of 16 colors in 8 shades, for 128 colors) | |
| 32 | Sound: MOS Technology 7360 "TED" (2 voice tone-generating sound capabilities) | |
| 33 | Ports: MOS 7360 (2 Joystick/Mouse ports; CBM Serial port; 'TED' port; "TV" | |
| 34 | Port and switch; CBM Monitor port; Power and reset switches; Power | |
| 35 | connector) | |
| 36 | Keyboard: QWERTY 62 key "membrane" (8 programmable function keys; 4 direction | |
| 37 | cursor-pad) | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | * Commodore 16 (1984) |
| 41 | 41 | |
| 42 | Redesigned version of the C116, with a different case and a different | |
| 42 | Redesigned version of the C116, with a different case and a different | |
| 43 | 43 | keyboard. |
| 44 | 44 | |
| 45 | 45 | CPU: MOS Technology 7501 (variable clock rate, with max 1.76 MHz) |
| 46 | 46 | RAM: 16 kilobytes (expandable to 64k internally) |
| 47 | 47 | ROM: 32 kilobytes |
| 48 | 48 | Video: MOS Technology 7360 "TED" (5 Video modes; Max. Resolution 320x200; |
| 49 | 40 columns text; Palette of 16 colors in 8 shades, for 128 colors) | |
| 50 | Sound: MOS Technology 7360 "TED" (2 voice tone-generating sound capabilities) | |
| 51 | Ports: MOS 7360 (2 Joystick/Mouse ports; CBM Serial port; 'TED' port; "TV" | |
| 52 | Port and switch; CBM Monitor port; Power and reset switches; Power | |
| 53 | connector) | |
| 49 | 40 columns text; Palette of 16 colors in 8 shades, for 128 colors) | |
| 50 | Sound: MOS Technology 7360 "TED" (2 voice tone-generating sound capabilities) | |
| 51 | Ports: MOS 7360 (2 Joystick/Mouse ports; CBM Serial port; 'TED' port; "TV" | |
| 52 | Port and switch; CBM Monitor port; Power and reset switches; Power | |
| 53 | connector) | |
| 54 | 54 | Keyboard: QWERTY 66 key typewriter style (8 programmable function keys; |
| 55 | ||
| 55 | 4 direction cursor-pad) | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | * Commodore Plus/4 (1984) |
| 59 | 59 | |
| 60 | 60 | This system became the middle tier of the Commodore 264 family, replacing |
| 61 | 61 | the original Commodore 264. The Plus/4 is basically the same as the C264, |
| 62 | but the name refers to the four built-in programs which came with the | |
| 62 | but the name refers to the four built-in programs which came with the | |
| 63 | 63 | machine: Word Processing, Spreadsheet, Database software, Graphing package. |
| 64 | 64 | |
| 65 | 65 | CPU: MOS Technology 7501 (variable clock rate, with max 1.76 MHz) |
| 66 | 66 | RAM: 64 kilobytes (expandable to 64k internally) |
| 67 | 67 | ROM: 64 kilobytes |
| 68 | 68 | Video: MOS Technology 7360 "TED" (5 Video modes; Max. Resolution 320x200; |
| 69 | 40 columns text; Palette of 16 colors in 8 shades, for 128 colors) | |
| 70 | Sound: MOS Technology 7360 "TED" (2 voice tone-generating sound capabilities) | |
| 71 | Ports: MOS 7360 (2 Joystick/Mouse ports; CBM Serial port; 'TED' port; "TV" | |
| 72 | Port and switch; CBM Monitor port; Power and reset switches; Power | |
| 73 | connector) | |
| 69 | 40 columns text; Palette of 16 colors in 8 shades, for 128 colors) | |
| 70 | Sound: MOS Technology 7360 "TED" (2 voice tone-generating sound capabilities) | |
| 71 | Ports: MOS 7360 (2 Joystick/Mouse ports; CBM Serial port; 'TED' port; "TV" | |
| 72 | Port and switch; CBM Monitor port; Power and reset switches; Power | |
| 73 | connector) | |
| 74 | 74 | Keyboard: Full-sized QWERTY 67 key (8 programmable function keys; |
| 75 | ||
| 75 | 4 direction cursor-pad) | |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | * Commodore 232 (1984, Prototype) |
| 79 | 79 | |
| 80 | This system never reached the production and only few units exist. It is | |
| 80 | This system never reached the production and only few units exist. It is | |
| 81 | 81 | in between the C16 and the C264, with its 32 kilobytes of RAM. |
| 82 | 82 | |
| 83 | 83 | |
| r5931 | r5932 | |
| 89 | 89 | * Commodore V364 (1984, Prototype) |
| 90 | 90 | |
| 91 | 91 | This system was supposed to become the high-end system of the family, |
| 92 | featuring 64 kilobytes of RAM, the same technology of the Plus/4, a | |
| 92 | featuring 64 kilobytes of RAM, the same technology of the Plus/4, a | |
| 93 | 93 | keyboard with numeric keypad and built in voice synthesis capabilities. |
| 94 | 94 | |
| 95 | 95 | [TO DO] |
| r5931 | r5932 | |
| 268 | 268 | |
| 269 | 269 | PORT_MODIFY("ROW1") |
| 270 | 270 | /* Both Shift keys were mapped to the same bit */ |
| 271 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left & Right)") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) | |
| 271 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Left & Right)") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) | |
| 272 | 272 | |
| 273 | 273 | PORT_MODIFY("ROW4") |
| 274 | 274 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 \xE2\x86\x91") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(0x2191) |
| r5931 | r5932 | |
| 303 | 303 | PORT_INCLUDE( c16 ) |
| 304 | 304 | |
| 305 | 305 | /* no real floppy */ |
| 306 | ||
| 306 | ||
| 307 | 307 | PORT_MODIFY( "ROW0" ) |
| 308 | 308 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(0xA3) |
| 309 | 309 | PORT_MODIFY( "ROW5" ) |
| r5931 | r5932 | |
| 329 | 329 | PORT_INCLUDE( plus4 ) |
| 330 | 330 | |
| 331 | 331 | /* no real floppy */ |
| 332 | ||
| 332 | ||
| 333 | 333 | PORT_MODIFY("CFG1") |
| 334 | 334 | PORT_BIT( 0x10, 0x10, IPT_UNUSED ) /* ntsc */ |
| 335 | 335 | PORT_BIT( 0x0c, 0x08, IPT_UNUSED ) /* 364 */ |
| r5931 | r5932 | |
| 374 | 374 | c1551_0_write_handshake, |
| 375 | 375 | NULL, |
| 376 | 376 | NULL, |
| 377 | NULL | |
| 377 | NULL | |
| 378 | 378 | }; |
| 379 | 379 | |
| 380 | 380 | static const tpi6525_interface c16_tpi6525_tpi_2_c1551_intf = |
| r5931 | r5932 | |
| 400 | 400 | c1551_1_write_handshake, |
| 401 | 401 | NULL, |
| 402 | 402 | NULL, |
| 403 | NULL | |
| 403 | NULL | |
| 404 | 404 | }; |
| 405 | 405 | |
| 406 | 406 | static const m6502_interface c16_m7501_interface = |
| r5931 | r5932 | |
| 462 | 462 | static MACHINE_DRIVER_START( c16c ) |
| 463 | 463 | MDRV_IMPORT_FROM( c16 ) |
| 464 | 464 | |
| 465 | /* c16c uses 'real' floppy drive emulation from machine/vc1541.c... | |
| 466 | still in progress, atm */ | |
| 465 | /* c16c uses 'real' floppy drive emulation from machine/vc1541.c... | |
| 466 | still in progress, atm */ | |
| 467 | 467 | MDRV_DEVICE_REMOVE("tpi6535_tpi_2") |
| 468 | 468 | MDRV_TPI6525_ADD("tpi6535_tpi_2", c16_tpi6525_tpi_2_c1551_intf) |
| 469 | 469 | |
| r5931 | r5932 | |
| 512 | 512 | static MACHINE_DRIVER_START( plus4c ) |
| 513 | 513 | MDRV_IMPORT_FROM( plus4 ) |
| 514 | 514 | |
| 515 | /* plus4c uses 'real' floppy drive emulation from machine/vc1541.c... | |
| 516 | still in progress, atm */ | |
| 515 | /* plus4c uses 'real' floppy drive emulation from machine/vc1541.c... | |
| 516 | still in progress, atm */ | |
| 517 | 517 | MDRV_DEVICE_REMOVE("tpi6535_tpi_2") |
| 518 | 518 | MDRV_TPI6525_ADD("tpi6535_tpi_2", c16_tpi6525_tpi_2_c1551_intf) |
| 519 | 519 |
| r5931 | r5932 | |
|---|---|---|
| 103 | 103 | 04 b9 1a |
| 104 | 104 | 04 b9 22 |
| 105 | 105 | 02 bb 12 |
| 106 | 4000 e0 | |
| 107 | rr w rr w rr w rr w rr w rr w rr w rr w | |
| 108 | 4000 ee | |
| 106 | 4000 e0 | |
| 107 | rr w rr w rr w rr w rr w rr w rr w rr w | |
| 108 | 4000 ee | |
| 109 | 109 | */ |
| 110 | 110 | break; |
| 111 | 111 | default: |
| r5931 | r5932 | |
| 116 | 116 | |
| 117 | 117 | static READ8_HANDLER( gmaster_port_r ) |
| 118 | 118 | { |
| 119 | // | |
| 119 | // UINT8 data = gmaster.ports[offset]; | |
| 120 | 120 | UINT8 data = 0xff; |
| 121 | 121 | switch (offset) |
| 122 | 122 | { |
| r5931 | r5932 | |
| 189 | 189 | static VIDEO_UPDATE( gmaster ) |
| 190 | 190 | { |
| 191 | 191 | int x,y; |
| 192 | // | |
| 192 | // plot_box(bitmap, 0, 0, 64/*bitmap->width*/, bitmap->height, 0); //xmess rounds up to 64 pixel | |
| 193 | 193 | for (y = 0; y < ARRAY_LENGTH(gmaster_video.pixels); y++) |
| 194 | 194 | { |
| 195 | 195 | for (x = 0; x < ARRAY_LENGTH(gmaster_video.pixels[0]); x++) |
| r5931 | r5932 | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | static const UPD7810_CONFIG config = { |
| 227 | // | |
| 227 | // TYPE_78C10, // 78c11 in handheld | |
| 228 | 228 | TYPE_7801, // temporarily until 7810 core fixes synchronized |
| 229 | 229 | gmaster_io_callback |
| 230 | 230 | }; |
| r5931 | r5932 | |
| 257 | 257 | ROM_START(gmaster) |
| 258 | 258 | ROM_REGION(0x10000,"maincpu", 0) |
| 259 | 259 | ROM_LOAD("gmaster.bin", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) ) |
| 260 | // | |
| 260 | // ROM_CART_LOAD(0, "bin", 0x8000, 0x7f00, 0) | |
| 261 | 261 | ROM_CART_LOAD("cart", 0x8000, 0x8000, 0) |
| 262 | 262 | ROM_END |
| 263 | 263 | |
| r5931 | r5932 | |
| 297 | 297 | osd_fclose(cartfile); |
| 298 | 298 | return 1; |
| 299 | 299 | } |
| 300 | // | |
| 300 | // memcpy(rom+0x0000, rom+0x8000, 0x4000); | |
| 301 | 301 | osd_fclose(cartfile); |
| 302 | 302 | return 0; |
| 303 | 303 | } |
| 304 | 304 | #endif |
| 305 | 305 | |
| 306 | 306 | /* YEAR NAME PARENT MACHINE INPUT INIT |
| 307 | ||
| 307 | COMPANY FULLNAME */ | |
| 308 | 308 | CONS( 1990, gmaster, 0, 0, gmaster, gmaster, gmaster, 0, "Hartung", "Game Master", GAME_IMPERFECT_SOUND) |
| r5931 | r5932 | |
|---|---|---|
| 99 | 99 | playfield.time=t; |
| 100 | 100 | |
| 101 | 101 | // logerror("%.4x playfield %d lowtime %s hightime %s\n",(int)activecpu_get_pc(), playfield.count, |
| 102 | // | |
| 102 | // attotime_string(playfield.low_time, 7), attotime_string(playfield.high_time,7) ); | |
| 103 | 103 | |
| 104 | 104 | if (playfield.started) { |
| 105 | 105 | // 0 twice as long low |
| 106 | 106 | // 1 twice as long high |
| 107 | 107 | if (attotime_compare(playfield.low_time,playfield.high_time)>0) d=TRUE; |
| 108 | ||
| 108 | ||
| 109 | 109 | playfield.data&=~(1<<(playfield.bit^7)); |
| 110 | 110 | if (d) playfield.data|=1<<(playfield.bit^7); |
| 111 | 111 | playfield.bit++; |
| r5931 | r5932 | |
| 199 | 199 | bit 6: input clocks!? |
| 200 | 200 | |
| 201 | 201 | port a: |
| 202 | bit 7: input low x/$37 2 | |
| 202 | bit 7: input low x/$37 2 | |
| 203 | 203 | bit 6: input low x/$37 3 |
| 204 | 204 | bit 5: input low x/$37 4 (else 1) |
| 205 | 205 | |
| r5931 | r5932 | |
| 253 | 253 | AM_RANGE( 0x0000, 0x03ff) AM_RAM |
| 254 | 254 | /* |
| 255 | 255 | 67-de playfield ($40 means white, $80 black) |
| 256 | ||
| 256 | */ | |
| 257 | 257 | // AM_RANGE( 0x4000, 0x40ff) AM_NOP |
| 258 | 258 | /* |
| 259 | probably zusatzger | |
| 259 | probably zusatzger??t memory (battery powered ram 256x4? at 0x4000) | |
| 260 | 260 | $40ff low nibble ram if playfield module (else init with normal playfield) |
| 261 | 261 | */ |
| 262 | 262 | AM_RANGE( 0x6000, 0x600f) AM_DEVREADWRITE("via6522_0", via_r, via_w) |
| r5931 | r5932 | |
| 278 | 278 | |
| 279 | 279 | PORT_START( "Switches" ) |
| 280 | 280 | //PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NEW GAME") PORT_CODE(KEYCODE_F3) // seems to be direct wired to reset |
| 281 | // PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?CLEAR") PORT_CODE(KEYCODE_F1) | |
| 282 | // PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?ENTER") PORT_CODE(KEYCODE_ENTER) | |
| 281 | // PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?CLEAR") PORT_CODE(KEYCODE_F1) | |
| 282 | // PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("?ENTER") PORT_CODE(KEYCODE_ENTER) | |
| 283 | 283 | PORT_START( "matrix1" ) |
| 284 | 284 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("?1") PORT_CODE(KEYCODE_1_PAD) |
| 285 | 285 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 C SQ EP") PORT_CODE(KEYCODE_9) |
| r5931 | r5932 | |
| 348 | 348 | ROM_START(ssystem3) |
| 349 | 349 | ROM_REGION(0x10000,"maincpu",0) |
| 350 | 350 | ROM_LOAD("ss3lrom", 0xc000, 0x1000, CRC(9ea46ed3) SHA1(34eef85b356efbea6ddac1d1705b104fc8e2731a) ) |
| 351 | // | |
| 351 | // ROM_RELOAD(0xe000, 0x1000) | |
| 352 | 352 | ROM_LOAD("ss3hrom", 0xf000, 0x1000, CRC(52741e0b) SHA1(2a7b950f9810c5a14a1b9d5e6b2bd93da621662e) ) |
| 353 | 353 | ROM_RELOAD(0xd000, 0x1000) |
| 354 | 354 | ROM_END |
| r5931 | r5932 | |
|---|---|---|
| 216 | 216 | MDRV_SOUND_ADD("nessound", NES, NTSC_CLOCK) |
| 217 | 217 | MDRV_SOUND_CONFIG(nes_apu_interface) |
| 218 | 218 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) |
| 219 | ||
| 219 | ||
| 220 | 220 | MDRV_CARTSLOT_ADD("cart") |
| 221 | 221 | MDRV_CARTSLOT_EXTENSION_LIST("nes,unf") |
| 222 | 222 | MDRV_CARTSLOT_MANDATORY |
| r5931 | r5932 | |
| 268 | 268 | |
| 269 | 269 | static MACHINE_DRIVER_START( famicom ) |
| 270 | 270 | MDRV_IMPORT_FROM( nes ) |
| 271 | ||
| 271 | ||
| 272 | 272 | MDRV_CARTSLOT_MODIFY("cart") |
| 273 | 273 | MDRV_CARTSLOT_EXTENSION_LIST("nes,unf") |
| 274 | 274 | MDRV_CARTSLOT_NOT_MANDATORY |
| r5931 | r5932 | |
| 350 | 350 | // and http://www.disgruntleddesigner.com/chrisc/drpcjr/DrPCJrMemMap.txt |
| 351 | 351 | ROM_START( drpcjr ) |
| 352 | 352 | ROM_REGION( 0x18000, "maincpu", 0 ) /* Main RAM + program banks */ |
| 353 | /* 4 banks to be mapped in 0xe000-0xffff (or 8 banks to be mapped in 0xe000-0xefff & 0xf000-0xffff). | |
| 354 | Banks selected by writing at 0x4180 */ | |
| 353 | /* 4 banks to be mapped in 0xe000-0xffff (or 8 banks to be mapped in 0xe000-0xefff & 0xf000-0xffff). | |
| 354 | Banks selected by writing at 0x4180 */ | |
| 355 | 355 | ROM_LOAD("drpcjr_bios.bin", 0x10000, 0x8000, CRC(c8fbef89) SHA1(2cb0a817b31400cdf27817d09bae7e69f41b062b) ) // bios vers. 1.0a |
| 356 | 356 | // Not sure if we should support this: hacked version 1.5a by Chris Covell with bugfixes and GameGenie support |
| 357 | // | |
| 357 | // ROM_LOAD("drpcjr_v1_5_gg.bin", 0x10000, 0x8000, CRC(98f2033b) SHA1(93c114da787a19279d1a46667c2f69b49e25d4f1) ) | |
| 358 | 358 | |
| 359 | 359 | ROM_REGION( 0x2000, "gfx1", 0 ) /* VROM */ |
| 360 | 360 | ROM_FILL( 0x0000, 0x2000, 0x00 ) |
| r5931 | r5932 | |
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | static SYSTEM_CONFIG_START(famicom) | |
| 405 | static SYSTEM_CONFIG_START(famicom) | |
| 406 | 406 | CONFIG_DEVICE(famicom_floppy_getinfo) |
| 407 | 407 | SYSTEM_CONFIG_END |
| 408 | 408 |
| r5931 | r5932 | |
|---|---|---|
| 46 | 46 | { |
| 47 | 47 | vg230.rtc.seconds=00; |
| 48 | 48 | vg230.rtc.minutes+=1; |
| 49 | if (vg230.rtc.minutes>=60) | |
| 49 | if (vg230.rtc.minutes>=60) | |
| 50 | 50 | { |
| 51 | 51 | vg230.rtc.minutes=0; |
| 52 | 52 | vg230.rtc.hours+=1; |
| 53 | if (vg230.rtc.hours>=24) | |
| 53 | if (vg230.rtc.hours>=24) | |
| 54 | 54 | { |
| 55 | 55 | vg230.rtc.hours=0; |
| 56 | 56 | vg230.rtc.days=(vg230.rtc.days+1)&0xfff; |
| r5931 | r5932 | |
| 61 | 61 | if (vg230.rtc.seconds==vg230.rtc.alarm_seconds |
| 62 | 62 | && vg230.rtc.minutes==vg230.rtc.alarm_minutes |
| 63 | 63 | && vg230.rtc.hours==vg230.rtc.alarm_hours |
| 64 | && (vg230.rtc.days&0x1f)==vg230.rtc.alarm_hours) | |
| 64 | && (vg230.rtc.days&0x1f)==vg230.rtc.alarm_hours) | |
| 65 | 65 | { |
| 66 | 66 | // generate alarm |
| 67 | 67 | } |
| r5931 | r5932 | |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | mame_get_base_datetime(machine, &systime); |
| 80 | ||
| 80 | ||
| 81 | 81 | vg230.rtc.seconds= systime.local_time.second; |
| 82 | 82 | vg230.rtc.minutes= systime.local_time.minute; |
| 83 | 83 | vg230.rtc.hours = systime.local_time.hour; |
| r5931 | r5932 | |
| 97 | 97 | int log=TRUE; |
| 98 | 98 | UINT8 data=0; |
| 99 | 99 | vg230.bios_timer.data+=0x100; //HACK |
| 100 | if (offset&1) | |
| 100 | if (offset&1) | |
| 101 | 101 | { |
| 102 | 102 | data=vg230.data[vg230.index]; |
| 103 | switch (vg230.index) | |
| 103 | switch (vg230.index) | |
| 104 | 104 | { |
| 105 | 105 | case 0x09: break; |
| 106 | 106 | case 0x0a: |
| 107 | if (vg230.data[9]&1) | |
| 107 | if (vg230.data[9]&1) | |
| 108 | 108 | { |
| 109 | 109 | data=input_port_read(space->machine, "JOY"); |
| 110 | 110 | } |
| 111 | else | |
| 111 | else | |
| 112 | 112 | { |
| 113 | 113 | data=0xff; |
| 114 | 114 | } |
| r5931 | r5932 | |
| 145 | 145 | |
| 146 | 146 | if (log) |
| 147 | 147 | logerror("%.5x vg230 %02x read %.2x\n",(int) cpu_get_pc(space->cpu),vg230.index,data); |
| 148 | // data=memory_region(machine, "maincpu")[0x4000+offset]; | |
| 149 | } | |
| 150 | else | |
| 151 | { | |
| 148 | // data=memory_region(machine, "maincpu")[0x4000+offset]; | |
| 149 | } | |
| 150 | else | |
| 151 | { | |
| 152 | 152 | data=vg230.index; |
| 153 | 153 | } |
| 154 | 154 | return data; |
| r5931 | r5932 | |
| 157 | 157 | static WRITE8_HANDLER( vg230_io_w ) |
| 158 | 158 | { |
| 159 | 159 | int log=TRUE; |
| 160 | if (offset&1) | |
| 160 | if (offset&1) | |
| 161 | 161 | { |
| 162 | // | |
| 162 | // memory_region(machine, "maincpu")[0x4000+offset]=data; | |
| 163 | 163 | vg230.data[vg230.index]=data; |
| 164 | switch (vg230.index) | |
| 164 | switch (vg230.index) | |
| 165 | 165 | { |
| 166 | 166 | case 0x09: break; |
| 167 | 167 | case 0x70: vg230.rtc.seconds=data&0x3f; break; |
| r5931 | r5932 | |
| 180 | 180 | break; |
| 181 | 181 | |
| 182 | 182 | case 0x7a: |
| 183 | if (data&2) | |
| 184 | { | |
| 185 | vg230.rtc.alarm_interrupt_request=FALSE; vg230.rtc.onehertz_interrupt_request=FALSE; /* update interrupt */ | |
| 183 | if (data&2) | |
| 184 | { | |
| 185 | vg230.rtc.alarm_interrupt_request=FALSE; vg230.rtc.onehertz_interrupt_request=FALSE; /* update interrupt */ | |
| 186 | 186 | } |
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | ||
| 189 | ||
| 190 | 190 | if (log) |
| 191 | 191 | logerror("%.5x vg230 %02x write %.2x\n",(int)cpu_get_pc(space->cpu),vg230.index,data); |
| 192 | } | |
| 193 | else | |
| 192 | } | |
| 193 | else | |
| 194 | 194 | { |
| 195 | 195 | vg230.index=data; |
| 196 | 196 | } |
| r5931 | r5932 | |
| 210 | 210 | static READ8_HANDLER( ems_r ) |
| 211 | 211 | { |
| 212 | 212 | UINT8 data=0; |
| 213 | switch (offset) | |
| 213 | switch (offset) | |
| 214 | 214 | { |
| 215 | 215 | case 0: data=ems.data; break; |
| 216 | 216 | case 2: case 3: data=ems.mapper[ems.index].data[offset&1]; break; |
| r5931 | r5932 | |
| 220 | 220 | |
| 221 | 221 | static WRITE8_HANDLER( ems_w ) |
| 222 | 222 | { |
| 223 | switch (offset) | |
| 223 | switch (offset) | |
| 224 | 224 | { |
| 225 | 225 | case 0: |
| 226 | 226 | ems.data=data; |
| 227 | switch (data&~3) | |
| 227 | switch (data&~3) | |
| 228 | 228 | { |
| 229 | 229 | case 0x80: ems.index=0; break; |
| 230 | 230 | case 0x84: ems.index=1; break; |
| r5931 | r5932 | |
| 256 | 256 | case 0xec: ems.index=25; break; |
| 257 | 257 | } |
| 258 | 258 | break; |
| 259 | ||
| 259 | ||
| 260 | 260 | case 2: |
| 261 | 261 | case 3: |
| 262 | 262 | ems.mapper[ems.index].data[offset&1]=data; |
| r5931 | r5932 | |
| 265 | 265 | ems.mapper[ems.index].type=(ems.mapper[ems.index].data[1]&0x70)>>4; |
| 266 | 266 | logerror("%.5x ems mapper %d(%05x)on:%d type:%d address:%07x\n",(int)cpu_get_pc(space->cpu),ems.index, ems.data<<12, |
| 267 | 267 | ems.mapper[ems.index].on, ems.mapper[ems.index].type, ems.mapper[ems.index].address ); |
| 268 | switch (ems.mapper[ems.index].type) | |
| 268 | switch (ems.mapper[ems.index].type) | |
| 269 | 269 | { |
| 270 | case 0: /*external*/ | |
| 270 | case 0: /*external*/ | |
| 271 | 271 | case 1: /*ram*/ |
| 272 | 272 | memory_set_bankptr( space->machine, ems.index+1, memory_region(space->machine, "maincpu") + (ems.mapper[ems.index].address&0xfffff) ); |
| 273 | 273 | break; |
| r5931 | r5932 | |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | static ADDRESS_MAP_START( pasogo_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 288 | // AM_RANGE(0x00000, 0xfffff) AM_UNMAP AM_MASK(0xfffff) | |
| 289 | // AM_RANGE( 0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w) | |
| 288 | // AM_RANGE(0x00000, 0xfffff) AM_UNMAP AM_MASK(0xfffff) | |
| 289 | // AM_RANGE( 0x4000, 0x7fff) AM_READWRITE(gmaster_io_r, gmaster_io_w) | |
| 290 | 290 | ADDRESS_MAP_GLOBAL_MASK(0xffFFF) |
| 291 | 291 | AM_RANGE(0x00000, 0x7ffff) AM_RAM |
| 292 | 292 | AM_RANGE(0x80000, 0x83fff) AM_RAMBANK(1) |
| r5931 | r5932 | |
| 303 | 303 | AM_RANGE(0xac000, 0xaffff) AM_RAMBANK(12) |
| 304 | 304 | AM_RANGE(0xb0000, 0xb3fff) AM_RAMBANK(13) |
| 305 | 305 | AM_RANGE(0xb4000, 0xb7fff) AM_RAMBANK(14) |
| 306 | // | |
| 306 | // AM_RANGE(0xb8000, 0xbffff) AM_RAM | |
| 307 | 307 | AM_RANGE(0xb8000, 0xbffff) AM_RAMBANK(28) |
| 308 | 308 | AM_RANGE(0xc0000, 0xc3fff) AM_RAMBANK(15) |
| 309 | 309 | AM_RANGE(0xc4000, 0xc7fff) AM_RAMBANK(16) |
| r5931 | r5932 | |
| 322 | 322 | ADDRESS_MAP_END |
| 323 | 323 | |
| 324 | 324 | static ADDRESS_MAP_START(pasogo_io, ADDRESS_SPACE_IO, 8) |
| 325 | // | |
| 325 | // ADDRESS_MAP_GLOBAL_MASK(0xfFFF) | |
| 326 | 326 | AM_RANGE(0x0020, 0x0021) AM_DEVREADWRITE("pic8259", pic8259_r, pic8259_w) |
| 327 | 327 | AM_RANGE(0x26, 0x27) AM_READWRITE(vg230_io_r, vg230_io_w ) |
| 328 | 328 | AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8254", pit8253_r, pit8253_w) |
| r5931 | r5932 | |
| 331 | 331 | |
| 332 | 332 | static INPUT_PORTS_START( pasogo ) |
| 333 | 333 | PORT_START("JOY") |
| 334 | // PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("select") | |
| 335 | // PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start") | |
| 334 | // PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SELECT) PORT_NAME("select") | |
| 335 | // PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("start") | |
| 336 | 336 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("O") /*?*/ |
| 337 | 337 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("X") /*?*/ |
| 338 | 338 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| r5931 | r5932 | |
| 356 | 356 | { |
| 357 | 357 | int i; |
| 358 | 358 | |
| 359 | for ( i = 0; i < ARRAY_LENGTH(pasogo_palette); i++ ) | |
| 359 | for ( i = 0; i < ARRAY_LENGTH(pasogo_palette); i++ ) | |
| 360 | 360 | { |
| 361 | 361 | palette_set_color_rgb(machine, i, pasogo_palette[i][0], pasogo_palette[i][1], pasogo_palette[i][2]); |
| 362 | 362 | } |
| r5931 | r5932 | |
| 368 | 368 | UINT8 *rom = memory_region(screen->machine, "maincpu")+0xb8000; |
| 369 | 369 | UINT16 c[]={ 3, 0 }; |
| 370 | 370 | int x,y; |
| 371 | // | |
| 371 | // plot_box(bitmap, 0, 0, 64/*bitmap->width*/, bitmap->height, 0); | |
| 372 | 372 | int w=640; |
| 373 | 373 | int h=240; |
| 374 | if (0) | |
| 374 | if (0) | |
| 375 | 375 | { |
| 376 | 376 | w=320; |
| 377 | 377 | h=240; |
| 378 | for (y=0;y<h; y++) | |
| 378 | for (y=0;y<h; y++) | |
| 379 | 379 | { |
| 380 | for (x=0;x<w;x+=4) | |
| 380 | for (x=0;x<w;x+=4) | |
| 381 | 381 | { |
| 382 | 382 | int a=(y&1)*0x2000; |
| 383 | 383 | UINT8 d=rom[a+(y&~1)*80/2+x/4]; |
| r5931 | r5932 | |
| 388 | 388 | *line++=(d>>0)&3; |
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | } | |
| 392 | else | |
| 391 | } | |
| 392 | else | |
| 393 | 393 | { |
| 394 | for (y=0;y<h; y++) | |
| 394 | for (y=0;y<h; y++) | |
| 395 | 395 | { |
| 396 | for (x=0;x<w;x+=8) | |
| 396 | for (x=0;x<w;x+=8) | |
| 397 | 397 | { |
| 398 | 398 | int a=(y&3)*0x2000; |
| 399 | 399 | UINT8 d=rom[a+(y&~3)*80/4+x/8]; |
| r5931 | r5932 | |
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | if (w!=width || h!=height) | |
| 412 | if (w!=width || h!=height) | |
| 413 | 413 | { |
| 414 | 414 | width=w; height=h; |
| 415 | // | |
| 415 | // video_screen_set_visarea(machine->primary_screen, 0, width-1, 0, height-1); | |
| 416 | 416 | video_screen_set_visarea(screen, 0, width-1, 0, height-1); |
| 417 | 417 | } |
| 418 | 418 | return 0; |
| r5931 | r5932 | |
| 420 | 420 | |
| 421 | 421 | static INTERRUPT_GEN( pasogo_interrupt ) |
| 422 | 422 | { |
| 423 | // | |
| 423 | // cputag_set_input_line(machine, "maincpu", UPD7810_INTFE1, PULSE_LINE); | |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | static IRQ_CALLBACK(pasogo_irq_callback) |
| r5931 | r5932 | |
| 457 | 457 | }; |
| 458 | 458 | |
| 459 | 459 | |
| 460 | static PIC8259_SET_INT_LINE( pasogo_pic8259_set_int_line ) | |
| 460 | static PIC8259_SET_INT_LINE( pasogo_pic8259_set_int_line ) | |
| 461 | 461 | { |
| 462 | 462 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? HOLD_LINE : CLEAR_LINE); |
| 463 | 463 | } |
| r5931 | r5932 | |
| 487 | 487 | MDRV_CPU_PROGRAM_MAP(pasogo_mem) |
| 488 | 488 | MDRV_CPU_IO_MAP( pasogo_io) |
| 489 | 489 | MDRV_CPU_VBLANK_INT("screen", pasogo_interrupt) |
| 490 | // | |
| 490 | // MDRV_CPU_CONFIG(i86_address_mask) | |
| 491 | 491 | MDRV_MACHINE_RESET( pasogo ) |
| 492 | 492 | |
| 493 | 493 | MDRV_PIT8254_ADD( "pit8254", pc_pit8254_config ) |
| r5931 | r5932 | |
| 518 | 518 | |
| 519 | 519 | ROM_START(pasogo) |
| 520 | 520 | ROM_REGION(0x100000,"maincpu", ROMREGION_ERASEFF) // 1 megabyte dram? |
| 521 | // ROM_LOAD("gmaster.bin", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) ) | |
| 522 | // ROM_CART_LOAD(0, "bin", 0x8000, 0x8000, 0) | |
| 521 | // ROM_LOAD("gmaster.bin", 0x0000, 0x1000, CRC(05cc45e5) SHA1(05d73638dea9657ccc2791c0202d9074a4782c1e) ) | |
| 522 | // ROM_CART_LOAD(0, "bin", 0x8000, 0x8000, 0) | |
| 523 | 523 | ROM_REGION(0x100000,"user1", ROMREGION_ERASEFF) |
| 524 | 524 | ROM_END |
| 525 | 525 | |
| r5931 | r5932 | |
| 532 | 532 | memory_set_bankptr( machine, 28, memory_region(machine, "maincpu") + 0xb8000/*?*/ ); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | /* YEAR NAME PARENT MACHINE INPUT INIT | |
| 536 | COMPANY FULLNAME */ | |
| 535 | /* YEAR NAME PARENT MACHINE INPUT INIT | |
| 536 | COMPANY FULLNAME */ | |
| 537 | 537 | CONS( 1996, pasogo, 0, 0, pasogo, pasogo, pasogo, 0, "KOEI", "PasoGo", GAME_NO_SOUND|GAME_NOT_WORKING) |
| 538 | 538 |
| r5931 | r5932 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | 13 | |
| 14 | 2008 - Driver Updates | |
| 14 | 2008 - Driver Updates | |
| 15 | 15 | --------------------- |
| 16 | 16 | |
| 17 | 17 | (most of the informations are taken from http://www.zimmers.net/cbmpics/ ) |
| r5931 | r5932 | |
| 28 | 28 | CPU: MOS Technology 6502 (1.01 MHz) |
| 29 | 29 | RAM: 5 kilobytes (Expanded to 21k though an external 16k unit) |
| 30 | 30 | ROM: 20 kilobytes |
| 31 | Video: MOS Technology 6560 "VIC"(Text: 22 columns, 23 rows; Hires: 176x184 | |
| 31 | Video: MOS Technology 6560 "VIC"(Text: 22 columns, 23 rows; Hires: 176x184 | |
| 32 | 32 | pixels bitmapped; 8 text colors, 16 background colors) |
| 33 | 33 | Sound: MOS Technology 6560 "VIC" (3 voices -square wave-, noise and volume) |
| 34 | 34 | Ports: 6522 VIA x2 (1 Joystick/Mouse port; CBM Serial port; 'Cartridge / |
| 35 | Game / Expansion' port; CBM Monitor port; CBM 'USER' port; Power and | |
| 36 | reset switches; Power connector) | |
| 37 | Keyboard: Full-sized QWERTY 66 key (8 programmable function keys; 2 sets of | |
| 38 | Keyboardable graphic characters; 2 key direction cursor-pad) | |
| 39 | ||
| 35 | Game / Expansion' port; CBM Monitor port; CBM 'USER' port; Power and | |
| 36 | reset switches; Power connector) | |
| 37 | Keyboard: Full-sized QWERTY 66 key (8 programmable function keys; 2 sets of | |
| 38 | Keyboardable graphic characters; 2 key direction cursor-pad) | |
| 40 | 39 | |
| 40 | ||
| 41 | 41 | * VIC 20 (1981) |
| 42 | 42 | |
| 43 | This system was the first computer to sell more than one million units | |
| 44 | worldwide. It was sold both in Europe and in the US. In Germany the | |
| 43 | This system was the first computer to sell more than one million units | |
| 44 | worldwide. It was sold both in Europe and in the US. In Germany the | |
| 45 | 45 | computer was renamed as VC 20 (apparently, it stands for 'VolksComputer' |
| 46 | 46 | |
| 47 | 47 | CPU: MOS Technology 6502A (1.01 MHz) |
| 48 | 48 | RAM: 5 kilobytes (Expanded to 32k) |
| 49 | 49 | ROM: 20 kilobytes |
| 50 | Video: MOS Technology 6560 "VIC"(Text: 22 columns, 23 rows; Hires: 176x184 | |
| 50 | Video: MOS Technology 6560 "VIC"(Text: 22 columns, 23 rows; Hires: 176x184 | |
| 51 | 51 | pixels bitmapped; 8 text colors, 16 background colors) |
| 52 | 52 | Sound: MOS Technology 6560 "VIC" (3 voices -square wave-, noise and volume) |
| 53 | 53 | Ports: 6522 VIA x2 (1 Joystick/Mouse port; CBM Serial port; 'Cartridge / |
| 54 | Game / Expansion' port; CBM Monitor port; CBM 'USER' port; Power and | |
| 55 | reset switches; Power connector) | |
| 56 | Keyboard: Full-sized QWERTY 66 key (8 programmable function keys; 2 sets of | |
| 57 | Keyboardable graphic characters; 2 key direction cursor-pad) | |
| 54 | Game / Expansion' port; CBM Monitor port; CBM 'USER' port; Power and | |
| 55 | reset switches; Power connector) | |
| 56 | Keyboard: Full-sized QWERTY 66 key (8 programmable function keys; 2 sets of | |
| 57 | Keyboardable graphic characters; 2 key direction cursor-pad) | |
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | * VIC 21 (1983) |
| 61 | 61 | |
| 62 | It consists of a VIC 20 with built-in RAM expansion, to reach a RAM | |
| 62 | It consists of a VIC 20 with built-in RAM expansion, to reach a RAM | |
| 63 | 63 | capability of 21 kilobytes. |
| 64 | 64 | |
| 65 | 65 | |
| r5931 | r5932 | |
| 76 | 76 | |
| 77 | 77 | * Timer system only 98% accurate |
| 78 | 78 | |
| 79 | * No support for printer or other devices; no userport; no rs232/v.24 | |
| 79 | * No support for printer or other devices; no userport; no rs232/v.24 | |
| 80 | 80 | interface; no special expansion modules like ieee488 interface |
| 81 | ||
| 81 | ||
| 82 | 82 | */ |
| 83 | 83 | |
| 84 | 84 | |
| r5931 | r5932 | |
| 152 | 152 | * |
| 153 | 153 | *************************************/ |
| 154 | 154 | |
| 155 | /* 2008-05 FP: These lightpen input ports, would better | |
| 156 | fit machine/cbmipt.c but PORT_MINMAX requires vic6560.c | |
| 155 | /* 2008-05 FP: These lightpen input ports, would better | |
| 156 | fit machine/cbmipt.c but PORT_MINMAX requires vic6560.c | |
| 157 | 157 | constants. Therefore, they will stay here, atm */ |
| 158 | 158 | |
| 159 | 159 | static INPUT_PORTS_START( vic_lightpen_6560 ) |
| r5931 | r5932 | |
| 180 | 180 | PORT_INCLUDE( vic_special ) /* SPECIAL */ |
| 181 | 181 | |
| 182 | 182 | PORT_INCLUDE( vic_controls ) /* JOY, PADDLE0, PADDLE1 */ |
| 183 | ||
| 183 | ||
| 184 | 184 | /* Lightpen 6560 */ |
| 185 | 185 | PORT_INCLUDE( vic_lightpen_6560 ) /* LIGHTX, LIGHTY */ |
| 186 | 186 | |
| r5931 | r5932 | |
| 202 | 202 | PORT_INCLUDE( vic_special ) /* SPECIAL */ |
| 203 | 203 | |
| 204 | 204 | PORT_INCLUDE( vic_controls ) /* JOY, PADDLE0, PADDLE1 */ |
| 205 | ||
| 205 | ||
| 206 | 206 | /* Lightpen 6561 */ |
| 207 | 207 | PORT_INCLUDE( vic_lightpen_6561 ) /* LIGHTX, LIGHTY */ |
| 208 | 208 | |
| r5931 | r5932 | |
| 217 | 217 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2) PORT_CHAR(':') PORT_CHAR('*') |
| 218 | 218 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') |
| 219 | 219 | PORT_MODIFY( "ROW1" ) |
| 220 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') | |
| 220 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('@') | |
| 221 | 221 | PORT_MODIFY( "ROW2" ) |
| 222 | 222 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(0x00C4) |
| 223 | 223 | PORT_MODIFY( "ROW5" ) |
| r5931 | r5932 | |
| 300 | 300 | MDRV_VIA6522_ADD("via6522_1", 0, vc20_via1) |
| 301 | 301 | MDRV_VIA6522_ADD("via6522_2", 0, vc20_via2) |
| 302 | 302 | MDRV_VIA6522_ADD("via6522_3", 0, vc20_via3) |
| 303 | ||
| 303 | ||
| 304 | 304 | MDRV_IMPORT_FROM(vic20_cartslot) |
| 305 | 305 | MACHINE_DRIVER_END |
| 306 | 306 |
| r5931 | r5932 | |
|---|---|---|
| 258 | 258 | |
| 259 | 259 | /*************************************************************************** |
| 260 | 260 | |
| 261 | ||
| 261 | Game driver(s) | |
| 262 | 262 | |
| 263 | 263 | ***************************************************************************/ |
| 264 | 264 |
| r5931 | r5932 | |
|---|---|---|
| 9 | 9 | |
| 10 | 10 | /* |
| 11 | 11 | |
| 12 | 2008 - Driver Updates | |
| 12 | 2008 - Driver Updates | |
| 13 | 13 | --------------------- |
| 14 | 14 | |
| 15 | 15 | (most of the informations are taken from http://www.zimmers.net/cbmpics/ ) |
| r5931 | r5932 | |
| 19 | 19 | |
| 20 | 20 | * Commodore Max Machine (1982, Japan) |
| 21 | 21 | |
| 22 | The Max Machine was produced by Commodore Japan and was released along | |
| 23 | with the C64 in Japan. Also known as "UltiMax" (in North America ads) | |
| 24 | or "VC-10 / VIC-10" (in some European advertising), it was designed to be a | |
| 25 | game console. It has no internal kernel and no BASIC, everything must be | |
| 26 | supplied by the cart. A Mini BASIC and a BASIC carts were produced (the | |
| 27 | latter with support for LOAD/SAVE commands as well). The character rom | |
| 22 | The Max Machine was produced by Commodore Japan and was released along | |
| 23 | with the C64 in Japan. Also known as "UltiMax" (in North America ads) | |
| 24 | or "VC-10 / VIC-10" (in some European advertising), it was designed to be a | |
| 25 | game console. It has no internal kernel and no BASIC, everything must be | |
| 26 | supplied by the cart. A Mini BASIC and a BASIC carts were produced (the | |
| 27 | latter with support for LOAD/SAVE commands as well). The character rom | |
| 28 | 28 | is not present either and its content was, again, in the cart. Max Machine |
| 29 | 29 | carts can be run by both C64 and C128. |
| 30 | 30 | |
| 31 | 31 | CPU: MOS Technology 6510 (1 MHz) |
| 32 | 32 | RAM: 4 kilobytes (2 kilobytes?) |
| 33 | 33 | ROM: none |
| 34 | Video: MOS 6566 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 35 | colors) | |
| 36 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 37 | capabilities) | |
| 38 | Ports: 6526 CIA (Power switch; 2 Commodore "Joystick" ports; 'EXPANSION' | |
| 39 | port; "TV" port; CBM Datasette port) | |
| 34 | Video: MOS 6566 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 35 | colors) | |
| 36 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 37 | capabilities) | |
| 38 | Ports: 6526 CIA (Power switch; 2 Commodore "Joystick" ports; 'EXPANSION' | |
| 39 | port; "TV" port; CBM Datasette port) | |
| 40 | 40 | Keyboard: Full-sized QWERTY "Contact-Pad" |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | * Commodore 64 (1982) |
| 44 | 44 | |
| 45 | Released in August 1982 in the US and marketed as a lower end home | |
| 45 | Released in August 1982 in the US and marketed as a lower end home | |
| 46 | 46 | computer, the C64 dominated the home computer market for a few years, |
| 47 | 47 | outselling competitors like Apple computers, IBM PCs and TRS-80s. |
| 48 | During the early stages of the project it was called VIC-40, but the | |
| 48 | During the early stages of the project it was called VIC-40, but the | |
| 49 | 49 | named was changed in the end probably to fit the name scheme used at |
| 50 | 50 | time for business product (letter + memory size: P128 & B256). |
| 51 | 51 | It was also advertised as VC 64 in Germany, and as VIC 64S in Sweden |
| r5931 | r5932 | |
| 54 | 54 | CPU: CSG 6510 (1 MHz) |
| 55 | 55 | RAM: 64 kilobytes |
| 56 | 56 | ROM: 20 kilobytes |
| 57 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 58 | colors) | |
| 59 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 60 | capabilities) | |
| 61 | Ports: MOS 6526 CIA x2 (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 62 | CBM Serial port; CBM Datasette port; parallel programmable "User" | |
| 63 | port; CBM Monitor port; C64 expansion port) | |
| 57 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 58 | colors) | |
| 59 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 60 | capabilities) | |
| 61 | Ports: MOS 6526 CIA x2 (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 62 | CBM Serial port; CBM Datasette port; parallel programmable "User" | |
| 63 | port; CBM Monitor port; C64 expansion port) | |
| 64 | 64 | Keyboard: Full-sized 62 key QWERTY (8 programmable function keys; 2 |
| 65 | ||
| 65 | cursor keys, 2 directions each) | |
| 66 | 66 | |
| 67 | 67 | BIOS: |
| 68 | kernal.901227-02.bin | |
| 69 | basic.901226-01.bin | |
| 70 | characters.901225-01.bin | |
| 68 | kernal.901227-02.bin | |
| 69 | basic.901226-01.bin | |
| 70 | characters.901225-01.bin | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | * Commodore 64 (1982, Japan) |
| 74 | 74 | |
| 75 | Released in Japan at the same time as Max Machine, in the hope to repeat | |
| 76 | the success of the VIC-1001, this system was a flop. Technically it is the | |
| 75 | Released in Japan at the same time as Max Machine, in the hope to repeat | |
| 76 | the success of the VIC-1001, this system was a flop. Technically it is the | |
| 77 | 77 | same as the C64, but it has native support for the Katakana character set. |
| 78 | 78 | |
| 79 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 80 | colors) | |
| 79 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 80 | colors) | |
| 81 | 81 | Keyboard: Full-sized 62 key QWERTY (8 programmable function keys; 2 |
| 82 | cursor keys, 2 directions each; Katakana characters accessible through | |
| 83 | C= key) | |
| 82 | cursor keys, 2 directions each; Katakana characters accessible through | |
| 83 | C= key) | |
| 84 | 84 | |
| 85 | 85 | BIOS |
| 86 | kernal.906145-02.bin | |
| 87 | basic.901226-01.bin | |
| 88 | characters.906143-02.bin | |
| 86 | kernal.906145-02.bin | |
| 87 | basic.901226-01.bin | |
| 88 | characters.906143-02.bin | |
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | * PET 64 (1983) |
| 92 | 92 | |
| 93 | Also known as CBM 4064, it was a C64 fitted in a PET case and with a PET | |
| 93 | Also known as CBM 4064, it was a C64 fitted in a PET case and with a PET | |
| 94 | 94 | monochrome screen. Exactly like the C64, it features a VIC-II video chip, |
| 95 | a SID sound chip, 2 x CIA 6526, 64K of memory and BASIC 2.0. Being forced | |
| 96 | to display on a monochrome screen, color codes were removed from the front | |
| 97 | of number keys. The kernel itself was modified to output only white | |
| 98 | characters on a black background. A plate with BASIC commands and other hints | |
| 95 | a SID sound chip, 2 x CIA 6526, 64K of memory and BASIC 2.0. Being forced | |
| 96 | to display on a monochrome screen, color codes were removed from the front | |
| 97 | of number keys. The kernel itself was modified to output only white | |
| 98 | characters on a black background. A plate with BASIC commands and other hints | |
| 99 | 99 | was put above the keyboard. |
| 100 | 100 | |
| 101 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 102 | colors, monochrome 14" monitor support) | |
| 103 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 104 | capabilities; Internal speaker) | |
| 101 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 102 | colors, monochrome 14" monitor support) | |
| 103 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 104 | capabilities; Internal speaker) | |
| 105 | 105 | Keyboard: Full-sized 62 key QWERTY (8 programmable function keys; 2 |
| 106 | cursor keys, 2 directions each; complete BASIC reference on keyboard | |
| 107 | panel ) | |
| 106 | cursor keys, 2 directions each; complete BASIC reference on keyboard | |
| 107 | panel ) | |
| 108 | 108 | |
| 109 | 109 | BIOS |
| 110 | kernal.4064.901246-01.bin | |
| 111 | basic.901226-01.bin | |
| 112 | characters.901225-01.bin | |
| 110 | kernal.4064.901246-01.bin | |
| 111 | basic.901226-01.bin | |
| 112 | characters.901225-01.bin | |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | * Educator 64 (1983) |
| 116 | 116 | |
| 117 | Basically the same as the PET 64, but it uses a standard C64 kernel, | |
| 118 | allowing to 'explore' all shades of green the monitor was capable of. Also | |
| 119 | the BASIC plate is slightly different. There could have been an earlier | |
| 120 | version, already called Educator 64, which came with no monitor and in a | |
| 117 | Basically the same as the PET 64, but it uses a standard C64 kernel, | |
| 118 | allowing to 'explore' all shades of green the monitor was capable of. Also | |
| 119 | the BASIC plate is slightly different. There could have been an earlier | |
| 120 | version, already called Educator 64, which came with no monitor and in a | |
| 121 | 121 | C64 case. |
| 122 | 122 | |
| 123 | 123 | Keyboard: Full-sized 62 key QWERTY (8 programmable function keys; 2 |
| 124 | cursor keys, 2 directions each; complete BASIC reference on keyboard | |
| 125 | panel ) | |
| 124 | cursor keys, 2 directions each; complete BASIC reference on keyboard | |
| 125 | panel ) | |
| 126 | 126 | |
| 127 | 127 | BIOS |
| 128 | kernal.901227-02.bin | |
| 129 | basic.901226-01.bin | |
| 130 | characters.901225-01.bin | |
| 128 | kernal.901227-02.bin | |
| 129 | basic.901226-01.bin | |
| 130 | characters.901225-01.bin | |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | * SX-64 Executive Computer (1984) |
| 134 | 134 | |
| 135 | Portable color computer based on the C64 hardware. The unit is heavy, with | |
| 136 | its metal case, features a built-in disk driver (mostly 1541 compatible) and | |
| 137 | has a large handle to carry the computer around. The detachable keyboard can | |
| 135 | Portable color computer based on the C64 hardware. The unit is heavy, with | |
| 136 | its metal case, features a built-in disk driver (mostly 1541 compatible) and | |
| 137 | has a large handle to carry the computer around. The detachable keyboard can | |
| 138 | 138 | be used as protective front plate. The SX-64 had a 4" full color screen and a |
| 139 | built-in speaker. The only differences between the C64 and the SX-64 are in | |
| 139 | built-in speaker. The only differences between the C64 and the SX-64 are in | |
| 140 | 140 | the start up colors and in the SX-64 better support for the internal floppy |
| 141 | 141 | drive. The tape drive support was removed in the portable system. |
| 142 | 142 | |
| 143 | 143 | CPU: MOS 6510 (1 MHz) |
| 144 | 144 | RAM: 64 kilobytes (68 with the 1541) |
| 145 | 145 | ROM: 20 kilobytes (36 with the 1541) |
| 146 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 147 | colors, 4" Full-color screen) | |
| 148 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 149 | capabilities; Internal MONO speaker) | |
| 150 | Ports: MOS 6526 CIA x2 (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 151 | CBM Serial port; CBM Datasette port; parallel programmable "User" | |
| 152 | port; CBM Monitor port; C64 expansion port) | |
| 146 | Video: MOS 6569 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 147 | colors, 4" Full-color screen) | |
| 148 | Sound: MOS 6581 "SID" (3 voice stereo synthesizer/digital sound | |
| 149 | capabilities; Internal MONO speaker) | |
| 150 | Ports: MOS 6526 CIA x2 (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 151 | CBM Serial port; CBM Datasette port; parallel programmable "User" | |
| 152 | port; CBM Monitor port; C64 expansion port) | |
| 153 | 153 | Keyboard: Full-sized 62 key QWERTY (8 programmable function keys; 2 |
| 154 | ||
| 154 | cursor keys, 2 directions each; detachable) | |
| 155 | 155 | Additional hardware: Commodore 1541 Disk Drive (5.25" 170K SS SD Floppy) |
| 156 | 156 | |
| 157 | 157 | BIOS: |
| 158 | kernal.sx.251104-04.bin | |
| 159 | basic.901226-01.bin | |
| 160 | characters.901225-01.bin | |
| 158 | kernal.sx.251104-04.bin | |
| 159 | basic.901226-01.bin | |
| 160 | characters.901225-01.bin | |
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | * DX-64 (198?) |
| r5931 | r5932 | |
| 169 | 169 | * Commodore 64C (1986) |
| 170 | 170 | |
| 171 | 171 | Redesigned version of the C64, released with slightly upgraded versions |
| 172 | of chips and peripherals. It came often bundled with GEOS, GUI based OS | |
| 172 | of chips and peripherals. It came often bundled with GEOS, GUI based OS | |
| 173 | 173 | by Berkeley Softworks (it was stored on floppy disks). It's also known as |
| 174 | 174 | C64-II but the name doesn't seems to have ever been official (only used |
| 175 | by magazines at early stage of ad & review). Another redesign, in a slightly | |
| 176 | larger case (closer to the original C64) is known as Commodore 64G, because | |
| 177 | mainly sold in Germany. Other repackaged versions followed, built around the | |
| 175 | by magazines at early stage of ad & review). Another redesign, in a slightly | |
| 176 | larger case (closer to the original C64) is known as Commodore 64G, because | |
| 177 | mainly sold in Germany. Other repackaged versions followed, built around the | |
| 178 | 178 | same kernel and chips. |
| 179 | 179 | |
| 180 | 180 | CPU: CSG 8500 (1 MHz; 6510 compatible) |
| 181 | 181 | RAM: 64 kilobytes |
| 182 | 182 | ROM: 20 kilobytes |
| 183 | Video: MOS 8565 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 184 | colors) | |
| 185 | Sound: CSG 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 186 | capabilities) | |
| 187 | Ports: MOS 6526 CIA x2 (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 188 | CBM Serial port; CBM Datasette port; parallel programmable "User" | |
| 189 | port; CBM Monitor port; C64 expansion port) | |
| 183 | Video: MOS 8565 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 184 | colors) | |
| 185 | Sound: CSG 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 186 | capabilities) | |
| 187 | Ports: MOS 6526 CIA x2 (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 188 | CBM Serial port; CBM Datasette port; parallel programmable "User" | |
| 189 | port; CBM Monitor port; C64 expansion port) | |
| 190 | 190 | Keyboard: Full-sized 62 key QWERTY (8 programmable function keys; 2 |
| 191 | ||
| 191 | cursor keys, 2 directions each) | |
| 192 | 192 | |
| 193 | 193 | BIOS: |
| 194 | 64c.251913-01.bin | |
| 195 | characters.901225-01.bin | |
| 194 | 64c.251913-01.bin | |
| 195 | characters.901225-01.bin | |
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | * Commodore 64 Games System (1990) |
| r5931 | r5932 | |
| 203 | 203 | CPU: CSG 6510 (1 MHz) |
| 204 | 204 | RAM: 64 kilobytes |
| 205 | 205 | ROM: 16 kilobytes |
| 206 | Video: MOS 8565 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 207 | colors) | |
| 208 | Sound: CSG 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 209 | capabilities) | |
| 210 | Ports: MOS 6526 CIA (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 211 | CBM Monitor port; C64 expansion port) | |
| 206 | Video: MOS 8565 "VIC-II" (320 x 200 Hi-Resolution, 40 columns text, 16 | |
| 207 | colors) | |
| 208 | Sound: CSG 8580 "SID" (3 voice stereo synthesizer/digital sound | |
| 209 | capabilities) | |
| 210 | Ports: MOS 6526 CIA (Power switch; 2 Commodore Joystick/Mouse ports; | |
| 211 | CBM Monitor port; C64 expansion port) | |
| 212 | 212 | |
| 213 | 213 | BIOS: |
| 214 | 64gs.390852-01.bin | |
| 215 | characters.901225-01.bin | |
| 214 | 64gs.390852-01.bin | |
| 215 | characters.901225-01.bin | |
| 216 | 216 | |
| 217 | 217 | * Commodore 64 "Gold" (1984, US - 1986, Germany) |
| 218 | 218 | |
| 219 | Commemorative version released to celebrate the one millionth Commodore 64 | |
| 220 | sold in the country. The whole case is golden colored. It is also reasonable | |
| 221 | to assume that the US version is based on the original C64, while the German | |
| 219 | Commemorative version released to celebrate the one millionth Commodore 64 | |
| 220 | sold in the country. The whole case is golden colored. It is also reasonable | |
| 221 | to assume that the US version is based on the original C64, while the German | |
| 222 | 222 | version is based on the C64C. |
| 223 | 223 | |
| 224 | 224 | |
| r5931 | r5932 | |
| 231 | 231 | |
| 232 | 232 | [Known Fake / Unofficial BIOS] |
| 233 | 233 | |
| 234 | Max Machine - These are BASIC V2.0 and kernel contained in the MAX BASIC | |
| 235 | cart, not a real Max BIOS. | |
| 236 | basic.901230-01.bin | |
| 237 | kernal.901231-01.bin | |
| 238 | ||
| 234 | Max Machine - These are BASIC V2.0 and kernel contained in the MAX BASIC | |
| 235 | cart, not a real Max BIOS. | |
| 236 | basic.901230-01.bin | |
| 237 | kernal.901231-01.bin | |
| 238 | ||
| 239 | 239 | Character roms |
| 240 | c64-german.bin - amateur hack | |
| 241 | c64-hungarian.bin - amateur hack | |
| 242 | kauno.bin - calligraphic font for the C64, data saved from a 1985 tape | |
| 240 | c64-german.bin - amateur hack | |
| 241 | c64-hungarian.bin - amateur hack | |
| 242 | kauno.bin - calligraphic font for the C64, data saved from a 1985 tape | |
| 243 | 243 | |
| 244 | 244 | [Peripherals] |
| 245 | 245 | |
| r5931 | r5932 | |
| 259 | 259 | - Commodore Joysticks |
| 260 | 260 | - Commodore Paddles |
| 261 | 261 | - Commodore 1350 / 1351 Mouse |
| 262 | - CMD SmartMouse | |
| 262 | - CMD SmartMouse | |
| 263 | 263 | - Inkwell Light Pen |
| 264 | 264 | - Koala Pad |
| 265 | 265 | - Commodore Music Maker overlay |
| 266 | 266 | - External music keyboard (to be plugged into the Sound Expander) |
| 267 | 267 | |
| 268 | 268 | - Commodore REU: REU stands for RAM Expansion Unit for C64 & C128. Three |
| 269 | models 1700 (128 KB) and 1750 (512 KB), and later the 1764 (256 KB, for the | |
| 269 | models 1700 (128 KB) and 1750 (512 KB), and later the 1764 (256 KB, for the | |
| 270 | 270 | C64) |
| 271 | 271 | - Commodore Sound Expander Cart |
| 272 | 272 | - Commodore Sound Sampler Cart |
| r5931 | r5932 | |
| 274 | 274 | - Schnedler Systems Turbo Master CPU |
| 275 | 275 | - Creative Micro Designs (CMD) RAMDrive, RAMLink and Super CPU Accelerator |
| 276 | 276 | - CMD SID symphony cartridge |
| 277 | - Commodore Universal Btx Decoder: Same design of the REU, it's a decoder | |
| 277 | - Commodore Universal Btx Decoder: Same design of the REU, it's a decoder | |
| 278 | 278 | for the Bildschirmtext, a sort of videotext online service similar to the |
| 279 | 279 | French Minitel. It allowed the C64 + Decoder to replace the very expensive |
| 280 | 280 | standalone decoder. |
| 281 | 281 | |
| 282 | Freezer Carts: Datel "Action Replay", Freeze Frame MK III B, Trilogic | |
| 282 | Freezer Carts: Datel "Action Replay", Freeze Frame MK III B, Trilogic | |
| 283 | 283 | "Expert", "The Final Cartridge III", "Retro Replay" |
| 284 | 284 | Kernal Replacement: SpeedDOS, DolphinDOS, JiffyDOS etc. |
| 285 | 285 | |
| r5931 | r5932 | |
| 292 | 292 | |
| 293 | 293 | * Cartridges: |
| 294 | 294 | |
| 295 | - Currently only Type 0 hardware is supported (check cart code in | |
| 295 | - Currently only Type 0 hardware is supported (check cart code in | |
| 296 | 296 | machine/c64.c for more notes). Other Types may load but not work. |
| 297 | 297 | |
| 298 | 298 | * Datasette: |
| 299 | 299 | |
| 300 | - Currently, .t64 images are supported as Quickload device. This only works | |
| 301 | if the file contains a single entry with a start address of $0801. This | |
| 302 | covers most of the existing files, but the format is desinged to be much | |
| 300 | - Currently, .t64 images are supported as Quickload device. This only works | |
| 301 | if the file contains a single entry with a start address of $0801. This | |
| 302 | covers most of the existing files, but the format is desinged to be much | |
| 303 | 303 | more flexible and it could be implemented as a real tape format. |
| 304 | 304 | |
| 305 | 305 | * Other Peripherals: |
| r5931 | r5932 | |
| 312 | 312 | |
| 313 | 313 | * Informations / BIOS / Supported Sets: |
| 314 | 314 | |
| 315 | - Find out if C64 was sold both as VIC 64S and C64 in Sweden, and which | |
| 315 | - Find out if C64 was sold both as VIC 64S and C64 in Sweden, and which | |
| 316 | 316 | were inner/outer differences. For sure advertising was using the VIC 64S |
| 317 | 317 | name. |
| 318 | 318 | - Was it really sold as VC 64 in Germany, or was it just a nickname used |
| 319 | 319 | at launch to indicate standard C64 units? |
| 320 | - What's the difference between Educator 64-1 and Educator 64-2? My guess | |
| 321 | is that Edu64-1 was a standard PET64/CBMB4064 with a different name, while | |
| 320 | - What's the difference between Educator 64-1 and Educator 64-2? My guess | |
| 321 | is that Edu64-1 was a standard PET64/CBMB4064 with a different name, while | |
| 322 | 322 | the Edu64-1 used the full C64 BIOS. Confirmations are needed, anyway. |
| 323 | 323 | */ |
| 324 | 324 | |
| r5931 | r5932 | |
| 382 | 382 | |
| 383 | 383 | static INPUT_PORTS_START (c64gs) |
| 384 | 384 | PORT_INCLUDE( c64 ) |
| 385 | ||
| 385 | ||
| 386 | 386 | /* 2008 FP: This has to be cleaned up later */ |
| 387 | 387 | /* C64gs should simply not scan these inputs */ |
| 388 | 388 | /* as a temporary solution, we keep PeT IPT_UNUSED shortcut */ |
| r5931 | r5932 | |
| 561 | 561 | /* cia */ |
| 562 | 562 | MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6569_CLOCK, c64_pal_cia0) |
| 563 | 563 | MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6569_CLOCK, c64_pal_cia1) |
| 564 | ||
| 564 | ||
| 565 | 565 | /* floppy from serial bus */ |
| 566 | 566 | MDRV_IMPORT_FROM(simulated_drive) |
| 567 | 567 | |
| r5931 | r5932 | |
| 577 | 577 | MDRV_SOUND_REPLACE("sid6581", SID6581, VIC6567_CLOCK) |
| 578 | 578 | MDRV_SOUND_CONFIG(c64_sound_interface) |
| 579 | 579 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 580 | ||
| 580 | ||
| 581 | 581 | MDRV_DEVICE_REMOVE("serial_bus") // in the current code, serial bus device is tied to the floppy drive |
| 582 | 582 | MDRV_DEVICE_REMOVE("cart1") |
| 583 | 583 | MDRV_DEVICE_REMOVE("cart2") |
| r5931 | r5932 | |
|---|---|---|
| 90 | 90 | /* They're needed to give the users the choice between different controllers */ |
| 91 | 91 | static UINT8 mess_md_io_read_data_port(running_machine *machine, int portnum) |
| 92 | 92 | { |
| 93 | static const char *const pad6names[2][4] = {{ "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" }, | |
| 93 | static const char *const pad6names[2][4] = {{ "PAD1_6B", "PAD2_6B", "UNUSED", "UNUSED" }, | |
| 94 | 94 | { "EXTRA1", "EXTRA2", "UNUSED", "UNUSED" }}; |
| 95 | 95 | static const char *const pad3names[4] = { "PAD1_3B", "PAD2_3B", "UNUSED", "UNUSED" }; |
| 96 | 96 | |
| 97 | UINT8 retdata; | |
| 97 | UINT8 retdata; | |
| 98 | 98 | int controller; |
| 99 | 99 | UINT8 helper_6b = (megadrive_io_ctrl_regs[portnum] & 0x3f) | 0xc0; // bits 6 & 7 always come from megadrive_io_data_regs |
| 100 | 100 | UINT8 helper_3b = (megadrive_io_ctrl_regs[portnum] & 0x7f) | 0x80; // bit 7 always comes from megadrive_io_data_regs |
| r5931 | r5932 | |
| 122 | 122 | if (mess_io_stage[portnum] == 2) |
| 123 | 123 | { |
| 124 | 124 | /* here we read B, C & the additional buttons */ |
| 125 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 126 | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x30) | | |
| 125 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 126 | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x30) | | |
| 127 | 127 | (input_port_read_safe(machine, pad6names[1][portnum], 0) & 0x0f)) & ~helper_6b); |
| 128 | 128 | } |
| 129 | 129 | else |
| 130 | 130 | { |
| 131 | 131 | /* here we read B, C & the directional buttons */ |
| 132 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 132 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 133 | 133 | ((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x3f) & ~helper_6b); |
| 134 | 134 | } |
| 135 | 135 | } |
| r5931 | r5932 | |
| 138 | 138 | if (mess_io_stage[portnum] == 1) |
| 139 | 139 | { |
| 140 | 140 | /* here we read ((Start & A) >> 2) | 0x00 */ |
| 141 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 141 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 142 | 142 | (((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) & ~helper_6b); |
| 143 | 143 | } |
| 144 | 144 | else if (mess_io_stage[portnum]==2) |
| 145 | 145 | { |
| 146 | 146 | /* here we read ((Start & A) >> 2) | 0x0f */ |
| 147 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 147 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 148 | 148 | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | 0x0f) & ~helper_6b); |
| 149 | 149 | } |
| 150 | 150 | else |
| 151 | 151 | { |
| 152 | 152 | /* here we read ((Start & A) >> 2) | Up and Down */ |
| 153 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 154 | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | | |
| 153 | retdata = (megadrive_io_data_regs[portnum] & helper_6b) | | |
| 154 | ((((input_port_read_safe(machine, pad6names[0][portnum], 0) & 0xc0) >> 2) | | |
| 155 | 155 | (input_port_read_safe(machine, pad6names[0][portnum], 0) & 0x03)) & ~helper_6b); |
| 156 | 156 | } |
| 157 | 157 | } |
| r5931 | r5932 | |
| 166 | 166 | if (megadrive_io_data_regs[portnum] & 0x40) |
| 167 | 167 | { |
| 168 | 168 | /* here we read B, C & the directional buttons */ |
| 169 | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | | |
| 169 | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | | |
| 170 | 170 | (((input_port_read_safe(machine, pad3names[portnum], 0) & 0x3f) | 0x40) & ~helper_3b); |
| 171 | 171 | } |
| 172 | 172 | else |
| 173 | 173 | { |
| 174 | 174 | /* here we read ((Start & A) >> 2) | Up and Down */ |
| 175 | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | | |
| 176 | ((((input_port_read_safe(machine, pad3names[portnum], 0) & 0xc0) >> 2) | | |
| 175 | retdata = (megadrive_io_data_regs[portnum] & helper_3b) | | |
| 176 | ((((input_port_read_safe(machine, pad3names[portnum], 0) & 0xc0) >> 2) | | |
| 177 | 177 | (input_port_read_safe(machine, pad3names[portnum], 0) & 0x03) | 0x40) & ~helper_3b); |
| 178 | 178 | } |
| 179 | 179 | } |
| r5931 | r5932 | |
| 230 | 230 | PORT_CATEGORY_CLASS( 0x0f, 0x00, "Player 1 Controller" ) |
| 231 | 231 | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 10 ) |
| 232 | 232 | PORT_CATEGORY_ITEM( 0x01, "Joystick 6 Buttons", 11 ) |
| 233 | // | |
| 233 | // PORT_CATEGORY_ITEM( 0x02, "Sega Mouse", 12 ) | |
| 234 | 234 | /* there exists both a 2 buttons version of the Mouse (Jpn ver, to be used with RPGs, it |
| 235 | can aslo be used as trackball) and a 3 buttons version (US ver, no trackball feats.) */ | |
| 236 | // PORT_CATEGORY_ITEM( 0x03, "Sega Menacer", 13 ) | |
| 237 | // PORT_CATEGORY_ITEM( 0x04, "Konami Justifier", 14 ) | |
| 238 | // PORT_CATEGORY_ITEM( 0x05, "Team Player (Sega Multitap)", 15 ) | |
| 239 | // PORT_CATEGORY_ITEM( 0x06, "4-Play (EA Multitap)", 16 ) | |
| 240 | // PORT_CATEGORY_ITEM( 0x07, "J-Cart", 17 ) | |
| 235 | can aslo be used as trackball) and a 3 buttons version (US ver, no trackball feats.) */ | |
| 236 | // PORT_CATEGORY_ITEM( 0x03, "Sega Menacer", 13 ) | |
| 237 | // PORT_CATEGORY_ITEM( 0x04, "Konami Justifier", 14 ) | |
| 238 | // PORT_CATEGORY_ITEM( 0x05, "Team Player (Sega Multitap)", 15 ) | |
| 239 | // PORT_CATEGORY_ITEM( 0x06, "4-Play (EA Multitap)", 16 ) | |
| 240 | // PORT_CATEGORY_ITEM( 0x07, "J-Cart", 17 ) | |
| 241 | 241 | PORT_CATEGORY_CLASS( 0xf0, 0x00, "Player 2 Controller" ) |
| 242 | 242 | PORT_CATEGORY_ITEM( 0x00, "Joystick 3 Buttons", 20 ) |
| 243 | 243 | PORT_CATEGORY_ITEM( 0x10, "Joystick 6 Buttons", 21 ) |
| r5931 | r5932 | |
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | /* MegaDrive inputs + Fake Region Selection */ |
| 303 | /* We need this as long as we only have the US version of the SVP add-on, otherwise we could not play | |
| 304 | Non-US Virtua Racing versions. It is also handy to develop add-ons emulation without adding each | |
| 303 | /* We need this as long as we only have the US version of the SVP add-on, otherwise we could not play | |
| 304 | Non-US Virtua Racing versions. It is also handy to develop add-ons emulation without adding each | |
| 305 | 305 | region variants, while they do not even work. Once emulation is working this must disappear. */ |
| 306 | 306 | static INPUT_PORTS_START( md_sel ) |
| 307 | 307 | PORT_INCLUDE( md ) |
| r5931 | r5932 | |
| 326 | 326 | { |
| 327 | 327 | MACHINE_RESET_CALL( megadriv ); |
| 328 | 328 | MACHINE_RESET_CALL( md_mappers ); |
| 329 | ||
| 329 | ||
| 330 | 330 | mess_init_6buttons_pad(machine); |
| 331 | 331 | } |
| 332 | 332 | |
| r5931 | r5932 | |
| 334 | 334 | MDRV_IMPORT_FROM(megadriv) |
| 335 | 335 | |
| 336 | 336 | MDRV_MACHINE_RESET( ms_megadriv ) |
| 337 | ||
| 337 | ||
| 338 | 338 | MDRV_IMPORT_FROM( genesis_cartslot ) |
| 339 | 339 | MACHINE_DRIVER_END |
| 340 | 340 | |
| r5931 | r5932 | |
| 342 | 342 | MDRV_IMPORT_FROM(megadpal) |
| 343 | 343 | |
| 344 | 344 | MDRV_MACHINE_RESET( ms_megadriv ) |
| 345 | ||
| 345 | ||
| 346 | 346 | MDRV_IMPORT_FROM( genesis_cartslot ) |
| 347 | 347 | MACHINE_DRIVER_END |
| 348 | 348 | |
| r5931 | r5932 | |
| 660 | 660 | break; |
| 661 | 661 | |
| 662 | 662 | /* |
| 663 | ||
| 663 | Still notes from notaz for the pen : | |
| 664 | 664 | |
| 665 | The pen can be used to 'draw' either on the drawing pad or on the storyware | |
| 666 | itself. Both storyware and drawing pad are mapped on single virtual plane, where | |
| 667 | coordinates range: | |
| 665 | The pen can be used to 'draw' either on the drawing pad or on the storyware | |
| 666 | itself. Both storyware and drawing pad are mapped on single virtual plane, where | |
| 667 | coordinates range: | |
| 668 | 668 | |
| 669 | x: 0x03c - 0x17c | |
| 670 | y: 0x1fc - 0x2f7 (drawing pad) | |
| 671 | 0x2f8 - 0x3f3 (storyware) | |
| 672 | */ | |
| 669 | x: 0x03c - 0x17c | |
| 670 | y: 0x1fc - 0x2f7 (drawing pad) | |
| 671 | 0x2f8 - 0x3f3 (storyware) | |
| 672 | */ | |
| 673 | 673 | case 2: |
| 674 | 674 | retdata = pico_read_penpos(space->machine, PICO_PENX) >> 8; |
| 675 | 675 | break; |
| r5931 | r5932 | |
| 684 | 684 | break; |
| 685 | 685 | case 6: |
| 686 | 686 | /* Page register : |
| 687 | 00 - storyware closed | |
| 688 | 01, 03, 07, 0f, 1f, 3f - pages 1-6 | |
| 689 | either page 5 or page 6 is often unused. | |
| 690 | */ | |
| 687 | 00 - storyware closed | |
| 688 | 01, 03, 07, 0f, 1f, 3f - pages 1-6 | |
| 689 | either page 5 or page 6 is often unused. | |
| 690 | */ | |
| 691 | 691 | { |
| 692 | 692 | UINT8 tmp; |
| 693 | 693 | |
| r5931 | r5932 | |
| 708 | 708 | break; |
| 709 | 709 | case 8: |
| 710 | 710 | /* |
| 711 | For reads, if bit 15 is cleared, it means PCM is 'busy' or | |
| 712 | something like that, as games sometimes wait for it to become 1. | |
| 713 | */ | |
| 711 | For reads, if bit 15 is cleared, it means PCM is 'busy' or | |
| 712 | something like that, as games sometimes wait for it to become 1. | |
| 713 | */ | |
| 714 | 714 | retdata = 0x00; |
| 715 | 715 | } |
| 716 | 716 | return retdata | retdata <<8; |
| r5931 | r5932 | |
| 771 | 771 | MDRV_DEVICE_REMOVE("genesis_snd_z80") |
| 772 | 772 | |
| 773 | 773 | MDRV_MACHINE_RESET( ms_megadriv ) |
| 774 | ||
| 774 | ||
| 775 | 775 | MDRV_IMPORT_FROM( pico_cartslot ) |
| 776 | 776 | MACHINE_DRIVER_END |
| 777 | 777 | |
| r5931 | r5932 | |
| 784 | 784 | MDRV_DEVICE_REMOVE("genesis_snd_z80") |
| 785 | 785 | |
| 786 | 786 | MDRV_MACHINE_RESET( ms_megadriv ) |
| 787 | ||
| 787 | ||
| 788 | 788 | MDRV_IMPORT_FROM( pico_cartslot ) |
| 789 | 789 | MACHINE_DRIVER_END |
| 790 | 790 |
| Previous | 15994 Revisions | Next |