This is an Assembly code and i want to know what the result for every instruction: AX and BX

The code is:

Mov ax, 0
Mov bx, -5
100: Inc ax++
Sub bx, ax
Cmp bx, -10
Jb 100
Put ax
Move ax, bx
Put ax

Posted on 2006-04-08 14:20:37 by dabdob
Sounds like a homework request... and there's stuff in there that doesn't make sense in plain x86, at least not without more context (like macro definition for "Put").
Posted on 2006-04-08 15:23:16 by f0dder
Well, this is not totally Right, i usually post some Tutorials about programming in and i just want to learn Assembly..

Technically i can tell you how the bove code funaction is well, as we have AX and BX, and everytime you inc by one and print the answer. untill you arrive the 1- 1- value to BX...

i want to someone to put the answer to see my answer too. Could you?!

Posted on 2006-04-10 04:29:04 by dabdob
The thing is that you then should give more info, for example, tought I can be wrong, I dont remember an assembler that let you specify a label with leading number aka your 100 label, also what notation is there? "Inc ax++"?,  the "++" was a comment for yourself and you miss the ";"?... or are you using something like "terse"... also you use "Move ax, bx" you could use directly "mov".

you start with ax=0, then increment it each time and you are substracting thes value to bx=-5 and you compare it with -10  that is  (-10 < -5), then you ask if -5 is below -10, because is not, then no jump will be performed.

By the way, I suguest programm in Windows (you are programming for DOS?) and use ollydbg for watch the execution step by step of the program, or find a debbuger for DOS.
Posted on 2006-04-10 13:45:04 by rea
I know that this forum is described as an assembly language forum but technically it is really an 'x86 assembly language forum.'  You need to find a forum, perhaps DaniWeb, that deals with MIPS coding.

Posted on 2006-04-12 12:08:56 by PBrennick
But I used to play around with MIPS R4300i (Nintendo 64) :'(
Posted on 2006-04-12 12:27:00 by SpooK
Me. too, though I liked the CoCo more...

Posted on 2006-04-12 13:26:11 by PBrennick