registry = ipsRegistry::instance(); $this->settings =& $this->registry->fetchSettings(); } public function getOutput() { return; } public function replaceOutput($output, $key) { require_once( IPSLib::getAppDir('ibprobattle') . '/sources/battleHooks.php' ); $this->battleHook = new battleHooks( $this->registry ); return $this->battleHook->statsTopicView($output, $key); } } ?>registry = ipsRegistry::instance(); $this->settings =& $this->registry->fetchSettings(); } public function getOutput() { require_once( IPSLib::getAppDir('ibprobattle') . '/sources/battleHooks.php' ); $this->battleHook = new battleHooks( $this->registry ); return $this->battleHook->statsTopicViewJS(); } } ?> ARCADE 0.197 - Page 3 - ARCADE - 1Emulation.com

Jump to content

Welcome to 1Emulation.com
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

ARCADE 0.197

- - - - -

  • Please log in to reply
36 replies to this topic

#23
Robert

Robert

    Alchemist

  • User Admin
  • 11,613 posts
  • Gender:Male
  • Location:Land of Oz

The new version is already in the process of being built.

 

You'll have to apply the change to your build.

 

For the future if you could show a diff with the minimum changes required then it could be added to 0.199



#24
haynor666

haynor666

    Proud Fan

  • Premium Members
  • 102 posts
  • Gender:Male
  • Location:Tarnobrzeg, Poland

Ok, here it is:

 

diff -Nru src/mame/drivers/ironhors.cpp src-fx/mame/drivers/ironhors.cpp
--- src/mame/drivers/ironhors.cpp	Tue May 29 19:01:45 2018
+++ src-fx/mame/drivers/ironhors.cpp	Thu May 31 19:56:19 2018
@@ -25,20 +25,31 @@
  *
  *************************************/
 
-TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::irq)
+TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::interrupt_tick)
+ {
+	uint8_t ticks_mask = ~m_interrupt_ticks & (m_interrupt_ticks + 1); // 0->1
+	m_interrupt_ticks++;
+	// NMI on d0
+	if (ticks_mask & m_interrupt_mask & 1)
+		m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+
+	// IRQ on d4
+	if (ticks_mask & m_interrupt_mask<<2 & 16)
+		m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
+}
+
+WRITE8_MEMBER(ironhors_state::irq_ctrl_w)
 {
-	int scanline = param;
+	/* bits 0/1/2 = interrupt enable */
+	uint8_t ack_mask = ~data & m_interrupt_mask; // 1->0
+
+	if (ack_mask & 1)
+		m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
+
+	if (ack_mask & 6)
+		m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE);
 
-	if (scanline == 240)
-	{
-		if (*m_interrupt_enable & 4)
-			m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
-	}
-	else if (((scanline+16) % 64) == 0)
-	{
-		if (*m_interrupt_enable & 1)
-			m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
-	}
+	m_interrupt_mask = data & 7;
 }
 
 WRITE8_MEMBER(ironhors_state::sh_irqtrigger_w)
@@ -63,7 +74,7 @@
 {
 	map(0x0000, 0x0002).ram();
 	map(0x0003, 0x0003).ram().w(this, FUNC(ironhors_state::charbank_w));
-	map(0x0004, 0x0004).ram().share("int_enable");
+	map(0x0004, 0x0004).ram().w(this, FUNC(ironhors_state::irq_ctrl_w));
 	map(0x0005, 0x001f).ram();
 	map(0x0020, 0x003f).ram().share("scroll");
 	map(0x0040, 0x005f).ram();
@@ -122,7 +133,7 @@
 
 
 	map(0x1800, 0x1800).w(this, FUNC(ironhors_state::sh_irqtrigger_w));
-	map(0x1a00, 0x1a00).ram().share("int_enable");
+	map(0x1a00, 0x1a00).ram().w(this, FUNC(ironhors_state::irq_enable_w));
 	map(0x1a01, 0x1a01).ram().w(this, FUNC(ironhors_state::charbank_w));
 	map(0x1a02, 0x1a02).w(this, FUNC(ironhors_state::palettebank_w));
 //  map(0x1c00, 0x1fff).ram();
@@ -355,6 +366,10 @@
 	save_item(NAME(m_palettebank));
 	save_item(NAME(m_charbank));
 	save_item(NAME(m_spriterambank));
+	save_item(NAME(m_interrupt_mask));
+	save_item(NAME(m_interrupt_ticks));
+	save_item(NAME(m_irq_enable));
+	save_item(NAME(m_nmi_enable));
 }
 
 void ironhors_state::machine_reset()
@@ -362,6 +377,10 @@
 	m_palettebank = 0;
 	m_charbank = 0;
 	m_spriterambank = 0;
