Can someone tell me how many possibities of the .while instruction there is on masm ?
I mean, .while can be written as
.while (data)
.while eax!
.while data1>0
.wile data1<0
...
All of hem generate coding as jne instructions
Adress1: cmp data1,0
jne Adress02
(...)
Adress2:
jmp Adress1
The point is what is the code for a e instruction ? Like:
Adress1: cmp data1,0
je Adress02
(...)
Adress2:
jmp Adress1
There is a .while data <>0 ????
Regards
Beyond2000!
I mean, .while can be written as
.while (data)
.while eax!
.while data1>0
.wile data1<0
...
All of hem generate coding as jne instructions
Adress1: cmp data1,0
jne Adress02
(...)
Adress2:
jmp Adress1
The point is what is the code for a e instruction ? Like:
Adress1: cmp data1,0
je Adress02
(...)
Adress2:
jmp Adress1
There is a .while data <>0 ????
Regards
Beyond2000!
I bet your while loop wouldn't exit.
I don't think there would be any more variations of While-Loop since if you deviate from the concept, it wouldn't be a While-Loop in the first place. ;)
edit()
correct me if I'm wrong since I don't use HLL loops in MASM but I think .while data <> 0 is just comparing data with the value of 0.
[color=#3366FF]while(myvar != 0)
{
//...some sloppy, slow code here
}[/color]
[color=green]__while:
test eax, eax
jz __exit_while
;...some sloppy, slow code here
jmp __while
__exit_while:[/color]
The first thing that a While-Loop is going to do is compare if the argument is TRUE, if it is, it will exit the loop, else continue with the instruction then jump back.
I don't think there would be any more variations of While-Loop since if you deviate from the concept, it wouldn't be a While-Loop in the first place. ;)
edit()
correct me if I'm wrong since I don't use HLL loops in MASM but I think .while data <> 0 is just comparing data with the value of 0.
Beyond2000!
.while
.wend
Think of it as a looping .if
.while TRUE
;No Exit, because expression never evaluates to false.
.wend
Syntax: .WHILE condition
statements
.ENDW
Description:
Used for clear coding of common loop blocks. Generates code so
that, while <condition> is true, the processor loops through the
following block of statements.
The .ENDW statement marks the end of the <statements> block,
causing the processor to return to the .WHILE directive to
reevaluate whether <condition> is still true. If <condition> is
initially false, the <statements> will not be executed.
.WHILE blocks can be nested, and the assembler will optimize to get
the best possible code.
Enjoy your work, P1
.while
.wend
Think of it as a looping .if
.while TRUE
;No Exit, because expression never evaluates to false.
.wend
Syntax: .WHILE condition
statements
.ENDW
Description:
Used for clear coding of common loop blocks. Generates code so
that, while <condition> is true, the processor loops through the
following block of statements.
The .ENDW statement marks the end of the <statements> block,
causing the processor to return to the .WHILE directive to
reevaluate whether <condition> is still true. If <condition> is
initially false, the <statements> will not be executed.
.WHILE blocks can be nested, and the assembler will optimize to get
the best possible code.
Enjoy your work, P1
Hi Pone
tks for the explanations.
I assume that an
.if al == data
.endif
will also generate
cmp al ==data
jne AdressXX
But what abut the je condition ?
If we have
cmp al == data
je AdressXX
AdressXX : xor ebx, ebx
(code.........)
How the .if condition aplies to it ?
I would like some examples, becasue all checked is that .if generates jne and not je.
Regards
Beyond2000!
tks for the explanations.
I assume that an
.if al == data
.endif
will also generate
cmp al ==data
jne AdressXX
But what abut the je condition ?
If we have
cmp al == data
je AdressXX
AdressXX : xor ebx, ebx
(code.........)
How the .if condition aplies to it ?
I would like some examples, becasue all checked is that .if generates jne and not je.
Regards
Beyond2000!
Beyond2000!
The .if example was to illustrate the logical condition after the .while are the same.
I pointed you in this direction, because there are alot of .if's in working pieces of code to learn from.
But when this assembles with different syntax, the conditional jumps form an execution loop for .while ( jumps to leave execution loop, when false ) and a branch for .if ( jumps to branch code and continues with program ).
Enjoy your work, P1
The .if example was to illustrate the logical condition after the .while are the same.
I pointed you in this direction, because there are alot of .if's in working pieces of code to learn from.
But when this assembles with different syntax, the conditional jumps form an execution loop for .while ( jumps to leave execution loop, when false ) and a branch for .if ( jumps to branch code and continues with program ).
Enjoy your work, P1