The LC-3 PowerPoint PPT Presentation

presentation player overlay
1 / 9
About This Presentation
Transcript and Presenter's Notes

Title: The LC-3


1
The LC-3 Chapter 5
  • COMP 2620

2
Control Instructions
  • Recall that there are three types of instructions
  • Data movement
  • Operate
  • Control
  • The control instructions influence the PC value
    so that execution is no longer linear in nature

3
Control Instructions
  • Recall, that so far we have only considered the
    branch instruction BRxxx.
  • This instructions worked by comparing the
    condition codes against the flags set in the
    instruction and jumping to a new location if one
    matched appropriately
  • We could get a unconditional jump using BRnzp

4
JMP Instruction
  • One problem with the BRnzp instruction is it is
    limited in the range of addresses near the PC
  • It had an effective range of -255256 from the
    branch itself
  • If we needed to branch to 2000 locations away, we
    could not easily do it

5
JMP Instruction
  • The JMP (opcode 1100) instruction will allow us
    to do this
  • The JMP instruction loads the PC with the
    contents of a specified register in bits 86
  • All the remaining bits are 0.
  • The change of the PC value always occurs!

6
JMP Instruction
7
TRAP Instruction
  • The TRAP instructions changes the PC to a memory
    address that is part of the operating system
  • The OS then performs a task on behalf of the
    program that is running
  • We say the TRAP instruction invokes a SERVICE CALL

8
TRAP Instruction
  • Bits 70 form the trap vector
  • The trap vector is a number that identifies which
    service call that the OS needs to perform
  • Hence, there are 256 possible trap vectors

9
TRAP Instruction
  • When routine is done, PC is set to the
    instruction following TRAP.

vector routine
x23 input a character from the keyboard
x21 output a character to the monitor
x25 halt the program
Write a Comment
User Comments (0)
About PowerShow.com