Implemented mov instruction core...

This commit is contained in:
xolatile
2024-07-06 08:03:05 -04:00
parent bfd7a1ab04
commit 5efba26804
2 changed files with 48 additions and 0 deletions

View File

@ -449,6 +449,21 @@ nnn: nop
nop nop
cmovg r9, r9; 4D 0F 4F C9 cmovg r9, r9; 4D 0F 4F C9
nop
nop
nop
nop
mov rcx, rdx
nop
mov rdx, [x8]
nop
mov qword[x8], rdx
nop
mov rdx, 1122334455667788h
nop
mov qword[x8], 11223344h
nop nop
nop nop

View File

@ -240,6 +240,34 @@ static void build_move_if (operation_index operation,
//~displacement (4, 0X12345678); // Not implemented at this point! //~displacement (4, 0X12345678); // Not implemented at this point!
} }
// SPECIAL!
static void build_move (size_index size,
type_index to,
next destination,
type_index from,
next source) {
/* */
build_short_prefix (size == D16);
build_long_prefix (size == D64,
(to == REG) && (upper ((form) destination)),
(from == REG) && (upper ((form) source)));
place ((to == REG) && (from == REG), (byte) (0X88 + (size != D8)));
place ((to == REG) && (from == MEM), (byte) (0X8A + (size != D8)));
place ((to == MEM) && (from == REG), (byte) (0X88 + (size != D8)));
build_register_redirection ((to == REG) && (from == MEM), destination);
build_register_redirection ((to == MEM) && (from == REG), source);
place ((to == REG) && (from == IMM), (byte) (0XB0
+ 0X08 * (size != D8)
+ 0X01 * (destination & 0X07)));
place ((to == MEM) && (from == IMM), (byte) (0XC6 + (size != D8)));
place ((to == MEM) && (from == IMM), (byte) (0X05));
}
next token_count; next token_count;
byte * token_array; byte * token_array;
@ -279,6 +307,11 @@ void assemble (next count,
array [index + 2], array [index + 3], array [index + 2], array [index + 3],
array [index + 4], array [index + 5]); array [index + 4], array [index + 5]);
index += 5; index += 5;
} else if (array [index] == MOV) {
build_move_if (array [index + 1], array [index + 2],
array [index + 3], array [index + 4],
array [index + 5]);
index += 5;
} }
} }
} }