Question 1(b) 2017 · May-June · Paper 43 · 7 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (b)
Question 7
Question 1
Question 1
Question 1
Question 1
Question 1
Question 1
Question 1
Show text version of question
Question 1
Part (b)
Question 1
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. Direct addressing. Load the contents of the location at the given address LDD <address> to ACC. Indirect addressing. The address to be used is at the given address. LDI <address> Load the contents of this second address to ACC. Indexed addressing. Form the address from <address> + the contents of LDX <address> the index register. Copy the contents of this calculated address to ACC. 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>. JMP <address> Jump to given address. Following a compare instruction, jump to <address> if the compare was JPE <address> True. Following a compare instruction, jump to <address> if the compare was JPN <address> False. Bitwise AND operation of the contents of ACC with the contents of AND <address> <address>. Bitwise XOR operation of the contents of ACC with the contents of XOR <address> <address>. Bitwise OR operation of the contents of ACC with the contents of OR <address> <address>. IN Key in a character and store its ASCII value in ACC. OUT Output to the screen the character whose ASCII value is stored in ACC. END Return control to the operating system.
Part (b)
The programmer now starts to write a program that:
- tests whether an 8-bit two’s complement integer stored at address NUMBER is positive or
- outputs 'P' for a positive integer and 'N' for a negative integer.
negative
Complete the following program. Use op codes from the given instruction set. Show the required value of MASK in binary.
Label Op code Operand Comment START:
MASK // set to zero all bits except sign bit
// compare with 0
// if not equal jump to ELSE
THEN: // load ACC with 'P' (ASCII value 80)
JMP ENDIF
ELSE: // load ACC with 'N' (ASCII value 78)
ENDIF:
END
NUMBER: B00000101 // integer to be tested
MASK: // value of mask in binary
Question 4
Why this question appears here
72% assigned-topic match · Information representation › Data representation
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_s17_qp_43.pdf
