I have the following code:
ORG 100
LOOP, Load X
Add Z
Store X
Load Y
Skipcond 400
Jump Q
Subt Z
Store Y
Jump LOOP
Q, Output X
Halt
X, Dec 0
Y, Dec 10
Z, Dec 1
Now if I understand it correctly, it would be somewhat equivalent to the following Python code:
x = 0
y = 10
z = 1
while True:
x += z
if y > 0:
y -= 1
else:
exit(0)
If that's the case, I'm confused why X = 10 in MARIE and X = 11 in Python upon completion of the looping process. From what I understand in the MARIE code, the skipcond 400 is equivalent to if y > 0. If that's the case, then when x = 10, y = 1 and it will still pass the skipcond to subtract 1 from y and therefore restart the loop and add 1 to x again meaning x = 11 when the loop ends and the data is outputed.
Some help understanding this would be greatly appreciated, thank you.