4.2 Assembly Language

Bulk view disabled for Guests. View lessons individually.

Assembly Language

1. The LMC Instruction Set (Simplified)

Key Mnemonics:
  • LDD [Add]: Load from Address
  • ADD [Add]: Add value at Address to ACC
  • STO [Add]: Store ACC value to Address
  • INC [Reg]: Increment Register
  • OUT: Output value in ACC
  • END: Terminate program
// Program at Addresses 100-103
100: LDD 200
101: ADD 201
102: STO 202
103: END

// Initial Memory Values
200: 15
201: 10

2. Worked Exam Trace

We start with the PC at 100. Each row shows the state after the Fetch and Execute stages for that instruction.

PC MAR MDR CIR ACC
100 --- --- --- 0
101 200 15 LDD 200 15
102 201 10 ADD 201 25
103 202 25 STO 202 25

3. Analysis of the Cycle

  • Fetch: The PC (100) is moved to MAR. The instruction "LDD 200" moves from RAM to MDR, then to CIR. PC increments to 101.
  • Execute: The CPU sees "LDD 200", so it puts 200 in the MAR, fetches the data (15) into the MDR, and finally loads it into the Accumulator (ACC).
Final Memory State:
Address 202 now contains the value 25.
⚠️ Exam Note: Immediate vs. Direct Addressing
  • Direct Addressing (LDD 200): Go to address 200 and get the number stored there.
  • Immediate Addressing (LDI 200): Load the actual number 200 into the accumulator.
Students often confuse these two! Direct = Address, Immediate = The actual value.