Past-paper question · 2017 October-November · Paper 41 · Q4(b)

Question 4(b) 2017 · October-November · Paper 41 · 0 marks

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

Official answer for Question 4

Part (b)

Question 10

✓
Label
✓
Opcode
✓
Operand
✓
Comment
✓
Mark
✓
START:
✓
LDR
✓
#0
✓
// initialise the Index Register

Question 1

✓
LOOP:
✓
LDX
✓
NUMBERS
✓
// load the value from NUMBERS
✓
1 (LOOP) +
✓
1(LDX NUMBERS)
✓
LSL
✓
#2
✓
// multiply by 4
✓
1 (LSL) +
✓
1 (#2)
✓
STX
✓
NUMBERS
✓
// store the new value in NUMBERS

Question 1

✓
INC
✓
IX
✓
// increment the Index Register

Question 1

✓
LDD
✓
COUNT
✓
INC
✓
ACC
✓
// increment COUNT

Question 1

✓
STO
✓
COUNT
✓
CMP
✓
#5
✓
// is COUNT = 5 ?

Question 1

✓
JPN
✓
LOOP
✓
// repeat for next number

Question 1

✓
ENDP:
✓
END
✓
COUNT:
✓
0
✓
NUMBERS:

Question 22

Question 13

Question 5

Question 46

Question 12

✓
9608/41
✓
Cambridge International AS/A Level – Mark Scheme
✓
October/November
✓
PUBLISHED
✓
2017
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_w17_ms_41.pdf →

Show text version of question

Question 4

Part (b)

Question 4

The following table shows part of the instruction set for a processor. The processor 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. LDR #n Immediate addressing. Load the number n to IX. STO <address> Store the contents of ACC at the given address. STX <address> Indexed addressing. Form the address from <address> + the contents of the index register. Copy the contents from ACC to this calculated address. ADD <address> Add the contents of the given address to the ACC. 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). JMP <address> Jump to the given address. CMP <address> Compare the contents of ACC with the contents of <address>. CMP #n Compare the contents of ACC with number n. 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. LSL #n Bits in ACC are shifted n places to the left. Zeros are introduced on the right hand end. LSR #n Bits in ACC are shifted n places to the right. Zeros are introduced on the left hand end. 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.

Question 7

Part (b)

Five numbers are stored, starting in the location labelled NUMBERS. A program is needed to

multiply each of the numbers by 4 and store them back in their original location.

Write this program. Use the op codes from the instruction set on the opposite page.

Label Op code Operand Comment START: // initialise the Index Register // load the value from NUMBERS // multiply by 4 // store the new value in NUMBERS // increment the Index Register

// increment COUNT

// is COUNT = 5 ? // repeat for next number ENDP: END COUNT: 0 NUMBERS: 22

Question 13

Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Constructs

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_w17_qp_41.pdf

Keep practising this topic