Here, am gonna illustrate you how to add two 16 bit numbers from Assembly level Language.
Here we go,
The full code is as,
LDA 2050
MOV B,A
LDA 2051
ADD B
JNC label
INR C
label: STA 2053
MOV A,C
STA 2054
HLT
Here,
LDA 2050
It means, load accumulator with data of 2050 memory address.
Now, it becomes A = data of 2050
MOV B,A
It means, Move data of Register A to register B.
LDA 2051
Same as first one.
ADD B
It means, add the content of register B to A and put output on A.
JNC label
It means, if carry occurs no jumping to label, else jump to label.
INR C
Increase C register by 1.
label: STA 2053
Store the content of accumulator in 2053 address memory
Similarly, the steps are followed..
Finally, we get Our result at 2053 with carry at 2054. HLT terminate our program.
Here we go,
The full code is as,
LDA 2050
MOV B,A
LDA 2051
ADD B
JNC label
INR C
label: STA 2053
MOV A,C
STA 2054
HLT
Here,
LDA 2050
It means, load accumulator with data of 2050 memory address.
Now, it becomes A = data of 2050
MOV B,A
It means, Move data of Register A to register B.
LDA 2051
Same as first one.
ADD B
It means, add the content of register B to A and put output on A.
JNC label
It means, if carry occurs no jumping to label, else jump to label.
INR C
Increase C register by 1.
label: STA 2053
Store the content of accumulator in 2053 address memory
Similarly, the steps are followed..
Finally, we get Our result at 2053 with carry at 2054. HLT terminate our program.
No comments:
Post a Comment