Previous Thread
Next Thread
Print Thread
Page 12 of 14 1 2 10 11 12 13 14
Ensjo #65311 10/28/10 10:44 PM
Joined: Jul 2007
Posts: 4,625
A
Very Senior Member
Offline
Very Senior Member
A
Joined: Jul 2007
Posts: 4,625
OK, "Aventura.wav". is working. smile
Some bytes was missing before, 168522 bytes instead of 168558 bytes.

Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Originally Posted by Curt Coder
Non-hacky solution [for emulating NE555's non-simetric wave] would be to either emulate an NE555 chip properly, or have 2 scanline timers (one for ASSERT, another for CLEAR_LINE).
Originally Posted by R. Belmont
For the two-timers solution you'd start the second timer in the service routine for the first one. It's a fairly common pattern in MAME/MESS.
Guys, searching MESS sources for "MDRV_TIMER_ADD_PERIODIC" I found this (src/mame/drivers/mw8080bw.c):
Code
#define SPCENCTR_STROBE_FREQ        (9.00)  /* Hz - calculated from the 555 timer */
#define SPCENCTR_STROBE_DUTY_CYCLE  (95)    /* % */


static TIMER_DEVICE_CALLBACK( spcenctr_strobe_timer_callback )
{
    mw8080bw_state *state = timer.machine->driver_data<mw8080bw_state>();
    output_set_value("STROBE", param && state->spcenctr_strobe_state);
}

[...]

static MACHINE_CONFIG_DERIVED( spcenctr, mw8080bw_root )

    [...]

    /* timers */
    MDRV_TIMER_ADD_PERIODIC("strobeon", spcenctr_strobe_timer_callback, HZ(SPCENCTR_STROBE_FREQ))
    MDRV_TIMER_PARAM(TRUE)  /* indicates strobe ON */

    MDRV_TIMER_ADD_PERIODIC("strobeoff", spcenctr_strobe_timer_callback, HZ(SPCENCTR_STROBE_FREQ))
    MDRV_TIMER_START_DELAY(HZ(SPCENCTR_STROBE_FREQ * 100 / SPCENCTR_STROBE_DUTY_CYCLE))
    MDRV_TIMER_PARAM(FALSE) /* indicates strobe OFF */

    [...]

MACHINE_CONFIG_END
It seems that this MDRV_TIMER_START_DELAY can do the magic, is it so?

Last edited by Ensjo; 10/29/10 12:14 PM.
Ensjo #65313 10/29/10 12:15 PM
Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
Correct.

Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Well... I did this:
Code
#define MC1000_NE555_FREQ       (60) /* Hz - calculated from the 555 timer */
#define MC1000_NE555_DUTY_CYCLE	(.16666) /* % */

static TIMER_DEVICE_CALLBACK( ne555_tick )
{
    mc1000_state *state = timer.machine->driver_data<mc1000_state>();

    // (state->ne555_int not needed anymore and can be done with?)
    state->ne555_int = param;

    cputag_set_input_line(timer.machine, Z80_TAG, INPUT_LINE_IRQ0, param);
}
...and...
Code
static MACHINE_CONFIG_START( mc1000, mc1000_state )

    [...]

    /* timers */
    MDRV_TIMER_ADD_PERIODIC("ne555assert", ne555_tick, HZ(MC1000_NE555_FREQ))
    MDRV_TIMER_PARAM(ASSERT_LINE)

    MDRV_TIMER_ADD_PERIODIC("ne555clear", ne555_tick, HZ(MC1000_NE555_FREQ))
    MDRV_TIMER_START_DELAY(HZ(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE))
    MDRV_TIMER_PARAM(CLEAR_LINE)

    [...]

MACHINE_CONFIG_END
Now, when I run that machine code program I made before I get:
Code
CALL 16128
..................1.............
.................1..............
................1...............
...............1................
..............1.................
.............1..................
............1...................
...........1....................
........
OK
Compare this to the real MC-1000 output:
Code
CALL 16128
...............1.....1.....1....
1........1.....1.....1.....1....
1.......1..............1....1...
2.1.....1.....1.....1......1....
1...............1...............
2......1.....1.............1....
2.........1.....1.....1.....1...
1........1.....1.....1.....1....
1.......1......1.....1.....1....
1.......
OK
Now... what stands for the difference? Is the emulated Z80 clock faster than the original machine (so that the program can print more dots before being interrupted by NE555)? Doesn't NE555 really produce interrupts at 60MHz? Or what? (And how could I test the hypotheses?)

Last edited by Ensjo; 10/29/10 04:28 PM.
Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Originally Posted by Justin
For natural keyboard mode you can list two characters for the same key, e.g. PORT_CHAR('4') PORT_CHAR('$')

The PORT_CHAR(UCHAR_SHIFT_1) then tells MESS that this is the modifier key that needs to be held down to get the second character listed. This allows things like copy-paste into MESS to work.
You having said that, I tried to paste something to emulated MC-1000, and noticed that some of the characters disappeared, more specifically, the keys that in MC-1000 are associated to the joystick (up-down-right-left-button for player 1 are I-Q-Y-1-9, and for player 2 are H-P-X-O-@).

I realized that in the ports definition, those keys are not associated to IPT_KEYBOARD like the others, only to IPT_JOYSTICK_UP etc.:
Code
    PORT_START("ROW0")
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@')
    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
    PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )

    PORT_START("ROW1")
    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
    PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
