Question: this is the assembly code I have but the output for W is coming to = 3 8 when I need it to = 4

this is the assembly code I have but the output for W is coming to =38 when I need it to =42, holding true to the equation W=(X+Y-P+Q): ; INSERT YOUR CODE HERE
ld a,22;
ld (X), a;
ld a,10;
ld (Y), a;
ld a,30;
ld (P), a;
ld a,40;
ld (Q), a;
;
; compute for w
ld a,(X);
ld b, a;
ld a,(Y);
add a, b;
ld b, a;
ld a,(P);
sub b;
ld b, a;
ld a,(Q);
add a, b;
ld (W), a;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!