chapter 9 trap routines and subroutines

18
Chapter 9 TRAP Routines and Subroutines

Upload: darren

Post on 23-Feb-2016

51 views

Category:

Documents


0 download

DESCRIPTION

Chapter 9 TRAP Routines and Subroutines. System Calls. System Call. LC-3 TRAP Mechanism. TRAP Instruction. TRAP. RET (JMP R7). TRAP Mechanism Operation. TRAP Routines and their Assembler Names. Example: Using the TRAP Instruction. Example: Output Service Routine. TRAP_PUTS - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 9 TRAP Routines and Subroutines

Chapter 9TRAP Routines and

Subroutines

Page 2: Chapter 9 TRAP Routines and Subroutines

System Calls

Page 3: Chapter 9 TRAP Routines and Subroutines

System Call

Page 4: Chapter 9 TRAP Routines and Subroutines

LC-3 TRAP Mechanism

Page 5: Chapter 9 TRAP Routines and Subroutines

TRAP Instruction

Page 6: Chapter 9 TRAP Routines and Subroutines

TRAP

Page 7: Chapter 9 TRAP Routines and Subroutines

RET (JMP R7)

Page 8: Chapter 9 TRAP Routines and Subroutines

TRAP Mechanism Operation

Page 9: Chapter 9 TRAP Routines and Subroutines

TRAP Routines and their Assembler Names

Page 10: Chapter 9 TRAP Routines and Subroutines

Example: Using the TRAP Instruction

Page 11: Chapter 9 TRAP Routines and Subroutines
Page 12: Chapter 9 TRAP Routines and Subroutines

9-12

Example: Output Service RoutineTRAP_PUTS

ST R0,OS_SAVE_R0 ; save R0, R1, and R7ST R1,OS_SAVE_R1ST R7,OS_SAVE_R7ADD R1,R0,#0 ; move string pointer (R0) into R1

TRAP_PUTS_LOOPLDR R0,R1,#0 ; write characters in string using OUTBRz TRAP_PUTS_DONEOUTADD R1,R1,#1BRnzp TRAP_PUTS_LOOP

TRAP_PUTS_DONELD R0,OS_SAVE_R0 ; restore R0, R1, and R7LD R1,OS_SAVE_R1LD R7,OS_SAVE_R7RET

stored in table,location x22

Page 13: Chapter 9 TRAP Routines and Subroutines
Page 14: Chapter 9 TRAP Routines and Subroutines
Page 15: Chapter 9 TRAP Routines and Subroutines
Page 16: Chapter 9 TRAP Routines and Subroutines
Page 17: Chapter 9 TRAP Routines and Subroutines
Page 18: Chapter 9 TRAP Routines and Subroutines