1. Trang chủ
  2. » Luận Văn - Báo Cáo

2) - TRƯỜNG CÁN BỘ QUẢN LÝ GIÁO DỤC THÀNH PHỐ HỒ CHÍ MINH

10 8 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 96,12 KB

Nội dung

program written in another language, external identifiers must have compatible naming conventions ( naming rules ). • An external identifier is a name that has been placed in a[r]

(1)

CSC 221

Computer Organization and Assembly Language

Lecture 30:

(2)

Lecture 29: Review

• Win32 API Functions that create, read, and write to

files:

– CreateFile – ReadFile – WriteFile

– SetFilePointer

• Console Window Manipulation Functions

– Screen buffer – Console window

– Controlling the cursor – Controlling the text color

(3)

Lecture 29: Review

• Time and Date Functions

– GetLocalTime, SetLocalTime – GetTickCount, Sleep

– GetDateTime

– SYSTEMTIME Structure

• Graphical Window Functions

– POINT, RECT Structures

– MSGStruct, WNDCLASS Structures – MessageBox Function

– WinMain, WinProc Procedures

(4)

Lecture Outline

• Why Link ASM and HLL Programs?

– General and Calling Conventions – External Identifiers

– MODEL Directive

• STDCALL • C

• Inline Assembly Code

– asm Directive

– You Can Do the Following – You Cannot Do the Following – Register Usage

(5)

Why Link ASM and HLL Programs?

Use high-level language for overall project

development

– Relieves programmer from low-level details – Less time

– Slow Speed and Large Size

Use assembly language code

– Speed up critical sections of code

– Access nonstandard hardware devices – Write platform-specific code

(6)

Objective

Interface or Connection, between

assembly language and high-level programming languages.

(7)

General Conventions

• Considerations when calling assembly language

procedures from high-level languages:

– Does the assembler or compiler alter the names of identifiers

placed in object files, and if so, how?

– Both must use the same naming convention (rules or

characteristics regarding the naming of variables and procedures)

– Both must use the same memory model, with compatible

segment names

(8)

Calling Convention

• Refers to the low-level details about how procedures are

called Considerations:

– Identifies specific registers that must be preserved by procedures – Determines how arguments are passed to procedures: in registers,

on the stack, in shared memory, etc

– Determines the order in which arguments are passed by calling

programs to procedures

– Determines whether arguments are passed by value or by

reference

(9)

External Identifiers

• When calling an assembly language procedure from a

program written in another language, external identifiers must have compatible naming conventions (naming rules)

• An external identifier is a name that has been placed in a

module’s object file in such a way that the linker can make the name available to other program modules

• The linker resolves references to external identifiers, but

(10)

Example

• suppose a C program named Main.c calls an external

procedure named ArraySum

• As illustrated in the following diagram, the C compiler

automatically preserves case and appends a leading underscore to the external name, changing it to

Ngày đăng: 01/04/2021, 17:04

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w