# Assembly language-2day,sos!

Page 1 of 1

## 4 Replies - 1414 Views - Last Post: 29 June 2008 - 02:39 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=55727&amp;s=a1070f8c24ded15c61a741394738fc7e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

Reputation: 0
• Posts: 3
• Joined: 16-June 08

# Assembly language-2day,sos!

Posted 24 June 2008 - 03:28 AM

Hello everybody!
I've just started to learn the assembly language,so i have problems in really simple,i guess,programms.

First of all,there are these 2 following programms,that we must correct,if there are any mistakes.
The first one,requires to transform the following,in assembly:

for (i=0;i<10;i++)
{
A[i]=0
}

(\$10=4,\$20-->i)<---those are given.

and the answer,we must correct is:
```add \$20,\$0,\$0 #\$20=0 ,i
Loop: mul \$22,\$22,\$10 # \$22= ix4
sw \$0, Astart(\$22) # A[i]=0
slt \$23,\$20,\$21 # if i<10 then \$21=1
bne \$23,0,Loop # if \$21<>= goto Loop

```

the second one requires to transfrom this:

χ[10]=χ[11]+C

C=\$13,\$10=10,table x starts in address 4000. <---those are given

```
lw \$8,4000(\$11)
sw \$8,4000(\$10)

```

the third programm,asks to transform this in assembly:

```while (A[i++]!=0)
{
B[i]=A[i]+32
}

```

and I have no idea how to start.

I know they are simple problems,but I'm totally new to this,plus I have to write an exam based on all these things.

Any help would be precious!

Is This A Good Question/Topic? 0

## Replies To: Assembly language-2day,sos!

### #2 jamesb

Reputation: 0
• Posts: 30
• Joined: 24-June 08

## Re: Assembly language-2day,sos!

Posted 26 June 2008 - 08:38 AM

I have some limited experience with assembly. I learned it for two different chips and they had a separate language for each. That leads me to believe that each manufacturer has its own tweaked assembly language....though I could be horribly wrong. What are you programming this on/with?

### #3 Tom9729

• Segmentation fault

Reputation: 180
• Posts: 2,641
• Joined: 30-December 07

## Re: Assembly language-2day,sos!

Posted 28 June 2008 - 07:05 PM

What platform are you programming on? What syntax are you using? I know a little of the NASM syntax..

Didn't you learn how to do this in class? Don't you have a book?

### #4 no2pencil

• Professor Snuggly Pants

Reputation: 5863
• Posts: 28,744
• Joined: 10-May 07

## Re: Assembly language-2day,sos!

Posted 28 June 2008 - 07:12 PM

Assuming this is x86 architecture... have a look at this page, as it offers many examples on loops.

### #5 born2c0de

• printf("I'm a %XR",195936478);

Reputation: 183
• Posts: 4,667
• Joined: 26-November 04

## Re: Assembly language-2day,sos!

Posted 29 June 2008 - 02:39 AM

I'm not familiar with this syntax.
It looks like AT&T syntax, but I'm not sure.