Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,716 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,206 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Assembly language-2day,sos!

 
Reply to this topicStart new topic

Assembly language-2day,sos!, problem with simple programms

Nadia88
post 24 Jun, 2008 - 03:28 AM
Post #1


New D.I.C Head

*
Joined: 16 Jun, 2008
Posts: 3


My Contributions


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:
CODE

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:


CODE


lw $8,4000($11)
add $8,&13,$8
sw $8,4000($10)




the third programm,asks to transform this in assembly:

CODE

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!
User is offlineProfile CardPM

Go to the top of the page


jamesb
post 26 Jun, 2008 - 08:38 AM
Post #2


New D.I.C Head

*
Joined: 24 Jun, 2008
Posts: 17


My Contributions


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?
User is offlineProfile CardPM

Go to the top of the page

Tom9729
post 28 Jun, 2008 - 07:05 PM
Post #3


Debian guru

Group Icon
Joined: 30 Dec, 2007
Posts: 1,405



Thanked 7 times

Dream Kudos: 325
My Contributions


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?
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 28 Jun, 2008 - 07:12 PM
Post #4


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 4,950



Thanked 27 times

Dream Kudos: 2325

Expert In: Goofing Off

My Contributions


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

Go to the top of the page

born2c0de
post 29 Jun, 2008 - 02:39 AM
Post #5


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

Group Icon
Joined: 26 Nov, 2004
Posts: 3,757



Thanked 20 times

Dream Kudos: 2800

Expert In: C, C++, VB, VB.NET, C#, Java, x86 Assembly, Win32 API, Reversing

My Contributions


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

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/8/08 09:13AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month