src/mess/machine/cuda.c
| r0 | r13679 | |
| 1 | /* |
| 2 | Apple "Cuda" ADB/system controller MCU |
| 3 | Emulation by R. Belmont |
| 4 | |
| 5 | Port definitions, primarily from the schematics. |
| 6 | |
| 7 | Port A: |
| 8 | |
| 9 | x------- O ADB data line out |
| 10 | -x------ I ADB data line in |
| 11 | --x----- I System type. 0 = "secure" power, 1 = "passive" or "soft" power |
| 12 | ---x---- O DFAC latch |
| 13 | ----x--- O "Fast Reset" |
| 14 | -----x-- I Keyboard power switch |
| 15 | ------x- I Chassis switch for "soft" power, pull up for "secure" or "passive" |
| 16 | -------x I Pull up for "passive", "PFW" for "secure" or "soft" |
| 17 | |
| 18 | Port B: |
| 19 | |
| 20 | x------- O DFAC bit clock |
| 21 | -x------ B DFAC data I/O (used in both directions) |
| 22 | --x----- B VIA shift register data (used in both directions) |
| 23 | ---x---- O VIA clock |
| 24 | ----x--- I VIA TIP |
| 25 | -----x-- I VIA BYTEACK |
| 26 | ------x- O VIA TREQ |
| 27 | -------x I +5v sense |
| 28 | |
| 29 | Port C: |
| 30 | x--- O 680x0 reset |
| 31 | -x-- ? 680x0 IPL 2 (used in both directions) |
| 32 | --x- ? IPL 1 for "passive" power, trickle sense for "soft" and "secure" |
| 33 | ---x ? IPL 0 for "passive" power, pull-up for "soft" power, file server switch for "secure" power |
| 34 | */ |
| 35 | |
| 36 | #define ADDRESS_MAP_MODERN |
| 37 | |
| 38 | #define CUDA_SUPER_VERBOSE |
| 39 | |
| 40 | #include "emu.h" |
| 41 | #include "cuda.h" |
| 42 | #include "cpu/m6805/m6805.h" |
| 43 | #include "machine/6522via.h" |
| 44 | #include "sound/asc.h" |
| 45 | #include "includes/mac.h" |
| 46 | |
| 47 | //************************************************************************** |
| 48 | // MACROS / CONSTANTS |
| 49 | //************************************************************************** |
| 50 | |
| 51 | #define CUDA_CPU_TAG "cuda" |
| 52 | |
| 53 | //************************************************************************** |
| 54 | // DEVICE DEFINITIONS |
| 55 | //************************************************************************** |
| 56 | |
| 57 | const device_type CUDA = &device_creator<cuda_device>; |
| 58 | |
| 59 | ROM_START( cuda ) |
| 60 | ROM_REGION(0x3300, CUDA_CPU_TAG, 0) |
| 61 | ROM_LOAD( "341s0060.bin", 0x1100, 0x1100, CRC(0f5e7b4a) SHA1(972b3778146d9787b18c3a9874d505cf606b3e15) ) |
| 62 | ROM_LOAD( "341s0788.bin", 0x2200, 0x1100, CRC(df6e1b43) SHA1(ec23cc6214c472d61b98964928c40589517a3172) ) |
| 63 | ROM_END |
| 64 | |
| 65 | //------------------------------------------------- |
| 66 | // ADDRESS_MAP |
| 67 | //------------------------------------------------- |
| 68 | |
| 69 | static ADDRESS_MAP_START( cuda_map, AS_PROGRAM, 8, cuda_device ) |
| 70 | AM_RANGE(0x0000, 0x0002) AM_READWRITE(ports_r, ports_w) |
| 71 | AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w) |
| 72 | AM_RANGE(0x0007, 0x0007) AM_READWRITE(pll_r, pll_w) |
| 73 | AM_RANGE(0x0008, 0x0008) AM_READWRITE(timer_ctrl_r, timer_ctrl_w) |
| 74 | AM_RANGE(0x0009, 0x0009) AM_READWRITE(timer_counter_r, timer_counter_w) |
| 75 | AM_RANGE(0x0012, 0x0012) AM_READWRITE(onesec_r, onesec_w) |
| 76 | AM_RANGE(0x0090, 0x00ff) AM_RAM // work RAM and stack |
| 77 | AM_RANGE(0x0100, 0x01ff) AM_READWRITE(pram_r, pram_w) |
| 78 | AM_RANGE(0x0f00, 0x1fff) AM_ROM AM_REGION(CUDA_CPU_TAG, 0) |
| 79 | ADDRESS_MAP_END |
| 80 | |
| 81 | //------------------------------------------------- |
| 82 | // MACHINE_CONFIG |
| 83 | //------------------------------------------------- |
| 84 | |
| 85 | static MACHINE_CONFIG_FRAGMENT( cuda ) |
| 86 | MCFG_CPU_ADD(CUDA_CPU_TAG, M68HC05EG, XTAL_32_768kHz*192) // 32.768 kHz input clock, can be PLL'ed to x128 = 4.1 MHz under s/w control |
| 87 | MCFG_CPU_PROGRAM_MAP(cuda_map) |
| 88 | MACHINE_CONFIG_END |
| 89 | |
| 90 | |
| 91 | //------------------------------------------------- |
| 92 | // machine_config_additions - device-specific |
| 93 | // machine configurations |
| 94 | //------------------------------------------------- |
| 95 | |
| 96 | machine_config_constructor cuda_device::device_mconfig_additions() const |
| 97 | { |
| 98 | return MACHINE_CONFIG_NAME( cuda ); |
| 99 | } |
| 100 | |
| 101 | const rom_entry *cuda_device::device_rom_region() const |
| 102 | { |
| 103 | return ROM_NAME( cuda ); |
| 104 | } |
| 105 | |
| 106 | //************************************************************************** |
| 107 | // LIVE DEVICE |
| 108 | //************************************************************************** |
| 109 | |
| 110 | void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data) |
| 111 | { |
| 112 | switch (offset) |
| 113 | { |
| 114 | case 0: // port A |
| 115 | /* printf("ADB:%d DFAC:%d PowerEnable:%d\n", |
| 116 | (data & 0x80) ? 1 : 0, |
| 117 | (data & 0x10) ? 1 : 0, |
| 118 | (data & 0x02) ? 1 : 0);*/ |
| 119 | |
| 120 | if ((data & 0x80) != last_adb) |
| 121 | { |
| 122 | /* if (data & 0x80) |
| 123 | { |
| 124 | printf("CU ADB: 1->0 time %lld\n", m_maincpu->total_cycles()-last_adb_time); |
| 125 | } |
| 126 | else |
| 127 | { |
| 128 | printf("CU ADB: 0->1 time %lld\n", m_maincpu->total_cycles()-last_adb_time); |
| 129 | }*/ |
| 130 | last_adb = data & 0x80; |
| 131 | last_adb_time = m_maincpu->total_cycles(); |
| 132 | } |
| 133 | break; |
| 134 | |
| 135 | case 1: // port B |
| 136 | { |
| 137 | if (treq != ((data>>1)&1)) |
| 138 | { |
| 139 | #ifdef CUDA_SUPER_VERBOSE |
| 140 | printf("CU-> TREQ: %d (PC=%x)\n", (data>>1)&1, cpu_get_pc(m_maincpu)); |
| 141 | #endif |
| 142 | treq = (data>>1) & 1; |
| 143 | } |
| 144 | if (via_data != ((data>>5)&1)) |
| 145 | { |
| 146 | #ifdef CUDA_SUPER_VERBOSE |
| 147 | printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, cpu_get_pc(m_maincpu)); |
| 148 | #endif |
| 149 | via_data = (data>>5) & 1; |
| 150 | } |
| 151 | if (via_clock != ((data>>4)&1)) |
| 152 | { |
| 153 | #ifdef CUDA_SUPER_VERBOSE |
| 154 | printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, cpu_get_pc(m_maincpu)); |
| 155 | #endif |
| 156 | via_clock = (data>>4) & 1; |
| 157 | via6522_device *via1 = machine().device<via6522_device>("via6522_0"); |
| 158 | via1->write_cb1(via_clock); |
| 159 | } |
| 160 | } |
| 161 | break; |
| 162 | |
| 163 | case 2: // port C |
| 164 | if ((data & 8) != reset_line) |
| 165 | { |
| 166 | #ifdef CUDA_SUPER_VERBOSE |
| 167 | printf("680x0 reset: %d -> %d\n", (ports[2] & 8)>>3, (data & 8)>>3); |
| 168 | #endif |
| 169 | reset_line = (data & 8); |
| 170 | |
| 171 | // falling edge, should reset the machine too |
| 172 | if ((ports[2] & 8) && !(data&8)) |
| 173 | { |
| 174 | mac_state *mac = machine().driver_data<mac_state>(); |
| 175 | |
| 176 | // force the memory overlay |
| 177 | mac->set_memory_overlay(0); |
| 178 | mac->set_memory_overlay(1); |
| 179 | |
| 180 | // if PRAM's waiting to be loaded, transfer it now |
| 181 | if (!pram_loaded) |
| 182 | { |
| 183 | memcpy(pram, disk_pram, 0x100); |
| 184 | pram_loaded = true; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | cputag_set_input_line(machine(), "maincpu", INPUT_LINE_RESET, (reset_line & 8) ? ASSERT_LINE : CLEAR_LINE); |
| 189 | } |
| 190 | break; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | READ8_MEMBER( cuda_device::ddr_r ) |
| 195 | { |
| 196 | return ddrs[offset]; |
| 197 | } |
| 198 | |
| 199 | WRITE8_MEMBER( cuda_device::ddr_w ) |
| 200 | { |
| 201 | /* printf("%02x to DDR %c\n", data, 'A' + offset);*/ |
| 202 | |
| 203 | send_port(space, offset, ports[offset] & data); |
| 204 | |
| 205 | ddrs[offset] = data; |
| 206 | } |
| 207 | |
| 208 | READ8_MEMBER( cuda_device::ports_r ) |
| 209 | { |
| 210 | UINT8 incoming = 0; |
| 211 | |
| 212 | switch (offset) |
| 213 | { |
| 214 | case 0: // port A |
| 215 | // incoming |= adb_in ? 0x40 : 0; |
| 216 | |
| 217 | if (cuda_controls_power) |
| 218 | { |
| 219 | incoming = 0x20 | 0x03; |
| 220 | } |
| 221 | else |
| 222 | { |
| 223 | incoming |= 0x23; // indicate passive power |
| 224 | } |
| 225 | break; |
| 226 | |
| 227 | case 1: // port B |
| 228 | if (cuda_controls_power) |
| 229 | { |
| 230 | incoming |= 0x01; // 0 for passive power, apparently |
| 231 | } |
| 232 | incoming |= byteack<<2; |
| 233 | incoming |= tip<<3; |
| 234 | incoming |= via_data<<5; |
| 235 | incoming |= 0xc0; // show DFAC lines high |
| 236 | break; |
| 237 | |
| 238 | case 2: // port C |
| 239 | if (cuda_controls_power) |
| 240 | { |
| 241 | incoming |= 0x3; |
| 242 | } |
| 243 | else |
| 244 | { |
| 245 | incoming |= 0x3; |
| 246 | } |
| 247 | break; |
| 248 | } |
| 249 | |
| 250 | // apply data direction registers |
| 251 | incoming &= (ddrs[offset] ^ 0xff); |
| 252 | // add in ddr-masked version of port writes |
| 253 | incoming |= (ports[offset] & ddrs[offset]); |
| 254 | |
| 255 | return incoming; |
| 256 | } |
| 257 | |
| 258 | WRITE8_MEMBER( cuda_device::ports_w ) |
| 259 | { |
| 260 | send_port(space, offset, data); |
| 261 | |
| 262 | ports[offset] = data; |
| 263 | } |
| 264 | |
| 265 | READ8_MEMBER( cuda_device::pll_r ) |
| 266 | { |
| 267 | return pll_ctrl; |
| 268 | } |
| 269 | |
| 270 | WRITE8_MEMBER( cuda_device::pll_w ) |
| 271 | { |
| 272 | #ifdef CUDA_SUPER_VERBOSE |
| 273 | if (pll_ctrl != data) |
| 274 | { |
| 275 | static const int clocks[4] = { 524288, 1048576, 2097152, 4194304 }; |
| 276 | printf("PLL ctrl: clock %d TCS:%d BCS:%d AUTO:%d BWC:%d PLLON:%d\n", clocks[data&3], |
| 277 | (data & 0x80) ? 1 : 0, |
| 278 | (data & 0x40) ? 1 : 0, |
| 279 | (data & 0x20) ? 1 : 0, |
| 280 | (data & 0x10) ? 1 : 0, |
| 281 | (data & 0x08) ? 1 : 0); |
| 282 | } |
| 283 | #endif |
| 284 | pll_ctrl = data; |
| 285 | } |
| 286 | |
| 287 | READ8_MEMBER( cuda_device::timer_ctrl_r ) |
| 288 | { |
| 289 | return timer_ctrl; |
| 290 | } |
| 291 | |
| 292 | WRITE8_MEMBER( cuda_device::timer_ctrl_w ) |
| 293 | { |
| 294 | // printf("%02x to timer control\n", data); |
| 295 | timer_ctrl = data; |
| 296 | } |
| 297 | |
| 298 | READ8_MEMBER( cuda_device::timer_counter_r ) |
| 299 | { |
| 300 | return timer_counter; |
| 301 | } |
| 302 | |
| 303 | WRITE8_MEMBER( cuda_device::timer_counter_w ) |
| 304 | { |
| 305 | // printf("%02x to timer/counter\n", data); |
| 306 | timer_counter = data; |
| 307 | } |
| 308 | |
| 309 | READ8_MEMBER( cuda_device::onesec_r ) |
| 310 | { |
| 311 | return onesec; |
| 312 | } |
| 313 | |
| 314 | WRITE8_MEMBER( cuda_device::onesec_w ) |
| 315 | { |
| 316 | static const float rates[4] = { 0.5f, 1.0f, 2.0f, 4.0f }; |
| 317 | |
| 318 | // printf("%02x to one-second control\n", data); |
| 319 | |
| 320 | m_timer->adjust(attotime::from_hz(rates[data&3]), 0, attotime::from_hz(rates[data&3])); |
| 321 | |
| 322 | if ((onesec & 0x40) && !(data & 0x40)) |
| 323 | { |
| 324 | device_set_input_line(m_maincpu, M68HC05EG_INT_CPI, CLEAR_LINE); |
| 325 | } |
| 326 | |
| 327 | onesec = data; |
| 328 | } |
| 329 | |
| 330 | READ8_MEMBER( cuda_device::pram_r ) |
| 331 | { |
| 332 | return pram[offset]; |
| 333 | } |
| 334 | |
| 335 | WRITE8_MEMBER( cuda_device::pram_w ) |
| 336 | { |
| 337 | pram[offset] = data; |
| 338 | } |
| 339 | |
| 340 | //------------------------------------------------- |
| 341 | // cuda_device - constructor |
| 342 | //------------------------------------------------- |
| 343 | |
| 344 | cuda_device::cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 345 | : device_t(mconfig, CUDA, "Apple Cuda", tag, owner, clock), |
| 346 | device_nvram_interface(mconfig, *this), |
| 347 | m_maincpu(*this, CUDA_CPU_TAG) |
| 348 | { |
| 349 | } |
| 350 | |
| 351 | //------------------------------------------------- |
| 352 | // static_set_type - configuration helper to set |
| 353 | // the chip type |
| 354 | //------------------------------------------------- |
| 355 | |
| 356 | void cuda_device::static_set_type(device_t &device, int type) |
| 357 | { |
| 358 | cuda_device &cuda = downcast<cuda_device &>(device); |
| 359 | cuda.rom_offset = type; |
| 360 | } |
| 361 | |
| 362 | //------------------------------------------------- |
| 363 | // device_start - device-specific startup |
| 364 | //------------------------------------------------- |
| 365 | |
| 366 | void cuda_device::device_start() |
| 367 | { |
| 368 | m_timer = timer_alloc(0, NULL); |
| 369 | save_item(NAME(ddrs[0])); |
| 370 | save_item(NAME(ddrs[1])); |
| 371 | save_item(NAME(ddrs[2])); |
| 372 | save_item(NAME(ports[0])); |
| 373 | save_item(NAME(ports[1])); |
| 374 | save_item(NAME(ports[2])); |
| 375 | save_item(NAME(pll_ctrl)); |
| 376 | save_item(NAME(timer_ctrl)); |
| 377 | save_item(NAME(timer_counter)); |
| 378 | save_item(NAME(onesec)); |
| 379 | save_item(NAME(treq)); |
| 380 | save_item(NAME(byteack)); |
| 381 | save_item(NAME(tip)); |
| 382 | save_item(NAME(via_data)); |
| 383 | save_item(NAME(via_clock)); |
| 384 | save_item(NAME(adb_in)); |
| 385 | save_item(NAME(reset_line)); |
| 386 | save_item(NAME(pram_loaded)); |
| 387 | save_item(NAME(pram)); |
| 388 | save_item(NAME(disk_pram)); |
| 389 | |
| 390 | astring tempstring; |
| 391 | UINT8 *rom = device().machine().region(device().subtag(tempstring, CUDA_CPU_TAG))->base(); |
| 392 | |
| 393 | if (rom) |
| 394 | { |
| 395 | memcpy(rom, rom+rom_offset, 0x1100); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | |
| 400 | //------------------------------------------------- |
| 401 | // device_reset - device-specific reset |
| 402 | //------------------------------------------------- |
| 403 | |
| 404 | void cuda_device::device_reset() |
| 405 | { |
| 406 | ddrs[0] = ddrs[1] = ddrs[2] = 0; |
| 407 | ports[0] = ports[1] = ports[2] = 0; |
| 408 | |
| 409 | m_timer->adjust(attotime::never); |
| 410 | |
| 411 | cuda_controls_power = false; // set to hard power control |
| 412 | adb_in = true; // line is pulled up to +5v, so nothing plugged in would read as "1" |
| 413 | reset_line = 0; |
| 414 | tip = 0; |
| 415 | treq = 0; |
| 416 | byteack = 0; |
| 417 | via_data = 0; |
| 418 | via_clock = 0; |
| 419 | pll_ctrl = 0; |
| 420 | timer_ctrl = 0; |
| 421 | timer_counter = 0; |
| 422 | last_adb_time = m_maincpu->total_cycles(); |
| 423 | } |
| 424 | |
| 425 | void cuda_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 426 | { |
| 427 | onesec |= 0x40; |
| 428 | |
| 429 | if (onesec & 0x10) |
| 430 | { |
| 431 | device_set_input_line(m_maincpu, M68HC05EG_INT_CPI, ASSERT_LINE); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | // the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted) |
| 436 | // we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live" |
| 437 | // once the cuda reboots the 68k |
| 438 | void cuda_device::nvram_default() |
| 439 | { |
| 440 | memset(pram, 0, 0x100); |
| 441 | memset(disk_pram, 0, 0x100); |
| 442 | |
| 443 | pram[0x1] = 0x80; |
| 444 | pram[0x2] = 0x4f; |
| 445 | pram[0x3] = 0x48; |
| 446 | pram[0x8] = 0x13; |
| 447 | pram[0x9] = 0x88; |
| 448 | pram[0xb] = 0x4c; |
| 449 | pram[0xc] = 0x4e; |
| 450 | pram[0xd] = 0x75; |
| 451 | pram[0xe] = 0x4d; |
| 452 | pram[0xf] = 0x63; |
| 453 | pram[0x10] = 0xa8; |
| 454 | pram[0x14] = 0xcc; |
| 455 | pram[0x15] = 0x0a; |
| 456 | pram[0x16] = 0xcc; |
| 457 | pram[0x17] = 0x0a; |
| 458 | pram[0x1d] = 0x02; |
| 459 | pram[0x17] = 0x63; |
| 460 | pram[0x6f] = 0x28; |
| 461 | pram[0x70] = 0x83; |
| 462 | pram[0x71] = 0x26; |
| 463 | pram[0x77] = 0x01; |
| 464 | pram[0x78] = 0xff; |
| 465 | pram[0x79] = 0xff; |
| 466 | pram[0x7a] = 0xff; |
| 467 | pram[0x7b] = 0xdf; |
| 468 | pram[0x7d] = 0x09; |
| 469 | pram[0xf3] = 0x12; |
| 470 | pram[0xf9] = 0x01; |
| 471 | pram[0xf3] = 0x12; |
| 472 | pram[0xfb] = 0x8d; |
| 473 | pram_loaded = false; |
| 474 | } |
| 475 | |
| 476 | void cuda_device::nvram_read(emu_file &file) |
| 477 | { |
| 478 | file.read(disk_pram, 0x100); |
| 479 | pram_loaded = false; |
| 480 | } |
| 481 | |
| 482 | void cuda_device::nvram_write(emu_file &file) |
| 483 | { |
| 484 | file.write(pram, 0x100); |
| 485 | } |
src/mess/machine/cuda.h
| r0 | r13679 | |
| 1 | #pragma once |
| 2 | |
| 3 | #ifndef __CUDA_H__ |
| 4 | #define __CUDA_H__ |
| 5 | |
| 6 | #include "emu.h" |
| 7 | |
| 8 | |
| 9 | |
| 10 | //************************************************************************** |
| 11 | // MACROS / CONSTANTS |
| 12 | //************************************************************************** |
| 13 | |
| 14 | #define CUDA_TAG "cuda" |
| 15 | |
| 16 | #define CUDA_341S0060 0x1100 // v2.40 |
| 17 | #define CUDA_341S0788 0x2200 // v2.37 |
| 18 | |
| 19 | //************************************************************************** |
| 20 | // INTERFACE CONFIGURATION MACROS |
| 21 | //************************************************************************** |
| 22 | |
| 23 | #define MCFG_CUDA_ADD(_type) \ |
| 24 | MCFG_DEVICE_ADD(CUDA_TAG, CUDA, 0) \ |
| 25 | MCFG_CUDA_TYPE(_type) |
| 26 | |
| 27 | #define MCFG_CUDA_REPLACE(_type) \ |
| 28 | MCFG_DEVICE_REPLACE(CUDA_TAG, CUDA, 0) \ |
| 29 | MCFG_CUDA_TYPE(_type) |
| 30 | |
| 31 | #define MCFG_CUDA_TYPE(_type) \ |
| 32 | cuda_device::static_set_type(*device, _type); |
| 33 | |
| 34 | //************************************************************************** |
| 35 | // TYPE DEFINITIONS |
| 36 | //************************************************************************** |
| 37 | |
| 38 | // ======================> cuda_device |
| 39 | |
| 40 | class cuda_device : public device_t, public device_nvram_interface |
| 41 | { |
| 42 | public: |
| 43 | // construction/destruction |
| 44 | cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 45 | |
| 46 | // inline configuration helpers |
| 47 | static void static_set_type(device_t &device, int type); |
| 48 | |
| 49 | // device_config_nvram_interface overrides |
| 50 | virtual void nvram_default(); |
| 51 | virtual void nvram_read(emu_file &file); |
| 52 | virtual void nvram_write(emu_file &file); |
| 53 | |
| 54 | DECLARE_READ8_MEMBER( ddr_r ); |
| 55 | DECLARE_WRITE8_MEMBER( ddr_w ); |
| 56 | DECLARE_READ8_MEMBER( ports_r ); |
| 57 | DECLARE_WRITE8_MEMBER( ports_w ); |
| 58 | DECLARE_READ8_MEMBER( pll_r ); |
| 59 | DECLARE_WRITE8_MEMBER( pll_w ); |
| 60 | DECLARE_READ8_MEMBER( timer_ctrl_r ); |
| 61 | DECLARE_WRITE8_MEMBER( timer_ctrl_w ); |
| 62 | DECLARE_READ8_MEMBER( timer_counter_r ); |
| 63 | DECLARE_WRITE8_MEMBER( timer_counter_w ); |
| 64 | DECLARE_READ8_MEMBER( onesec_r ); |
| 65 | DECLARE_WRITE8_MEMBER( onesec_w ); |
| 66 | DECLARE_READ8_MEMBER( pram_r ); |
| 67 | DECLARE_WRITE8_MEMBER( pram_w ); |
| 68 | |
| 69 | // VIA interface routines |
| 70 | UINT8 get_treq() { return treq; } |
| 71 | void set_tip(UINT8 val) { tip = val; } |
| 72 | void set_byteack(UINT8 val) { byteack = val; } |
| 73 | UINT8 get_via_data() { return via_data; } |
| 74 | void set_via_data(UINT8 dat) { via_data = dat; printf("68K-> VIA_DATA: %d\n", dat); } |
| 75 | UINT8 get_via_clock() { return via_clock; } |
| 76 | |
| 77 | int rom_offset; |
| 78 | |
| 79 | protected: |
| 80 | // device-level overrides |
| 81 | virtual void device_start(); |
| 82 | virtual void device_reset(); |
| 83 | virtual void device_config_complete() { m_shortname = "cuda"; } |
| 84 | virtual machine_config_constructor device_mconfig_additions() const; |
| 85 | virtual const rom_entry *device_rom_region() const; |
| 86 | |
| 87 | required_device<cpu_device> m_maincpu; |
| 88 | |
| 89 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 90 | |
| 91 | private: |
| 92 | UINT8 ddrs[3]; |
| 93 | UINT8 ports[3]; |
| 94 | UINT8 pll_ctrl; |
| 95 | UINT8 timer_ctrl; |
| 96 | UINT8 timer_counter; |
| 97 | UINT8 onesec; |
| 98 | UINT8 treq, byteack, tip, via_data, via_clock, last_adb; |
| 99 | UINT64 last_adb_time; |
| 100 | bool cuda_controls_power; |
| 101 | bool adb_in; |
| 102 | int reset_line; |
| 103 | emu_timer *m_timer; |
| 104 | UINT8 pram[0x100], disk_pram[0x100]; |
| 105 | bool pram_loaded; |
| 106 | |
| 107 | void send_port(address_space &space, UINT8 offset, UINT8 data); |
| 108 | }; |
| 109 | |
| 110 | // device type definition |
| 111 | extern const device_type CUDA; |
| 112 | |
| 113 | #endif |
src/mess/drivers/mac.c
| r13678 | r13679 | |
| 219 | 219 | m_rbv_ifr = ifr | 0x80; |
| 220 | 220 | |
| 221 | 221 | // printf("VIA2 raise\n"); |
| 222 | | this->set_via2_interrupt(1); |
| 222 | set_via2_interrupt(1); |
| 223 | 223 | } |
| 224 | 224 | else |
| 225 | 225 | { |
| 226 | 226 | // printf("VIA2 lower\n"); |
| 227 | | this->set_via2_interrupt(0); |
| 227 | set_via2_interrupt(0); |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| r13678 | r13679 | |
| 1173 | 1173 | MCFG_RAM_EXTRA_OPTIONS("6M,8M,10M") |
| 1174 | 1174 | MACHINE_CONFIG_END |
| 1175 | 1175 | |
| 1176 | static MACHINE_CONFIG_DERIVED( maccclas, maclc ) |
| 1177 | |
| 1178 | MCFG_CPU_REPLACE("maincpu", M68030, C15M) |
| 1179 | MCFG_CPU_PROGRAM_MAP(maclc_map) |
| 1180 | MCFG_CPU_VBLANK_INT(MAC_SCREEN_NAME, mac_rbv_vbl) |
| 1181 | |
| 1182 | MCFG_RAM_MODIFY(RAM_TAG) |
| 1183 | MCFG_RAM_DEFAULT_SIZE("4M") |
| 1184 | MCFG_RAM_EXTRA_OPTIONS("6M,8M,10M") |
| 1185 | |
| 1186 | MCFG_EGRET_REMOVE() |
| 1187 | MCFG_CUDA_ADD(CUDA_341S0788) // should be 341s0417, but only the color classic used that rev and those are "collectable" ($$$$) |
| 1188 | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
| 1189 | MACHINE_CONFIG_END |
| 1190 | |
| 1176 | 1191 | static MACHINE_CONFIG_DERIVED( maclc3, maclc ) |
| 1177 | 1192 | |
| 1178 | 1193 | MCFG_CPU_REPLACE("maincpu", M68030, 25000000) |
| r13678 | r13679 | |
| 1556 | 1571 | MCFG_RAM_MODIFY(RAM_TAG) |
| 1557 | 1572 | MCFG_RAM_DEFAULT_SIZE("2M") |
| 1558 | 1573 | MCFG_RAM_EXTRA_OPTIONS("4M,8M,16M,32M,48M,64M,128M") |
| 1574 | |
| 1559 | 1575 | MCFG_EGRET_ADD(EGRET_TYPE_100) |
| 1560 | 1576 | MCFG_QUANTUM_PERFECT_CPU("maincpu") |
| 1561 | 1577 | MACHINE_CONFIG_END |
| r13678 | r13679 | |
| 2159 | 2175 | COMP( 1992, macpb180, macpb160, 0, macpb180, macadb, macpb160, "Apple Computer", "Macintosh PowerBook 180", GAME_NOT_WORKING ) |
| 2160 | 2176 | COMP( 1992, macpb180c,macpb160, 0, macpb180c,macadb, macpb160, "Apple Computer", "Macintosh PowerBook 180c", GAME_NOT_WORKING ) |
| 2161 | 2177 | //COMP( 1992, macpd210, 0, 0, macpd210, macadb, macpd210, "Apple Computer", "Macintosh PowerBook Duo 210", GAME_NOT_WORKING ) |
| 2162 | | COMP( 1993, maccclas, 0, 0, maclc2, macadb, maclrcclassic,"Apple Computer", "Macintosh Color Classic", GAME_NOT_WORKING ) |
| 2178 | COMP( 1993, maccclas, 0, 0, maccclas, macadb, maclrcclassic,"Apple Computer", "Macintosh Color Classic", GAME_NOT_WORKING ) |
| 2163 | 2179 | COMP( 1992, macpb145b,macpb140, 0, macpb170, macadb, macpb140, "Apple Computer", "Macintosh PowerBook 145B", GAME_NOT_WORKING ) |
| 2164 | 2180 | COMP( 1993, maclc3, 0, 0, maclc3, maciici, maclc3, "Apple Computer", "Macintosh LC III", GAME_NOT_WORKING ) |
| 2165 | 2181 | COMP( 1993, maciivx, 0, 0, maciivx, maciici, maciivx, "Apple Computer", "Macintosh IIvx", GAME_NOT_WORKING ) |