The 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). Opcode LDM #n LDD <address> STO <address> ADD <address> INC | <register> DEC | <register> CMP <address> JPE <address> JPN <address> JMP <address> IN OUT END Instruction Operand Immediate addressing. Load the number n to ACC Direct addressing. Load the contents of the location at the given address to ACC Store contents of ACC at the given address Add the contents of the given address to the ACC Add 1 to the contents of the register (ACC or IX) Subtract 1 from the contents of the register (ACC or IX) Compare the contents of ACC with the contents of <address> Following a compare instruction, jump to <address> if the compare was True Following a compare instruction, jump to <address> if the compare was False Jump to the given address Key in a character and store its ASCII value in ACC Output to the screen the character whose ASCII value is stored in ACC Return control to the operating system Explanation # denotes a denary number, e.g. #123 The current contents of the main memory and selected values from the ASCII character set are: Address 70 71 72 73 74 75 76 77 78 79 80 81 82 83 Instruction IN CMP 100 JPE 80 CMP 101 JPE 76 JMP 80 LDD 102 INC ACC STO 102 JMP 70 LDD 102 DEC ACC STO 102 JMP 70 ... 100 68 101 65 102 100 ASCII code table (selected codes only) ASCII code 65 66 67 68 Character A B C D
- (a)Complete the trace table for the program currently in main memory when the following characters are input: AD Do not trace the program any further when the third input is required. Instruction address ACC Memory address 100 101 102 68 65 100[4]
- (b)(i)The contents of memory address 300 represent an unsigned binary integer. Write the denary value of the unsigned binary integer in memory address 300.[1]
- (b)(ii)An assembly language program needs to test if bit number 2 in memory address 300 is a 1. Complete the assembly language instruction to perform this test. #4[1]
- (b)(iii)An assembly language program needs to set bit numbers 4, 5, 6 and 7 to 0, but keep bits 0 to 3 with their existing values. Write the assembly language instruction to perform this action.[2]
Mark scheme
Marking points from the official mark scheme (May/June 2021). The mark or mark type is shown in brackets.
- [1] (a) ACC: 65 (after first IN, for 'A')
- [1] (a) ACC: 100 (after LDD 102 at 76), ACC: 101 (after INC ACC at 77), Mem[102]: 101 (after STO 102 at 78)
- [1] (a) ACC: 68 (after second IN, for 'D')
- [1] (a) ACC: 101 (after LDD 102 at 80), ACC: 100 (after DEC ACC at 81), Mem[102]: 100 (after STO 102 at 82)
- [1] (b)(i) 102
- [1] (b)(ii) AND
- [1] (b)(iii) AND
- [1] (b)(iii) #15
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →