How can x86 arithmetic in 8 bit mode and update the flags?

200 Views Asked by At

I want simulate 8051 using the x86 instruction. In 32 bits mode, I have to rotate left to get the carry flag. it is more steps to get the overflow flag. Do you know how to AL, BL, CL, DL, to do arithmetic operation and update the flags.

1

There are 1 best solutions below

1
qjpdzjcb On

Thank you very much. "ADD AL, CL" work. I am not quite familiar with x86 ISA, because of 8bit 16bit 32bit 64bit and its compatibility. I try ADD instruction to see the flags changing all day long and could not get the satisfy answer until I see your post. X86 machine could not execute 8051 code. 8051 simulator is perform by my program including fetch-decode-execute. If I could use 8-bit x86 ISA, then the execution part of 8051 simulator could use native machine code. In fact, I am planing to simulate 8051 ALU by using verilog if x86 ISA could not support 8 bit operation.