Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN {
- countCommand = 0; #счетчик команд
- fReadCommand = 0; #1 - происходит чтение команды и аргументов, 0 - не происходит
- modR = 0; #16-битный или 8-битный режим
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0; #флаг для команд LES и LDS
- isGroupInstruction = 0; #флаг для команд, использующих с 5 по 3 бит байта modR/M(Groups of instructions )
- isx83 = 0; #флаг для команд 0х83
- firstArg = 0; #флаг для первого аргумента команд. 0 - r/m, 1 - r, 2 - fixRegister, 3 - addr
- secondArg = 0; #флаг для второго аргумента команд. 0 - other, 1 - addr
- fEndCode = 0; #флаг конца кода
- }
- #{
- # if(fEndCode == 1 )
- # {
- # Command[countCommand] = $1 " db " $2;
- # countCommand++;
- # next;
- # }
- #}
- {
- if(fReadCommand != 0)
- {
- #расшифровка команд, использующих с 5 по 3 бит байта modR/M(Groups of instructions )
- if(isGroupInstruction == 1)
- {
- MODRM_one = substr($2,1,1);
- MODRM_two = substr($2,2,1);
- if(Command[countCommand] == "_ROT reg,1") { print("frgt"); }
- if(MODRM_one == "0") { binMODRM = "0000"; }
- if(MODRM_one == "1") { binMODRM = "0001"; }
- if(MODRM_one == "2") { binMODRM = "0010"; }
- if(MODRM_one == "3") { binMODRM = "0011"; }
- if(MODRM_one == "4") { binMODRM = "0100"; }
- if(MODRM_one == "5") { binMODRM = "0101"; }
- if(MODRM_one == "6") { binMODRM = "0110"; }
- if(MODRM_one == "7") { binMODRM = "0111"; }
- if(MODRM_one == "8") { binMODRM = "1000"; }
- if(MODRM_one == "9") { binMODRM = "1001"; }
- if(MODRM_one == "a") { binMODRM = "1010"; }
- if(MODRM_one == "b") { binMODRM = "1011"; }
- if(MODRM_one == "c") { binMODRM = "1100"; }
- if(MODRM_one == "d") { binMODRM = "1101"; }
- if(MODRM_one == "e") { binMODRM = "1110"; }
- if(MODRM_one == "f") { binMODRM = "1111"; }
- if(MODRM_two == "0") { binMODRM = binMODRM "0000"; }
- if(MODRM_two == "1") { binMODRM = binMODRM "0001"; }
- if(MODRM_two == "2") { binMODRM = binMODRM "0010"; }
- if(MODRM_two == "3") { binMODRM = binMODRM "0011"; }
- if(MODRM_two == "4") { binMODRM = binMODRM "0100"; }
- if(MODRM_two == "5") { binMODRM = binMODRM "0101"; }
- if(MODRM_two == "6") { binMODRM = binMODRM "0110"; }
- if(MODRM_two == "7") { binMODRM = binMODRM "0111"; }
- if(MODRM_two == "8") { binMODRM = binMODRM "1000"; }
- if(MODRM_two == "9") { binMODRM = binMODRM "1001"; }
- if(MODRM_two == "a") { binMODRM = binMODRM "1010"; }
- if(MODRM_two == "b") { binMODRM = binMODRM "1011"; }
- if(MODRM_two == "c") { binMODRM = binMODRM "1100"; }
- if(MODRM_two == "d") { binMODRM = binMODRM "1101"; }
- if(MODRM_two == "e") { binMODRM = binMODRM "1110"; }
- if(MODRM_two == "f") { binMODRM = binMODRM "1111"; }
- binR = substr(binMODRM,3,3);
- tempo2 = Command[countCommand];
- if(binR == "000") { gsub("_ALU1", "ADD", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_POP", "POP", tempo2); gsub("_ROT", "ROL", tempo2); gsub("_ALU2", "TEST", tempo2); gsub("_MISC", "INC", tempo2); }
- if(binR == "001") { gsub("_ALU1", "OR", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "ROR", tempo2); gsub("_ALU2", "*TEST", tempo2); gsub("_MISC", "DEC", tempo2); }
- if(binR == "010") { gsub("_ALU1", "ADC", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "RCL", tempo2); gsub("_ALU2", "NOT", tempo2); }
- if(binR == "011") { gsub("_ALU1", "SBB", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "RCR", tempo2); gsub("_ALU2", "NEG", tempo2); }
- if(binR == "100") { gsub("_ALU1", "AND", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "SHL/SAL", tempo2); gsub("_ALU2", "MUL", tempo2); }
- if(binR == "101") { gsub("_ALU1", "SUB", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "SHR", tempo2); gsub("_ALU2", "IMUL", tempo2); }
- if(binR == "110") { gsub("_ALU1", "XOR", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "*SHL/*SAL", tempo2); gsub("_ALU2", "DIV", tempo2); }
- if(binR == "111") { gsub("_ALU1", "CMP", tempo2); gsub("_MOV", "MOV", tempo2); gsub("_ROT", "SAR", tempo2); gsub("_ALU2", "IDIV", tempo2); }
- Command[countCommand] = tempo2;
- binMODRM = "";
- }
- #чтение аргументов
- if(firstArg < 2 && modR != 0 && (secondArg <= 0 || isGroupInstruction == 1))
- {
- MODRM_one = substr($2,1,1);
- MODRM_two = substr($2,2,1);
- if(modR == 8)
- {
- modR_ch1 ="L";
- modR_AH_SP ="AH";
- modR_CH_BP ="CH";
- modR_DH_SI ="DH";
- modR_BH_DI ="BH";
- }
- else if(modR == 16)
- {
- modR_ch1 ="X";
- modR_AH_SP ="SP";
- modR_CH_BP ="BP";
- modR_DH_SI ="SI";
- modR_BH_DI ="DI";
- }
- if(MODRM_two >= "0" && MODRM_two <= "7")
- {
- if(MODRM_one == "0" || MODRM_one == "4" || MODRM_one == "8" || MODRM_one == "c") reg1 = "A" modR_ch1;
- if(MODRM_one == "1" || MODRM_one == "5" || MODRM_one == "9" || MODRM_one == "d") reg1 = "D" modR_ch1;
- if(MODRM_one == "2" || MODRM_one == "6" || MODRM_one == "a" || MODRM_one == "e") reg1 = modR_AH_SP;
- if(MODRM_one == "3" || MODRM_one == "7" || MODRM_one == "b" || MODRM_one == "f") reg1 = modR_DH_SI;
- }
- if(MODRM_two >= "8" && MODRM_two <= "f")
- {
- if(MODRM_one == "0" || MODRM_one == "4" || MODRM_one == "8" || MODRM_one == "c") reg1 = "C" modR_ch1;
- if(MODRM_one == "1" || MODRM_one == "5" || MODRM_one == "9" || MODRM_one == "d") reg1 = "B" modR_ch1;
- if(MODRM_one == "2" || MODRM_one == "6" || MODRM_one == "a" || MODRM_one == "e") reg1 = modR_CH_BP;
- if(MODRM_one == "3" || MODRM_one == "7" || MODRM_one == "b" || MODRM_one == "f") reg1 = modR_BH_DI;
- }
- if(MODRM_one < "4")
- {
- if(MODRM_two == "0" || MODRM_two == "8") reg2="[BX+SI]";
- if(MODRM_two == "1" || MODRM_two == "9") reg2="[BX+DI]";
- if(MODRM_two == "2" || MODRM_two == "a") reg2="[BP+SI]";
- if(MODRM_two == "3" || MODRM_two == "b") reg2="[BP+DI]";
- if(MODRM_two == "4" || MODRM_two == "c") reg2="[SI]";
- if(MODRM_two == "5" || MODRM_two == "d") reg2="[DI]";
- if(MODRM_two == "6" || MODRM_two == "e") { reg2="addr"; secondArg=1; modR=16;};
- if(MODRM_two == "7" || MODRM_two == "f") reg2="[BX]";
- }
- if(MODRM_one >= "4" && MODRM_one < "8")
- {
- if(MODRM_two == "0" || MODRM_two == "8") { reg2="[BX+SI]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "1" || MODRM_two == "9") { reg2="[BX+DI]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "2" || MODRM_two == "a") { reg2="[BP+SI]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "3" || MODRM_two == "b") { reg2="[BP+DI]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "4" || MODRM_two == "c") { reg2="[SI]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "5" || MODRM_two == "d") { reg2="[DI]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "6" || MODRM_two == "e") { reg2="[BP]+addr"; secondArg=1; modR=8;};
- if(MODRM_two == "7" || MODRM_two == "f") { reg2="[BX]+addr"; secondArg=1; modR=8;};
- }
- if(MODRM_one >= "8" && MODRM_one < "c")
- {
- if(MODRM_two == "0" || MODRM_two == "8") { reg2="[BX+SI]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "1" || MODRM_two == "9") { reg2="[BX+DI]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "2" || MODRM_two == "a") { reg2="[BP+SI]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "3" || MODRM_two == "b") { reg2="[BP+DI]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "4" || MODRM_two == "c") { reg2="[SI]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "5" || MODRM_two == "d") { reg2="[DI]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "6" || MODRM_two == "e") { reg2="[BP]+addr"; secondArg=1; modR=16;};
- if(MODRM_two == "7" || MODRM_two == "f") { reg2="[BX]+addr"; secondArg=1; modR=16;};
- }
- if(MODRM_one >= "c" && MODRM_one <= "f")
- {
- if(MODRM_two == "0" || MODRM_two == "8") reg2="A" modR_ch1;
- if(MODRM_two == "1" || MODRM_two == "9") reg2="C" modR_ch1;
- if(MODRM_two == "2" || MODRM_two == "a") reg2="D" modR_ch1;
- if(MODRM_two == "3" || MODRM_two == "b") reg2="B" modR_ch1;
- if(MODRM_two == "4" || MODRM_two == "c") reg2=modR_AH_SP;
- if(MODRM_two == "5" || MODRM_two == "d") reg2=modR_CH_BP;
- if(MODRM_two == "6" || MODRM_two == "e") reg2=modR_DH_SI;
- if(MODRM_two == "7" || MODRM_two == "f") reg2=modR_BH_DI;
- }
- temp = "nyll"
- if(firstArg <= 0)
- {
- temp = reg1;
- reg1 = reg2;
- reg2 = temp;
- }
- if(isGroupInstruction == 1)
- {
- temp = Command[countCommand];
- gsub("reg", reg2, temp);
- Command[countCommand] = temp;
- if(firstArg == -1 || secondArg == -1) { fReadCommand = 0; countCommand++; next;}
- firstArg = 4;
- fReadCommand=1;
- if(isx83 == 1) { isx83=0; modR = 8;}
- next;
- }
- if(firstArg==3 || secondArg == 1)
- {
- Command[countCommand] = Command[countCommand] reg1 "," reg2;
- fReadCommand=1;
- next;
- }
- if(isLES_LDS == 0) { Command[countCommand] = Command[countCommand] reg1 "," reg2; }
- else
- {
- Command[countCommand] = Command[countCommand] reg1;
- isLES_LDS = 0;
- }
- fReadCommand = 0;
- countCommand = countCommand+1;
- next;
- }
- if(firstArg == 2 && secondArg == 0)
- {
- Command[countCommand] = Command[countCommand] $2;
- modR = modR - 8;
- if(modR != 0)
- {
- next;
- }
- else
- {
- fReadCommand = 0;
- countCommand = countCommand+1;
- next;
- }
- }
- if(secondArg == 1 || firstArg == 3 )
- {
- tempo = tempo $2;
- modR = modR - 8;
- if(modR != 0)
- {
- next;
- }
- else
- {
- tempo2 = Command[countCommand];
- gsub("addr", tempo, tempo2);
- Command[countCommand] = tempo2;
- fReadCommand = 0;
- countCommand = countCommand+1;
- tempo = "";
- }
- }
- next;
- }
- }
- #все что ниже - расшифровка команд
- $2 ~ /^0/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 1;
- secondArg = 0;
- if($2 == "00")
- {
- Command[countCommand] = $1 " " "ADD ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "01")
- {
- Command[countCommand] = $1 " " "ADD ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "02")
- {
- Command[countCommand] = $1 " " "ADD ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "03")
- {
- Command[countCommand] = $1 " " "ADD ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "04")
- {
- Command[countCommand] = $1 " " "ADD AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "05")
- {
- Command[countCommand] = $1 " " "ADD AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "06")
- {
- Command[countCommand] = $1 " " "PUSH ES";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "07")
- {
- Command[countCommand] = $1 " " "POP ES";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "08")
- {
- Command[countCommand] = $1 " " "OR ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "09")
- {
- Command[countCommand] = $1 " " "OR ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "0a")
- {
- Command[countCommand] = $1 " " "OR ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "0b")
- {
- Command[countCommand] = $1 " " "OR ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "0c")
- {
- Command[countCommand] = $1 " " "OR AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "0d")
- {
- Command[countCommand] = $1 " " "OR AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "0e")
- {
- Command[countCommand] = $1 " " "PUSH CS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "0f")
- {
- Command[countCommand] = $1 " " "POP CS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- }
- }
- $2 ~ /^1/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 1;
- secondArg = 0;
- if($2 == "10")
- {
- Command[countCommand] = $1 " " "ADC ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "11")
- {
- Command[countCommand] = $1 " " "ADC ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "12")
- {
- Command[countCommand] = $1 " " "ADC ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "13")
- {
- Command[countCommand] = $1 " " "ADC ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "14")
- {
- Command[countCommand] = $1 " " "ADC AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "15")
- {
- Command[countCommand] = $1 " " "ADC AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "16")
- {
- Command[countCommand] = $1 " " "PUSH SS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "17")
- {
- Command[countCommand] = $1 " " "POP SS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "18")
- {
- Command[countCommand] = $1 " " "SBB ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "19")
- {
- Command[countCommand] = $1 " " "SBB ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "1a")
- {
- Command[countCommand] = $1 " " "SBB ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "1b")
- {
- Command[countCommand] = $1 " " "SBB ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "1c")
- {
- Command[countCommand] = $1 " " "SBB AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "1d")
- {
- Command[countCommand] = $1 " " "SBB AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "1e")
- {
- Command[countCommand] = $1 " " "PUSH DS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "1f")
- {
- Command[countCommand] = $1 " " "POP DS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- }
- }
- $2 ~ /^2/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 1;
- secondArg = 0;
- if($2 == "20")
- {
- Command[countCommand] = $1 " " "AND ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "21")
- {
- Command[countCommand] = $1 " " "AND ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "22")
- {
- Command[countCommand] = $1 " " "AND ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "23")
- {
- Command[countCommand] = $1 " " "AND ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "24")
- {
- Command[countCommand] = $1 " " "AND AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "25")
- {
- Command[countCommand] = $1 " " "AND AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "26")
- {
- Command[countCommand] = $1 " " "ES:";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "27")
- {
- Command[countCommand] = $1 " " "DAA";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "28")
- {
- Command[countCommand] = $1 " " "SUB ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "29")
- {
- Command[countCommand] = $1 " " "SUB ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "2a")
- {
- Command[countCommand] = $1 " " "SUB ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "2b")
- {
- Command[countCommand] = $1 " " "SUB ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "2c")
- {
- Command[countCommand] = $1 " " "SUB AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "2d")
- {
- Command[countCommand] = $1 " " "SUB AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "2e")
- {
- Command[countCommand] = $1 " " "CS:";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "2f")
- {
- Command[countCommand] = $1 " " "DAS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- }
- }
- $2 ~ /^3/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 1;
- secondArg = 0;
- if($2 == "30")
- {
- Command[countCommand] = $1 " " "XOR ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "31")
- {
- Command[countCommand] = $1 " " "XOR ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "32")
- {
- Command[countCommand] = $1 " " "XOR ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "33")
- {
- Command[countCommand] = $1 " " "XOR ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "34")
- {
- Command[countCommand] = $1 " " "XOR AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "35")
- {
- Command[countCommand] = $1 " " "XOR AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "36")
- {
- Command[countCommand] = $1 " " "SS:";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "37")
- {
- Command[countCommand] = $1 " " "AAA";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "38")
- {
- Command[countCommand] = $1 " " "CMP ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "39")
- {
- Command[countCommand] = $1 " " "CMP ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "3a")
- {
- Command[countCommand] = $1 " " "CMP ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "3b")
- {
- Command[countCommand] = $1 " " "CMP ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "3c")
- {
- Command[countCommand] = $1 " " "CMP AL, ";
- modR = 8;
- firstArg = 2;
- next;
- }
- if($2 == "3d")
- {
- Command[countCommand] = $1 " " "CMP AX, ";
- modR = 16;
- firstArg = 2;
- next;
- }
- if($2 == "3e")
- {
- Command[countCommand] = $1 " " "DS:";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "3f")
- {
- Command[countCommand] = $1 " " "AAS";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- }
- }
- $2 ~ /^4/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 1;
- secondArg = 0;
- if($2 == "40")
- {
- Command[countCommand] = $1 " " "INC AX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "41")
- {
- Command[countCommand] = $1 " " "INC CX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "42")
- {
- Command[countCommand] = $1 " " "INC DX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "43")
- {
- Command[countCommand] = $1 " " "INC BX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "44")
- {
- Command[countCommand] = $1 " " "INC SP";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "45")
- {
- Command[countCommand] = $1 " " "INC BP";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "46")
- {
- Command[countCommand] = $1 " " "INC SI";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "47")
- {
- Command[countCommand] = $1 " " "INC DI";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "48")
- {
- Command[countCommand] = $1 " " "DEC AX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "49")
- {
- Command[countCommand] = $1 " " "DEC CX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "4a")
- {
- Command[countCommand] = $1 " " "DEC DX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "4b")
- {
- Command[countCommand] = $1 " " "DEC BX";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "4c")
- {
- Command[countCommand] = $1 " " "DEC SP";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "4d")
- {
- Command[countCommand] = $1 " " "DEC BP";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "4e")
- {
- Command[countCommand] = $1 " " "DEC SI";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- if($2 == "4f")
- {
- Command[countCommand] = $1 " " "DEC DI";
- fReadCommand = 0;
- countCommand++;
- next;
- }
- }
- }
- $2 ~ /^5/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 0;
- secondArg = 0;
- if($2 == "50")
- {
- Command[countCommand] = $1 " " "PUSH AX";
- next;
- }
- if($2 == "51")
- {
- Command[countCommand] = $1 " " "PUSH CX";
- next;
- }
- if($2 == "52")
- {
- Command[countCommand] = $1 " " "PUSH DX";
- next;
- }
- if($2 == "53")
- {
- Command[countCommand] = $1 " " "PUSH BX";
- next;
- }
- if($2 == "54")
- {
- Command[countCommand] = $1 " " "PUSH SP";
- next;
- }
- if($2 == "55")
- {
- Command[countCommand] = $1 " " "PUSH BP";
- next;
- }
- if($2 == "56")
- {
- Command[countCommand] = $1 " " "PUSH SI";
- next;
- }
- if($2 == "57")
- {
- Command[countCommand] = $1 " " "PUSH DI";
- next;
- }
- if($2 == "58")
- {
- Command[countCommand] = $1 " " "POP AX";
- next;
- }
- if($2 == "59")
- {
- Command[countCommand] = $1 " " "POP CX";
- next;
- }
- if($2 == "5a")
- {
- Command[countCommand] = $1 " " "POP DX";
- next;
- }
- if($2 == "5b")
- {
- Command[countCommand] = $1 " " "POP BX";
- next;
- }
- if($2 == "5c")
- {
- Command[countCommand] = $1 " " "POP SP";
- next;
- }
- if($2 == "5d")
- {
- Command[countCommand] = $1 " " "POP BP";
- next;
- }
- if($2 == "5e")
- {
- Command[countCommand] = $1 " " "POP SI";
- next;
- }
- if($2 == "5f")
- {
- Command[countCommand] = $1 " " "POP DI";
- next;
- }
- countCommand++;
- }
- }
- $2 ~ /^7/ {
- if(fReadCommand == 0)
- {
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- fReadCommand = 1;
- modR = 8;
- firstArg = 2;
- secondArg = 0;
- if($2 == "70")
- {
- Command[countCommand] = $1 " " "JO ";
- next;
- }
- if($2 == "71")
- {
- Command[countCommand] = $1 " " "JNO ";
- next;
- }
- if($2 == "72")
- {
- Command[countCommand] = $1 " " "JB/JNAE ";
- next;
- }
- if($2 == "73")
- {
- Command[countCommand] = $1 " " "JNB/JAE ";
- next;
- }
- if($2 == "74")
- {
- Command[countCommand] = $1 " " "JE/JZ ";
- next;
- }
- if($2 == "75")
- {
- Command[countCommand] = $1 " " "JNE/JNZ ";
- next;
- }
- if($2 == "76")
- {
- Command[countCommand] = $1 " " "JBE/JNA ";
- next;
- }
- if($2 == "77")
- {
- Command[countCommand] = $1 " " "JNBE/JA ";
- next;
- }
- if($2 == "78")
- {
- Command[countCommand] = $1 " " "JS ";
- next;
- }
- if($2 == "79")
- {
- Command[countCommand] = $1 " " "JNS ";
- next;
- }
- if($2 == "7a")
- {
- Command[countCommand] = $1 " " "JP/JPE ";
- next;
- }
- if($2 == "7b")
- {
- Command[countCommand] = $1 " " "JNP/JPO ";
- next;
- }
- if($2 == "7c")
- {
- Command[countCommand] = $1 " " "JL/JNGE ";
- next;
- }
- if($2 == "7d")
- {
- Command[countCommand] = $1 " " "JNL/JGE ";
- next;
- }
- if($2 == "7e")
- {
- Command[countCommand] = $1 " " "JLE/JNG ";
- next;
- }
- if($2 == "7f")
- {
- Command[countCommand] = $1 " " "JNLE/JG ";
- next;
- }
- }
- }
- $2 ~ /^8/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 1;
- secondArg = 0;
- if($2 == "80")
- {
- Command[countCommand] = $1 " " "_ALU1 reg, addr";
- modR = 8;
- firstArg = 1;
- isGroupInstruction =1;
- secondArg = 1;
- next;
- }
- if($2 == "81")
- {
- Command[countCommand] = $1 " " "_ALU1 reg, addr";
- modR = 16;
- firstArg = 1;
- isGroupInstruction =1;
- secondArg = 1;
- next;
- }
- if($2 == "82")
- {
- Command[countCommand] = $1 " " "_ALU1 reg, addr";
- modR = 8;
- firstArg = 1;
- isGroupInstruction =1;
- secondArg = 1;
- next;
- }
- if($2 == "83")
- {
- Command[countCommand] = $1 " " "_ALU1 reg, addr";
- modR = 16;
- firstArg = 1;
- isGroupInstruction =1;
- secondArg = 1;
- isx83 = 1;
- next;
- }
- if($2 == "84")
- {
- Command[countCommand] = $1 " " "TEST ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "85")
- {
- Command[countCommand] = $1 " " "TEST ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "86")
- {
- Command[countCommand] = $1 " " "XCHG ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "87")
- {
- Command[countCommand] = $1 " " "XCHG ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "88")
- {
- Command[countCommand] = $1 " " "MOV ";
- modR = 8;
- firstArg = 0;
- next;
- }
- if($2 == "89")
- {
- Command[countCommand] = $1 " " "MOV ";
- modR = 16;
- firstArg = 0;
- next;
- }
- if($2 == "8a")
- {
- Command[countCommand] = $1 " " "MOV ";
- modR = 8;
- firstArg = 1;
- next;
- }
- if($2 == "8b")
- {
- Command[countCommand] = $1 " " "MOV ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "8c")
- {
- Command[countCommand] = $1 " " "_MOV reg, sr";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = 0;
- next;
- }
- if($2 == "8d")
- {
- Command[countCommand] = $1 " " "LEA ";
- modR = 16;
- firstArg = 1;
- next;
- }
- if($2 == "8e")
- {
- Command[countCommand] = $1 " " "_MOV sr, reg";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = 0;
- next;
- }
- if($2 == "8f")
- {
- Command[countCommand] = $1 " " "_POP reg";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = 0;
- next;
- }
- }
- }
- $2 ~ /^9/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- fReadCommand = 0;
- secondArg = 0;
- if($2 == "90")
- {
- Command[countCommand] = $1 " " "NOP";
- next;
- }
- if($2 == "91")
- {
- Command[countCommand] = $1 " " "XCHG AX,CX";
- next;
- }
- if($2 == "92")
- {
- Command[countCommand] = $1 " " "XCHG AX,DX";
- next;
- }
- if($2 == "93")
- {
- Command[countCommand] = $1 " " "XCHG AX,BX";
- next;
- }
- if($2 == "94")
- {
- Command[countCommand] = $1 " " "XCHG AX,SP";
- next;
- }
- if($2 == "95")
- {
- Command[countCommand] = $1 " " "XCHG AX,BP";
- next;
- }
- if($2 == "96")
- {
- Command[countCommand] = $1 " " "XCHG AX,SI";
- next;
- }
- if($2 == "97")
- {
- Command[countCommand] = $1 " " "XCHG AX,DI";
- next;
- }
- if($2 == "98")
- {
- Command[countCommand] = $1 " " "CBW";
- next;
- }
- if($2 == "99")
- {
- Command[countCommand] = $1 " " "CWD";
- next;
- }
- if($2 == "9a")
- {
- Command[countCommand] = $1 " " "CALL seg:";
- modR = 16;
- countCommand--;
- fReadCommand = 1;
- next;
- }
- if($2 == "9b")
- {
- Command[countCommand] = $1 " " "WAIT";
- next;
- }
- if($2 == "9c")
- {
- Command[countCommand] = $1 " " "PUSHF";
- next;
- }
- if($2 == "9d")
- {
- Command[countCommand] = $1 " " "POPF";
- next;
- }
- if($2 == "9e")
- {
- Command[countCommand] = $1 " " "SAHF";
- next;
- }
- if($2 == "9f")
- {
- Command[countCommand] = $1 " " "LAHF";
- next;
- }
- countCommand++;
- }
- }
- $2 ~ /^a/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- if($2 == "a0")
- {
- Command[countCommand] = $1 " " "MOV AL,[addr]";
- modR = 16;
- firstArg = 2;
- secondArg = 1;
- fReadCommand = 1;
- next;
- }
- if($2 == "a1")
- {
- Command[countCommand] = $1 " " "MOV AX,[addr]";
- modR = 16;
- firstArg = 2;
- secondArg = 1;
- fReadCommand = 1;
- next;
- }
- if($2 == "a2")
- {
- Command[countCommand] = $1 " " "MOV [addr],AL";
- modR = 16;
- firstArg = 3;
- secondArg = 0;
- fReadCommand = 1;
- next;
- }
- if($2 == "a3")
- {
- Command[countCommand] = $1 " " "MOV [addr],AX";
- modR = 16;
- firstArg = 3;
- secondArg = 0;
- fReadCommand = 1;
- next;
- }
- if($2 == "a4")
- {
- Command[countCommand] = $1 " " "MOVSB";
- fReadCommand = 1;
- countCommand++;
- next;
- }
- if($2 == "a5")
- {
- Command[countCommand] = $1 " " "MOVSW";
- fReadCommand = 1;
- countCommand++;
- next;
- }
- if($2 == "a6")
- {
- Command[countCommand] = $1 " " "CMPSB";
- fReadCommand = 1;
- countCommand++;
- next;
- }
- if($2 == "a7")
- {
- Command[countCommand] = $1 " " "CMPSW";
- fReadCommand = 1;
- countCommand++;
- next;
- }
- if($2 == "a8")
- {
- Command[countCommand] = $1 " " "TEST AL, ";
- modR = 8;
- firstArg = 2;
- secondArg = 0;
- next;
- }
- if($2 == "a9")
- {
- Command[countCommand] = $1 " " "TEST AX, ";
- modR = 16;
- firstArg = 2;
- secondArg = 0;
- next;
- }
- if($2 == "aa")
- {
- Command[countCommand] = $1 " " "STOSB";
- fReadCommand = 1;
- countCommand++;
- secondArg = 0;
- next;
- }
- if($2 == "ab")
- {
- Command[countCommand] = $1 " " "STOSW";
- fReadCommand = 1;
- countCommand++;
- secondArg = 0;
- next;
- }
- if($2 == "ac")
- {
- Command[countCommand] = $1 " " "LODSW";
- fReadCommand = 1;
- countCommand++;
- secondArg = 0;
- next;
- }
- if($2 == "ad")
- {
- Command[countCommand] = $1 " " "SCASW";
- fReadCommand = 1;
- countCommand++;
- secondArg = 0;
- next;
- }
- if($2 == "ae")
- {
- Command[countCommand] = $1 " " "CMPSW";
- fReadCommand = 1;
- countCommand++;
- secondArg = 0;
- next;
- }
- if($2 == "af")
- {
- Command[countCommand] = $1 " " "CMPSW";
- fReadCommand = 1;
- countCommand++;
- secondArg = 0;
- next;
- }
- }
- }
- $2 ~ /^b/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isx83 = 0;
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 0;
- isGroupInstruction = 0;
- if($2 == "b0")
- {
- Command[countCommand] = $1 " " "MOV AL, ";
- modR = 8;
- next;
- }
- if($2 == "b1")
- {
- Command[countCommand] = $1 " " "MOV CL, ";
- modR = 8;
- next;
- }
- if($2 == "b2")
- {
- Command[countCommand] = $1 " " "MOV DL, ";
- modR = 8;
- next;
- }
- if($2 == "b3")
- {
- Command[countCommand] = $1 " " "MOV BL, ";
- modR = 8;
- next;
- }
- if($2 == "b4")
- {
- Command[countCommand] = $1 " " "MOV AH, ";
- modR = 8;
- next;
- }
- if($2 == "b5")
- {
- Command[countCommand] = $1 " " "MOV CH, ";
- modR = 8;
- next;
- }
- if($2 == "b6")
- {
- Command[countCommand] = $1 " " "MOV DH, ";
- modR = 8;
- next;
- }
- if($2 == "b7")
- {
- Command[countCommand] = $1 " " "MOV BH, ";
- modR = 8;
- next;
- }
- if($2 == "b8")
- {
- Command[countCommand] = $1 " " "MOV AX, ";
- modR = 16;
- next;
- }
- if($2 == "b9")
- {
- Command[countCommand] = $1 " " "MOV CX, ";
- modR = 16;
- next;
- }
- if($2 == "ba")
- {
- Command[countCommand] = $1 " " "MOV DX, ";
- modR = 16;
- next;
- }
- if($2 == "bb")
- {
- Command[countCommand] = $1 " " "MOV BX, ";
- modR = 16;
- next;
- }
- if($2 == "bc")
- {
- Command[countCommand] = $1 " " "MOV SP, ";
- modR = 16;
- next;
- }
- if($2 == "bd")
- {
- Command[countCommand] = $1 " " "MOV BP, ";
- modR = 16;
- next;
- }
- if($2 == "be")
- {
- Command[countCommand] = $1 " " "MOV SI, ";
- modR = 16;
- next;
- }
- if($2 == "bf")
- {
- Command[countCommand] = $1 " " "MOV DI, ";
- modR = 16;
- next;
- }
- }
- }
- $2 ~ /^c/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- secondArg = 0;
- if($2 == "c0")
- {
- next;
- }
- if($2 == "c1")
- {
- next;
- }
- if($2 == "c2")
- {
- Command[countCommand] = $1 " " "RET ";
- modR = 16;
- fReadCommand = 1;
- firstArg = 2;
- next;
- }
- if($2 == "c3")
- {
- Command[countCommand] = $1 " " "RET";
- countCommand++;
- fReadCommand = 0;
- fEndCode = 1;
- next;
- }
- if($2 == "c4")
- {
- Command[countCommand] = $1 " " "LES ";
- modR = 16;
- fReadCommand = 1;
- firstArg = 0;
- isLES_LDS = 1;
- next;
- }
- if($2 == "c5")
- {
- Command[countCommand] = $1 " " "LDS ";
- modR = 16;
- fReadCommand = 1;
- firstArg = 0;
- isLES_LDS = 1;
- next;
- }
- if($2 == "c6")
- {
- Command[countCommand] = $1 " " "_MOV reg, addr";
- modR = 8;
- firstArg = 1;
- isGroupInstruction =1;
- secondArg = 1;
- next;
- }
- if($2 == "c7")
- {
- Command[countCommand] = $1 " " "_MOV reg, addr";
- modR = 16;
- firstArg = 1;
- isGroupInstruction =1;
- secondArg = 1;
- next;
- }
- if($2 == "c8")
- {
- }
- if($2 == "c9")
- {
- }
- if($2 == "ca")
- {
- Command[countCommand] = $1 " " "RETF ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 16;
- next;
- }
- if($2 == "cb")
- {
- Command[countCommand] = $1 " " "RETF ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 16;
- next;
- }
- if($2 == "cc")
- {
- Command[countCommand] = $1 " " "INT 3";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "cd")
- {
- Command[countCommand] = $1 " " "INT ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "ce")
- {
- Command[countCommand] = $1 " " "INTO";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "cf")
- {
- Command[countCommand] = $1 " " "IRET";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- }
- }
- $2 ~ /^d/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- secondArg = 0;
- if($2 == "d0")
- {
- Command[countCommand] = $1 " " "_ROT reg , 1";
- modR = 8;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = -1;
- fReadCommand = 1;
- next;
- }
- if($2 == "d1")
- {
- Command[countCommand] = $1 " " "_ROT reg , 1";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = -1;
- fReadCommand = 1;
- next;
- }
- if($2 == "d2")
- {
- Command[countCommand] = $1 " " "_ROT reg , CL";
- modR = 8;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = -1;
- fReadCommand = 1;
- next;
- }
- if($2 == "d3")
- {
- Command[countCommand] = $1 " " "_ROT reg,1";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = -1;
- secondArg = 0;
- fReadCommand = 1;
- next;
- }
- if($2 == "d4")
- {
- Command[countCommand] = $1 " " "AAM *";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "d5")
- {
- Command[countCommand] = $1 " " "AAD *";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "d6")
- {
- Command[countCommand] = $1 " " "*SALC";
- countCommand++;
- next;
- }
- if($2 == "d7")
- {
- Command[countCommand] = $1 " " "XLAT";
- countCommand++;
- next;
- }
- if($2 == "d8")
- {
- Command[countCommand] = $1 " " "ESC 0";
- countCommand++;
- next;
- }
- if($2 == "d9")
- {
- omand[countCommand] = $1 " " "ESC 1";
- countCommand++;
- next;
- }
- if($2 == "da")
- {
- Command[countCommand] = $1 " " "ESC 2";
- countCommand++;
- next;
- }
- if($2 == "db")
- {
- Command[countCommand] = $1 " " "ESC 3";
- countCommand++;
- next;
- }
- if($2 == "dc")
- {
- Command[countCommand] = $1 " " "ESC 4";
- countCommand++;
- next;
- }
- if($2 == "dd")
- {
- Command[countCommand] = $1 " " "ESC 5";
- countCommand++;
- next;
- }
- if($2 == "de")
- {
- Command[countCommand] = $1 " " "ESC 6";
- countCommand++;
- next;
- }
- if($2 == "df")
- {
- Command[countCommand] = $1 " " "ESC 7";
- countCommand++;
- next;
- }
- }
- }
- $2 ~ /^e/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- secondArg = 0;
- if($2 == "e0")
- {
- Command[countCommand] = $1 " " "LOOPNZ/NE ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "e1")
- {
- Command[countCommand] = $1 " " "LOOPZ/E ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "e2")
- {
- Command[countCommand] = $1 " " "LOOP ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "e3")
- {
- Command[countCommand] = $1 " " "JCXZ ";
- fReadCommand = 1;
- firstArg = 2;
- modR = 8;
- next;
- }
- if($2 == "e4")
- {
- Command[countCommand] = $1 " " "IN AL,[addr]";
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 1;
- modR = 8;
- next;
- }
- if($2 == "e5")
- {
- Command[countCommand] = $1 " " "IN AX,[addr]";
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 1;
- modR = 8;
- next;
- }
- if($2 == "e6")
- {
- Command[countCommand] = $1 " " "OUT [addr],AL";
- fReadCommand = 1;
- firstArg = 3;
- secondArg = 0;
- modR = 8;
- next;
- }
- if($2 == "e7")
- {
- Command[countCommand] = $1 " " "OUT [addr],AX";
- fReadCommand = 1;
- firstArg = 3;
- secondArg = 0;
- modR = 8;
- next;
- }
- if($2 == "e8")
- {
- Command[countCommand] = $1 " " "CALL ";
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 0;
- modR = 16;
- next;
- }
- if($2 == "e9")
- {
- Command[countCommand] = $1 " " "JMP ";
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 0;
- modR = 16;
- next;
- }
- if($2 == "ea")
- {
- Command[countCommand] = $1 " " "JMP seg: ";
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 0;
- modR = 16;
- next;
- }
- if($2 == "eb")
- {
- Command[countCommand] = $1 " " "JMP ";
- fReadCommand = 1;
- firstArg = 2;
- secondArg = 0;
- modR = 8;
- next;
- }
- if($2 == "ec")
- {
- Command[countCommand] = $1 " " "IN AL,[DX]";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "ed")
- {
- Command[countCommand] = $1 " " "N AX,[DX]";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "ee")
- {
- Command[countCommand] = $1 " " "OUT [DX],AL";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "ef")
- {
- Command[countCommand] = $1 " " "OUT [DX],AX";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- }
- }
- $2 ~ /^f/ {
- if(fReadCommand == 0)
- {
- modR = 0;
- isData = 0;
- isRegister = 0;
- isLES_LDS = 0;
- isGroupInstruction = 0;
- isx83 = 0;
- firstArg = 0;
- secondArg = 0;
- fReadCommand = 1;
- if($2 == "f0")
- {
- Command[countCommand] = $1 " " "LOCK";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "f1")
- {
- }
- if($2 == "f2")
- {
- Command[countCommand] = $1 " " "REPNE/REPNZ";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "f3")
- {
- Command[countCommand] = $1 " " "REP/REPE/REPZ";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "f4")
- {
- Command[countCommand] = $1 " " "HLT";
- CommandsEND = $1;
- countCommand++;
- fReadCommand = 0;
- fEndCode = 1;
- next;
- }
- if($2 == "f5")
- {
- Command[countCommand] = $1 " " "CMC";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "f6")
- {
- Command[countCommand] = $1 " " "_ALU2 reg, addr";
- modR = 8;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = 1;
- next;
- }
- if($2 == "f7")
- {
- Command[countCommand] = $1 " " "_ALU2 reg, addr";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = 1;
- next;
- }
- if($2 == "f8")
- {
- Command[countCommand] = $1 " " "CLC";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "f9")
- {
- Command[countCommand] = $1 " " "STC";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "fa")
- {
- Command[countCommand] = $1 " " "CLI";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "fb")
- {
- Command[countCommand] = $1 " " "STI";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "fc")
- {
- Command[countCommand] = $1 " " "CLD";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "fd")
- {
- Command[countCommand] = $1 " " "STD";
- countCommand++;
- fReadCommand = 0;
- next;
- }
- if($2 == "fe")
- {
- Command[countCommand] = $1 " " "_MISC reg";
- modR = 8;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = -1;
- next;
- }
- if($2 == "ff")
- {
- Command[countCommand] = $1 " " "_MISC reg";
- modR = 16;
- firstArg = 1;
- isGroupInstruction = 1;
- secondArg = -1;
- next;
- }
- }
- }
- #вывод всех команд
- END {
- for(i=0; i < countCommand; i=i+1)
- print(Command[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement