Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 24th, 2011, 03:03 PM
Ebda3 Ebda3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 2 Ebda3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 13 sec
Reputation Power: 0
Assembly - How to write this prog in MIPS(Mars)??

hi gents

i can't start to resolve this progarm it's so deficult ...

....Write program can be used to generate (n) random number (0<= x <1).
Show a sample output for 10 numbers????

Reply With Quote
  #2  
Old April 25th, 2011, 10:06 AM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Oct 2003
Posts: 3,129 MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 21 h 52 m 18 sec
Reputation Power: 1736
To answer your question - How to write this prog in MIPS(Mars)?):
Start learning the assemble language.. everything is difficult at the beginning.

Unless you read the sticky and have a more "direct"/precise question, the best we can do is redirect you to google and/or a assemble "manual".
Like this one: http://logos.cs.uic.edu/366/notes/mips%20quick%20tutorial.htm
You can also take at look at http://en.wikibooks.org/wiki/MIPS_Assembly

Reply With Quote
  #3  
Old April 29th, 2011, 05:49 AM
Ebda3 Ebda3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 2 Ebda3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 13 sec
Reputation Power: 0
here is my work but i can't find the problem
the problem when i do run only
but when i do assemple it shows me is sucssefully

Quote:
a: .word 673
c: .word 37 x: .word 1
.text
lcm: ## argument: none, returns X(n+1) in $v0
lw $t1, a # const a
lw $t2, c # const c
lw $t3, x # current X
multu $t3, $t1 # HILO <- X * a
mflo $v0 # v0 <- Lo
addu $v0, $v0, $t2 # v0 += c
sw $v0, x
jr $ra
# lcminit - sets initial X for LCM RNG
# X = $a0, return#
lcminit:sw, $a0, x # save $a0 in x
jr $ra

lcmmod:
# $v0 = lcm() % $a0; return $v0

addi $sp, $sp, -4 # push return address
sw $ra, 0($sp) #
jal lcm # v0 <- lcm (32 bit word)
divu $v0, $a0
mfhi $v0 # v0 <- lcm % a0
lw $ra, 0($sp) # pop return address
addi $sp, $sp, 4 #
jr $ra



# main program
.text # main MUST BE GLOBAL
.globl main
main:
loop: # PRINT prompt
.data
prompt: .asciiz "\nX(0)(-1 to exit): "
.text
la $a0, prompt
li $v0, 4
syscall
li $v0, 5 # read i
syscall
sw $v0, -12($fp)
move $a0, $v0
jal lcminit #initialize thge LCM RNG
blt $v0, 0, exit # If i<0, exit
.data # PRINT ans
ans: .asciiz "lcm is: "
modulus:.word 1000
.text
la $a0, ans ###replaced
li $v0, 4
syscall
li $s3, 3 # loop 3 times
lcmloop:
blt $s3, 1, prompt # if done loop, get new X(0)
sub $s3, $s3, 1
lw $a0, modulus
# CALL lcmmod
jal lcmmod
# PRINT lccmod
move $a0, $v0
li $v0, 1
syscall
.data # print comma
comma: .asciiz ","
.text
la $a0, comma
li $v0, 4
syscall
b lcmloop # next lcm
exit:
li $v0, 10 # Appropriate way to end assembly code
syscall

Reply With Quote
  #4  
Old April 29th, 2011, 02:13 PM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Oct 2003
Posts: 3,129 MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 21 h 52 m 18 sec
Reputation Power: 1736
You have to be more descriptive.

When/where (in code) does it start to fail?
What did you expect?
What actually happen?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Assembly - How to write this prog in MIPS(Mars)??

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap