BR main
sum: .WORD 0
num1: .BLOCK 1
num2: .BLOCK 1
num3: .BLOCK 1
main: LDWA sum,d
DECI num1,d
ADDA num1,d
DECI num2,d
ADDA num2,d
DECI num3,d
ADDA num3,d
STWA sum,d
DECO sum,d
STOP
.END
This is a machine language program written to add 3 integers in pep/9 and it is working fine.
I want to add a negative number ex: -3 to the two numbers without using subtraction.
But the conditions are :
- Store the -3 in hexadecimal.
- Do not use the subtract,negate,or invert instruction
EXPECTED INPUT : 2, 4, -3;
EXPECTED OUTPUT: 3
How can I do this?