trunk/src/mess/drivers/pdp1.c
| r20721 | r20722 | |
| 387 | 387 | |
| 388 | 388 | |
| 389 | 389 | |
| 390 | | static void pdp1_machine_stop(running_machine &machine); |
| 391 | | |
| 392 | 390 | static void pdp1_tape_read_binary(device_t *device); |
| 393 | 391 | static void pdp1_io_sc_callback(device_t *device); |
| 394 | 392 | |
| r20721 | r20722 | |
| 509 | 507 | } |
| 510 | 508 | |
| 511 | 509 | |
| 512 | | static void pdp1_machine_stop(running_machine &machine) |
| 510 | void pdp1_state::pdp1_machine_stop() |
| 513 | 511 | { |
| 514 | | pdp1_state *state = machine.driver_data<pdp1_state>(); |
| 515 | 512 | /* the core will take care of freeing the timers, BUT we must set the variables |
| 516 | 513 | to NULL if we don't want to risk confusing the tape image init function */ |
| 517 | | state->m_tape_reader.timer = state->m_tape_puncher.timer = state->m_typewriter.tyo_timer = state->m_dpy_timer = NULL; |
| 514 | m_tape_reader.timer = m_tape_puncher.timer = m_typewriter.tyo_timer = m_dpy_timer = NULL; |
| 518 | 515 | } |
| 519 | 516 | |
| 520 | 517 | |
| r20721 | r20722 | |
| 656 | 653 | dst = machine().root_device().memregion("gfx1")->base(); |
| 657 | 654 | memcpy(dst, fontdata6x8, pdp1_fontdata_size); |
| 658 | 655 | |
| 659 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_machine_stop),&machine())); |
| 656 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_state::pdp1_machine_stop),this)); |
| 660 | 657 | |
| 661 | 658 | m_tape_reader.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::reader_callback),this)); |
| 662 | 659 | m_tape_puncher.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pdp1_state::puncher_callback),this)); |
trunk/src/mess/drivers/vboy.c
| r20721 | r20722 | |
| 217 | 217 | TIMER_DEVICE_CALLBACK_MEMBER(timer_pad_tick); |
| 218 | 218 | TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineL); |
| 219 | 219 | TIMER_DEVICE_CALLBACK_MEMBER(vboy_scanlineR); |
| 220 | void vboy_machine_stop(); |
| 220 | 221 | }; |
| 221 | 222 | |
| 222 | 223 | |
| r20721 | r20722 | |
| 1164 | 1165 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // Battery low |
| 1165 | 1166 | INPUT_PORTS_END |
| 1166 | 1167 | |
| 1167 | | static void vboy_machine_stop(running_machine &machine) |
| 1168 | void vboy_state::vboy_machine_stop() |
| 1168 | 1169 | { |
| 1169 | | vboy_state *state = machine.driver_data<vboy_state>(); |
| 1170 | | |
| 1171 | 1170 | // only do this if the cart loader detected some form of backup |
| 1172 | | if (state->m_nvptr != NULL) |
| 1171 | if (m_nvptr != NULL) |
| 1173 | 1172 | { |
| 1174 | | device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage); |
| 1175 | | image->battery_save(state->m_nvptr, 0x10000); |
| 1173 | device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage); |
| 1174 | image->battery_save(m_nvptr, 0x10000); |
| 1176 | 1175 | } |
| 1177 | 1176 | } |
| 1178 | 1177 | |
| 1179 | 1178 | void vboy_state::machine_start() |
| 1180 | 1179 | { |
| 1181 | 1180 | /* add a hook for battery save */ |
| 1182 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_machine_stop),&machine())); |
| 1181 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(vboy_state::vboy_machine_stop),this)); |
| 1183 | 1182 | |
| 1184 | 1183 | // m_vboy_sram = auto_alloc_array(machine(), UINT32, 0x10000/4); |
| 1185 | 1184 | } |
trunk/src/mess/drivers/nc.c
| r20721 | r20722 | |
| 120 | 120 | |
| 121 | 121 | static void nc_printer_update(running_machine &machine, UINT8 data); |
| 122 | 122 | |
| 123 | | |
| 124 | | |
| 125 | | |
| 126 | | static void nc100_machine_stop(running_machine &machine); |
| 127 | | static void nc200_machine_stop(running_machine &machine); |
| 128 | | |
| 129 | 123 | /* |
| 130 | 124 | Port 0x00: |
| 131 | 125 | ========== |
| r20721 | r20722 | |
| 933 | 927 | m_irq_latch_mask = (1<<0) | (1<<1); |
| 934 | 928 | } |
| 935 | 929 | |
| 936 | | static void nc100_machine_stop(running_machine &machine) |
| 930 | void nc_state::nc100_machine_stop() |
| 937 | 931 | { |
| 938 | | nc_common_open_stream_for_writing(machine); |
| 939 | | nc_common_store_memory_to_stream(machine); |
| 940 | | nc_common_close_stream(machine); |
| 932 | nc_common_open_stream_for_writing(machine()); |
| 933 | nc_common_store_memory_to_stream(machine()); |
| 934 | nc_common_close_stream(machine()); |
| 941 | 935 | } |
| 942 | 936 | |
| 943 | 937 | void nc_state::machine_start() |
| 944 | 938 | { |
| 945 | 939 | m_type = NC_TYPE_1xx; |
| 946 | 940 | |
| 947 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc100_machine_stop),&machine())); |
| 941 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc_state::nc100_machine_stop),this)); |
| 948 | 942 | |
| 949 | 943 | /* keyboard timer */ |
| 950 | 944 | m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); |
| r20721 | r20722 | |
| 1311 | 1305 | nc200_video_set_backlight(machine(), 0); |
| 1312 | 1306 | } |
| 1313 | 1307 | |
| 1314 | | static void nc200_machine_stop(running_machine &machine) |
| 1308 | void nc_state::nc200_machine_stop() |
| 1315 | 1309 | { |
| 1316 | | nc_common_open_stream_for_writing(machine); |
| 1317 | | nc_common_store_memory_to_stream(machine); |
| 1318 | | nc_common_close_stream(machine); |
| 1310 | nc_common_open_stream_for_writing(machine()); |
| 1311 | nc_common_store_memory_to_stream(machine()); |
| 1312 | nc_common_close_stream(machine()); |
| 1319 | 1313 | } |
| 1320 | 1314 | |
| 1321 | 1315 | MACHINE_START_MEMBER(nc_state,nc200) |
| 1322 | 1316 | { |
| 1323 | 1317 | m_type = NC_TYPE_200; |
| 1324 | 1318 | |
| 1325 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc200_machine_stop),&machine())); |
| 1319 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(nc_state::nc200_machine_stop),this)); |
| 1326 | 1320 | |
| 1327 | 1321 | /* keyboard timer */ |
| 1328 | 1322 | m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nc_state::nc_keyboard_timer_callback),this)); |
trunk/src/mess/drivers/gba.c
| r20721 | r20722 | |
| 43 | 43 | |
| 44 | 44 | static const UINT32 timer_clks[4] = { 16777216, 16777216/64, 16777216/256, 16777216/1024 }; |
| 45 | 45 | |
| 46 | | static void gba_machine_stop(running_machine &machine) |
| 46 | void gba_state::gba_machine_stop() |
| 47 | 47 | { |
| 48 | | gba_state *state = machine.driver_data<gba_state>(); |
| 49 | | |
| 50 | 48 | // only do this if the cart loader detected some form of backup |
| 51 | | if (state->m_nvsize > 0) |
| 49 | if (m_nvsize > 0) |
| 52 | 50 | { |
| 53 | | device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage); |
| 54 | | image->battery_save(state->m_nvptr, state->m_nvsize); |
| 51 | device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage); |
| 52 | image->battery_save(m_nvptr, m_nvsize); |
| 55 | 53 | } |
| 56 | 54 | |
| 57 | | if (state->m_flash_size > 0) |
| 55 | if (m_flash_size > 0) |
| 58 | 56 | { |
| 59 | | device_image_interface *image = dynamic_cast<device_image_interface *>(state->m_nvimage); |
| 60 | | UINT8 *nvram = auto_alloc_array( machine, UINT8, state->m_flash_size); |
| 61 | | for (int i = 0; i < state->m_flash_size; i++) |
| 57 | device_image_interface *image = dynamic_cast<device_image_interface *>(m_nvimage); |
| 58 | UINT8 *nvram = auto_alloc_array( machine(), UINT8, m_flash_size); |
| 59 | for (int i = 0; i < m_flash_size; i++) |
| 62 | 60 | { |
| 63 | | nvram[i] = state->m_mFlashDev->read_raw( i); |
| 61 | nvram[i] = m_mFlashDev->read_raw( i); |
| 64 | 62 | } |
| 65 | | image->battery_save( nvram, state->m_flash_size); |
| 66 | | auto_free( machine, nvram); |
| 63 | image->battery_save( nvram, m_flash_size); |
| 64 | auto_free( machine(), nvram); |
| 67 | 65 | } |
| 68 | 66 | } |
| 69 | 67 | |
| r20721 | r20722 | |
| 2129 | 2127 | void gba_state::machine_start() |
| 2130 | 2128 | { |
| 2131 | 2129 | /* add a hook for battery save */ |
| 2132 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_machine_stop),&machine())); |
| 2130 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gba_state::gba_machine_stop),this)); |
| 2133 | 2131 | |
| 2134 | 2132 | /* create a timer to fire scanline functions */ |
| 2135 | 2133 | m_scan_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gba_state::perform_scan),this)); |
trunk/src/mess/machine/cybiko.c
| r20721 | r20722 | |
| 21 | 21 | // FUNCTION PROTOTYPES // |
| 22 | 22 | ///////////////////////// |
| 23 | 23 | |
| 24 | | #define MACHINE_STOP(name) \ |
| 25 | | static void machine_stop_##name( running_machine &machine) |
| 26 | | |
| 27 | | // machine stop |
| 28 | | MACHINE_STOP( cybikov1 ); |
| 29 | | MACHINE_STOP( cybikov2 ); |
| 30 | | MACHINE_STOP( cybikoxt ); |
| 31 | | |
| 32 | 24 | // state->m_rs232 |
| 33 | 25 | static void cybiko_rs232_init(running_machine &machine); |
| 34 | 26 | static void cybiko_rs232_exit(void); |
| r20721 | r20722 | |
| 192 | 184 | // serial port |
| 193 | 185 | cybiko_rs232_init(machine()); |
| 194 | 186 | // other |
| 195 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov1),&machine())); |
| 187 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikov1),this)); |
| 196 | 188 | } |
| 197 | 189 | |
| 198 | 190 | MACHINE_START_MEMBER(cybiko_state,cybikov2) |
| r20721 | r20722 | |
| 210 | 202 | // serial port |
| 211 | 203 | cybiko_rs232_init(machine()); |
| 212 | 204 | // other |
| 213 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikov2),&machine())); |
| 205 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikov2),this)); |
| 214 | 206 | } |
| 215 | 207 | |
| 216 | 208 | MACHINE_START_MEMBER(cybiko_state,cybikoxt) |
| r20721 | r20722 | |
| 227 | 219 | // serial port |
| 228 | 220 | cybiko_rs232_init(machine()); |
| 229 | 221 | // other |
| 230 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(machine_stop_cybikoxt),&machine())); |
| 222 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cybiko_state::machine_stop_cybikoxt),this)); |
| 231 | 223 | } |
| 232 | 224 | |
| 233 | 225 | /////////////////// |
| r20721 | r20722 | |
| 256 | 248 | // MACHINE STOP // |
| 257 | 249 | ////////////////// |
| 258 | 250 | |
| 259 | | MACHINE_STOP( cybikov1 ) |
| 251 | void cybiko_state::machine_stop_cybikov1() |
| 260 | 252 | { |
| 261 | 253 | _logerror( 0, ("machine_stop_cybikov1\n")); |
| 262 | 254 | // real-time clock |
| 263 | | nvram_system_save( machine, "rtc", cybiko_pcf8593_save); |
| 255 | nvram_system_save( machine(), "rtc", cybiko_pcf8593_save); |
| 264 | 256 | // serial dataflash |
| 265 | | nvram_system_save( machine, "flash1", cybiko_at45dbxx_save); |
| 257 | nvram_system_save( machine(), "flash1", cybiko_at45dbxx_save); |
| 266 | 258 | // serial port |
| 267 | 259 | cybiko_rs232_exit(); |
| 268 | 260 | } |
| 269 | 261 | |
| 270 | | MACHINE_STOP( cybikov2 ) |
| 262 | void cybiko_state::machine_stop_cybikov2() |
| 271 | 263 | { |
| 272 | 264 | _logerror( 0, ("machine_stop_cybikov2\n")); |
| 273 | 265 | // real-time clock |
| 274 | | nvram_system_save( machine, "rtc", cybiko_pcf8593_save); |
| 266 | nvram_system_save( machine(), "rtc", cybiko_pcf8593_save); |
| 275 | 267 | // serial dataflash |
| 276 | | nvram_system_save( machine, "flash1", cybiko_at45dbxx_save); |
| 268 | nvram_system_save( machine(), "flash1", cybiko_at45dbxx_save); |
| 277 | 269 | // multi-purpose flash |
| 278 | | nvram_system_save( machine, "flash2", cybiko_sst39vfx_save); |
| 270 | nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save); |
| 279 | 271 | // serial port |
| 280 | 272 | cybiko_rs232_exit(); |
| 281 | 273 | } |
| 282 | 274 | |
| 283 | | MACHINE_STOP( cybikoxt ) |
| 275 | void cybiko_state::machine_stop_cybikoxt() |
| 284 | 276 | { |
| 285 | 277 | _logerror( 0, ("machine_stop_cybikoxt\n")); |
| 286 | 278 | // real-time clock |
| 287 | | nvram_system_save( machine, "rtc", cybiko_pcf8593_save); |
| 279 | nvram_system_save( machine(), "rtc", cybiko_pcf8593_save); |
| 288 | 280 | // multi-purpose flash |
| 289 | | nvram_system_save( machine, "flash2", cybiko_sst39vfx_save); |
| 281 | nvram_system_save( machine(), "flash2", cybiko_sst39vfx_save); |
| 290 | 282 | // ramdisk |
| 291 | | nvram_system_save( machine, "ramdisk", cybiko_ramdisk_save); |
| 283 | nvram_system_save( machine(), "ramdisk", cybiko_ramdisk_save); |
| 292 | 284 | // serial port |
| 293 | 285 | cybiko_rs232_exit(); |
| 294 | 286 | } |
trunk/src/mess/machine/apple2.c
| r20721 | r20722 | |
| 1175 | 1175 | * Machine reset |
| 1176 | 1176 | * ----------------------------------------------------------------------- */ |
| 1177 | 1177 | |
| 1178 | | static void apple2_reset(running_machine &machine) |
| 1178 | void apple2_state::machine_reset() |
| 1179 | 1179 | { |
| 1180 | | apple2_state *state = machine.driver_data<apple2_state>(); |
| 1181 | 1180 | int need_intcxrom; |
| 1182 | 1181 | |
| 1183 | | state->m_rambase = state->m_ram->pointer(); |
| 1184 | | state->apple2_refresh_delegates(); |
| 1182 | m_rambase = m_ram->pointer(); |
| 1183 | apple2_refresh_delegates(); |
| 1185 | 1184 | |
| 1186 | | need_intcxrom = !strcmp(machine.system().name, "apple2c") |
| 1187 | | || !strcmp(machine.system().name, "apple2c0") |
| 1188 | | || !strcmp(machine.system().name, "apple2c3") |
| 1189 | | || !strcmp(machine.system().name, "apple2c4") |
| 1190 | | || !strcmp(machine.system().name, "prav8c") |
| 1191 | | || !strcmp(machine.system().name, "apple2cp") |
| 1192 | | || !strncmp(machine.system().name, "apple2g", 7); |
| 1193 | | apple2_setvar(machine, need_intcxrom ? VAR_INTCXROM : 0, ~0); |
| 1185 | need_intcxrom = !strcmp(machine().system().name, "apple2c") |
| 1186 | || !strcmp(machine().system().name, "apple2c0") |
| 1187 | || !strcmp(machine().system().name, "apple2c3") |
| 1188 | || !strcmp(machine().system().name, "apple2c4") |
| 1189 | || !strcmp(machine().system().name, "prav8c") |
| 1190 | || !strcmp(machine().system().name, "apple2cp") |
| 1191 | || !strncmp(machine().system().name, "apple2g", 7); |
| 1192 | apple2_setvar(machine(), need_intcxrom ? VAR_INTCXROM : 0, ~0); |
| 1194 | 1193 | |
| 1195 | 1194 | // ROM 0 cannot boot unless language card bank 2 is write-enabled (but read ROM) on startup |
| 1196 | | if (!strncmp(machine.system().name, "apple2g", 7)) |
| 1195 | if (!strncmp(machine().system().name, "apple2g", 7)) |
| 1197 | 1196 | { |
| 1198 | | apple2_setvar(machine, VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2); |
| 1197 | apple2_setvar(machine(), VAR_LCWRITE|VAR_LCRAM2, VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2); |
| 1199 | 1198 | } |
| 1200 | 1199 | |
| 1201 | | state->m_a2_speaker_state = 0; |
| 1200 | m_a2_speaker_state = 0; |
| 1202 | 1201 | |
| 1203 | | state->m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset |
| 1202 | m_a2_cnxx_slot = -1; // bank in ROM at C800 on reset |
| 1204 | 1203 | |
| 1205 | | state->m_joystick_x1_time = state->m_joystick_y1_time = 0; |
| 1206 | | state->m_joystick_x2_time = state->m_joystick_y2_time = 0; |
| 1204 | m_joystick_x1_time = m_joystick_y1_time = 0; |
| 1205 | m_joystick_x2_time = m_joystick_y2_time = 0; |
| 1207 | 1206 | } |
| 1208 | 1207 | |
| 1209 | 1208 | |
| r20721 | r20722 | |
| 1760 | 1759 | state->m_fdc_diskreg = 0; |
| 1761 | 1760 | |
| 1762 | 1761 | AY3600_init(machine); |
| 1763 | | machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(apple2_reset),&machine)); |
| 1764 | 1762 | |
| 1765 | 1763 | /* state save registers */ |
| 1766 | 1764 | state->save_item(NAME(state->m_flags)); |
| r20721 | r20722 | |
| 1807 | 1805 | mem_cfg.memmap = apple2_memmap_entries; |
| 1808 | 1806 | mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; |
| 1809 | 1807 | apple2_setup_memory(machine(), &mem_cfg); |
| 1810 | | |
| 1811 | | /* perform initial reset */ |
| 1812 | | apple2_reset(machine()); |
| 1813 | 1808 | } |
| 1814 | 1809 | |
| 1815 | 1810 | MACHINE_START_MEMBER(apple2_state,laser128) |
| r20721 | r20722 | |
| 1827 | 1822 | mem_cfg.memmap = apple2_memmap_entries; |
| 1828 | 1823 | mem_cfg.auxmem = (UINT8*)NULL; |
| 1829 | 1824 | apple2_setup_memory(machine(), &mem_cfg); |
| 1830 | | |
| 1831 | | /* perform initial reset */ |
| 1832 | | apple2_reset(machine()); |
| 1833 | 1825 | } |
| 1834 | 1826 | |
| 1835 | 1827 | MACHINE_START_MEMBER(apple2_state,apple2orig) |
| r20721 | r20722 | |
| 1850 | 1842 | mem_cfg.memmap = apple2_memmap_entries; |
| 1851 | 1843 | mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; |
| 1852 | 1844 | apple2_setup_memory(machine(), &mem_cfg); |
| 1853 | | |
| 1854 | | /* perform initial reset */ |
| 1855 | | apple2_reset(machine()); |
| 1856 | 1845 | } |
| 1857 | 1846 | |
| 1858 | 1847 | MACHINE_START_MEMBER(apple2_state,space84) |
| r20721 | r20722 | |
| 1873 | 1862 | mem_cfg.memmap = apple2_memmap_entries; |
| 1874 | 1863 | mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram; |
| 1875 | 1864 | apple2_setup_memory(machine(), &mem_cfg); |
| 1876 | | |
| 1877 | | /* perform initial reset */ |
| 1878 | | apple2_reset(machine()); |
| 1879 | 1865 | } |
| 1880 | 1866 | |
| 1881 | 1867 | MACHINE_START_MEMBER(apple2_state,tk2000) |
| r20721 | r20722 | |
| 1895 | 1881 | mem_cfg.memmap = tk2000_memmap_entries; |
| 1896 | 1882 | mem_cfg.auxmem = (UINT8*)NULL; |
| 1897 | 1883 | apple2_setup_memory(machine(), &mem_cfg); |
| 1898 | | |
| 1899 | | /* perform initial reset */ |
| 1900 | | apple2_reset(machine()); |
| 1901 | 1884 | } |
| 1902 | 1885 | |
| 1903 | 1886 | int apple2_state::apple2_pressed_specialkey(UINT8 key) |
trunk/src/mess/machine/gb.c
| r20721 | r20722 | |
| 129 | 129 | */ |
| 130 | 130 | |
| 131 | 131 | |
| 132 | | static void gb_machine_stop(running_machine &machine); |
| 133 | | |
| 134 | 132 | #ifdef MAME_DEBUG |
| 135 | 133 | /* #define V_GENERAL*/ /* Display general debug information */ |
| 136 | 134 | /* #define V_BANK*/ /* Display bank switching debug information */ |
| r20721 | r20722 | |
| 283 | 281 | |
| 284 | 282 | MACHINE_START_MEMBER(gb_state,gb) |
| 285 | 283 | { |
| 286 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine())); |
| 284 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this)); |
| 287 | 285 | |
| 288 | 286 | /* Allocate the serial timer, and disable it */ |
| 289 | 287 | m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); |
| r20721 | r20722 | |
| 294 | 292 | |
| 295 | 293 | MACHINE_START_MEMBER(gb_state,gbc) |
| 296 | 294 | { |
| 297 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine())); |
| 295 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this)); |
| 298 | 296 | |
| 299 | 297 | /* Allocate the serial timer, and disable it */ |
| 300 | 298 | m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); |
| r20721 | r20722 | |
| 323 | 321 | m_sgb_packets = -1; |
| 324 | 322 | m_sgb_tile_data = auto_alloc_array_clear(machine(), UINT8, 0x2000 ); |
| 325 | 323 | |
| 326 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_machine_stop),&machine())); |
| 324 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(gb_state::gb_machine_stop),this)); |
| 327 | 325 | |
| 328 | 326 | /* Allocate the serial timer, and disable it */ |
| 329 | 327 | m_gb_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_state::gb_serial_timer_proc),this)); |
| r20721 | r20722 | |
| 409 | 407 | } |
| 410 | 408 | } |
| 411 | 409 | |
| 412 | | static void gb_machine_stop(running_machine &machine) |
| 410 | void gb_state::gb_machine_stop() |
| 413 | 411 | { |
| 414 | | gb_state *state = machine.driver_data<gb_state>(); |
| 415 | 412 | /* Don't save if there was no battery */ |
| 416 | | if(!(state->m_CartType & BATTERY) || !state->m_RAMBanks) |
| 413 | if(!(m_CartType & BATTERY) || !m_RAMBanks) |
| 417 | 414 | return; |
| 418 | 415 | |
| 419 | 416 | /* NOTE: The reason we save the carts RAM this way instead of using MAME's |
| 420 | 417 | built in macros is because they force the filename to be the name of |
| 421 | 418 | the machine. We need to have a separate name for each game. */ |
| 422 | | device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart")); |
| 423 | | image->battery_save(state->m_gb_cart_ram, state->m_RAMBanks * 0x2000); |
| 419 | device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart")); |
| 420 | image->battery_save(m_gb_cart_ram, m_RAMBanks * 0x2000); |
| 424 | 421 | } |
| 425 | 422 | |
| 426 | 423 | void gb_state::gb_set_mbc1_banks() |
trunk/src/mess/machine/wswan.c
| r20721 | r20722 | |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | | static void wswan_machine_stop( running_machine &machine ) |
| 184 | void wswan_state::wswan_machine_stop() |
| 185 | 185 | { |
| 186 | | wswan_state *state = machine.driver_data<wswan_state>(); |
| 187 | | device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart")); |
| 188 | | if ( state->m_eeprom.size ) |
| 186 | device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart")); |
| 187 | if ( m_eeprom.size ) |
| 189 | 188 | { |
| 190 | | image->battery_save(state->m_eeprom.data, state->m_eeprom.size ); |
| 189 | image->battery_save(m_eeprom.data, m_eeprom.size ); |
| 191 | 190 | } |
| 192 | 191 | } |
| 193 | 192 | |
| r20721 | r20722 | |
| 204 | 203 | { |
| 205 | 204 | m_ws_bios_bank = NULL; |
| 206 | 205 | m_system_type = TYPE_WSWAN; |
| 207 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine())); |
| 206 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_state::wswan_machine_stop),this)); |
| 208 | 207 | m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp ); |
| 209 | 208 | m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) ); |
| 210 | 209 | |
| r20721 | r20722 | |
| 221 | 220 | { |
| 222 | 221 | m_ws_bios_bank = NULL; |
| 223 | 222 | m_system_type = TYPE_WSC; |
| 224 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_machine_stop),&machine())); |
| 223 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(wswan_state::wswan_machine_stop),this)); |
| 225 | 224 | m_vdp.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(wswan_state::wswan_scanline_interrupt),this), &m_vdp ); |
| 226 | 225 | m_vdp.timer->adjust( attotime::from_ticks( 256, 3072000 ), 0, attotime::from_ticks( 256, 3072000 ) ); |
| 227 | 226 | |
trunk/src/mess/machine/dgn_beta.c
| r20721 | r20722 | |
| 1006 | 1006 | |
| 1007 | 1007 | |
| 1008 | 1008 | /********************************* Machine/Driver Initialization ****************************************/ |
| 1009 | | static void dgnbeta_reset(running_machine &machine) |
| 1009 | void dgn_beta_state::machine_reset() |
| 1010 | 1010 | { |
| 1011 | | dgn_beta_state *state = machine.driver_data<dgn_beta_state>(); |
| 1012 | | device_t *fdc = machine.device(FDC_TAG); |
| 1013 | | pia6821_device *pia_0 = machine.device<pia6821_device>( PIA_0_TAG ); |
| 1014 | | pia6821_device *pia_1 = machine.device<pia6821_device>( PIA_1_TAG ); |
| 1015 | | pia6821_device *pia_2 = machine.device<pia6821_device>( PIA_2_TAG ); |
| 1011 | device_t *fdc = machine().device(FDC_TAG); |
| 1012 | pia6821_device *pia_0 = machine().device<pia6821_device>( PIA_0_TAG ); |
| 1013 | pia6821_device *pia_1 = machine().device<pia6821_device>( PIA_1_TAG ); |
| 1014 | pia6821_device *pia_2 = machine().device<pia6821_device>( PIA_2_TAG ); |
| 1016 | 1015 | |
| 1017 | 1016 | logerror("MACHINE_RESET( dgnbeta )\n"); |
| 1018 | 1017 | |
| 1019 | | state->m_system_rom = state->memregion(MAINCPU_TAG)->base(); |
| 1018 | m_system_rom = memregion(MAINCPU_TAG)->base(); |
| 1020 | 1019 | |
| 1021 | 1020 | /* Make sure CPU 1 is started out halted ! */ |
| 1022 | | machine.device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 1021 | machine().device(DMACPU_TAG)->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 1023 | 1022 | |
| 1024 | 1023 | /* Reset to task 0, and map banks disabled, so standard memory map */ |
| 1025 | 1024 | /* with ram at $0000-$BFFF, ROM at $C000-FBFF, IO at $FC00-$FEFF */ |
| 1026 | 1025 | /* and ROM at $FF00-$FFFF */ |
| 1027 | | state->m_TaskReg = 0; |
| 1028 | | state->m_PIATaskReg = 0; |
| 1029 | | state->m_EnableMapRegs = 0; |
| 1030 | | memset(state->m_PageRegs, 0, sizeof(state->m_PageRegs)); /* Reset page registers to 0 */ |
| 1031 | | SetDefaultTask(machine); |
| 1026 | m_TaskReg = 0; |
| 1027 | m_PIATaskReg = 0; |
| 1028 | m_EnableMapRegs = 0; |
| 1029 | memset(m_PageRegs, 0, sizeof(m_PageRegs)); /* Reset page registers to 0 */ |
| 1030 | SetDefaultTask(machine()); |
| 1032 | 1031 | |
| 1033 | 1032 | /* Set pullups on all PIA port A, to match what hardware does */ |
| 1034 | 1033 | pia_0->set_port_a_z_mask(0xFF); |
| 1035 | 1034 | pia_1->set_port_a_z_mask(0xFF); |
| 1036 | 1035 | pia_2->set_port_a_z_mask(0xFF); |
| 1037 | 1036 | |
| 1038 | | state->m_d_pia1_pa_last = 0x00; |
| 1039 | | state->m_d_pia1_pb_last = 0x00; |
| 1040 | | state->m_RowShifter = 0x00; /* shift register to select row */ |
| 1041 | | state->m_Keyrow = 0x00; /* Keyboard row being shifted out */ |
| 1042 | | state->m_d_pia0_pb_last = 0x00; /* Last byte output to pia0 port b */ |
| 1043 | | state->m_d_pia0_cb2_last = 0x00; /* Last state of CB2 */ |
| 1037 | m_d_pia1_pa_last = 0x00; |
| 1038 | m_d_pia1_pb_last = 0x00; |
| 1039 | m_RowShifter = 0x00; /* shift register to select row */ |
| 1040 | m_Keyrow = 0x00; /* Keyboard row being shifted out */ |
| 1041 | m_d_pia0_pb_last = 0x00; /* Last byte output to pia0 port b */ |
| 1042 | m_d_pia0_cb2_last = 0x00; /* Last state of CB2 */ |
| 1044 | 1043 | |
| 1045 | | state->m_KInDat_next = 0x00; /* Next data bit to input */ |
| 1046 | | state->m_KAny_next = 0x00; /* Next value for KAny */ |
| 1044 | m_KInDat_next = 0x00; /* Next data bit to input */ |
| 1045 | m_KAny_next = 0x00; /* Next value for KAny */ |
| 1047 | 1046 | |
| 1048 | | state->m_DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */ |
| 1047 | m_DMA_NMI_LAST = 0x80; /* start with DMA NMI inactive, as pulled up */ |
| 1049 | 1048 | // DMA_NMI = CLEAR_LINE; /* start with DMA NMI inactive */ |
| 1050 | 1049 | |
| 1051 | 1050 | wd17xx_dden_w(fdc, CLEAR_LINE); |
| 1052 | 1051 | wd17xx_set_drive(fdc, 0); |
| 1053 | 1052 | |
| 1054 | | state->m_videoram.set_target(machine.device<ram_device>(RAM_TAG)->pointer(),state->m_videoram.bytes()); /* Point video ram at the start of physical ram */ |
| 1053 | m_videoram.set_target(machine().device<ram_device>(RAM_TAG)->pointer(),m_videoram.bytes()); /* Point video ram at the start of physical ram */ |
| 1055 | 1054 | |
| 1056 | 1055 | wd17xx_reset(fdc); |
| 1057 | | state->m_wd2797_written=0; |
| 1056 | m_wd2797_written=0; |
| 1058 | 1057 | } |
| 1059 | 1058 | |
| 1060 | 1059 | void dgn_beta_state::machine_start() |
| r20721 | r20722 | |
| 1065 | 1064 | machine().device<cpu_device>(MAINCPU_TAG)->debug()->set_dasm_override(dgnbeta_dasm_override); |
| 1066 | 1065 | } |
| 1067 | 1066 | |
| 1068 | | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(dgnbeta_reset),&machine())); |
| 1069 | | dgnbeta_reset(machine()); |
| 1070 | 1067 | /* setup debug commands */ |
| 1071 | 1068 | if (machine().debug_flags & DEBUG_FLAG_ENABLED) |
| 1072 | 1069 | { |
trunk/src/mess/machine/sms.c
| r20721 | r20722 | |
| 1337 | 1337 | return m_gg_sio[offset]; |
| 1338 | 1338 | } |
| 1339 | 1339 | |
| 1340 | | static void sms_machine_stop( running_machine &machine ) |
| 1340 | void sms_state::sms_machine_stop() |
| 1341 | 1341 | { |
| 1342 | | sms_state *state = machine.driver_data<sms_state>(); |
| 1343 | | |
| 1344 | 1342 | /* Does the cartridge have SRAM that should be saved? */ |
| 1345 | | if (state->m_cartridge[state->m_current_cartridge].sram_save) { |
| 1346 | | device_image_interface *image = dynamic_cast<device_image_interface *>(machine.device("cart1")); |
| 1347 | | image->battery_save(state->m_cartridge[state->m_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE ); |
| 1343 | if (m_cartridge[m_current_cartridge].sram_save) { |
| 1344 | device_image_interface *image = dynamic_cast<device_image_interface *>(machine().device("cart1")); |
| 1345 | image->battery_save(m_cartridge[m_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE ); |
| 1348 | 1346 | } |
| 1349 | 1347 | } |
| 1350 | 1348 | |
| r20721 | r20722 | |
| 1908 | 1906 | |
| 1909 | 1907 | MACHINE_START_MEMBER(sms_state,sms) |
| 1910 | 1908 | { |
| 1911 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_machine_stop),&machine())); |
| 1909 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(sms_state::sms_machine_stop),this)); |
| 1912 | 1910 | m_rapid_fire_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sms_state::rapid_fire_callback),this)); |
| 1913 | 1911 | m_rapid_fire_timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10)); |
| 1914 | 1912 | |
trunk/src/mess/machine/electron.c
| r20721 | r20722 | |
| 321 | 321 | beep_set_frequency( speaker, 300 ); |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | | static void electron_reset(running_machine &machine) |
| 324 | void electron_state::machine_reset() |
| 325 | 325 | { |
| 326 | | electron_state *state = machine.driver_data<electron_state>(); |
| 327 | | state->membank("bank2")->set_entry(0); |
| 326 | membank("bank2")->set_entry(0); |
| 328 | 327 | |
| 329 | | state->m_ula.communication_mode = 0x04; |
| 330 | | state->m_ula.screen_mode = 0; |
| 331 | | state->m_ula.cassette_motor_mode = 0; |
| 332 | | state->m_ula.capslock_mode = 0; |
| 333 | | state->m_ula.screen_mode = 0; |
| 334 | | state->m_ula.screen_start = 0x3000; |
| 335 | | state->m_ula.screen_base = 0x3000; |
| 336 | | state->m_ula.screen_size = 0x8000 - 0x3000; |
| 337 | | state->m_ula.screen_addr = 0; |
| 338 | | state->m_ula.tape_running = 0; |
| 339 | | state->m_ula.vram = (UINT8 *)machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(state->m_ula.screen_base); |
| 328 | m_ula.communication_mode = 0x04; |
| 329 | m_ula.screen_mode = 0; |
| 330 | m_ula.cassette_motor_mode = 0; |
| 331 | m_ula.capslock_mode = 0; |
| 332 | m_ula.screen_mode = 0; |
| 333 | m_ula.screen_start = 0x3000; |
| 334 | m_ula.screen_base = 0x3000; |
| 335 | m_ula.screen_size = 0x8000 - 0x3000; |
| 336 | m_ula.screen_addr = 0; |
| 337 | m_ula.tape_running = 0; |
| 338 | m_ula.vram = (UINT8 *)machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(m_ula.screen_base); |
| 340 | 339 | } |
| 341 | 340 | |
| 342 | 341 | void electron_state::machine_start() |
| r20721 | r20722 | |
| 347 | 346 | m_ula.interrupt_control = 0x00; |
| 348 | 347 | machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(electron_state::setup_beep),this)); |
| 349 | 348 | m_tape_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(electron_state::electron_tape_timer_handler),this)); |
| 350 | | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(electron_reset),&machine())); |
| 351 | 349 | } |
trunk/src/mess/machine/lynx.c
| r20721 | r20722 | |
| 1920 | 1920 | membank("bank4")->set_entry((data & 8) ? 1 : 0); |
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | | static void lynx_reset(running_machine &machine) |
| 1923 | void lynx_state::machine_reset() |
| 1924 | 1924 | { |
| 1925 | | lynx_state *state = machine.driver_data<lynx_state>(); |
| 1926 | | state->lynx_memory_config_w(machine.device("maincpu")->memory().space(AS_PROGRAM), 0, 0); |
| 1925 | lynx_memory_config_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0); |
| 1927 | 1926 | |
| 1928 | | machine.device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); |
| 1929 | | machine.device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE); |
| 1927 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, CLEAR_LINE); |
| 1928 | machine().device("maincpu")->execute().set_input_line(M65SC02_IRQ_LINE, CLEAR_LINE); |
| 1930 | 1929 | |
| 1931 | | memset(&state->m_suzy, 0, sizeof(state->m_suzy)); |
| 1932 | | memset(&state->m_mikey, 0, sizeof(state->m_mikey)); |
| 1930 | memset(&m_suzy, 0, sizeof(m_suzy)); |
| 1931 | memset(&m_mikey, 0, sizeof(m_mikey)); |
| 1933 | 1932 | |
| 1934 | | state->m_suzy.data[0x88] = 0x01; |
| 1935 | | state->m_suzy.data[0x90] = 0x00; |
| 1936 | | state->m_suzy.data[0x91] = 0x00; |
| 1937 | | state->m_mikey.data[0x80] = 0x00; |
| 1938 | | state->m_mikey.data[0x81] = 0x00; |
| 1939 | | state->m_mikey.data[0x88] = 0x01; |
| 1940 | | state->m_mikey.data[0x8a] = 0x00; |
| 1941 | | state->m_mikey.data[0x8c] = 0x00; |
| 1942 | | state->m_mikey.data[0x90] = 0x00; |
| 1943 | | state->m_mikey.data[0x92] = 0x00; |
| 1933 | m_suzy.data[0x88] = 0x01; |
| 1934 | m_suzy.data[0x90] = 0x00; |
| 1935 | m_suzy.data[0x91] = 0x00; |
| 1936 | m_mikey.data[0x80] = 0x00; |
| 1937 | m_mikey.data[0x81] = 0x00; |
| 1938 | m_mikey.data[0x88] = 0x01; |
| 1939 | m_mikey.data[0x8a] = 0x00; |
| 1940 | m_mikey.data[0x8c] = 0x00; |
| 1941 | m_mikey.data[0x90] = 0x00; |
| 1942 | m_mikey.data[0x92] = 0x00; |
| 1944 | 1943 | |
| 1945 | | lynx_uart_reset(state); |
| 1944 | lynx_uart_reset(this); |
| 1946 | 1945 | |
| 1947 | 1946 | // hack to allow current object loading to work |
| 1948 | 1947 | #if 0 |
| 1949 | | lynx_timer_write( state, 0, 0, 160 ); // set backup value (hpos) = 160 |
| 1950 | | lynx_timer_write( state, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period |
| 1951 | | lynx_timer_write( state, 2, 0, 105 ); // set backup value (vpos) = 102 |
| 1952 | | lynx_timer_write( state, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link |
| 1948 | lynx_timer_write( this, 0, 0, 160 ); // set backup value (hpos) = 160 |
| 1949 | lynx_timer_write( this, 0, 1, 0x10 | 0x8 | 0 ); // enable count, enable reload, 1us period |
| 1950 | lynx_timer_write( this, 2, 0, 105 ); // set backup value (vpos) = 102 |
| 1951 | lynx_timer_write( this, 2, 1, 0x10 | 0x8 | 7 ); // enable count, enable reload, link |
| 1953 | 1952 | #endif |
| 1953 | |
| 1954 | render_target *target = machine().render().first_target(); |
| 1955 | target->set_view(m_rotate); |
| 1954 | 1956 | } |
| 1955 | 1957 | |
| 1956 | 1958 | void lynx_state::lynx_postload() |
| r20721 | r20722 | |
| 1976 | 1978 | |
| 1977 | 1979 | memset(&m_suzy, 0, sizeof(m_suzy)); |
| 1978 | 1980 | |
| 1979 | | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(lynx_reset),&machine())); |
| 1980 | | |
| 1981 | 1981 | for (i = 0; i < NR_LYNX_TIMERS; i++) |
| 1982 | 1982 | lynx_timer_init(machine(), i); |
| 1983 | 1983 | } |
| 1984 | 1984 | |
| 1985 | | void lynx_state::machine_reset() |
| 1986 | | { |
| 1987 | | render_target *target = machine().render().first_target(); |
| 1988 | | target->set_view(m_rotate); |
| 1989 | | } |
| 1990 | 1985 | |
| 1991 | 1986 | /**************************************** |
| 1992 | 1987 | |
trunk/src/mame/machine/tecmosys.c
| r20721 | r20722 | |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | 105 | |
| 106 | | static void tecmosys_prot_reset(running_machine &machine) |
| 107 | | { |
| 108 | | tecmosys_state *state = machine.driver_data<tecmosys_state>(); |
| 109 | | state->m_device_read_ptr = 0; |
| 110 | | state->m_device_status = DS_IDLE; |
| 111 | | state->m_device_value = 0xff; |
| 106 | void tecmosys_state::tecmosys_prot_reset() |
| 107 | { |
| 108 | m_device_read_ptr = 0; |
| 109 | m_device_status = DS_IDLE; |
| 110 | m_device_value = 0xff; |
| 112 | 111 | } |
| 113 | 112 | |
| 114 | | void tecmosys_prot_init(running_machine &machine, int which) |
| 113 | void tecmosys_state::tecmosys_prot_init(int which) |
| 115 | 114 | { |
| 116 | | tecmosys_state *state = machine.driver_data<tecmosys_state>(); |
| 117 | 115 | switch (which) |
| 118 | 116 | { |
| 119 | | case 0: state->m_device_data = &deroon_data; break; |
| 120 | | case 1: state->m_device_data = &tkdensho_data; break; |
| 121 | | case 2: state->m_device_data = &tkdensha_data; break; |
| 117 | case 0: m_device_data = &deroon_data; break; |
| 118 | case 1: m_device_data = &tkdensho_data; break; |
| 119 | case 2: m_device_data = &tkdensha_data; break; |
| 122 | 120 | } |
| 123 | 121 | |
| 124 | | machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_prot_reset), &machine)); |
| 122 | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(tecmosys_state::tecmosys_prot_reset),this)); |
| 125 | 123 | } |
| 126 | 124 | |
| 127 | 125 | READ16_MEMBER(tecmosys_state::tecmosys_prot_status_r) |
trunk/src/mame/video/model2.c
| r20721 | r20722 | |
| 2692 | 2692 | /***********************************************************************************************/ |
| 2693 | 2693 | |
| 2694 | 2694 | |
| 2695 | | static void model2_exit(running_machine &machine) |
| 2695 | void model2_state::model2_exit() |
| 2696 | 2696 | { |
| 2697 | | model2_state *state = machine.driver_data<model2_state>(); |
| 2698 | | poly_free(state->m_poly); |
| 2697 | poly_free(m_poly); |
| 2699 | 2698 | } |
| 2700 | 2699 | |
| 2701 | 2700 | VIDEO_START_MEMBER(model2_state,model2) |
| r20721 | r20722 | |
| 2707 | 2706 | m_sys24_bitmap.allocate(width, height+4); |
| 2708 | 2707 | |
| 2709 | 2708 | m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0); |
| 2710 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_exit), &machine())); |
| 2709 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model2_state::model2_exit), this)); |
| 2711 | 2710 | |
| 2712 | 2711 | /* initialize the hardware rasterizer */ |
| 2713 | 2712 | model2_3d_init( machine(), (UINT16*)memregion("user3")->base() ); |
trunk/src/mame/video/model3.c
| r20721 | r20722 | |
| 105 | 105 | #define BYTE_REVERSE16(x) (((x >> 8) & 0xff) | ((x << 8) & 0xff00)) |
| 106 | 106 | |
| 107 | 107 | |
| 108 | | static void model3_exit(running_machine &machine) |
| 108 | void model3_state::model3_exit() |
| 109 | 109 | { |
| 110 | | model3_state *state = machine.driver_data<model3_state>(); |
| 111 | | invalidate_texture(machine, 0, 0, 0, 6, 5); |
| 112 | | invalidate_texture(machine, 1, 0, 0, 6, 5); |
| 113 | | poly_free(state->m_poly); |
| 110 | invalidate_texture(machine(), 0, 0, 0, 6, 5); |
| 111 | invalidate_texture(machine(), 1, 0, 0, 6, 5); |
| 112 | poly_free(m_poly); |
| 114 | 113 | } |
| 115 | 114 | |
| 116 | 115 | void model3_state::video_start() |
| 117 | 116 | { |
| 118 | 117 | m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0); |
| 119 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_exit), &machine())); |
| 118 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_state::model3_exit), this)); |
| 120 | 119 | |
| 121 | 120 | machine().primary_screen->register_screen_bitmap(m_bitmap3d); |
| 122 | 121 | machine().primary_screen->register_screen_bitmap(m_zbuffer); |
trunk/src/mame/video/namcos22.c
| r20721 | r20722 | |
| 2661 | 2661 | m_dirtypal[offset&(0x7fff/4)] = 1; |
| 2662 | 2662 | } |
| 2663 | 2663 | |
| 2664 | | static void namcos22_reset(running_machine &machine) |
| 2664 | void namcos22_state::namcos22_reset() |
| 2665 | 2665 | { |
| 2666 | 2666 | memset(&mSceneRoot, 0, sizeof(mSceneRoot)); |
| 2667 | 2667 | mpFreeSceneNode = NULL; |
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | | static void namcos22_exit(running_machine &machine) |
| 2670 | void namcos22_state::namcos22_exit() |
| 2671 | 2671 | { |
| 2672 | | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| 2673 | | poly_free(state->m_poly); |
| 2672 | poly_free(m_poly); |
| 2674 | 2673 | } |
| 2675 | 2674 | |
| 2676 | 2675 | VIDEO_START_MEMBER(namcos22_state,common) |
| r20721 | r20722 | |
| 2695 | 2694 | m_pPolyH = m_pPolyM + m_PtRomSize; |
| 2696 | 2695 | |
| 2697 | 2696 | m_poly = poly_alloc(machine(), 4000, sizeof(poly_extra_data), 0); |
| 2698 | | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_reset), &machine())); |
| 2699 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_exit), &machine())); |
| 2697 | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(namcos22_state::namcos22_reset), this)); |
| 2698 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(namcos22_state::namcos22_exit), this)); |
| 2700 | 2699 | |
| 2701 | 2700 | machine().gfx[GFX_CHAR]->set_source((UINT8 *)m_cgram.target()); |
| 2702 | 2701 | } |
trunk/src/mame/video/midzeus.c
| r20721 | r20722 | |
| 82 | 82 | * |
| 83 | 83 | *************************************/ |
| 84 | 84 | |
| 85 | | static void exit_handler(running_machine &machine); |
| 86 | | |
| 87 | 85 | static void zeus_pointer_w(UINT32 which, UINT32 data, int logit); |
| 88 | 86 | static void zeus_register16_w(running_machine &machine, offs_t offset, UINT16 data, int logit); |
| 89 | 87 | static void zeus_register32_w(running_machine &machine, offs_t offset, UINT32 data, int logit); |
| r20721 | r20722 | |
| 275 | 273 | poly = poly_alloc(machine(), 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); |
| 276 | 274 | |
| 277 | 275 | /* we need to cleanup on exit */ |
| 278 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine())); |
| 276 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus_state::exit_handler), this)); |
| 279 | 277 | |
| 280 | 278 | yoffs = 0; |
| 281 | 279 | texel_width = 256; |
| r20721 | r20722 | |
| 301 | 299 | } |
| 302 | 300 | |
| 303 | 301 | |
| 304 | | static void exit_handler(running_machine &machine) |
| 302 | void midzeus_state::exit_handler() |
| 305 | 303 | { |
| 306 | 304 | #if DUMP_WAVE_RAM |
| 307 | 305 | FILE *f = fopen("waveram.dmp", "w"); |
trunk/src/mame/video/midzeus2.c
| r20721 | r20722 | |
| 101 | 101 | * |
| 102 | 102 | *************************************/ |
| 103 | 103 | |
| 104 | | static void exit_handler(running_machine &machine); |
| 105 | | |
| 106 | 104 | static void zeus_register32_w(running_machine &machine, offs_t offset, UINT32 data, int logit); |
| 107 | 105 | static void zeus_register_update(running_machine &machine, offs_t offset, UINT32 oldval, int logit); |
| 108 | 106 | static void zeus_pointer_write(UINT8 which, UINT32 value); |
| r20721 | r20722 | |
| 272 | 270 | poly = poly_alloc(machine(), 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS); |
| 273 | 271 | |
| 274 | 272 | /* we need to cleanup on exit */ |
| 275 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(exit_handler), &machine())); |
| 273 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(midzeus_state::exit_handler2), this)); |
| 276 | 274 | |
| 277 | 275 | zbase = 2.0f; |
| 278 | 276 | yoffs = 0; |
| r20721 | r20722 | |
| 296 | 294 | } |
| 297 | 295 | |
| 298 | 296 | |
| 299 | | static void exit_handler(running_machine &machine) |
| 297 | void midzeus_state::exit_handler2() |
| 300 | 298 | { |
| 301 | 299 | #if DUMP_WAVE_RAM |
| 302 | 300 | FILE *f = fopen("waveram.dmp", "w"); |
trunk/src/mame/drivers/tecmosys.c
| r20721 | r20722 | |
| 653 | 653 | DRIVER_INIT_MEMBER(tecmosys_state,deroon) |
| 654 | 654 | { |
| 655 | 655 | tecmosys_descramble(machine()); |
| 656 | | tecmosys_prot_init(machine(), 0); // machine/tecmosys.c |
| 656 | tecmosys_prot_init(0); // machine/tecmosys.c |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | DRIVER_INIT_MEMBER(tecmosys_state,tkdensho) |
| 660 | 660 | { |
| 661 | 661 | tecmosys_descramble(machine()); |
| 662 | | tecmosys_prot_init(machine(), 1); |
| 662 | tecmosys_prot_init(1); |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | DRIVER_INIT_MEMBER(tecmosys_state,tkdensha) |
| 666 | 666 | { |
| 667 | 667 | tecmosys_descramble(machine()); |
| 668 | | tecmosys_prot_init(machine(), 2); |
| 668 | tecmosys_prot_init(2); |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | GAME( 1995, deroon, 0, deroon, deroon, tecmosys_state, deroon, ROT0, "Tecmo", "Deroon DeroDero", 0 ) |
trunk/src/mame/drivers/cobra.c
| r20721 | r20722 | |
| 723 | 723 | virtual void video_start(); |
| 724 | 724 | UINT32 screen_update_cobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 725 | 725 | INTERRUPT_GEN_MEMBER(cobra_vblank); |
| 726 | void cobra_video_exit(); |
| 726 | 727 | }; |
| 727 | 728 | |
| 728 | 729 | void cobra_renderer::render_color_scan(INT32 scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid) |
| r20721 | r20722 | |
| 982 | 983 | } |
| 983 | 984 | } |
| 984 | 985 | |
| 985 | | static void cobra_video_exit(running_machine *machine) |
| 986 | void cobra_state::cobra_video_exit() |
| 986 | 987 | { |
| 987 | | cobra_state *state = machine->driver_data<cobra_state>(); |
| 988 | | state->m_renderer->gfx_exit(*machine); |
| 988 | m_renderer->gfx_exit(machine()); |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | void cobra_state::video_start() |
| 992 | 992 | { |
| 993 | | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cobra_video_exit), &machine())); |
| 993 | machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(cobra_state::cobra_video_exit), this)); |
| 994 | 994 | |
| 995 | 995 | m_renderer = auto_alloc(machine(), cobra_renderer(machine())); |
| 996 | 996 | m_renderer->gfx_init(machine()); |
trunk/src/mame/drivers/taitosj.c
| r20721 | r20722 | |
| 2731 | 2731 | ROM_LOAD( "pal16l8.28", 0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */ |
| 2732 | 2732 | ROM_END |
| 2733 | 2733 | |
| 2734 | | static void reset_common(running_machine &machine) |
| 2734 | void taitosj_state::reset_common() |
| 2735 | 2735 | { |
| 2736 | | taitosj_state *state = machine.driver_data<taitosj_state>(); |
| 2737 | | state->m_sndnmi_disable = 1; |
| 2738 | | state->m_input_port_4_f0 = 0; |
| 2736 | m_sndnmi_disable = 1; |
| 2737 | m_input_port_4_f0 = 0; |
| 2739 | 2738 | /* start in 1st gear */ |
| 2740 | | state->m_kikstart_gears[0] = 0x02; |
| 2741 | | state->m_kikstart_gears[1] = 0x02; |
| 2742 | | state->m_dac_out = 0; |
| 2743 | | state->m_dac_vol = 0; |
| 2739 | m_kikstart_gears[0] = 0x02; |
| 2740 | m_kikstart_gears[1] = 0x02; |
| 2741 | m_dac_out = 0; |
| 2742 | m_dac_vol = 0; |
| 2744 | 2743 | } |
| 2745 | 2744 | |
| 2746 | | static void init_common(running_machine &machine) |
| 2745 | void taitosj_state::init_common() |
| 2747 | 2746 | { |
| 2748 | | taitosj_state *state = machine.driver_data<taitosj_state>(); |
| 2749 | | state->save_item(NAME(state->m_sndnmi_disable)); |
| 2750 | | state->save_item(NAME(state->m_input_port_4_f0)); |
| 2751 | | state->save_item(NAME(state->m_kikstart_gears)); |
| 2752 | | state->save_item(NAME(state->m_dac_out)); |
| 2753 | | state->save_item(NAME(state->m_dac_vol)); |
| 2754 | | |
| 2755 | | machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(reset_common), &machine)); |
| 2747 | save_item(NAME(m_sndnmi_disable)); |
| 2748 | save_item(NAME(m_input_port_4_f0)); |
| 2749 | save_item(NAME(m_kikstart_gears)); |
| 2750 | save_item(NAME(m_dac_out)); |
| 2751 | save_item(NAME(m_dac_vol)); |
| 2752 | |
| 2753 | machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(taitosj_state::reset_common), this)); |
| 2756 | 2754 | } |
| 2757 | 2755 | |
| 2758 | 2756 | DRIVER_INIT_MEMBER(taitosj_state,taitosj) |
| 2759 | 2757 | { |
| 2760 | | init_common(machine()); |
| 2758 | init_common(); |
| 2761 | 2759 | } |
| 2762 | 2760 | |
| 2763 | 2761 | DRIVER_INIT_MEMBER(taitosj_state,spacecr) |
| 2764 | 2762 | { |
| 2765 | | init_common(machine()); |
| 2763 | init_common(); |
| 2766 | 2764 | |
| 2767 | 2765 | /* install protection handler */ |
| 2768 | 2766 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd48b, 0xd48b, read8_delegate(FUNC(taitosj_state::spacecr_prot_r),this)); |
| r20721 | r20722 | |
| 2770 | 2768 | |
| 2771 | 2769 | DRIVER_INIT_MEMBER(taitosj_state,alpine) |
| 2772 | 2770 | { |
| 2773 | | init_common(machine()); |
| 2771 | init_common(); |
| 2774 | 2772 | |
| 2775 | 2773 | /* install protection handlers */ |
| 2776 | 2774 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this)); |
| r20721 | r20722 | |
| 2779 | 2777 | |
| 2780 | 2778 | DRIVER_INIT_MEMBER(taitosj_state,alpinea) |
| 2781 | 2779 | { |
| 2782 | | init_common(machine()); |
| 2780 | init_common(); |
| 2783 | 2781 | |
| 2784 | 2782 | /* install protection handlers */ |
| 2785 | 2783 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd40b, 0xd40b, read8_delegate(FUNC(taitosj_state::alpine_port_2_r),this)); |
| r20721 | r20722 | |
| 2788 | 2786 | |
| 2789 | 2787 | DRIVER_INIT_MEMBER(taitosj_state,junglhbr) |
| 2790 | 2788 | { |
| 2791 | | init_common(machine()); |
| 2789 | init_common(); |
| 2792 | 2790 | |
| 2793 | 2791 | /* inverter on bits 0 and 1 */ |
| 2794 | 2792 | machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x9000, 0xbfff, write8_delegate(FUNC(taitosj_state::junglhbr_characterram_w),this)); |