Past-paper question · 2017 October-November · Paper 42 · Q5(b)

Question 5(b) 2017 · October-November · Paper 42 · 10 marks

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

Official answer for Question 5

Part (b)

Question 10

✓
Label
✓
Op Code
✓
Operand
✓
Comment
✓
START:
✓
LDR
✓
#0
✓
// initialise the Index Register

Question 1

✓
LOOP:
✓
LDX
✓
VALUES
✓
// load the value from VALUES
✓
1(loop) +
✓
1(LDX
✓
Values)
✓
LSR
✓
#3
✓
// divide by 8
✓
1 (LSR) + 1
✓
(#3)
✓
STX
✓
VALUES
✓
// store the new value in VALUES

Question 1

✓
INC
✓
IX
✓
// increment the Index Register

Question 1

✓
LDD
✓
REPS
✓
// increment REPS

Question 1

✓
INC
✓
ACC
✓
STO
✓
REPS
✓
CMP
✓
#6
✓
// is REPS = 6 ?

Question 1

✓
JPN
✓
LOOP
✓
// repeat for next value

Question 1

✓
END
✓
REPS:
✓
0
✓
VALUES:

Question 22

Question 13

Question 5

Question 46

Question 12

Question 33

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

Mark scheme 9608_w17_ms_42.pdf →

Show text version of question

Question 5

Part (b)

Question 5

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 9

Part (b)

Six values are stored, starting at the location VALUES. A program is needed to divide each of

the values by 8 and store them back in their original location.

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

Label Op code Operand Comment START: // initialise the Index Register // load the value from VALUES // divide by 8 // store the new value in VALUES // increment the Index Register

// increment REPS

// is REPS = 6 ? // repeat for next value END REPS: 0 VALUES: 22

Question 13

Question 5

Question 46

Question 12

Question 33

[10]

Question 11

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 12

Topic relevance

Why this question appears here

72% 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_w17_qp_42.pdf

Keep practising this topic