Changeset 1656
- Timestamp:
- 07/21/08 00:36:15 (1 month ago)
- Files:
-
- libemu/trunk/src/functions/cmp.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libemu/trunk/src/functions/cmp.c
r1639 r1656 26 26 *******************************************************************************/ 27 27 28 #include <endian.h> 28 29 #include <stdint.h> 29 30 … … 34 35 bcopy(&(a), &operand_a, bits/8); \ 35 36 bcopy(&(b), &operand_b, bits/8); \ 36 UINT(bits) operation_result = operand_a operation operand_b; 37 UINT(bits) operation_result = operand_a operation operand_b; 37 38 #else // ENDIAN 38 39 #define INSTR_CALC(bits, a, b, operation) \ … … 47 48 48 49 #include "emu/emu_memory.h" 49 50 50 51 51 #ifdef INSTR_CALC_AND_SET_FLAGS … … 355 355 *i->imm16, 356 356 -) 357 358 MEM_WORD_WRITE(c, i->modrm.ea, dst);359 360 357 } 361 358 else … … 373 370 i->imm, 374 371 -) 375 376 MEM_DWORD_WRITE(c, i->modrm.ea, dst);377 378 372 } 379 373 } … … 414 408 int32_t instr_group_1_83_cmp(struct emu_cpu *c, struct emu_cpu_instruction *i) 415 409 { 410 411 /* As the INSTR_CALC for big endian uses bcopy of the operands size, we have to create an operand of the size 412 * and use it, the replacement aligned equal size operand is called imm 413 */ 414 #if BYTE_ORDER == BIG_ENDIAN 415 uint8_t imm8; 416 bcopy(i->imm8, &imm8, 1); 417 uint32_t imm = imm8; 418 #endif 419 416 420 if ( i->modrm.mod != 3 ) 417 421 { … … 426 430 uint16_t dst; 427 431 MEM_WORD_READ(c, i->modrm.ea, &dst); 428 429 432 INSTR_CALC_AND_SET_FLAGS(16, 430 433 c, 431 434 dst, 435 #if BYTE_ORDER == BIG_ENDIAN 436 imm, 437 #else 432 438 *i->imm8, 439 #endif 433 440 -) 434 435 MEM_WORD_WRITE(c, i->modrm.ea, dst);436 437 441 } 438 442 else … … 451 455 c, 452 456 dst, 453 *i->imm8, 454 -) 455 MEM_DWORD_WRITE(c, i->modrm.ea, dst); 457 #if BYTE_ORDER == BIG_ENDIAN 458 imm, 459 #else 460 *i->imm8, 461 #endif 462 463 -) 456 464 } 457 465 } … … 468 476 c, 469 477 *c->reg16[i->modrm.rm], 470 *i->imm8, 478 #if BYTE_ORDER == BIG_ENDIAN 479 imm, 480 #else 481 *i->imm8, 482 #endif 483 471 484 -) 472 485 } … … 481 494 c, 482 495 c->reg[i->modrm.rm], 483 *i->imm8, 484 -) 485 } 486 } 487 return 0; 488 } 496 #if BYTE_ORDER == BIG_ENDIAN 497 imm, 498 #else 499 *i->imm8, 500 #endif 501 502 -) 503 } 504 } 505 return 0; 506 }
