src/mess/machine/at.c
| r4560 | r4561 | |
| 54 | 54 | *************************************************************/ |
| 55 | 55 | |
| 56 | 56 | static PIC8259_SET_INT_LINE( at_pic8259_master_set_int_line ) { |
| 57 | | cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? ASSERT_LINE : CLEAR_LINE); |
| 57 | cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? ASSERT_LINE : CLEAR_LINE); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| r4560 | r4561 | |
| 146 | 146 | static void at_set_gate_a20(running_machine *machine, int a20) |
| 147 | 147 | { |
| 148 | 148 | /* set the CPU's A20 line */ |
| 149 | | cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20); |
| 149 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| r4560 | r4561 | |
| 162 | 162 | |
| 163 | 163 | static void init_at_common(running_machine *machine, const struct kbdc8042_interface *at8042) |
| 164 | 164 | { |
| 165 | | const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM); |
| 165 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 166 | 166 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_AT, at_set_keyb_int, at_set_irq_line); |
| 167 | 167 | mc146818_init(machine, MC146818_STANDARD); |
| 168 | 168 | soundblaster_config(&soundblaster); |
| r4560 | r4561 | |
| 224 | 224 | |
| 225 | 225 | if (LOG_PORT80 && (offset == 0)) |
| 226 | 226 | { |
| 227 | | logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) cpu_get_reg(space->machine->cpu[0],REG_GENPC)); |
| 227 | logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, |
| 228 | (unsigned) cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPC)); |
| 228 | 229 | } |
| 229 | 230 | |
| 230 | 231 | switch(offset % 8) { |
| r4560 | r4561 | |
| 250 | 251 | offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) |
| 251 | 252 | & 0xFF0000; |
| 252 | 253 | |
| 253 | | result = memory_read_byte(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), page_offset + offset); |
| 254 | result = memory_read_byte(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), page_offset + offset); |
| 254 | 255 | return result; |
| 255 | 256 | } |
| 256 | 257 | |
| r4560 | r4561 | |
| 260 | 261 | offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) |
| 261 | 262 | & 0xFF0000; |
| 262 | 263 | |
| 263 | | memory_write_byte(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), page_offset + offset, data); |
| 264 | memory_write_byte(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), page_offset + offset, data); |
| 264 | 265 | } |
| 265 | 266 | |
| 266 | 267 | |
| r4560 | r4561 | |
| 471 | 472 | |
| 472 | 473 | static READ8_HANDLER( at_kbdc8042_p1_r ) |
| 473 | 474 | { |
| 474 | | logerror("%04x: reading P1\n", cpu_get_pc(space->machine->cpu[0]) ); |
| 475 | logerror("%04x: reading P1\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) ); |
| 475 | 476 | return 0xFF; |
| 476 | 477 | } |
| 477 | 478 | |
| r4560 | r4561 | |
| 484 | 485 | |
| 485 | 486 | static WRITE8_HANDLER( at_kbdc8042_p2_w ) |
| 486 | 487 | { |
| 487 | | logerror("%04x: writing $%02x to P2\n", cpu_get_pc(space->machine->cpu[0]), data ); |
| 488 | logerror("%04x: writing $%02x to P2\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), data ); |
| 488 | 489 | |
| 489 | 490 | at_set_gate_a20( space->machine, ( data & 0x02 ) ? 1 : 0 ); |
| 490 | 491 | |
| 491 | | cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE ); |
| 492 | cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE ); |
| 492 | 493 | |
| 493 | 494 | at_kbdc8042.clock_signal = ( data & 0x40 ) ? 1 : 0; |
| 494 | 495 | at_kbdc8042.data_signal = ( data & 0x80 ) ? 1 : 0; |
| r4560 | r4561 | |
| 552 | 553 | switch ( offset ) |
| 553 | 554 | { |
| 554 | 555 | case 0: /* A2 is wired to 8042 A0 */ |
| 555 | | data = upi41_master_r( space->machine->cpu[1], 0 ); |
| 556 | data = upi41_master_r( cputag_get_cpu(space->machine, "kbdc8042"), 0 ); |
| 556 | 557 | break; |
| 557 | 558 | |
| 558 | 559 | case 1: |
| r4560 | r4561 | |
| 581 | 582 | break; |
| 582 | 583 | |
| 583 | 584 | case 4: /* A2 is wired to 8042 A0 */ |
| 584 | | data = upi41_master_r( space->machine->cpu[1], 1 ); |
| 585 | data = upi41_master_r( cputag_get_cpu(space->machine, "kbdc8042"), 1 ); |
| 585 | 586 | break; |
| 586 | 587 | } |
| 587 | 588 | |
| r4560 | r4561 | |
| 598 | 599 | |
| 599 | 600 | switch (offset) { |
| 600 | 601 | case 0: /* A2 is wired to 8042 A0 */ |
| 601 | | upi41_master_w( space->machine->cpu[1], 0, data ); |
| 602 | upi41_master_w( cputag_get_cpu(space->machine, "kbdc8042"), 0, data ); |
| 602 | 603 | break; |
| 603 | 604 | |
| 604 | 605 | case 1: |
| r4560 | r4561 | |
| 608 | 609 | break; |
| 609 | 610 | |
| 610 | 611 | case 4: /* A2 is wired to 8042 A0 */ |
| 611 | | upi41_master_w( space->machine->cpu[1], 1, data ); |
| 612 | upi41_master_w( cputag_get_cpu(space->machine, "kbdc8042"), 1, data ); |
| 612 | 613 | break; |
| 613 | 614 | } |
| 614 | 615 | } |
| r4560 | r4561 | |
| 686 | 687 | static void at_map_vga_memory(running_machine *machine, offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh) |
| 687 | 688 | { |
| 688 | 689 | int buswidth; |
| 689 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 690 | | buswidth = cpu_get_databus_width(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 690 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 691 | buswidth = cpu_get_databus_width(cputag_get_cpu(machine, "maincpu"), ADDRESS_SPACE_PROGRAM); |
| 691 | 692 | switch(buswidth) |
| 692 | 693 | { |
| 693 | 694 | case 8: |
| r4560 | r4561 | |
| 761 | 762 | |
| 762 | 763 | MACHINE_START( at ) |
| 763 | 764 | { |
| 764 | | cpu_set_irq_callback(machine->cpu[0], at_irq_callback); |
| 765 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), at_irq_callback); |
| 765 | 766 | pc_fdc_init( machine, &fdc_interface ); |
| 766 | 767 | } |
| 767 | 768 | |
src/mess/machine/amstrad.c
| r4560 | r4561 | |
| 582 | 582 | { |
| 583 | 583 | amstrad_plus_irq_cause = channel * 2; |
| 584 | 584 | amstrad_plus_asic_ram[0x2c0f] |= (0x40 >> channel); |
| 585 | | cpu_set_input_line(machine->cpu[0],0,ASSERT_LINE); |
| 585 | cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE); |
| 586 | 586 | logerror("DMA %i: INT\n",channel); |
| 587 | 587 | } |
| 588 | 588 | if (command & 0x20) // Stop processing on this channel |
| r4560 | r4561 | |
| 1206 | 1206 | { |
| 1207 | 1207 | if (amstrad_CRTC_HS_Counter >= 32) |
| 1208 | 1208 | { |
| 1209 | | cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE); |
| 1209 | cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE); |
| 1210 | 1210 | } |
| 1211 | 1211 | amstrad_CRTC_HS_Counter = 0; |
| 1212 | 1212 | } |
| r4560 | r4561 | |
| 1215 | 1215 | if ( amstrad_CRTC_HS_Counter >= 52 ) |
| 1216 | 1216 | { |
| 1217 | 1217 | amstrad_CRTC_HS_Counter = 0; |
| 1218 | | cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE); |
| 1218 | cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE); |
| 1219 | 1219 | } |
| 1220 | 1220 | } |
| 1221 | 1221 | amstrad_CRTC_HS = hsync ? 1 : 0; |
| r4560 | r4561 | |
| 1238 | 1238 | { |
| 1239 | 1239 | if( asic.pri == 0 || asic.enabled == 0) |
| 1240 | 1240 | { |
| 1241 | | cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE); |
| 1241 | cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE); |
| 1242 | 1242 | } |
| 1243 | 1243 | } |
| 1244 | 1244 | amstrad_CRTC_HS_Counter = 0; |
| r4560 | r4561 | |
| 1250 | 1250 | amstrad_CRTC_HS_Counter = 0; |
| 1251 | 1251 | if ( asic.pri == 0 || asic.enabled == 0 ) |
| 1252 | 1252 | { |
| 1253 | | cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE); |
| 1253 | cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE); |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
| 1256 | 1256 | |
| r4560 | r4561 | |
| 1262 | 1262 | if ( asic.pri == video_screen_get_vpos( device->machine->primary_screen ) ) |
| 1263 | 1263 | { |
| 1264 | 1264 | logerror("PRI: triggered, scanline %d\n",asic.pri); |
| 1265 | | cpu_set_input_line(device->machine->cpu[0],0,ASSERT_LINE); |
| 1265 | cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE); |
| 1266 | 1266 | amstrad_plus_irq_cause = 0x06; // raster interrupt vector |
| 1267 | 1267 | amstrad_CRTC_HS_Counter &= ~0x20; // ASIC PRI resets the MSB of the raster counter |
| 1268 | 1268 | } |
| r4560 | r4561 | |
| 1366 | 1366 | { |
| 1367 | 1367 | int pc; |
| 1368 | 1368 | |
| 1369 | | pc = cpu_get_pc(space->machine->cpu[0]); |
| 1369 | pc = cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")); |
| 1370 | 1370 | |
| 1371 | 1371 | /* there are two places where CALL &0065 can be found |
| 1372 | 1372 | in the multiface rom. At this address there is a RET. |
| r4560 | r4561 | |
| 1484 | 1484 | multiface_rethink_memory(machine); |
| 1485 | 1485 | |
| 1486 | 1486 | /* pulse the nmi line */ |
| 1487 | | cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); |
| 1487 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 1488 | 1488 | |
| 1489 | 1489 | /* initialise 0065 override to monitor calls to 0065 */ |
| 1490 | | memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),amstrad_multiface_directoverride); |
| 1490 | memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), amstrad_multiface_directoverride); |
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | } |
| r4560 | r4561 | |
| 1651 | 1651 | } |
| 1652 | 1652 | else // CPC+/GX4000 |
| 1653 | 1653 | { |
| 1654 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1654 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1655 | 1655 | |
| 1656 | 1656 | if ( asic.enabled && ( asic.rmr2 & 0x18 ) == 0x18 ) |
| 1657 | 1657 | { |
| r4560 | r4561 | |
| 1782 | 1782 | Aleste_RamBanks[i] = BankAddr; |
| 1783 | 1783 | AmstradCPC_RamBanks[i] = BankAddr; |
| 1784 | 1784 | } |
| 1785 | | } else {/* Need to add the ram expansion configuration here ! */ |
| 1785 | } |
| 1786 | else |
| 1787 | {/* Need to add the ram expansion configuration here ! */ |
| 1786 | 1788 | } |
| 1787 | 1789 | amstrad_rethinkMemory(machine); |
| 1788 | 1790 | } |
| r4560 | r4561 | |
| 1890 | 1892 | if ( asic.enabled ) |
| 1891 | 1893 | { |
| 1892 | 1894 | vector = (data & 0xf8) + (amstrad_plus_irq_cause); |
| 1893 | | cpu_set_input_line_vector(space->machine->cpu[0], 0, vector); |
| 1895 | cpu_set_input_line_vector(cputag_get_cpu(space->machine, "maincpu"), 0, vector); |
| 1894 | 1896 | logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data); |
| 1895 | 1897 | } |
| 1896 | 1898 | asic.dma_clear = data & 0x01; |
| r4560 | r4561 | |
| 1934 | 1936 | if(data & 0x40) |
| 1935 | 1937 | { |
| 1936 | 1938 | logerror("ASIC: DMA 0 IRQ acknowledge\n"); |
| 1937 | | cpu_set_input_line(space->machine->cpu[0],0,CLEAR_LINE); |
| 1939 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| 1938 | 1940 | amstrad_plus_irq_cause = 0x06; |
| 1939 | 1941 | amstrad_plus_asic_ram[0x2c0f] &= ~0x40; |
| 1940 | 1942 | } |
| 1941 | 1943 | if(data & 0x20) |
| 1942 | 1944 | { |
| 1943 | 1945 | logerror("ASIC: DMA 1 IRQ acknowledge\n"); |
| 1944 | | cpu_set_input_line(space->machine->cpu[0],0,CLEAR_LINE); |
| 1946 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| 1945 | 1947 | amstrad_plus_irq_cause = 0x06; |
| 1946 | 1948 | amstrad_plus_asic_ram[0x2c0f] &= ~0x20; |
| 1947 | 1949 | } |
| 1948 | 1950 | if(data & 0x10) |
| 1949 | 1951 | { |
| 1950 | 1952 | logerror("ASIC: DMA 2 IRQ acknowledge\n"); |
| 1951 | | cpu_set_input_line(space->machine->cpu[0],0,CLEAR_LINE); |
| 1953 | cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); |
| 1952 | 1954 | amstrad_plus_irq_cause = 0x06; |
| 1953 | 1955 | amstrad_plus_asic_ram[0x2c0f] &= ~0x10; |
| 1954 | 1956 | } |
| r4560 | r4561 | |
| 2044 | 2046 | static void amstrad_GateArray_write(running_machine *machine, UINT8 dataToGateArray) |
| 2045 | 2047 | { |
| 2046 | 2048 | /* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */ |
| 2047 | | switch ((dataToGateArray & 0xc0)>>6) { |
| 2049 | switch ((dataToGateArray & 0xc0)>>6) |
| 2050 | { |
| 2048 | 2051 | /* Pen selection |
| 2049 | 2052 | ------------- |
| 2050 | 2053 | Bit Value Function Bit Value Function |
| r4560 | r4561 | |
| 2130 | 2133 | if ( gate_array.mrer & 0x10 ) |
| 2131 | 2134 | { |
| 2132 | 2135 | amstrad_CRTC_HS_Counter = 0; |
| 2133 | | cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE); |
| 2136 | cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); |
| 2134 | 2137 | } |
| 2135 | 2138 | |
| 2136 | 2139 | /* b3b2 != 0 then change the state of upper or lower rom area and rethink memory */ |
| r4560 | r4561 | |
| 2311 | 2314 | /* if b14 = 0 : CRTC Read selected */ |
| 2312 | 2315 | if ((offset & (1<<14)) == 0) |
| 2313 | 2316 | { |
| 2314 | | switch(r1r0) { |
| 2317 | switch(r1r0) |
| 2318 | { |
| 2315 | 2319 | case 0x02: |
| 2316 | 2320 | data = mc6845_status_r( mc6845, 0 ); |
| 2317 | 2321 | // /* CRTC Type 1 : Read Status Register |
| r4560 | r4561 | |
| 2584 | 2588 | /* load CPCEMU style snapshots */ |
| 2585 | 2589 | static void amstrad_handle_snapshot(running_machine *machine, unsigned char *pSnapshot) |
| 2586 | 2590 | { |
| 2587 | | const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM); |
| 2591 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2588 | 2592 | const device_config *mc6845 = devtag_get_device(space->machine, "mc6845" ); |
| 2589 | 2593 | const device_config *ay8910 = devtag_get_device(machine, "ay"); |
| 2590 | 2594 | int RegData; |
| r4560 | r4561 | |
| 2592 | 2596 | |
| 2593 | 2597 | /* init Z80 */ |
| 2594 | 2598 | RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8); |
| 2595 | | cpu_set_reg(machine->cpu[0],Z80_AF, RegData); |
| 2599 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, RegData); |
| 2596 | 2600 | |
| 2597 | 2601 | RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8); |
| 2598 | | cpu_set_reg(machine->cpu[0],Z80_BC, RegData); |
| 2602 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, RegData); |
| 2599 | 2603 | |
| 2600 | 2604 | RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8); |
| 2601 | | cpu_set_reg(machine->cpu[0],Z80_DE, RegData); |
| 2605 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, RegData); |
| 2602 | 2606 | |
| 2603 | 2607 | RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8); |
| 2604 | | cpu_set_reg(machine->cpu[0],Z80_HL, RegData); |
| 2608 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, RegData); |
| 2605 | 2609 | |
| 2606 | 2610 | RegData = (pSnapshot[0x019] & 0x0ff) ; |
| 2607 | | cpu_set_reg(machine->cpu[0],Z80_R, RegData); |
| 2611 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, RegData); |
| 2608 | 2612 | |
| 2609 | 2613 | RegData = (pSnapshot[0x01a] & 0x0ff); |
| 2610 | | cpu_set_reg(machine->cpu[0],Z80_I, RegData); |
| 2614 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, RegData); |
| 2611 | 2615 | |
| 2612 | 2616 | if ((pSnapshot[0x01b] & 1)==1) |
| 2613 | 2617 | { |
| 2614 | | cpu_set_reg(machine->cpu[0],Z80_IFF1, 1); |
| 2618 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, 1); |
| 2615 | 2619 | } |
| 2616 | 2620 | else |
| 2617 | 2621 | { |
| 2618 | | cpu_set_reg(machine->cpu[0],Z80_IFF1, 0); |
| 2622 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, 0); |
| 2619 | 2623 | } |
| 2620 | 2624 | |
| 2621 | 2625 | if ((pSnapshot[0x01c] & 1)==1) |
| 2622 | 2626 | { |
| 2623 | | cpu_set_reg(machine->cpu[0],Z80_IFF2, 1); |
| 2627 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, 1); |
| 2624 | 2628 | } |
| 2625 | 2629 | else |
| 2626 | 2630 | { |
| 2627 | | cpu_set_reg(machine->cpu[0],Z80_IFF2, 0); |
| 2631 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, 0); |
| 2628 | 2632 | } |
| 2629 | 2633 | |
| 2630 | 2634 | RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8); |
| 2631 | | cpu_set_reg(machine->cpu[0],Z80_IX, RegData); |
| 2635 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, RegData); |
| 2632 | 2636 | |
| 2633 | 2637 | RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8); |
| 2634 | | cpu_set_reg(machine->cpu[0],Z80_IY, RegData); |
| 2638 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, RegData); |
| 2635 | 2639 | |
| 2636 | 2640 | RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8); |
| 2637 | | cpu_set_reg(machine->cpu[0],Z80_SP, RegData); |
| 2638 | | cpu_set_reg(machine->cpu[0],REG_GENSP,RegData); |
| 2641 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, RegData); |
| 2642 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP, RegData); |
| 2639 | 2643 | |
| 2640 | 2644 | RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8); |
| 2641 | 2645 | |
| 2642 | | cpu_set_reg(machine->cpu[0],Z80_PC, RegData); |
| 2643 | | // cpu_set_reg(machine->cpu[0],REG_SP,RegData); |
| 2646 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, RegData); |
| 2647 | // cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_SP, RegData); |
| 2644 | 2648 | |
| 2645 | 2649 | RegData = (pSnapshot[0x025] & 0x0ff); |
| 2646 | | cpu_set_reg(machine->cpu[0],Z80_IM, RegData); |
| 2650 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, RegData); |
| 2647 | 2651 | |
| 2648 | 2652 | RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8); |
| 2649 | | cpu_set_reg(machine->cpu[0],Z80_AF2, RegData); |
| 2653 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, RegData); |
| 2650 | 2654 | |
| 2651 | 2655 | RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8); |
| 2652 | | cpu_set_reg(machine->cpu[0],Z80_BC2, RegData); |
| 2656 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, RegData); |
| 2653 | 2657 | |
| 2654 | 2658 | RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8); |
| 2655 | | cpu_set_reg(machine->cpu[0],Z80_DE2, RegData); |
| 2659 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, RegData); |
| 2656 | 2660 | |
| 2657 | 2661 | RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8); |
| 2658 | | cpu_set_reg(machine->cpu[0],Z80_HL2, RegData); |
| 2662 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, RegData); |
| 2659 | 2663 | |
| 2660 | 2664 | /* init GA */ |
| 2661 | 2665 | for (i=0; i<17; i++) |
| r4560 | r4561 | |
| 2804 | 2808 | } |
| 2805 | 2809 | |
| 2806 | 2810 | /* multiface hardware enabled? */ |
| 2807 | | if (multiface_hardware_enabled(machine)) { |
| 2811 | if (multiface_hardware_enabled(machine)) |
| 2812 | { |
| 2808 | 2813 | multiface_rethink_memory(machine); |
| 2809 | 2814 | } |
| 2810 | 2815 | } |
| r4560 | r4561 | |
| 2854 | 2859 | static unsigned char amstrad_Psg_FunctionSelected; |
| 2855 | 2860 | static void update_psg(running_machine *machine) |
| 2856 | 2861 | { |
| 2857 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2862 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2858 | 2863 | const device_config *ay8910 = devtag_get_device(machine, "ay"); |
| 2859 | 2864 | |
| 2860 | 2865 | if(aleste_mode & 0x20) // RTC selected |
| r4560 | r4561 | |
| 2946 | 2951 | /* Set b7 with cassette tape input */ |
| 2947 | 2952 | if(amstrad_system_type != SYSTEM_GX4000) |
| 2948 | 2953 | { |
| 2949 | | if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03) { |
| 2954 | if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03) |
| 2955 | { |
| 2950 | 2956 | data |= (1<<7); |
| 2951 | 2957 | } |
| 2952 | 2958 | } |
| r4560 | r4561 | |
| 3011 | 3017 | /* b5 Cassette Write data */ |
| 3012 | 3018 | if(amstrad_system_type != SYSTEM_GX4000) |
| 3013 | 3019 | { |
| 3014 | | if ((changed_data & 0x20) != 0) { |
| 3020 | if ((changed_data & 0x20) != 0) |
| 3021 | { |
| 3015 | 3022 | cassette_output(devtag_get_device(device->machine, "cassette" ), |
| 3016 | 3023 | ((data & 0x20) ? -1.0 : +1.0)); |
| 3017 | 3024 | } |
| r4560 | r4561 | |
| 3074 | 3081 | amstrad_plus_asic_ram[0x2c0f] &= ~0x80; // not a raster interrupt, so this bit is reset |
| 3075 | 3082 | return (amstrad_plus_asic_ram[0x2805] & 0xf8) | amstrad_plus_irq_cause; |
| 3076 | 3083 | } |
| 3077 | | cpu_set_input_line(device->machine->cpu[0],0, CLEAR_LINE); |
| 3084 | cputag_set_input_line(device->machine,"maincpu", 0, CLEAR_LINE); |
| 3078 | 3085 | amstrad_CRTC_HS_Counter &= 0x1F; |
| 3079 | 3086 | if ( asic.enabled ) |
| 3080 | 3087 | { |
| r4560 | r4561 | |
| 3213 | 3220 | |
| 3214 | 3221 | static void amstrad_common_init(running_machine *machine) |
| 3215 | 3222 | { |
| 3216 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 3223 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 3217 | 3224 | |
| 3218 | 3225 | aleste_mode = 0; |
| 3219 | 3226 | |
| r4560 | r4561 | |
| 3245 | 3252 | memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_BANK15); |
| 3246 | 3253 | memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_BANK16); |
| 3247 | 3254 | |
| 3248 | | device_reset(space->machine->cpu[0]); |
| 3255 | device_reset(cputag_get_cpu(space->machine, "maincpu")); |
| 3249 | 3256 | if ( amstrad_system_type == SYSTEM_CPC || amstrad_system_type == SYSTEM_ALESTE ) |
| 3250 | | cpu_set_input_line_vector(machine->cpu[0], 0,0xff); |
| 3257 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0xff); |
| 3251 | 3258 | else |
| 3252 | | cpu_set_input_line_vector(machine->cpu[0], 0,0x00); |
| 3259 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0x00); |
| 3253 | 3260 | |
| 3254 | 3261 | if(amstrad_system_type != SYSTEM_GX4000) |
| 3255 | 3262 | { |
| r4560 | r4561 | |
| 3267 | 3274 | |
| 3268 | 3275 | /* Using the cool code Juergen has provided, I will override |
| 3269 | 3276 | the timing tables with the values for the amstrad */ |
| 3270 | | z80_set_cycle_tables(machine->cpu[0], |
| 3277 | z80_set_cycle_tables(cputag_get_cpu(machine, "maincpu"), |
| 3271 | 3278 | (void*)amstrad_cycle_table_op, |
| 3272 | 3279 | (void*)amstrad_cycle_table_cb, |
| 3273 | 3280 | (void*)amstrad_cycle_table_ed, |
| r4560 | r4561 | |
| 3276 | 3283 | (void*)amstrad_cycle_table_ex); |
| 3277 | 3284 | |
| 3278 | 3285 | /* Juergen is a cool dude! */ |
| 3279 | | cpu_set_irq_callback(machine->cpu[0], amstrad_cpu_acknowledge_int); |
| 3286 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), amstrad_cpu_acknowledge_int); |
| 3280 | 3287 | } |
| 3281 | 3288 | |
| 3282 | 3289 | |
src/mess/drivers/aquarius.c
| r4560 | r4561 | |
| 219 | 219 | |
| 220 | 220 | static INPUT_CHANGED( aquarius_reset ) |
| 221 | 221 | { |
| 222 | | cpu_set_input_line(field->port->machine->cpu[0], INPUT_LINE_RESET, (input_port_read(field->port->machine, "RESET") ? CLEAR_LINE : ASSERT_LINE)); |
| 222 | cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_RESET, (input_port_read(field->port->machine, "RESET") ? CLEAR_LINE : ASSERT_LINE)); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | static INPUT_PORTS_START(aquarius) |
| r4560 | r4561 | |
| 358 | 358 | switch (mess_ram_size) |
| 359 | 359 | { |
| 360 | 360 | case 4 * 1024: |
| 361 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 361 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 362 | 362 | break; |
| 363 | 363 | |
| 364 | 364 | case 8 * 1024: // 4K expansion |
| 365 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 366 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 365 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x4fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 366 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 20 * 1024: // 16K expansion |
| 370 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x8fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 371 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 370 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x8fff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 371 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP); |
| 372 | 372 | break; |
| 373 | 373 | |
| 374 | 374 | case 36 * 1024: // 32K expansion (prototype) |
| 375 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 375 | memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1); |
| 376 | 376 | break; |
| 377 | 377 | } |
| 378 | 378 | |
| r4560 | r4561 | |
| 398 | 398 | switch (size) |
| 399 | 399 | { |
| 400 | 400 | case 8 * 1024: |
| 401 | | memory_install_readwrite8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0x2000, SMH_BANK2, SMH_UNMAP); |
| 401 | memory_install_readwrite8_handler(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0x2000, SMH_BANK2, SMH_UNMAP); |
| 402 | 402 | break; |
| 403 | 403 | |
| 404 | 404 | case 16 * 1024: |
| 405 | | memory_install_readwrite8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_UNMAP); |
| 405 | memory_install_readwrite8_handler(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_UNMAP); |
| 406 | 406 | break; |
| 407 | 407 | } |
| 408 | 408 | |