trunk/src/emu/cpu/arcompact/arcompactdasm_ops.c
| r242421 | r242422 | |
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 | |
| 198 | int arcompact_01_01_00_helper(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext) |
| 199 | { |
| 200 | int size = 4; |
| 201 | |
| 202 | // Branch on Compare / Bit Test - Register-Register |
| 203 | // 00001 bbb sssssss 1 S BBB CCCCCC N 0 iiii |
| 204 | INT32 address = (op & 0x00fe0000) >> 17; |
| 205 | address |= ((op & 0x00008000) >> 15) << 7; |
| 206 | if (address & 0x80) address = -(address & 0x7f); |
| 207 | |
| 208 | int c = (op & 0x00000fc0) >> 6; |
| 209 | int b = (op & 0x07000000) >> 24; |
| 210 | b |= ((op & 0x00007000) >> 12) << 3; |
| 211 | int n = (op & 0x00000020) >> 5; op &= ~0x00000020; |
| 212 | |
| 213 | op &= ~0x07007fe0; |
| 214 | |
| 215 | if ((b != LIMM_REG) && (c != LIMM_REG)) |
| 216 | { |
| 217 | print("%s%s (r%d) (r%d) %08x (%08x)", optext, delaybit[n], b, c, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 218 | } |
| 219 | else |
| 220 | { |
| 221 | UINT32 limm; |
| 222 | GET_LIMM_32; |
| 223 | size = 8; |
| 224 | |
| 225 | if ((b == LIMM_REG) && (c != LIMM_REG)) |
| 226 | { |
| 227 | print("%s%s (%08x) (r%d) %08x (%08x)", optext, delaybit[n], limm, c, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 228 | } |
| 229 | else if ((c == LIMM_REG) && (b != LIMM_REG)) |
| 230 | { |
| 231 | print("%s%s (r%d) (%08x) %08x (%08x)", optext, delaybit[n], b, limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 232 | } |
| 233 | else |
| 234 | { |
| 235 | // b and c are LIMM? invalid?? |
| 236 | print("%s%s (%08x) (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 237 | |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | return size; |
| 242 | } |
| 243 | |
| 198 | 244 | #define GET_01_01_01_BRANCH_ADDR \ |
| 199 | 245 | INT32 address = (op & 0x00fe0000) >> 17; \ |
| 200 | 246 | address |= ((op & 0x00008000) >> 15) << 7; \ |
| r242421 | r242422 | |
| 205 | 251 | #define GROUP_0e_GET_h \ |
| 206 | 252 | h = ((op & 0x0007) << 3); \ |
| 207 | 253 | h |= ((op & 0x00e0) >> 5); \ |
| 208 | | op &= ~0x00e7; \ |
| 209 | 254 | |
| 210 | | #define COMMON16_GET_breg \ |
| 211 | | breg = ((op & 0x0700) >>8); \ |
| 212 | | op &= ~0x0700; \ |
| 213 | | |
| 214 | | #define COMMON16_GET_creg \ |
| 215 | | creg = ((op & 0x00e0) >>5); \ |
| 216 | | op &= ~0x00e0; \ |
| 217 | | |
| 218 | | #define COMMON16_GET_u5 \ |
| 219 | | u = ((op & 0x001f) >>0); \ |
| 220 | | op &= ~0x001f; \ |
| 221 | | |
| 222 | | #define COMMON16_GET_u8 \ |
| 223 | | u = ((op & 0x00ff) >>0); \ |
| 224 | | op &= ~0x00ff; \ |
| 225 | | |
| 226 | | #define COMMON16_GET_u7 \ |
| 227 | | u = ((op & 0x007f) >>0); \ |
| 228 | | op &= ~0x007f; \ |
| 229 | | |
| 230 | | // registers used in 16-bit opcodes hae a limited range |
| 231 | | // and can only address registers r0-r3 and r12-r15 |
| 232 | | |
| 233 | | #define REG_16BIT_RANGE(_reg_) \ |
| 234 | | if (_reg_>3) _reg_+= 8; \ |
| 235 | | |
| 236 | | |
| 237 | 255 | // this is as messed up as the rest of the 16-bit alignment in LE mode... |
| 238 | 256 | |
| 239 | 257 | #define GET_LIMM \ |
| r242421 | r242422 | |
| 251 | 269 | { |
| 252 | 270 | int size = 4; |
| 253 | 271 | // Branch Conditionally |
| 254 | | // 0000 0sss ssss sss0 SSSS SSSS SSNQ QQQQ |
| 272 | // 00000 ssssssssss 0 SSSSSSSSSS N QQQQQ |
| 255 | 273 | INT32 address = (op & 0x07fe0000) >> 17; |
| 256 | 274 | address |= ((op & 0x0000ffc0) >> 6) << 10; |
| 257 | 275 | if (address & 0x800000) address = -(address & 0x7fffff); |
| r242421 | r242422 | |
| 266 | 284 | { |
| 267 | 285 | int size = 4; |
| 268 | 286 | // Branch Unconditionally Far |
| 269 | | // 0000 0sss ssss sss1 SSSS SSSS SSNR TTTT |
| 287 | // 00000 ssssssssss 1 SSSSSSSSSS N R TTTT |
| 270 | 288 | INT32 address = (op & 0x07fe0000) >> 17; |
| 271 | 289 | address |= ((op & 0x0000ffc0) >> 6) << 10; |
| 272 | 290 | address |= ((op & 0x0000000f) >> 0) << 20; |
| r242421 | r242422 | |
| 315 | 333 | return size; |
| 316 | 334 | } |
| 317 | 335 | |
| 336 | int arcompact_handle01_01_00_00_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BREQ b - c"); } |
| 337 | int arcompact_handle01_01_00_01_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRNE b - c"); } |
| 338 | int arcompact_handle01_01_00_02_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRLT b - c"); } |
| 339 | int arcompact_handle01_01_00_03_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRGE b - c"); } |
| 340 | int arcompact_handle01_01_00_04_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRLO b - c"); } |
| 341 | int arcompact_handle01_01_00_05_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRHS b - c"); } |
| 342 | int arcompact_handle01_01_00_0e_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BBIT0 (b & 1<<c) == 0"); } |
| 343 | int arcompact_handle01_01_00_0f_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BBIT1 (b & 1<<c) != 0"); } |
| 318 | 344 | |
| 319 | 345 | |
| 320 | | int arcompact_01_01_00_helper(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext) |
| 321 | | { |
| 322 | | int size = 4; |
| 346 | int arcompact_handle01_01_01_00_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BREQ b - u6 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 347 | int arcompact_handle01_01_01_01_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BRNE b - u6 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 348 | int arcompact_handle01_01_01_02_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BRLT b - u6 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 349 | int arcompact_handle01_01_01_03_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BRGE b - u6 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 350 | int arcompact_handle01_01_01_04_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BRLO b - u6 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 351 | int arcompact_handle01_01_01_05_dasm(DASM_OPS_32) { GET_01_01_01_BRANCH_ADDR; print("BRHS b - u6 (dst %08x) (%08x)", pc + (address * 2) + 4, op); return 4; } |
| 323 | 352 | |
| 324 | | // Branch on Compare / Bit Test - Register-Register |
| 325 | | // 00001 bbb sssssss 1 S BBB CCCCCC N 0 iiii |
| 326 | | GET_01_01_01_BRANCH_ADDR |
| 327 | 353 | |
| 354 | 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; } |
| 355 | 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; } |
| 328 | 356 | |
| 329 | | int c = (op & 0x00000fc0) >> 6; |
| 330 | | int b = (op & 0x07000000) >> 24; |
| 331 | | b |= ((op & 0x00007000) >> 12) << 3; |
| 332 | | int n = (op & 0x00000020) >> 5; op &= ~0x00000020; |
| 333 | 357 | |
| 334 | | op &= ~0x07007fe0; |
| 335 | | |
| 336 | | if ((b != LIMM_REG) && (c != LIMM_REG)) |
| 337 | | { |
| 338 | | print("%s%s %s %s %08x (%08x)", optext, delaybit[n], regnames[b], regnames[c], pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 339 | | } |
| 340 | | else |
| 341 | | { |
| 342 | | UINT32 limm; |
| 343 | | GET_LIMM_32; |
| 344 | | size = 8; |
| 345 | | |
| 346 | | if ((b == LIMM_REG) && (c != LIMM_REG)) |
| 347 | | { |
| 348 | | print("%s%s (%08x) %s %08x (%08x)", optext, delaybit[n], limm, regnames[b], pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 349 | | } |
| 350 | | else if ((c == LIMM_REG) && (b != LIMM_REG)) |
| 351 | | { |
| 352 | | print("%s%s %s (%08x) %08x (%08x)", optext, delaybit[n], regnames[b], limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 353 | | } |
| 354 | | else |
| 355 | | { |
| 356 | | // b and c are LIMM? invalid?? |
| 357 | | print("%s%s (%08x) (%08x) (illegal?) %08x (%08x)", optext, delaybit[n], limm, limm, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 358 | | |
| 359 | | } |
| 360 | | } |
| 361 | | |
| 362 | | return size; |
| 363 | | } |
| 364 | | |
| 365 | | |
| 366 | | // register - register cases |
| 367 | | int arcompact_handle01_01_00_00_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BREQ"); } |
| 368 | | int arcompact_handle01_01_00_01_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRNE"); } |
| 369 | | int arcompact_handle01_01_00_02_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRLT"); } |
| 370 | | int arcompact_handle01_01_00_03_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRGE"); } |
| 371 | | int arcompact_handle01_01_00_04_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRLO"); } |
| 372 | | int arcompact_handle01_01_00_05_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BRHS"); } |
| 373 | | int arcompact_handle01_01_00_0e_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BBIT0");} |
| 374 | | int arcompact_handle01_01_00_0f_dasm(DASM_OPS_32) { return arcompact_01_01_00_helper( output, pc, op, oprom, "BBIT1");} |
| 375 | | |
| 376 | | int arcompact_01_01_01_helper(char *output, offs_t pc, UINT32 op, const UINT8* oprom, const char* optext) |
| 377 | | { |
| 378 | | int size = 4; |
| 379 | | |
| 380 | | // using 'b' as limm here makes no sense (comparing a long immediate against a short immediate) so I assume it isn't |
| 381 | | // valid? |
| 382 | | |
| 383 | | // Branch on Compare / Bit Test - Register-Immediate |
| 384 | | // 0000 1bbb ssss sss1 SBBB uuuu uuN1 iiii |
| 385 | | GET_01_01_01_BRANCH_ADDR |
| 386 | | |
| 387 | | int u = (op & 0x00000fc0) >> 6; |
| 388 | | int b = (op & 0x07000000) >> 24; |
| 389 | | b |= ((op & 0x00007000) >> 12) << 3; |
| 390 | | int n = (op & 0x00000020) >> 5; op &= ~0x00000020; |
| 391 | | |
| 392 | | op &= ~0x07007fe0; |
| 393 | | |
| 394 | | print("%s%s %s %02x %08x (%08x)", optext, delaybit[n], regnames[b], u, pc + (address * 2) + 4, op & ~0xf8fe800f); |
| 395 | | |
| 396 | | return size; |
| 397 | | } |
| 398 | | |
| 399 | | // register -immediate cases |
| 400 | | int arcompact_handle01_01_01_00_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BREQ"); } |
| 401 | | int arcompact_handle01_01_01_01_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRNE"); } |
| 402 | | int arcompact_handle01_01_01_02_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRLT"); } |
| 403 | | int arcompact_handle01_01_01_03_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRGE"); } |
| 404 | | int arcompact_handle01_01_01_04_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRLO"); } |
| 405 | | int arcompact_handle01_01_01_05_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BRHS"); } |
| 406 | | int arcompact_handle01_01_01_0e_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BBIT0"); } |
| 407 | | int arcompact_handle01_01_01_0f_dasm(DASM_OPS_32) { return arcompact_01_01_01_helper(output, pc, op, oprom, "BBIT1"); } |
| 408 | | |
| 409 | | |
| 410 | 358 | int arcompact_handle02_dasm(DASM_OPS_32) |
| 411 | 359 | { |
| 412 | 360 | // bitpos |
| r242421 | r242422 | |
| 1041 | 989 | |
| 1042 | 990 | |
| 1043 | 991 | |
| 1044 | | int arcompact_handle0e_0x_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext, int revop) |
| 992 | |
| 993 | |
| 994 | |
| 995 | int arcompact_handle0e_00_dasm(DASM_OPS_16) |
| 1045 | 996 | { |
| 1046 | | int h,breg; |
| 997 | int h; |
| 1047 | 998 | int size = 2; |
| 1048 | 999 | |
| 1049 | 1000 | GROUP_0e_GET_h; |
| 1050 | | COMMON16_GET_breg; |
| 1051 | | REG_16BIT_RANGE(breg); |
| 1052 | | |
| 1001 | |
| 1053 | 1002 | if (h == LIMM_REG) |
| 1054 | 1003 | { |
| 1055 | 1004 | UINT32 limm; |
| 1056 | 1005 | GET_LIMM; |
| 1057 | 1006 | size = 6; |
| 1058 | | if (!revop) print("%s %s, (%08x) (%04x)", optext, regnames[breg], limm, op); |
| 1059 | | else print("%s (%08x), %s (%04x)", optext, limm, regnames[breg], op); |
| 1007 | print("ADD_S b <- b + (%08x) (%04x)", limm, op); |
| 1060 | 1008 | } |
| 1061 | 1009 | else |
| 1062 | 1010 | { |
| 1063 | | if (!revop) print("%s %s, %s (%04x)", optext, regnames[breg], regnames[h], op); |
| 1064 | | else print("%s %s, %s (%04x)", optext, regnames[h], regnames[breg], op); |
| 1065 | 1011 | |
| 1012 | print("ADD_S b <- b + (r%d) (%04x)", h, op); |
| 1066 | 1013 | } |
| 1067 | 1014 | |
| 1068 | 1015 | return size; |
| 1069 | | |
| 1070 | 1016 | } |
| 1071 | 1017 | |
| 1072 | | int arcompact_handle0e_00_dasm(DASM_OPS_16) |
| 1073 | | { |
| 1074 | | return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "ADD_S", 0); |
| 1075 | | } |
| 1076 | | |
| 1077 | 1018 | int arcompact_handle0e_01_dasm(DASM_OPS_16) |
| 1078 | 1019 | { |
| 1079 | | return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "MOV_S", 0); |
| 1020 | int h; |
| 1021 | int size = 2; |
| 1022 | GROUP_0e_GET_h; |
| 1023 | |
| 1024 | if (h == LIMM_REG) |
| 1025 | { |
| 1026 | UINT32 limm; |
| 1027 | GET_LIMM; |
| 1028 | size = 6; |
| 1029 | print("MOV_S b <- (%08x) (%04x)", limm, op); |
| 1030 | } |
| 1031 | else |
| 1032 | { |
| 1033 | print("MOV_S b <- (r%d) (%04x)", h, op); |
| 1034 | } |
| 1035 | return size; |
| 1080 | 1036 | } |
| 1081 | 1037 | |
| 1082 | 1038 | int arcompact_handle0e_02_dasm(DASM_OPS_16) |
| 1083 | 1039 | { |
| 1084 | | return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "CMP_S", 0); |
| 1040 | int h; |
| 1041 | int size = 2; |
| 1042 | GROUP_0e_GET_h; |
| 1043 | |
| 1044 | if (h == LIMM_REG) |
| 1045 | { |
| 1046 | UINT32 limm; |
| 1047 | GET_LIMM; |
| 1048 | size = 6; |
| 1049 | print("CMP_S b - (%08x) (%04x)", limm, op); |
| 1050 | } |
| 1051 | else |
| 1052 | { |
| 1053 | print("CMP_S b - (r%d) (%04x)", h, op); |
| 1054 | } |
| 1055 | return size; |
| 1085 | 1056 | } |
| 1086 | 1057 | |
| 1087 | 1058 | int arcompact_handle0e_03_dasm(DASM_OPS_16) |
| 1088 | 1059 | { |
| 1089 | | return arcompact_handle0e_0x_helper_dasm(output, pc, op, oprom, "MOV_S", 1); |
| 1060 | int h; |
| 1061 | int size = 2; |
| 1062 | GROUP_0e_GET_h; |
| 1063 | |
| 1064 | if (h == LIMM_REG) |
| 1065 | { |
| 1066 | UINT32 limm; |
| 1067 | GET_LIMM; |
| 1068 | size = 6; |
| 1069 | print("MOV_S (%08x) <- b (%04x)", limm, op); |
| 1070 | } |
| 1071 | else |
| 1072 | { |
| 1073 | print("MOV_S (r%d) <- b (%04x)", h, op); |
| 1074 | } |
| 1075 | |
| 1076 | return size; |
| 1090 | 1077 | } |
| 1091 | 1078 | |
| 1092 | 1079 | |
| r242421 | r242422 | |
| 1147 | 1134 | int arcompact_handle0f_1f_dasm(DASM_OPS_16) { print("BRK_S (%08x)", op); return 2;} |
| 1148 | 1135 | |
| 1149 | 1136 | |
| 1150 | | int arcompact_handle_ld_helper_dasm(char *output, offs_t pc, UINT16 op, const UINT8* oprom, const char* optext, int shift, int swap) |
| 1137 | int arcompact_handle10_dasm(DASM_OPS_16) |
| 1151 | 1138 | { |
| 1152 | | int breg, creg, u; |
| 1153 | | |
| 1154 | | COMMON16_GET_breg; |
| 1155 | | COMMON16_GET_creg; |
| 1156 | | COMMON16_GET_u5; |
| 1157 | | |
| 1158 | | REG_16BIT_RANGE(breg); |
| 1159 | | REG_16BIT_RANGE(creg); |
| 1160 | | |
| 1161 | | u <<= shift; |
| 1162 | | |
| 1163 | | if (!swap) print("%s %s, [%s, 0x%02x] (%04x)", optext, regnames[creg], regnames[breg], u, op); |
| 1164 | | else print("%s [%s, 0x%02x], %s (%04x)", optext, regnames[breg], u, regnames[creg], op); |
| 1139 | print("LD_S (%04x)", op); |
| 1165 | 1140 | return 2; |
| 1166 | | |
| 1167 | 1141 | } |
| 1168 | 1142 | |
| 1169 | | |
| 1170 | | int arcompact_handle10_dasm(DASM_OPS_16) |
| 1171 | | { |
| 1172 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LD_S", 2, 0); |
| 1173 | | } |
| 1174 | | |
| 1175 | 1143 | int arcompact_handle11_dasm(DASM_OPS_16) |
| 1176 | 1144 | { |
| 1177 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LDB_S", 0, 0); |
| 1145 | print("LDB_S (%04x)", op); |
| 1146 | return 2; |
| 1178 | 1147 | } |
| 1179 | 1148 | |
| 1180 | 1149 | int arcompact_handle12_dasm(DASM_OPS_16) |
| 1181 | 1150 | { |
| 1182 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LDW_S", 1, 0); |
| 1151 | print("LDW_S (%04x)", op); |
| 1152 | return 2; |
| 1183 | 1153 | } |
| 1184 | 1154 | |
| 1185 | 1155 | int arcompact_handle13_dasm(DASM_OPS_16) |
| 1186 | 1156 | { |
| 1187 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "LDW_S.X", 1, 0); |
| 1157 | print("LSW_S.X (%04x)", op); |
| 1158 | return 2; |
| 1188 | 1159 | } |
| 1189 | 1160 | |
| 1190 | 1161 | int arcompact_handle14_dasm(DASM_OPS_16) |
| 1191 | 1162 | { |
| 1192 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "ST_S", 2, 1); |
| 1163 | print("ST_S (%04x)", op); |
| 1164 | return 2; |
| 1193 | 1165 | } |
| 1194 | 1166 | |
| 1195 | 1167 | int arcompact_handle15_dasm(DASM_OPS_16) |
| 1196 | 1168 | { |
| 1197 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "STB_S", 0, 1); |
| 1169 | print("STB_S (%04x)", op); |
| 1170 | return 2; |
| 1198 | 1171 | } |
| 1199 | 1172 | |
| 1200 | 1173 | int arcompact_handle16_dasm(DASM_OPS_16) |
| 1201 | 1174 | { |
| 1202 | | return arcompact_handle_ld_helper_dasm(output, pc, op, oprom, "STW_S", 1, 1); |
| 1175 | print("STW_S (%04x)", op); |
| 1176 | return 2; |
| 1203 | 1177 | } |
| 1204 | 1178 | |
| 1205 | 1179 | |
| r242421 | r242422 | |
| 1315 | 1289 | // op bits remaining for 0x18_06_xx subgroups 0x0700 |
| 1316 | 1290 | int arcompact_handle18_06_01_dasm(DASM_OPS_16) |
| 1317 | 1291 | { |
| 1318 | | int breg = (op & 0x0700) >> 8; |
| 1292 | int b = (op & 0x0700) >> 8; |
| 1319 | 1293 | op &= ~0x0700; // all bits now used |
| 1320 | | REG_16BIT_RANGE(breg) |
| 1321 | 1294 | |
| 1322 | | print("POP_S %s", regnames[breg]); |
| 1295 | print("POP_S [%02x]", b); |
| 1323 | 1296 | |
| 1324 | 1297 | return 2; |
| 1325 | 1298 | } |
| r242421 | r242422 | |
| 1340 | 1313 | // op bits remaining for 0x18_07_xx subgroups 0x0700 |
| 1341 | 1314 | int arcompact_handle18_07_01_dasm(DASM_OPS_16) |
| 1342 | 1315 | { |
| 1343 | | int breg = (op & 0x0700) >> 8; |
| 1316 | int b = (op & 0x0700) >> 8; |
| 1344 | 1317 | op &= ~0x0700; // all bits now used |
| 1345 | | REG_16BIT_RANGE(breg) |
| 1346 | 1318 | |
| 1347 | | print("PUSH_S %s", regnames[breg]); |
| 1319 | print("PUSH_S [%02x]", b); |
| 1348 | 1320 | |
| 1349 | 1321 | return 2; |
| 1350 | 1322 | } |
| r242421 | r242422 | |
| 1376 | 1348 | |
| 1377 | 1349 | int arcompact_handle1b_dasm(DASM_OPS_16) |
| 1378 | 1350 | { |
| 1379 | | int breg, u; |
| 1380 | | COMMON16_GET_breg; |
| 1381 | | COMMON16_GET_u8; |
| 1382 | | REG_16BIT_RANGE(breg); |
| 1383 | | |
| 1384 | | print("MOV_S %s, %02x", regnames[breg], u); |
| 1351 | print("MOV_S (%04x)", op); |
| 1385 | 1352 | return 2; |
| 1386 | 1353 | } |
| 1387 | 1354 | |
| 1388 | | int arcompact_handle1c_00_dasm(DASM_OPS_16) |
| 1389 | | { |
| 1390 | | int breg, u; |
| 1391 | | COMMON16_GET_breg; |
| 1392 | | COMMON16_GET_u7; |
| 1393 | | REG_16BIT_RANGE(breg); |
| 1355 | int arcompact_handle1c_00_dasm(DASM_OPS_16) { print("ADD_S b <- b + u7 (%04x)", op); return 2;} |
| 1356 | int arcompact_handle1c_01_dasm(DASM_OPS_16) { print("CMP_S b - u7 (%04x)", op); return 2;} |
| 1394 | 1357 | |
| 1395 | | print("ADD_S %s, %02x", regnames[breg], u); |
| 1396 | | return 2; |
| 1397 | | } |
| 1398 | 1358 | |
| 1399 | | int arcompact_handle1c_01_dasm(DASM_OPS_16) |
| 1400 | | { |
| 1401 | | int breg, u; |
| 1402 | | COMMON16_GET_breg; |
| 1403 | | COMMON16_GET_u7; |
| 1404 | | REG_16BIT_RANGE(breg); |
| 1405 | | |
| 1406 | | print("CMP_S %s, %02x", regnames[breg], u); |
| 1407 | | return 2; |
| 1408 | | } |
| 1409 | | |
| 1410 | | |
| 1411 | 1359 | int arcompact_handle1d_00_dasm(DASM_OPS_16) { print("BREQ_S (%04x)", op); return 2;} |
| 1412 | 1360 | int arcompact_handle1d_01_dasm(DASM_OPS_16) { print("BRNE_S (%04x)", op); return 2;} |
| 1413 | 1361 | |