
December 1st, 2006, 06:08 AM
|
 |
Contributing User
|
|
Join Date: Aug 2003
Location: UK
Posts: 242
  
Time spent in forums: 1 Day 9 h 33 m 7 sec
Reputation Power: 8
|
|
|
Need help on a very simple assembler program!
Hi, I've never ever been taught how to actually program in assembler before, but an assignment I have requires me to create a small bit of assembly code to put into a program called WinDLX to test things such as processor pipelining.
All my 'program' in assembler has to do is generate DLX code that avoids stalls for the sequence of a=b+c and then d=e-f. To do this I know I need to define f before I add b and c to a, and store a before I do the subtraction to avoid stalls. Here is my code that I know is very close (as I remember seeing an example of this and it was similar, although I can't recall how it was done!) but for some reason the program WinDLX cannot load it because it claims there are errors with the code.
Code:
.data
a: .word 0
b: .word 3
c: .word 4
d: .word 0
e: .word 8
f: .word 5
.text
.global main
main:
lw r2, b
lw r3, c
lw r5, e
add r1, r2, r3
lw r6, f
sw a, r1
sub r4, r5, r6
sw d, r4
Finish:
lw r2,b
lw r3,c
lw r4,d
lw r5,e
lw r6,f
trap 0
Thanks for any help with this!
|