Exercise 7: Modify the first counting program used in this lab so that it will count just from one to sixteen, stopping when it reaches sixteen. (The program is repeated below.) To do this, each time through the loop, you need to test whether the number is sixteen. If it is, jump to a HLT instruction at the end of the program. Testing whether a number is sixteen requires two steps: First, subtract 16 from the number, and then test whether the answer is zero. Use a JMZ instruction to test whether the answer is zero. (This is like a JMP instruction, except that the jump only occurs if the number in the AC is zero.) Write a paragraph explaining how your program works. lod-c 1 ; This is the original counting program. sto 12 lod 12 inc sto 12 jmp 2 hlt ; Add a halt instruction at the end. Exercise 8: Describe what is done by the "CountAndStore" program, which you encountered earlier in the lab
j 2. j 2 2 sin ( z ) Sa ( z ) z U m. F z( ) . . Sa 1 . . 1 Sa . 0 . . j 0 2 2 2 z(t) , Fz()=jMz(), U m. M z( ) . Sa 1 . . 1 Sa . 0 . . 0 2 2 2 .1.2.7 0 R 2 R. 0 , R. 0 .. R . 0 . 200 0 0 U m.