943,833 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 592
  • Assembly RSS
Jun 26th, 2009
0

new to assembly

Expand Post »
hello everyone! i usually hang around the c++ area, but I'll need to learn assembly for computer architecture 2 in the fall so here it is. I wrote a simple program to convert temperatures from C to F. PCspim doesn't like it for some reason.

here are my codes, it just won't run.

assembly Syntax (Toggle Plain Text)
  1. .text
  2. .globl _start
  3. _start:
  4.  
  5. la $a0, prompt
  6. li $v0, 4
  7. syscall
  8.  
  9. li $v0, 5
  10. syscall
  11.  
  12. mul $t0, $v0, 9
  13. div $t0, $t0, 5
  14. addi $t0, $t0, 32
  15.  
  16. la $a0, ans1
  17. li $v0, 4
  18. syscall
  19.  
  20. move $a0, $t0
  21. li $v0, 1
  22. syscall
  23.  
  24. la $a0, endl
  25. li $v0, 4
  26. syscall
  27.  
  28. li $v0, 10
  29. syscall
  30.  
  31.  
  32. .data
  33. prompt: .asciiz "enter the temperature in celcius: "
  34. ans1: .asciiz "The temperature in F is: "
  35. endl: .asciiz "\n"
Last edited by homeryansta; Jun 26th, 2009 at 1:30 am.
Similar Threads
Reputation Points: 46
Solved Threads: 1
Junior Poster in Training
homeryansta is offline Offline
87 posts
since Jan 2009
Jun 26th, 2009
0

Re: new to assembly

Have you tested the installation, by writing the "hello world" program?

A simple print string and halt.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jun 26th, 2009
0

Re: new to assembly

Click to Expand / Collapse  Quote originally posted by Salem ...
Have you tested the installation, by writing the "hello world" program?

A simple print string and halt.
yes I have, and it works fine
Reputation Points: 46
Solved Threads: 1
Junior Poster in Training
homeryansta is offline Offline
87 posts
since Jan 2009
Jun 26th, 2009
0

Re: new to assembly

OK, so it's just divide and conquer to move from something which works, to something which doesn't.

li $v0, 5
syscall
Does this actually return an integer result in a register?
Or did it assume a pointer to a string.

Imagine that I don't have the manual for your psim syscall's.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jun 26th, 2009
1

Re: new to assembly

ok, I'm an idiot. double underscore is require for _ _ start
Reputation Points: 46
Solved Threads: 1
Junior Poster in Training
homeryansta is offline Offline
87 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Counting Letters in a File...
Next Thread in Assembly Forum Timeline: Two code snippets that should have the same effect but don't





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC