Low Level Languages
Explain the concepts and, using examples, demonstrate an understanding of the use of the accumulator, registers, and program counter;
Describe immediate, direct, indirect, relative and indexed addressing of memory when referring to low-level languages;
Discuss the concepts and, using examples, show an understanding of mnemonics, opcode, operand and symbolic addressing in assembly language to include simple arithmetic operations, data transfer and flow-control.
Notes
§ Opcodes is the part of the binary string that represent the operations that the computer can understand and carry out. They are easier to remember.
§ They can be represented by mnemonics which are the pseudo names given to the different operations that make it easier. E.g. ADD.
§ The operand is the data to be manipulated, there’s no point telling the computer what to ADD if there’s no data to apply it to. It can hold the address of the data, or just the data.
§ Address Labels are used as a symbolic representation of the operands
§ Symbolic addressing is the use of characters to represent the address of a store location
There are three different operations that can be done in assemble language, which have different effects on the processor. These are: arithmetic or logic operations, data transfer and flow control.
Arithmetic Operations
§ When opcode is decoded, data is collected and placed in the memory data register
§ It is then manipulated in the ALU. Part of this is the accumulator, where results are temporarily stored until they are needed for the next operation.
Data Transfer
§ Some operations (like GET and GTO) just move data in and out of the memory.
Flow Control
§ This is where the order which instructions are executed may be changed by a jump instruction or a conditional jump instruction.
The special Registers
The program counter (PC) is used to keep track of the location of the next instruction to be executed. (This register is also known as the Sequence Control Register (SCR)). It is used so that the processor always knows where the next instruction is. Note that the content can be changed by some instructions as well as simple incrimination.
The memory address register (MAR) holds the address of the instruction or data that is to be fetched from memory. This address can come directly from the PC if the data to be fetched is the next instruction, or it can come from the CIR when the address of the data to be used is found in the decoding process.
The current instruction register (CIR) holds the instruction that is to be executed, ready for decoding. This instruction will consist of (at least) an operation code which will be looked up in the table of codes so that the processor knows what actions are necessary and the address which will be sent to the MAR.
The memory data register (MDR) holds data to be transferred to memory and data that is being transferred from memory, including instructions on their way to the CIR. The computer cannot distinguish between data and instructions. Both are held as binary numbers. How these binary numbers are interpreted depends on the registers in which they end up. The MDR is the only route between the other registers and the main memory of the computer.
The accumulator
is where results are temporarily held and is used in conjunction with a
working register (ALU) to do calculations.
The index register is a special register used to adjust the address part of an instruction. If this is to be used then the simple case of two parts to the instruction which was detailed above, must become three parts because there must be a part of the instruction which defines which sort of addressing must be used.
Addressing
Each instruction in machine code is represented by a series of binary digits. There are two parts to each instruction, an operation (the opcode) and the data. The data is what the operation is being applied to, there are a number of different ways in which this data can be represented, and this is known as addressing. Usually the address of the data is given rather than just the data.
Direct Addressing
This is where the address part of the instruction holds the address of where the data is. For example if an instruction was 00110111 and the first 3 bits were the instruction e.g. ADD and the last 5 bits were the address, then the computer would know to add whatever is in the data location 10111 to the accumulator. Most bytes are bigger than 8 bits, more like 32 or 64 bits. However it does not give access to enough memory, and needs supplementing with other methods.
Immediate Addressing
This is when the value in the instruction is not an address at all but the actual data. This is very simple, although not often used because the program parameters cannot be changed. This means that the data being operated on can’t be adjusted and only uses constants.
Indirect Addressing
This is where the real address is stored in the memory so the value in the address part of the instruction is pointing to the address of the data. This method is useful because the amount of space in a location is much bigger than the space in the address part of the instruction. Therefore we can store larger addresses and use more memory.
Relative Addressing
This is direct addressing that does not commence from the start of the address of the memory. It begins from a fixed point, and all addresses are relative to that point.
Indexed Addressing
This is where the address part of the instruction is added to the value held in a special register. The special register use is the Index Register (IR). The result of this is then the required address.
Past Exam Questions and Answers
Explain the term
opcode
the mnemonic part of the instruction/that indicates what it is to do/code for the operation |
What is symbolic addressing?
the use of characters to represent the address of a store location |
What is the purpose of the
accumulator?
temporary storage (within
ALU) |
What is indexed addressing?
uses an index
register/IR |
What is direct addressing?
the instruction gives the address to be used |
What is relative addressing?
allows a real address to
be calculated… |
What’s immediate
addressing?
used in assembly
language |
Why is it not possible to use only direct
addressing in assembly languages?
number of addresses
available is limited… |
Explain Mnemonics
a code that is easily
remembered… |
Explain flow controll
the order in which
instructions are executed |
How and why is the the
index register (IR) used?
used in indexed
addressing |
What are the differences between machine code and
assembly language?
Machine
Code: |
What’s the use of an operand, in
an assembly language instruction?
address field (in an
instruction) |
What’s the difference between
direct and indirect addressing?
direct: |