wok-6.x view 8086tiny/stuff/8086tiny.u @ rev 24783
Up apache-ant (1.10.12)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Mar 20 12:11:06 2022 +0000 (2022-03-20) |
parents | |
children |
line source
1 --- 8086tiny.c
2 +++ 8086tiny.c
3 @@ -112,8 +112,9 @@
4 regs16[REG_AX] = op_result, \
5 set_OF(set_CF(op_result - (op_data_type)op_result)))
6 #define DIV_MACRO(out_data_type,in_data_type,out_regs) (scratch_int = CAST(out_data_type)mem[rm_addr]) && !(scratch2_uint = (in_data_type)(scratch_uint = (out_regs[i_w+1] << 16) + regs16[REG_AX]) / scratch_int, scratch2_uint - (out_data_type)scratch2_uint) ? out_regs[i_w+1] = scratch_uint - scratch_int * (*out_regs = scratch2_uint) : pc_interrupt(0)
7 -#define DAA_DAS(op1,op2,mask,min) set_AF((((scratch2_uint = regs8[REG_AL]) & 0x0F) > 9) || regs8[FLAG_AF]) && (op_result = regs8[REG_AL] op1 6, set_CF(regs8[FLAG_CF] || (regs8[REG_AL] op2 scratch2_uint))), \
8 - set_CF((((mask & 1 ? scratch2_uint : regs8[REG_AL]) & mask) > min) || regs8[FLAG_CF]) && (op_result = regs8[REG_AL] op1 0x60)
9 +#define DAA_DAS(op1,op2) \
10 +set_AF((((scratch_uchar = regs8[REG_AL]) & 0x0F) > 9) || regs8[FLAG_AF]) && (op_result = (regs8[REG_AL] op1 6), set_CF(regs8[FLAG_CF] || (regs8[REG_AL] op2 scratch_uchar))), \
11 +set_CF((regs8[REG_AL] > 0x9f) || regs8[FLAG_CF]) && (op_result = (regs8[REG_AL] op1 0x60))
12 #define ADC_SBB_MACRO(a) OP(a##= regs8[FLAG_CF] +), \
13 set_CF(regs8[FLAG_CF] && (op_result == op_dest) || (a op_result < a(int)op_dest)), \
14 set_AF_OF_arith()
15 @@ -451,7 +452,6 @@
16 OPCODE 12: // ROL|ROR|RCL|RCR|SHL|SHR|???|SAR reg/mem, 1/CL/imm (80186)
17 scratch2_uint = SIGN_OF(mem[rm_addr]),
18 scratch_uint = extra ? // xxx reg/mem, imm
19 - ++reg_ip,
20 (char)i_data1
21 : // xxx reg/mem, CL
22 i_d
23 @@ -468,7 +468,7 @@
24 else // Rotate/shift left operations
25 R_M_OP(mem[rm_addr], <<=, scratch_uint);
26 if (i_reg > 3) // Shift operations
27 - set_opcode(0x10); // Decode like ADC
28 + set_flags_type = FLAGS_UPDATE_SZP; // Shift instructions affect SZP
29 if (i_reg > 4) // SHR or SAR
30 set_CF(op_dest >> (scratch_uint - 1) & 1);
31 }
32 @@ -605,7 +605,7 @@
33 rep_override_en && rep_override_en++
34 OPCODE 28: // DAA/DAS
35 i_w = 0;
36 - extra ? DAA_DAS(-=, >=, 0xFF, 0x99) : DAA_DAS(+=, <, 0xF0, 0x90) // extra = 0 for DAA, 1 for DAS
37 + if (extra) DAA_DAS(-=, >); else DAA_DAS(+=, <)
38 OPCODE 29: // AAA/AAS
39 op_result = AAA_AAS(extra - 1)
40 OPCODE 30: // CBW