src/mess/machine/mac.c
| r9345 | r9346 | |
| 85 | 85 | #define AUDIO_IS_CLASSIC (mac->mac_model < MODEL_MAC_II) && (mac->mac_model != MODEL_MAC_PORTABLE) && (mac->mac_model != MODEL_MAC_PB100) |
| 86 | 86 | #define MAC_HAS_VIA2 (mac->mac_model >= MODEL_MAC_II) |
| 87 | 87 | |
| 88 | #define ASC_INTS_RBV ((mac->mac_model == MODEL_MAC_IICI) || (mac->mac_model == MODEL_MAC_IISI) || (mac->mac_model >= MODEL_MAC_LC && mac->mac_model <= MODEL_MAC_COLOR_CLASSIC)) |
| 89 | |
| 88 | 90 | #ifdef MAME_DEBUG |
| 89 | 91 | #define LOG_VIA 0 |
| 90 | 92 | #define LOG_RTC 0 |
| r9345 | r9346 | |
| 102 | 104 | #endif |
| 103 | 105 | |
| 104 | 106 | #define LOG_ADB 0 |
| 107 | #define LOG_ADB_MCU_CMD 0 |
| 105 | 108 | |
| 106 | 109 | // ADB states |
| 107 | 110 | #define ADB_STATE_NEW_COMMAND (0) |
| r9345 | r9346 | |
| 308 | 311 | { |
| 309 | 312 | mac_state *mac = device->machine->driver_data<mac_state>(); |
| 310 | 313 | |
| 311 | | if (mac->mac_model >= MODEL_MAC_II) |
| 314 | if (ASC_INTS_RBV) |
| 312 | 315 | { |
| 316 | mac->rbv_regs[3] |= 0x90; // any VIA 2 interrupt | sound interrupt |
| 317 | |
| 318 | // (need to figure out what gets triggered here) |
| 319 | } |
| 320 | else if (mac->mac_model >= MODEL_MAC_II) |
| 321 | { |
| 313 | 322 | via6522_device *via2 = device->machine->device<via6522_device>("via6522_1"); |
| 314 | 323 | |
| 315 | 324 | via2->write_cb1(state^1); |
| r9345 | r9346 | |
| 2098 | 2107 | switch (mac->adb_buffer[1]) |
| 2099 | 2108 | { |
| 2100 | 2109 | case 0x01: // enable/disable ADB auto-polling |
| 2101 | | #if LOG_ADB |
| 2110 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2102 | 2111 | if (mac->adb_buffer[2]) |
| 2103 | 2112 | { |
| 2104 | 2113 | printf("ADB: Egret enable ADB auto-poll\n"); |
| r9345 | r9346 | |
| 2116 | 2125 | { |
| 2117 | 2126 | int addr = mac->adb_buffer[2]<<8 | mac->adb_buffer[3]; |
| 2118 | 2127 | |
| 2119 | | #if LOG_ADB |
| 2128 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2120 | 2129 | printf("ADB: Egret read 6805 address %x\n", addr); |
| 2121 | 2130 | #endif |
| 2122 | 2131 | |
| r9345 | r9346 | |
| 2135 | 2144 | break; |
| 2136 | 2145 | |
| 2137 | 2146 | case 0x03: // read RTC |
| 2138 | | #if LOG_ADB |
| 2147 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2139 | 2148 | printf("ADB: Egret read RTC = %08x\n", mac->rtc_seconds[3]<<24|mac->rtc_seconds[2]<<16|mac->rtc_seconds[1]<<8|mac->rtc_seconds[0]); |
| 2140 | 2149 | #endif |
| 2141 | 2150 | |
| r9345 | r9346 | |
| 2143 | 2152 | break; |
| 2144 | 2153 | |
| 2145 | 2154 | case 0x07: // read PRAM |
| 2146 | | #if LOG_ADB |
| 2155 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2147 | 2156 | printf("ADB: Egret read PRAM from %x\n", mac->adb_buffer[2]<<8 | mac->adb_buffer[3]); |
| 2148 | 2157 | #endif |
| 2149 | 2158 | |
| r9345 | r9346 | |
| 2155 | 2164 | int addr = mac->adb_buffer[2]<<8 | mac->adb_buffer[3]; |
| 2156 | 2165 | int len = mac->adb_datasize - 4; |
| 2157 | 2166 | |
| 2158 | | #if LOG_ADB |
| 2167 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2159 | 2168 | printf("ADB: Egret write %d bytes to address %x\n", len, addr); |
| 2160 | 2169 | #endif |
| 2161 | 2170 | |
| r9345 | r9346 | |
| 2167 | 2176 | mac->rtc_ram[(addr-0x100)+i] = mac->adb_buffer[4+i]; |
| 2168 | 2177 | } |
| 2169 | 2178 | } |
| 2170 | | #if LOG_ADB |
| 2179 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2171 | 2180 | else |
| 2172 | 2181 | { |
| 2173 | 2182 | printf("ADB: Egret unhandled direct write @ %x\n", addr); |
| r9345 | r9346 | |
| 2179 | 2188 | break; |
| 2180 | 2189 | |
| 2181 | 2190 | case 0x0c: // write PRAM |
| 2182 | | #if LOG_ADB |
| 2191 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2183 | 2192 | printf("ADB: Egret write %02x to PRAM at %x\n", mac->adb_buffer[4], mac->adb_buffer[2]<<8 | mac->adb_buffer[3]); |
| 2184 | 2193 | #endif |
| 2185 | 2194 | |
| r9345 | r9346 | |
| 2196 | 2205 | break; |
| 2197 | 2206 | |
| 2198 | 2207 | case 0x0e: // send to DFAC |
| 2199 | | #if LOG_ADB |
| 2208 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2200 | 2209 | printf("ADB: Egret send %02x to DFAC\n", mac->adb_buffer[2]); |
| 2201 | 2210 | #endif |
| 2202 | 2211 | |
| r9345 | r9346 | |
| 2204 | 2213 | break; |
| 2205 | 2214 | |
| 2206 | 2215 | case 0x1b: // set one-second interrupt |
| 2207 | | #if LOG_ADB |
| 2216 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2208 | 2217 | if (mac->adb_buffer[2]) |
| 2209 | 2218 | { |
| 2210 | 2219 | printf("ADB: Egret enable one-second IRQ\n"); |
| r9345 | r9346 | |
| 2219 | 2228 | break; |
| 2220 | 2229 | |
| 2221 | 2230 | case 0x1c: // enable/disable keyboard NMI |
| 2222 | | #if LOG_ADB |
| 2231 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2223 | 2232 | if (mac->adb_buffer[2]) |
| 2224 | 2233 | { |
| 2225 | 2234 | printf("ADB: Egret enable keyboard NMI\n"); |
| r9345 | r9346 | |
| 2234 | 2243 | break; |
| 2235 | 2244 | |
| 2236 | 2245 | default: |
| 2237 | | #if LOG_ADB |
| 2246 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2238 | 2247 | printf("ADB: Unknown Egret MCU command %02x\n", mac->adb_buffer[1]); |
| 2239 | 2248 | #endif |
| 2240 | 2249 | break; |
| r9345 | r9346 | |
| 2285 | 2294 | // if bit 2 drops and bit 1 is zero, execute the command |
| 2286 | 2295 | if (!(state & 0x02) && !(state & 0x04) && (mac->adb_state & 0x04) && (mac->adb_datasize > 0)) |
| 2287 | 2296 | { |
| 2288 | | #if LOG_ADB |
| 2297 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2289 | 2298 | int i; |
| 2290 | 2299 | |
| 2291 | 2300 | printf("Egret ADB: exec command with %d bytes: ", mac->adb_datasize); |
| r9345 | r9346 | |
| 2302 | 2311 | switch (mac->adb_buffer[0]) |
| 2303 | 2312 | { |
| 2304 | 2313 | case 0: // ADB command |
| 2305 | | mac->adb_datasize = 0; |
| 2314 | switch (mac->adb_buffer[1] & 0xf) |
| 2315 | { |
| 2316 | case 0: // reset |
| 2317 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2318 | printf("Egret: ADB Reset\n"); |
| 2319 | #endif |
| 2320 | mac_egret_response_std(mac, 0, 0, 0); |
| 2321 | break; |
| 2322 | |
| 2323 | case 1: // flush |
| 2324 | #if LOG_ADB || LOG_ADB_MCU_CMD |
| 2325 | printf("Egret: ADB Reset\n"); |
| 2326 | #endif |
| 2327 | mac_egret_response_std(mac, 1, 0, 0); |
| 2328 | break; |
| 2329 | |
| 2330 | default: |
| 2331 | printf("Egret: Unhandled ADB command %x\n", mac->adb_buffer[1]); |
| 2332 | mac->adb_datasize = 0; |
| 2333 | break; |
| 2334 | |
| 2335 | } |
| 2306 | 2336 | break; |
| 2307 | 2337 | |
| 2308 | 2338 | case 1: // general Egret MCU command |
src/mess/video/mac.c
| r9345 | r9346 | |
| 199 | 199 | *scanline++ = cb264_palette[pixels&0xf0]; |
| 200 | 200 | *scanline++ = cb264_palette[(pixels<<4)&0xf0]; |
| 201 | 201 | } |
| 202 | | } |
| 202 | } |
| 203 | 203 | } |
| 204 | 204 | break; |
| 205 | 205 | |
| r9345 | r9346 | |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | // IIci/IIsi RAM-Based Video (RBV) |
| 316 | |
| 317 | VIDEO_START( macrbv ) |
| 318 | { |
| 319 | mac_state *mac = machine->driver_data<mac_state>(); |
| 320 | |
| 321 | memset(mac->rbv_regs, 0, sizeof(mac->rbv_regs)); |
| 322 | |
| 323 | mac->rbv_count = 0; |
| 324 | mac->rbv_clutoffs = 0; |
| 325 | mac->rbv_immed10wr = 0; |
| 326 | |
| 327 | mac->rbv_regs[2] = 0xff; |
| 328 | } |
| 329 | |
| 330 | VIDEO_UPDATE( macrbv ) |
| 331 | { |
| 332 | UINT32 *scanline; |
| 333 | int x, y; |
| 334 | mac_state *mac = screen->machine->driver_data<mac_state>(); |
| 335 | |
| 336 | switch (mac->rbv_regs[0x10] & 7) |
| 337 | { |
| 338 | case 0: // 1bpp |
| 339 | { |
| 340 | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 341 | UINT8 pixels; |
| 342 | |
| 343 | for (y = 0; y < 480; y++) |
| 344 | { |
| 345 | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 346 | for (x = 0; x < 640; x+=8) |
| 347 | { |
| 348 | pixels = vram8[(y * 80) + ((x/8)^3)]; |
| 349 | |
| 350 | *scanline++ = mac->rbv_palette[0xfe|(pixels>>7)]; |
| 351 | *scanline++ = mac->rbv_palette[0xfe|((pixels>>6)&1)]; |
| 352 | *scanline++ = mac->rbv_palette[0xfe|((pixels>>5)&1)]; |
| 353 | *scanline++ = mac->rbv_palette[0xfe|((pixels>>4)&1)]; |
| 354 | *scanline++ = mac->rbv_palette[0xfe|((pixels>>3)&1)]; |
| 355 | *scanline++ = mac->rbv_palette[0xfe|((pixels>>2)&1)]; |
| 356 | *scanline++ = mac->rbv_palette[0xfe|((pixels>>1)&1)]; |
| 357 | *scanline++ = mac->rbv_palette[0xfe|(pixels&1)]; |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | break; |
| 362 | |
| 363 | case 1: // 2bpp |
| 364 | { |
| 365 | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 366 | UINT8 pixels; |
| 367 | |
| 368 | for (y = 0; y < 480; y++) |
| 369 | { |
| 370 | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 371 | for (x = 0; x < 640/4; x++) |
| 372 | { |
| 373 | pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; |
| 374 | |
| 375 | *scanline++ = mac->rbv_palette[0xfc|((pixels>>6)&3)]; |
| 376 | *scanline++ = mac->rbv_palette[0xfc|((pixels>>4)&3)]; |
| 377 | *scanline++ = mac->rbv_palette[0xfc|((pixels>>2)&3)]; |
| 378 | *scanline++ = mac->rbv_palette[0xfc|(pixels&3)]; |
| 379 | } |
| 380 | } |
| 381 | } |
| 382 | break; |
| 383 | |
| 384 | case 2: // 4bpp |
| 385 | { |
| 386 | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 387 | UINT8 pixels; |
| 388 | |
| 389 | for (y = 0; y < 480; y++) |
| 390 | { |
| 391 | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 392 | |
| 393 | for (x = 0; x < 640/2; x++) |
| 394 | { |
| 395 | pixels = vram8[(y * 320) + (BYTE4_XOR_BE(x))]; |
| 396 | |
| 397 | *scanline++ = mac->rbv_palette[0xf0|(pixels>>4)]; |
| 398 | *scanline++ = mac->rbv_palette[0xf0|(pixels&0xf)]; |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | break; |
| 403 | |
| 404 | case 3: // 8bpp |
| 405 | { |
| 406 | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 407 | UINT8 pixels; |
| 408 | |
| 409 | for (y = 0; y < 480; y++) |
| 410 | { |
| 411 | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 412 | |
| 413 | for (x = 0; x < 640; x++) |
| 414 | { |
| 415 | pixels = vram8[(y * 640) + (BYTE4_XOR_BE(x))]; |
| 416 | *scanline++ = mac->rbv_palette[pixels]; |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | return 0; |
| 423 | } |
| 424 | |
src/mess/drivers/mac.c
| r9345 | r9346 | |
| 69 | 69 | return 0x17171717; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | | // IIci/IIsi RAM-Based Video (RBV) |
| 73 | | |
| 74 | | static UINT8 rbv_regs[256], rbv_ier, rbv_ifr; |
| 75 | | static UINT32 rbv_colors[3], rbv_count, rbv_clutoffs, rbv_immed10wr; |
| 76 | | static UINT32 rbv_palette[256]; |
| 77 | | |
| 78 | | static VIDEO_START( macrbv ) |
| 79 | | { |
| 80 | | memset(rbv_regs, 0, sizeof(rbv_regs)); |
| 81 | | |
| 82 | | rbv_count = 0; |
| 83 | | rbv_clutoffs = 0; |
| 84 | | rbv_immed10wr = 0; |
| 85 | | |
| 86 | | rbv_regs[2] = 0xff; |
| 87 | | } |
| 88 | | |
| 89 | 72 | // do this here - VIDEO_UPDATE is called each scanline when stepping in the |
| 90 | 73 | // debugger, which means you can't escape the VIA2 IRQ handler |
| 91 | | static INTERRUPT_GEN( mac_rbv_vbl ) |
| 74 | INTERRUPT_GEN( mac_rbv_vbl ) |
| 92 | 75 | { |
| 93 | | rbv_regs[2] &= ~0x40; // set vblank signal |
| 76 | mac_state *mac = device->machine->driver_data<mac_state>(); |
| 94 | 77 | |
| 95 | | if ((rbv_regs[0x12] & 0x40) && (rbv_ier & 0x2)) |
| 78 | mac->rbv_regs[2] &= ~0x40; // set vblank signal |
| 79 | |
| 80 | if ((mac->rbv_regs[0x12] & 0x40) && (mac->rbv_ier & 0x2)) |
| 96 | 81 | { |
| 97 | | rbv_ifr |= 0x82; |
| 82 | mac->rbv_ifr |= 0x82; |
| 98 | 83 | mac_set_via2_interrupt(device->machine, 1); |
| 99 | 84 | } |
| 100 | 85 | } |
| 101 | 86 | |
| 102 | | static VIDEO_UPDATE( macrbv ) |
| 103 | | { |
| 104 | | UINT32 *scanline; |
| 105 | | int x, y; |
| 106 | | |
| 107 | | switch (rbv_regs[0x10] & 7) |
| 108 | | { |
| 109 | | case 0: // 1bpp |
| 110 | | { |
| 111 | | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 112 | | UINT8 pixels; |
| 113 | | |
| 114 | | for (y = 0; y < 480; y++) |
| 115 | | { |
| 116 | | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 117 | | for (x = 0; x < 640; x+=8) |
| 118 | | { |
| 119 | | pixels = vram8[(y * 80) + ((x/8)^3)]; |
| 120 | | |
| 121 | | *scanline++ = rbv_palette[0xfe|(pixels>>7)]; |
| 122 | | *scanline++ = rbv_palette[0xfe|((pixels>>6)&1)]; |
| 123 | | *scanline++ = rbv_palette[0xfe|((pixels>>5)&1)]; |
| 124 | | *scanline++ = rbv_palette[0xfe|((pixels>>4)&1)]; |
| 125 | | *scanline++ = rbv_palette[0xfe|((pixels>>3)&1)]; |
| 126 | | *scanline++ = rbv_palette[0xfe|((pixels>>2)&1)]; |
| 127 | | *scanline++ = rbv_palette[0xfe|((pixels>>1)&1)]; |
| 128 | | *scanline++ = rbv_palette[0xfe|(pixels&1)]; |
| 129 | | } |
| 130 | | } |
| 131 | | } |
| 132 | | break; |
| 133 | | |
| 134 | | case 1: // 2bpp |
| 135 | | { |
| 136 | | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 137 | | UINT8 pixels; |
| 138 | | |
| 139 | | for (y = 0; y < 480; y++) |
| 140 | | { |
| 141 | | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 142 | | for (x = 0; x < 640/4; x++) |
| 143 | | { |
| 144 | | pixels = vram8[(y * 160) + (BYTE4_XOR_BE(x))]; |
| 145 | | |
| 146 | | *scanline++ = rbv_palette[0xfc|((pixels>>6)&3)]; |
| 147 | | *scanline++ = rbv_palette[0xfc|((pixels>>4)&3)]; |
| 148 | | *scanline++ = rbv_palette[0xfc|((pixels>>2)&3)]; |
| 149 | | *scanline++ = rbv_palette[0xfc|(pixels&3)]; |
| 150 | | } |
| 151 | | } |
| 152 | | } |
| 153 | | break; |
| 154 | | |
| 155 | | case 2: // 4bpp |
| 156 | | { |
| 157 | | UINT8 *vram8 = (UINT8 *)messram_get_ptr(screen->machine->device("messram")); |
| 158 | | UINT8 pixels; |
| 159 | | |
| 160 | | for (y = 0; y < 480; y++) |
| 161 | | { |
| 162 | | scanline = BITMAP_ADDR32(bitmap, y, 0); |
| 163 | | |
| 164 | | for (x = 0; x < 640/2; x++) |
| 165 | | { |
| 166 | | pixels = vram8[(y * 320) + (BYTE4_XOR_BE(x))]; |
| 167 | | |
| 168 | | *scanline++ = rbv_palette[0xf0|(pixels>>4)]; |
| 169 | | *scanline++ = rbv_palette[0xf0|(pixels&0xf)]; |
| 170 | | } |
| 171 | | } |
| 172 | | } |
| 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 | | } |
| 191 | | } |
| 192 | | |
| 193 | | return 0; |
| 194 | | } |
| 195 | | |
| 196 | 87 | static WRITE32_HANDLER( rbv_ramdac_w ) |
| 197 | 88 | { |
| 89 | mac_state *mac = space->machine->driver_data<mac_state>(); |
| 90 | |
| 198 | 91 | if (!offset) |
| 199 | 92 | { |
| 200 | | rbv_clutoffs = data>>24; |
| 201 | | rbv_count = 0; |
| 93 | mac->rbv_clutoffs = data>>24; |
| 94 | mac->rbv_count = 0; |
| 202 | 95 | } |
| 203 | 96 | else |
| 204 | 97 | { |
| 205 | | rbv_colors[rbv_count++] = data>>24; |
| 98 | mac->rbv_colors[mac->rbv_count++] = data>>24; |
| 206 | 99 | |
| 207 | | if (rbv_count == 3) |
| 100 | if (mac->rbv_count == 3) |
| 208 | 101 | { |
| 209 | | palette_set_color(space->machine, rbv_clutoffs, MAKE_RGB(rbv_colors[0], rbv_colors[1], rbv_colors[2])); |
| 210 | | rbv_palette[rbv_clutoffs] = MAKE_RGB(rbv_colors[0], rbv_colors[1], rbv_colors[2]); |
| 211 | | rbv_clutoffs++; |
| 212 | | rbv_count = 0; |
| 102 | palette_set_color(space->machine, mac->rbv_clutoffs, MAKE_RGB(mac->rbv_colors[0], mac->rbv_colors[1], mac->rbv_colors[2])); |
| 103 | mac->rbv_palette[mac->rbv_clutoffs] = MAKE_RGB(mac->rbv_colors[0], mac->rbv_colors[1], mac->rbv_colors[2]); |
| 104 | mac->rbv_clutoffs++; |
| 105 | mac->rbv_count = 0; |
| 213 | 106 | } |
| 214 | 107 | } |
| 215 | 108 | } |
| r9345 | r9346 | |
| 217 | 110 | static READ8_HANDLER ( mac_rbv_r ) |
| 218 | 111 | { |
| 219 | 112 | int data = 0; |
| 113 | mac_state *mac = space->machine->driver_data<mac_state>(); |
| 220 | 114 | |
| 221 | 115 | if (offset < 0x100) |
| 222 | 116 | { |
| 223 | | data = rbv_regs[offset]; |
| 117 | data = mac->rbv_regs[offset]; |
| 224 | 118 | |
| 225 | 119 | if (offset == 0x02) |
| 226 | 120 | { |
| r9345 | r9346 | |
| 232 | 126 | |
| 233 | 127 | if (offset == 0x10) |
| 234 | 128 | { |
| 235 | | if (!rbv_immed10wr) |
| 129 | if (!mac->rbv_immed10wr) |
| 236 | 130 | { |
| 237 | 131 | data &= ~0x38; |
| 238 | 132 | data |= (6<<3); // 13" RGB monitor at 640x480 |
| 239 | 133 | } |
| 240 | 134 | else |
| 241 | 135 | { |
| 242 | | rbv_immed10wr = 0; |
| 136 | mac->rbv_immed10wr = 0; |
| 243 | 137 | } |
| 244 | 138 | } |
| 245 | 139 | |
| r9345 | r9346 | |
| 256 | 150 | switch (offset) |
| 257 | 151 | { |
| 258 | 152 | case 13: // IFR |
| 259 | | return rbv_ifr; |
| 153 | return mac->rbv_ifr; |
| 260 | 154 | break; |
| 261 | 155 | |
| 262 | 156 | case 14: // IER |
| 263 | | return rbv_ier; |
| 157 | return mac->rbv_ier; |
| 264 | 158 | break; |
| 265 | 159 | |
| 266 | 160 | default: |
| r9345 | r9346 | |
| 276 | 170 | |
| 277 | 171 | static WRITE8_HANDLER ( mac_rbv_w ) |
| 278 | 172 | { |
| 173 | mac_state *mac = space->machine->driver_data<mac_state>(); |
| 174 | |
| 279 | 175 | if (offset < 0x100) |
| 280 | 176 | { |
| 281 | 177 | // if (offset == 0x10) printf("rbv_w: %02x to offset %x (PC=%x)\n", data, offset, cpu_get_pc(space->cpu)); |
| r9345 | r9346 | |
| 283 | 179 | { |
| 284 | 180 | case 0x03: |
| 285 | 181 | mac_set_via2_interrupt(space->machine, 0); |
| 286 | | rbv_regs[offset] = data; |
| 182 | mac->rbv_regs[offset] = data; |
| 287 | 183 | break; |
| 288 | 184 | |
| 289 | 185 | case 0x10: |
| 290 | 186 | if (data != 0) |
| 291 | 187 | { |
| 292 | | rbv_immed10wr = 1; |
| 188 | mac->rbv_immed10wr = 1; |
| 293 | 189 | } |
| 294 | | rbv_regs[offset] = data; |
| 190 | mac->rbv_regs[offset] = data; |
| 295 | 191 | break; |
| 296 | 192 | |
| 297 | 193 | case 0x12: |
| 298 | 194 | if (data & 0x80) // 1 bits write 1s |
| 299 | 195 | { |
| 300 | | rbv_regs[offset] |= data & 0x7f; |
| 196 | mac->rbv_regs[offset] |= data & 0x7f; |
| 301 | 197 | } |
| 302 | 198 | else // 1 bits write 0s |
| 303 | 199 | { |
| 304 | | rbv_regs[offset] &= ~(data & 0x7f); |
| 200 | mac->rbv_regs[offset] &= ~(data & 0x7f); |
| 305 | 201 | } |
| 306 | 202 | break; |
| 307 | 203 | |
| 308 | 204 | case 0x13: |
| 309 | 205 | if (data & 0x80) // 1 bits write 1s |
| 310 | 206 | { |
| 311 | | rbv_regs[offset] |= data & 0x7f; |
| 207 | mac->rbv_regs[offset] |= data & 0x7f; |
| 312 | 208 | |
| 313 | | if (data == 0xff) rbv_regs[offset] = 0x1f; // I don't know why this is special, but the IIci ROM's POST demands it |
| 209 | if (data == 0xff) mac->rbv_regs[offset] = 0x1f; // I don't know why this is special, but the IIci ROM's POST demands it |
| 314 | 210 | } |
| 315 | 211 | else // 1 bits write 0s |
| 316 | 212 | { |
| 317 | | rbv_regs[offset] &= ~(data & 0x7f); |
| 213 | mac->rbv_regs[offset] &= ~(data & 0x7f); |
| 318 | 214 | } |
| 215 | // printf("RBV: 0x13 (%02x) = %02x (PC %x)\n", data, mac->rbv_regs[offset], cpu_get_pc(space->cpu)); |
| 319 | 216 | break; |
| 320 | 217 | |
| 321 | 218 | default: |
| 322 | | rbv_regs[offset] = data; |
| 219 | mac->rbv_regs[offset] = data; |
| 323 | 220 | break; |
| 324 | 221 | } |
| 325 | 222 | } |
| r9345 | r9346 | |
| 331 | 228 | { |
| 332 | 229 | case 13: // IFR |
| 333 | 230 | // printf("rbv_w: %02x to IFR\n", data); |
| 334 | | rbv_ifr = data; |
| 231 | mac->rbv_ifr = data; |
| 335 | 232 | mac_set_via2_interrupt(space->machine, 0); |
| 336 | 233 | break; |
| 337 | 234 | |
| 338 | 235 | case 14: // IER |
| 339 | 236 | if (data & 0x80) // 1 bits write 1s |
| 340 | 237 | { |
| 341 | | rbv_ier |= data & 0x7f; |
| 238 | mac->rbv_ier |= data & 0x7f; |
| 342 | 239 | } |
| 343 | 240 | else // 1 bits write 0s |
| 344 | 241 | { |
| 345 | | rbv_ier &= ~(data & 0x7f); |
| 242 | mac->rbv_ier &= ~(data & 0x7f); |
| 346 | 243 | } |
| 347 | 244 | |
| 348 | | // printf("rbv_w: %02x to IER => %02x\n", data, rbv_ier); |
| 245 | // printf("rbv_w: %02x to IER => %02x\n", data, mac->rbv_ier); |
| 349 | 246 | break; |
| 350 | 247 | |
| 351 | 248 | default: |