Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Computer organization and assembly language - Lecture 16: Procedures

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

In this lecture, students will be able to understand: Computer organization, data representation, integer arithmetic, binary representation, floating point representation, machine instruction characteristics, instruction cycles, types of operands, pentium and power PC data types, microporessor bus structure, address, data, control buses and registers, memory organization and structure, addressing modes. | CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures Lecture 15: Review Elements are only added/removed to/from the top. LIFO (Last In First Out) structure. Managed by the CPU, using two registers: SS:ESP PUSH and POP Instructions PUSH syntax: PUSH r/m16 PUSH r/m32 PUSH imm32 POP syntax: POP r/m16 POP r/m32 10 9 8 7 6 5 4 3 2 1 Top Bottom Lecture 15: Review (cont.) PUSHFD and POPFD push and pop the EFLAGS register PUSHAD pushes the 32-bit general-purpose registers on the stack order: EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI POPAD pops the same registers off the stack in reverse order PUSHA and POPA do the same for 16-bit registers Lecture Outline Defining and Using PROCEDURES Creating Procedures Documenting Procedures Example: SumOf Procedure CALL and RET Instructions Nested Procedure Calls Local and Global Labels Procedure Parameters Flowchart Symbols USES Operator Creating Procedures Large problems can be divided into smaller tasks to make them more manageable. | CSC 221 Computer Organization and Assembly Language Lecture 16: Procedures Lecture 15: Review Elements are only added/removed to/from the top. LIFO (Last In First Out) structure. Managed by the CPU, using two registers: SS:ESP PUSH and POP Instructions PUSH syntax: PUSH r/m16 PUSH r/m32 PUSH imm32 POP syntax: POP r/m16 POP r/m32 10 9 8 7 6 5 4 3 2 1 Top Bottom Lecture 15: Review (cont.) PUSHFD and POPFD push and pop the EFLAGS register PUSHAD pushes the 32-bit general-purpose registers on the stack order: EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI POPAD pops the same registers off the stack in reverse order PUSHA and POPA do the same for 16-bit registers Lecture Outline Defining and Using PROCEDURES Creating Procedures Documenting Procedures Example: SumOf Procedure CALL and RET Instructions Nested Procedure Calls Local and Global Labels Procedure Parameters Flowchart Symbols USES Operator Creating Procedures Large problems can be divided into smaller tasks to make them more manageable. A procedure is the Assembly equivalent of a Java or C++ function. Following is an assembly language procedure named sample: sample PROC . . . ret sample ENDP Documenting Procedures Suggested documentation for each procedure: A description of all tasks accomplished by the procedure. Receives: A list of input parameters; state their usage and requirements. Returns: A description of values returned by the procedure. Requires: Optional list of requirements called preconditions that must be satisfied before the procedure is called. Example: SumOf Procedure ;--------------------------------------------------------- SumOf PROC ; ; Calculates and returns the sum of three 32-bit integers. ; Receives: EAX, EBX, ECX, the three integers. May be ; signed or unsigned. ; Returns: EAX = sum, and the status flags (Carry, ; Overflow, etc.) are changed. ; Requires: nothing ;--------------------------------------------------------- add eax,ebx add eax,ecx ret SumOf ENDP CALL and RET Instructions The CALL

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.