Tested all regular and irregular instructions with registers...

This commit is contained in:
xolatile
2024-07-08 19:37:50 -04:00
parent 8462947b12
commit af3ef51339
4 changed files with 28 additions and 29 deletions

View File

@ -169,6 +169,9 @@ static void build_irregular (operation_index operation,
build_long_prefix (size == D64, build_long_prefix (size == D64,
(to == REG) && (upper ((form) destination)), 0); (to == REG) && (upper ((form) destination)), 0);
// 40>front
place ((size == D8) && (to == REG) && front (destination), (byte) 0X40);
place (1, (byte) (0XF6 place (1, (byte) (0XF6
+ 0X08 * ((operation == INC) || (operation == DEC)) + 0X08 * ((operation == INC) || (operation == DEC))
+ 0X01 * (size != D8))); + 0X01 * (size != D8)));

View File

@ -4,6 +4,10 @@ static char * fa [] = {
"add", "or", "adc", "sbb", "and", "sub", "xor", "cmp" "add", "or", "adc", "sbb", "and", "sub", "xor", "cmp"
}; };
static char * faa [] = {
"inc", "dec", "not", "neg", "mul", "imul", "div", "idiv"
};
static char * fr [] = { static char * fr [] = {
"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@ -33,27 +37,26 @@ int main (void) {
printf ("nop\n"); printf ("nop\n");
printf ("nop\n"); printf ("nop\n");
for (a = 0; a < (int) (sizeof (fa) / sizeof (* fa)); ++a) { //~for (a = 0; a < (int) (sizeof (fa) / sizeof (* fa)); ++a) {
//~for (w = 0; w < 4; ++w) {
//~for (d = 0; d < 16; ++d) {
//~for (s = 0; s < 16; ++s) {
//~printf ("nop\n");
//~printf ("%s %s, %s\n", fa [a], fr [d + 16 * w], fr [s + 16 * w]);
//~}
//~}
//~}
//~}
for (a = 0; a < (int) (sizeof (faa) / sizeof (* faa)); ++a) {
for (w = 0; w < 4; ++w) { for (w = 0; w < 4; ++w) {
for (d = 0; d < 16; ++d) { for (d = 0; d < 16; ++d) {
for (s = 0; s < 16; ++s) { printf ("nop\n");
printf ("nop\n"); printf ("%s %s\n", faa [a], fr [d + 16 * w]);
printf ("%s %s, %s\n", fa [a], fr [d + 16 * w], fr [s + 16 * w]);
}
} }
} }
} }
//~a = 0;
//~w = 3;
//~for (d = 0; d < 16; ++d) {
//~for (s = 0; s < 16; ++s) {
//~printf ("nop\n");
//~printf ("%s %s, %s\n", fa [a], fr [d + 16 * w], fr [s + 16 * w]);
//~}
//~}
printf ("nop\n"); printf ("nop\n");
printf ("nop\n"); printf ("nop\n");
printf ("nop\n"); printf ("nop\n");

View File

@ -2,6 +2,6 @@
set -xe set -xe
diff -s -y -t --color=auto flatten.txt xlatten.txt diff flatten.txt xlatten.txt
exit exit

View File

@ -8,6 +8,10 @@ static char * fa [] = {
"ADD", "OR", "ADC", "SBB", "AND", "SUB", "XOR", "CMP" "ADD", "OR", "ADC", "SBB", "AND", "SUB", "XOR", "CMP"
}; };
static char * faa [] = {
"INC", "DEC", "NOT", "NEG", "UMUL", "IMUL", "UDIV", "IDIV"
};
static char * fr [] = { static char * fr [] = {
"REG, R0", "REG, R1", "REG, R2", "REG, R3", "REG, R4", "REG, R5", "REG, R6", "REG, R7", "REG, R0", "REG, R1", "REG, R2", "REG, R3", "REG, R4", "REG, R5", "REG, R6", "REG, R7",
"REG, R8", "REG, R9", "REG, R10", "REG, R11", "REG, R12", "REG, R13", "REG, R14", "REG, R15" "REG, R8", "REG, R9", "REG, R10", "REG, R11", "REG, R12", "REG, R13", "REG, R14", "REG, R15"
@ -20,24 +24,13 @@ static char * fi [] = {
int main (void) { int main (void) {
int a, w, t, d, f, s; int a, w, t, d, f, s;
for (a = 0; a < (int) (sizeof (fa) / sizeof (* fa)); ++a) { for (a = 0; a < (int) (sizeof (faa) / sizeof (* faa)); ++a) {
for (w = 0; w < 4; ++w) { for (w = 0; w < 4; ++w) {
for (d = 0; d < 16; ++d) { for (d = 0; d < 16; ++d) {
for (s = 0; s < 16; ++s) { printf ("NOP, %s, %s, %s,\n", faa [a], fw [w], fr [d]);
printf ("NOP, %s, %s, %s, %s,\n", fa [a], fw [w], fr [d], fr [s]);
}
} }
} }
} }
//~a = 0;
//~w = 3;
//~for (d = 0; d < 16; ++d) {
//~for (s = 0; s < 16; ++s) {
//~printf ("NOP, %s, %s, %s, %s,\n", fa [a], fw [w], fr [d], fr [s]);
//~}
//~}
return (0); return (0);
} }