-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could you please add CS, IP register? #18
Comments
And it seems do not support all feature of |
Hey, So the answer for both of your questions is same : it is because the emulator does not translate the instructions to an actual bytecode. The way emulator works now, is in first pass it converts the code to a simple intermediate representation, which is text based. Then instead of converting that to bytecode, which would be stored in memory, the actual running of program is done directly from this text-based IR, where each instruction is parsed and evaluated each time it is to be run. Ideally, the IR should be converted to a bytecode which then should be stored in the memory ; but when making this, we could not find a definitive definition of Hex codes for 8086 assembly. The few sources which we found seemed to disagree with each other and did not cover all the instructions, so we kept the IR text-based. (We could have defined out own bytecode, but we didn't). Thus we cannot actually store the instructions in the memory like the data is stored. Hence there is no meaning of CS and IP, as we cannot treat any place in memory as the "code" segment, and the IP is maintained internally by the emulator, and it should be modified. For the same reason, the jmp instruction only supports jumping using labels, as any memory address given explicitly or in register cannot be an instruction address. In case you have any idea about 8086 asm hex codes, we can try implementing that, or if you have any idea of making a consistent bytecode for all ~100 instructions, please feel free to mention! |
Thx for your replying. Your project is awsome. When the code work with memory, I found it does not work well. Such as The implementation details you gave us tells me the reson why such type of code does not work well. |
Thank you!
For the reasons explained above, cs and ip will not work in code. For the You can check out the instructions page on the website : https://yjdoc2.github.io/8086-emulator-web/help for details of the instruction syntax. This lists all the instructions, and the operands supported by them. For example , for move : This specifies, that for mov instruction using memory as one of the operand, you need to add "byte" or "word" in front of it. Hope this will be helpful. |
As we know, 8086CPU has 14 registers, but 8086-emulator-web lacks both of CS and IP.
I want to verify this theory that
jmp ax:bx
semantically equivalent to executemov cs,ax
&mov ip,bx
.Could you please add CS & IP? Or just tell me why this emulator does not include CS and IP.
The text was updated successfully, but these errors were encountered: