Past-paper question · 2017 May-June · Paper 43 · Q1(a)

Question 1(a) 2017 · May-June · Paper 43 · 8 marks

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

Official answer for Question 1

Part (a)

Question 8

✓
Op
✓
Label
✓
Operand
✓
Comment
✓
code
✓
START: IN
✓
// INPUT character
✓
STO
✓
CHAR
✓
// store in CHAR

Question 1

✓
// Initialise ACC
✓
LDM
✓
#65
✓
(ASCII value for

Question 1

✓
'A' is 65)
✓
LOOP: OUT
✓
// OUTPUT ACC
✓
1 + 1
✓
// compare ACC with
✓
CMP
✓
CHAR

Question 1

✓
CHAR
✓
// if equal jump to
✓
JPE
✓
ENDFOR

Question 1

✓
end of FOR loop
✓
INC
✓
ACC
✓
// increment ACC

Question 1

✓
JMP
✓
LOOP
✓
// jump to LOOP

Question 1

✓
ENDFOR: END
✓
CHAR:

Mark scheme 9608_s17_ms_43.pdf →

Show text version of question

Question 1

Part (a)

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 (a)

A programmer writes a program that:

  • reads a character from the keyboard (assume it will be a capital letter)
  • outputs the alphabetical sequence of characters from ‘A’ to the character input. For

example, if the character ‘G’ is input, the output is:

ABCDEFG

The programmer has started to write the program in the table on the following page. The Comment column contains descriptions for the missing instructions, labels and data.

Question 3

Complete the following program. Use op codes from the given instruction set.

Label Op code Operand Comment START: // INPUT character

// store in CHAR

// Initialise ACC (ASCII value for 'A' is 65)

// OUTPUT ACC

// compare ACC with CHAR

// if equal jump to end of FOR loop

// increment ACC

// jump to LOOP

ENDFOR: END

CHAR:

[8]
Topic relevance

Why this question appears here

72% assigned-topic match · Hardware › Logic gates and logic circuits

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

Keep practising this topic