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"

Recommended Answers

All 4 Replies

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

A simple print string and halt.

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

A simple print string and halt.

yes I have, and it works fine :)

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.

ok, I'm an idiot. double underscore is require for _ _ start

commented: Thanks for the feedback answer :) +36
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.