src/mess/machine/a2cffa.c
| r0 | r8189 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2cffa.c |
| 4 | |
| 5 | Implementation of Rich Dreher's IDE/CompactFlash card |
| 6 | for the Apple II. |
| 7 | |
| 8 | http://www.dreher.net/ |
| 9 | |
| 10 | *********************************************************************/ |
| 11 | |
| 12 | #include "a2cffa.h" |
| 13 | #include "includes/apple2.h" |
| 14 | #include "machine/idectrl.h" |
| 15 | |
| 16 | |
| 17 | /*************************************************************************** |
| 18 | PARAMETERS |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | #define LOG_A2CFFA 1 |
| 22 | |
| 23 | |
| 24 | /*************************************************************************** |
| 25 | TYPE DEFINITIONS |
| 26 | ***************************************************************************/ |
| 27 | |
| 28 | typedef struct _a2cffa_token a2cffa_token; |
| 29 | struct _a2cffa_token |
| 30 | { |
| 31 | UINT8 *ROM; // card ROM |
| 32 | UINT16 lastdata; // last data from IDE |
| 33 | }; |
| 34 | |
| 35 | |
| 36 | /*************************************************************************** |
| 37 | INLINE FUNCTIONS |
| 38 | ***************************************************************************/ |
| 39 | |
| 40 | INLINE a2cffa_token *get_token(const running_device *device) |
| 41 | { |
| 42 | assert(device != NULL); |
| 43 | assert(device->type == A2CFFA); |
| 44 | return (a2cffa_token *) device->token; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | |
| 49 | /*************************************************************************** |
| 50 | FUNCTION PROTOTYPES |
| 51 | ***************************************************************************/ |
| 52 | |
| 53 | /*------------------------------------------------- |
| 54 | DEVICE_START(a2cffa) - device start |
| 55 | function |
| 56 | -------------------------------------------------*/ |
| 57 | |
| 58 | static DEVICE_START(a2cffa) |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | |
| 63 | |
| 64 | /*------------------------------------------------- |
| 65 | DEVICE_RESET(a2cffa) - device reset |
| 66 | function |
| 67 | -------------------------------------------------*/ |
| 68 | |
| 69 | static DEVICE_RESET(a2cffa) |
| 70 | { |
| 71 | a2cffa_token *token = get_token(device); |
| 72 | |
| 73 | // find card ROM |
| 74 | token->ROM = (UINT8 *)memory_region(device->machine, "cffa"); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | |
| 79 | /*------------------------------------------------- |
| 80 | a2cffa_r - device read function |
| 81 | -------------------------------------------------*/ |
| 82 | |
| 83 | READ8_DEVICE_HANDLER(a2cffa_r) |
| 84 | { |
| 85 | a2cffa_token *token = get_token(device); |
| 86 | |
| 87 | if (offset == 0) |
| 88 | { |
| 89 | return token->lastdata>>8; |
| 90 | } |
| 91 | else if (offset == 8) |
| 92 | { |
| 93 | token->lastdata = ide_controller_r(device->machine->devicelist.find("ide"), 0x1f0+offset-8, 2); |
| 94 | return token->lastdata & 0xff; |
| 95 | } |
| 96 | else if (offset > 8) |
| 97 | { |
| 98 | return ide_controller_r(device->machine->devicelist.find("ide"), 0x1f0+offset-8, 1); |
| 99 | } |
| 100 | |
| 101 | return 0xff; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | |
| 106 | /*------------------------------------------------- |
| 107 | a2cffa_w - device write function |
| 108 | -------------------------------------------------*/ |
| 109 | |
| 110 | WRITE8_DEVICE_HANDLER(a2cffa_w) |
| 111 | { |
| 112 | a2cffa_token *token = get_token(device); |
| 113 | |
| 114 | if (offset == 0) |
| 115 | { |
| 116 | token->lastdata &= 0x00ff; |
| 117 | token->lastdata |= data<<8; |
| 118 | } |
| 119 | else if (offset == 8) |
| 120 | { |
| 121 | token->lastdata &= 0xff00; |
| 122 | token->lastdata |= data; |
| 123 | ide_controller_w(device->machine->devicelist.find("ide"), 0x1f0+offset-8, 2, token->lastdata); |
| 124 | } |
| 125 | else if (offset > 8) |
| 126 | { |
| 127 | ide_controller_w(device->machine->devicelist.find("ide"), 0x1f0+offset-8, 1, data); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | /* slot ext. ROM (C800) read function */ |
| 133 | READ8_DEVICE_HANDLER(a2cffa_c800_r) |
| 134 | { |
| 135 | a2cffa_token *token = get_token(device); |
| 136 | |
| 137 | return token->ROM[offset+0x800]; |
| 138 | } |
| 139 | |
| 140 | /* slot ext. ROM (C800) write function */ |
| 141 | WRITE8_DEVICE_HANDLER(a2cffa_c800_w) |
| 142 | { |
| 143 | } |
| 144 | |
| 145 | /* slot ROM (CN00) read function */ |
| 146 | READ8_DEVICE_HANDLER(a2cffa_cnxx_r) |
| 147 | { |
| 148 | a2cffa_token *token = get_token(device); |
| 149 | |
| 150 | return token->ROM[offset+0x700]; // this needs to be = to the slot #, we assume 7 for now |
| 151 | } |
| 152 | |
| 153 | /* slot ROM (CN00) write function */ |
| 154 | WRITE8_DEVICE_HANDLER(a2cffa_cnxx_w) |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | |
| 159 | /*------------------------------------------------- |
| 160 | DEVICE_GET_INFO(a2cffa) - device get info |
| 161 | function |
| 162 | -------------------------------------------------*/ |
| 163 | |
| 164 | DEVICE_GET_INFO(a2cffa) |
| 165 | { |
| 166 | switch (state) |
| 167 | { |
| 168 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 169 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(a2cffa_token); break; |
| 170 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 171 | case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break; |
| 172 | |
| 173 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 174 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(a2cffa); break; |
| 175 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 176 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(a2cffa); break; |
| 177 | |
| 178 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 179 | case DEVINFO_STR_NAME: strcpy(info->s, "Apple II CFFA Card (www.dreher.net)"); break; |
| 180 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Apple II CFFA Card (www.dreher.net)"); break; |
| 181 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 182 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 183 | } |
| 184 | } |
| 185 | |
src/mess/machine/a2cffa.h
| r0 | r8189 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | a2cffa.h |
| 4 | |
| 5 | Implementation of Rich Dreher's IDE/CompactFlash board for |
| 6 | the Apple II |
| 7 | |
| 8 | *********************************************************************/ |
| 9 | |
| 10 | #ifndef __A2CFFA__ |
| 11 | #define __A2CFFA__ |
| 12 | |
| 13 | #include "emu.h" |
| 14 | |
| 15 | |
| 16 | /*************************************************************************** |
| 17 | CONSTANTS |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #define A2CFFA DEVICE_GET_INFO_NAME(a2cffa) |
| 21 | |
| 22 | #define MDRV_A2CFFA_ADD(_tag) \ |
| 23 | MDRV_DEVICE_ADD((_tag), A2CFFA, 0) |
| 24 | |
| 25 | |
| 26 | /*************************************************************************** |
| 27 | FUNCTION PROTOTYPES |
| 28 | ***************************************************************************/ |
| 29 | |
| 30 | /* device get info function */ |
| 31 | DEVICE_GET_INFO(a2cffa); |
| 32 | |
| 33 | /* slot read function */ |
| 34 | READ8_DEVICE_HANDLER(a2cffa_r); |
| 35 | |
| 36 | /* slot write function */ |
| 37 | WRITE8_DEVICE_HANDLER(a2cffa_w); |
| 38 | |
| 39 | /* slot ext. ROM (C800) read function */ |
| 40 | READ8_DEVICE_HANDLER(a2cffa_c800_r); |
| 41 | |
| 42 | /* slot ext. ROM (C800) write function */ |
| 43 | WRITE8_DEVICE_HANDLER(a2cffa_c800_w); |
| 44 | |
| 45 | /* slot ROM (CN00) read function */ |
| 46 | READ8_DEVICE_HANDLER(a2cffa_cnxx_r); |
| 47 | |
| 48 | /* slot ROM (CN00) write function */ |
| 49 | WRITE8_DEVICE_HANDLER(a2cffa_cnxx_w); |
| 50 | |
| 51 | #endif /* __A2SCSI__ */ |
| 52 | |
src/mess/drivers/apple2.c
| r8188 | r8189 | |
| 182 | 182 | |
| 183 | 183 | #include "emu.h" |
| 184 | 184 | #include "cpu/m6502/m6502.h" |
| 185 | #include "cpu/z80/z80.h" |
| 185 | 186 | #include "deprecat.h" |
| 186 | 187 | #include "devices/appldriv.h" |
| 187 | 188 | #include "devices/flopdrv.h" |
| r8188 | r8189 | |
| 192 | 193 | #include "machine/ap2_lang.h" |
| 193 | 194 | #include "machine/applefdc.h" |
| 194 | 195 | #include "machine/mockngbd.h" |
| 196 | //#include "machine/a2z80.h" |
| 195 | 197 | #include "sound/ay8910.h" |
| 196 | 198 | #include "sound/speaker.h" |
| 197 | 199 | #include "devices/messram.h" |
| 200 | #include "machine/a2cffa.h" |
| 201 | #include "machine/idectrl.h" |
| 202 | #include "devices/harddriv.h" |
| 198 | 203 | |
| 199 | 204 | |
| 200 | 205 | /*************************************************************************** |
| r8188 | r8189 | |
| 678 | 683 | MDRV_RAM_EXTRA_OPTIONS("64K") |
| 679 | 684 | MDRV_RAM_DEFAULT_VALUE(0x00) |
| 680 | 685 | MACHINE_DRIVER_END |
| 686 | #if 0 |
| 687 | MACHINE_DRIVER_START( apple2e_z80 ) |
| 688 | MDRV_IMPORT_FROM( apple2_common ) |
| 689 | MDRV_VIDEO_START(apple2e) |
| 681 | 690 | |
| 691 | MDRV_CPU_ADD("softcard", Z80, 1021800*2) // softcard Z80 runs at twice the 6502 clock |
| 692 | MDRV_CPU_PROGRAM_MAP(a2z80_map) |
| 693 | |
| 694 | MDRV_A2Z80_ADD("a2z80") |
| 695 | MDRV_APPLE2_SLOT_ADD(7, "a2z80", 0, 0, 0, 0, 0, a2z80_cnxx_w) |
| 696 | |
| 697 | MDRV_QUANTUM_PERFECT_CPU("maincpu") |
| 698 | |
| 699 | /* internal ram */ |
| 700 | MDRV_RAM_ADD("messram") |
| 701 | MDRV_RAM_DEFAULT_SIZE("128K") |
| 702 | MDRV_RAM_EXTRA_OPTIONS("64K") |
| 703 | MDRV_RAM_DEFAULT_VALUE(0x00) |
| 704 | MACHINE_DRIVER_END |
| 705 | #endif |
| 682 | 706 | static MACHINE_DRIVER_START( mprof3 ) |
| 683 | 707 | MDRV_IMPORT_FROM( apple2e ) |
| 684 | 708 | |
| r8188 | r8189 | |
| 690 | 714 | static MACHINE_DRIVER_START( apple2ee ) |
| 691 | 715 | MDRV_IMPORT_FROM( apple2e ) |
| 692 | 716 | MDRV_CPU_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ |
| 717 | |
| 718 | /* CFFA stuff */ |
| 719 | MDRV_HARDDISK_ADD("harddisk") |
| 720 | MDRV_IDE_CONTROLLER_ADD("ide", NULL) |
| 721 | MDRV_IDE_CONTROLLER_REGIONS("harddisk", NULL) |
| 722 | MDRV_A2CFFA_ADD("cffa") |
| 723 | MDRV_APPLE2_SLOT_ADD(7, "cffa", a2cffa_r, a2cffa_w, a2cffa_c800_r, a2cffa_c800_w, a2cffa_cnxx_r, a2cffa_cnxx_w) |
| 693 | 724 | MACHINE_DRIVER_END |
| 694 | 725 | |
| 695 | 726 | static MACHINE_DRIVER_START( apple2c ) |
| r8188 | r8189 | |
| 841 | 872 | ROM_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16)) /* Disk II ROM - DOS 3.3 version */ |
| 842 | 873 | ROM_END |
| 843 | 874 | |
| 875 | ROM_START(apple2ez) |
| 876 | ROM_REGION(0x2000,"gfx1",0) |
| 877 | ROM_LOAD ( "342-0133-a.chr", 0x0000, 0x1000,CRC(b081df66) SHA1(7060de104046736529c1e8a687a0dd7b84f8c51b)) |
| 878 | ROM_LOAD ( "342-0133-a.chr", 0x1000, 0x1000,CRC(b081df66) SHA1(7060de104046736529c1e8a687a0dd7b84f8c51b)) |
| 879 | |
| 880 | ROM_REGION(0x4700,"maincpu",0) |
| 881 | ROM_LOAD ( "342-0135-b.64", 0x0000, 0x2000, CRC(e248835e) SHA1(523838c19c79f481fa02df56856da1ec3816d16e)) |
| 882 | ROM_LOAD ( "342-0134-a.64", 0x2000, 0x2000, CRC(fc3d59d8) SHA1(8895a4b703f2184b673078f411f4089889b61c54)) |
| 883 | ROM_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16)) /* Disk II ROM - DOS 3.3 version */ |
| 884 | ROM_END |
| 885 | |
| 844 | 886 | ROM_START(mprof3) |
| 845 | 887 | ROM_REGION(0x2000,"gfx1",0) |
| 846 | 888 | ROM_LOAD ( "mpf3.chr", 0x0000, 0x1000,CRC(2597bc19) SHA1(e114dcbb512ec24fb457248c1b53cbd78039ed20)) |
| r8188 | r8189 | |
| 862 | 904 | ROM_LOAD ( "342-0304-a.64", 0x0000, 0x2000, CRC(443aa7c4) SHA1(3aecc56a26134df51e65e17f33ae80c1f1ac93e6)) |
| 863 | 905 | ROM_LOAD ( "342-0303-a.64", 0x2000, 0x2000, CRC(95e10034) SHA1(afb09bb96038232dc757d40c0605623cae38088e)) |
| 864 | 906 | ROM_LOAD ( "341-0027-a.p5", 0x4500, 0x0100, CRC(ce7144f6) SHA1(d4181c9f046aafc3fb326b381baac809d9e38d16)) /* Disk II ROM - DOS 3.3 version */ |
| 907 | |
| 908 | ROM_REGION(0x1000, "cffa", 0) |
| 909 | ROM_LOAD( "cffa20eec02.bin", 0x000000, 0x001000, CRC(fb3726f8) SHA1(080ff88f19de22328e162954ee2b51ee65f9d5cd) ) |
| 865 | 910 | ROM_END |
| 866 | 911 | |
| 867 | 912 | ROM_START(apple2ep) |
| r8188 | r8189 | |
| 967 | 1012 | COMP( 1980, apple2jp, apple2, 0, apple2p, apple2p, 0, "Apple Computer", "Apple ][j+", GAME_SUPPORTS_SAVE ) |
| 968 | 1013 | COMP( 1982, ace100, apple2, 0, apple2, apple2e, 0, "Franklin Computer", "Franklin Ace 100", GAME_SUPPORTS_SAVE ) |
| 969 | 1014 | COMP( 1983, apple2e, 0, apple2, apple2e, apple2e, 0, "Apple Computer", "Apple //e", GAME_SUPPORTS_SAVE ) |
| 1015 | //COMP( 1983, apple2ez, apple2e, 0, apple2e_z80, apple2e, 0, "Apple Computer", "Apple //e (with Z80 SoftCard)", GAME_SUPPORTS_SAVE ) |
| 970 | 1016 | COMP( 1983, mprof3, apple2e, 0, mprof3, apple2e, 0, "Multitech", "Microprofessor III", GAME_SUPPORTS_SAVE ) |
| 971 | 1017 | COMP( 1985, apple2ee, apple2e, 0, apple2ee, apple2e, 0, "Apple Computer", "Apple //e (enhanced)", GAME_SUPPORTS_SAVE ) |
| 972 | 1018 | COMP( 1987, apple2ep, apple2e, 0, apple2ee, apple2ep, 0, "Apple Computer", "Apple //e (Platinum)", GAME_SUPPORTS_SAVE ) |