1. Theory Fundamentals
A section of Computer Science, 9608
Listing 10 of 304 questions
A simple program written in assembly language is translated using a two-pass assembler. The table contains some of the tasks performed by a two-pass assembler. Tick (✓) one box in each row to indicate whether the task is performed at the first or second pass. The first row has been completed for you. Task First pass Second pass Creation of symbol table ✓ Expansion of macros Generation of object code Removal of comments The processor’s instruction set can be grouped according to their function. For example, one group is modes of addressing. Identify two other groups of instructions. The table shows assembly language instructions for a processor which has one general purpose register, the Accumulator (ACC), and an Index Register (. Instruction Explanation Op code Operand LDM #n Immediate addressing. Load the denary number n to ACC. LDD Direct addressing. Load the contents of the location at the given address to ACC. LDX Indexed addressing. Form the address from + the contents of the Index Register. Copy the contents of this calculated address to ACC. LDR #n Immediate addressing. Load the denary number n to IX. STO Store contents of ACC at the given address. ADD Add the contents of the given address to ACC. INC Add 1 to the contents of the register (ACC or . CMP #n Compare contents of ACC with denary number n. JPE Following a compare instruction, jump to if the compare was True. JPN Following a compare instruction, jump to if the compare was False. JMP Jump to the given address. OUT Output to screen the character whose ASCII value is stored in ACC. END Return control to the operating system. The current contents of the main memory, Index Register (and selected values from the ASCII character set are: Address Instruction LDM #0 STO 300 CMP #0 JPE 28 LDX 100 ADD 301 OUT JMP 30 LDX 100 OUT LDD 300 INC ACC STO 300 INC IX CMP #2 JPN 22 END … … IX ASCII code table (Selected codes only) ASCII Code Character A B C D E a b c d e
9608_s19_qp_11
THEORY
2019
Paper 1, Variant 1
The steps 1 to 6 describe the first pass of a two‑pass assembler. The following three statements are used to complete the sequence of steps. A If it is already in the symbol table, it checks to see if the absolute address is known B When it meets a symbolic address, it checks to see if it is already in the symbol table C If it is known, it is entered Write one of the letters A, B or C in the appropriate step to complete the sequence. 1. The assembler reads the assembly language instructions 2. 3. If it is not, it adds it to the symbol table 4. 5. 6. If it is not known, it is marked as unknown. The assembler translates assembly code into machine code. The table shows the denary values for three assembler op codes. Op code Denary value LDD ADD STO Convert the denary value for the op code LDD into 8‑bit binary. Convert the denary value for the op code STO into hexadecimal. State why the denary value for the op code ADD cannot be represented in 8‑bit two’s complement form. Justify your answer. 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 (. Instruction Explanation Op code Operand LDM #n Immediate addressing. Load the denary number n to ACC LDD Direct addressing. Load the contents of the location at the given address to ACC LDX Indexed addressing. Form the address from + the contents of the Index Register. Copy the contents of this calculated address to ACC LDR #n Immediate addressing. Load the denary number n to IX STO Store contents of ACC at the given address ADD Add the contents of the given address to ACC INC Add 1 to the contents of the register (ACC or CMP Compare contents of the address given with the contents of ACC JPE Following a compare instruction, jump to if the compare was True JPN Following a compare instruction, jump to if the compare was False JMP Jump to the given address OUT Output to screen the character whose ASCII value is stored in ACC END Return control to the operating system
9608_s20_qp_12
THEORY
2020
Paper 1, Variant 2
Questions Discovered
304