diff options
author | 2008-11-03 01:16:39 +0000 | |
---|---|---|
committer | 2008-11-03 01:16:39 +0000 | |
commit | 17b6c56de9cfd441ed8b09fbd74fb55573596311 (patch) | |
tree | 5f2baa5e8cbae6f30688b85634c6183294aa8424 /src/emu/machine/74123.c | |
parent | b29e06704bc7b1bb3c2e7ef9111c1bea6f132f49 (diff) |
74123 Fixes:
* Clear behaviour to follow datasheet.
* Avoid recursive calls when setting a/b/clear lines from callback
Diffstat (limited to 'src/emu/machine/74123.c')
-rw-r--r-- | src/emu/machine/74123.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/emu/machine/74123.c b/src/emu/machine/74123.c index 1439eeb6373..a2bc6878094 100644 --- a/src/emu/machine/74123.c +++ b/src/emu/machine/74123.c @@ -71,12 +71,21 @@ static int timer_running(ttl74123_t *chip) } +static TIMER_CALLBACK( output_callback ) +{ + const device_config *device = ptr; + ttl74123_t *chip = get_safe_token(device); + + chip->intf->output_changed_cb(device, 0, param); +} + + static void set_output(const device_config *device) { ttl74123_t *chip = get_safe_token(device); int output = timer_running(chip); - chip->intf->output_changed_cb(device, 0, output); + timer_set( attotime_zero, (void *) device, output, output_callback ); if (LOG) logerror("74123 %s: Output: %d\n", device->tag, output); } @@ -85,8 +94,10 @@ static void set_output(const device_config *device) static TIMER_CALLBACK( clear_callback ) { const device_config *device = ptr; + ttl74123_t *chip = get_safe_token(device); + int output = timer_running(chip); - set_output(device); + chip->intf->output_changed_cb(device, 0, output); } @@ -154,14 +165,15 @@ WRITE8_DEVICE_HANDLER( ttl74123_clear_w ) { ttl74123_t *chip = get_safe_token(device); - /* clear the output if A=LO, B=HI and falling edge on clear */ - if (!data && chip->clear && chip->b && !chip->a && !chip->clear) + /* start/regtrigger pulse if B=HI and A=LO and rising edge on clear */ + if (data && !chip->a && chip->b && !chip->clear) + start_pulse(device); + else if (!data) /* clear the output */ { timer_adjust_oneshot(chip->timer, attotime_zero, 0); if (LOG) logerror("74123 #%s: Cleared\n", device->tag ); } - chip->clear = data; } @@ -185,7 +197,7 @@ static DEVICE_START( ttl74123 ) chip->intf = device->static_config; assert_always(chip->intf, "No interface specified"); - assert_always((chip->intf->connection_type == TTL74123_GROUNDED) && (chip->intf->cap >= CAP_U(0.01)), "Only capacitors >= 0.01uF supported for GROUNDED type"); + assert_always((chip->intf->connection_type != TTL74123_GROUNDED) || (chip->intf->cap >= CAP_U(0.01)), "Only capacitors >= 0.01uF supported for GROUNDED type"); assert_always(chip->intf->cap >= CAP_P(1000), "Only capacitors >= 1000pF supported "); chip->timer = timer_alloc(clear_callback, (void *) device); |