Then I thought of creating other two ports for the joysticks, and mixing them later. I did this:
Code
	PORT_START("JOY0")
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)        /* @ */
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)    /* H */
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)  /* P */
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)  /* X */
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) /* 0 */
	PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START("JOY1")
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    /* I */
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  /* Q */
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  /* Y */
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) /* 1 */
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )        /* 9 */
	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START("ROW0")
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@')
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )

	PORT_START("ROW1")
	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
And then:
Code
static READ8_DEVICE_HANDLER( keydata_r )
{
	mc1000_state *state = device->machine->driver_data<mc1000_state>();

	UINT8 data = 0xff;

	if (!BIT(state->keylatch, 0)) data &= input_port_read(device->machine, "ROW0") &
                                              input_port_read(device->machine, "JOY0");
	if (!BIT(state->keylatch, 1)) data &= input_port_read(device->machine, "ROW1") &
	                                      input_port_read(device->machine, "JOY1");
	if (!BIT(state->keylatch, 2)) data &= input_port_read(device->machine, "ROW2");
	if (!BIT(state->keylatch, 3)) data &= input_port_read(device->machine, "ROW3");
	if (!BIT(state->keylatch, 4)) data &= input_port_read(device->machine, "ROW4");
	if (!BIT(state->keylatch, 5)) data &= input_port_read(device->machine, "ROW5");
	if (!BIT(state->keylatch, 6)) data &= input_port_read(device->machine, "ROW6");
	if (!BIT(state->keylatch, 7)) data &= input_port_read(device->machine, "ROW7");

	data = (input_port_read(device->machine, "MODIFIERS") & 0xc0) | (data & 0x3f);

	if (cassette_input(state->cassette) < +0.0)	data &= 0x7f;

	return data;
}
Then I could paste successfully. smile

But... how can I disable joystick mapping to keyboard in MESS? In my MacBook Pro I edited mc1000.ini and changed "joystick" option to 0, and it still mapping. frown

Last edited by Ensjo; 10/29/10 05:45 PM.
Ensjo #65318 10/30/10 07:48 PM
Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Hello, people. I opened my real MC-1000 to know what are the resistors that are linked to the NE555 astable circuit.

Then I used this online toot to interpret the color codes:
  • R16 = brown, black, red, gold = 1000 ohms
  • R17 = orange, white, yellow, gold = 390 Kohms

Then I could reconstitute the NE555 part of MC-1000's awfully blurred schematics:
Code
 +---------*---*---o V+
 |         |   |
+-+        |   |
| |309K    |   |
| |R17     |8  |4
+-+      +-------+
 |      7|       |3
 *-------|       |-------> /INT (Z80)
 |       |       |
 |       |       |
