Previous | 199869 Revisions | Next |
r36808 Monday 30th March, 2015 at 18:30:18 UTC by Miodrag Milanović |
---|
removed windows/osinline.h and placed MSVC dependent files in top folder (nw) moved MSVC defines from winprefix.h to osdcomm.h removed empty file compilation - porttime.c removed osinline.h in windows and sdl and change files using them. |
[scripts/src] | 3rdparty.lua |
[src/mame/drivers] | m72.c |
[src/mame/includes] | m72.h |
[src/mame/video] | m72.c |
[src/osd] | eivc.h* eivcx86.h* eminline.h osdcomm.h |
[src/osd/modules/opengl] | gl_shader_mgr.c |
[src/osd/modules/sync] | sync_ntc.c sync_os2.c sync_sdl.c sync_windows.c |
[src/osd/sdl] | |
[src/osd/windows] |
r245319 | r245320 | |
---|---|---|
405 | 405 | files { |
406 | 406 | MAME_DIR .. "3rdparty/portmidi/pm_common/portmidi.c", |
407 | 407 | MAME_DIR .. "3rdparty/portmidi/pm_common/pmutil.c", |
408 | MAME_DIR .. "3rdparty/portmidi/porttime/porttime.c", | |
409 | } | |
408 | } | |
410 | 409 | |
411 | 410 | if _OPTIONS["targetos"]=="windows" then |
412 | 411 | files { |
r245319 | r245320 | |
---|---|---|
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | ||
100 | ||
101 | ||
99 | 102 | /***************************************************************************/ |
100 | 103 | |
101 | 104 | void m72_state::machine_start() |
102 | 105 | { |
103 | m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m72_state::scanline_interrupt),this)); | |
106 | m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m72_state::m72_scanline_interrupt),this)); | |
107 | ||
108 | save_item(NAME(m_mcu_sample_addr)); | |
109 | save_item(NAME(m_mcu_snd_cmd_latch)); | |
104 | 110 | } |
105 | 111 | |
106 | 112 | MACHINE_START_MEMBER(m72_state,kengo) |
107 | 113 | { |
108 | 114 | m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(m72_state::kengo_scanline_interrupt),this)); |
115 | ||
116 | save_item(NAME(m_mcu_sample_addr)); | |
117 | save_item(NAME(m_mcu_snd_cmd_latch)); | |
109 | 118 | } |
110 | 119 | |
111 | 120 | TIMER_CALLBACK_MEMBER(m72_state::synch_callback) |
r245319 | r245320 | |
135 | 144 | m_scanline_timer->adjust(m_screen->time_until_pos(0)); |
136 | 145 | } |
137 | 146 | |
138 | TIMER_CALLBACK_MEMBER(m72_state::scanline_interrupt) | |
147 | TIMER_CALLBACK_MEMBER(m72_state::m72_scanline_interrupt) | |
139 | 148 | { |
140 | 149 | int scanline = param; |
141 | 150 | |
r245319 | r245320 | |
191 | 200 | |
192 | 201 | Protection emulation |
193 | 202 | |
203 | Currently only available for lohtb2, since this is the only game | |
204 | with a dumped 8751. | |
205 | ||
194 | 206 | The protection device does |
195 | 207 | |
196 | 208 | * provide startup code |
r245319 | r245320 | |
209 | 221 | } |
210 | 222 | |
211 | 223 | |
212 | WRITE16_MEMBER(m72_state::main_mcu_sound_w) | |
224 | WRITE16_MEMBER(m72_state::m72_main_mcu_sound_w) | |
213 | 225 | { |
214 | 226 | if (data & 0xfff0) |
215 | 227 | logerror("sound_w: %04x %04x\n", mem_mask, data); |
r245319 | r245320 | |
221 | 233 | } |
222 | 234 | } |
223 | 235 | |
224 | WRITE16_MEMBER(m72_state::main_mcu_w) | |
236 | WRITE16_MEMBER(m72_state::m72_main_mcu_w) | |
225 | 237 | { |
226 | 238 | UINT16 val = m_protection_ram[offset]; |
227 | 239 | |
r245319 | r245320 | |
243 | 255 | machine().scheduler().synchronize( timer_expired_delegate(FUNC(m72_state::delayed_ram16_w),this), (offset<<16) | val, m_protection_ram); |
244 | 256 | } |
245 | 257 | |
246 | WRITE8_MEMBER(m72_state::mcu_data_w) | |
258 | WRITE8_MEMBER(m72_state::m72_mcu_data_w) | |
247 | 259 | { |
248 | 260 | UINT16 val; |
249 | 261 | if (offset&1) val = (m_protection_ram[offset/2] & 0x00ff) | (data << 8); |
r245319 | r245320 | |
252 | 264 | machine().scheduler().synchronize( timer_expired_delegate(FUNC(m72_state::delayed_ram16_w),this), ((offset >>1 ) << 16) | val, m_protection_ram); |
253 | 265 | } |
254 | 266 | |
255 | READ8_MEMBER(m72_state::mcu_data_r) | |
267 | READ8_MEMBER(m72_state::m72_mcu_data_r) | |
256 | 268 | { |
257 | 269 | UINT8 ret; |
258 | 270 | |
r245319 | r245320 | |
267 | 279 | return ret; |
268 | 280 | } |
269 | 281 | |
270 | INTERRUPT_GEN_MEMBER(m72_state::mcu_int) | |
282 | INTERRUPT_GEN_MEMBER(m72_state::m72_mcu_int) | |
271 | 283 | { |
272 | 284 | //m_mcu_snd_cmd_latch |= 0x11; /* 0x10 is special as well - FIXME */ |
273 | 285 | m_mcu_snd_cmd_latch = 0x11;// | (machine.rand() & 1); /* 0x10 is special as well - FIXME */ |
274 | 286 | device.execute().set_input_line(1, ASSERT_LINE); |
275 | 287 | } |
276 | 288 | |
277 | READ8_MEMBER(m72_state::mcu_sample_r) | |
289 | READ8_MEMBER(m72_state::m72_mcu_sample_r) | |
278 | 290 | { |
279 | 291 | UINT8 sample; |
280 | 292 | sample = memregion("samples")->base()[m_mcu_sample_addr++]; |
281 | 293 | return sample; |
282 | 294 | } |
283 | 295 | |
284 | WRITE8_MEMBER(m72_state::mcu_ack_w) | |
296 | WRITE8_MEMBER(m72_state::m72_mcu_ack_w) | |
285 | 297 | { |
286 | 298 | m_mcu->set_input_line(1, CLEAR_LINE); |
287 | 299 | m_mcu_snd_cmd_latch = 0; |
288 | 300 | } |
289 | 301 | |
290 | READ8_MEMBER(m72_state::mcu_snd_r) | |
302 | READ8_MEMBER(m72_state::m72_mcu_snd_r) | |
291 | 303 | { |
292 | 304 | return m_mcu_snd_cmd_latch; |
293 | 305 | } |
294 | 306 | |
295 | READ8_MEMBER(m72_state::mcu_port_r) | |
307 | READ8_MEMBER(m72_state::m72_mcu_port_r) | |
296 | 308 | { |
297 | 309 | logerror("port read: %02x\n", offset); |
298 | 310 | return 0; |
299 | 311 | } |
300 | 312 | |
301 | WRITE8_MEMBER(m72_state::mcu_port_w) | |
313 | WRITE8_MEMBER(m72_state::m72_mcu_port_w) | |
302 | 314 | { |
303 | 315 | if (offset == 1) |
304 | 316 | { |
r245319 | r245320 | |
310 | 322 | |
311 | 323 | } |
312 | 324 | |
313 | WRITE8_MEMBER(m72_state::mcu_low_w) | |
325 | WRITE8_MEMBER(m72_state::m72_mcu_low_w) | |
314 | 326 | { |
315 | 327 | m_mcu_sample_addr = (m_mcu_sample_addr & 0xffe000) | (data<<5); |
316 | 328 | logerror("low: %02x %02x %08x\n", offset, data, m_mcu_sample_addr); |
317 | 329 | } |
318 | 330 | |
319 | WRITE8_MEMBER(m72_state::mcu_high_w) | |
331 | WRITE8_MEMBER(m72_state::m72_mcu_high_w) | |
320 | 332 | { |
321 | 333 | m_mcu_sample_addr = (m_mcu_sample_addr & 0x1fff) | (data<<(8+5)); |
322 | 334 | logerror("high: %02x %02x %08x\n", offset, data, m_mcu_sample_addr); |
323 | 335 | } |
324 | 336 | |
325 | RE | |
337 | WRITE8_MEMBER(m72_state::m72_snd_cpu_sample_w) | |
326 | 338 | { |
339 | //m_dac->write_signed8(data); | |
340 | m_dac->write_unsigned8(data); | |
341 | } | |
342 | ||
343 | READ8_MEMBER(m72_state::m72_snd_cpu_sample_r) | |
344 | { | |
327 | 345 | return m_mcu_sample_latch; |
328 | 346 | } |
329 | 347 | |
r245319 | r245320 | |
335 | 353 | |
336 | 354 | m_protection_ram = auto_alloc_array(machine(), UINT16, 0x10000/2); |
337 | 355 | program.install_read_bank(0xb0000, 0xbffff, "bank1"); |
338 | program.install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::main_mcu_w),this)); | |
339 | membank("bank1")->configure_entry(0, m_protection_ram); | |
340 | ||
341 | save_pointer(NAME(m_protection_ram), 0x10000/2); | |
342 | save_item(NAME(m_mcu_sample_latch)); | |
343 | save_item(NAME(m_mcu_sample_addr)); | |
344 | save_item(NAME(m_mcu_snd_cmd_latch)); | |
356 | program.install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::m72_main_mcu_w),this)); | |
357 | membank("bank1")->set_base(m_protection_ram); | |
345 | 358 | |
346 | 359 | //io.install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::loht_sample_trigger_w),this)); |
347 | io.install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::main_mcu_sound_w),this)); | |
360 | io.install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::m72_main_mcu_sound_w),this)); | |
348 | 361 | |
349 | 362 | /* sound cpu */ |
350 | sndio.install_write_handler(0x82, 0x82, 0xff, 0, write8_delegate(FUNC(dac_device::write_unsigned8),(dac_device*)m_dac)); | |
351 | sndio.install_read_handler (0x84, 0x84, 0xff, 0, read8_delegate(FUNC(m72_state::snd_cpu_sample_r),this)); | |
363 | sndio.install_write_handler(0x82, 0x82, 0xff, 0, write8_delegate(FUNC(m72_state::m72_snd_cpu_sample_w),this)); | |
364 | sndio.install_read_handler (0x84, 0x84, 0xff, 0, read8_delegate(FUNC(m72_state::m72_snd_cpu_sample_r),this)); | |
352 | 365 | |
353 | 366 | /* lohtb2 */ |
354 | 367 | #if 0 |
r245319 | r245320 | |
684 | 697 | m_maincpu->space(AS_PROGRAM).install_read_bank(0xb0000, 0xb0fff, "bank1"); |
685 | 698 | m_maincpu->space(AS_PROGRAM).install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),this)); |
686 | 699 | m_maincpu->space(AS_PROGRAM).install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::protection_w),this)); |
687 | membank("bank1")->configure_entry(0, m_protection_ram); | |
688 | ||
689 | save_pointer(NAME(m_protection_ram), 0x1000/2); | |
700 | membank("bank1")->set_base(m_protection_ram); | |
690 | 701 | } |
691 | 702 | |
692 | 703 | DRIVER_INIT_MEMBER(m72_state,bchopper) |
r245319 | r245320 | |
797 | 808 | AM_RANGE(0x00000, ROMSIZE-1) AM_ROM \ |
798 | 809 | AM_RANGE(WORKRAM, WORKRAM+0x3fff) AM_RAM /* work RAM */ \ |
799 | 810 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") \ |
800 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") \ | |
801 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") \ | |
802 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") \ | |
803 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") \ | |
811 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") \ | |
812 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") \ | |
813 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") \ | |
814 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") \ | |
804 | 815 | AM_RANGE(0xe0000, 0xeffff) AM_READWRITE(soundram_r, soundram_w) \ |
805 | 816 | AM_RANGE(0xffff0, 0xfffff) AM_ROM \ |
806 | 817 | ADDRESS_MAP_END |
r245319 | r245320 | |
817 | 828 | AM_RANGE(0x9c000, 0x9ffff) AM_RAM /* work RAM */ |
818 | 829 | AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */ |
819 | 830 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
820 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
821 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
822 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
823 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") | |
831 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
832 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
833 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
834 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") | |
824 | 835 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
825 | 836 | ADDRESS_MAP_END |
826 | 837 | |
r245319 | r245320 | |
829 | 840 | AM_RANGE(0x88000, 0x8bfff) AM_RAM /* work RAM */ |
830 | 841 | AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */ |
831 | 842 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
832 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
833 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
834 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
835 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") | |
843 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
844 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
845 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
846 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") | |
836 | 847 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
837 | 848 | ADDRESS_MAP_END |
838 | 849 | |
839 | 850 | static ADDRESS_MAP_START( rtype2_map, AS_PROGRAM, 16, m72_state ) |
840 | 851 | AM_RANGE(0x00000, 0x7ffff) AM_ROM |
841 | AM_RANGE(0xb0000, 0xb0001) AM_WRITE(irq_line_w) | |
842 | AM_RANGE(0xbc000, 0xbc001) AM_WRITE(dmaon_w) | |
852 | AM_RANGE(0xb0000, 0xb0001) AM_WRITE(m72_irq_line_w) | |
853 | AM_RANGE(0xbc000, 0xbc001) AM_WRITE(m72_dmaon_w) | |
843 | 854 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
844 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
845 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
846 | AM_RANGE(0xd4000, 0xd7fff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") | |
847 | AM_RANGE(0xd8000, 0xd8bff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
855 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
856 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
857 | AM_RANGE(0xd4000, 0xd7fff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") | |
858 | AM_RANGE(0xd8000, 0xd8bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
848 | 859 | AM_RANGE(0xe0000, 0xe3fff) AM_RAM /* work RAM */ |
849 | 860 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
850 | 861 | ADDRESS_MAP_END |
r245319 | r245320 | |
852 | 863 | static ADDRESS_MAP_START( majtitle_map, AS_PROGRAM, 16, m72_state ) |
853 | 864 | AM_RANGE(0x00000, 0x7ffff) AM_ROM |
854 | 865 | AM_RANGE(0xa0000, 0xa03ff) AM_RAM AM_SHARE("majtitle_rowscr") |
855 | AM_RANGE(0xa4000, 0xa4bff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
856 | AM_RANGE(0xac000, 0xaffff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
857 | AM_RANGE(0xb0000, 0xbffff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") /* larger than the other games */ | |
866 | AM_RANGE(0xa4000, 0xa4bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
867 | AM_RANGE(0xac000, 0xaffff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
868 | AM_RANGE(0xb0000, 0xbffff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") /* larger than the other games */ | |
858 | 869 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
859 | 870 | AM_RANGE(0xc8000, 0xc83ff) AM_RAM AM_SHARE("spriteram2") |
860 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
871 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
861 | 872 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM /* work RAM */ |
862 | AM_RANGE(0xe0000, 0xe0001) AM_WRITE(irq_line_w) | |
873 | AM_RANGE(0xe0000, 0xe0001) AM_WRITE(m72_irq_line_w) | |
863 | 874 | AM_RANGE(0xe4000, 0xe4001) AM_WRITEONLY /* playfield enable? 1 during screen transitions, 0 otherwise */ |
864 | AM_RANGE(0xec000, 0xec001) AM_WRITE(dmaon_w) | |
875 | AM_RANGE(0xec000, 0xec001) AM_WRITE(m72_dmaon_w) | |
865 | 876 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
866 | 877 | ADDRESS_MAP_END |
867 | 878 | |
r245319 | r245320 | |
870 | 881 | AM_RANGE(0xa0000, 0xa3fff) AM_RAM /* work RAM */ |
871 | 882 | AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */ |
872 | 883 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
873 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
874 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
875 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
876 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") | |
884 | AM_RANGE(0xc8000, 0xc8bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
885 | AM_RANGE(0xcc000, 0xccbff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
886 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
887 | AM_RANGE(0xd8000, 0xdbfff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") | |
877 | 888 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
878 | 889 | ADDRESS_MAP_END |
879 | 890 | |
880 | 891 | static ADDRESS_MAP_START( hharryu_map, AS_PROGRAM, 16, m72_state ) |
881 | 892 | AM_RANGE(0x00000, 0x7ffff) AM_ROM |
882 | AM_RANGE(0xa0000, 0xa0bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
883 | AM_RANGE(0xa8000, 0xa8bff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
884 | AM_RANGE(0xb0000, 0xb0001) AM_WRITE(irq_line_w) | |
885 | AM_RANGE(0xbc000, 0xbc001) AM_WRITE(dmaon_w) | |
893 | AM_RANGE(0xa0000, 0xa0bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
894 | AM_RANGE(0xa8000, 0xa8bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
895 | AM_RANGE(0xb0000, 0xb0001) AM_WRITE(m72_irq_line_w) | |
896 | AM_RANGE(0xbc000, 0xbc001) AM_WRITE(m72_dmaon_w) | |
886 | 897 | AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */ |
887 | 898 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
888 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
889 | AM_RANGE(0xd4000, 0xd7fff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") | |
899 | AM_RANGE(0xd0000, 0xd3fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
900 | AM_RANGE(0xd4000, 0xd7fff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") | |
890 | 901 | AM_RANGE(0xe0000, 0xe3fff) AM_RAM /* work RAM */ |
891 | 902 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
892 | 903 | ADDRESS_MAP_END |
893 | 904 | |
894 | 905 | static ADDRESS_MAP_START( kengo_map, AS_PROGRAM, 16, m72_state ) |
895 | 906 | AM_RANGE(0x00000, 0x7ffff) AM_ROM |
896 | AM_RANGE(0xa0000, 0xa0bff) AM_READWRITE(palette1_r, palette1_w) AM_SHARE("paletteram") | |
897 | AM_RANGE(0xa8000, 0xa8bff) AM_READWRITE(palette2_r, palette2_w) AM_SHARE("paletteram2") | |
898 | AM_RANGE(0xb0000, 0xb0001) AM_WRITE(irq_line_w) | |
907 | AM_RANGE(0xa0000, 0xa0bff) AM_READWRITE(m72_palette1_r, m72_palette1_w) AM_SHARE("paletteram") | |
908 | AM_RANGE(0xa8000, 0xa8bff) AM_READWRITE(m72_palette2_r, m72_palette2_w) AM_SHARE("paletteram2") | |
909 | AM_RANGE(0xb0000, 0xb0001) AM_WRITE(m72_irq_line_w) | |
899 | 910 | AM_RANGE(0xb4000, 0xb4001) AM_WRITENOP /* ??? */ |
900 | AM_RANGE(0xbc000, 0xbc001) AM_WRITE(dmaon_w) | |
911 | AM_RANGE(0xbc000, 0xbc001) AM_WRITE(m72_dmaon_w) | |
901 | 912 | AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram") |
902 | AM_RANGE(0x80000, 0x83fff) AM_RAM_WRITE(videoram1_w) AM_SHARE("videoram1") | |
903 | AM_RANGE(0x84000, 0x87fff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") | |
913 | AM_RANGE(0x80000, 0x83fff) AM_RAM_WRITE(m72_videoram1_w) AM_SHARE("videoram1") | |
914 | AM_RANGE(0x84000, 0x87fff) AM_RAM_WRITE(m72_videoram2_w) AM_SHARE("videoram2") | |
904 | 915 | AM_RANGE(0xe0000, 0xe3fff) AM_RAM /* work RAM */ |
905 | 916 | AM_RANGE(0xffff0, 0xfffff) AM_ROM |
906 | 917 | ADDRESS_MAP_END |
r245319 | r245320 | |
910 | 921 | AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1") |
911 | 922 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
912 | 923 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w) |
913 | AM_RANGE(0x02, 0x03) AM_WRITE(port02_w) /* coin counters, reset sound cpu, other stuff? */ | |
914 | AM_RANGE(0x04, 0x05) AM_WRITE(dmaon_w) | |
915 | AM_RANGE(0x06, 0x07) AM_WRITE(irq_line_w) | |
924 | AM_RANGE(0x02, 0x03) AM_WRITE(m72_port02_w) /* coin counters, reset sound cpu, other stuff? */ | |
925 | AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w) | |
926 | AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w) | |
916 | 927 | //AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
917 | AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w) | |
918 | AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w) | |
919 | AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w) | |
920 | AM_RANGE(0x86, 0x87) AM_WRITE(scrollx2_w) | |
928 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) | |
929 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) | |
930 | AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w) | |
931 | AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w) | |
921 | 932 | /* { 0xc0, 0xc0 trigger sample, filled by init_ function */ |
922 | 933 | ADDRESS_MAP_END |
923 | 934 | |
r245319 | r245320 | |
928 | 939 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w) |
929 | 940 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
930 | 941 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
931 | AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w) | |
932 | AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w) | |
933 | AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w) | |
934 | AM_RANGE(0x86, 0x87) AM_WRITE(scrollx2_w) | |
942 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) | |
943 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) | |
944 | AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w) | |
945 | AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w) | |
935 | 946 | ADDRESS_MAP_END |
936 | 947 | |
937 | 948 | static ADDRESS_MAP_START( poundfor_portmap, AS_IO, 16, m72_state ) |
r245319 | r245320 | |
941 | 952 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w) |
942 | 953 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
943 | 954 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
944 | AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w) | |
945 | AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w) | |
946 | AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w) | |
947 | AM_RANGE(0x86, 0x87) AM_WRITE(scrollx2_w) | |
955 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) | |
956 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) | |
957 | AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w) | |
958 | AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w) | |
948 | 959 | ADDRESS_MAP_END |
949 | 960 | |
950 | 961 | static ADDRESS_MAP_START( majtitle_portmap, AS_IO, 16, m72_state ) |
r245319 | r245320 | |
954 | 965 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w) |
955 | 966 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
956 | 967 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
957 | AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w) | |
958 | AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w) | |
959 | AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w) | |
960 | AM_RANGE(0x86, 0x87) AM_WRITE(scrollx2_w) | |
968 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) | |
969 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) | |
970 | AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w) | |
971 | AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w) | |
961 | 972 | AM_RANGE(0x8e, 0x8f) AM_WRITE(majtitle_gfx_ctrl_w) |
962 | 973 | ADDRESS_MAP_END |
963 | 974 | |
r245319 | r245320 | |
967 | 978 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
968 | 979 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w) |
969 | 980 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) /* coin counters, reset sound cpu, other stuff? */ |
970 | AM_RANGE(0x04, 0x05) AM_WRITE(dmaon_w) | |
971 | AM_RANGE(0x06, 0x07) AM_WRITE(irq_line_w) | |
981 | AM_RANGE(0x04, 0x05) AM_WRITE(m72_dmaon_w) | |
982 | AM_RANGE(0x06, 0x07) AM_WRITE(m72_irq_line_w) | |
972 | 983 | AM_RANGE(0x40, 0x43) AM_WRITENOP /* Interrupt controller, only written to at bootup */ |
973 | AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w) | |
974 | AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w) | |
975 | AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w) | |
976 | AM_RANGE(0x86, 0x87) AM_WRITE(scrollx2_w) | |
984 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) | |
985 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) | |
986 | AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w) | |
987 | AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w) | |
977 | 988 | ADDRESS_MAP_END |
978 | 989 | |
979 | 990 | static ADDRESS_MAP_START( kengo_portmap, AS_IO, 16, m72_state ) |
r245319 | r245320 | |
982 | 993 | AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW") |
983 | 994 | AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w) |
984 | 995 | AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w) |
985 | AM_RANGE(0x80, 0x81) AM_WRITE(scrolly1_w) | |
986 | AM_RANGE(0x82, 0x83) AM_WRITE(scrollx1_w) | |
987 | AM_RANGE(0x84, 0x85) AM_WRITE(scrolly2_w) | |
988 | AM_RANGE(0x86, 0x87) AM_WRITE(scrollx2_w) | |
996 | AM_RANGE(0x80, 0x81) AM_WRITE(m72_scrolly1_w) | |
997 | AM_RANGE(0x82, 0x83) AM_WRITE(m72_scrollx1_w) | |
998 | AM_RANGE(0x84, 0x85) AM_WRITE(m72_scrolly2_w) | |
999 | AM_RANGE(0x86, 0x87) AM_WRITE(m72_scrollx2_w) | |
989 | 1000 | // AM_RANGE(0x8c, 0x8f) AM_WRITENOP /* ??? */ |
990 | 1001 | ADDRESS_MAP_END |
991 | 1002 | |
r245319 | r245320 | |
1037 | 1048 | |
1038 | 1049 | static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, m72_state ) |
1039 | 1050 | /* External access */ |
1040 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(mcu_sample_r, mcu_low_w) | |
1041 | AM_RANGE(0x0001, 0x0001) AM_WRITE(mcu_high_w) | |
1042 | AM_RANGE(0x0002, 0x0002) AM_READWRITE(mcu_snd_r, mcu_ack_w) | |
1051 | AM_RANGE(0x0000, 0x0000) AM_READWRITE(m72_mcu_sample_r, m72_mcu_low_w) | |
1052 | AM_RANGE(0x0001, 0x0001) AM_WRITE(m72_mcu_high_w) | |
1053 | AM_RANGE(0x0002, 0x0002) AM_READWRITE(m72_mcu_snd_r, m72_mcu_ack_w) | |
1043 | 1054 | /* shared at b0000 - b0fff on the main cpu */ |
1044 | AM_RANGE(0xc000, 0xcfff) AM_READWRITE(mcu_data_r,mcu_data_w ) | |
1055 | AM_RANGE(0xc000, 0xcfff) AM_READWRITE(m72_mcu_data_r,m72_mcu_data_w ) | |
1045 | 1056 | |
1046 | 1057 | /* Ports */ |
1047 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(mcu_port_r, mcu_port_w) | |
1058 | AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(m72_mcu_port_r, m72_mcu_port_w) | |
1048 | 1059 | ADDRESS_MAP_END |
1049 | 1060 | |
1050 | 1061 | #define COIN_MODE_1 \ |
r245319 | r245320 | |
1782 | 1793 | |
1783 | 1794 | MCFG_SCREEN_ADD("screen", RASTER) |
1784 | 1795 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
1785 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
1796 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
1786 | 1797 | MCFG_SCREEN_PALETTE("palette") |
1787 | 1798 | |
1788 | 1799 | MCFG_VIDEO_START_OVERRIDE(m72_state,m72) |
r245319 | r245320 | |
1800 | 1811 | |
1801 | 1812 | MCFG_CPU_ADD("mcu",I8751, XTAL_8MHz) /* Uses its own XTAL */ |
1802 | 1813 | MCFG_CPU_IO_MAP(mcu_io_map) |
1803 | MCFG_CPU_VBLANK_INT_DRIVER("screen", m72_state, mcu_int) | |
1814 | MCFG_CPU_VBLANK_INT_DRIVER("screen", m72_state, m72_mcu_int) | |
1804 | 1815 | |
1805 | 1816 | MACHINE_CONFIG_END |
1806 | 1817 | |
r245319 | r245320 | |
1915 | 1926 | |
1916 | 1927 | MCFG_SCREEN_ADD("screen", RASTER) |
1917 | 1928 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
1918 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
1929 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
1919 | 1930 | MCFG_SCREEN_PALETTE("palette") |
1920 | 1931 | |
1921 | 1932 | MCFG_VIDEO_START_OVERRIDE(m72_state,rtype2) |
r245319 | r245320 | |
1946 | 1957 | |
1947 | 1958 | MCFG_SCREEN_ADD("screen", RASTER) |
1948 | 1959 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
1949 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
1960 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
1950 | 1961 | MCFG_SCREEN_PALETTE("palette") |
1951 | 1962 | |
1952 | 1963 | MCFG_VIDEO_START_OVERRIDE(m72_state,hharry) |
r245319 | r245320 | |
1977 | 1988 | |
1978 | 1989 | MCFG_SCREEN_ADD("screen", RASTER) |
1979 | 1990 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
1980 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
1991 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
1981 | 1992 | MCFG_SCREEN_PALETTE("palette") |
1982 | 1993 | |
1983 | 1994 | MCFG_VIDEO_START_OVERRIDE(m72_state,hharry) |
r245319 | r245320 | |
2009 | 2020 | |
2010 | 2021 | MCFG_SCREEN_ADD("screen", RASTER) |
2011 | 2022 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
2012 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
2023 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
2013 | 2024 | MCFG_SCREEN_PALETTE("palette") |
2014 | 2025 | |
2015 | 2026 | MCFG_VIDEO_START_OVERRIDE(m72_state,hharryu) |
r245319 | r245320 | |
2038 | 2049 | |
2039 | 2050 | MCFG_SCREEN_ADD("screen", RASTER) |
2040 | 2051 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
2041 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
2052 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
2042 | 2053 | MCFG_SCREEN_PALETTE("palette") |
2043 | 2054 | |
2044 | 2055 | MCFG_VIDEO_START_OVERRIDE(m72_state,poundfor) |
r245319 | r245320 | |
2069 | 2080 | |
2070 | 2081 | MCFG_SCREEN_ADD("screen", RASTER) |
2071 | 2082 | MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256) |
2072 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update) | |
2083 | MCFG_SCREEN_UPDATE_DRIVER(m72_state, screen_update_m72) | |
2073 | 2084 | MCFG_SCREEN_PALETTE("palette") |
2074 | 2085 | |
2075 | 2086 | MCFG_VIDEO_START_OVERRIDE(m72_state,poundfor) |
r245319 | r245320 | |
3491 | 3502 | // the program roms failing their tests. This is why we still have simulation code for many games |
3492 | 3503 | // despite having Japanese version MCU roms for several of them. See notes next to the sets |
3493 | 3504 | |
3494 | GAME( 1987, rtype, 0, rtype, rtype, driver_device, 0, ROT0, "Irem", "R-Type (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3495 | GAME( 1987, rtypej, rtype, rtype, rtype, driver_device, 0, ROT0, "Irem", "R-Type (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3496 | GAME( 1987, rtypejp, rtype, rtype, rtypep, driver_device, 0, ROT0, "Irem", "R-Type (Japan prototype)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3497 | GAME( 1987, rtypeu, rtype, rtype, rtype, driver_device, 0, ROT0, "Irem (Nintendo of America license)", "R-Type (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3498 | GAME( 1987, rtypeb, rtype, rtype, rtype, driver_device, 0, ROT0, "bootleg", "R-Type (World bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3505 | GAME( 1987, rtype, 0, rtype, rtype, driver_device, 0, ROT0, "Irem", "R-Type (World)", GAME_NO_COCKTAIL ) | |
3506 | GAME( 1987, rtypej, rtype, rtype, rtype, driver_device, 0, ROT0, "Irem", "R-Type (Japan)", GAME_NO_COCKTAIL ) | |
3507 | GAME( 1987, rtypejp, rtype, rtype, rtypep, driver_device, 0, ROT0, "Irem", "R-Type (Japan prototype)", GAME_NO_COCKTAIL ) | |
3508 | GAME( 1987, rtypeu, rtype, rtype, rtype, driver_device, 0, ROT0, "Irem (Nintendo of America license)", "R-Type (US)", GAME_NO_COCKTAIL ) | |
3509 | GAME( 1987, rtypeb, rtype, rtype, rtype, driver_device, 0, ROT0, "bootleg", "R-Type (World bootleg)", GAME_NO_COCKTAIL ) | |
3499 | 3510 | |
3500 | GAME( 1987, bchopper, 0, m72, bchopper, m72_state, bchopper, ROT0, "Irem", "Battle Chopper", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3501 | GAME( 1987, mrheli, bchopper, m72_8751, bchopper, m72_state, m72_8751, ROT0, "Irem", "Mr. HELI no Daibouken (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3511 | GAME( 1987, bchopper, 0, m72, bchopper, m72_state, bchopper, ROT0, "Irem", "Battle Chopper", GAME_NO_COCKTAIL ) | |
3512 | GAME( 1987, mrheli, bchopper, m72_8751, bchopper, m72_state, m72_8751, ROT0, "Irem", "Mr. HELI no Daibouken (Japan)", GAME_NO_COCKTAIL ) | |
3502 | 3513 | |
3503 | GAME( 1988, nspirit, 0, m72, nspirit, m72_state, nspirit, ROT0, "Irem", "Ninja Spirit", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // doesn't wait / check for japan warning string.. fails rom check if used with japanese mcu rom (World version?) | |
3504 | GAME( 1988, nspiritj, nspirit, m72_8751, nspirit, m72_state, m72_8751, ROT0, "Irem", "Saigo no Nindou (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // waits for japan warning screen, works with our mcu dump, corrupt warning screen due to priority / mixing errors (Japan Version) | |
3514 | GAME( 1988, nspirit, 0, m72, nspirit, m72_state, nspirit, ROT0, "Irem", "Ninja Spirit", GAME_NO_COCKTAIL ) // doesn't wait / check for japan warning string.. fails rom check if used with japanese mcu rom (World version?) | |
3515 | GAME( 1988, nspiritj, nspirit, m72_8751, nspirit, m72_state, m72_8751, ROT0, "Irem", "Saigo no Nindou (Japan)", GAME_NO_COCKTAIL ) // waits for japan warning screen, works with our mcu dump, corrupt warning screen due to priority / mixing errors (Japan Version) | |
3505 | 3516 | |
3506 | GAME( 1988, imgfight, 0, m72, imgfight, m72_state, imgfight, ROT270, "Irem", "Image Fight (World, revision A)", GAME_SUPPORTS_SAVE ) // doesn't wait / check for japan warning string.. fails rom check if used with japanese mcu rom (World version?) | |
3507 | GAME( 1988, imgfightj, imgfight, m72_8751, imgfight, m72_state, m72_8751, ROT270, "Irem", "Image Fight (Japan)", GAME_SUPPORTS_SAVE ) // waits for japan warning screen, works with our mcu dump, can't actually see warning screen due to priority / mixing errors, check tilemap viewer (Japan Version) | |
3517 | GAME( 1988, imgfight, 0, m72, imgfight, m72_state, imgfight, ROT270, "Irem", "Image Fight (World, revision A)", 0 ) // doesn't wait / check for japan warning string.. fails rom check if used with japanese mcu rom (World version?) | |
3518 | GAME( 1988, imgfightj, imgfight, m72_8751, imgfight, m72_state, m72_8751, ROT270, "Irem", "Image Fight (Japan)", 0 ) // waits for japan warning screen, works with our mcu dump, can't actually see warning screen due to priority / mixing errors, check tilemap viewer (Japan Version) | |
3508 | 3519 | |
3509 | GAME( 1989, loht, 0, m72, loht, m72_state, loht, ROT0, "Irem", "Legend of Hero Tonma", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // fails rom check if used with Japan MCU rom (World version?) | |
3510 | GAME( 1989, lohtj, loht, m72_8751, loht, m72_state, m72_8751, ROT0, "Irem", "Legend of Hero Tonma (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // waits for japan warning screen, works with our mcu dump (Japan Version) | |
3511 | GAME( 1989, lohtb2, loht, m72_8751, loht, m72_state, m72_8751, ROT0, "bootleg", "Legend of Hero Tonma (Japan, bootleg with i8751)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) // works like above, mcu code is the same as the real code, probably just an alt revision on a bootleg board | |
3512 | GAME( 1989, lohtb, loht, m72, loht, driver_device, 0, ROT0, "bootleg", "Legend of Hero Tonma (unprotected bootleg)", GAME_NOT_WORKING| GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3520 | GAME( 1989, loht, 0, m72, loht, m72_state, loht, ROT0, "Irem", "Legend of Hero Tonma", GAME_NO_COCKTAIL ) // fails rom check if used with Japan MCU rom (World version?) | |
3521 | GAME( 1989, lohtj, loht, m72_8751, loht, m72_state, m72_8751, ROT0, "Irem", "Legend of Hero Tonma (Japan)", GAME_NO_COCKTAIL ) // waits for japan warning screen, works with our mcu dump (Japan Version) | |
3522 | GAME( 1989, lohtb2, loht, m72_8751, loht, m72_state, m72_8751, ROT0, "bootleg", "Legend of Hero Tonma (Japan, bootleg with i8751)", GAME_NO_COCKTAIL ) // works like above, mcu code is the same as the real code, probably just an alt revision on a bootleg board | |
3523 | GAME( 1989, lohtb, loht, m72, loht, driver_device, 0, ROT0, "bootleg", "Legend of Hero Tonma (unprotected bootleg)", GAME_NOT_WORKING| GAME_NO_COCKTAIL ) | |
3513 | 3524 | |
3514 | GAME( 1989, xmultipl, 0, xmultipl, xmultipl, driver_device, 0, ROT0, "Irem", "X Multiply (World, M81)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3515 | GAME( 1989, xmultiplm72, xmultipl, xmultiplm72, xmultipl, m72_state, m72_8751, ROT0, "Irem", "X Multiply (Japan, M72)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3525 | GAME( 1989, xmultipl, 0, xmultipl, xmultipl, driver_device, 0, ROT0, "Irem", "X Multiply (World, M81)", GAME_NO_COCKTAIL ) | |
3526 | GAME( 1989, xmultiplm72, xmultipl, xmultiplm72, xmultipl, m72_state, m72_8751, ROT0, "Irem", "X Multiply (Japan, M72)", GAME_NO_COCKTAIL ) | |
3516 | 3527 | |
3517 | GAME( 1989, dbreed, 0, dbreed, dbreed, driver_device, 0, ROT0, "Irem", "Dragon Breed (M81 PCB version)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3518 | GAME( 1989, dbreedm72, dbreed, dbreedm72, dbreed, m72_state, dbreedm72, ROT0, "Irem", "Dragon Breed (M72 PCB version)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3528 | GAME( 1989, dbreed, 0, dbreed, dbreed, driver_device, 0, ROT0, "Irem", "Dragon Breed (M81 PCB version)", GAME_NO_COCKTAIL ) | |
3529 | GAME( 1989, dbreedm72, dbreed, dbreedm72, dbreed, m72_state, dbreedm72, ROT0, "Irem", "Dragon Breed (M72 PCB version)", GAME_NO_COCKTAIL ) | |
3519 | 3530 | |
3520 | GAME( 1989, rtype2, 0, rtype2, rtype2, driver_device, 0, ROT0, "Irem", "R-Type II", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3521 | GAME( 1989, rtype2j, rtype2, rtype2, rtype2, driver_device, 0, ROT0, "Irem", "R-Type II (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3522 | GAME( 1989, rtype2jc, rtype2, rtype2, rtype2, driver_device, 0, ROT0, "Irem", "R-Type II (Japan, revision C)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3531 | GAME( 1989, rtype2, 0, rtype2, rtype2, driver_device, 0, ROT0, "Irem", "R-Type II", GAME_NO_COCKTAIL ) | |
3532 | GAME( 1989, rtype2j, rtype2, rtype2, rtype2, driver_device, 0, ROT0, "Irem", "R-Type II (Japan)", GAME_NO_COCKTAIL ) | |
3533 | GAME( 1989, rtype2jc, rtype2, rtype2, rtype2, driver_device, 0, ROT0, "Irem", "R-Type II (Japan, revision C)", GAME_NO_COCKTAIL ) | |
3523 | 3534 | |
3524 | GAME( 1990, majtitle, 0, majtitle, rtype2, driver_device, 0, ROT0, "Irem", "Major Title (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3525 | GAME( 1990, majtitlej, majtitle, majtitle, rtype2, driver_device, 0, ROT0, "Irem", "Major Title (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3535 | GAME( 1990, majtitle, 0, majtitle, rtype2, driver_device, 0, ROT0, "Irem", "Major Title (World)", GAME_NO_COCKTAIL ) | |
3536 | GAME( 1990, majtitlej, majtitle, majtitle, rtype2, driver_device, 0, ROT0, "Irem", "Major Title (Japan)", GAME_NO_COCKTAIL ) | |
3526 | 3537 | |
3527 | GAME( 1990, hharry, 0, hharry, hharry, driver_device, 0, ROT0, "Irem", "Hammerin' Harry (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3528 | GAME( 1990, hharryu, hharry, hharryu, hharry, driver_device, 0, ROT0, "Irem America", "Hammerin' Harry (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3529 | GAME( 1990, dkgensan, hharry, hharryu, hharry, driver_device, 0, ROT0, "Irem", "Daiku no Gensan (Japan, M82)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3530 | GAME( 1990, dkgensanm72, hharry, dkgenm72, hharry, m72_state, dkgenm72, ROT0, "Irem", "Daiku no Gensan (Japan, M72)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3538 | GAME( 1990, hharry, 0, hharry, hharry, driver_device, 0, ROT0, "Irem", "Hammerin' Harry (World)", GAME_NO_COCKTAIL ) | |
3539 | GAME( 1990, hharryu, hharry, hharryu, hharry, driver_device, 0, ROT0, "Irem America", "Hammerin' Harry (US)", GAME_NO_COCKTAIL ) | |
3540 | GAME( 1990, dkgensan, hharry, hharryu, hharry, driver_device, 0, ROT0, "Irem", "Daiku no Gensan (Japan, M82)", GAME_NO_COCKTAIL ) | |
3541 | GAME( 1990, dkgensanm72, hharry, dkgenm72, hharry, m72_state, dkgenm72, ROT0, "Irem", "Daiku no Gensan (Japan, M72)", GAME_NO_COCKTAIL ) | |
3531 | 3542 | |
3532 | GAME( 1990, poundfor, 0, poundfor, poundfor, driver_device, 0, ROT270, "Irem", "Pound for Pound (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3533 | GAME( 1990, poundforj, poundfor, poundfor, poundfor, driver_device, 0, ROT270, "Irem", "Pound for Pound (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3534 | GAME( 1990, poundforu, poundfor, poundfor, poundfor, driver_device, 0, ROT270, "Irem America", "Pound for Pound (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3543 | GAME( 1990, poundfor, 0, poundfor, poundfor, driver_device, 0, ROT270, "Irem", "Pound for Pound (World)", GAME_NO_COCKTAIL ) | |
3544 | GAME( 1990, poundforj, poundfor, poundfor, poundfor, driver_device, 0, ROT270, "Irem", "Pound for Pound (Japan)", GAME_NO_COCKTAIL ) | |
3545 | GAME( 1990, poundforu, poundfor, poundfor, poundfor, driver_device, 0, ROT270, "Irem America", "Pound for Pound (US)", GAME_NO_COCKTAIL ) | |
3535 | 3546 | |
3536 | GAME( 1990, airduel, 0, m72, airduel, m72_state, airduel, ROT270, "Irem", "Air Duel (Japan)", | |
3547 | GAME( 1990, airduel, 0, m72, airduel, m72_state, airduel, ROT270, "Irem", "Air Duel (Japan)", 0 ) | |
3537 | 3548 | |
3538 | GAME( 1991, cosmccop, 0, cosmccop, gallop, driver_device, 0, ROT0, "Irem", "Cosmic Cop (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3539 | GAME( 1991, gallop, cosmccop, m72, gallop, m72_state, gallop, ROT0, "Irem", "Gallop - Armed Police Unit (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) | |
3549 | GAME( 1991, cosmccop, 0, cosmccop, gallop, driver_device, 0, ROT0, "Irem", "Cosmic Cop (World)", GAME_NO_COCKTAIL ) | |
3550 | GAME( 1991, gallop, cosmccop, m72, gallop, m72_state, gallop, ROT0, "Irem", "Gallop - Armed Police Unit (Japan)", GAME_NO_COCKTAIL ) | |
3540 | 3551 | |
3541 | GAME( 1991, kengo, 0, kengo, kengo, driver_device, 0, ROT0, "Irem", "Ken-Go", GAME_NO_COCKTAIL | |
3552 | GAME( 1991, kengo, 0, kengo, kengo, driver_device, 0, ROT0, "Irem", "Ken-Go", GAME_NO_COCKTAIL ) |
r245319 | r245320 | |
---|---|---|
11 | 11 | public: |
12 | 12 | m72_state(const machine_config &mconfig, device_type type, const char *tag) |
13 | 13 | : driver_device(mconfig, type, tag), |
14 | m_spriteram(*this, "spriteram"), | |
15 | m_videoram1(*this, "videoram1"), | |
16 | m_videoram2(*this, "videoram2"), | |
17 | m_majtitle_rowscrollram(*this, "majtitle_rowscr"), | |
18 | m_spriteram2(*this, "spriteram2"), | |
19 | m_soundram(*this, "soundram"), | |
14 | 20 | m_maincpu(*this, "maincpu"), |
15 | 21 | m_soundcpu(*this, "soundcpu"), |
16 | 22 | m_mcu(*this, "mcu"), |
r245319 | r245320 | |
19 | 25 | m_gfxdecode(*this, "gfxdecode"), |
20 | 26 | m_screen(*this, "screen"), |
21 | 27 | m_palette(*this, "palette"), |
22 | m_spriteram(*this, "spriteram"), | |
23 | m_videoram1(*this, "videoram1"), | |
24 | m_videoram2(*this, "videoram2"), | |
25 | m_majtitle_rowscrollram(*this, "majtitle_rowscr"), | |
26 | m_spriteram2(*this, "spriteram2"), | |
27 | m_soundram(*this, "soundram"), | |
28 | 28 | m_generic_paletteram_16(*this, "paletteram"), |
29 | 29 | m_generic_paletteram2_16(*this, "paletteram2") { } |
30 | 30 | |
31 | required_shared_ptr<UINT16> m_spriteram; | |
32 | required_shared_ptr<UINT16> m_videoram1; | |
33 | required_shared_ptr<UINT16> m_videoram2; | |
34 | optional_shared_ptr<UINT16> m_majtitle_rowscrollram; | |
35 | optional_shared_ptr<UINT16> m_spriteram2; | |
36 | optional_shared_ptr<UINT8> m_soundram; | |
37 | ||
31 | 38 | required_device<cpu_device> m_maincpu; |
32 | 39 | required_device<cpu_device> m_soundcpu; |
33 | 40 | optional_device<cpu_device> m_mcu; |
r245319 | r245320 | |
36 | 43 | required_device<gfxdecode_device> m_gfxdecode; |
37 | 44 | required_device<screen_device> m_screen; |
38 | 45 | required_device<palette_device> m_palette; |
39 | ||
40 | required_shared_ptr<UINT16> m_spriteram; | |
41 | required_shared_ptr<UINT16> m_videoram1; | |
42 | required_shared_ptr<UINT16> m_videoram2; | |
43 | optional_shared_ptr<UINT16> m_majtitle_rowscrollram; | |
44 | optional_shared_ptr<UINT16> m_spriteram2; | |
45 | optional_shared_ptr<UINT8> m_soundram; | |
46 | 46 | required_shared_ptr<UINT16> m_generic_paletteram_16; |
47 | 47 | required_shared_ptr<UINT16> m_generic_paletteram2_16; |
48 | 48 | |
49 | 49 | UINT16 *m_protection_ram; |
50 | 50 | emu_timer *m_scanline_timer; |
51 | 51 | UINT8 m_irq_base; |
52 | UINT8 m_mcu_snd_cmd_latch; | |
53 | UINT8 m_mcu_sample_latch; | |
54 | UINT32 m_mcu_sample_addr; | |
52 | 55 | const UINT8 *m_protection_code; |
53 | 56 | const UINT8 *m_protection_crc; |
57 | int m_prev[4]; | |
58 | int m_diff[4]; | |
54 | 59 | UINT32 m_raster_irq_position; |
55 | 60 | UINT16 *m_buffered_spriteram; |
56 | 61 | tilemap_t *m_fg_tilemap; |
r245319 | r245320 | |
60 | 65 | INT32 m_scrollx2; |
61 | 66 | INT32 m_scrolly2; |
62 | 67 | INT32 m_video_off; |
63 | ||
64 | //poundfor specific | |
65 | int m_prev[4]; | |
66 | int m_diff[4]; | |
67 | ||
68 | // majtitle specific | |
69 | 68 | int m_majtitle_rowscroll; |
70 | ||
71 | // m72_i8751 specific | |
72 | UINT8 m_mcu_snd_cmd_latch; | |
73 | UINT8 m_mcu_sample_latch; | |
74 | UINT32 m_mcu_sample_addr; | |
75 | ||
76 | // common | |
77 | DECLARE_READ16_MEMBER(palette1_r); | |
78 | DECLARE_READ16_MEMBER(palette2_r); | |
79 | DECLARE_WRITE16_MEMBER(palette1_w); | |
80 | DECLARE_WRITE16_MEMBER(palette2_w); | |
81 | DECLARE_WRITE16_MEMBER(videoram1_w); | |
82 | DECLARE_WRITE16_MEMBER(videoram2_w); | |
83 | DECLARE_READ16_MEMBER(soundram_r); | |
84 | DECLARE_WRITE16_MEMBER(soundram_w); | |
85 | ||
86 | // m72_i8751 specific | |
87 | DECLARE_WRITE16_MEMBER(main_mcu_sound_w); | |
88 | DECLARE_WRITE16_MEMBER(main_mcu_w); | |
89 | DECLARE_WRITE8_MEMBER(mcu_data_w); | |
90 | DECLARE_READ8_MEMBER(mcu_data_r); | |
91 | DECLARE_READ8_MEMBER(mcu_sample_r); | |
92 | DECLARE_WRITE8_MEMBER(mcu_ack_w); | |
93 | DECLARE_READ8_MEMBER(mcu_snd_r); | |
94 | DECLARE_READ8_MEMBER(mcu_port_r); | |
95 | DECLARE_WRITE8_MEMBER(mcu_port_w); | |
96 | DECLARE_WRITE8_MEMBER(mcu_low_w); | |
97 | DECLARE_WRITE8_MEMBER(mcu_high_w); | |
98 | DECLARE_READ8_MEMBER(snd_cpu_sample_r); | |
99 | DECLARE_WRITE16_MEMBER(irq_line_w); | |
100 | DECLARE_WRITE16_MEMBER(scrollx1_w); | |
101 | DECLARE_WRITE16_MEMBER(scrollx2_w); | |
102 | DECLARE_WRITE16_MEMBER(scrolly1_w); | |
103 | DECLARE_WRITE16_MEMBER(scrolly2_w); | |
104 | DECLARE_WRITE16_MEMBER(dmaon_w); | |
105 | DECLARE_WRITE16_MEMBER(port02_w); | |
106 | DECLARE_READ16_MEMBER(protection_r); | |
107 | DECLARE_WRITE16_MEMBER(protection_w); | |
108 | ||
109 | // game specific | |
69 | DECLARE_WRITE16_MEMBER(m72_main_mcu_sound_w); | |
70 | DECLARE_WRITE16_MEMBER(m72_main_mcu_w); | |
71 | DECLARE_WRITE8_MEMBER(m72_mcu_data_w); | |
72 | DECLARE_READ8_MEMBER(m72_mcu_data_r); | |
73 | DECLARE_READ8_MEMBER(m72_mcu_sample_r); | |
74 | DECLARE_WRITE8_MEMBER(m72_mcu_ack_w); | |
75 | DECLARE_READ8_MEMBER(m72_mcu_snd_r); | |
76 | DECLARE_READ8_MEMBER(m72_mcu_port_r); | |
77 | DECLARE_WRITE8_MEMBER(m72_mcu_port_w); | |
78 | DECLARE_WRITE8_MEMBER(m72_mcu_low_w); | |
79 | DECLARE_WRITE8_MEMBER(m72_mcu_high_w); | |
80 | DECLARE_READ8_MEMBER(m72_snd_cpu_sample_r); | |
110 | 81 | DECLARE_WRITE16_MEMBER(bchopper_sample_trigger_w); |
111 | 82 | DECLARE_WRITE16_MEMBER(nspirit_sample_trigger_w); |
112 | 83 | DECLARE_WRITE16_MEMBER(imgfight_sample_trigger_w); |
r245319 | r245320 | |
115 | 86 | DECLARE_WRITE16_MEMBER(airduel_sample_trigger_w); |
116 | 87 | DECLARE_WRITE16_MEMBER(dkgenm72_sample_trigger_w); |
117 | 88 | DECLARE_WRITE16_MEMBER(gallop_sample_trigger_w); |
89 | DECLARE_READ16_MEMBER(protection_r); | |
90 | DECLARE_WRITE16_MEMBER(protection_w); | |
91 | DECLARE_READ16_MEMBER(soundram_r); | |
92 | DECLARE_WRITE16_MEMBER(soundram_w); | |
118 | 93 | DECLARE_READ16_MEMBER(poundfor_trackball_r); |
94 | DECLARE_READ16_MEMBER(m72_palette1_r); | |
95 | DECLARE_READ16_MEMBER(m72_palette2_r); | |
96 | DECLARE_WRITE16_MEMBER(m72_palette1_w); | |
97 | DECLARE_WRITE16_MEMBER(m72_palette2_w); | |
98 | DECLARE_WRITE16_MEMBER(m72_videoram1_w); | |
99 | DECLARE_WRITE16_MEMBER(m72_videoram2_w); | |
100 | DECLARE_WRITE16_MEMBER(m72_irq_line_w); | |
101 | DECLARE_WRITE16_MEMBER(m72_scrollx1_w); | |
102 | DECLARE_WRITE16_MEMBER(m72_scrollx2_w); | |
103 | DECLARE_WRITE16_MEMBER(m72_scrolly1_w); | |
104 | DECLARE_WRITE16_MEMBER(m72_scrolly2_w); | |
105 | DECLARE_WRITE16_MEMBER(m72_dmaon_w); | |
106 | DECLARE_WRITE16_MEMBER(m72_port02_w); | |
119 | 107 | DECLARE_WRITE16_MEMBER(rtype2_port02_w); |
120 | 108 | DECLARE_WRITE16_MEMBER(majtitle_gfx_ctrl_w); |
121 | ||
122 | TILE_GET_INFO_MEMBER(get_bg_tile_info); | |
123 | TILE_GET_INFO_MEMBER(get_fg_tile_info); | |
109 | DECLARE_WRITE8_MEMBER(m72_snd_cpu_sample_w); | |
110 | DECLARE_DRIVER_INIT(dkgenm72); | |
111 | DECLARE_DRIVER_INIT(bchopper); | |
112 | DECLARE_DRIVER_INIT(gallop); | |
113 | DECLARE_DRIVER_INIT(m72_8751); | |
114 | DECLARE_DRIVER_INIT(dbreedm72); | |
115 | DECLARE_DRIVER_INIT(airduel); | |
116 | DECLARE_DRIVER_INIT(nspirit); | |
117 | DECLARE_DRIVER_INIT(loht); | |
118 | DECLARE_DRIVER_INIT(imgfight); | |
119 | TILE_GET_INFO_MEMBER(m72_get_bg_tile_info); | |
120 | TILE_GET_INFO_MEMBER(m72_get_fg_tile_info); | |
124 | 121 | TILE_GET_INFO_MEMBER(hharry_get_bg_tile_info); |
125 | 122 | TILE_GET_INFO_MEMBER(rtype2_get_bg_tile_info); |
126 | 123 | TILE_GET_INFO_MEMBER(rtype2_get_fg_tile_info); |
127 | 124 | TILEMAP_MAPPER_MEMBER(majtitle_scan_rows); |
128 | ||
129 | 125 | void machine_start(); |
130 | 126 | void machine_reset(); |
131 | 127 | DECLARE_VIDEO_START(m72); |
r245319 | r245320 | |
138 | 134 | DECLARE_VIDEO_START(poundfor); |
139 | 135 | DECLARE_MACHINE_START(kengo); |
140 | 136 | DECLARE_MACHINE_RESET(kengo); |
141 | DECLARE_DRIVER_INIT(dkgenm72); | |
142 | DECLARE_DRIVER_INIT(bchopper); | |
143 | DECLARE_DRIVER_INIT(gallop); | |
144 | DECLARE_DRIVER_INIT(m72_8751); | |
145 | DECLARE_DRIVER_INIT(dbreedm72); | |
146 | DECLARE_DRIVER_INIT(airduel); | |
147 | DECLARE_DRIVER_INIT(nspirit); | |
148 | DECLARE_DRIVER_INIT(loht); | |
149 | DECLARE_DRIVER_INIT(imgfight); | |
150 | ||
151 | INTERRUPT_GEN_MEMBER(mcu_int); | |
137 | UINT32 screen_update_m72(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
138 | UINT32 screen_update_majtitle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
139 | INTERRUPT_GEN_MEMBER(m72_mcu_int); | |
152 | 140 | INTERRUPT_GEN_MEMBER(fake_nmi); |
153 | 141 | TIMER_CALLBACK_MEMBER(synch_callback); |
154 | TIMER_CALLBACK_MEMBER(scanline_interrupt); | |
142 | TIMER_CALLBACK_MEMBER(m72_scanline_interrupt); | |
155 | 143 | TIMER_CALLBACK_MEMBER(kengo_scanline_interrupt); |
156 | 144 | TIMER_CALLBACK_MEMBER(delayed_ram16_w); |
157 | ||
158 | ||
159 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
160 | UINT32 screen_update_majtitle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); | |
161 | inline void get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum); | |
145 | inline void m72_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum); | |
162 | 146 | inline void rtype2_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum); |
163 | 147 | void register_savestate(); |
164 | 148 | inline void changecolor(int color,int r,int g,int b); |
165 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
149 | void m72_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); | |
166 | 150 | void majtitle_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); |
167 | 151 | int find_sample(int num); |
168 | 152 | void copy_le(UINT16 *dest, const UINT8 *src, UINT8 bytes); |
r245319 | r245320 | |
---|---|---|
7 | 7 | |
8 | 8 | ***************************************************************************/ |
9 | 9 | |
10 | inline void m72_state::get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum) | |
10 | inline void m72_state::m72_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum) | |
11 | 11 | { |
12 | 12 | int code,attr,color,pri; |
13 | 13 | |
r245319 | r245320 | |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | TILE_GET_INFO_MEMBER(m72_state::get_bg_tile_info) | |
57 | TILE_GET_INFO_MEMBER(m72_state::m72_get_bg_tile_info) | |
58 | 58 | { |
59 | get_tile_info(tileinfo,tile_index,m_videoram2,2); | |
59 | m72_get_tile_info(tileinfo,tile_index,m_videoram2,2); | |
60 | 60 | } |
61 | 61 | |
62 | TILE_GET_INFO_MEMBER(m72_state::get_fg_tile_info) | |
62 | TILE_GET_INFO_MEMBER(m72_state::m72_get_fg_tile_info) | |
63 | 63 | { |
64 | get_tile_info(tileinfo,tile_index,m_videoram1,1); | |
64 | m72_get_tile_info(tileinfo,tile_index,m_videoram1,1); | |
65 | 65 | } |
66 | 66 | |
67 | 67 | TILE_GET_INFO_MEMBER(m72_state::hharry_get_bg_tile_info) |
68 | 68 | { |
69 | get_tile_info(tileinfo,tile_index,m_videoram2,1); | |
69 | m72_get_tile_info(tileinfo,tile_index,m_videoram2,1); | |
70 | 70 | } |
71 | 71 | |
72 | 72 | TILE_GET_INFO_MEMBER(m72_state::rtype2_get_bg_tile_info) |
r245319 | r245320 | |
107 | 107 | |
108 | 108 | VIDEO_START_MEMBER(m72_state,m72) |
109 | 109 | { |
110 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::get_bg_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,64); | |
111 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::get_fg_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,64); | |
110 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::m72_get_bg_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,64); | |
111 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::m72_get_fg_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,64); | |
112 | 112 | |
113 | 113 | m_buffered_spriteram = auto_alloc_array(machine(), UINT16, m_spriteram.bytes()/2); |
114 | 114 | |
r245319 | r245320 | |
178 | 178 | m_bg_tilemap->set_scrolldx(6,0); |
179 | 179 | m_fg_tilemap->set_scrolldy(-128,-128); |
180 | 180 | m_bg_tilemap->set_scrolldy(-128,-128); |
181 | ||
182 | save_item(NAME(m_prev)); | |
183 | save_item(NAME(m_diff)); | |
184 | 181 | } |
185 | 182 | |
186 | 183 | VIDEO_START_MEMBER(m72_state,hharryu) |
r245319 | r245320 | |
221 | 218 | m_bg_tilemap->set_scrolldy(-128,-128); |
222 | 219 | |
223 | 220 | register_savestate(); |
224 | save_item(NAME(m_majtitle_rowscroll)); | |
225 | 221 | } |
226 | 222 | |
227 | 223 | VIDEO_START_MEMBER(m72_state,hharry) |
228 | 224 | { |
229 | 225 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::hharry_get_bg_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,64); |
230 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS,8,8,64,64); | |
226 | m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(m72_state::m72_get_fg_tile_info),this), TILEMAP_SCAN_ROWS,8,8,64,64); | |
231 | 227 | |
232 | 228 | m_buffered_spriteram = auto_alloc_array(machine(), UINT16, m_spriteram.bytes()/2); |
233 | 229 | |
r245319 | r245320 | |
257 | 253 | |
258 | 254 | ***************************************************************************/ |
259 | 255 | |
260 | READ16_MEMBER(m72_state::palette1_r) | |
256 | READ16_MEMBER(m72_state::m72_palette1_r) | |
261 | 257 | { |
262 | 258 | /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */ |
263 | 259 | offset &= ~0x100; |
r245319 | r245320 | |
265 | 261 | return m_generic_paletteram_16[offset] | 0xffe0; /* only D0-D4 are connected */ |
266 | 262 | } |
267 | 263 | |
268 | READ16_MEMBER(m72_state::palette2_r) | |
264 | READ16_MEMBER(m72_state::m72_palette2_r) | |
269 | 265 | { |
270 | 266 | /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */ |
271 | 267 | offset &= ~0x100; |
r245319 | r245320 | |
278 | 274 | m_palette->set_pen_color(color,pal5bit(r),pal5bit(g),pal5bit(b)); |
279 | 275 | } |
280 | 276 | |
281 | WRITE16_MEMBER(m72_state::palette1_w) | |
277 | WRITE16_MEMBER(m72_state::m72_palette1_w) | |
282 | 278 | { |
283 | 279 | /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */ |
284 | 280 | offset &= ~0x100; |
r245319 | r245320 | |
291 | 287 | m_generic_paletteram_16[offset + 0x400]); |
292 | 288 | } |
293 | 289 | |
294 | WRITE16_MEMBER(m72_state::palette2_w) | |
290 | WRITE16_MEMBER(m72_state::m72_palette2_w) | |
295 | 291 | { |
296 | 292 | /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */ |
297 | 293 | offset &= ~0x100; |
r245319 | r245320 | |
304 | 300 | m_generic_paletteram2_16[offset + 0x400]); |
305 | 301 | } |
306 | 302 | |
307 | WRITE16_MEMBER(m72_state::videoram1_w) | |
303 | WRITE16_MEMBER(m72_state::m72_videoram1_w) | |
308 | 304 | { |
309 | 305 | COMBINE_DATA(&m_videoram1[offset]); |
310 | 306 | m_fg_tilemap->mark_tile_dirty(offset/2); |
311 | 307 | } |
312 | 308 | |
313 | WRITE16_MEMBER(m72_state::videoram2_w) | |
309 | WRITE16_MEMBER(m72_state::m72_videoram2_w) | |
314 | 310 | { |
315 | 311 | COMBINE_DATA(&m_videoram2[offset]); |
316 | 312 | m_bg_tilemap->mark_tile_dirty(offset/2); |
317 | 313 | } |
318 | 314 | |
319 | WRITE16_MEMBER(m72_state::irq_line_w) | |
315 | WRITE16_MEMBER(m72_state::m72_irq_line_w) | |
320 | 316 | { |
321 | 317 | COMBINE_DATA(&m_raster_irq_position); |
322 | 318 | } |
323 | 319 | |
324 | WRITE16_MEMBER(m72_state::scrollx1_w) | |
320 | WRITE16_MEMBER(m72_state::m72_scrollx1_w) | |
325 | 321 | { |
326 | 322 | COMBINE_DATA(&m_scrollx1); |
327 | 323 | } |
328 | 324 | |
329 | WRITE16_MEMBER(m72_state::scrollx2_w) | |
325 | WRITE16_MEMBER(m72_state::m72_scrollx2_w) | |
330 | 326 | { |
331 | 327 | COMBINE_DATA(&m_scrollx2); |
332 | 328 | } |
333 | 329 | |
334 | WRITE16_MEMBER(m72_state::scrolly1_w) | |
330 | WRITE16_MEMBER(m72_state::m72_scrolly1_w) | |
335 | 331 | { |
336 | 332 | COMBINE_DATA(&m_scrolly1); |
337 | 333 | } |
338 | 334 | |
339 | WRITE16_MEMBER(m72_state::scrolly2_w) | |
335 | WRITE16_MEMBER(m72_state::m72_scrolly2_w) | |
340 | 336 | { |
341 | 337 | COMBINE_DATA(&m_scrolly2); |
342 | 338 | } |
343 | 339 | |
344 | WRITE16_MEMBER(m72_state::dmaon_w) | |
340 | WRITE16_MEMBER(m72_state::m72_dmaon_w) | |
345 | 341 | { |
346 | 342 | if (ACCESSING_BITS_0_7) |
347 | 343 | memcpy(m_buffered_spriteram, m_spriteram, m_spriteram.bytes()); |
348 | 344 | } |
349 | 345 | |
350 | 346 | |
351 | WRITE16_MEMBER(m72_state::port02_w) | |
347 | WRITE16_MEMBER(m72_state::m72_port02_w) | |
352 | 348 | { |
353 | 349 | if (ACCESSING_BITS_0_7) |
354 | 350 | { |
r245319 | r245320 | |
413 | 409 | |
414 | 410 | ***************************************************************************/ |
415 | 411 | |
416 | void m72_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
412 | void m72_state::m72_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) | |
417 | 413 | { |
418 | 414 | UINT16 *spriteram = m_buffered_spriteram; |
419 | 415 | int offs; |
r245319 | r245320 | |
516 | 512 | } |
517 | 513 | } |
518 | 514 | |
519 | UINT32 m72_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) | |
515 | UINT32 m72_state::screen_update_m72(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) | |
520 | 516 | { |
521 | 517 | if (m_video_off) |
522 | 518 | { |
r245319 | r245320 | |
532 | 528 | |
533 | 529 | m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); |
534 | 530 | m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); |
535 | draw_sprites(bitmap,cliprect); | |
531 | m72_draw_sprites(bitmap,cliprect); | |
536 | 532 | m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); |
537 | 533 | m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); |
538 | 534 | return 0; |
r245319 | r245320 | |
569 | 565 | m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); |
570 | 566 | m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); |
571 | 567 | majtitle_draw_sprites(bitmap,cliprect); |
572 | draw_sprites(bitmap,cliprect); | |
568 | m72_draw_sprites(bitmap,cliprect); | |
573 | 569 | m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); |
574 | 570 | m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); |
575 | 571 | return 0; |
r0 | r245320 | |
---|---|---|
1 | // license:BSD-3-Clause | |
2 | // copyright-holders:Aaron Giles | |
3 | //============================================================ | |
4 | // | |
5 | // eivc.h | |
6 | // | |
7 | // Inline implementations for MSVC compiler. | |
8 | // | |
9 | //============================================================ | |
10 | ||
11 | #ifndef __EIVC__ | |
12 | #define __EIVC__ | |
13 | ||
14 | #if (_MSC_VER >= 1400) | |
15 | ||
16 | // need to ignore 'nonstandard extension used' warning in setjmp.h | |
17 | #pragma warning(push) | |
18 | #pragma warning(disable: 4987) | |
19 | #include <intrin.h> | |
20 | #pragma warning(pop) | |
21 | ||
22 | #else | |
23 | extern "C" long __cdecl _InterlockedIncrement(long volatile *); | |
24 | extern "C" long __cdecl _InterlockedDecrement(long volatile *); | |
25 | extern "C" long _InterlockedExchange(long volatile *, long); | |
26 | extern "C" long _InterlockedCompareExchange (long volatile *, long, long); | |
27 | extern "C" long _InterlockedExchangeAdd(long volatile *, long); | |
28 | extern "C" unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask); | |
29 | #endif | |
30 | ||
31 | #pragma intrinsic(_InterlockedIncrement) | |
32 | #pragma intrinsic(_InterlockedDecrement) | |
33 | #pragma intrinsic(_InterlockedCompareExchange) | |
34 | #pragma intrinsic(_InterlockedExchange) | |
35 | #pragma intrinsic(_InterlockedExchangeAdd) | |
36 | #if (_MSC_VER >= 1310) | |
37 | #pragma intrinsic(_BitScanReverse) | |
38 | #endif | |
39 | ||
40 | ||
41 | /*************************************************************************** | |
42 | INLINE BIT MANIPULATION FUNCTIONS | |
43 | ***************************************************************************/ | |
44 | ||
45 | /*------------------------------------------------- | |
46 | count_leading_zeros - return the number of | |
47 | leading zero bits in a 32-bit value | |
48 | -------------------------------------------------*/ | |
49 | ||
50 | #ifndef count_leading_zeros | |
51 | #define count_leading_zeros _count_leading_zeros | |
52 | INLINE UINT8 _count_leading_zeros(UINT32 value) | |
53 | { | |
54 | UINT32 index; | |
55 | return _BitScanReverse((unsigned long *)&index, value) ? (index ^ 31) : 32; | |
56 | } | |
57 | #endif | |
58 | ||
59 | ||
60 | /*------------------------------------------------- | |
61 | count_leading_ones - return the number of | |
62 | leading one bits in a 32-bit value | |
63 | -------------------------------------------------*/ | |
64 | ||
65 | #ifndef count_leading_ones | |
66 | #define count_leading_ones _count_leading_ones | |
67 | INLINE UINT8 _count_leading_ones(UINT32 value) | |
68 | { | |
69 | UINT32 index; | |
70 | return _BitScanReverse((unsigned long *)&index, ~value) ? (index ^ 31) : 32; | |
71 | } | |
72 | #endif | |
73 | ||
74 | ||
75 | ||
76 | /*************************************************************************** | |
77 | INLINE SYNCHRONIZATION FUNCTIONS | |
78 | ***************************************************************************/ | |
79 | ||
80 | /*------------------------------------------------- | |
81 | compare_exchange32 - compare the 'compare' | |
82 | value against the memory at 'ptr'; if equal, | |
83 | swap in the 'exchange' value. Regardless, | |
84 | return the previous value at 'ptr'. | |
85 | -------------------------------------------------*/ | |
86 | ||
87 | #ifndef compare_exchange32 | |
88 | #define compare_exchange32 _compare_exchange32 | |
89 | INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) | |
90 | { | |
91 | return _InterlockedCompareExchange((volatile long *)ptr, exchange, compare); | |
92 | } | |
93 | #endif | |
94 | ||
95 | ||
96 | /*------------------------------------------------- | |
97 | compare_exchange64 - compare the 'compare' | |
98 | value against the memory at 'ptr'; if equal, | |
99 | swap in the 'exchange' value. Regardless, | |
100 | return the previous value at 'ptr'. | |
101 | -------------------------------------------------*/ | |
102 | ||
103 | #ifdef PTR64 | |
104 | #ifndef compare_exchange64 | |
105 | #define compare_exchange64 _compare_exchange64 | |
106 | INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) | |
107 | { | |
108 | return _InterlockedCompareExchange64(ptr, exchange, compare); | |
109 | } | |
110 | #endif | |
111 | #endif | |
112 | ||
113 | ||
114 | /*------------------------------------------------- | |
115 | atomic_exchange32 - atomically exchange the | |
116 | exchange value with the memory at 'ptr', | |
117 | returning the original value. | |
118 | -------------------------------------------------*/ | |
119 | ||
120 | #ifndef atomic_exchange32 | |
121 | #define atomic_exchange32 _atomic_exchange32 | |
122 | INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) | |
123 | { | |
124 | return _InterlockedExchange((volatile long *)ptr, exchange); | |
125 | } | |
126 | #endif | |
127 | ||
128 | ||
129 | /*------------------------------------------------- | |
130 | atomic_add32 - atomically add the delta value | |
131 | to the memory at 'ptr', returning the final | |
132 | result. | |
133 | -------------------------------------------------*/ | |
134 | ||
135 | #ifndef atomic_add32 | |
136 | #define atomic_add32 _atomic_add32 | |
137 | INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) | |
138 | { | |
139 | return _InterlockedExchangeAdd((volatile long *)ptr, delta) + delta; | |
140 | } | |
141 | #endif | |
142 | ||
143 | ||
144 | /*------------------------------------------------- | |
145 | atomic_increment32 - atomically increment the | |
146 | 32-bit value in memory at 'ptr', returning the | |
147 | final result. | |
148 | -------------------------------------------------*/ | |
149 | ||
150 | #ifndef atomic_increment32 | |
151 | #define atomic_increment32 _atomic_increment32 | |
152 | INLINE INT32 _atomic_increment32(INT32 volatile *ptr) | |
153 | { | |
154 | return _InterlockedIncrement((volatile long *)ptr); | |
155 | } | |
156 | #endif | |
157 | ||
158 | ||
159 | /*------------------------------------------------- | |
160 | atomic_decrement32 - atomically decrement the | |
161 | 32-bit value in memory at 'ptr', returning the | |
162 | final result. | |
163 | -------------------------------------------------*/ | |
164 | ||
165 | #ifndef atomic_decrement32 | |
166 | #define atomic_decrement32 _atomic_decrement32 | |
167 | INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) | |
168 | { | |
169 | return _InterlockedDecrement((volatile long *)ptr); | |
170 | } | |
171 | #endif | |
172 | ||
173 | ||
174 | #endif /* __EIVC__ */ |
r0 | r245320 | |
---|---|---|
1 | // license:BSD-3-Clause | |
2 | // copyright-holders:Aaron Giles | |
3 | //============================================================ | |
4 | // | |
5 | // eivcx86.h | |
6 | // | |
7 | // x86 inline implementations for MSVC compiler. | |
8 | // | |
9 | //============================================================ | |
10 | ||
11 | #ifndef __EIVCX86__ | |
12 | #define __EIVCX86__ | |
13 | ||
14 | #ifdef PTR64 | |
15 | #include <emmintrin.h> | |
16 | #include <intrin.h> | |
17 | #endif | |
18 | ||
19 | ||
20 | /*************************************************************************** | |
21 | INLINE MATH FUNCTIONS | |
22 | ***************************************************************************/ | |
23 | ||
24 | /*------------------------------------------------- | |
25 | mul_32x32 - perform a signed 32 bit x 32 bit | |
26 | multiply and return the full 64 bit result | |
27 | -------------------------------------------------*/ | |
28 | ||
29 | #ifndef PTR64 | |
30 | #define mul_32x32 _mul_32x32 | |
31 | INLINE INT64 _mul_32x32(INT32 a, INT32 b) | |
32 | { | |
33 | // in theory this should work, but it is untested | |
34 | __asm | |
35 | { | |
36 | mov eax,a | |
37 | imul b | |
38 | // leave results in edx:eax | |
39 | } | |
40 | } | |
41 | #endif | |
42 | ||
43 | ||
44 | /*------------------------------------------------- | |
45 | mulu_32x32 - perform an unsigned 32 bit x | |
46 | 32 bit multiply and return the full 64 bit | |
47 | result | |
48 | -------------------------------------------------*/ | |
49 | ||
50 | #ifndef PTR64 | |
51 | #define mulu_32x32 _mulu_32x32 | |
52 | INLINE UINT64 _mulu_32x32(UINT32 a, UINT32 b) | |
53 | { | |
54 | // in theory this should work, but it is untested | |
55 | __asm | |
56 | { | |
57 | mov eax,a | |
58 | mul b | |
59 | // leave results in edx:eax | |
60 | } | |
61 | } | |
62 | #endif | |
63 | ||
64 | ||
65 | /*------------------------------------------------- | |
66 | mul_32x32_hi - perform a signed 32 bit x 32 bit | |
67 | multiply and return the upper 32 bits of the | |
68 | result | |
69 | -------------------------------------------------*/ | |
70 | ||
71 | #ifndef PTR64 | |
72 | #define mul_32x32_hi _mul_32x32_hi | |
73 | INLINE INT32 _mul_32x32_hi(INT32 a, INT32 b) | |
74 | { | |
75 | INT32 result; | |
76 | ||
77 | __asm | |
78 | { | |
79 | mov eax,a | |
80 | imul b | |
81 | mov result,edx | |
82 | } | |
83 | ||
84 | return result; | |
85 | } | |
86 | #endif | |
87 | ||
88 | ||
89 | /*------------------------------------------------- | |
90 | mulu_32x32_hi - perform an unsigned 32 bit x | |
91 | 32 bit multiply and return the upper 32 bits | |
92 | of the result | |
93 | -------------------------------------------------*/ | |
94 | ||
95 | #ifndef PTR64 | |
96 | #define mulu_32x32_hi _mulu_32x32_hi | |
97 | INLINE UINT32 _mulu_32x32_hi(UINT32 a, UINT32 b) | |
98 | { | |
99 | INT32 result; | |
100 | ||
101 | __asm | |
102 | { | |
103 | mov eax,a | |
104 | mul b | |
105 | mov result,edx | |
106 | } | |
107 | ||
108 | return result; | |
109 | } | |
110 | #endif | |
111 | ||
112 | ||
113 | /*------------------------------------------------- | |
114 | mul_32x32_shift - perform a signed 32 bit x | |
115 | 32 bit multiply and shift the result by the | |
116 | given number of bits before truncating the | |
117 | result to 32 bits | |
118 | -------------------------------------------------*/ | |
119 | ||
120 | #ifndef PTR64 | |
121 | #define mul_32x32_shift _mul_32x32_shift | |
122 | INLINE INT32 _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) | |
123 | { | |
124 | INT32 result; | |
125 | ||
126 | __asm | |
127 | { | |
128 | mov eax,a | |
129 | imul b | |
130 | mov cl,shift | |
131 | shrd eax,edx,cl | |
132 | mov result,eax | |
133 | } | |
134 | ||
135 | return result; | |
136 | } | |
137 | #endif | |
138 | ||
139 | ||
140 | /*------------------------------------------------- | |
141 | mulu_32x32_shift - perform an unsigned 32 bit x | |
142 | 32 bit multiply and shift the result by the | |
143 | given number of bits before truncating the | |
144 | result to 32 bits | |
145 | -------------------------------------------------*/ | |
146 | ||
147 | #ifndef PTR64 | |
148 | #define mulu_32x32_shift _mulu_32x32_shift | |
149 | INLINE UINT32 _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) | |
150 | { | |
151 | INT32 result; | |
152 | ||
153 | __asm | |
154 | { | |
155 | mov eax,a | |
156 | mul b | |
157 | mov cl,shift | |
158 | shrd eax,edx,cl | |
159 | mov result,eax | |
160 | } | |
161 | ||
162 | return result; | |
163 | } | |
164 | #endif | |
165 | ||
166 | ||
167 | /*------------------------------------------------- | |
168 | div_64x32 - perform a signed 64 bit x 32 bit | |
169 | divide and return the 32 bit quotient | |
170 | -------------------------------------------------*/ | |
171 | ||
172 | #ifndef PTR64 | |
173 | #define div_64x32 _div_64x32 | |
174 | INLINE INT32 _div_64x32(INT64 a, INT32 b) | |
175 | { | |
176 | INT32 result; | |
177 | INT32 alow = a; | |
178 | INT32 ahigh = a >> 32; | |
179 | ||
180 | __asm | |
181 | { | |
182 | mov eax,alow | |
183 | mov edx,ahigh | |
184 | idiv b | |
185 | mov result,eax | |
186 | } | |
187 | ||
188 | return result; | |
189 | } | |
190 | #endif | |
191 | ||
192 | ||
193 | /*------------------------------------------------- | |
194 | divu_64x32 - perform an unsigned 64 bit x 32 bit | |
195 | divide and return the 32 bit quotient | |
196 | -------------------------------------------------*/ | |
197 | ||
198 | #ifndef PTR64 | |
199 | #define divu_64x32 _divu_64x32 | |
200 | INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) | |
201 | { | |
202 | UINT32 result; | |
203 | UINT32 alow = a; | |
204 | UINT32 ahigh = a >> 32; | |
205 | ||
206 | __asm | |
207 | { | |
208 | mov eax,alow | |
209 | mov edx,ahigh | |
210 | div b | |
211 | mov result,eax | |
212 | } | |
213 | ||
214 | return result; | |
215 | } | |
216 | #endif | |
217 | ||
218 | ||
219 | /*------------------------------------------------- | |
220 | div_64x32_rem - perform a signed 64 bit x 32 | |
221 | bit divide and return the 32 bit quotient and | |
222 | 32 bit remainder | |
223 | -------------------------------------------------*/ | |
224 | ||
225 | #ifndef PTR64 | |
226 | #define div_64x32_rem _div_64x32_rem | |
227 | INLINE INT32 _div_64x32_rem(INT64 a, INT32 b, INT32 *remainder) | |
228 | { | |
229 | INT32 result; | |
230 | INT32 alow = a; | |
231 | INT32 ahigh = a >> 32; | |
232 | INT32 rem; | |
233 | ||
234 | __asm | |
235 | { | |
236 | mov eax,alow | |
237 | mov edx,ahigh | |
238 | idiv b | |
239 | mov result,eax | |
240 | mov rem,edx | |
241 | } | |
242 | ||
243 | *remainder = rem; | |
244 | return result; | |
245 | } | |
246 | #endif | |
247 | ||
248 | ||
249 | /*------------------------------------------------- | |
250 | divu_64x32_rem - perform an unsigned 64 bit x | |
251 | 32 bit divide and return the 32 bit quotient | |
252 | and 32 bit remainder | |
253 | -------------------------------------------------*/ | |
254 | ||
255 | #ifndef PTR64 | |
256 | #define divu_64x32_rem _divu_64x32_rem | |
257 | INLINE UINT32 _divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder) | |
258 | { | |
259 | UINT32 result; | |
260 | UINT32 alow = a; | |
261 | UINT32 ahigh = a >> 32; | |
262 | UINT32 rem; | |
263 | ||
264 | __asm | |
265 | { | |
266 | mov eax,alow | |
267 | mov edx,ahigh | |
268 | div b | |
269 | mov result,eax | |
270 | mov rem,edx | |
271 | } | |
272 | ||
273 | *remainder = rem; | |
274 | return result; | |
275 | } | |
276 | #endif | |
277 | ||
278 | ||
279 | /*------------------------------------------------- | |
280 | div_32x32_shift - perform a signed divide of | |
281 | two 32 bit values, shifting the first before | |
282 | division, and returning the 32 bit quotient | |
283 | -------------------------------------------------*/ | |
284 | ||
285 | #ifndef PTR64 | |
286 | #define div_32x32_shift _div_32x32_shift | |
287 | INLINE INT32 _div_32x32_shift(INT32 a, INT32 b, UINT8 shift) | |
288 | { | |
289 | INT32 result; | |
290 | ||
291 | __asm | |
292 | { | |
293 | mov eax,a | |
294 | cdq | |
295 | mov cl,shift | |
296 | shld edx,eax,cl | |
297 | shl eax,cl | |
298 | idiv b | |
299 | mov result,eax | |
300 | } | |
301 | ||
302 | return result; | |
303 | } | |
304 | #endif | |
305 | ||
306 | ||
307 | /*------------------------------------------------- | |
308 | divu_32x32_shift - perform an unsigned divide of | |
309 | two 32 bit values, shifting the first before | |
310 | division, and returning the 32 bit quotient | |
311 | -------------------------------------------------*/ | |
312 | ||
313 | #ifndef PTR64 | |
314 | #define divu_32x32_shift _divu_32x32_shift | |
315 | INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) | |
316 | { | |
317 | UINT32 result; | |
318 | ||
319 | __asm | |
320 | { | |
321 | mov eax,a | |
322 | xor edx,edx | |
323 | mov cl,shift | |
324 | shld edx,eax,cl | |
325 | shl eax,cl | |
326 | div b | |
327 | mov result,eax | |
328 | } | |
329 | ||
330 | return result; | |
331 | } | |
332 | #endif | |
333 | ||
334 | ||
335 | /*------------------------------------------------- | |
336 | mod_64x32 - perform a signed 64 bit x 32 bit | |
337 | divide and return the 32 bit remainder | |
338 | -------------------------------------------------*/ | |
339 | ||
340 | #ifndef PTR64 | |
341 | #define mod_64x32 _mod_64x32 | |
342 | INLINE INT32 _mod_64x32(INT64 a, INT32 b) | |
343 | { | |
344 | INT32 result; | |
345 | INT32 alow = a; | |
346 | INT32 ahigh = a >> 32; | |
347 | ||
348 | __asm | |
349 | { | |
350 | mov eax,alow | |
351 | mov edx,ahigh | |
352 | idiv b | |
353 | mov result,edx | |
354 | } | |
355 | ||
356 | return result; | |
357 | } | |
358 | #endif | |
359 | ||
360 | ||
361 | /*------------------------------------------------- | |
362 | modu_64x32 - perform an unsigned 64 bit x 32 bit | |
363 | divide and return the 32 bit remainder | |
364 | -------------------------------------------------*/ | |
365 | ||
366 | #ifndef PTR64 | |
367 | #define modu_64x32 _modu_64x32 | |
368 | INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) | |
369 | { | |
370 | UINT32 result; | |
371 | UINT32 alow = a; | |
372 | UINT32 ahigh = a >> 32; | |
373 | ||
374 | __asm | |
375 | { | |
376 | mov eax,alow | |
377 | mov edx,ahigh | |
378 | div b | |
379 | mov result,edx | |
380 | } | |
381 | ||
382 | return result; | |
383 | } | |
384 | #endif | |
385 | ||
386 | ||
387 | /*------------------------------------------------- | |
388 | recip_approx - compute an approximate floating | |
389 | point reciprocal | |
390 | -------------------------------------------------*/ | |
391 | ||
392 | #ifdef PTR64 | |
393 | #define recip_approx _recip_approx | |
394 | INLINE float _recip_approx(float z) | |
395 | { | |
396 | __m128 mz = _mm_set_ss(z); | |
397 | __m128 mooz = _mm_rcp_ss(mz); | |
398 | float ooz; | |
399 | _mm_store_ss(&ooz, mooz); | |
400 | return ooz; | |
401 | } | |
402 | #endif | |
403 | ||
404 | ||
405 | ||
406 | /*************************************************************************** | |
407 | INLINE BIT MANIPULATION FUNCTIONS | |
408 | ***************************************************************************/ | |
409 | ||
410 | /*------------------------------------------------- | |
411 | count_leading_zeros - return the number of | |
412 | leading zero bits in a 32-bit value | |
413 | -------------------------------------------------*/ | |
414 | ||
415 | #ifndef PTR64 | |
416 | #define count_leading_zeros _count_leading_zeros | |
417 | INLINE UINT8 _count_leading_zeros(UINT32 value) | |
418 | { | |
419 | INT32 result; | |
420 | ||
421 | __asm | |
422 | { | |
423 | bsr eax,value | |
424 | jnz skip | |
425 | mov eax,63 | |
426 | skip: | |
427 | xor eax,31 | |
428 | mov result,eax | |
429 | } | |
430 | ||
431 | return result; | |
432 | } | |
433 | #endif | |
434 | ||
435 | ||
436 | /*------------------------------------------------- | |
437 | count_leading_ones - return the number of | |
438 | leading one bits in a 32-bit value | |
439 | -------------------------------------------------*/ | |
440 | ||
441 | #ifndef PTR64 | |
442 | #define count_leading_ones _count_leading_ones | |
443 | INLINE UINT8 _count_leading_ones(UINT32 value) | |
444 | { | |
445 | INT32 result; | |
446 | ||
447 | __asm | |
448 | { | |
449 | mov eax,value | |
450 | not eax | |
451 | bsr eax,eax | |
452 | jnz skip | |
453 | mov eax,63 | |
454 | skip: | |
455 | xor eax,31 | |
456 | mov result,eax | |
457 | } | |
458 | ||
459 | return result; | |
460 | } | |
461 | #endif | |
462 | ||
463 | ||
464 | ||
465 | /*************************************************************************** | |
466 | INLINE TIMING FUNCTIONS | |
467 | ***************************************************************************/ | |
468 | ||
469 | /*------------------------------------------------- | |
470 | get_profile_ticks - return a tick counter | |
471 | from the processor that can be used for | |
472 | profiling. It does not need to run at any | |
473 | particular rate. | |
474 | -------------------------------------------------*/ | |
475 | ||
476 | #define get_profile_ticks _get_profile_ticks | |
477 | ||
478 | #ifdef PTR64 | |
479 | ||
480 | INLINE osd_ticks_t _get_profile_ticks(void) | |
481 | { | |
482 | return __rdtsc(); | |
483 | } | |
484 | ||
485 | #else | |
486 | ||
487 | INLINE osd_ticks_t _get_profile_ticks(void) | |
488 | { | |
489 | UINT64 result; | |
490 | UINT64 *presult = &result; | |
491 | ||
492 | __asm { | |
493 | __asm _emit 0Fh __asm _emit 031h // rdtsc | |
494 | mov ebx, presult | |
495 | mov [ebx],eax | |
496 | mov [ebx+4],edx | |
497 | } | |
498 | ||
499 | return result; | |
500 | } | |
501 | ||
502 | #endif | |
503 | ||
504 | #endif /* __EIVCX86__ */ |
r245319 | r245320 | |
---|---|---|
18 | 18 | #if defined(__GNUC__) |
19 | 19 | |
20 | 20 | #if defined(__i386__) || defined(__x86_64__) |
21 | ||
22 | ||
23 | INLINE void ATTR_FORCE_INLINE | |
24 | osd_yield_processor(void) | |
25 | { | |
26 | __asm__ __volatile__ ( " rep ; nop ;" ); | |
27 | } | |
28 | ||
29 | ||
30 | #if defined(__x86_64__) | |
31 | ||
32 | //============================================================ | |
33 | // osd_exchange64 | |
34 | //============================================================ | |
35 | ||
36 | INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE | |
37 | _osd_exchange64(INT64 volatile *ptr, INT64 exchange) | |
38 | { | |
39 | register INT64 ret; | |
40 | __asm__ __volatile__ ( | |
41 | " lock ; xchg %[exchange], %[ptr] ;" | |
42 | : [ptr] "+m" (*ptr) | |
43 | , [ret] "=r" (ret) | |
44 | : [exchange] "1" (exchange) | |
45 | ); | |
46 | return ret; | |
47 | } | |
48 | #define osd_exchange64 _osd_exchange64 | |
49 | ||
50 | #endif /* __x86_64__ */ | |
51 | ||
52 | ||
53 | #elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) | |
54 | ||
55 | ||
56 | INLINE void ATTR_FORCE_INLINE | |
57 | osd_yield_processor(void) | |
58 | { | |
59 | __asm__ __volatile__ ( " nop \n nop \n" ); | |
60 | } | |
61 | ||
62 | ||
63 | ||
64 | #if defined(__ppc64__) || defined(__PPC64__) | |
65 | ||
66 | //============================================================ | |
67 | // osd_exchange64 | |
68 | //============================================================ | |
69 | ||
70 | INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE | |
71 | _osd_exchange64(INT64 volatile *ptr, INT64 exchange) | |
72 | { | |
73 | register INT64 ret; | |
74 | __asm__ __volatile__ ( | |
75 | "1: ldarx %[ret], 0, %[ptr] \n" | |
76 | " stdcx. %[exchange], 0, %[ptr] \n" | |
77 | " bne- 1b \n" | |
78 | : [ret] "=&r" (ret) | |
79 | : [ptr] "r" (ptr) | |
80 | , [exchange] "r" (exchange) | |
81 | : "cr0" | |
82 | ); | |
83 | return ret; | |
84 | } | |
85 | #define osd_exchange64 _osd_exchange64 | |
86 | ||
87 | #endif /* __ppc64__ || __PPC64__ */ | |
88 | ||
89 | #endif | |
90 | ||
91 | #if defined(__i386__) || defined(__x86_64__) | |
21 | 92 | #include "eigccx86.h" |
22 | 93 | #elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) |
23 | 94 | #include "eigccppc.h" |
24 | 95 | #else |
25 | # | |
96 | #error "no matching assembler implementations found - please compile with NOASM=1" | |
26 | 97 | #endif |
27 | 98 | |
28 | 99 | #else |
29 | 100 | |
30 | #i | |
101 | #if defined(_MSC_VER) | |
31 | 102 | |
103 | #if (defined(_M_IX86) || defined(_M_X64)) | |
104 | #include "eivcx86.h" | |
32 | 105 | #endif |
106 | ||
107 | #include "eivc.h" | |
108 | ||
109 | INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange); | |
110 | INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange); | |
111 | INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta); | |
112 | ||
113 | #ifdef PTR64 | |
114 | INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange); | |
33 | 115 | #endif |
34 | 116 | |
35 | 117 | |
118 | #ifndef compare_exchange32 | |
119 | #define compare_exchange32 win_compare_exchange32 | |
120 | #endif /* compare_exchange32 */ | |
121 | ||
122 | #ifdef PTR64 | |
123 | #ifndef compare_exchange64 | |
124 | #define compare_exchange64 win_compare_exchange64 | |
125 | #endif /* compare_exchange64 */ | |
126 | #endif | |
127 | ||
128 | #ifndef atomic_exchange32 | |
129 | #define atomic_exchange32 win_atomic_exchange32 | |
130 | #endif /* atomic_exchange32 */ | |
131 | ||
132 | ||
133 | #ifndef atomic_add32 | |
134 | #define atomic_add32 win_atomic_add32 | |
135 | #endif /* atomic_add32 */ | |
136 | #else | |
137 | ||
138 | #error "no matching assembler implementations found - please compile with NOASM=1" | |
139 | ||
140 | #endif | |
141 | ||
142 | #endif | |
143 | #endif | |
144 | ||
145 | ||
36 | 146 | /*************************************************************************** |
37 | 147 | INLINE MATH FUNCTIONS |
38 | 148 | ***************************************************************************/ |
r245319 | r245320 | |
---|---|---|
1 | 1 | #include <stdio.h> /* snprintf */ |
2 | 2 | #include <stdlib.h> /* malloc */ |
3 | 3 | |
4 | #include "osdcomm.h" | |
4 | 5 | #include "osd_opengl.h" |
5 | 6 | |
6 | 7 | #include "gl_shader_mgr.h" |
r245319 | r245320 | |
---|---|---|
31 | 31 | |
32 | 32 | // MAME headers |
33 | 33 | #include "osdcore.h" |
34 | #include "osinline.h" | |
35 | 34 | #include "osdsync.h" |
36 | 35 | |
37 | 36 | #include "eminline.h" |
r245319 | r245320 | |
---|---|---|
21 | 21 | |
22 | 22 | // MAME headers |
23 | 23 | #include "osdcore.h" |
24 | #include "osinline.h" | |
25 | 24 | #include "osdsync.h" |
26 | 25 | |
27 | 26 | #include "eminline.h" |
r245319 | r245320 | |
---|---|---|
18 | 18 | |
19 | 19 | // MAME headers |
20 | 20 | #include "osdcore.h" |
21 | #include "osinline.h" | |
22 | 21 | #include "osdsync.h" |
23 | 22 | |
24 | 23 | #include "eminline.h" |
r245319 | r245320 | |
---|---|---|
14 | 14 | |
15 | 15 | // MAME headers |
16 | 16 | #include "osdcore.h" |
17 | #include " | |
17 | #include "eminline.h" | |
18 | 18 | #include "osdsync.h" |
19 | 19 | |
20 | 20 |
r245319 | r245320 | |
---|---|---|
223 | 223 | #define __has_feature(x) 0 |
224 | 224 | #endif |
225 | 225 | |
226 | #ifdef _MSC_VER | |
227 | #include <malloc.h> | |
228 | #if _MSC_VER < 1900 // < VS2015 | |
229 | #define snprintf _snprintf | |
230 | #if _MSC_VER < 1800 // VS2013 or earlier | |
231 | #define alloca _alloca | |
232 | #define round(x) floor((x) + 0.5) | |
233 | #define strtoll _strtoi64 | |
234 | #define _USE_MATH_DEFINES | |
235 | #include <math.h> | |
236 | static __inline double fmin(double x, double y){ return (x < y) ? x : y; } | |
237 | static __inline double fmax(double x, double y){ return (x > y) ? x : y; } | |
238 | static __inline double log2(double x) { return log(x) * M_LOG2E; } | |
239 | #endif // VS2013 | |
240 | #else // VS2015 | |
241 | #define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS | |
242 | #endif | |
243 | #endif | |
244 | ||
226 | 245 | #endif /* __OSDCOMM_H__ */ |
r245319 | r245320 | |
---|---|---|
1 | //============================================================ | |
2 | // | |
3 | // osinline.h - GNU C inline functions | |
4 | // | |
5 | //============================================================ | |
6 | ||
7 | #ifndef __OSINLINE__ | |
8 | #define __OSINLINE__ | |
9 | ||
10 | #include "eminline.h" | |
11 | ||
12 | ||
13 | //============================================================ | |
14 | // INLINE FUNCTIONS | |
15 | //============================================================ | |
16 | ||
17 | #if defined(__i386__) || defined(__x86_64__) | |
18 | ||
19 | ||
20 | INLINE void ATTR_FORCE_INLINE | |
21 | osd_yield_processor(void) | |
22 | { | |
23 | __asm__ __volatile__ ( " rep ; nop ;" ); | |
24 | } | |
25 | ||
26 | ||
27 | #if defined(__x86_64__) | |
28 | ||
29 | //============================================================ | |
30 | // osd_exchange64 | |
31 | //============================================================ | |
32 | ||
33 | INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE | |
34 | _osd_exchange64(INT64 volatile *ptr, INT64 exchange) | |
35 | { | |
36 | register INT64 ret; | |
37 | __asm__ __volatile__ ( | |
38 | " lock ; xchg %[exchange], %[ptr] ;" | |
39 | : [ptr] "+m" (*ptr) | |
40 | , [ret] "=r" (ret) | |
41 | : [exchange] "1" (exchange) | |
42 | ); | |
43 | return ret; | |
44 | } | |
45 | #define osd_exchange64 _osd_exchange64 | |
46 | ||
47 | #endif /* __x86_64__ */ | |
48 | ||
49 | ||
50 | #elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__) | |
51 | ||
52 | ||
53 | INLINE void ATTR_FORCE_INLINE | |
54 | osd_yield_processor(void) | |
55 | { | |
56 | __asm__ __volatile__ ( " nop \n nop \n" ); | |
57 | } | |
58 | ||
59 | ||
60 | ||
61 | #if defined(__ppc64__) || defined(__PPC64__) | |
62 | ||
63 | //============================================================ | |
64 | // osd_exchange64 | |
65 | //============================================================ | |
66 | ||
67 | INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE | |
68 | _osd_exchange64(INT64 volatile *ptr, INT64 exchange) | |
69 | { | |
70 | register INT64 ret; | |
71 | __asm__ __volatile__ ( | |
72 | "1: ldarx %[ret], 0, %[ptr] \n" | |
73 | " stdcx. %[exchange], 0, %[ptr] \n" | |
74 | " bne- 1b \n" | |
75 | : [ret] "=&r" (ret) | |
76 | : [ptr] "r" (ptr) | |
77 | , [exchange] "r" (exchange) | |
78 | : "cr0" | |
79 | ); | |
80 | return ret; | |
81 | } | |
82 | #define osd_exchange64 _osd_exchange64 | |
83 | ||
84 | #endif /* __ppc64__ || __PPC64__ */ | |
85 | ||
86 | #else | |
87 | ||
88 | #error "no matching assembler implementations found - please compile with NOASM=1" | |
89 | ||
90 | #endif | |
91 | ||
92 | #endif /* __OSINLINE__ */ |
r245319 | r245320 | |
---|---|---|
77 | 77 | |
78 | 78 | #endif /* SDLMAME_UNIX */ |
79 | 79 | |
80 | #ifdef _MSC_VER | |
81 | void *__cdecl _alloca(size_t); | |
82 | #define alloca _alloca | |
83 | #endif | |
84 | ||
85 | 80 | #ifdef __GNUC__ |
86 | 81 | #define alloca __builtin_alloca |
87 | 82 | #endif |
r245319 | r245320 | |
---|---|---|
11 | 11 | |
12 | 12 | #include "osdcomm.h" |
13 | 13 | #include "osdcore.h" |
14 | #ifdef SDLMAME_NOASM | |
15 | 14 | #include "eminline.h" |
16 | #else | |
17 | #include "osinline.h" | |
18 | #endif | |
19 | 15 | |
20 | 16 | #include "watchdog.h" |
21 | 17 | #include "modules/lib/osdlib.h" |
r245319 | r245320 | |
---|---|---|
1 | // license:BSD-3-Clause | |
2 | // copyright-holders:Aaron Giles | |
3 | //============================================================ | |
4 | // | |
5 | // eivc.h | |
6 | // | |
7 | // Inline implementations for MSVC compiler. | |
8 | // | |
9 | //============================================================ | |
10 | ||
11 | #ifndef __EIVC__ | |
12 | #define __EIVC__ | |
13 | ||
14 | #if (_MSC_VER >= 1400) | |
15 | ||
16 | // need to ignore 'nonstandard extension used' warning in setjmp.h | |
17 | #pragma warning(push) | |
18 | #pragma warning(disable: 4987) | |
19 | #include <intrin.h> | |
20 | #pragma warning(pop) | |
21 | ||
22 | #else | |
23 | extern "C" long __cdecl _InterlockedIncrement(long volatile *); | |
24 | extern "C" long __cdecl _InterlockedDecrement(long volatile *); | |
25 | extern "C" long _InterlockedExchange(long volatile *, long); | |
26 | extern "C" long _InterlockedCompareExchange (long volatile *, long, long); | |
27 | extern "C" long _InterlockedExchangeAdd(long volatile *, long); | |
28 | extern "C" unsigned char _BitScanReverse(unsigned long *Index, unsigned long Mask); | |
29 | #endif | |
30 | ||
31 | #pragma intrinsic(_InterlockedIncrement) | |
32 | #pragma intrinsic(_InterlockedDecrement) | |
33 | #pragma intrinsic(_InterlockedCompareExchange) | |
34 | #pragma intrinsic(_InterlockedExchange) | |
35 | #pragma intrinsic(_InterlockedExchangeAdd) | |
36 | #if (_MSC_VER >= 1310) | |
37 | #pragma intrinsic(_BitScanReverse) | |
38 | #endif | |
39 | ||
40 | ||
41 | /*************************************************************************** | |
42 | INLINE BIT MANIPULATION FUNCTIONS | |
43 | ***************************************************************************/ | |
44 | ||
45 | /*------------------------------------------------- | |
46 | count_leading_zeros - return the number of | |
47 | leading zero bits in a 32-bit value | |
48 | -------------------------------------------------*/ | |
49 | ||
50 | #ifndef count_leading_zeros | |
51 | #define count_leading_zeros _count_leading_zeros | |
52 | INLINE UINT8 _count_leading_zeros(UINT32 value) | |
53 | { | |
54 | UINT32 index; | |
55 | return _BitScanReverse((unsigned long *)&index, value) ? (index ^ 31) : 32; | |
56 | } | |
57 | #endif | |
58 | ||
59 | ||
60 | /*------------------------------------------------- | |
61 | count_leading_ones - return the number of | |
62 | leading one bits in a 32-bit value | |
63 | -------------------------------------------------*/ | |
64 | ||
65 | #ifndef count_leading_ones | |
66 | #define count_leading_ones _count_leading_ones | |
67 | INLINE UINT8 _count_leading_ones(UINT32 value) | |
68 | { | |
69 | UINT32 index; | |
70 | return _BitScanReverse((unsigned long *)&index, ~value) ? (index ^ 31) : 32; | |
71 | } | |
72 | #endif | |
73 | ||
74 | ||
75 | ||
76 | /*************************************************************************** | |
77 | INLINE SYNCHRONIZATION FUNCTIONS | |
78 | ***************************************************************************/ | |
79 | ||
80 | /*------------------------------------------------- | |
81 | compare_exchange32 - compare the 'compare' | |
82 | value against the memory at 'ptr'; if equal, | |
83 | swap in the 'exchange' value. Regardless, | |
84 | return the previous value at 'ptr'. | |
85 | -------------------------------------------------*/ | |
86 | ||
87 | #ifndef compare_exchange32 | |
88 | #define compare_exchange32 _compare_exchange32 | |
89 | INLINE INT32 _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) | |
90 | { | |
91 | return _InterlockedCompareExchange((volatile long *)ptr, exchange, compare); | |
92 | } | |
93 | #endif | |
94 | ||
95 | ||
96 | /*------------------------------------------------- | |
97 | compare_exchange64 - compare the 'compare' | |
98 | value against the memory at 'ptr'; if equal, | |
99 | swap in the 'exchange' value. Regardless, | |
100 | return the previous value at 'ptr'. | |
101 | -------------------------------------------------*/ | |
102 | ||
103 | #ifdef PTR64 | |
104 | #ifndef compare_exchange64 | |
105 | #define compare_exchange64 _compare_exchange64 | |
106 | INLINE INT64 _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) | |
107 | { | |
108 | return _InterlockedCompareExchange64(ptr, exchange, compare); | |
109 | } | |
110 | #endif | |
111 | #endif | |
112 | ||
113 | ||
114 | /*------------------------------------------------- | |
115 | atomic_exchange32 - atomically exchange the | |
116 | exchange value with the memory at 'ptr', | |
117 | returning the original value. | |
118 | -------------------------------------------------*/ | |
119 | ||
120 | #ifndef atomic_exchange32 | |
121 | #define atomic_exchange32 _atomic_exchange32 | |
122 | INLINE INT32 _atomic_exchange32(INT32 volatile *ptr, INT32 exchange) | |
123 | { | |
124 | return _InterlockedExchange((volatile long *)ptr, exchange); | |
125 | } | |
126 | #endif | |
127 | ||
128 | ||
129 | /*------------------------------------------------- | |
130 | atomic_add32 - atomically add the delta value | |
131 | to the memory at 'ptr', returning the final | |
132 | result. | |
133 | -------------------------------------------------*/ | |
134 | ||
135 | #ifndef atomic_add32 | |
136 | #define atomic_add32 _atomic_add32 | |
137 | INLINE INT32 _atomic_add32(INT32 volatile *ptr, INT32 delta) | |
138 | { | |
139 | return _InterlockedExchangeAdd((volatile long *)ptr, delta) + delta; | |
140 | } | |
141 | #endif | |
142 | ||
143 | ||
144 | /*------------------------------------------------- | |
145 | atomic_increment32 - atomically increment the | |
146 | 32-bit value in memory at 'ptr', returning the | |
147 | final result. | |
148 | -------------------------------------------------*/ | |
149 | ||
150 | #ifndef atomic_increment32 | |
151 | #define atomic_increment32 _atomic_increment32 | |
152 | INLINE INT32 _atomic_increment32(INT32 volatile *ptr) | |
153 | { | |
154 | return _InterlockedIncrement((volatile long *)ptr); | |
155 | } | |
156 | #endif | |
157 | ||
158 | ||
159 | /*------------------------------------------------- | |
160 | atomic_decrement32 - atomically decrement the | |
161 | 32-bit value in memory at 'ptr', returning the | |
162 | final result. | |
163 | -------------------------------------------------*/ | |
164 | ||
165 | #ifndef atomic_decrement32 | |
166 | #define atomic_decrement32 _atomic_decrement32 | |
167 | INLINE INT32 _atomic_decrement32(INT32 volatile *ptr) | |
168 | { | |
169 | return _InterlockedDecrement((volatile long *)ptr); | |
170 | } | |
171 | #endif | |
172 | ||
173 | ||
174 | #endif /* __EIVC__ */ |
r245319 | r245320 | |
---|---|---|
1 | // license:BSD-3-Clause | |
2 | // copyright-holders:Aaron Giles | |
3 | //============================================================ | |
4 | // | |
5 | // eivcx86.h | |
6 | // | |
7 | // x86 inline implementations for MSVC compiler. | |
8 | // | |
9 | //============================================================ | |
10 | ||
11 | #ifndef __EIVCX86__ | |
12 | #define __EIVCX86__ | |
13 | ||
14 | #ifdef PTR64 | |
15 | #include <emmintrin.h> | |
16 | #include <intrin.h> | |
17 | #endif | |
18 | ||
19 | ||
20 | /*************************************************************************** | |
21 | INLINE MATH FUNCTIONS | |
22 | ***************************************************************************/ | |
23 | ||
24 | /*------------------------------------------------- | |
25 | mul_32x32 - perform a signed 32 bit x 32 bit | |
26 | multiply and return the full 64 bit result | |
27 | -------------------------------------------------*/ | |
28 | ||
29 | #ifndef PTR64 | |
30 | #define mul_32x32 _mul_32x32 | |
31 | INLINE INT64 _mul_32x32(INT32 a, INT32 b) | |
32 | { | |
33 | // in theory this should work, but it is untested | |
34 | __asm | |
35 | { | |
36 | mov eax,a | |
37 | imul b | |
38 | // leave results in edx:eax | |
39 | } | |
40 | } | |
41 | #endif | |
42 | ||
43 | ||
44 | /*------------------------------------------------- | |
45 | mulu_32x32 - perform an unsigned 32 bit x | |
46 | 32 bit multiply and return the full 64 bit | |
47 | result | |
48 | -------------------------------------------------*/ | |
49 | ||
50 | #ifndef PTR64 | |
51 | #define mulu_32x32 _mulu_32x32 | |
52 | INLINE UINT64 _mulu_32x32(UINT32 a, UINT32 b) | |
53 | { | |
54 | // in theory this should work, but it is untested | |
55 | __asm | |
56 | { | |
57 | mov eax,a | |
58 | mul b | |
59 | // leave results in edx:eax | |
60 | } | |
61 | } | |
62 | #endif | |
63 | ||
64 | ||
65 | /*------------------------------------------------- | |
66 | mul_32x32_hi - perform a signed 32 bit x 32 bit | |
67 | multiply and return the upper 32 bits of the | |
68 | result | |
69 | -------------------------------------------------*/ | |
70 | ||
71 | #ifndef PTR64 | |
72 | #define mul_32x32_hi _mul_32x32_hi | |
73 | INLINE INT32 _mul_32x32_hi(INT32 a, INT32 b) | |
74 | { | |
75 | INT32 result; | |
76 | ||
77 | __asm | |
78 | { | |
79 | mov eax,a | |
80 | imul b | |
81 | mov result,edx | |
82 | } | |
83 | ||
84 | return result; | |
85 | } | |
86 | #endif | |
87 | ||
88 | ||
89 | /*------------------------------------------------- | |
90 | mulu_32x32_hi - perform an unsigned 32 bit x | |
91 | 32 bit multiply and return the upper 32 bits | |
92 | of the result | |
93 | -------------------------------------------------*/ | |
94 | ||
95 | #ifndef PTR64 | |
96 | #define mulu_32x32_hi _mulu_32x32_hi | |
97 | INLINE UINT32 _mulu_32x32_hi(UINT32 a, UINT32 b) | |
98 | { | |
99 | INT32 result; | |
100 | ||
101 | __asm | |
102 | { | |
103 | mov eax,a | |
104 | mul b | |
105 | mov result,edx | |
106 | } | |
107 | ||
108 | return result; | |
109 | } | |
110 | #endif | |
111 | ||
112 | ||
113 | /*------------------------------------------------- | |
114 | mul_32x32_shift - perform a signed 32 bit x | |
115 | 32 bit multiply and shift the result by the | |
116 | given number of bits before truncating the | |
117 | result to 32 bits | |
118 | -------------------------------------------------*/ | |
119 | ||
120 | #ifndef PTR64 | |
121 | #define mul_32x32_shift _mul_32x32_shift | |
122 | INLINE INT32 _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) | |
123 | { | |
124 | INT32 result; | |
125 | ||
126 | __asm | |
127 | { | |
128 | mov eax,a | |
129 | imul b | |
130 | mov cl,shift | |
131 | shrd eax,edx,cl | |
132 | mov result,eax | |
133 | } | |
134 | ||
135 | return result; | |
136 | } | |
137 | #endif | |
138 | ||
139 | ||
140 | /*------------------------------------------------- | |
141 | mulu_32x32_shift - perform an unsigned 32 bit x | |
142 | 32 bit multiply and shift the result by the | |
143 | given number of bits before truncating the | |
144 | result to 32 bits | |
145 | -------------------------------------------------*/ | |
146 | ||
147 | #ifndef PTR64 | |
148 | #define mulu_32x32_shift _mulu_32x32_shift | |
149 | INLINE UINT32 _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) | |
150 | { | |
151 | INT32 result; | |
152 | ||
153 | __asm | |
154 | { | |
155 | mov eax,a | |
156 | mul b | |
157 | mov cl,shift | |
158 | shrd eax,edx,cl | |
159 | mov result,eax | |
160 | } | |
161 | ||
162 | return result; | |
163 | } | |
164 | #endif | |
165 | ||
166 | ||
167 | /*------------------------------------------------- | |
168 | div_64x32 - perform a signed 64 bit x 32 bit | |
169 | divide and return the 32 bit quotient | |
170 | -------------------------------------------------*/ | |
171 | ||
172 | #ifndef PTR64 | |
173 | #define div_64x32 _div_64x32 | |
174 | INLINE INT32 _div_64x32(INT64 a, INT32 b) | |
175 | { | |
176 | INT32 result; | |
177 | INT32 alow = a; | |
178 | INT32 ahigh = a >> 32; | |
179 | ||
180 | __asm | |
181 | { | |
182 | mov eax,alow | |
183 | mov edx,ahigh | |
184 | idiv b | |
185 | mov result,eax | |
186 | } | |
187 | ||
188 | return result; | |
189 | } | |
190 | #endif | |
191 | ||
192 | ||
193 | /*------------------------------------------------- | |
194 | divu_64x32 - perform an unsigned 64 bit x 32 bit | |
195 | divide and return the 32 bit quotient | |
196 | -------------------------------------------------*/ | |
197 | ||
198 | #ifndef PTR64 | |
199 | #define divu_64x32 _divu_64x32 | |
200 | INLINE UINT32 _divu_64x32(UINT64 a, UINT32 b) | |
201 | { | |
202 | UINT32 result; | |
203 | UINT32 alow = a; | |
204 | UINT32 ahigh = a >> 32; | |
205 | ||
206 | __asm | |
207 | { | |
208 | mov eax,alow | |
209 | mov edx,ahigh | |
210 | div b | |
211 | mov result,eax | |
212 | } | |
213 | ||
214 | return result; | |
215 | } | |
216 | #endif | |
217 | ||
218 | ||
219 | /*------------------------------------------------- | |
220 | div_64x32_rem - perform a signed 64 bit x 32 | |
221 | bit divide and return the 32 bit quotient and | |
222 | 32 bit remainder | |
223 | -------------------------------------------------*/ | |
224 | ||
225 | #ifndef PTR64 | |
226 | #define div_64x32_rem _div_64x32_rem | |
227 | INLINE INT32 _div_64x32_rem(INT64 a, INT32 b, INT32 *remainder) | |
228 | { | |
229 | INT32 result; | |
230 | INT32 alow = a; | |
231 | INT32 ahigh = a >> 32; | |
232 | INT32 rem; | |
233 | ||
234 | __asm | |
235 | { | |
236 | mov eax,alow | |
237 | mov edx,ahigh | |
238 | idiv b | |
239 | mov result,eax | |
240 | mov rem,edx | |
241 | } | |
242 | ||
243 | *remainder = rem; | |
244 | return result; | |
245 | } | |
246 | #endif | |
247 | ||
248 | ||
249 | /*------------------------------------------------- | |
250 | divu_64x32_rem - perform an unsigned 64 bit x | |
251 | 32 bit divide and return the 32 bit quotient | |
252 | and 32 bit remainder | |
253 | -------------------------------------------------*/ | |
254 | ||
255 | #ifndef PTR64 | |
256 | #define divu_64x32_rem _divu_64x32_rem | |
257 | INLINE UINT32 _divu_64x32_rem(UINT64 a, UINT32 b, UINT32 *remainder) | |
258 | { | |
259 | UINT32 result; | |
260 | UINT32 alow = a; | |
261 | UINT32 ahigh = a >> 32; | |
262 | UINT32 rem; | |
263 | ||
264 | __asm | |
265 | { | |
266 | mov eax,alow | |
267 | mov edx,ahigh | |
268 | div b | |
269 | mov result,eax | |
270 | mov rem,edx | |
271 | } | |
272 | ||
273 | *remainder = rem; | |
274 | return result; | |
275 | } | |
276 | #endif | |
277 | ||
278 | ||
279 | /*------------------------------------------------- | |
280 | div_32x32_shift - perform a signed divide of | |
281 | two 32 bit values, shifting the first before | |
282 | division, and returning the 32 bit quotient | |
283 | -------------------------------------------------*/ | |
284 | ||
285 | #ifndef PTR64 | |
286 | #define div_32x32_shift _div_32x32_shift | |
287 | INLINE INT32 _div_32x32_shift(INT32 a, INT32 b, UINT8 shift) | |
288 | { | |
289 | INT32 result; | |
290 | ||
291 | __asm | |
292 | { | |
293 | mov eax,a | |
294 | cdq | |
295 | mov cl,shift | |
296 | shld edx,eax,cl | |
297 | shl eax,cl | |
298 | idiv b | |
299 | mov result,eax | |
300 | } | |
301 | ||
302 | return result; | |
303 | } | |
304 | #endif | |
305 | ||
306 | ||
307 | /*------------------------------------------------- | |
308 | divu_32x32_shift - perform an unsigned divide of | |
309 | two 32 bit values, shifting the first before | |
310 | division, and returning the 32 bit quotient | |
311 | -------------------------------------------------*/ | |
312 | ||
313 | #ifndef PTR64 | |
314 | #define divu_32x32_shift _divu_32x32_shift | |
315 | INLINE UINT32 _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) | |
316 | { | |
317 | UINT32 result; | |
318 | ||
319 | __asm | |
320 | { | |
321 | mov eax,a | |
322 | xor edx,edx | |
323 | mov cl,shift | |
324 | shld edx,eax,cl | |
325 | shl eax,cl | |
326 | div b | |
327 | mov result,eax | |
328 | } | |
329 | ||
330 | return result; | |
331 | } | |
332 | #endif | |
333 | ||
334 | ||
335 | /*------------------------------------------------- | |
336 | mod_64x32 - perform a signed 64 bit x 32 bit | |
337 | divide and return the 32 bit remainder | |
338 | -------------------------------------------------*/ | |
339 | ||
340 | #ifndef PTR64 | |
341 | #define mod_64x32 _mod_64x32 | |
342 | INLINE INT32 _mod_64x32(INT64 a, INT32 b) | |
343 | { | |
344 | INT32 result; | |
345 | INT32 alow = a; | |
346 | INT32 ahigh = a >> 32; | |
347 | ||
348 | __asm | |
349 | { | |
350 | mov eax,alow | |
351 | mov edx,ahigh | |
352 | idiv b | |
353 | mov result,edx | |
354 | } | |
355 | ||
356 | return result; | |
357 | } | |
358 | #endif | |
359 | ||
360 | ||
361 | /*------------------------------------------------- | |
362 | modu_64x32 - perform an unsigned 64 bit x 32 bit | |
363 | divide and return the 32 bit remainder | |
364 | -------------------------------------------------*/ | |
365 | ||
366 | #ifndef PTR64 | |
367 | #define modu_64x32 _modu_64x32 | |
368 | INLINE UINT32 _modu_64x32(UINT64 a, UINT32 b) | |
369 | { | |
370 | UINT32 result; | |
371 | UINT32 alow = a; | |
372 | UINT32 ahigh = a >> 32; | |
373 | ||
374 | __asm | |
375 | { | |
376 | mov eax,alow | |
377 | mov edx,ahigh | |
378 | div b | |
379 | mov result,edx | |
380 | } | |
381 | ||
382 | return result; | |
383 | } | |
384 | #endif | |
385 | ||
386 | ||
387 | /*------------------------------------------------- | |
388 | recip_approx - compute an approximate floating | |
389 | point reciprocal | |
390 | -------------------------------------------------*/ | |
391 | ||
392 | #ifdef PTR64 | |
393 | #define recip_approx _recip_approx | |
394 | INLINE float _recip_approx(float z) | |
395 | { | |
396 | __m128 mz = _mm_set_ss(z); | |
397 | __m128 mooz = _mm_rcp_ss(mz); | |
398 | float ooz; | |
399 | _mm_store_ss(&ooz, mooz); | |
400 | return ooz; | |
401 | } | |
402 | #endif | |
403 | ||
404 | ||
405 | ||
406 | /*************************************************************************** | |
407 | INLINE BIT MANIPULATION FUNCTIONS | |
408 | ***************************************************************************/ | |
409 | ||
410 | /*------------------------------------------------- | |
411 | count_leading_zeros - return the number of | |
412 | leading zero bits in a 32-bit value | |
413 | -------------------------------------------------*/ | |
414 | ||
415 | #ifndef PTR64 | |
416 | #define count_leading_zeros _count_leading_zeros | |
417 | INLINE UINT8 _count_leading_zeros(UINT32 value) | |
418 | { | |
419 | INT32 result; | |
420 | ||
421 | __asm | |
422 | { | |
423 | bsr eax,value | |
424 | jnz skip | |
425 | mov eax,63 | |
426 | skip: | |
427 | xor eax,31 | |
428 | mov result,eax | |
429 | } | |
430 | ||
431 | return result; | |
432 | } | |
433 | #endif | |
434 | ||
435 | ||
436 | /*------------------------------------------------- | |
437 | count_leading_ones - return the number of | |
438 | leading one bits in a 32-bit value | |
439 | -------------------------------------------------*/ | |
440 | ||
441 | #ifndef PTR64 | |
442 | #define count_leading_ones _count_leading_ones | |
443 | INLINE UINT8 _count_leading_ones(UINT32 value) | |
444 | { | |
445 | INT32 result; | |
446 | ||
447 | __asm | |
448 | { | |
449 | mov eax,value | |
450 | not eax | |
451 | bsr eax,eax | |
452 | jnz skip | |
453 | mov eax,63 | |
454 | skip: | |
455 | xor eax,31 | |
456 | mov result,eax | |
457 | } | |
458 | ||
459 | return result; | |
460 | } | |
461 | #endif | |
462 | ||
463 | ||
464 | ||
465 | /*************************************************************************** | |
466 | INLINE TIMING FUNCTIONS | |
467 | ***************************************************************************/ | |
468 | ||
469 | /*------------------------------------------------- | |
470 | get_profile_ticks - return a tick counter | |
471 | from the processor that can be used for | |
472 | profiling. It does not need to run at any | |
473 | particular rate. | |
474 | -------------------------------------------------*/ | |
475 | ||
476 | #define get_profile_ticks _get_profile_ticks | |
477 | ||
478 | #ifdef PTR64 | |
479 | ||
480 | INLINE osd_ticks_t _get_profile_ticks(void) | |
481 | { | |
482 | return __rdtsc(); | |
483 | } | |
484 | ||
485 | #else | |
486 | ||
487 | INLINE osd_ticks_t _get_profile_ticks(void) | |
488 | { | |
489 | UINT64 result; | |
490 | UINT64 *presult = &result; | |
491 | ||
492 | __asm { | |
493 | __asm _emit 0Fh __asm _emit 031h // rdtsc | |
494 | mov ebx, presult | |
495 | mov [ebx],eax | |
496 | mov [ebx+4],edx | |
497 | } | |
498 | ||
499 | return result; | |
500 | } | |
501 | ||
502 | #endif | |
503 | ||
504 | #endif /* __EIVCX86__ */ |
r245319 | r245320 | |
---|---|---|
1 | // license:BSD-3-Clause | |
2 | // copyright-holders:Aaron Giles | |
3 | //============================================================ | |
4 | // | |
5 | // osinline.h | |
6 | // | |
7 | // Inline implementations for non-GCC Win32 compilers | |
8 | // | |
9 | //============================================================ | |
10 | ||
11 | #ifndef __OSINLINE__ | |
12 | #define __OSINLINE__ | |
13 | ||
14 | #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) | |
15 | #include "eivcx86.h" | |
16 | #endif | |
17 | ||
18 | #if defined(_MSC_VER) | |
19 | #include "eivc.h" | |
20 | #endif | |
21 | ||
22 | INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange); | |
23 | INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange); | |
24 | INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta); | |
25 | ||
26 | #ifdef PTR64 | |
27 | INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange); | |
28 | #endif | |
29 | ||
30 | ||
31 | #ifndef compare_exchange32 | |
32 | #define compare_exchange32 win_compare_exchange32 | |
33 | #endif /* compare_exchange32 */ | |
34 | ||
35 | #ifdef PTR64 | |
36 | #ifndef compare_exchange64 | |
37 | #define compare_exchange64 win_compare_exchange64 | |
38 | #endif /* compare_exchange64 */ | |
39 | #endif | |
40 | ||
41 | #ifndef atomic_exchange32 | |
42 | #define atomic_exchange32 win_atomic_exchange32 | |
43 | #endif /* atomic_exchange32 */ | |
44 | ||
45 | ||
46 | #ifndef atomic_add32 | |
47 | #define atomic_add32 win_atomic_add32 | |
48 | #endif /* atomic_add32 */ | |
49 | ||
50 | ||
51 | #endif /* __OSINLINE__ */ |
r245319 | r245320 | |
---|---|---|
10 | 10 | #define _WIN32_WINNT 0x0501 // Windows XP |
11 | 11 | #endif |
12 | 12 | |
13 | #ifdef _MSC_VER | |
14 | #include <malloc.h> | |
15 | #if _MSC_VER < 1900 // < VS2015 | |
16 | #define snprintf _snprintf | |
17 | #if _MSC_VER < 1800 // VS2013 or earlier | |
18 | #define alloca _alloca | |
19 | #define round(x) floor((x) + 0.5) | |
20 | #define strtoll _strtoi64 | |
21 | #define _USE_MATH_DEFINES | |
22 | #include <math.h> | |
23 | static __inline double fmin(double x, double y){ return (x < y) ? x : y; } | |
24 | static __inline double fmax(double x, double y){ return (x > y) ? x : y; } | |
25 | static __inline double log2(double x) { return log(x) * M_LOG2E; } | |
26 | #if _MSC_VER < 1500 // VS2008 or earlier | |
27 | #define vsnprintf _vsnprintf | |
28 | #endif // VS2008 | |
29 | #endif // VS2013 | |
30 | #else // VS2015 | |
31 | #pragma warning (disable: 4091) | |
32 | #pragma warning (disable: 4267) | |
33 | #pragma warning (disable: 4456 4457 4458 4459) | |
34 | #pragma warning (disable: 4463) | |
35 | #pragma warning (disable: 4838) | |
36 | #pragma warning (disable: 5025 5026 5027) | |
37 | #define _CRT_STDIO_LEGACY_WIDE_SPECIFIERS | |
38 | #endif | |
39 | #endif | |
40 | ||
41 | 13 | #ifdef __GNUC__ |
42 | 14 | #ifndef alloca |
43 | 15 | #define alloca __builtin_alloca |
https://github.com/mamedev/mame/commit/de541d79eea8f7527ff33440f6081474606738e3 |
Previous | 199869 Revisions | Next |