trunk/src/emu/cpu/e132xs/e132xs.c
| r32020 | r32021 | |
| 35 | 35 | |
| 36 | 36 | Pierpaolo Prazzoli |
| 37 | 37 | - 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. |
| 39 | 39 | |
| 40 | 40 | Pierpaolo Prazzoli |
| 41 | 41 | - Removed nested delays |
| r32020 | r32021 | |
| 59 | 59 | - Added nested delays |
| 60 | 60 | |
| 61 | 61 | Tomasz Slanina |
| 62 | | - Added"undefined" C flag to shift left instructions |
| 62 | - Added "undefined" C flag to shift left instructions |
| 63 | 63 | |
| 64 | 64 | Pierpaolo Prazzoli |
| 65 | 65 | - Added interrupts-block for delay instructions |
| r32020 | r32021 | |
| 177 | 177 | - Implemented a crude hack to set FL in the SR to 6, since according to the docs |
| 178 | 178 | that's supposed to happen each time a trap occurs, apparently including when |
| 179 | 179 | 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 |
| 181 | 181 | docs not saying anything on it. If FL is not 6, the branch falls through and |
| 182 | 182 | encounters a CHK PC, L2, which at that point will always throw a range trap. |
| 183 | 183 | The range trap vector contains 00000000 (CHK PC, PC), which according to the |
| 184 | 184 | docs will always throw a range trap (which would effectively lock the system). |
| 185 | 185 | 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 |
| 187 | 187 | flags, it reveals yet another bug in that the branch is interpreted as being |
| 188 | 188 | +0x8700. This means that the PC then wraps around to 000082B0, give or take |
| 189 | 189 | a few bytes. While it does indeed branch to valid code, I highly doubt that |
| r32020 | r32021 | |
| 211 | 211 | |
| 212 | 212 | *********************************************************************/ |
| 213 | 213 | |
| 214 | | #include"emu.h" |
| 215 | | #include"debugger.h" |
| 216 | | #include"e132xs.h" |
| 214 | #include "emu.h" |
| 215 | #include "debugger.h" |
| 216 | #include "e132xs.h" |
| 217 | 217 | |
| 218 | 218 | #ifdef MAME_DEBUG |
| 219 | 219 | #define DEBUG_PRINTF(x) do { osd_printf_debug x; } while (0) |
| r32020 | r32021 | |
| 308 | 308 | //------------------------------------------------- |
| 309 | 309 | |
| 310 | 310 | e116t_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__) |
| 312 | 312 | { |
| 313 | 313 | } |
| 314 | 314 | |
| r32020 | r32021 | |
| 318 | 318 | //------------------------------------------------- |
| 319 | 319 | |
| 320 | 320 | e116xt_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__) |
| 322 | 322 | { |
| 323 | 323 | } |
| 324 | 324 | |
| r32020 | r32021 | |
| 328 | 328 | //------------------------------------------------- |
| 329 | 329 | |
| 330 | 330 | e116xs_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__) |
| 332 | 332 | { |
| 333 | 333 | } |
| 334 | 334 | |
| r32020 | r32021 | |
| 338 | 338 | //------------------------------------------------- |
| 339 | 339 | |
| 340 | 340 | e116xsr_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__) |
| 342 | 342 | { |
| 343 | 343 | } |
| 344 | 344 | |
| r32020 | r32021 | |
| 348 | 348 | //------------------------------------------------- |
| 349 | 349 | |
| 350 | 350 | e132n_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__) |
| 352 | 352 | { |
| 353 | 353 | } |
| 354 | 354 | |
| r32020 | r32021 | |
| 358 | 358 | //------------------------------------------------- |
| 359 | 359 | |
| 360 | 360 | e132t_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__) |
| 362 | 362 | { |
| 363 | 363 | } |
| 364 | 364 | |
| r32020 | r32021 | |
| 368 | 368 | //------------------------------------------------- |
| 369 | 369 | |
| 370 | 370 | e132xn_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__) |
| 372 | 372 | { |
| 373 | 373 | } |
| 374 | 374 | |
| r32020 | r32021 | |
| 378 | 378 | //------------------------------------------------- |
| 379 | 379 | |
| 380 | 380 | e132xt_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__) |
| 382 | 382 | { |
| 383 | 383 | } |
| 384 | 384 | |
| r32020 | r32021 | |
| 388 | 388 | //------------------------------------------------- |
| 389 | 389 | |
| 390 | 390 | e132xs_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__) |
| 392 | 392 | { |
| 393 | 393 | } |
| 394 | 394 | |
| r32020 | r32021 | |
| 398 | 398 | //------------------------------------------------- |
| 399 | 399 | |
| 400 | 400 | e132xsr_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__) |
| 402 | 402 | { |
| 403 | 403 | } |
| 404 | 404 | |
| r32020 | r32021 | |
| 408 | 408 | //------------------------------------------------- |
| 409 | 409 | |
| 410 | 410 | gms30c2116_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__) |
| 412 | 412 | { |
| 413 | 413 | } |
| 414 | 414 | |
| r32020 | r32021 | |
| 418 | 418 | //------------------------------------------------- |
| 419 | 419 | |
| 420 | 420 | gms30c2132_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__) |
| 422 | 422 | { |
| 423 | 423 | } |
| 424 | 424 | |
| r32020 | r32021 | |
| 428 | 428 | //------------------------------------------------- |
| 429 | 429 | |
| 430 | 430 | gms30c2216_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__) |
| 432 | 432 | { |
| 433 | 433 | } |
| 434 | 434 | |
| r32020 | r32021 | |
| 438 | 438 | //------------------------------------------------- |
| 439 | 439 | |
| 440 | 440 | gms30c2232_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__) |
| 442 | 442 | { |
| 443 | 443 | } |
| 444 | 444 | |
| r32020 | r32021 | |
| 459 | 459 | return addr; |
| 460 | 460 | } |
| 461 | 461 | |
| 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) */ |
| 463 | 463 | UINT32 hyperstone_device::get_emu_code_addr(UINT8 num) /* num is OP */ |
| 464 | 464 | { |
| 465 | 465 | UINT32 addr; |
| r32020 | r32021 | |
| 4210 | 4210 | { |
| 4211 | 4211 | // signed or unsigned multiplication, single word product |
| 4212 | 4212 | case EMUL: |
| 4213 | | case 0x100: // used in"N" type cpu |
| 4213 | case 0x100: // used in "N" type cpu |
| 4214 | 4214 | { |
| 4215 | 4215 | UINT32 result; |
| 4216 | 4216 | |
| r32020 | r32021 | |
| 4437 | 4437 | SET_SREGF(READ_W(DREG + 4)); |
| 4438 | 4438 | |
| 4439 | 4439 | // 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 |
| 4441 | 4441 | if(!(decode->src == decode->dst && S_BIT == LOCAL) && !SAME_SRCF_DST ) |
| 4442 | 4442 | { |
| 4443 | 4443 | SET_DREG(DREG + 8); |
| r32020 | r32021 | |
| 4861 | 4861 | } |
| 4862 | 4862 | |
| 4863 | 4863 | |
| 4864 | | #include"e132xsop.inc" |
| 4864 | #include "e132xsop.inc" |
| 4865 | 4865 | |
| 4866 | 4866 | //************************************************************************** |
| 4867 | 4867 | // CORE EXECUTION LOOP |