+-+R16  2| IC 28 |
| |1K +--|       |
| |   |  |  555  |
+-+   |  |       |
 |    | 6|       |5
 *----*�-|       |---+
 |       |       |   |
---C30   +-------+  ---C29
---103       |1     ---103
_|_         _|_     _|_
///         ///     ///
Then I used this other online tool to calculate the square wave produced by NE555.

I filled the fields with:
  • 0.00000001 farads (C = C30; "103" = 10 x 10� pF = 0.01 �F)
  • 390000 ohms (resistor 1 = R17)
  • 1000 ohms (resistor 2 = R16)

...and got:
  • 99.74489795918367 Duty Cycle Percentage
  • 368.1126130105722 Frequency in Hertz
  • 0.00000693 Seconds Low
  • 0.0027096299999999998 Seconds High

368Hz?! What do you say? I know nothing of electronics. Did I use the right values? Are this results correct?

Last edited by Ensjo; 10/30/10 07:52 PM.
Ensjo #65319 10/30/10 08:13 PM
Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
368 Hz sounds ballpark given your real hardware has roughly 1/5th as many 1s between dots as the 60 Hz MESS version, and 5*60 = 300.

Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Well, I used 368 Hz and a 99.745 duty cycle percentage, and got this:
Code
CALL 16128
..1..1..1...1..1..1..1...1..1..1
.1..1...1..1..1...1..1..1..1...1
.1..1..1..1...1..1..1...1..1..1.
2..1...1..1..1..1...1..1..1..1..
2..1..1..1...1..1..1..1...1..1..
2.1..1...1..1..1..1...1..1..1...
2..........1..1..1..1...1..1..1.
2..1...1..1..1...1..1..1..1...1.
2..1..1..1...1..1..1...1..1..1..
2.1...1..1..1..1...1..1..1..1...
.1..1...1..1..1..1.
OK
The frequency is a little too high compared to the machine, but I'll leave it like this for the time being. At least it's much more close to the real machine than before. smile

So... HERE IS OUR NEW DIFF: smile Someone apply it, please.
Code
Index: src/mess/drivers/mc1000.c
===================================================================
--- src/mess/drivers/mc1000.c	(revision 9475)
+++ src/mess/drivers/mc1000.c	(working copy)
@@ -164,22 +164,39 @@
 /* Input Ports */
 
 static INPUT_PORTS_START( mc1000 )
+	PORT_START("JOY0")
+	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)        /* = '@' */
+	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)    /* = 'H' */
+	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)  /* = 'P' */
+	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)  /* = 'X' */
+	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) /* = '0' */
+	PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+	PORT_START("JOY1")
+	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
+	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    /* = 'I' */
+	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  /* = 'Q' */
+	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  /* = 'Y' */
+	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) /* = '1' */
+	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )        /* = '9' */
+	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
+
 	PORT_START("ROW0")
-	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@')
-	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
-	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
-	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
-	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
+	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('@')
+	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
+	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
+	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X')
+	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
 
 	PORT_START("ROW1")
 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
-	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
-	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
-	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
-	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
-	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
+	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
+	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
+	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
+	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
+	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
 	PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
 
 	PORT_START("ROW2")
@@ -238,7 +255,7 @@
 
 	PORT_START("MODIFIERS")
 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
-	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
+	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
 
 	PORT_INCLUDE( m6847_artifacting )
 INPUT_PORTS_END
@@ -294,8 +311,10 @@
 
 	UINT8 data = 0xff;
 
-	if (!BIT(state->keylatch, 0)) data &= input_port_read(device->machine, "ROW0");
-	if (!BIT(state->keylatch, 1)) data &= input_port_read(device->machine, "ROW1");
+	if (!BIT(state->keylatch, 0)) data &= input_port_read(device->machine, "ROW0") &
+	                                      input_port_read(device->machine, "JOY0");
+	if (!BIT(state->keylatch, 1)) data &= input_port_read(device->machine, "ROW1") &
+	                                      input_port_read(device->machine, "JOY1");
 	if (!BIT(state->keylatch, 2)) data &= input_port_read(device->machine, "ROW2");
 	if (!BIT(state->keylatch, 3)) data &= input_port_read(device->machine, "ROW3");
 	if (!BIT(state->keylatch, 4)) data &= input_port_read(device->machine, "ROW4");