+	m_interrupt_mask = 0;
+	m_interrupt_ticks = 0;
+	m_irq_enable = 0;
+	m_nmi_enable = 0;
 }
 
 /*
@@ -382,21 +401,18 @@
 MACHINE_CONFIG_START(ironhors_state::ironhors)
 
 	/* basic machine hardware */
-	MCFG_DEVICE_ADD("maincpu", MC6809E, 18432000/6)        /* 3.072 MHz??? mod by Shingo Suzuki 1999/10/15 */
+	MCFG_DEVICE_ADD("maincpu", MC6809E, MASTER_CLOCK/12)
 	MCFG_DEVICE_PROGRAM_MAP(master_map)
-	MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ironhors_state, irq, "screen", 0, 1)
+	MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", ironhors_state, interrupt_tick, "screen", 0, 16)
 
-	MCFG_DEVICE_ADD("soundcpu", Z80, 18432000/6)      /* 3.072 MHz */
+	MCFG_DEVICE_ADD("soundcpu", Z80, MASTER_CLOCK/6)      /* 3.072 MHz */
 	MCFG_DEVICE_PROGRAM_MAP(slave_map)
 	MCFG_DEVICE_IO_MAP(slave_io_map)
 
 
 	/* video hardware */
 	MCFG_SCREEN_ADD("screen", RASTER)
-	MCFG_SCREEN_REFRESH_RATE(30)
-	MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
-	MCFG_SCREEN_SIZE(32*8, 32*8)
-	MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1)
+	MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 396, 8, 248, 256, 16, 240)
 	MCFG_SCREEN_UPDATE_DRIVER(ironhors_state, screen_update)
 	MCFG_SCREEN_PALETTE("palette")
 
@@ -410,7 +426,7 @@
 
 	MCFG_GENERIC_LATCH_8_ADD("soundlatch")
 
-	MCFG_DEVICE_ADD("ym2203", YM2203, 18432000/6)
+	MCFG_DEVICE_ADD("ym2203", YM2203, MASTER_CLOCK/6)
 	MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(*this, ironhors_state, filter_w))
 
 	MCFG_SOUND_ROUTE(0, "disc_ih", 1.0, 0)
@@ -423,20 +439,26 @@
 
 MACHINE_CONFIG_END
 
-TIMER_DEVICE_CALLBACK_MEMBER(ironhors_state::farwest_irq)
+WRITE8_MEMBER(ironhors_state::irq_enable_w)
+ {
+	uint8_t mask = data & 0x07;		// check only bits 0,1,2
+	m_nmi_enable = mask & 0x01;		// bit 0 NMI
+	m_irq_enable = mask & 0x05;		// bit 2 IRQ
+	
+	// bit 4 is also used....
+}
+
+INTERRUPT_GEN_MEMBER(ironhors_state::farwest_irq)
 {
-	int scanline = param;
+	if (m_irq_enable)
+		m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
+}
 
-	if ((scanline % 2) == 1)
-	{
-		if (*m_interrupt_enable & 4)
-			m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
-	}
-	else if ((scanline % 2) == 0)
-	{
-		if (*m_interrupt_enable & 1)
-			m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
-	}
+INTERRUPT_GEN_MEMBER(ironhors_state::farwest_irq_nmi)
+{
+	if (m_nmi_enable) {
+		m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
+		m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); }
 }
 
 READ8_MEMBER(ironhors_state::farwest_soundlatch_r)
@@ -449,8 +471,9 @@
 
 	MCFG_DEVICE_MODIFY("maincpu")
 	MCFG_DEVICE_PROGRAM_MAP(farwest_master_map)
-	MCFG_DEVICE_MODIFY("scantimer")
-	MCFG_TIMER_DRIVER_CALLBACK(ironhors_state, farwest_irq)
+	MCFG_DEVICE_VBLANK_INT_DRIVER("screen", ironhors_state, farwest_irq)
+	MCFG_DEVICE_PERIODIC_INT_DRIVER(ironhors_state, farwest_irq_nmi, 480)		/* 8*60, seems ok */
+	MCFG_DEVICE_REMOVE("scantimer")
 
 	MCFG_DEVICE_MODIFY("soundcpu")
 	MCFG_DEVICE_PROGRAM_MAP(farwest_slave_map)
diff -Nru src/mame/includes/ironhors.h src-fx/mame/includes/ironhors.h
--- src/mame/includes/ironhors.h	Tue May 29 19:01:55 2018
+++ src-fx/mame/includes/ironhors.h	Thu May 31 20:47:35 2018
@@ -10,6 +10,8 @@
 #include "machine/timer.h"
 #include "sound/discrete.h"
 
