Past-paper question · 2021 May-June · Paper 41 · Q6

Question 6 2021 · May-June · Paper 41 · 6 marks

Original past-paper question for 6
Original past-paper question for 6
Reveal official mark-scheme answer Official mark-scheme answer for 6

Official answer for Question 6

✓
Marks

Question 6

✓
Instruction
✓
Label
✓
Op Code
✓
Operand
✓
LDR
✓
#0
✓
1 mark for start
✓
start: LDD
✓
count
✓
1 mark for LDD count
✓
CMP
✓
#5
✓
1 mark for CMP #5
✓
JPE
✓
endP
✓
LDX
✓
word
✓
1 mark
✓
AND
✓
Mask1
✓
CMP
✓
#0
✓
JPE
✓
output
✓
LDX
✓
word
✓
1 mark
✓
AND
✓
Mask2
✓
output: OUT
✓
LDD
✓
count
✓
1 mark
✓
INC
✓
ACC
✓
STO
✓
count
✓
INC
✓
IX
✓
JMP
✓
start
✓
endP: end
✓
word: B01001000
✓
B01101111
✓
B01110101
✓
B01110011
✓
B01100101
✓
mask1: B00100000
✓
mask2: B11011111
✓
count: 0
✓
9608/41
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2021
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s21_ms_41.pdf →

Show text version of question

Question 6

The table shows assembly language instructions for a processor that has one general purpose register, the Accumulator (ACC), and an Index Register (IX).

Instruction Label Op Operand Explanation code LDM #n Immediate addressing. Load the number n to ACC Direct addressing. Load the contents of the location at LDD <address> the given address to ACC Indexed addressing. Form the address from <address> LDX <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 contents of ACC at the given address ADD <address> Add the contents of the given address to ACC INC <register> Add 1 to the contents of the register (ACC or IX) Bitwise AND operation of the contents of ACC with the AND <address> contents of <address> Bitwise XOR operation of the contents of ACC with the XOR <address> contents of <address> Bitwise OR operation of the contents of ACC with the OR <address> contents of <address> Output to screen the character whose ASCII value is OUT stored in ACC Compare the contents of ACC with the contents of CMP <address> <address> CMP #n Compare the contents of ACC with number n Following a compare instruction, jump to <address> if JPE <address> the compare was True Following a compare instruction, jump to <address> if JPN <address> the compare was False JMP <address> Jump to the given address END Return control to the operating system <label>: <op Labels an instruction <operand> code> <label>: <data> Gives a symbolic address <label> to the memory location with contents <data>

An algorithm takes each letter of a stored 5-letter word and checks if the letter is upper case.

If the letter is upper case, it outputs the letter.

If the letter is not upper case, it converts the letter to upper case and then outputs it.

All ASCII upper case letters have 010 as the three most significant bits.

Assume each letter is alphabetic.

Question 17

Complete the assembly language program for the algorithm described using the instruction set provided on the previous page.

Instruction Comment Label Op code Operand

LDR #0 // load zero to IX

// load count and check if it is 5

JPE endP // jump to end

LDX word // load letter from indexed address word

// check if it is upper case CMP #0

JPE output // jump to output if it is upper case

LDX word // load letter from indexed address word

// convert to upper case

output: OUT // output the character

// increase count by 1

INC IX // increase IX by 1

JMP start // return to start

endP: end // end the program

word: B01001000

B01101111

B01110101

B01110011

B01100101

mask1: B00100000

mask2: B11011111

count: 0

[6]

Question 18

Topic relevance

Why this question appears here

98% 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_s21_qp_41.pdf

Keep practising this topic