@@ -378,20 +397,53 @@
 
 /* Machine Driver */
 
+/*
+ 
+ Interrupt generator:
+ NE555 chip in astable circuit.
+ 
+  +---------*---*---o V+
+  |         |   |
+ +-+        |   |
+ | |309K    |   |
+ | |R17     |8  |4
+ +-+      +-------+
+  |      7|       |3
+  *-------|       |-------> /INT (Z80)
+  |       |       |
+  |       |       |
+ +-+R16  2| IC 28 |
+ | |1K +--|       |
+ | |   |  |  555  |
+ +-+   |  |       |
+  |    | 6|       |5
+  *----*�-|       |---+
+  |       |       |   |
+ ---C30   +-------+  ---C29
+ ---103       |1     ---103
+ _|_         _|_     _|_
+ ///         ///     ///
+ 
+ Calculated properties:
+ 
+ * 99.74489795918367 Duty Cycle Percentage
+ * 368.1126130105722 Frequency in Hertz
+ * 0.00000693 Seconds Low
+ * 0.0027096299999999998 Seconds High
+ 
+ */
+
+#define MC1000_NE555_FREQ       (368) /* Hz */
+#define MC1000_NE555_DUTY_CYCLE (99.745) /* % */
+
 static TIMER_DEVICE_CALLBACK( ne555_tick )
 {
 	mc1000_state *state = timer.machine->driver_data<mc1000_state>();
 
-	if (state->ne555_int == ASSERT_LINE)
-	{
-		state->ne555_int = CLEAR_LINE;
-	}
-	else
-	{
-		state->ne555_int = ASSERT_LINE;
-	}
+	// (state->ne555_int not needed anymore and can be done with?)
+	state->ne555_int = param;
 
-	cputag_set_input_line(timer.machine, Z80_TAG, INPUT_LINE_IRQ0, state->ne555_int);
+	cputag_set_input_line(timer.machine, Z80_TAG, INPUT_LINE_IRQ0, param);
 }
 
 static const cassette_config mc1000_cassette_config =
@@ -421,28 +473,34 @@
 static MACHINE_CONFIG_START( mc1000, mc1000_state )
 
 	/* basic machine hardware */
-    MDRV_CPU_ADD(Z80_TAG, Z80, 3579545)
-    MDRV_CPU_PROGRAM_MAP(mc1000_mem)
-    MDRV_CPU_IO_MAP(mc1000_io)
+	MDRV_CPU_ADD(Z80_TAG, Z80, 3579545)
+	MDRV_CPU_PROGRAM_MAP(mc1000_mem)
+	MDRV_CPU_IO_MAP(mc1000_io)
 
-    MDRV_MACHINE_START(mc1000)
-    MDRV_MACHINE_RESET(mc1000)
+	MDRV_MACHINE_START(mc1000)
+	MDRV_MACHINE_RESET(mc1000)
 
-	MDRV_TIMER_ADD_PERIODIC("ne555", ne555_tick, HZ(60))
+	/* timers */
+	MDRV_TIMER_ADD_PERIODIC("ne555clear", ne555_tick, HZ(MC1000_NE555_FREQ))
+	MDRV_TIMER_PARAM(CLEAR_LINE)
 
-    /* video hardware */
-    MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
-    MDRV_SCREEN_REFRESH_RATE(M6847_NTSC_FRAMES_PER_SECOND)
-    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
-    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
+	MDRV_TIMER_ADD_PERIODIC("ne555assert", ne555_tick, HZ(MC1000_NE555_FREQ))
+	MDRV_TIMER_START_DELAY(HZ(MC1000_NE555_FREQ * 100 / MC1000_NE555_DUTY_CYCLE))
+	MDRV_TIMER_PARAM(ASSERT_LINE)
+
+	/* video hardware */
+	MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
+	MDRV_SCREEN_REFRESH_RATE(M6847_NTSC_FRAMES_PER_SECOND)
+	MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
+	MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
 	MDRV_SCREEN_SIZE(320, 25+192+26)
 	MDRV_SCREEN_VISIBLE_AREA(0, 319, 1, 239)
-    MDRV_PALETTE_LENGTH(16)
+	MDRV_PALETTE_LENGTH(16)
 
-    MDRV_VIDEO_UPDATE(mc1000)
+	MDRV_VIDEO_UPDATE(mc1000)
 
-    MDRV_MC6847_ADD(MC6847_TAG, mc1000_mc6847_intf)
-    MDRV_MC6847_TYPE(M6847_VERSION_ORIGINAL_NTSC)
+	MDRV_MC6847_ADD(MC6847_TAG, mc1000_mc6847_intf)
+	MDRV_MC6847_TYPE(M6847_VERSION_ORIGINAL_NTSC)
 	MDRV_MC6847_CHAR_ROM(mc1000_get_char_rom)
 
 	/* sound hardware */

Ensjo #65321 10/30/10 11:37 PM
Joined: Aug 2004
Posts: 1,458
Likes: 9
Very Senior Member
Offline
Very Senior Member
Joined: Aug 2004
Posts: 1,458
Likes: 9
I tested this and the keyboard is having significant problems. For example typing R gives H, A gives @, etc. The current svn works properly.

Robbbert #65322 10/31/10 02:41 AM
Joined: Jul 2009
Posts: 78
Ensjo Offline OP
Member
OP Offline
Member
Joined: Jul 2009
Posts: 78
Originally Posted by robbbert
I tested this and the keyboard is having significant problems. For example typing R gives H, A gives @, etc. The current svn works properly.
Yes, it's a weird side-effect of the change I explain at this post.

In MC-1000, the joystick positions & buttons are equivalent to the pressing of certain keys:
  • Player one: up=I, down=Q, right=Y, left=1, button=9;
  • Player two: up=H, down=P, right=X, left=0, button=@

In the current svn, these keys are defined only as IPT_JOYSTICK_... ports. When you PASTE a text to the emulation, the corresponding characters are not inserted because MESS doesn't find a corresponding IPT_KEYBOARD port for them.

(Paste 10 PRINT "HELLO WORLD" and you'll see only RNT "ELLO WORLD"

It works when a PERSON types something, though, because, in the code, the joystick lines are "wired" to the keyboard lines.

What did I do? Defined separate, proper ports for the keyboard and joystick, and then "wired" them.

It did work (now pasting a text to the emulation does work... But now MESS' own keyboard mapping of joystick is causing that weird side-effect.

MESS keyboard-to-joystick mapping is:
  • Player one: up=UP, down=DOWN, right=RIGHT, left=LEFT, button=LEFT CTRL;
  • Player two: up=R, down=F, right=G, left=D, button=A

What is happening is that MESS is mapping these keys to the keys above, and we have:
  • UP->I, DOWN->Q, RIGHT->Y, LEFT->1, LEFT CTRL->9 (in fact, we get the equivalent to CTRL+9);
  • R->H, F->P, G->X, D->0, A->@

But it is enabled by default, so the keyboard is confused.

Probably, disabling MESS' keyboard-to-joystick mapping should solve the problem, but how can we do it?

In mc1000.ini I found an option "joystick" with value "1"; I changed it to "0", but the mapping is STILL enabled.

HOW CAN WE DISABLE MESS' JOYSTICK MAPPING when the machine starts, in a way that the user can enable it only when needed (i.e., to play a game using the arrow keys)? frown

Last edited by Ensjo; 10/31/10 02:51 AM.
Page 12 of 14 1 2 10 11 12 13 14

Link Copied to Clipboard
Who's Online Now
2 members (Kale, 1 invisible), 233 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,923
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com