Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,720 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,151 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



MIPS assembler Question

 
Reply to this topicStart new topic

MIPS assembler Question, I'm having trouble trying to extract a number stored in certain bi

Megeara
post 19 May, 2008 - 04:49 AM
Post #1


New D.I.C Head

*
Joined: 19 May, 2008
Posts: 2

This isn't homework its juust a practice question for my computing Lab exam, I don't expect you to
give me code I just need to know how to get an inter stored in certain bits of register $a1 ($5) out to manipulate it.
Here's what I've attempted, $5 has a stored from bits 0-7, b from 8-15 etc up to d.


.set noreorder # Avoid reordering instructions
.text # Start generating instructions
.globl start # The label should be globally known
.ent start # The label marks an entry point
start: srl $8, $5, 16 # removes d and c
sll $8, $8, 24 # $t0=b
srl $9, $9, 8 # removes d from c, b, and a
sll $9, $5, 24 # $t1=c
sll $10, $5, 24 # $t2=d
addu $11, $8, $9 # temp= b+c
addu $4, $11, $10 # a= temp+d
iloop: j iloop # infinite loop
nop
.end start # Marks the end of the program
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/8/08 09:32AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month