The IADD instruction in IJVM adds two 1-word numbers. When I add EEEEEEEE
to itself I get DDDDDDDC
. What happens to the carry 1? How can I get it? Is it saved in a register?
Asked
Active
Viewed 508 times
1

Boann
- 48,794
- 16
- 117
- 146

user2925939
- 21
- 1
-
The MIC1 that interprets IJVM only has two condition codes, N and Z. The carry out from the ALU is not stored. The microarchitecture could be modified to store the carry out, like it stores the N and Z bits. – downeyt Nov 11 '15 at 04:46
-
@downeyt Would you mind if I quote your comment in my answer? – Jonathon Reinhart Nov 11 '15 at 12:22
-
@Jonathon Reinhart - You may quote my comment in your answer. – downeyt Nov 11 '15 at 13:09
-
If you create a table for adding 2 two-bit numbers and showing the results, without the carry bit, you might get an idea of how to detect carry without needing a carry flag. – downeyt Nov 29 '15 at 22:51
1 Answers
2
It appears that the carry-out bit is lost.
No version of the IJVM Assembly Language Specification that I've come across says anything about a carry-out bit, or carry flag.
IADD Pop two words from stack; push their sum
downeyt adds:
The MIC1 that interprets IJVM only has two condition codes, N and Z. The carry out from the ALU is not stored. The microarchitecture could be modified to store the carry out, like it stores the N and Z bits.

Community
- 1
- 1

Jonathon Reinhart
- 132,704
- 33
- 254
- 328