This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: which means it would have an infinite recursion. * Extra Credit 2 90 % : Can you code a program in the LC-3 machine language, that performs the same task? * .ORIG X3000; start at location X3000 LD R1, NUMBER; load the value into R1 LOOP; AND R1, R1, #-1; take the two’s complement, first multiply by negative one ADD R1, R1, #1; take the two’s complement, second by add one Brn, LOOP; If value is negative, proceed, otherwise LOOP HALT; halt the system .END; end of program This simulates a program that will take the two’s complement, and since the two’s complement will never be negative, an applied loop will make this process never ending and therefore self-replicating....
View Full Document
This note was uploaded on 01/12/2010 for the course BME 14345 taught by Professor Orlyalter during the Fall '09 term at University of Texas.
- Fall '09