Past-paper question · 2017 May-June · Paper 42 · Q1(b)

Question 1(b) 2017 · May-June · Paper 42 · 6 marks

Original past-paper question for 1(B)
Original past-paper question for 1(B)
Original past-paper question for 1(B)
Original past-paper question for 1(B)
Reveal official mark-scheme answer Official mark-scheme answer for 1(B)

Official answer for Question 1

Part (b)

Question 6

✓
Op
✓
Label
✓
Operand
✓
Comment
✓
code
✓
START:
✓
LDD
✓
NUMBER1

Question 1

✓
XOR
✓
MASK
✓
// convert to one's complement

Question 1

✓
INC
✓
ACC
✓
// convert to two's complement

Question 1

✓
STO
✓
NUMBER2

Question 1

✓
END
✓
MASK:
✓
B11111111
✓
// show value of mask in binary here

Question 1

✓
NUMBER1:
✓
B00000101
✓
// positive integer
✓
NUMBER2:
✓
B11111011
✓
// show value of negative equivalent

Question 1

✓
9608/42
✓
Cambridge International AS/A Level – Mark Scheme
✓
May/June 2017
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s17_ms_42.pdf →

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 Explanation Op code Operand LDM #n Immediate addressing. Load the number n to ACC. LDD <address> Direct addressing. Load the contents of the location at the given address to ACC. LDI <address> Indirect addressing. The address to be used is at the given address. Load the contents of this second address to ACC. LDX <address> Indexed addressing. Form the address from <address> + the contents of 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). CMP <address> Compare the contents of ACC with the contents of <address>. JMP <address> Jump to the given address. JPE <address> Following a compare instruction, jump to <address> if the compare was True. JPN <address> Following a compare instruction, jump to <address> if the compare was False. AND <address> Bitwise AND operation of the contents of ACC with the contents of <address>. XOR <address> Bitwise XOR operation of the contents of ACC with the contents of <address>. OR <address> Bitwise OR operation of the contents of ACC with the contents of <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:

  • converts a positive integer, stored at address NUMBER1, into its negative equivalent in
  • two’s complement form

  • stores the result at address NUMBER2

Complete the following program. Use op codes from the given instruction set. Show the value stored in NUMBER2.

Op Label Operand Comment code START: MASK // convert to one's complement // convert to two's complement

END MASK: // show value of mask in binary here NUMBER1: B00000101 // positive integer NUMBER2: // negative equivalent

[6]

Question 4

Topic relevance

Why this question appears here

71% 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_42.pdf

Keep practising this topic