Presentation is loading. Please wait.

Presentation is loading. Please wait.

The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP 2620 1.

Similar presentations


Presentation on theme: "The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP 2620 1."— Presentation transcript:

1 The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP 2620 1

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 -255…256 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 [8:6] 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 [7:0] 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 When routine is done, PC is set to the instruction following TRAP. TRAP Instruction vectorroutine x23input a character from the keyboard x21output a character to the monitor x25halt the program


Download ppt "The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP 2620 1."

Similar presentations


Ads by Google