Previous 199869 Revisions Next

r32021 Tuesday 9th September, 2014 at 12:56:58 UTC by David Haywood
oops (nw)
[src/emu/cpu/e132xs]e132xs.c

trunk/src/emu/cpu/e132xs/e132xs.c
r32020r32021
3535
3636 Pierpaolo Prazzoli
3737 - Fixed LDxx.N/P/S opcodes not to increment the destination register when
38   it's the same as the source or"next source" one.
38   it's the same as the source or "next source" one.
3939
4040 Pierpaolo Prazzoli
4141 - Removed nested delays
r32020r32021
5959 - Added nested delays
6060
6161 Tomasz Slanina
62 - Added"undefined" C flag to shift left instructions
62 - Added "undefined" C flag to shift left instructions
6363
6464 Pierpaolo Prazzoli
6565 - Added interrupts-block for delay instructions
r32020r32021
177177    - Implemented a crude hack to set FL in the SR to 6, since according to the docs
178178      that's supposed to happen each time a trap occurs, apparently including when
179179      the processor starts up. The 3rd opcode executed in vamphalf checks to see if
180      the FL flag in SR 6, so it's apparently the"correct" behaviour despite the
180      the FL flag in SR 6, so it's apparently the "correct" behaviour despite the
181181      docs not saying anything on it. If FL is not 6, the branch falls through and
182182      encounters a CHK PC, L2, which at that point will always throw a range trap.
183183      The range trap vector contains 00000000 (CHK PC, PC), which according to the
184184      docs will always throw a range trap (which would effectively lock the system).
185185      This revealed a bug: CHK PC, PC apparently does not throw a range trap, which
186      needs to be fixed. Now that the"correct" behaviour is hacked in with the FL
186      needs to be fixed. Now that the "correct" behaviour is hacked in with the FL
187187      flags, it reveals yet another bug in that the branch is interpreted as being
188188      +0x8700. This means that the PC then wraps around to 000082B0, give or take
189189      a few bytes. While it does indeed branch to valid code, I highly doubt that
r32020r32021
211211
212212*********************************************************************/
213213
214#include"emu.h"
215#include"debugger.h"
216#include"e132xs.h"
214#include "emu.h"
215#include "debugger.h"
216#include "e132xs.h"
217217
218218#ifdef MAME_DEBUG
219219#define DEBUG_PRINTF(x) do { osd_printf_debug x; } while (0)
r32020r32021
308308//-------------------------------------------------
309309
310310e116t_device::e116t_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
311   : hyperstone_device(mconfig,"E1-16T", tag, owner, clock, E116T, 16, 16, ADDRESS_MAP_NAME(e116_4k_iram_map),"e116t", __FILE__)
311   : hyperstone_device(mconfig, "E1-16T", tag, owner, clock, E116T, 16, 16, ADDRESS_MAP_NAME(e116_4k_iram_map), "e116t", __FILE__)
312312{
313313}
314314
r32020r32021
318318//-------------------------------------------------
319319
320320e116xt_device::e116xt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
321   : hyperstone_device(mconfig,"E1-16XT", tag, owner, clock, E116XT, 16, 16, ADDRESS_MAP_NAME(e116_8k_iram_map),"e116xt", __FILE__)
321   : hyperstone_device(mconfig, "E1-16XT", tag, owner, clock, E116XT, 16, 16, ADDRESS_MAP_NAME(e116_8k_iram_map), "e116xt", __FILE__)
322322{
323323}
324324
r32020r32021
328328//-------------------------------------------------
329329
330330e116xs_device::e116xs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
331   : hyperstone_device(mconfig,"E1-16XS", tag, owner, clock, E116XS, 16, 16, ADDRESS_MAP_NAME(e116_16k_iram_map),"e116xs", __FILE__)
331   : hyperstone_device(mconfig, "E1-16XS", tag, owner, clock, E116XS, 16, 16, ADDRESS_MAP_NAME(e116_16k_iram_map), "e116xs", __FILE__)
332332{
333333}
334334
r32020r32021
338338//-------------------------------------------------
339339
340340e116xsr_device::e116xsr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
341   : hyperstone_device(mconfig,"E1-16XSR", tag, owner, clock, E116XT, 16, 16, ADDRESS_MAP_NAME(e116_16k_iram_map),"e116xsr", __FILE__)
341   : hyperstone_device(mconfig, "E1-16XSR", tag, owner, clock, E116XT, 16, 16, ADDRESS_MAP_NAME(e116_16k_iram_map), "e116xsr", __FILE__)
342342{
343343}
344344
r32020r32021
348348//-------------------------------------------------
349349
350350e132n_device::e132n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
351   : hyperstone_device(mconfig,"E1-32N", tag, owner, clock, E132N, 32, 32, ADDRESS_MAP_NAME(e132_4k_iram_map),"e132n", __FILE__)
351   : hyperstone_device(mconfig, "E1-32N", tag, owner, clock, E132N, 32, 32, ADDRESS_MAP_NAME(e132_4k_iram_map), "e132n", __FILE__)
352352{
353353}
354354
r32020r32021
358358//-------------------------------------------------
359359
360360e132t_device::e132t_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
361   : hyperstone_device(mconfig,"E1-32T", tag, owner, clock, E132T, 32, 32, ADDRESS_MAP_NAME(e132_4k_iram_map),"e132t", __FILE__)
361   : hyperstone_device(mconfig, "E1-32T", tag, owner, clock, E132T, 32, 32, ADDRESS_MAP_NAME(e132_4k_iram_map), "e132t", __FILE__)
362362{
363363}
364364
r32020r32021
368368//-------------------------------------------------
369369
370370e132xn_device::e132xn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
371   : hyperstone_device(mconfig,"E1-32XN", tag, owner, clock, E132XN, 32, 32, ADDRESS_MAP_NAME(e132_8k_iram_map),"e132xn", __FILE__)
371   : hyperstone_device(mconfig, "E1-32XN", tag, owner, clock, E132XN, 32, 32, ADDRESS_MAP_NAME(e132_8k_iram_map), "e132xn", __FILE__)
372372{
373373}
374374
r32020r32021
378378//-------------------------------------------------
379379
380380e132xt_device::e132xt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
381   : hyperstone_device(mconfig,"E1-32XT", tag, owner, clock, E132XT, 32, 32, ADDRESS_MAP_NAME(e132_8k_iram_map),"e132xt", __FILE__)
381   : hyperstone_device(mconfig, "E1-32XT", tag, owner, clock, E132XT, 32, 32, ADDRESS_MAP_NAME(e132_8k_iram_map), "e132xt", __FILE__)
382382{
383383}
384384
r32020r32021
388388//-------------------------------------------------
389389
390390e132xs_device::e132xs_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
391   : hyperstone_device(mconfig,"E1-32XS", tag, owner, clock, E132XS, 32, 32, ADDRESS_MAP_NAME(e132_16k_iram_map),"e132xs", __FILE__)
391   : hyperstone_device(mconfig, "E1-32XS", tag, owner, clock, E132XS, 32, 32, ADDRESS_MAP_NAME(e132_16k_iram_map), "e132xs", __FILE__)
392392{
393393}
394394
r32020r32021
398398//-------------------------------------------------
399399
400400e132xsr_device::e132xsr_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
401   : hyperstone_device(mconfig,"E1-32XSR", tag, owner, clock, E132XSR, 32, 32, ADDRESS_MAP_NAME(e132_16k_iram_map),"e132xsr", __FILE__)
401   : hyperstone_device(mconfig, "E1-32XSR", tag, owner, clock, E132XSR, 32, 32, ADDRESS_MAP_NAME(e132_16k_iram_map), "e132xsr", __FILE__)
402402{
403403}
404404
r32020r32021
408408//-------------------------------------------------
409409
410410gms30c2116_device::gms30c2116_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
411   : hyperstone_device(mconfig,"GMS30C2116", tag, owner, clock, GMS30C2116, 16, 16, ADDRESS_MAP_NAME(e116_4k_iram_map),"gms30c2116", __FILE__)
411   : hyperstone_device(mconfig, "GMS30C2116", tag, owner, clock, GMS30C2116, 16, 16, ADDRESS_MAP_NAME(e116_4k_iram_map), "gms30c2116", __FILE__)
412412{
413413}
414414
r32020r32021
418418//-------------------------------------------------
419419
420420gms30c2132_device::gms30c2132_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
421   : hyperstone_device(mconfig,"GMS30C2132", tag, owner, clock, GMS30C2132, 32, 32, ADDRESS_MAP_NAME(e132_4k_iram_map),"gms30c2132", __FILE__)
421   : hyperstone_device(mconfig, "GMS30C2132", tag, owner, clock, GMS30C2132, 32, 32, ADDRESS_MAP_NAME(e132_4k_iram_map), "gms30c2132", __FILE__)
422422{
423423}
424424
r32020r32021
428428//-------------------------------------------------
429429
430430gms30c2216_device::gms30c2216_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
431   : hyperstone_device(mconfig,"GMS30C2216", tag, owner, clock, GMS30C2216, 16, 16, ADDRESS_MAP_NAME(e116_8k_iram_map),"gms30c2216", __FILE__)
431   : hyperstone_device(mconfig, "GMS30C2216", tag, owner, clock, GMS30C2216, 16, 16, ADDRESS_MAP_NAME(e116_8k_iram_map), "gms30c2216", __FILE__)
432432{
433433}
434434
r32020r32021
438438//-------------------------------------------------
439439
440440gms30c2232_device::gms30c2232_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
441   : hyperstone_device(mconfig,"GMS30C2232", tag, owner, clock, GMS30C2232, 32, 32, ADDRESS_MAP_NAME(e132_8k_iram_map),"gms30c2232", __FILE__)
441   : hyperstone_device(mconfig, "GMS30C2232", tag, owner, clock, GMS30C2232, 32, 32, ADDRESS_MAP_NAME(e132_8k_iram_map), "gms30c2232", __FILE__)
442442{
443443}
444444
r32020r32021
459459   return addr;
460460}
461461
462/* Return the entry point for a determinated emulated code (the one for"extend" opcode is reserved) */
462/* Return the entry point for a determinated emulated code (the one for "extend" opcode is reserved) */
463463UINT32 hyperstone_device::get_emu_code_addr(UINT8 num) /* num is OP */
464464{
465465   UINT32 addr;
r32020r32021
42104210   {
42114211      // signed or unsigned multiplication, single word product
42124212      case EMUL:
4213      case 0x100: // used in"N" type cpu
4213      case 0x100: // used in "N" type cpu
42144214      {
42154215         UINT32 result;
42164216
r32020r32021
44374437   SET_SREGF(READ_W(DREG + 4));
44384438
44394439   // post increment the destination register if it's different from the source one
4440   // and from the"next source" one
4440   // and from the "next source" one
44414441   if(!(decode->src == decode->dst && S_BIT == LOCAL) &&   !SAME_SRCF_DST )
44424442   {
44434443      SET_DREG(DREG + 8);
r32020r32021
48614861}
48624862
48634863
4864#include"e132xsop.inc"
4864#include "e132xsop.inc"
48654865
48664866//**************************************************************************
48674867//  CORE EXECUTION LOOP

Previous 199869 Revisions Next


© 1997-2024 The MAME Team