This preview shows pages 1–2. Sign up to view the full content.
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 twos complement, first multiply by negative one ADD R1, R1, #1; take the twos 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 twos complement, and since the twos complement will never be negative, an applied loop will make this process never ending and therefore self-replicating....
View Full Document
- Fall '09