src/mess/machine/mac.c
| r9315 | r9316 | |
| 2342 | 2342 | timer_adjust_oneshot(mac->pmu_send_timer, attotime_make(0, ATTOSECONDS_IN_USEC(200)), 0); |
| 2343 | 2343 | } |
| 2344 | 2344 | |
| 2345 | | // 900c74, 901ba4, 901bd8 |
| 2346 | 2345 | static void pmu_exec(mac_state *mac) |
| 2347 | 2346 | { |
| 2348 | 2347 | mac->pm_sptr = 0; // clear send pointer |
| r9315 | r9316 | |
| 2363 | 2362 | { |
| 2364 | 2363 | mac->rtc_ram[mac->pm_cmd[2] + i] = mac->pm_cmd[4+i]; |
| 2365 | 2364 | } |
| 2365 | } |
| 2366 | break; |
| 2366 | 2367 | |
| 2367 | | // no reply? |
| 2368 | case 0x39: // read first 20 bytes of PRAM |
| 2369 | { |
| 2370 | int i; |
| 2371 | |
| 2372 | mac->pm_out[0] = 20; |
| 2373 | for (i = 0; i < 20; i++) |
| 2374 | { |
| 2375 | mac->pm_out[1 + i] = mac->rtc_ram[i]; |
| 2376 | } |
| 2377 | mac->pm_slen = 21; |
| 2378 | timer_adjust_oneshot(mac->pmu_send_timer, attotime_make(0, ATTOSECONDS_IN_USEC(200)), 0); |
| 2368 | 2379 | } |
| 2380 | break; |
| 2369 | 2381 | |
| 2370 | 2382 | case 0x3a: // read extended PRAM byte(s). cmd[2] = address, cmd[3] = length |
| 2371 | 2383 | if ((mac->pm_cmd[2] + mac->pm_cmd[3]) < 0x100) |
| r9315 | r9316 | |
| 2382 | 2394 | } |
| 2383 | 2395 | break; |
| 2384 | 2396 | |
| 2397 | case 0x68: // read battery/charger level |
| 2398 | pmu_one_byte_reply(mac, 1); |
| 2399 | break; |
| 2400 | |
| 2385 | 2401 | case 0x78: // read interrupt flag |
| 2386 | 2402 | pmu_one_byte_reply(mac, 0); |
| 2387 | 2403 | break; |
| r9315 | r9316 | |
| 2539 | 2555 | case MODEL_MAC_PORTABLE: |
| 2540 | 2556 | case MODEL_MAC_PB100: |
| 2541 | 2557 | #if LOG_ADB |
| 2542 | | printf("Read PM data %x\n", mac->pm_data_recv); |
| 2558 | // printf("Read PM data %x\n", mac->pm_data_recv); |
| 2543 | 2559 | #endif |
| 2544 | 2560 | return mac->pm_data_recv; |
| 2545 | 2561 | |
| r9315 | r9316 | |
| 2586 | 2602 | if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100) |
| 2587 | 2603 | { |
| 2588 | 2604 | // printf("Read VIA B: PM_ACK %x\n", mac->pm_ack); |
| 2589 | | val = 0x80 | mac->pm_ack; // SCC wait/request |
| 2605 | val = 0x80 | 0x04 | mac->pm_ack; // SCC wait/request (bit 2 must be set at 900c1a or startup tests always fail) |
| 2590 | 2606 | } |
| 2591 | 2607 | else |
| 2592 | 2608 | { |
| r9315 | r9316 | |
| 2637 | 2653 | if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100) |
| 2638 | 2654 | { |
| 2639 | 2655 | #if LOG_ADB |
| 2640 | | printf("%02x to PM\n", data); |
| 2656 | // printf("%02x to PM\n", data); |
| 2641 | 2657 | #endif |
| 2642 | 2658 | mac->pm_data_send = data; |
| 2643 | 2659 | return; |
| r9315 | r9316 | |
| 2704 | 2720 | } |
| 2705 | 2721 | } |
| 2706 | 2722 | } |
| 2707 | | if (!(data & 1) && (mac->pm_req & 1)) |
| 2723 | else if (!(data & 1) && (mac->pm_req & 1)) |
| 2708 | 2724 | { |
| 2709 | 2725 | if (mac->pm_state == 0) |
| 2710 | 2726 | { |
| r9315 | r9316 | |
| 2720 | 2736 | mac->pm_slen--; |
| 2721 | 2737 | mac->pm_ack |= 2; // raise ACK to indicate available byte |
| 2722 | 2738 | #if LOG_ADB |
| 2723 | | printf("PM: sending byte %02x\n", mac->pm_data_recv); |
| 2739 | printf("PM: 68k asserted /REQ, sending byte %02x\n", mac->pm_data_recv); |
| 2724 | 2740 | #endif |
| 2725 | 2741 | |
| 2726 | 2742 | // another byte to send? |
| r9315 | r9316 | |
| 2731 | 2747 | else |
| 2732 | 2748 | { |
| 2733 | 2749 | mac->pm_state = 0; // back to receive state |
| 2750 | timer_adjust_oneshot(mac->pmu_send_timer, attotime_never, 0); |
| 2734 | 2751 | } |
| 2735 | 2752 | } |
| 2736 | 2753 | } |
| 2754 | |
| 2737 | 2755 | mac->pm_req = data & 1; |
| 2738 | 2756 | return; |
| 2739 | 2757 | } |
| r9315 | r9316 | |
| 2982 | 3000 | adb_reset(mac); |
| 2983 | 3001 | } |
| 2984 | 3002 | |
| 2985 | | if (mac->mac_model >= MODEL_MAC_PLUS) |
| 2986 | | { |
| 2987 | | // ncr5380_scan_devices(machine->device("ncr5380")); |
| 2988 | | } |
| 2989 | | |
| 2990 | 3003 | if ((mac->mac_model == MODEL_MAC_SE) || (mac->mac_model == MODEL_MAC_CLASSIC)) |
| 2991 | 3004 | { |
| 2992 | 3005 | mac_set_sound_buffer(machine->device("custom"), 1); |
| r9315 | r9316 | |
| 2996 | 3009 | } |
| 2997 | 3010 | |
| 2998 | 3011 | scsi_interrupt = 0; |
| 2999 | | mac->mac_nubus_irq_state = 0xff; |
| 3000 | | if (machine->device<cpu_device>("maincpu")->debug()) { |
| 3012 | if (machine->device<cpu_device>("maincpu")->debug()) |
| 3013 | { |
| 3001 | 3014 | machine->device<cpu_device>("maincpu")->debug()->set_dasm_override(mac_dasm_override); |
| 3002 | 3015 | } |
| 3003 | 3016 | |
| r9315 | r9316 | |
| 3005 | 3018 | mac->mac_scsiirq_enable = 0; |
| 3006 | 3019 | mac->mac_via2_vbl = 0; |
| 3007 | 3020 | mac->mac_se30_vbl_enable = 0; |
| 3008 | | mac->mac_nubus_irq_state = 0; |
| 3021 | mac->mac_nubus_irq_state = 0xff; |
| 3009 | 3022 | mac->keyboard_reply = 0; |
| 3010 | 3023 | mac->kbd_comm = 0; |
| 3011 | 3024 | mac->kbd_receive = 0; |
src/mess/drivers/mac.c
| r9315 | r9316 | |
| 86 | 86 | rbv_regs[2] = 0xff; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | | static VIDEO_UPDATE( macrbv ) |
| 89 | // do this here - VIDEO_UPDATE is called each scanline when stepping in the |
| 90 | // debugger, which means you can't escape the VIA2 IRQ handler |
| 91 | static INTERRUPT_GEN( mac_rbv_vbl ) |
| 90 | 92 | { |
| 91 | | UINT32 *scanline; |
| 92 | | int x, y; |
| 93 | | |
| 94 | 93 | rbv_regs[2] &= ~0x40; // set vblank signal |
| 95 | 94 | |
| 96 | 95 | if ((rbv_regs[0x12] & 0x40) && (rbv_ier & 0x2)) |
| 97 | 96 | { |
| 98 | 97 | rbv_ifr |= 0x82; |
| 99 | | mac_set_via2_interrupt(screen->machine, 1); |
| 98 | mac_set_via2_interrupt(device->machine, 1); |
| 100 | 99 | } |
| 100 | } |
| 101 | 101 | |
| 102 | static VIDEO_UPDATE( macrbv ) |
| 103 | { |
| 104 | UINT32 *scanline; |
| 105 | int x, y; |
| 106 | |
| 102 | 107 | switch (rbv_regs[0x10] & 7) |
| 103 | 108 | { |
| 104 | 109 | case 0: // 1bpp |
| r9315 | r9316 | |
| 166 | 171 | } |
| 167 | 172 | } |
| 168 | 173 | break; |
| 174 | |
| 175 | case 3: // 8bpp |
| 176 | { |
| 177 | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 178 | UINT8 pixels; |
| 179 | |
| 180 | for (y = 0; y < 480; y++) |
| 181 | { |
| 182 | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 183 | |
| 184 | for (x = 0; x < 640; x++) |
| 185 | { |
| 186 | pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; |
| 187 | *scanline++ = rbv_palette[pixels]; |
| 188 | } |
| 189 | } |
| 190 | } |
| 169 | 191 | } |
| 170 | 192 | |
| 171 | 193 | return 0; |
| r9315 | r9316 | |
| 256 | 278 | { |
| 257 | 279 | if (offset < 0x100) |
| 258 | 280 | { |
| 259 | | // if ((offset != 3) && (offset != 0x12)) printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, cpu_get_pc(space->cpu)); |
| 281 | // if (offset == 0x10) printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, cpu_get_pc(space->cpu)); |
| 260 | 282 | switch (offset) |
| 261 | 283 | { |
| 262 | 284 | case 0x03: |
| r9315 | r9316 | |
| 265 | 287 | break; |
| 266 | 288 | |
| 267 | 289 | case 0x10: |
| 268 | | rbv_immed10wr = 1; |
| 290 | if (data != 0) |
| 291 | { |
| 292 | rbv_immed10wr = 1; |
| 293 | } |
| 269 | 294 | rbv_regs[offset] = data; |
| 270 | 295 | break; |
| 271 | 296 | |
| r9315 | r9316 | |
| 531 | 556 | return 0; |
| 532 | 557 | } |
| 533 | 558 | |
| 559 | static READ16_HANDLER(mac_config_r) |
| 560 | { |
| 561 | return 0xffff; // not sure what this does |
| 562 | } |
| 563 | |
| 534 | 564 | /*************************************************************************** |
| 535 | 565 | ADDRESS MAPS |
| 536 | 566 | ***************************************************************************/ |
| r9315 | r9316 | |
| 559 | 589 | AM_RANGE(0xf90000, 0xf9ffff) AM_READWRITE(macplus_scsi_r, macplus_scsi_w) |
| 560 | 590 | AM_RANGE(0xfa8000, 0xfaffff) AM_RAM // VRAM |
| 561 | 591 | AM_RANGE(0xfb0000, 0xfbffff) AM_READWRITE8(mac_asc_r, mac_asc_w, 0xffff) |
| 592 | AM_RANGE(0xfc0000, 0xfcffff) AM_READ(mac_config_r) |
| 562 | 593 | AM_RANGE(0xfd0000, 0xfdffff) AM_READWRITE(mac_scc_r, mac_scc_2_w) |
| 563 | 594 | AM_RANGE(0xfffff0, 0xffffff) AM_READWRITE(mac_autovector_r, mac_autovector_w) |
| 564 | 595 | ADDRESS_MAP_END |
| r9315 | r9316 | |
| 869 | 900 | |
| 870 | 901 | /* internal ram */ |
| 871 | 902 | MDRV_RAM_ADD("messram") |
| 872 | | MDRV_RAM_DEFAULT_SIZE("2M") |
| 873 | | MDRV_RAM_EXTRA_OPTIONS("2M,4M,6M,8M") |
| 903 | MDRV_RAM_DEFAULT_SIZE("1M") |
| 904 | MDRV_RAM_EXTRA_OPTIONS("1M,3M,5M,7M,9M") |
| 874 | 905 | |
| 875 | 906 | MACHINE_CONFIG_END |
| 876 | 907 | |
| r9315 | r9316 | |
| 1060 | 1091 | |
| 1061 | 1092 | MDRV_CPU_REPLACE("maincpu", M68030, 25000000) |
| 1062 | 1093 | MDRV_CPU_PROGRAM_MAP(maciici_map) |
| 1094 | MDRV_CPU_VBLANK_INT("screen", mac_rbv_vbl) |
| 1063 | 1095 | |
| 1064 | 1096 | MDRV_PALETTE_LENGTH(256) |
| 1065 | 1097 | |