trunk/src/mess/machine/cuda.c
| r20001 | r20002 | |
| 132 | 132 | |
| 133 | 133 | adb_in = (data & 0x80) ? true : false; |
| 134 | 134 | |
| 135 | | mac_state *mac = machine().driver_data<mac_state>(); |
| 136 | | mac->adb_linechange(((data & 0x80) >> 7) ^ 1, (int)(machine().time().as_ticks(1000000) - last_adb_time)); |
| 135 | m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); |
| 136 | m_out_adb_func(((data & 0x80) >> 7) ^ 1); |
| 137 | 137 | |
| 138 | 138 | last_adb = data & 0x80; |
| 139 | 139 | last_adb_time = machine().time().as_ticks(1000000); |
| r20001 | r20002 | |
| 405 | 405 | void cuda_device::device_start() |
| 406 | 406 | { |
| 407 | 407 | m_out_reset_func.resolve(m_out_reset_cb, *this); |
| 408 | m_out_adb_func.resolve(m_out_adb_cb, *this); |
| 408 | 409 | |
| 409 | 410 | m_timer = timer_alloc(0, NULL); |
| 410 | 411 | m_prog_timer = timer_alloc(1, NULL); |
| r20001 | r20002 | |
| 426 | 427 | save_item(NAME(via_clock)); |
| 427 | 428 | save_item(NAME(adb_in)); |
| 428 | 429 | save_item(NAME(reset_line)); |
| 430 | save_item(NAME(m_adb_dtime)); |
| 429 | 431 | save_item(NAME(pram_loaded)); |
| 430 | 432 | save_item(NAME(pram)); |
| 431 | 433 | save_item(NAME(disk_pram)); |
trunk/src/mess/machine/cuda.h
| r20001 | r20002 | |
| 5 | 5 | |
| 6 | 6 | #include "emu.h" |
| 7 | 7 | |
| 8 | | |
| 9 | | |
| 10 | 8 | //************************************************************************** |
| 11 | 9 | // MACROS / CONSTANTS |
| 12 | 10 | //************************************************************************** |
| r20001 | r20002 | |
| 37 | 35 | #define MCFG_CUDA_TYPE(_type) \ |
| 38 | 36 | cuda_device::static_set_type(*device, _type); |
| 39 | 37 | |
| 38 | #define MCFG_CUDA_REMOVE() \ |
| 39 | MCFG_DEVICE_REMOVE(CUDA_TAG) |
| 40 | |
| 40 | 41 | //************************************************************************** |
| 41 | 42 | // TYPE DEFINITIONS |
| 42 | 43 | //************************************************************************** |
| r20001 | r20002 | |
| 44 | 45 | struct cuda_interface |
| 45 | 46 | { |
| 46 | 47 | devcb_write_line m_out_reset_cb; |
| 48 | devcb_write_line m_out_adb_cb; |
| 47 | 49 | }; |
| 48 | 50 | |
| 49 | 51 | // ======================> cuda_device |
| r20001 | r20002 | |
| 85 | 87 | void set_via_data(UINT8 dat) { via_data = dat; } |
| 86 | 88 | UINT8 get_via_clock() { return via_clock; } |
| 87 | 89 | void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; } |
| 90 | int get_adb_dtime() { return m_adb_dtime; } |
| 88 | 91 | |
| 89 | 92 | int rom_offset; |
| 90 | 93 | |
| r20001 | r20002 | |
| 112 | 115 | bool cuda_controls_power; |
| 113 | 116 | bool adb_in; |
| 114 | 117 | int reset_line; |
| 118 | int m_adb_dtime; |
| 115 | 119 | emu_timer *m_timer, *m_prog_timer; |
| 116 | 120 | UINT8 pram[0x100], disk_pram[0x100]; |
| 117 | 121 | bool pram_loaded; |
| r20001 | r20002 | |
| 119 | 123 | void send_port(address_space &space, UINT8 offset, UINT8 data); |
| 120 | 124 | |
| 121 | 125 | devcb_resolved_write_line m_out_reset_func; |
| 126 | devcb_resolved_write_line m_out_adb_func; |
| 122 | 127 | }; |
| 123 | 128 | |
| 124 | 129 | // device type definition |
trunk/src/mess/machine/egret.c
| r20001 | r20002 | |
| 130 | 130 | // allow the linechange handler to override us |
| 131 | 131 | adb_in = (data & 0x80) ? true : false; |
| 132 | 132 | |
| 133 | | mac_state *mac = machine().driver_data<mac_state>(); |
| 134 | | mac->adb_linechange(((data & 0x80) >> 7) ^ 1, (int)(machine().time().as_ticks(1000000) - last_adb_time)); |
| 133 | m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time); |
| 134 | m_out_adb_func(((data & 0x80) >> 7) ^ 1); |
| 135 | 135 | |
| 136 | 136 | last_adb = data & 0x80; |
| 137 | 137 | last_adb_time = machine().time().as_ticks(1000000); |
| r20001 | r20002 | |
| 177 | 177 | // falling edge, should reset the machine too |
| 178 | 178 | if ((ports[2] & 8) && !(data&8)) |
| 179 | 179 | { |
| 180 | | mac_state *mac = machine().driver_data<mac_state>(); |
| 181 | | |
| 182 | | // force the memory overlay |
| 183 | | mac->set_memory_overlay(0); |
| 184 | | mac->set_memory_overlay(1); |
| 185 | | |
| 186 | 180 | // if PRAM's waiting to be loaded, transfer it now |
| 187 | 181 | if (!pram_loaded) |
| 188 | 182 | { |
| r20001 | r20002 | |
| 191 | 185 | } |
| 192 | 186 | } |
| 193 | 187 | |
| 194 | | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_RESET, (reset_line & 8) ? ASSERT_LINE : CLEAR_LINE); |
| 188 | m_out_reset_func((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE); |
| 195 | 189 | } |
| 196 | 190 | break; |
| 197 | 191 | } |
| r20001 | r20002 | |
| 356 | 350 | egret.rom_offset = type; |
| 357 | 351 | } |
| 358 | 352 | |
| 353 | void egret_device::device_config_complete() |
| 354 | { |
| 355 | m_shortname = "egret"; |
| 356 | |
| 357 | // inherit a copy of the static data |
| 358 | const egret_interface *intf = reinterpret_cast<const egret_interface *>(static_config()); |
| 359 | if (intf != NULL) |
| 360 | { |
| 361 | *static_cast<egret_interface *>(this) = *intf; |
| 362 | } |
| 363 | // or initialize to defaults if none provided |
| 364 | else |
| 365 | { |
| 366 | memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb)); |
| 367 | memset(&m_out_adb_cb, 0, sizeof(m_out_adb_cb)); |
| 368 | } |
| 369 | } |
| 370 | |
| 359 | 371 | //------------------------------------------------- |
| 360 | 372 | // device_start - device-specific startup |
| 361 | 373 | //------------------------------------------------- |
| 362 | 374 | |
| 363 | 375 | void egret_device::device_start() |
| 364 | 376 | { |
| 377 | m_out_reset_func.resolve(m_out_reset_cb, *this); |
| 378 | m_out_adb_func.resolve(m_out_adb_cb, *this); |
| 379 | |
| 365 | 380 | m_timer = timer_alloc(0, NULL); |
| 366 | 381 | save_item(NAME(ddrs[0])); |
| 367 | 382 | save_item(NAME(ddrs[1])); |
| r20001 | r20002 | |
| 380 | 395 | save_item(NAME(via_clock)); |
| 381 | 396 | save_item(NAME(adb_in)); |
| 382 | 397 | save_item(NAME(reset_line)); |
| 398 | save_item(NAME(m_adb_dtime)); |
| 383 | 399 | save_item(NAME(pram_loaded)); |
| 384 | 400 | save_item(NAME(pram)); |
| 385 | 401 | save_item(NAME(disk_pram)); |
trunk/src/mess/machine/egret.h
| r20001 | r20002 | |
| 21 | 21 | // INTERFACE CONFIGURATION MACROS |
| 22 | 22 | //************************************************************************** |
| 23 | 23 | |
| 24 | | #define MCFG_EGRET_ADD(_type) \ |
| 24 | #define MCFG_EGRET_ADD(_type, _config) \ |
| 25 | 25 | MCFG_DEVICE_ADD(EGRET_TAG, EGRET, 0) \ |
| 26 | MCFG_DEVICE_CONFIG(_config) \ |
| 26 | 27 | MCFG_EGRET_TYPE(_type) |
| 27 | 28 | |
| 28 | | #define MCFG_EGRET_REPLACE(_type) \ |
| 29 | #define MCFG_EGRET_REPLACE(_type, _config) \ |
| 29 | 30 | MCFG_DEVICE_REPLACE(EGRET_TAG, EGRET, 0) \ |
| 31 | MCFG_DEVICE_CONFIG(_config) \ |
| 30 | 32 | MCFG_EGRET_TYPE(_type) |
| 31 | 33 | |
| 32 | 34 | #define MCFG_EGRET_TYPE(_type) \ |
| r20001 | r20002 | |
| 39 | 41 | // TYPE DEFINITIONS |
| 40 | 42 | //************************************************************************** |
| 41 | 43 | |
| 44 | struct egret_interface |
| 45 | { |
| 46 | devcb_write_line m_out_reset_cb; |
| 47 | devcb_write_line m_out_adb_cb; |
| 48 | }; |
| 49 | |
| 42 | 50 | // ======================> egret_device |
| 43 | 51 | |
| 44 | | class egret_device : public device_t, public device_nvram_interface |
| 52 | class egret_device : public device_t, public device_nvram_interface, public egret_interface |
| 45 | 53 | { |
| 46 | 54 | public: |
| 47 | 55 | // construction/destruction |
| r20001 | r20002 | |
| 78 | 86 | void set_via_data(UINT8 dat) { via_data = dat; } |
| 79 | 87 | UINT8 get_via_clock() { return via_clock; } |
| 80 | 88 | void set_adb_line(int linestate) { adb_in = (linestate == ASSERT_LINE) ? true : false; } |
| 89 | int get_adb_dtime() { return m_adb_dtime; } |
| 81 | 90 | |
| 82 | 91 | int rom_offset; |
| 83 | 92 | |
| r20001 | r20002 | |
| 85 | 94 | // device-level overrides |
| 86 | 95 | virtual void device_start(); |
| 87 | 96 | virtual void device_reset(); |
| 88 | | virtual void device_config_complete() { m_shortname = "egret"; } |
| 97 | virtual void device_config_complete(); |
| 89 | 98 | virtual machine_config_constructor device_mconfig_additions() const; |
| 90 | 99 | virtual const rom_entry *device_rom_region() const; |
| 91 | 100 | |
| r20001 | r20002 | |
| 105 | 114 | bool egret_controls_power; |
| 106 | 115 | bool adb_in; |
| 107 | 116 | int reset_line; |
| 117 | int m_adb_dtime; |
| 108 | 118 | emu_timer *m_timer; |
| 109 | 119 | UINT8 pram[0x100], disk_pram[0x100]; |
| 110 | 120 | bool pram_loaded; |
| 111 | 121 | |
| 112 | 122 | void send_port(address_space &space, UINT8 offset, UINT8 data); |
| 123 | |
| 124 | devcb_resolved_write_line m_out_reset_func; |
| 125 | devcb_resolved_write_line m_out_adb_func; |
| 113 | 126 | }; |
| 114 | 127 | |
| 115 | 128 | // device type definition |