As a beginner, I'm trying to solve this assembly exercise.
Write a program to subtract (X-Y) and store the result in Z register, then: Check if Z =0, add 50 to X reg. else decrement Y reg. Let the PC = 100.
I'm not sure if it's done like this, but according to my coursebook and lectures, I've achieved this result, ignoring the "if" part if the other part is satisfied.
100 SUB Z, X, Y
101 JZ 104
102 DEC Y
103 JMP 105
104 ADD X, 50
105 END
But I'm worried if the question is not asking to ignore the "if" part even if the other part is satisfied, which results in something like this.
100 SUB Z, X, Y
101 JZ 103
102 DEC Y
103 ADD X, 50
104 END
I have no clue which one is the correct answer to that question. Any help will be very appreciated.
Aucun commentaire:
Enregistrer un commentaire