trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
| r242356 | r242357 | |
| 139 | 139 | |
| 140 | 140 | UINT8 condition = op & 0x0000001f; |
| 141 | 141 | |
| 142 | | print("B(%s) %08x (%08x)", conditions[condition], pc + (address * 2) + 2, op & ~0xffffffdf); |
| 142 | print("B(%s) %08x (%08x)", conditions[condition], pc + (address * 2), op & ~0xffffffdf); |
| 143 | 143 | return size; |
| 144 | 144 | } |
| 145 | 145 | |
| r242356 | r242357 | |
| 153 | 153 | address |= ((op & 0x0000000f) >> 0) << 20; |
| 154 | 154 | if (address & 0x800000) address = -(address & 0x7fffff); |
| 155 | 155 | |
| 156 | | print("B %08x (%08x)", pc + (address * 2) + 2, op & ~0xffffffcf); |
| 156 | print("B %08x (%08x)", pc + (address * 2), op & ~0xffffffcf); |
| 157 | 157 | return size; |
| 158 | 158 | } |
| 159 | 159 | |
| r242356 | r242357 | |
| 169 | 169 | |
| 170 | 170 | UINT8 condition = op & 0x0000001f; |
| 171 | 171 | |
| 172 | | print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2) + 2, op & ~0xffffffdf ); |
| 172 | print("BL(%s) %08x (%08x)", conditions[condition], pc + (address *2), op & ~0xffffffdf ); |
| 173 | 173 | return size; |
| 174 | 174 | } |
| 175 | 175 | |
| r242356 | r242357 | |
| 183 | 183 | address |= ((op & 0x0000000f) >> 0) << 20; |
| 184 | 184 | if (address & 0x800000) address = -(address&0x7fffff); |
| 185 | 185 | |
| 186 | | print("BL %08x (%08x)", pc + (address *2) + 2, op & ~0xffffffcf ); |
| 186 | print("BL %08x (%08x)", pc + (address *2), op & ~0xffffffcf ); |
| 187 | 187 | return size; |
| 188 | 188 | } |
| 189 | 189 | |
| r242356 | r242357 | |
| 208 | 208 | int arcompact_handle01_01_01_0e_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BBIT0 (b & 1<<u6) == 0 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 209 | 209 | int arcompact_handle01_01_01_0f_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BBIT1 (b & 1<<u6) != 0 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 210 | 210 | |
| 211 | | #if 0 |
| 211 | |
| 212 | 212 | //#define EXPLICIT_EXTENSIONS |
| 213 | 213 | |
| 214 | 214 | static const char *datasize[0x4] = |
| r242356 | r242357 | |
| 216 | 216 | #ifdef EXPLICIT_EXTENSIONS |
| 217 | 217 | /* 00 */ ".L", // Dword (default) (can use no extension, using .L to be explicit) |
| 218 | 218 | #else |
| 219 | | /* 00 */ " ",// Dword (default) |
| 219 | /* 00 */ "",// Dword (default) |
| 220 | 220 | #endif |
| 221 | 221 | /* 01 */ ".B", // Byte |
| 222 | 222 | /* 02 */ ".W", // Word |
| r242356 | r242357 | |
| 228 | 228 | #ifdef EXPLICIT_EXTENSIONS |
| 229 | 229 | /* 00 */ ".ZX", // Zero Extend (can use no extension, using .ZX to be explicit) |
| 230 | 230 | else |
| 231 | | /* 00 */ " ", // Zero Extend |
| 231 | /* 00 */ "", // Zero Extend |
| 232 | 232 | #endif |
| 233 | 233 | /* 01 */ ".X" // Sign Extend |
| 234 | 234 | }; |
| r242356 | r242357 | |
| 238 | 238 | #ifdef EXPLICIT_EXTENSIONS |
| 239 | 239 | /* 00 */ ".AN", // No Writeback (can use no extension, using .AN to be explicit) |
| 240 | 240 | #else |
| 241 | | /* 00 */ " ", // No Writeback |
| 241 | /* 00 */ "", // No Writeback |
| 242 | 242 | #endif |
| 243 | 243 | /* 01 */ ".AW", // Writeback pre memory access |
| 244 | 244 | /* 02 */ ".AB", // Writeback post memory access |
| r242356 | r242357 | |
| 250 | 250 | #ifdef EXPLICIT_EXTENSIONS |
| 251 | 251 | /* 00 */ ".EN", // Data Cache Enabled (can use no extension, using .EN to be explicit) |
| 252 | 252 | #else |
| 253 | | /* 00 */ " ", // Data Cache Enabled |
| 253 | /* 00 */ "", // Data Cache Enabled |
| 254 | 254 | #endif |
| 255 | 255 | /* 01 */ ".DI" // Direct to Memory (Cache Bypass) |
| 256 | 256 | }; |
| 257 | 257 | |
| 258 | static const char *flagbit[0x2] = |
| 259 | { |
| 260 | #ifdef EXPLICIT_EXTENSIONS |
| 261 | /* 00 */ ".NF", // Don't Set Flags (can use no extension, using .NF to be explicit) |
| 262 | #else |
| 263 | /* 00 */ "", // Don't Set Flags |
| 264 | #endif |
| 265 | /* 01 */ ".F" // Set Flags |
| 266 | }; |
| 267 | |
| 258 | 268 | static const char *regnames[0x40] = |
| 259 | 269 | { |
| 260 | 270 | /* 00 */ "r0", |
| r242356 | r242357 | |
| 325 | 335 | /* 3e */ "r62(LIMM)", // use Long Immediate Data instead of register |
| 326 | 336 | /* 3f */ "r63(PCL)" |
| 327 | 337 | }; |
| 328 | | #endif |
| 329 | 338 | |
| 339 | |
| 330 | 340 | int arcompact_handle02_dasm(DASM_OPS_32) |
| 331 | 341 | { |
| 332 | 342 | // bitpos |
| r242356 | r242357 | |
| 335 | 345 | // fields |
| 336 | 346 | // 0001 0bbb ssss ssss SBBB DaaZ ZXAA AAAA |
| 337 | 347 | |
| 338 | | #if 0 |
| 339 | | int A = (op & 0x0000003f >> 0); //op &= ~0x0000003f; |
| 340 | | int X = (op & 0x00000040 >> 6); //op &= ~0x00000040; |
| 341 | | int Z = (op & 0x00000180 >> 7); //op &= ~0x00000180; |
| 342 | | int a = (op & 0x00000600 >> 9); //op &= ~0x00000600; |
| 343 | | int D = (op & 0x00000800 >> 11);// op &= ~0x00000800; |
| 344 | | int B = (op & 0x00007000 >> 12);// op &= ~0x00007000; |
| 345 | | int S = (op & 0x00008000 >> 15);// op &= ~0x00008000; |
| 346 | | int s = (op & 0x00ff0000 >> 16);// op &= ~0x00ff0000; |
| 347 | | int b = (op & 0x07000000 >> 24);// op &= ~0x07000000; |
| 348 | 348 | |
| 349 | int A = (op & 0x0000003f) >> 0; //op &= ~0x0000003f; |
| 350 | int X = (op & 0x00000040) >> 6; //op &= ~0x00000040; |
| 351 | int Z = (op & 0x00000180) >> 7; //op &= ~0x00000180; |
| 352 | int a = (op & 0x00000600) >> 9; //op &= ~0x00000600; |
| 353 | int D = (op & 0x00000800) >> 11;// op &= ~0x00000800; |
| 354 | int B = (op & 0x00007000) >> 12;// op &= ~0x00007000; |
| 355 | int S = (op & 0x00008000) >> 15;// op &= ~0x00008000; |
| 356 | int s = (op & 0x00ff0000) >> 16;// op &= ~0x00ff0000; |
| 357 | int b = (op & 0x07000000) >> 24;// op &= ~0x07000000; |
| 358 | |
| 349 | 359 | int breg = b | (B << 3); |
| 350 | 360 | int sdat = s | (S << 8); // todo - signed |
| 351 | | #endif |
| 352 | 361 | |
| 353 | | |
| 354 | 362 | output += sprintf( output, "LD"); |
| 355 | | // output += sprintf( output, "%s", datasize[Z]); |
| 356 | | // output += sprintf( output, "%s", dataextend[X]); |
| 357 | | // output += sprintf( output, "%s", addressmode[a]); |
| 358 | | // output += sprintf( output, "%s", cachebit[D]); |
| 359 | | // output += sprintf( output, " "); |
| 360 | | // output += sprintf( output, "%s, ", regnames[A]); |
| 361 | | // output += sprintf( output, "["); |
| 362 | | // output += sprintf( output, "%s(%d %d), ", regnames[breg], B, b); |
| 363 | | // output += sprintf( output, "%d", sdat); |
| 364 | | // output += sprintf( output, "]"); |
| 363 | output += sprintf( output, "%s", datasize[Z]); |
| 364 | output += sprintf( output, "%s", dataextend[X]); |
| 365 | output += sprintf( output, "%s", addressmode[a]); |
| 366 | output += sprintf( output, "%s", cachebit[D]); |
| 367 | output += sprintf( output, " "); |
| 368 | output += sprintf( output, "%s, ", regnames[A]); |
| 369 | output += sprintf( output, "["); |
| 370 | output += sprintf( output, "%s, ", regnames[breg]); |
| 371 | output += sprintf( output, "%d", sdat); |
| 372 | output += sprintf( output, "]"); |
| 365 | 373 | |
| 366 | 374 | return 4; |
| 367 | 375 | } |
| r242356 | r242357 | |
| 388 | 396 | int arcompact_handle04_07_dasm(DASM_OPS_32) { print("XOR (%08x)", op); return 4;} |
| 389 | 397 | int arcompact_handle04_08_dasm(DASM_OPS_32) { print("MAX (%08x)", op); return 4;} |
| 390 | 398 | int arcompact_handle04_09_dasm(DASM_OPS_32) { print("MIN (%08x)", op); return 4;} |
| 391 | | int arcompact_handle04_0a_dasm(DASM_OPS_32) { print("MOV (%08x)", op); return 4;} |
| 399 | |
| 400 | int arcompact_handle04_0a_dasm(DASM_OPS_32) |
| 401 | { |
| 402 | // PP |
| 403 | // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA |
| 404 | int size = 4; |
| 405 | |
| 406 | int p = (op & 0x00c00000) >> 22; op &= ~0x00c00000; |
| 407 | int b = (op & 0x07000000) >> 24; op &= ~0x07000000; |
| 408 | int B = (op & 0x00007000) >> 12; op &= ~0x00007000; |
| 409 | int breg = b | (B << 3); |
| 410 | int F = (op & 0x00008000) >> 15;op &= ~0x00008000; |
| 411 | |
| 412 | output += sprintf( output, "MOV"); |
| 413 | output += sprintf( output, "%s", flagbit[F]); |
| 414 | output += sprintf( output, " p(%d)", p); |
| 415 | output += sprintf( output, " %s, ", regnames[breg]); |
| 416 | |
| 417 | if (p == 0) |
| 418 | { |
| 419 | // 0010 0bbb 00ii iiii FBBB CCCC CCAA AAAA |
| 420 | |
| 421 | int C = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; |
| 422 | int A = (op & 0x0000003f) >> 0; op &= ~0x0000003f; |
| 423 | |
| 424 | if (C == LIMM_REG) |
| 425 | { |
| 426 | UINT32 limm; |
| 427 | GET_LIMM_32; |
| 428 | size = 8; |
| 429 | output += sprintf( output, "(%08x) A(%s)", limm, regnames[A]); |
| 430 | } |
| 431 | else |
| 432 | { |
| 433 | output += sprintf( output, "C(%s) A(%s)", regnames[C], regnames[A]); |
| 434 | } |
| 435 | } |
| 436 | else if (p == 1) |
| 437 | { |
| 438 | // 0010 0bbb 00ii iiii FBBB UUUU UUAA AAAA |
| 439 | int U = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; |
| 440 | int A = (op & 0x0000003f) >> 0; op &= ~0x0000003f; |
| 441 | |
| 442 | output += sprintf( output, "U(%02x) A(%s)", U, regnames[A]); |
| 443 | |
| 444 | } |
| 445 | else if (p == 2) |
| 446 | { |
| 447 | int S = (op & 0x00000fff) >> 0; op &= ~0x00000fff; |
| 448 | output += sprintf( output, "S(%02x)", S); |
| 449 | |
| 450 | } |
| 451 | else if (p == 3) |
| 452 | { |
| 453 | int M = (op & 0x00000020) >> 5; op &= ~0x00000020; |
| 454 | int Q = (op & 0x0000001f) >> 0; op &= ~0x0000001f; |
| 455 | |
| 456 | output += sprintf( output, " M(%d)", M); |
| 457 | output += sprintf( output, " Cond<%s> ", conditions[Q]); |
| 458 | |
| 459 | if (M == 0) |
| 460 | { |
| 461 | int C = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; |
| 462 | output += sprintf( output, "C(%s)", regnames[C]); |
| 463 | |
| 464 | } |
| 465 | else if (M == 1) |
| 466 | { |
| 467 | int U = (op & 0x00000fc0) >> 6; op &= ~0x00000fc0; |
| 468 | output += sprintf( output, "U(%02x)", U); |
| 469 | |
| 470 | } |
| 471 | |
| 472 | } |
| 473 | |
| 474 | return size; |
| 475 | } |
| 476 | |
| 477 | |
| 392 | 478 | int arcompact_handle04_0b_dasm(DASM_OPS_32) { print("TST (%08x)", op); return 4;} |
| 393 | 479 | int arcompact_handle04_0c_dasm(DASM_OPS_32) { print("CMP (%08x)", op); return 4;} |
| 394 | 480 | int arcompact_handle04_0d_dasm(DASM_OPS_32) { print("RCMP (%08x)", op); return 4;} |