Solved: Anyone familiar with MIPS code?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

ElementOfMagic

Thread Starter
Joined
Dec 30, 2012
Messages
52
Hello. :)

I am currently writing a sample program, to test whether a number is prime or not. If it is (and only if it is), that number should be printed to the screen.
My problem is that for some reason when I try to run the program, I am getting an 'invalid program counter' error. :confused:

I am using MIPS 4.2, if that's any help.

Here's my code:

Code:
.data 

printPrime:
addi $v0, $zero, 1
add $a0, $zero, $t4
syscall

.text 

#Set registers
add $s0, $zero, 3
add $t4, $zero, $s0

#Test if each num in sequence is prime
rem $t1, $t4, 2
bnez $t1, printPrime
Thank-You to anyone who can help me out. (y)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top