*******Asembly Code (Add x3000 to line numbers)***** .ORIG x3000 0 AND R2, R2, #0 ; init counter 1 LD R3, PTR ; R3 pointer to chars 2 GETC ; R0 gets char input 3 LDR R1, R3, #0 ; R1 gets first char 4 TEST ADD R4, R1, #-4 ; Test for EOT 5 BRz OUTPUT ; done? ;Test character for match, if so increment count. 6 NOT R1, R1 7 ADD R1, R1, R0 ; If match, R1 = xFFFF 8 NOT R1, R1 ; If match, R1 = x0000 9 BRnp GETCHAR ; No match, no increment A ADD R2, R2, #1 ; Get next character from file. B GETCHAR ADD R3, R3, #1 ; Point to next char C LDR R1, R3, #0 ; R1 gets next char D BRnzp TEST ; Output the count. E OUTPUT LD R0, ASCII ; Load ASCII template F ADD R0, R0, R2 ; Covert binary to ASCII 10 OUT ; ASCII code is displayed 11 HALT ; Halt machine ; Storage for pointer and ASCII template 12 ASCII .FILL x0030 13 PTR .FILL x4000 .END *******************Symbol Table********************* Command: cat // Symbol table // Scope level 0: // Symbol Name Page Address // ---------------- ------------ // PTR 3013 // ASCII 3012 // TEST 3004 // OUTPUT 300E // GETCHAR 300B ***************Object Code in Hex******************* Command: xxd 3000 54a0 2611 f020 62c0 187c 0408 927f 1240 927f 0a01 14a1 16e1 62c0 0ff6 2003 1002 f021 f025 0030 4000 **************Object Code in Binary**************** Command: xxd -b 00110000 00000000 01010100 10100000 00100110 00010001 11110000 00100000 01100010 11000000 00011000 01111100 00000100 00001000 10010010 01111111 00010010 01000000 10010010 01111111 00001010 00000001 00010100 10100001 00010110 11100001 01100010 11000000 00001111 11110110 00100000 00000011 00010000 00000010 11110000 00100001 11110000 00100101 00000000 00110000 01000000 00000000