Assembly language-2day,sos!

problem with simple programms

Page 1 of 1

4 Replies - 1215 Views - Last Post: 29 June 2008 - 02:39 AM Rate Topic: -----

#1 Nadia88  Icon User is offline

  • New D.I.C Head

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

Assembly language-2day,sos!

Post icon  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
add $21,$0,10 #$21=10
Loop: mul $22,$22,$10 # $22= ix4
sw $0, Astart($22) # A[i]=0
slt $23,$20,$21 # if i<10 then $21=1
addi $20,20,1 #i=i+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

and the possible answer is:



lw $8,4000($11)
add $8,&13,$8
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!

Thank you in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Assembly language-2day,sos!

#2 jamesb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#3 Tom9729  Icon User is offline

  • Segmentation fault
  • member icon

Reputation: 180
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5348
  • View blog
  • Posts: 27,305
  • 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.
Was This Post Helpful? 0
  • +
  • -

#5 born2c0de  Icon User is offline

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

Reputation: 180
  • View blog
  • 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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1