Registers | Equiv. in LMC* | Functions |
---|---|---|
Accumulator | Accumulator | General purpose, store value before and after execution of an instruction |
Program Counter (PC) | PC | Holds the (memory) address of the next instruction to be fetched |
Memory Data Register (MDR) | Stored the data value fetched from the memory, temporarily | |
Memory Address Register (MAR) | Address Register | Stored the address of the memory that is about to be used by a program instruction |
Current Instruction Register (CIR) | Instruction Register | Stored the currently executing instruction |
Index Register (IX) | Stores a number which will be used to change an address value | |
Status Register (SR) | Contains "Flags" which is represented by individual bits, that show the current status of the arithmetic operation. e.g. C - Carry V - Overflow N - Negative |
* https://peterhigginson.co.uk/LMC/
Diagram showing some buses with wires in a computer system
w17/qp13/4
Remark | Stage | Register transfer notation |
---|---|---|
Fetch instruction | Program Counter (PC) loaded with address of next instruction | |
Content of PC are copied to MAR | MAR <- [PC] | |
Content of PC increased by 1 | PC <- [PC] + 1 | |
Address given by MAR is located and content from main memory copied to MDR | MDR <- [ [MAR] ] | |
Content of MDR are copied to CIR | CIR <- [MDR] | |
Decode instruction | The opcode and operand are identified | |
Execute instruction | ||
Repeat the cycle if no interrupt |
Refer p.87 for the flowchart, also LMC to understand more on this
Assembly
LDM #33
Machine Code
0000 0001 0010 0001
Assembler
Opcode
0000 0001
Operand
0010 0001
Decoded instruction
Modes of addressing
Addressing Mode | Operand | Example |
---|---|---|
Immediate | The operand is the actual number used | LDM #13 Load Number 13 to accumulator |
Direct | Operand is the address of the value |
LDD 56 Load the content in Address 56 into accumulator, that means, so accumulator will have 89 in this case |
Indirect | Operand is the address of the address of the content |
LDI 55 The content in Address 55 will be used as the address for the actual content, thus, accumulator will have 135 |
Indexed | Operand is added to the value of index register (IX) and resulted the address of the value needed |
LDX 51 and assume IX is 2 So the Accumulator will load the value from 53, which is 172 in this case |
Address | Content |
---|---|
51 | 54 |
52 | 135 |
53 | 172 |
54 | 201 |
55 | 52 |
56 | 89 |
;Define a macro called "NameOfMacro" ;Note the keyword MACRO itself is directive MACRO NameOfMacro <instructions>
END MACRO
;Calling macro NameOfMacro