svp que fait ce programme ? merci d'avance

1.load A
3.CMP 20
4.JB etq1
5.load A
6.SUB 1
7.JMP etq2
8.etq1 load A
      9.Add 5
10.etq2 STORE A

Please post in English. On top of not conforming to our rules, you're limiting the number of people who can (or will choose to) help you by asking questions in French.

That program is equivalent to this:

if(A + B < 20)
  A = A + 5;
  A = A - 1;

Line-by-line, you have:


Puts the variable A on the register, and then adds the value of B to that. So, it computes A + B.

CMP   20
JB    etq1

Compares the result of the previous lines (i.e., A + B) to the value 20, and jumps if the comparison results in a less-than case, that is, if A + B < 20. If not (e.g. "else") it computes this:

SUB   1
JMP   etq2.

Which puts A on the register and subtracts one to that. Then, it jumps to label 2 (I assume that etq2 is an abbreviation for "étiquette 2").

If the comparison did yield a less-than case, then it executes this (at label 1) instead:

ADD  5

Which is obviously A + 5. And finally, in any case, at label 2, it executes this:


which means that the current value of the register (either A + 5 or A - 1) is saved into the variable A.

En passant, deceptikon a raison, il vaut utiliser l'anglais, pour le bénéfice de tous.

thank you mike :)))))
i don't speak english very well im a debutante in that too :/

This article has been dead for over six months. Start a new discussion instead.