+#define MASTER_CLOCK        XTAL(18'432'000)
+
 class ironhors_state : public driver_device
 {
 public:
@@ -21,7 +23,6 @@
 		m_palette(*this, "palette"),
 		m_soundlatch(*this, "soundlatch"),
 		m_disc_ih(*this, "disc_ih"),
-		m_interrupt_enable(*this, "int_enable"),
 		m_scroll(*this, "scroll"),
 		m_colorram(*this, "colorram"),
 		m_videoram(*this, "videoram"),
@@ -36,12 +37,17 @@
 	DECLARE_WRITE8_MEMBER(flipscreen_w);
 	DECLARE_WRITE8_MEMBER(filter_w);
 	DECLARE_READ8_MEMBER(farwest_soundlatch_r);
+	DECLARE_WRITE8_MEMBER(irq_ctrl_w);
+	DECLARE_WRITE8_MEMBER(irq_enable_w);
 
 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
 	uint32_t screen_update_farwest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
 
 	TIMER_DEVICE_CALLBACK_MEMBER(irq);
 	TIMER_DEVICE_CALLBACK_MEMBER(farwest_irq);
+	TIMER_DEVICE_CALLBACK_MEMBER(interrupt_tick);
+	INTERRUPT_GEN_MEMBER(farwest_irq);
+	INTERRUPT_GEN_MEMBER(farwest_irq_nmi);
 
 	DECLARE_PALETTE_INIT(ironhors);
 	DECLARE_VIDEO_START(farwest);
@@ -68,7 +74,7 @@
 	required_device<discrete_device> m_disc_ih;
 
 	/* memory pointers */
-	required_shared_ptr<uint8_t> m_interrupt_enable;
+	//required_shared_ptr<uint8_t> m_interrupt_enable;
 	required_shared_ptr<uint8_t> m_scroll;
 	required_shared_ptr<uint8_t> m_colorram;
 	required_shared_ptr<uint8_t> m_videoram;
@@ -80,6 +86,10 @@
 	int        m_palettebank;
 	int        m_charbank;
 	int        m_spriterambank;
+	uint8_t    m_interrupt_mask;
+	uint8_t    m_interrupt_ticks;
+	uint8_t    m_irq_enable;
+	uint8_t    m_nmi_enable;
 
 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
 	void farwest_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );

 



#25
Robert

Robert

    Alchemist

  • User Admin
  • 11,613 posts
  • Gender:Male
  • Location:Land of Oz
That's too much typing. Maybe you could attach your source file here instead, or point me to where it can be found.

#26
haynor666

haynor666

    Proud Fan

  • Premium Members
  • 102 posts
  • Gender:Male
  • Location:Tarnobrzeg, Poland

That is also possible. Files attached.

Attached Files



#27
Robert

Robert

    Alchemist

  • User Admin
  • 11,613 posts
  • Gender:Male
  • Location:Land of Oz

Thanks, added.



#28
haynor666

haynor666

    Proud Fan

  • Premium Members
  • 102 posts
  • Gender:Male
  • Location:Tarnobrzeg, Poland

Well... for version 200 this change won't be needed. Angelo Salese fixed game to 61 Hz.



#29
Robert

Robert

    Alchemist

  • User Admin
  • 11,613 posts
  • Gender:Male
  • Location:Land of Oz

I saw that, and took a copy of the old one just in case you didn't like what he did.

 

But if you're sure you're happy with what he's done, I'll just use the standard MAME code.

 

Let me know.



#30
mamesick

mamesick

    Member

  • Members+
  • 86 posts

In my opinion Kale fix is a nasty hack. ARCADE code for ironhors is more accurate emulation and it's based on gberet code which was verified to be correct. Hardware is pretty the same, memory maps, etc. etc.



#31
haynor666

haynor666

    Proud Fan

  • Premium Members
  • 102 posts
  • Gender:Male
  • Location:Tarnobrzeg, Poland
I did check latest mame git and Iron Horse works fine with syncrefresh. Tested with my own groovymame build I'm sure it will work with future ARCADE32/64. MameSick, maybe it's not the proper way but You know how hard is to convince some devs. For end user this does not matter either and it reduces ARCADE32/64 code vs official mame.

Edited by haynor666, 19 July 2018 - 08:05 PM.


#32
Robert

Robert

    Alchemist

  • User Admin
  • 11,613 posts
  • Gender:Male
  • Location:Land of Oz

Currently the old code is in use, but obviously I'd like to use official code instead.

 

Mamesick what do you prefer?



#33
mamesick

mamesick

    Member

  • Members+
  • 86 posts
Life (and releasing ARCADE build) must be easier so go ahead with official code. Maybe you could keep a copy of old code for future use, who knows what will happen.

Edited by mamesick, 20 July 2018 - 07:40 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users