tailieunhanh - Lecture Computer organization and assembly language: Chapter 24 - Dr. Safdar Hussain Bouk

After studying this chapter you will be able to understand: Summarize, at a top level, the key functions of an operating system (OS); discuss the evolution of operating systems for early simple batch systems to modern complex systems; discuss the key design areas that have been instrumental in the development of modern operating systems;. | CSC 221 Computer Organization and Assembly Language Lecture 24: Advanced Procedures Lecture 23: Review Assembly Implementation of: Shift and Rotate Instructions Logical Shifts and Arithmetic Shifts SHL and SHR Instruction SAL and SAR Instructions ROL and ROR Instruction RCL and RCR Instructions SHLD/SHRD Instructions Shift and Rotate Applications Lecture 23: Review Assembly Implementation of: Multiplication and Division Instructions MUL Instruction IMUL Instruction DIV Instruction Signed Integer Division (cont.) Lecture Outline Local Variables Stack Parameters Register vs. Stack Parameters INVOKE Directive PROC Directive PROTO Directive Passing by Value or by Reference Parameter Classifications Example: Exchanging Two Integers Trouble-Shooting Tips Lecture Outline Stack Frames Memory Models Language Specifiers Explicit Access to Stack Parameters Passing Arguments by Reference Creating Local Variables Terminologies Programming languages use different terms to refer to subroutines : In C and C++, subroutines functions In Java, subroutines methods In MASM, subroutines procedures Values passed to a subroutine by a calling program are called arguments. When the values are received by the called subroutine, they are called parameters. LOCAL Directive A local variable is created, used, and destroyed within a single procedure. The LOCAL directive declares a list of local variables. immediately follows the PROC directive each variable is assigned a type Syntax: LOCAL varlist Example: MySub PROC LOCAL var1:BYTE, var2:WORD, var3:SDWORD Local Variables LOCAL flagVals[20]:BYTE ; array of bytes LOCAL pArray:PTR WORD ; pointer to an array myProc PROC, ; procedure LOCAL t1:BYTE, ; local variables Examples: MASM-Generated Code (1 of 2) BubbleSort PROC LOCAL temp:DWORD, SwapFlag:BYTE . . . ret BubbleSort ENDP BubbleSort PROC push ebp mov ebp,esp add esp,0FFFFFFF8h ; add -8 to ESP . . . mov esp,ebp pop ebp ret BubbleSort ENDP MASM generates the following code: MASM-Generated . | CSC 221 Computer Organization and Assembly Language Lecture 24: Advanced Procedures Lecture 23: Review Assembly Implementation of: Shift and Rotate Instructions Logical Shifts and Arithmetic Shifts SHL and SHR Instruction SAL and SAR Instructions ROL and ROR Instruction RCL and RCR Instructions SHLD/SHRD Instructions Shift and Rotate Applications Lecture 23: Review Assembly Implementation of: Multiplication and Division Instructions MUL Instruction IMUL Instruction DIV Instruction Signed Integer Division (cont.) Lecture Outline Local Variables Stack Parameters Register vs. Stack Parameters INVOKE Directive PROC Directive PROTO Directive Passing by Value or by Reference Parameter Classifications Example: Exchanging Two Integers Trouble-Shooting Tips Lecture Outline Stack Frames Memory Models Language Specifiers Explicit Access to Stack Parameters Passing Arguments by Reference Creating Local Variables Terminologies Programming languages use different terms to refer to subroutines : In

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.