1.1.1 structure and function of processor Flashcards
contains 1.1.1 and assembly code + addressing modes from 1.2 (SLR07)
Why was assembly language developed?
- allow humans to input instructions easily, without having to remember long strings of 1’s and 0’s.
- allows programmer to write machine code using a set of mnemonics that represent binary equivalent in machine code
What are Mnemonics?
- Simplified instructions, used in assembly language, to easily write instructions.
Give examples of some mnemonics
- ADD, SUB, STA (store), LDA(load), BRA (branch always), BRZ(branch if zero), BRP(branch if positive), INP, OUT, HLT (end), DAT(data location), AVG.
what does HLT do?
- Ends the program
what does ADD do?
- Adds contents stored in specified memory location (uses operand) to value held in accumulator
what does SUB do?
- Subtracts contents stored in specified memory location using operand from value held in accumulator
what does BRA do?
- Always branches to address specified by operand. Unconditional branch
what does BRZ do?
Branches to address specified by operand if value in accumulator = zero. Conditional branch
what does BRP do?
- branches to address specified by operand if value in accumulator is 0 or positive. A conditional branch
what does STA do?
- Copies value held in accumulator to be stored in memory location specified by operand
what does LDA do?
Loads/copies value from specified memory location given by operand into accumulator
what does INP do?
Takes an input value from input area and stores into accumulator (opcode is 9 and operand is 01)
what does OUT do?
- Displays value held in accumulator in output area (opcode is 9 and operand is 02)
what does DAT do?
- indicate a location that contains data and an optional value for instruction (initialisation: it creates a variable identifier that can be used instead of an address in instructions).
where do you put data definitions for LMC
- Data definitions go at bottom of program
What will this do?
num1 DAT 100
- it will map a memory location to identifier num1 and set its initial value as 100.
in machine code, there are different types of addressing modes specified by what?
- opcode
the addressing mode specifies the way in which _________ will be interpreted.
- operand
what does direct addressing mode do
- value in operand is referencing address in memory where the required value is located
what does immediate addressing mode do
- data to be used is the actual value of the operand.
- often denoted with # in assembly language.
what does indirect addressing mode do
- value in operand is a reference to memory location that contains address in memory where required value is located
why is indirect addressing so useful
- large address ranges can be used to reference data and instructions
what does indexed addressing mode do
- index register = dedicated registers in the CPU.
- Indexed referencing makes use of this register to access array with data in contiguous memory locations.
if operand is 1010 and index register stored value 0011, what would happen using indexed addressing if instruction is ADD 10
- operand specifies that memory location to be used is 10. it finds value in location and adds value in index register to that value (10+3=13)
- therefore go to memory address 13 to access data to add.