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]osinline.h sdlprefix.h watchdog.c
[src/osd/windows]eivc.h eivcx86.h osinline.h winprefix.h

trunk/scripts/src/3rdparty.lua
r245319r245320
405405   files {
406406      MAME_DIR .. "3rdparty/portmidi/pm_common/portmidi.c",
407407      MAME_DIR .. "3rdparty/portmidi/pm_common/pmutil.c",
408      MAME_DIR .. "3rdparty/portmidi/porttime/porttime.c",
409      }
408   }
410409
411410   if _OPTIONS["targetos"]=="windows" then
412411      files {
trunk/src/mame/drivers/m72.c
r245319r245320
9696
9797
9898
99
100
101
99102/***************************************************************************/
100103
101104void m72_state::machine_start()
102105{
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));
104110}
105111
106112MACHINE_START_MEMBER(m72_state,kengo)
107113{
108114   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));
109118}
110119
111120TIMER_CALLBACK_MEMBER(m72_state::synch_callback)
r245319r245320
135144   m_scanline_timer->adjust(m_screen->time_until_pos(0));
136145}
137146
138TIMER_CALLBACK_MEMBER(m72_state::scanline_interrupt)
147TIMER_CALLBACK_MEMBER(m72_state::m72_scanline_interrupt)
139148{
140149   int scanline = param;
141150
r245319r245320
191200
192201Protection emulation
193202
203Currently only available for lohtb2, since this is the only game
204with a dumped 8751.
205
194206The protection device does
195207
196208* provide startup code
r245319r245320
209221}
210222
211223
212WRITE16_MEMBER(m72_state::main_mcu_sound_w)
224WRITE16_MEMBER(m72_state::m72_main_mcu_sound_w)
213225{
214226   if (data & 0xfff0)
215227      logerror("sound_w: %04x %04x\n", mem_mask, data);
r245319r245320
221233   }
222234}
223235
224WRITE16_MEMBER(m72_state::main_mcu_w)
236WRITE16_MEMBER(m72_state::m72_main_mcu_w)
225237{
226238   UINT16 val = m_protection_ram[offset];
227239
r245319r245320
243255      machine().scheduler().synchronize( timer_expired_delegate(FUNC(m72_state::delayed_ram16_w),this), (offset<<16) | val, m_protection_ram);
244256}
245257
246WRITE8_MEMBER(m72_state::mcu_data_w)
258WRITE8_MEMBER(m72_state::m72_mcu_data_w)
247259{
248260   UINT16 val;
249261   if (offset&1) val = (m_protection_ram[offset/2] & 0x00ff) | (data << 8);
r245319r245320
252264   machine().scheduler().synchronize( timer_expired_delegate(FUNC(m72_state::delayed_ram16_w),this), ((offset >>1 ) << 16) | val, m_protection_ram);
253265}
254266
255READ8_MEMBER(m72_state::mcu_data_r)
267READ8_MEMBER(m72_state::m72_mcu_data_r)
256268{
257269   UINT8 ret;
258270
r245319r245320
267279   return ret;
268280}
269281
270INTERRUPT_GEN_MEMBER(m72_state::mcu_int)
282INTERRUPT_GEN_MEMBER(m72_state::m72_mcu_int)
271283{
272284   //m_mcu_snd_cmd_latch |= 0x11; /* 0x10 is special as well - FIXME */
273285   m_mcu_snd_cmd_latch = 0x11;// | (machine.rand() & 1); /* 0x10 is special as well - FIXME */
274286   device.execute().set_input_line(1, ASSERT_LINE);
275287}
276288
277READ8_MEMBER(m72_state::mcu_sample_r)
289READ8_MEMBER(m72_state::m72_mcu_sample_r)
278290{
279291   UINT8 sample;
280292   sample = memregion("samples")->base()[m_mcu_sample_addr++];
281293   return sample;
282294}
283295
284WRITE8_MEMBER(m72_state::mcu_ack_w)
296WRITE8_MEMBER(m72_state::m72_mcu_ack_w)
285297{
286298   m_mcu->set_input_line(1, CLEAR_LINE);
287299   m_mcu_snd_cmd_latch = 0;
288300}
289301
290READ8_MEMBER(m72_state::mcu_snd_r)
302READ8_MEMBER(m72_state::m72_mcu_snd_r)
291303{
292304   return m_mcu_snd_cmd_latch;
293305}
294306
295READ8_MEMBER(m72_state::mcu_port_r)
307READ8_MEMBER(m72_state::m72_mcu_port_r)
296308{
297309   logerror("port read: %02x\n", offset);
298310   return 0;
299311}
300312
301WRITE8_MEMBER(m72_state::mcu_port_w)
313WRITE8_MEMBER(m72_state::m72_mcu_port_w)
302314{
303315   if (offset == 1)
304316   {
r245319r245320
310322
311323}
312324
313WRITE8_MEMBER(m72_state::mcu_low_w)
325WRITE8_MEMBER(m72_state::m72_mcu_low_w)
314326{
315327   m_mcu_sample_addr = (m_mcu_sample_addr & 0xffe000) | (data<<5);
316328   logerror("low: %02x %02x %08x\n", offset, data, m_mcu_sample_addr);
317329}
318330
319WRITE8_MEMBER(m72_state::mcu_high_w)
331WRITE8_MEMBER(m72_state::m72_mcu_high_w)
320332{
321333   m_mcu_sample_addr = (m_mcu_sample_addr & 0x1fff) | (data<<(8+5));
322334   logerror("high: %02x %02x %08x\n", offset, data, m_mcu_sample_addr);
323335}
324336
325READ8_MEMBER(m72_state::snd_cpu_sample_r)
337WRITE8_MEMBER(m72_state::m72_snd_cpu_sample_w)
326338{
339   //m_dac->write_signed8(data);
340   m_dac->write_unsigned8(data);
341}
342
343READ8_MEMBER(m72_state::m72_snd_cpu_sample_r)
344{
327345   return m_mcu_sample_latch;
328346}
329347
r245319r245320
335353
336354   m_protection_ram = auto_alloc_array(machine(), UINT16, 0x10000/2);
337355   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);
345358
346359   //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));
348361
349362   /* 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));
352365
353366   /* lohtb2 */
354367#if 0
r245319r245320
684697   m_maincpu->space(AS_PROGRAM).install_read_bank(0xb0000, 0xb0fff, "bank1");
685698   m_maincpu->space(AS_PROGRAM).install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),this));
686699   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);
690701}
691702
692703DRIVER_INIT_MEMBER(m72_state,bchopper)
r245319r245320
797808   AM_RANGE(0x00000, ROMSIZE-1) AM_ROM                                 \
798809   AM_RANGE(WORKRAM, WORKRAM+0x3fff) AM_RAM    /* work RAM */          \
799810   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")      \
804815   AM_RANGE(0xe0000, 0xeffff) AM_READWRITE(soundram_r, soundram_w)                         \
805816   AM_RANGE(0xffff0, 0xfffff) AM_ROM                                   \
806817ADDRESS_MAP_END
r245319r245320
817828   AM_RANGE(0x9c000, 0x9ffff) AM_RAM   /* work RAM */
818829   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */
819830   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")
824835   AM_RANGE(0xffff0, 0xfffff) AM_ROM
825836ADDRESS_MAP_END
826837
r245319r245320
829840   AM_RANGE(0x88000, 0x8bfff) AM_RAM   /* work RAM */
830841   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */
831842   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")
836847   AM_RANGE(0xffff0, 0xfffff) AM_ROM
837848ADDRESS_MAP_END
838849
839850static ADDRESS_MAP_START( rtype2_map, AS_PROGRAM, 16, m72_state )
840851   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)
843854   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")
848859   AM_RANGE(0xe0000, 0xe3fff) AM_RAM   /* work RAM */
849860   AM_RANGE(0xffff0, 0xfffff) AM_ROM
850861ADDRESS_MAP_END
r245319r245320
852863static ADDRESS_MAP_START( majtitle_map, AS_PROGRAM, 16, m72_state )
853864   AM_RANGE(0x00000, 0x7ffff) AM_ROM
854865   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 */
858869   AM_RANGE(0xc0000, 0xc03ff) AM_RAM AM_SHARE("spriteram")
859870   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")
861872   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)
863874   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)
865876   AM_RANGE(0xffff0, 0xfffff) AM_ROM
866877ADDRESS_MAP_END
867878
r245319r245320
870881   AM_RANGE(0xa0000, 0xa3fff) AM_RAM   /* work RAM */
871882   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */
872883   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")
877888   AM_RANGE(0xffff0, 0xfffff) AM_ROM
878889ADDRESS_MAP_END
879890
880891static ADDRESS_MAP_START( hharryu_map, AS_PROGRAM, 16, m72_state )
881892   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)
886897   AM_RANGE(0xb0ffe, 0xb0fff) AM_WRITEONLY /* leftover from protection?? */
887898   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")
890901   AM_RANGE(0xe0000, 0xe3fff) AM_RAM   /* work RAM */
891902   AM_RANGE(0xffff0, 0xfffff) AM_ROM
892903ADDRESS_MAP_END
893904
894905static ADDRESS_MAP_START( kengo_map, AS_PROGRAM, 16, m72_state )
895906   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)
899910   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)
901912   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")
904915   AM_RANGE(0xe0000, 0xe3fff) AM_RAM   /* work RAM */
905916   AM_RANGE(0xffff0, 0xfffff) AM_ROM
906917ADDRESS_MAP_END
r245319r245320
910921   AM_RANGE(0x02, 0x03) AM_READ_PORT("IN1")
911922   AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
912923   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)
916927   //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)
921932/*  { 0xc0, 0xc0      trigger sample, filled by init_ function */
922933ADDRESS_MAP_END
923934
r245319r245320
928939   AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
929940   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
930941   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)
935946ADDRESS_MAP_END
936947
937948static ADDRESS_MAP_START( poundfor_portmap, AS_IO, 16, m72_state )
r245319r245320
941952   AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
942953   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
943954   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)
948959ADDRESS_MAP_END
949960
950961static ADDRESS_MAP_START( majtitle_portmap, AS_IO, 16, m72_state )
r245319r245320
954965   AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
955966   AM_RANGE(0x02, 0x03) AM_WRITE(rtype2_port02_w)
956967   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)
961972   AM_RANGE(0x8e, 0x8f) AM_WRITE(majtitle_gfx_ctrl_w)
962973ADDRESS_MAP_END
963974
r245319r245320
967978   AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
968979   AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
969980   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)
972983   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)
977988ADDRESS_MAP_END
978989
979990static ADDRESS_MAP_START( kengo_portmap, AS_IO, 16, m72_state )
r245319r245320
982993   AM_RANGE(0x04, 0x05) AM_READ_PORT("DSW")
983994   AM_RANGE(0x00, 0x01) AM_DEVWRITE("m72", m72_audio_device, sound_command_w)
984995   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)
9891000//  AM_RANGE(0x8c, 0x8f) AM_WRITENOP    /* ??? */
9901001ADDRESS_MAP_END
9911002
r245319r245320
10371048
10381049static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, m72_state )
10391050   /* 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)
10431054   /* 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 )
10451056
10461057   /* 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)
10481059ADDRESS_MAP_END
10491060
10501061#define COIN_MODE_1 \
r245319r245320
17821793
17831794   MCFG_SCREEN_ADD("screen", RASTER)
17841795   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)
17861797   MCFG_SCREEN_PALETTE("palette")
17871798
17881799   MCFG_VIDEO_START_OVERRIDE(m72_state,m72)
r245319r245320
18001811
18011812   MCFG_CPU_ADD("mcu",I8751, XTAL_8MHz) /* Uses its own XTAL */
18021813   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)
18041815
18051816MACHINE_CONFIG_END
18061817
r245319r245320
19151926
19161927   MCFG_SCREEN_ADD("screen", RASTER)
19171928   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)
19191930   MCFG_SCREEN_PALETTE("palette")
19201931
19211932   MCFG_VIDEO_START_OVERRIDE(m72_state,rtype2)
r245319r245320
19461957
19471958   MCFG_SCREEN_ADD("screen", RASTER)
19481959   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)
19501961   MCFG_SCREEN_PALETTE("palette")
19511962
19521963   MCFG_VIDEO_START_OVERRIDE(m72_state,hharry)
r245319r245320
19771988
19781989   MCFG_SCREEN_ADD("screen", RASTER)
19791990   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)
19811992   MCFG_SCREEN_PALETTE("palette")
19821993
19831994   MCFG_VIDEO_START_OVERRIDE(m72_state,hharry)
r245319r245320
20092020
20102021   MCFG_SCREEN_ADD("screen", RASTER)
20112022   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)
20132024   MCFG_SCREEN_PALETTE("palette")
20142025
20152026   MCFG_VIDEO_START_OVERRIDE(m72_state,hharryu)
r245319r245320
20382049
20392050   MCFG_SCREEN_ADD("screen", RASTER)
20402051   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)
20422053   MCFG_SCREEN_PALETTE("palette")
20432054
20442055   MCFG_VIDEO_START_OVERRIDE(m72_state,poundfor)
r245319r245320
20692080
20702081   MCFG_SCREEN_ADD("screen", RASTER)
20712082   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)
20732084   MCFG_SCREEN_PALETTE("palette")
20742085
20752086   MCFG_VIDEO_START_OVERRIDE(m72_state,poundfor)
r245319r245320
34913502// the program roms failing their tests.  This is why we still have simulation code for many games
34923503// despite having Japanese version MCU roms for several of them.  See notes next to the sets
34933504
3494GAME( 1987, rtype,       0,        rtype,       rtype,    driver_device, 0,           ROT0,   "Irem", "R-Type (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3495GAME( 1987, rtypej,      rtype,    rtype,       rtype,    driver_device, 0,           ROT0,   "Irem", "R-Type (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3496GAME( 1987, rtypejp,     rtype,    rtype,       rtypep,   driver_device, 0,           ROT0,   "Irem", "R-Type (Japan prototype)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3497GAME( 1987, rtypeu,      rtype,    rtype,       rtype,    driver_device, 0,           ROT0,   "Irem (Nintendo of America license)", "R-Type (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3498GAME( 1987, rtypeb,      rtype,    rtype,       rtype,    driver_device, 0,           ROT0,   "bootleg", "R-Type (World bootleg)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3505GAME( 1987, rtype,       0,        rtype,       rtype,    driver_device, 0,           ROT0,   "Irem", "R-Type (World)", GAME_NO_COCKTAIL )
3506GAME( 1987, rtypej,      rtype,    rtype,       rtype,    driver_device, 0,           ROT0,   "Irem", "R-Type (Japan)", GAME_NO_COCKTAIL )
3507GAME( 1987, rtypejp,     rtype,    rtype,       rtypep,   driver_device, 0,           ROT0,   "Irem", "R-Type (Japan prototype)", GAME_NO_COCKTAIL )
3508GAME( 1987, rtypeu,      rtype,    rtype,       rtype,    driver_device, 0,           ROT0,   "Irem (Nintendo of America license)", "R-Type (US)", GAME_NO_COCKTAIL )
3509GAME( 1987, rtypeb,      rtype,    rtype,       rtype,    driver_device, 0,           ROT0,   "bootleg", "R-Type (World bootleg)", GAME_NO_COCKTAIL )
34993510
3500GAME( 1987, bchopper,    0,        m72,         bchopper, m72_state,     bchopper,    ROT0,   "Irem", "Battle Chopper", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3501GAME( 1987, mrheli,      bchopper, m72_8751,    bchopper, m72_state,     m72_8751,    ROT0,   "Irem", "Mr. HELI no Daibouken (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3511GAME( 1987, bchopper,    0,        m72,         bchopper, m72_state,     bchopper,    ROT0,   "Irem", "Battle Chopper", GAME_NO_COCKTAIL )
3512GAME( 1987, mrheli,      bchopper, m72_8751,    bchopper, m72_state,     m72_8751,    ROT0,   "Irem", "Mr. HELI no Daibouken (Japan)", GAME_NO_COCKTAIL )
35023513
3503GAME( 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?)
3504GAME( 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)
3514GAME( 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?)
3515GAME( 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)
35053516
3506GAME( 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?)
3507GAME( 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)
3517GAME( 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?)
3518GAME( 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)
35083519
3509GAME( 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?)
3510GAME( 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)
3511GAME( 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
3512GAME( 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 )
3520GAME( 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?)
3521GAME( 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)
3522GAME( 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
3523GAME( 1989, lohtb,       loht,     m72,         loht,     driver_device, 0,           ROT0,   "bootleg", "Legend of Hero Tonma (unprotected bootleg)", GAME_NOT_WORKING| GAME_NO_COCKTAIL )
35133524
3514GAME( 1989, xmultipl,    0,        xmultipl,    xmultipl, driver_device, 0,           ROT0,   "Irem", "X Multiply (World, M81)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3515GAME( 1989, xmultiplm72, xmultipl, xmultiplm72, xmultipl, m72_state,     m72_8751,    ROT0,   "Irem", "X Multiply (Japan, M72)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3525GAME( 1989, xmultipl,    0,        xmultipl,    xmultipl, driver_device, 0,           ROT0,   "Irem", "X Multiply (World, M81)", GAME_NO_COCKTAIL )
3526GAME( 1989, xmultiplm72, xmultipl, xmultiplm72, xmultipl, m72_state,     m72_8751,    ROT0,   "Irem", "X Multiply (Japan, M72)", GAME_NO_COCKTAIL )
35163527
3517GAME( 1989, dbreed,      0,        dbreed,      dbreed,   driver_device, 0,           ROT0,   "Irem", "Dragon Breed (M81 PCB version)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3518GAME( 1989, dbreedm72,   dbreed,   dbreedm72,   dbreed,   m72_state,     dbreedm72,   ROT0,   "Irem", "Dragon Breed (M72 PCB version)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3528GAME( 1989, dbreed,      0,        dbreed,      dbreed,   driver_device, 0,           ROT0,   "Irem", "Dragon Breed (M81 PCB version)", GAME_NO_COCKTAIL )
3529GAME( 1989, dbreedm72,   dbreed,   dbreedm72,   dbreed,   m72_state,     dbreedm72,   ROT0,   "Irem", "Dragon Breed (M72 PCB version)", GAME_NO_COCKTAIL )
35193530
3520GAME( 1989, rtype2,      0,        rtype2,      rtype2,   driver_device, 0,           ROT0,   "Irem", "R-Type II", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3521GAME( 1989, rtype2j,     rtype2,   rtype2,      rtype2,   driver_device, 0,           ROT0,   "Irem", "R-Type II (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3522GAME( 1989, rtype2jc,    rtype2,   rtype2,      rtype2,   driver_device, 0,           ROT0,   "Irem", "R-Type II (Japan, revision C)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3531GAME( 1989, rtype2,      0,        rtype2,      rtype2,   driver_device, 0,           ROT0,   "Irem", "R-Type II", GAME_NO_COCKTAIL )
3532GAME( 1989, rtype2j,     rtype2,   rtype2,      rtype2,   driver_device, 0,           ROT0,   "Irem", "R-Type II (Japan)", GAME_NO_COCKTAIL )
3533GAME( 1989, rtype2jc,    rtype2,   rtype2,      rtype2,   driver_device, 0,           ROT0,   "Irem", "R-Type II (Japan, revision C)", GAME_NO_COCKTAIL )
35233534
3524GAME( 1990, majtitle,    0,        majtitle,    rtype2,   driver_device, 0,           ROT0,   "Irem", "Major Title (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3525GAME( 1990, majtitlej,   majtitle, majtitle,    rtype2,   driver_device, 0,           ROT0,   "Irem", "Major Title (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3535GAME( 1990, majtitle,    0,        majtitle,    rtype2,   driver_device, 0,           ROT0,   "Irem", "Major Title (World)", GAME_NO_COCKTAIL )
3536GAME( 1990, majtitlej,   majtitle, majtitle,    rtype2,   driver_device, 0,           ROT0,   "Irem", "Major Title (Japan)", GAME_NO_COCKTAIL )
35263537
3527GAME( 1990, hharry,      0,        hharry,      hharry,   driver_device, 0,           ROT0,   "Irem", "Hammerin' Harry (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3528GAME( 1990, hharryu,     hharry,   hharryu,     hharry,   driver_device, 0,           ROT0,   "Irem America", "Hammerin' Harry (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3529GAME( 1990, dkgensan,    hharry,   hharryu,     hharry,   driver_device, 0,           ROT0,   "Irem", "Daiku no Gensan (Japan, M82)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3530GAME( 1990, dkgensanm72, hharry,   dkgenm72,    hharry,   m72_state,     dkgenm72,    ROT0,   "Irem", "Daiku no Gensan (Japan, M72)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3538GAME( 1990, hharry,      0,        hharry,      hharry,   driver_device, 0,           ROT0,   "Irem", "Hammerin' Harry (World)", GAME_NO_COCKTAIL )
3539GAME( 1990, hharryu,     hharry,   hharryu,     hharry,   driver_device, 0,           ROT0,   "Irem America", "Hammerin' Harry (US)", GAME_NO_COCKTAIL )
3540GAME( 1990, dkgensan,    hharry,   hharryu,     hharry,   driver_device, 0,           ROT0,   "Irem", "Daiku no Gensan (Japan, M82)", GAME_NO_COCKTAIL )
3541GAME( 1990, dkgensanm72, hharry,   dkgenm72,    hharry,   m72_state,     dkgenm72,    ROT0,   "Irem", "Daiku no Gensan (Japan, M72)", GAME_NO_COCKTAIL )
35313542
3532GAME( 1990, poundfor,    0,        poundfor,    poundfor, driver_device, 0,           ROT270, "Irem", "Pound for Pound (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3533GAME( 1990, poundforj,   poundfor, poundfor,    poundfor, driver_device, 0,           ROT270, "Irem", "Pound for Pound (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3534GAME( 1990, poundforu,   poundfor, poundfor,    poundfor, driver_device, 0,           ROT270, "Irem America", "Pound for Pound (US)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3543GAME( 1990, poundfor,    0,        poundfor,    poundfor, driver_device, 0,           ROT270, "Irem", "Pound for Pound (World)", GAME_NO_COCKTAIL )
3544GAME( 1990, poundforj,   poundfor, poundfor,    poundfor, driver_device, 0,           ROT270, "Irem", "Pound for Pound (Japan)", GAME_NO_COCKTAIL )
3545GAME( 1990, poundforu,   poundfor, poundfor,    poundfor, driver_device, 0,           ROT270, "Irem America", "Pound for Pound (US)", GAME_NO_COCKTAIL )
35353546
3536GAME( 1990, airduel,     0,        m72,         airduel,  m72_state,     airduel,     ROT270, "Irem", "Air Duel (Japan)", GAME_SUPPORTS_SAVE )
3547GAME( 1990, airduel,     0,        m72,         airduel,  m72_state,     airduel,     ROT270, "Irem", "Air Duel (Japan)", 0 )
35373548
3538GAME( 1991, cosmccop,    0,        cosmccop,    gallop,   driver_device, 0,           ROT0,   "Irem", "Cosmic Cop (World)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3539GAME( 1991, gallop,      cosmccop, m72,         gallop,   m72_state,     gallop,      ROT0,   "Irem", "Gallop - Armed Police Unit (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3549GAME( 1991, cosmccop,    0,        cosmccop,    gallop,   driver_device, 0,           ROT0,   "Irem", "Cosmic Cop (World)", GAME_NO_COCKTAIL )
3550GAME( 1991, gallop,      cosmccop, m72,         gallop,   m72_state,     gallop,      ROT0,   "Irem", "Gallop - Armed Police Unit (Japan)", GAME_NO_COCKTAIL )
35403551
3541GAME( 1991, kengo,       0,        kengo,       kengo,    driver_device, 0,           ROT0,   "Irem", "Ken-Go", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
3552GAME( 1991, kengo,       0,        kengo,       kengo,    driver_device, 0,           ROT0,   "Irem", "Ken-Go", GAME_NO_COCKTAIL )
trunk/src/mame/includes/m72.h
r245319r245320
1111public:
1212   m72_state(const machine_config &mconfig, device_type type, const char *tag)
1313      : 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"),
1420      m_maincpu(*this, "maincpu"),
1521      m_soundcpu(*this, "soundcpu"),
1622      m_mcu(*this, "mcu"),
r245319r245320
1925      m_gfxdecode(*this, "gfxdecode"),
2026      m_screen(*this, "screen"),
2127      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"),
2828      m_generic_paletteram_16(*this, "paletteram"),
2929      m_generic_paletteram2_16(*this, "paletteram2") { }
3030
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
3138   required_device<cpu_device> m_maincpu;
3239   required_device<cpu_device> m_soundcpu;
3340   optional_device<cpu_device> m_mcu;
r245319r245320
3643   required_device<gfxdecode_device> m_gfxdecode;
3744   required_device<screen_device> m_screen;
3845   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;
4646   required_shared_ptr<UINT16> m_generic_paletteram_16;
4747   required_shared_ptr<UINT16> m_generic_paletteram2_16;
4848
4949   UINT16 *m_protection_ram;
5050   emu_timer *m_scanline_timer;
5151   UINT8 m_irq_base;
52   UINT8 m_mcu_snd_cmd_latch;
53   UINT8 m_mcu_sample_latch;
54   UINT32 m_mcu_sample_addr;
5255   const UINT8 *m_protection_code;
5356   const UINT8 *m_protection_crc;
57   int m_prev[4];
58   int m_diff[4];
5459   UINT32 m_raster_irq_position;
5560   UINT16 *m_buffered_spriteram;
5661   tilemap_t *m_fg_tilemap;
r245319r245320
6065   INT32 m_scrollx2;
6166   INT32 m_scrolly2;
6267   INT32 m_video_off;
63
64   //poundfor specific
65   int m_prev[4];
66   int m_diff[4];
67
68   // majtitle specific
6968   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);
11081   DECLARE_WRITE16_MEMBER(bchopper_sample_trigger_w);
11182   DECLARE_WRITE16_MEMBER(nspirit_sample_trigger_w);
11283   DECLARE_WRITE16_MEMBER(imgfight_sample_trigger_w);
r245319r245320
11586   DECLARE_WRITE16_MEMBER(airduel_sample_trigger_w);
11687   DECLARE_WRITE16_MEMBER(dkgenm72_sample_trigger_w);
11788   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);
11893   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);
119107   DECLARE_WRITE16_MEMBER(rtype2_port02_w);
120108   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);
124121   TILE_GET_INFO_MEMBER(hharry_get_bg_tile_info);
125122   TILE_GET_INFO_MEMBER(rtype2_get_bg_tile_info);
126123   TILE_GET_INFO_MEMBER(rtype2_get_fg_tile_info);
127124   TILEMAP_MAPPER_MEMBER(majtitle_scan_rows);
128   
129125   void machine_start();
130126   void machine_reset();
131127   DECLARE_VIDEO_START(m72);
r245319r245320
138134   DECLARE_VIDEO_START(poundfor);
139135   DECLARE_MACHINE_START(kengo);
140136   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);
152140   INTERRUPT_GEN_MEMBER(fake_nmi);
153141   TIMER_CALLBACK_MEMBER(synch_callback);
154   TIMER_CALLBACK_MEMBER(scanline_interrupt);
142   TIMER_CALLBACK_MEMBER(m72_scanline_interrupt);
155143   TIMER_CALLBACK_MEMBER(kengo_scanline_interrupt);
156144   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);
162146   inline void rtype2_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum);
163147   void register_savestate();
164148   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);
166150   void majtitle_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
167151   int find_sample(int num);
168152   void copy_le(UINT16 *dest, const UINT8 *src, UINT8 bytes);
trunk/src/mame/video/m72.c
r245319r245320
77
88***************************************************************************/
99
10inline void m72_state::get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum)
10inline void m72_state::m72_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum)
1111{
1212   int code,attr,color,pri;
1313
r245319r245320
5454}
5555
5656
57TILE_GET_INFO_MEMBER(m72_state::get_bg_tile_info)
57TILE_GET_INFO_MEMBER(m72_state::m72_get_bg_tile_info)
5858{
59   get_tile_info(tileinfo,tile_index,m_videoram2,2);
59   m72_get_tile_info(tileinfo,tile_index,m_videoram2,2);
6060}
6161
62TILE_GET_INFO_MEMBER(m72_state::get_fg_tile_info)
62TILE_GET_INFO_MEMBER(m72_state::m72_get_fg_tile_info)
6363{
64   get_tile_info(tileinfo,tile_index,m_videoram1,1);
64   m72_get_tile_info(tileinfo,tile_index,m_videoram1,1);
6565}
6666
6767TILE_GET_INFO_MEMBER(m72_state::hharry_get_bg_tile_info)
6868{
69   get_tile_info(tileinfo,tile_index,m_videoram2,1);
69   m72_get_tile_info(tileinfo,tile_index,m_videoram2,1);
7070}
7171
7272TILE_GET_INFO_MEMBER(m72_state::rtype2_get_bg_tile_info)
r245319r245320
107107
108108VIDEO_START_MEMBER(m72_state,m72)
109109{
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);
112112
113113   m_buffered_spriteram = auto_alloc_array(machine(), UINT16, m_spriteram.bytes()/2);
114114
r245319r245320
178178   m_bg_tilemap->set_scrolldx(6,0);
179179   m_fg_tilemap->set_scrolldy(-128,-128);
180180   m_bg_tilemap->set_scrolldy(-128,-128);
181   
182   save_item(NAME(m_prev));
183   save_item(NAME(m_diff));
184181}
185182
186183VIDEO_START_MEMBER(m72_state,hharryu)
r245319r245320
221218   m_bg_tilemap->set_scrolldy(-128,-128);
222219
223220   register_savestate();
224   save_item(NAME(m_majtitle_rowscroll));
225221}
226222
227223VIDEO_START_MEMBER(m72_state,hharry)
228224{
229225   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);
231227
232228   m_buffered_spriteram = auto_alloc_array(machine(), UINT16, m_spriteram.bytes()/2);
233229
r245319r245320
257253
258254***************************************************************************/
259255
260READ16_MEMBER(m72_state::palette1_r)
256READ16_MEMBER(m72_state::m72_palette1_r)
261257{
262258   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
263259   offset &= ~0x100;
r245319r245320
265261   return m_generic_paletteram_16[offset] | 0xffe0;    /* only D0-D4 are connected */
266262}
267263
268READ16_MEMBER(m72_state::palette2_r)
264READ16_MEMBER(m72_state::m72_palette2_r)
269265{
270266   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
271267   offset &= ~0x100;
r245319r245320
278274   m_palette->set_pen_color(color,pal5bit(r),pal5bit(g),pal5bit(b));
279275}
280276
281WRITE16_MEMBER(m72_state::palette1_w)
277WRITE16_MEMBER(m72_state::m72_palette1_w)
282278{
283279   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
284280   offset &= ~0x100;
r245319r245320
291287         m_generic_paletteram_16[offset + 0x400]);
292288}
293289
294WRITE16_MEMBER(m72_state::palette2_w)
290WRITE16_MEMBER(m72_state::m72_palette2_w)
295291{
296292   /* A9 isn't connected, so 0x200-0x3ff mirrors 0x000-0x1ff etc. */
297293   offset &= ~0x100;
r245319r245320
304300         m_generic_paletteram2_16[offset + 0x400]);
305301}
306302
307WRITE16_MEMBER(m72_state::videoram1_w)
303WRITE16_MEMBER(m72_state::m72_videoram1_w)
308304{
309305   COMBINE_DATA(&m_videoram1[offset]);
310306   m_fg_tilemap->mark_tile_dirty(offset/2);
311307}
312308
313WRITE16_MEMBER(m72_state::videoram2_w)
309WRITE16_MEMBER(m72_state::m72_videoram2_w)
314310{
315311   COMBINE_DATA(&m_videoram2[offset]);
316312   m_bg_tilemap->mark_tile_dirty(offset/2);
317313}
318314
319WRITE16_MEMBER(m72_state::irq_line_w)
315WRITE16_MEMBER(m72_state::m72_irq_line_w)
320316{
321317   COMBINE_DATA(&m_raster_irq_position);
322318}
323319
324WRITE16_MEMBER(m72_state::scrollx1_w)
320WRITE16_MEMBER(m72_state::m72_scrollx1_w)
325321{
326322   COMBINE_DATA(&m_scrollx1);
327323}
328324
329WRITE16_MEMBER(m72_state::scrollx2_w)
325WRITE16_MEMBER(m72_state::m72_scrollx2_w)
330326{
331327   COMBINE_DATA(&m_scrollx2);
332328}
333329
334WRITE16_MEMBER(m72_state::scrolly1_w)
330WRITE16_MEMBER(m72_state::m72_scrolly1_w)
335331{
336332   COMBINE_DATA(&m_scrolly1);
337333}
338334
339WRITE16_MEMBER(m72_state::scrolly2_w)
335WRITE16_MEMBER(m72_state::m72_scrolly2_w)
340336{
341337   COMBINE_DATA(&m_scrolly2);
342338}
343339
344WRITE16_MEMBER(m72_state::dmaon_w)
340WRITE16_MEMBER(m72_state::m72_dmaon_w)
345341{
346342   if (ACCESSING_BITS_0_7)
347343      memcpy(m_buffered_spriteram, m_spriteram, m_spriteram.bytes());
348344}
349345
350346
351WRITE16_MEMBER(m72_state::port02_w)
347WRITE16_MEMBER(m72_state::m72_port02_w)
352348{
353349   if (ACCESSING_BITS_0_7)
354350   {
r245319r245320
413409
414410***************************************************************************/
415411
416void m72_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
412void m72_state::m72_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
417413{
418414   UINT16 *spriteram = m_buffered_spriteram;
419415   int offs;
r245319r245320
516512   }
517513}
518514
519UINT32 m72_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
515UINT32 m72_state::screen_update_m72(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
520516{
521517   if (m_video_off)
522518   {
r245319r245320
532528
533529   m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
534530   m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
535   draw_sprites(bitmap,cliprect);
531   m72_draw_sprites(bitmap,cliprect);
536532   m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
537533   m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
538534   return 0;
r245319r245320
569565   m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
570566   m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
571567   majtitle_draw_sprites(bitmap,cliprect);
572   draw_sprites(bitmap,cliprect);
568   m72_draw_sprites(bitmap,cliprect);
573569   m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
574570   m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
575571   return 0;
trunk/src/osd/eivc.h
r0r245320
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
23extern "C" long __cdecl _InterlockedIncrement(long volatile *);
24extern "C" long __cdecl _InterlockedDecrement(long volatile *);
25extern "C" long _InterlockedExchange(long volatile *, long);
26extern "C" long _InterlockedCompareExchange (long volatile *, long, long);
27extern "C" long _InterlockedExchangeAdd(long volatile *, long);
28extern "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
52INLINE 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
67INLINE 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
89INLINE 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
106INLINE 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
122INLINE 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
137INLINE 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
152INLINE 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
167INLINE INT32 _atomic_decrement32(INT32 volatile *ptr)
168{
169   return _InterlockedDecrement((volatile long *)ptr);
170}
171#endif
172
173
174#endif /* __EIVC__ */
trunk/src/osd/eivcx86.h
r0r245320
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
31INLINE 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
52INLINE 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
73INLINE 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
97INLINE 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
122INLINE 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
149INLINE 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
174INLINE 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
200INLINE 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
227INLINE 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
257INLINE 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
287INLINE 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
315INLINE 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
342INLINE 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
368INLINE 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
394INLINE 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
417INLINE 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
443INLINE 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
480INLINE osd_ticks_t _get_profile_ticks(void)
481{
482   return __rdtsc();
483}
484
485#else
486
487INLINE 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__ */
trunk/src/osd/eminline.h
r245319r245320
1818#if defined(__GNUC__)
1919
2020#if defined(__i386__) || defined(__x86_64__)
21
22
23INLINE void ATTR_FORCE_INLINE
24osd_yield_processor(void)
25{
26   __asm__ __volatile__ ( " rep ; nop ;" );
27}
28
29
30#if defined(__x86_64__)
31
32//============================================================
33//  osd_exchange64
34//============================================================
35
36INLINE 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
56INLINE void ATTR_FORCE_INLINE
57osd_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
70INLINE 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__)
2192#include "eigccx86.h"
2293#elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__)
2394#include "eigccppc.h"
2495#else
25#include "osinline.h"
96#error "no matching assembler implementations found - please compile with NOASM=1"
2697#endif
2798
2899#else
29100
30#include "osinline.h"
101#if defined(_MSC_VER)
31102
103#if (defined(_M_IX86) || defined(_M_X64))
104#include "eivcx86.h"
32105#endif
106
107#include "eivc.h"
108
109INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange);
110INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange);
111INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta);
112
113#ifdef PTR64
114INT64 win_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange);
33115#endif
34116
35117
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
36146/***************************************************************************
37147    INLINE MATH FUNCTIONS
38148***************************************************************************/
trunk/src/osd/modules/opengl/gl_shader_mgr.c
r245319r245320
11#include <stdio.h>   /* snprintf */
22#include <stdlib.h>  /* malloc */
33
4#include "osdcomm.h"
45#include "osd_opengl.h"
56
67#include "gl_shader_mgr.h"
trunk/src/osd/modules/sync/sync_ntc.c
r245319r245320
3131
3232// MAME headers
3333#include "osdcore.h"
34#include "osinline.h"
3534#include "osdsync.h"
3635
3736#include "eminline.h"
trunk/src/osd/modules/sync/sync_os2.c
r245319r245320
2121
2222// MAME headers
2323#include "osdcore.h"
24#include "osinline.h"
2524#include "osdsync.h"
2625
2726#include "eminline.h"
trunk/src/osd/modules/sync/sync_sdl.c
r245319r245320
1818
1919// MAME headers
2020#include "osdcore.h"
21#include "osinline.h"
2221#include "osdsync.h"
2322
2423#include "eminline.h"
trunk/src/osd/modules/sync/sync_windows.c
r245319r245320
1414
1515// MAME headers
1616#include "osdcore.h"
17#include "osinline.h"
17#include "eminline.h"
1818#include "osdsync.h"
1919
2020
trunk/src/osd/osdcomm.h
r245319r245320
223223   #define __has_feature(x) 0
224224#endif
225225
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>
236static __inline double fmin(double x, double y){ return (x < y) ? x : y; }
237static __inline double fmax(double x, double y){ return (x > y) ? x : y; }
238static __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
226245#endif  /* __OSDCOMM_H__ */
trunk/src/osd/sdl/osinline.h
r245319r245320
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
20INLINE void ATTR_FORCE_INLINE
21osd_yield_processor(void)
22{
23   __asm__ __volatile__ ( " rep ; nop ;" );
24}
25
26
27#if defined(__x86_64__)
28
29//============================================================
30//  osd_exchange64
31//============================================================
32
33INLINE 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
53INLINE void ATTR_FORCE_INLINE
54osd_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
67INLINE 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__ */
trunk/src/osd/sdl/sdlprefix.h
r245319r245320
7777
7878#endif /* SDLMAME_UNIX */
7979
80#ifdef _MSC_VER
81void *__cdecl _alloca(size_t);
82#define alloca _alloca
83#endif
84
8580#ifdef __GNUC__
8681#define alloca  __builtin_alloca
8782#endif
trunk/src/osd/sdl/watchdog.c
r245319r245320
1111
1212#include "osdcomm.h"
1313#include "osdcore.h"
14#ifdef SDLMAME_NOASM
1514#include "eminline.h"
16#else
17#include "osinline.h"
18#endif
1915
2016#include "watchdog.h"
2117#include "modules/lib/osdlib.h"
trunk/src/osd/windows/eivc.h
r245319r245320
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
23extern "C" long __cdecl _InterlockedIncrement(long volatile *);
24extern "C" long __cdecl _InterlockedDecrement(long volatile *);
25extern "C" long _InterlockedExchange(long volatile *, long);
26extern "C" long _InterlockedCompareExchange (long volatile *, long, long);
27extern "C" long _InterlockedExchangeAdd(long volatile *, long);
28extern "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
52INLINE 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
67INLINE 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
89INLINE 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
106INLINE 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
122INLINE 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
137INLINE 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
152INLINE 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
167INLINE INT32 _atomic_decrement32(INT32 volatile *ptr)
168{
169   return _InterlockedDecrement((volatile long *)ptr);
170}
171#endif
172
173
174#endif /* __EIVC__ */
trunk/src/osd/windows/eivcx86.h
r245319r245320
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
31INLINE 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
52INLINE 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
73INLINE 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
97INLINE 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
122INLINE 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
149INLINE 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
174INLINE 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
200INLINE 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
227INLINE 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
257INLINE 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
287INLINE 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
315INLINE 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
342INLINE 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
368INLINE 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
394INLINE 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
417INLINE 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
443INLINE 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
480INLINE osd_ticks_t _get_profile_ticks(void)
481{
482   return __rdtsc();
483}
484
485#else
486
487INLINE 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__ */
trunk/src/osd/windows/osinline.h
r245319r245320
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
22INT32 win_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange);
23INT32 win_atomic_exchange32(INT32 volatile *ptr, INT32 exchange);
24INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta);
25
26#ifdef PTR64
27INT64 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__ */
trunk/src/osd/windows/winprefix.h
r245319r245320
1010#define _WIN32_WINNT 0x0501 // Windows XP
1111#endif
1212
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>
23static __inline double fmin(double x, double y){ return (x < y) ? x : y; }
24static __inline double fmax(double x, double y){ return (x > y) ? x : y; }
25static __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
4113#ifdef __GNUC__
4214#ifndef alloca
4315#define alloca  __builtin_alloca


Previous 199869 Revisions Next


© 1997-2024 The MAME Team