News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

some questions for beginer

Started by HATEM, September 10, 2006, 10:33:28 AM

Previous topic - Next topic

HATEM

hello
i want to know how do this in assembly

1-if statement
for exemple

1-1 IF x=2 do
.......

1-2 and

IF x=3 do
.....
....
Else
.....
....

2- and how do this boocle

2-1 for i=10 do
...
...
-----------------
2-2 wile x=z do
...
...
....
-----------------
2-3 repeat
......
.....
.....
.......
until x=z

----------------
3- how declare a table and how can i fill it and how can i print the table i want a good explaination with exemples please
thank you

ToutEnMasm


hello,
a sample in masm32 with is listing.So you can modify it for the 16 bits
                            ToutEnMasm



mov eax,5
.if eax == 4
mov edx,4
.elseif eax == 3
mov edx,3
.else
mov edx,0
.endif

mov edx,0
.while eax
inc edx
.if edx == 5
.break
.endif
dec eax
.endw



Quote
00000000         .LISTALL
00000000  B8 00000005         mov eax,5
               .if eax == 4
00000005  83 F8 04      *       cmp    eax, 004h
00000008  75 07      *       jne    @C0001
0000000A  BA 00000004            mov edx,4
               .elseif eax == 3
0000000F  EB 11      *       jmp    @C0003
00000011         *@C0001:
00000011  83 F8 03      *       cmp    eax, 003h
00000014  75 07      *       jne    @C0004
00000016  BA 00000003            mov edx,3
               .else
0000001B  EB 05      *       jmp    @C0006
0000001D         *@C0004:
0000001D  BA 00000000            mov edx,0
               .endif
00000022         *@C0006:
00000022         *@C0003:
                  
00000022  BA 00000000         mov edx,0   
               .while eax
00000027  EB 09      *       jmp    @C0007
00000029         *@C0008:
00000029  42               inc edx
                  .if edx == 5
0000002A  83 FA 05      *       cmp    edx, 005h
0000002D  75 02      *       jne    @C0009
                     .break
0000002F  EB 05      *       jmp    @C000B
                  .endif      
00000031         *@C0009:
00000031  48               dec eax
               .endw
00000032         *@C0007:
00000032  0B C0      *       or   eax, eax
00000034  75 F3      *       jne    @C0008
00000036         *@C000B:



Tedd

What a nice list of demands :lol It doesn't sound a lot like homework at all ::) Alright, so it could 'not' be homework, but so far all you've done is made a list of demands. Are you even going to try?
I'll give you some hints for the IF statement, and you can try and do it from there. Part two is basically part 1 with a  few well placed extra instructions (which is why it's layed out like this; oh wait, it's not homework :wink)
So, for the IF statement you'll need the "cmp" instruction to check if the condition is met. And then one of the various forms of "jmp" such as "jz" or "jnz". If the condition IS met then you execute the code rather than jumping, and if it's not, then you jump over the code 'inside' the do-part.
Post your answer here and we'll praise you, or correct it :U
No snowflake in an avalanche feels responsible.

HATEM

thank you for your help but i'm a biginer what does this number means 0000000F ;0000000A
please in 16bit
it is not a home work pecause i'm not a student  :bg i'm just want to learn assembly 16 bit  :dazzled:
please explaint it more and you don't mention how can i declare a table and how can i fill it

Tedd

No snowflake in an avalanche feels responsible.

HATEM