LAB1 - ADD R1 R1 #-1 decrement R1 BRP OUTERLOOP if R1 is...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 Lab Assignment 1 .ORIG x3000 start at mem location x3000 AND R2 R2 #0 set value in R2 to 0 AND R1 R1 #0 set value in R1 to 0 AND R0 R0 #0 set value in R0 to 0 LD R1 x0FD load data in x3101 into R1 LD R0 x0FB load data in x3100 into RO ADD R2 R2 R0 store data in R0 into R2 OUTERLOOPADD R2 R2 #0 BRN LOOP2 if R2 is positive, branch to Loop1 BRP LOOP1 if R2 is negative, branch to Loop2 LOOP1ADD R2 R2 R2 add sum to r2
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ADD R1 R1 #-1 decrement R1 BRP OUTERLOOP if R1 is positive, go back to outer loop BRZ END if R1 is zero, end program LOOP2ADD R2 R2 R2 Add sum to R2 ADD R2 R2 #1 Add 1 to sum ADD R1 R1 #-1 decrement R1 BRP OUTERLOOP if R1 positive, go back to outerloop BRZ END if R1 is zero, end program ENDST R2 x0EF Store final number in memory location x3102 TRAP x25 stop program .END...
View Full Document

Ask a homework question - tutors are online