Small safe changes to mov instruction...

This commit is contained in:
xolatile
2024-07-21 18:01:31 -04:00
parent bb468d1ac4
commit e4afc20f87
2 changed files with 16 additions and 12 deletions

View File

@ -298,10 +298,10 @@ static void build_move(unsigned int size,
input((to == MEM) && (from == IMM), 0xc6 + (size != D8));
input((to == MEM) && (from == IMM), 0x05);
input_at((to == REG) && (from == MEM), D32, source, 0);
input_at((to == REG) && (from == MEM), D32, source, 0x1000);
input_by((to == REG) && (from == IMM), size, source);
input_at((to == MEM) && (from == REG), D32, ~0x0u, ~0x0u);
input_at((to == MEM) && (from == IMM), D32, ~0x0u, ~0x0u);
input_at((to == MEM) && (from == REG), D32, destination, 0x1000);
input_at((to == MEM) && (from == IMM), D32, destination, 0x1000);
input_by((to == MEM) && (from == IMM), size, source);
input_at((to == REG) && (from == REL), D32, source, 0x4010b0);
}
@ -418,15 +418,18 @@ void assemble(unsigned int count,
while (index < count) {
if (array[index] == ASMDIRREL) {
asmdirrel(1, array[index + 1]);
asmdirrel(1,
array[index + 1]);
index += 1;
} else if (array[index] == ASMDIRMEM) {
asmdirmem(1, array[index + 1]);
asmdirmem(1,
array[index + 1]);
index += 1;
} else if (array[index] == ASMDIRIMM) {
unsigned int repeat = 0;
while (repeat < array[index + 2]) {
asmdirimm(1, array[index + 1],
asmdirimm(1,
array[index + 1],
array[index + 3 + repeat]);
++repeat;
}

View File

@ -10,21 +10,22 @@ int main (int argc, char * * argv) {
file_echo (file, "format ELF64 executable 3\n");
file_echo (file, "segment readable executable\n");
file_echo (file, "entry $\n");
file_echo (file, "x0:\n");
file_echo (file, "fff:\n");
file_echo (file, "nop\n");
for (i = 1; i < argc; ++i) {
if (i == 3) {
file_echo (file, ", ");
} else {
file_echo (file, " ");
if (argv [i] [0] == '+') {
file_echo (file, "\nnop\n");
continue;
}
file_echo (file, " ");
file_echo (file, argv [i]);
}
file_echo (file, "\nnop\n");
file_echo (file, "segment readable writable\n");
file_echo (file, "nnn:\n");
file_echo (file, "x1: db 11h\n");
file_echo (file, "x2: dw 1122h\n");
file_echo (file, "x4: dd 11223344h\n");