src/mess/machine/mockngbd.c
| r14801 | r14802 | |
| 1 | | /********************************************************************* |
| 2 | | |
| 3 | | mockngbd.c |
| 4 | | |
| 5 | | Implementation of the Apple II Mockingboard |
| 6 | | |
| 7 | | The Mockingboard comes in different flavours: |
| 8 | | |
| 9 | | * Sound I: one AY-3-8910 chip for three audio channels |
| 10 | | * Speech I: one SC-01 chip |
| 11 | | * Sound II: two AY-3-8910 chips for six audio channels |
| 12 | | * Sound/Speech I: one AY-3-8910 and one SC-01 |
| 13 | | |
| 14 | | * Mockingboard A: two AY-3-8913 chips for six audio channels and two open sockets for SSI-263 speech chips |
| 15 | | * Mockingboard B: not a soundcard per se, but just two SSI-263 speech chip upgrade for Mockingboard A |
| 16 | | * Mockingboard C: two AY-3-8913 and one SSI-263 (essentially a Mockingboard A with the upgrade pre-installed, only one speech chip allowed) |
| 17 | | * Mockingboard D: for Apple IIc only, two AY-3-8913 and one SSI-263, connected to the serial port and its own particular driver |
| 18 | | * Mockingboard M: bundled with Mindscape's Bank Street Music Writer, with two AY-3-8913 chips and an open socket |
| 19 | | for one speech chip. This model included a headphone jack and a jumper to permit sound to be played |
| 20 | | through the Apple's built-in speaker. |
| 21 | | * Mockingboard v1: a clone of the Mockingboard A from ReactiveMicro.com |
| 22 | | |
| 23 | | |
| 24 | | TODO - When sound cores and the 6522 VIA become devices, and devices |
| 25 | | can contain other devices, start containing AY8910 and 6522VIA |
| 26 | | implementations |
| 27 | | |
| 28 | | *********************************************************************/ |
| 29 | | |
| 30 | | #include "mockngbd.h" |
| 31 | | #include "sound/ay8910.h" |
| 32 | | |
| 33 | | |
| 34 | | /*************************************************************************** |
| 35 | | PARAMETERS |
| 36 | | ***************************************************************************/ |
| 37 | | |
| 38 | | #define LOG_MOCKINGBOARD 0 |
| 39 | | |
| 40 | | |
| 41 | | /*************************************************************************** |
| 42 | | TYPE DEFINITIONS |
| 43 | | ***************************************************************************/ |
| 44 | | |
| 45 | | typedef struct _mockingboard_token mockingboard_token; |
| 46 | | struct _mockingboard_token |
| 47 | | { |
| 48 | | UINT8 flip1; |
| 49 | | UINT8 flip2; |
| 50 | | UINT8 latch0; |
| 51 | | UINT8 latch1; |
| 52 | | }; |
| 53 | | |
| 54 | | |
| 55 | | /*************************************************************************** |
| 56 | | INLINE FUNCTIONS |
| 57 | | ***************************************************************************/ |
| 58 | | |
| 59 | | INLINE mockingboard_token *get_token(device_t *device) |
| 60 | | { |
| 61 | | assert(device != NULL); |
| 62 | | assert(device->type() == MOCKINGBOARD); |
| 63 | | return (mockingboard_token *) downcast<legacy_device_base *>(device)->token(); |
| 64 | | } |
| 65 | | |
| 66 | | |
| 67 | | |
| 68 | | /*************************************************************************** |
| 69 | | FUNCTION PROTOTYPES |
| 70 | | ***************************************************************************/ |
| 71 | | |
| 72 | | /*------------------------------------------------- |
| 73 | | DEVICE_START(mockingboard) - device start |
| 74 | | function |
| 75 | | -------------------------------------------------*/ |
| 76 | | |
| 77 | | static DEVICE_START(mockingboard) |
| 78 | | { |
| 79 | | } |
| 80 | | |
| 81 | | |
| 82 | | |
| 83 | | /*------------------------------------------------- |
| 84 | | DEVICE_RESET(mockingboard) - device reset |
| 85 | | function |
| 86 | | -------------------------------------------------*/ |
| 87 | | |
| 88 | | static DEVICE_RESET(mockingboard) |
| 89 | | { |
| 90 | | mockingboard_token *token = get_token(device); |
| 91 | | token->flip1 = 0x00; |
| 92 | | token->flip2 = 0x00; |
| 93 | | token->latch0 = 0x00; |
| 94 | | token->latch1 = 0x00; |
| 95 | | |
| 96 | | /* TODO: fix this */ |
| 97 | | /* What follows is pure filth. It abuses the core like an angry pimp on a bad hair day. */ |
| 98 | | |
| 99 | | /* Since we know that the Mockingboard has no code ROM, we'll copy into the slot ROM space |
| 100 | | an image of the onboard ROM so that when an IRQ bankswitches to the onboard ROM, we read |
| 101 | | the proper stuff. Without this, it will choke and try to use the memory handler above, and |
| 102 | | fail miserably. That should really be fixed. I beg you -- if you are reading this comment, |
| 103 | | fix this :) */ |
| 104 | | // memcpy (apple2_slotrom(slot), &apple_rom[0x0000 + (slot * 0x100)], 0x100); |
| 105 | | } |
| 106 | | |
| 107 | | |
| 108 | | |
| 109 | | /*------------------------------------------------- |
| 110 | | mockingboard_r - device read function |
| 111 | | -------------------------------------------------*/ |
| 112 | | |
| 113 | | READ8_DEVICE_HANDLER(mockingboard_r) |
| 114 | | { |
| 115 | | // UINT8 result = 0x00; |
| 116 | | mockingboard_token *token = get_token(device); |
| 117 | | |
| 118 | | switch (offset) |
| 119 | | { |
| 120 | | /* This is used to ID the board */ |
| 121 | | case 0x04: |
| 122 | | token->flip1 ^= 0x08; |
| 123 | | // result = token->flip1; |
| 124 | | break; |
| 125 | | |
| 126 | | case 0x84: |
| 127 | | token->flip2 ^= 0x08; |
| 128 | | // result = token->flip2; |
| 129 | | break; |
| 130 | | |
| 131 | | default: |
| 132 | | if (LOG_MOCKINGBOARD) |
| 133 | | logerror("mockingboard_r unmapped, offset: %02x, pc: %s\n", offset, device->machine().describe_context()); |
| 134 | | break; |
| 135 | | } |
| 136 | | return 0x00; |
| 137 | | } |
| 138 | | |
| 139 | | |
| 140 | | |
| 141 | | /*------------------------------------------------- |
| 142 | | mockingboard_w - device write function |
| 143 | | -------------------------------------------------*/ |
| 144 | | |
| 145 | | WRITE8_DEVICE_HANDLER(mockingboard_w) |
| 146 | | { |
| 147 | | device_t *ay8910_1 = device->machine().device("ay8910.1"); |
| 148 | | device_t *ay8910_2 = device->machine().device("ay8910.2"); |
| 149 | | mockingboard_token *token = get_token(device); |
| 150 | | |
| 151 | | if (LOG_MOCKINGBOARD) |
| 152 | | logerror("mockingboard_w, $%02x:%02x\n", offset, data); |
| 153 | | |
| 154 | | /* There is a 6522 in here which interfaces to the 8910s */ |
| 155 | | switch (offset) |
| 156 | | { |
| 157 | | case 0x00: /* ORB1 */ |
| 158 | | switch (data) |
| 159 | | { |
| 160 | | case 0x00: /* reset */ |
| 161 | | ay8910_1->reset(); |
| 162 | | break; |
| 163 | | case 0x04: /* make inactive */ |
| 164 | | break; |
| 165 | | case 0x06: /* write data */ |
| 166 | | ay8910_data_w(ay8910_1, 0, token->latch0); |
| 167 | | break; |
| 168 | | case 0x07: /* set register */ |
| 169 | | ay8910_address_w(ay8910_1, 0, token->latch0); |
| 170 | | break; |
| 171 | | } |
| 172 | | break; |
| 173 | | |
| 174 | | case 0x01: /* ORA1 */ |
| 175 | | token->latch0 = data; |
| 176 | | break; |
| 177 | | |
| 178 | | case 0x02: /* DDRB1 */ |
| 179 | | case 0x03: /* DDRA1 */ |
| 180 | | break; |
| 181 | | |
| 182 | | case 0x80: /* ORB2 */ |
| 183 | | switch (data) |
| 184 | | { |
| 185 | | case 0x00: /* reset */ |
| 186 | | ay8910_2->reset(); |
| 187 | | break; |
| 188 | | case 0x04: /* make inactive */ |
| 189 | | break; |
| 190 | | case 0x06: /* write data */ |
| 191 | | ay8910_data_w(ay8910_2, 0, token->latch1); |
| 192 | | break; |
| 193 | | case 0x07: /* set register */ |
| 194 | | ay8910_address_w(ay8910_2, 0, token->latch1); |
| 195 | | break; |
| 196 | | } |
| 197 | | break; |
| 198 | | |
| 199 | | case 0x81: /* ORA2 */ |
| 200 | | token->latch1 = data; |
| 201 | | break; |
| 202 | | |
| 203 | | case 0x82: /* DDRB2 */ |
| 204 | | case 0x83: /* DDRA2 */ |
| 205 | | break; |
| 206 | | } |
| 207 | | } |
| 208 | | |
| 209 | | |
| 210 | | |
| 211 | | /*------------------------------------------------- |
| 212 | | DEVICE_GET_INFO(mockingboard) - device get info |
| 213 | | function |
| 214 | | -------------------------------------------------*/ |
| 215 | | |
| 216 | | DEVICE_GET_INFO(mockingboard) |
| 217 | | { |
| 218 | | switch (state) |
| 219 | | { |
| 220 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 221 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(mockingboard_token); break; |
| 222 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break; |
| 223 | | |
| 224 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 225 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(mockingboard); break; |
| 226 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 227 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(mockingboard); break; |
| 228 | | |
| 229 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 230 | | case DEVINFO_STR_NAME: strcpy(info->s, "Apple II Mockingboard"); break; |
| 231 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Apple II Mockingboard"); break; |
| 232 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 233 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 234 | | } |
| 235 | | } |
| 236 | | |
| 237 | | DEFINE_LEGACY_DEVICE(MOCKINGBOARD, mockingboard); |
src/mess/drivers/apple2gs.c
| r14801 | r14802 | |
| 56 | 56 | #include "machine/ap2_slot.h" |
| 57 | 57 | #include "machine/ap2_lang.h" |
| 58 | 58 | #include "machine/applefdc.h" |
| 59 | | #include "machine/mockngbd.h" |
| 60 | 59 | #include "machine/8530scc.h" |
| 61 | | #include "sound/ay8910.h" |
| 62 | 60 | #include "sound/speaker.h" |
| 63 | 61 | #include "machine/ram.h" |
| 64 | 62 | |
| r14801 | r14802 | |
| 176 | 174 | /* nothing in the address map - everything is added dynamically */ |
| 177 | 175 | ADDRESS_MAP_END |
| 178 | 176 | |
| 179 | | |
| 180 | | static const ay8910_interface apple2_ay8910_interface = |
| 181 | | { |
| 182 | | AY8910_LEGACY_OUTPUT, |
| 183 | | AY8910_DEFAULT_LOADS, |
| 184 | | DEVCB_NULL |
| 185 | | }; |
| 186 | | |
| 187 | 177 | static MACHINE_CONFIG_START( apple2gs, apple2gs_state ) |
| 188 | 178 | /* basic machine hardware */ |
| 189 | 179 | MCFG_CPU_ADD("maincpu", G65816, APPLE2GS_14M/5) |
| r14801 | r14802 | |
| 212 | 202 | MCFG_SOUND_ADD("a2speaker", SPEAKER_SOUND, 0) |
| 213 | 203 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 214 | 204 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 215 | | MCFG_SOUND_ADD("ay8913.1", AY8913, 1022727) |
| 216 | | MCFG_SOUND_CONFIG(apple2_ay8910_interface) |
| 217 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 218 | | MCFG_SOUND_ADD("ay8913.2", AY8913, 1022727) |
| 219 | | MCFG_SOUND_CONFIG(apple2_ay8910_interface) |
| 220 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 221 | 205 | |
| 222 | 206 | MCFG_ES5503_ADD("es5503", APPLE2GS_7M, apple2gs_doc_irq, apple2gs_adc_read) |
| 223 | 207 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| r14801 | r14802 | |
| 225 | 209 | |
| 226 | 210 | /* slot devices */ |
| 227 | 211 | MCFG_APPLE2_LANGCARD_ADD("langcard") |
| 228 | | MCFG_MOCKINGBOARD_ADD("mockingboard") |
| 229 | 212 | MCFG_IWM_ADD("fdc", apple2_fdc_interface) |
| 230 | 213 | |
| 231 | 214 | /* slots */ |
| 232 | 215 | MCFG_APPLE2_SLOT_ADD(0, "langcard", apple2_langcard_r, apple2_langcard_w, 0, 0, 0, 0) |
| 233 | | MCFG_APPLE2_SLOT_ADD(4, "mockingboard", mockingboard_r, mockingboard_w, 0, 0, 0, 0) |
| 234 | 216 | MCFG_APPLE2_SLOT_ADD(6, "fdc", applefdc_r, applefdc_w, 0, 0, 0, 0) |
| 235 | 217 | |
| 236 | 218 | /* SCC */ |
src/mess/drivers/apple2.c
| r14801 | r14802 | |
| 194 | 194 | #include "machine/ap2_slot.h" |
| 195 | 195 | #include "machine/ap2_lang.h" |
| 196 | 196 | #include "machine/applefdc.h" |
| 197 | | #include "machine/mockngbd.h" |
| 198 | | //#include "machine/a2z80.h" |
| 199 | | #include "sound/ay8910.h" |
| 200 | 197 | #include "sound/speaker.h" |
| 201 | 198 | #include "machine/ram.h" |
| 202 | 199 | #include "machine/a2cffa.h" |
| r14801 | r14802 | |
| 557 | 554 | palette_set_colors(machine, 0, apple2_palette, ARRAY_LENGTH(apple2_palette)); |
| 558 | 555 | } |
| 559 | 556 | |
| 560 | | static const ay8910_interface apple2_ay8910_interface = |
| 561 | | { |
| 562 | | AY8910_LEGACY_OUTPUT, |
| 563 | | AY8910_DEFAULT_LOADS, |
| 564 | | DEVCB_NULL |
| 565 | | }; |
| 566 | | |
| 567 | 557 | static const floppy_interface apple2_floppy_interface = |
| 568 | 558 | { |
| 569 | 559 | DEVCB_NULL, |
| r14801 | r14802 | |
| 611 | 601 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 612 | 602 | MCFG_SOUND_ADD("a2speaker", SPEAKER_SOUND, 0) |
| 613 | 603 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 614 | | MCFG_SOUND_ADD("ay8913.1", AY8913, 1022727) |
| 615 | | MCFG_SOUND_CONFIG(apple2_ay8910_interface) |
| 616 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 617 | | MCFG_SOUND_ADD("ay8913.2", AY8913, 1022727) |
| 618 | | MCFG_SOUND_CONFIG(apple2_ay8910_interface) |
| 619 | | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 620 | 604 | |
| 621 | 605 | /* slot devices */ |
| 622 | 606 | MCFG_APPLE2_LANGCARD_ADD("langcard") |
| 623 | | MCFG_MOCKINGBOARD_ADD("mockingboard") |
| 624 | 607 | MCFG_APPLEFDC_ADD("fdc", apple2_fdc_interface) |
| 625 | 608 | |
| 626 | 609 | /* slots */ |
| 627 | 610 | MCFG_APPLE2_SLOT_ADD(0, "langcard", apple2_langcard_r, apple2_langcard_w, 0, 0, 0, 0) |
| 628 | | MCFG_APPLE2_SLOT_ADD(4, "mockingboard", mockingboard_r, mockingboard_w, 0, 0, 0, 0) |
| 629 | 611 | MCFG_APPLE2_SLOT_ADD(6, "fdc", applefdc_r, applefdc_w, 0, 0, 0, 0) |
| 630 | 612 | |
| 631 | 613 | MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(apple2_floppy_interface,15,16) |