Transcript Document
課程簡介與背景知識介紹
組合語言
971版
教材
敎科書介紹
• Intel-base computers
– KIP R. IRVINE, Assembly Language for INTELbased Computers, 5th Edition, Pearson.
• 王國華、白能勝、曾鴻祥編譯,組合語言,第五版,
全華圖書印行,書號:培生05976。ISBN 978-986-154610-0。
• ARM series processor
– Peter Knaggs and Stephen Welsh, ARM: Assembly
Language Programming, School of Design,
Engineering & Computing, August 31, 2004
教材
敎科書介紹(續)
• Features of Assembly Language for INTELbased Computers, 5th Edition:
–
–
–
–
–
教材
Intel IA-32組合語言
IA-32架構介紹
組語的基礎
巨集
高階語言介面
敎科書介紹
• ARM: Assembly Language Programming
–
–
–
–
–
–
–
–
–
教材
電子書
Assembler
Architecture
Instruction Set
Addressing mode
Program
Data Movement
Subroutine
…
教學目標
• 資工系教學目標
–培養具有增進或改善數位生活之各式系統設計與
實作能力的科技人才。
•數位生活系統
–嵌入式系統
•撰寫程式
•組合語言課程教學目標
–學習組合語言的程式設計的基本技巧,並認識
IA-32和ARM組合語言。使學生具備入門的技術,
能夠看懂與編寫IA-32與ARM組合語言程式。
教材
評分方式
• 期中考25%
• 期末考40%(整學期授課範圍)
• 平常分數35%
– 上課態度:基本分:70 (50%)
•
•
•
•
•
•
•
•
•
•
•
教材
全勤:+5
課堂練習:完成+1/每次
未被扣分:+5
缺課(未事先請假):-2/每節
遲到/早退:-1/每次
上課吵鬧:-1/每次
不聽勸告: -1/每次
上課玩電動:-10/每次
上課時做與課堂無關事項:-2/每次
不帶課本: -1/每次
缺考: -10/每次
– 小考/作業:(50%)
基本概念
• 組譯器(Assembler)
– 是一個能將組合語言的來源碼或原始碼(sourcecode),轉換成機器語言的公用程式。
• 連結器(Linker)
– 是一個能將組譯器產生的若干檔案,結合成單一
的可執行程式的公用程式。
• 除錯器(Debugger)
– 是一個能讓程式設計人員能夠逐步追蹤程式的執
行過程與檢視暫存器與記憶體內容的公用程式。
教材
基本概念
• 整合發展環境
– 將編輯器、組譯器、連結器、除錯器等整合在一
起的人機介面程式。
– 例:
• Visual Studio .Net 2005
• Visual C++ 2005 Express
教材
基本概念
• 組合語言和機器語言
– 一對一關係。
– 機器語言指令:
• 由0與1組成的特定二進位pattern
• 例:
1011100010111
– 組合語言指令
• 由助憶碼(mnemonic)表示
• 例:
add eax ,Y ;將Y的值存放到EAX暫存器。
教材
基本概念
• 組合語言和高階語言關係
– 高階語言的每個敘述 對應 多個組合語言敘述的
組合。
• 組合語言
– 通常有特定的格式。例:
Label
教材
add
AX, BX
; 將AX和BX暫存器的值相加
發展環境建構
• 組譯程式安裝
– Ref: http://kipirvine.com/asm/gettingStarted/index.htm#Required
– If you are using Visual Studio 2005 Professional or Team Suite, these
products already contain the Microsoft Assembler 8.0.
• Step 1: Install Visual C++ 2005 Express
Edition
• Step 2: Download and Install the Microsoft
Assembler
• Step 3: Installing the Book's Example
Programs
• Step 4: Building a Sample Assembly Language
Program
• Step 5: Running the Sample Program in Debug
Mode
教材
發展環境建構
• 函式庫與範例程式下載
– 進入網站: www.asmirvine.com
– 點入超連結:Link Libraries and Example Programs
– 下載: IrvineExamples.exe (a self-extracting archive file)
• 透過超連結:
– Complete set of example programs and link libraries
• After the file has been saved,
• 函式庫安裝
– 執行 IrvineExamples.exe
• Double-click on the self-extracting archive file to extract its contents.
• The programs are normally installed in the c:\Irvine folder, but you
have the option of changing the location.
教材
發展環境建構
• Installing the Book's Example
Programs
– get the latest copy of the book's link
libraries and example programs.
• The examples are stored in a selfextracting archive file that automatically
extracts to the c:\Irvine folder.
• Unless you have some objection to using
that location, do not alter the path.
– (Lab managers: you can designate c:\Irvine
directory as read-only.)
– If you plan to change the installation location,
read our instructions relating to changing
project properties.
教材
Irvine’s Examples
• The folllowing files will be copied into the c:\Irvine directory:
•
•
•
•
•
•
•
•
•
•
•
Filename
Description
GraphWin.inc Include file for writing Windows applications
Irvine16.inc
Include file used with the Irvine16 link library (16-bit applications)
Irvine16.lib
16-bit link function library used with this book
Irvine32.inc
Include file used with the Irvine32 link library (32-bit applications)
Link16.exe
16-bit linker
Irvine32.lib
32-bit link function library used with this book
Macros.inc
Include file containing macros (explained in Chapter 10)
SmallWin.inc Small-sized include file, used by Irvine32.inc
User32.lib
Link library with Windows functions.
make16.bat
Batch file for building 16-bit applications
VirtualKeys.inc Keyboard code definitions file, used by Irvine32.inc
A subdirectory named Examples will contain all the example programs shown in the
book.
教材