Six original Cambridge-style questions on tracing assembly language programs, with mark-scheme style solutions.
100 LDR #0 101 LDX 240 102 ADD 250 103 STO 250 104 INC IX 105 LDD 251 106 DEC ACC 107 STO 251 108 CMP #0 109 JPN 101 110 END
Memory: 240 holds 4, 241 holds 9, 242 holds 2, 250 holds 0, 251 holds 3. Trace the program and give the final contents of addresses 250 and 251, the IX and the ACC.
100 LDM #0 101 STO 300 102 IN 103 CMP #46 104 JPE 109 105 LDD 300 106 INC ACC 107 STO 300 108 JMP 102 109 LDD 300 110 ADD #48 111 OUT 112 END
The user types the characters A, B and then a full stop. (ASCII: A is 65, B is 66, the full stop is 46, the character 0 is 48.) State the final contents of address 300 and the output, and describe what the program does.
Explain the difference between the instructions JPE and JPN.
Memory: 150 holds 152, 151 holds 7, 152 holds 20. Trace LDI 150, SUB 151, STO 151, CMI 150. Give the contents of the ACC and address 151, and state whether the compare is True or False.
Write assembly language instructions, using the 9618 instruction set, to input a character and output it twice.
A loop is meant to run 4 times. The counter is stored at address 90 and starts at 4. The loop ends with LDD 90, DEC ACC, STO 90, CMP #1, JPN to the start of the loop. Explain why the loop does not run 4 times, and correct it.
Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.