DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   new to assembly (http://www.daniweb.com/forums/thread199895.html)

homeryansta Jun 26th, 2009 1:19 am
new to assembly
 
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.

        .text
        .globl _start
_start:

        la $a0, prompt 
        li $v0, 4
        syscall

        li $v0, 5       
        syscall

        mul $t0, $v0, 9
        div $t0, $t0, 5 
        addi $t0, $t0, 32       

        la $a0, ans1
        li $v0, 4
        syscall

        move $a0, $t0
        li $v0, 1
        syscall

        la $a0, endl
        li $v0, 4
        syscall

        li $v0, 10
        syscall


        .data
        prompt:  .asciiz  "enter the temperature in celcius: "
        ans1:        .asciiz  "The temperature in F is: "
        endl:        .asciiz  "\n"

Salem Jun 26th, 2009 2:12 am
Re: new to assembly
 
Have you tested the installation, by writing the "hello world" program?

A simple print string and halt.

homeryansta Jun 26th, 2009 2:14 am
Re: new to assembly
 
Quote:

Originally Posted by Salem (Post 900434)
Have you tested the installation, by writing the "hello world" program?

A simple print string and halt.

yes I have, and it works fine :)

Salem Jun 26th, 2009 2:19 am
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.

homeryansta Jun 26th, 2009 2:46 am
Re: new to assembly
 
ok, I'm an idiot. double underscore is require for _ _ start


All times are GMT -4. The time now is 1:02 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC