Question 3 2016 · October-November · Paper 43 · 15 marks
Reveal official mark-scheme answer

Official answer for Question 3
Question 4
Question 43
Show text version of question
Question 3
The following table shows part of the instruction set for a processor which has one general purpose register, the Accumulator (ACC), and an index register (IX).
Instruction Op Explanation Operand code LDM #n Immediate addressing. Load the number n to ACC. LDD <address> Direct addressing. Load the contents of the given address to ACC. Indexed addressing. Form the address from <address> + the contents LDX <address> of the index register. Copy the contents of this calculated address to ACC. LDR #n Immediate addressing. Load the number n into IX. STO <address> Store the contents of ACC at the given address. INC <register> Add 1 to the contents of the register (ACC or IX). DEC <register> Subtract 1 from the contents of the register (ACC or IX). CMP <address> Compare the contents of ACC with the contents of <address>. CMP #n Compare the contents of ACC with number n. Following a compare instruction, jump to <address> if the compare JPE <address> was True. Following a compare instruction, jump to <address> if the compare JPN <address> was False. Output to the screen the character whose ASCII value is stored in OUT ACC. END Return control to the operating system.
reverse order.
The program will use locations starting at address NAME to store the characters in the string. The location with address MAX stores the number of characters that make up the string.
The programmer has started to write the program in the table opposite. The Comment column contains descriptions for the missing program instructions.
Complete the program using op codes from the given instruction set.
Question 15
Op Label Operand Comment code START: // initialise index register to zero
// initialise COUNT to zero
LOOP1: // load character from indexed address NAME
// output character to screen
// increment index register
// increment COUNT starts here
// is COUNT = MAX ?
// if FALSE, jump to LOOP1
REVERSE: // decrement index register
// set ACC to zero
// store in COUNT
LOOP2: // load character from indexed address NAME
// output character to screen
// decrement index register
// increment COUNT starts here
// is COUNT = MAX ?
// if FALSE, jump to LOOP2
// end of program
COUNT:
MAX: 4
NAME: B01000110 // ASCII code in binary for 'F'
B01010010 // ASCII code in binary for 'R'
B01000101 // ASCII code in binary for 'E'
B01000100 // ASCII code in binary for 'D'
Question 16
Why this question appears here
82% assigned-topic match · Processor fundamentals › Assembly language
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_w16_qp_43.pdf
