PowerPoint 簡報

Similar documents
幻灯片 1

第 15 章 程 式 編 写 語 言 15.1 程 式 編 写 語 言 的 角 色 程 式 編 寫 語 言 是 程 式 編 寫 員 與 電 腦 溝 通 的 界 面 語 法 是 一 組 規 則 讓 程 式 編 寫 員 將 字 詞 集 合 起 來 電 腦 是 處 理 位 元 和 字 節 的 機 器, 與

untitled

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

CC213

1 CPU

Computer Architecture

,768 32,767 32K JMP Jnnn (386+) LOOP CALL [Label:] JMP short/near/far address L10: jmp jmp L20: L10 L20

投影片 1

Microsoft PowerPoint - Lecture7II.ppt

EK-STM32F

Learning Java

CH01.indd

A Preliminary Implementation of Linux Kernel Virus and Process Hiding

目次 

Microsoft PowerPoint - Ch2-1.ppt

epub83-1

<4D F736F F D20C7B6C8EBCABDCFB5CDB3C9E8BCC6CAA6B0B8C0FDB5BCD1A75FD1F9D5C22E646F63>

Microsoft PowerPoint - chap2.ppt

Process Data flow Data store External entity 6-10 Context diagram Level 0 diagram Level 1 diagram Level 2 diagram

Microsoft Word - 11.doc

Microsoft PowerPoint - CA_03 Chapter5 Part-II_multi _V1.ppt

ICD ICD ICD ICD ICD


投影片 1

<4D F736F F F696E74202D20C8EDBCFEBCDCB9B9CAA6D1D0D0DEBDB2D7F92E707074>

目 录

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

Microsoft Word _2 課本1225_OK_0222修.doc

D/A DAC ( 1us) (10~20 ) DAC0832 1

06721 main() lock pick proc() restart() [2][4] MINIX minix2.0 GDT, IDT irq table[] CPU CPU CPU CPU (IDTR) idt[] CPU _hwint00:! Interrupt

Microsoft PowerPoint - OPVB1基本VB.ppt

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f

sp_overview.pptx

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Oracle Solaris Studio makefile C C++ Fortran IDE Solaris Linux C/C++/Fortran IDE "Project Properties" IDE makefile 1.

Simulator By SunLingxi 2003

大学计算机基础B.doc

OOAD PowerDesigner OOAD Applying PowerDesigner CASE Tool in OOAD PowerDesigner CASE Tool PowerDesigner PowerDesigner CASE To

Microsoft Word - 全華Ch4Ans.doc

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Microsoft PowerPoint - CA_02 Chapter5 Part-I_Single _V2.ppt

( Version 0.4 ) 1

9 什 么 是 竞 争 与 冒 险 现 象? 怎 样 判 断? 如 何 消 除?( 汉 王 笔 试 ) 在 组 合 逻 辑 中, 由 于 门 的 输 入 信 号 通 路 中 经 过 了 不 同 的 延 时, 导 致 到 达 该 门 的 时 间 不 一 致 叫 竞 争 产 生 毛 刺 叫 冒 险 如

Epson

Olav Lundström MicroSCADA Pro Marketing & Sales 2005 ABB - 1-1MRS755673

JAEA-Technology indb

Microsoft PowerPoint - C15_LAB_MTS86_INTRO

PowerPoint 簡報

ebook140-8

Microsoft Word - 選擇_無解答2_.doc

untitled

Serial ATA ( Silicon Image SiI3114)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 5 (4) S A T A... 8 (5) S A T A... 10

Microsoft Word - 正文.doc

Microsoft Word htm


FAQ -PowerDesigner9.5.DOC

DPJJX1.DOC

Value Chain ~ (E-Business RD / Pre-Sales / Consultant) APS, Advanc

AL-M200 Series

「人名權威檔」資料庫欄位建置表

(2) Function 0BH: Function 0CH: (pixel, picture element) Function 0DH: Function 0FH: Function 13H:

untitled

摘 要 在 這 忙 碌 的 社 會 中, 普 遍 人 們 運 動 時 間 其 實 並 不 充 裕, 體 力 越 來 越 差 的 情 況 下 還 隨 意 飲 食 導 致 身 體 健 康 越 來 越 差, 因 此 本 專 題 打 算 利 用 健 康 飲 食 的 方 式 改 善 這 些 人 的 體 質,

S 可编程控制器

Microsoft PowerPoint - chap1 [相容模式]

ebook140-9

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

Microsoft Word - instruction-cycle.docx

C++ 程式設計

IP TCP/IP PC OS µclinux MPEG4 Blackfin DSP MPEG4 IP UDP Winsock I/O DirectShow Filter DirectShow MPEG4 µclinux TCP/IP IP COM, DirectShow I

Microsoft PowerPoint - os_4.ppt

计算机与信息工程系最终.FIT)

微處理機期末專題

PROFIBUS3.doc

Oracle Oracle Solaris Studio IDE makefile C C++ Fortran makefile IDE Solaris Linux C/C++/Fortran Oracle IDE "P


untitled

Fuzzy Highlight.ppt

Guide to Install SATA Hard Disks

Ch03_嵌入式作業系統建置_01

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM

instructions.PDF

untitled

AL-MX200 Series

Transcription:

System Programming Jian-hua Yeh ( 葉建華 ) 真理大學資訊科學系助理教授 au4290@email.au.edu.tw

Textbookextbook System Software: An Introduction to Systems Programming (3rd Edition) By Leland L. Beck 台北圖書公司 2

CHAPTER 1 INTRODUCTION 1.1 Computer System Programming The programs implemented in either software and (or) firmware that makes the computer hardware usable. 系統程式就是驅動電腦硬體工作之軟體及軔體程式 燒錄在硬體 ( 例如 ROM EPROM ) 之軟體為軔體 ; 基本輸出 / 輸入系統 (Basic Input Output Systems), 它就是一種軔體 3

系統程式所包含的範圍 SP People Application Program Utility Program (Library) Debugging Aids Macro Processor Text Editor Compiler Assembler Loader and Linker Memory Processor Device Information Management and Process Management Management Management OS Bare Machine (Computer) 4

何謂系統程式 1. Utility Program and Library( 公用程式及庫存函數 ) a. System Command b. Library e.g. OCX,DLL 2. Debugging Aids( 除錯工具 ) a. Program Trace (Assign Breakpoint) * 印出各個變數或暫存器 (Register) 的內容 b. Debug Command, Norton Utility,PC Tools, * 在 DOS 環境下, 可以使用 Debug 這個命令 c. Core Dump dbx or gdb(gnu Tool) d. Diagnostic 在程式內加上 print 敘述, 是一種土法鍊鋼的方式 5

何謂系統程式 3. Macro Processor( 巨集處理器 ) #define PI 3.14159 #define add(a,b) (a+b) : : k=add(i,j)*pi; k=(i+j)*3.14159; l=add(k,i)*pi; l=(k+i)*3.14159; * Macro Definition * Macro Call (Macro Expansion) ( 巨集呼叫 巨集的展開 ) 6

何謂系統程式 * Macro Definition * Macro Call (Macro Expansion) The macro processor replaces each macro instruction with the corresponding group of source Language Statements 巨集處理器會將巨集所定義的原始程式敘述取代巨集呼叫 * Function Call (Closed Subroutine) ( 函數呼叫 ) Calling Program transfers of data and control to called program 當函數被呼叫時, 參數會傳至函數內, 而且執行的控制權也會轉至函數內, 一直到函數 Return 為止 * Macro Call (Open Subroutine) ( 巨集呼叫 ) This means its code is inserted into the program 7

何謂系統程式 Run fast macro call use more memory space Less memory space function call spend more CPU time (STACK) * 通常我們講求執行速度的時候 ( 希望執行速度快 ), 會考慮使用巨集, 這是以空間換取時間 * 反之函數佔主記憶體空間較少, 但是使用到疊堆 (STACK), 速度相對會慢一些 時間換取空間 8

何謂系統程式 4. Text Editor( 文字編譯器 ) a. Screen editor MS-Word b. Typesetting( 排版 ) 9

何謂系統程式 1.2 Translator( 轉譯器 ) The language translator translates source program to their machine language equivalents. 將原始程式翻譯成機器語言, 必須靠轉譯器來執行 轉譯器大概可以被區分為編譯器 (Compiler) 組譯器 (Assembler) 解譯器 (Interpreter) 10

何謂系統程式 1. Compiler( 編譯器 ) C,C++,COBOL, language High level language Object program Source Compiler Machine Linker Executable Loader Run Program Code Module 高階語言目的程式連結器可執行的模組載入器原始程式機器碼 11

何謂系統程式 2. Assembler( 組譯器 ) Assembly language Object program Source Assembler Machine Linker Executable Loader Run Program Code Module 組合語言 12

何謂系統程式 3. Interpreter ( 解譯器 ) BASIC, HTML, Java Script, VB Script, language a. 將原始程式直接透過解譯器執行 b. 解譯器將原始程式的一個敘述翻成中間碼 c. 將中間碼送入解譯器相對功能之程式中, 以便執行 中間碼 d. 重複執行步驟 b 及步驟 c Intermediate BASIC language Code Source Interpreter Program Run 13

何謂系統程式 3. Interpreter ( 解譯器 ) Java 好處 * Byte Code 是一種與機器無關 (Machine Independent) 的語言 * 可以跨平台在不同種類的電腦內執行 Source Java Byte Program Interpreter Code Byte Java Code Run Module Run 14

何謂系統程式 1.3 Loader and Linker( 載入器及連結器 ) 1. Linker Combines two or more separate object programs and supplies the information needed to allow reference between them 15

何謂系統程式 Linker Executable Module main 1000 main : : call sub1 call sub1 : : sub1 107A sub1 : Linker : call sub2 call sub2 : : sub2 1120 sub2 程式呼叫函數連結的圖解 16

何謂系統程式 2. Loader a. Allocation Assign Memory Location b. Linking Link external reference c. Relocation Modify the object program so that it can be loaded at different address d. Loading Load object program into main memory 17

何謂系統程式 載入器可以有二種解釋 * 狹義的是指將執行模組載入主記憶體內, 然後執行 * 廣義的意思則包含四大功能 1. 分派 (Allocation) 指定執行模組所要擺放的記憶體位置 2. 連結 (Linking) 連結函數外部的變數 意思是說某個函數使用的 ( 或參考到的 ) 變數不在此函數內, 而是被定義在別的函數內, 我們透過連結器將它們連結在一起 18

何謂系統程式 載入器 3. 重定位 (Relocation) 修訂執行模組, 使得它可以載入記憶體內不同位置 意思是說執行模組執行時, 或許在主記憶體 1000 這個位置, 下次執行時或許在 3020 這個位置, 它是可以隨時定位的 4. 載入 (Loading) 將執行模組載入主記憶體內, 然後執行 19

何謂作業系統 1.4 Operating System( 作業系統 ) 只有硬體而沒有加上軟體及軔體的電腦為裸機 (Bare Machine) 作業系統四大管理 1. Memory Management( 記憶體管理 ) 管理主記憶體, 並決定那一支程式可以佔有主記憶體, 那一支程式不能使用主記憶體, 2. Processor / Process Management( 處理器 / 處理元管理 ) 中央處理器之使用 3. Device Management( 設備管理 ) 管理輸出輸入週邊設備之運作, 尤其必須有設備驅動程式 (Device Driver) 來驅動設備工作 4. Information Management( 資訊管理 ) 20 管理磁碟 磁片 光碟內之檔案結構及其內容

系統軟體與機器結構 1.5 Relationship between system software and machine architecture Machine Independent Machine Dependent Machine 系統軟體與機器結構之關係 * Machine dependent( 與機器相關 ) Instruction Set,Instruction Format,Addressing Mode, Assembly language * Machine independent( 與機器無關 ) General design logic/strategy, two passes assembler 21

SIC 機器結構 1.6 SIC Machine Structure Simplified Instructional Computer SIC and SIC/XE 1.Registers A Accumulator X Index Register L Linkage Register B Base Register S General Working Register T General Working Register F Floating Point Accumulator PC Program Counter SW Status Word 22

SIC 機器結構 2.Instruction Set 23

SIC Instruction Set 24

SIC Instruction Set 25

SIC Instruction Set 26

SIC Instruction Set 27

SIC Instruction Set 28

SIC 機器結構 3.Instruction Format 一個指令週期又可分為 * 找尋週期 (Fetch Cycle) * 執行週期 (Execute Cycle) Fetch Instruction Decoder Fetch Operand Computation Store Result Fetch Cycle Execute Cycle A. 找尋週期 指令週期 依照程式計數器 (Program Counter) 之內容, 至主記憶體內找出指令 (Fetch Instruction) 29

SIC 機器結構 B. 執行週期將找出之指令解碼並執行, 它又分為下列週期 : a. 解碼週期 (Decoder Cycle) 解析指令要作什麼工作 b. 找尋運算子週期 (Fetch Operand Cycle) 至主記憶體內找到運算子之內容 c. 計算 ( 執行 ) 週期 (Computation (Execute) Cycle) 依指令需求作計算或執行工作 d. 儲存結果週期 (Store Result Cycle) 將執行結果存入主記憶體內 30

SIC 機器結構 我們以 ADD DATA 為例 : 步驟一 : 依程式計數器找到 ADD DATA 這個指令, 它為找尋週期 步驟二 : 解析 ADD DATA 欲作何事, 它為解碼週期 步驟三 : 到 DATA 之位置找到 DATA 之值, 它為找尋運算子週期 步驟四 : 將 DATA 之值與 A 暫存器內之值相加, 它為計算 ( 執行 ) 週期 步驟五 : 將相加之結果擺入 A 暫存器內, 它為儲存結果週期 31

SIC 機器結構 4. Addressing ( 定址 ) a. 立即定址法 (Immediate Addressing) LDA #40 在指令中直接將值放入 ( 此例為 40), 且 40 也會在機器碼出現 b. 直接定址法或簡易定址法 (Direct Addressing 或 Simple Addressing) LDA DATA 假如 DATA 之地址為 1500, 則它的機器碼為 001500 組譯器必須先找到 DATA 的地址, 然後將此地址放入機器碼內, 表 示地址為 1500 32

SIC 機器結構 c. 間接定址法 (Indirect Addressing) J @RETADR RETADR 之地址為 1500,1500 內之 3800 才是我們真正要的值, 所以此例是跳至地址 3800 在變數內放的是地址, 再由此地址找到值的定址方式 地址值 RETADR 1500 3800 3800 間接定址法之圖解 33

SIC 機器結構 d. 索引 ( 或相對 ) 定址法 (Indexed 或 Relative Addressing) LDCH DATA,X DATA 之地址為 1500 DATA 對應之地址必須再加上 X 當作位移 (Offset), 才是真正的地址 索引定址常常可以被拿來當作至陣列內存取元素使用 地址值 X 2 1500 25 DATA 陣列 33 66 1500+2 索引定址法之圖解 34

SIC 機器結構 5. Instruction Type a. Standard Type 8 1 15 Opcode x address X=0 direct addressing 1 using X as index register 35

SIC 機器結構 b. Format 1 8 Opcode c. Format 2 8 4 4 Opcode r1 r2 r1,r2 : Register number 36

SIC 機器結構 d. Format 3 6 1 1 1 1 1 1 12 Opcode n i x b p e disp e. Format 4 6 1 1 1 1 1 1 20 Opcode n i x b p e address 37

SIC 機器結構 6 1 1 1 1 1 1 12 Opcode n i x b p e disp e: 0 format 3, 1 format 4 b: 使用 base register p: 使用 program counter x: 使用 index register i: 使用 immediate mode # LDA #5 n: 使用 indirect mode @ J @RETADR disp: relative addressing address: direct (simple) addressing 38

SIC 機器結構 6 1 1 1 1 1 1 12 Opcode n i x b p e disp i n description 1 0 immediate addressing 0 1 indirect addressing 0 0 simple (direct) addressing standard type 1 1 simple (direct) addressing XE type b p target address 1 0 TA=(B)+disp 目的地址為 base register 的內容加上 disp 0 1 TA=(PC)+disp 0 0 TA=disp format 3 TA=address format 4 39

SIC 機器結構 6.Indexing Addressing a.indexed 索引使用 x register 進行 array access 地址值 X 2 1500 25 DATA 陣列 33 66 1500+2 40

SIC 機器結構 b. Relative (Relocation) 相對使用 base register or program counter 進行程式位置之定址 地址 B or PC 1500 1500 LDA #5 STA AA LDA #8 地址 B or PC 0 LDA #5 0 STA AA LDA #8 41

SIC 機器結構 Examples (B) = 006000 (PC) = 003000 (X) = 000090 disp or n i x b p e address target address value 3030 003600 1 1 0 0 1 0 600 3000+600= 3600 103000 1 1 1 1 0 0 300 90+6000+300=6390 00C303 3600 103000 1 0 0 0 1 0 30 3000+30=3030 103000 0 1 0 0 0 0 30 30 000030 0 0 0 0 1 1 600 3000+600=3600 103000 6390 00C303 1 1 0 0 0 1 C303 C303 003030 C303 003030 42

SIC 機器結構 7.SIC Programming Examples * Executable instruction * Pseudo instruction : Specify an operation (directive) to the assembler. 要求組譯器作某些事本身不翻成機器碼 43

SIC 機器結構 RESERVE WORD LDA FIVE STA ALPHA LDCH CHARZ STCH C1 : : ALPHA RESW 1 FIVE WORD 5 CHARZ BYTE C'Z' C1 RESB 1 SIC PROGRAM ALPHA LDA #5 STA LDCH #90 STCH C1 : : ALPHA RESW 1 C1 RESB 1 SIC/XE PROGRAM 44

SIC 機器結構 LDX ZERO NOVECH LDCH STR1,X STCH STR2,X TIX ELEVEN JLT MOVECH : STR1 BYTE C'TEST STRING' STR2 RESB 11 : ZERO WORD 0 ELEVEN WORD 11 add 1 to index register and compare result LDT #11 LDX #0 NOVECH LDCH STR1,X STCH STR2,X TIXR T JLT MOVECH : STR1 BYTE C'TEST STRING' STR2 RESB 11 SIC PROGRAM SIC /XE PROGRAM 45

80XX 機器結構 1.7 80XX Assembly Language 1. Register 2. Instruction set 3. Instruction cycle e.g. ADD AX,DATA 03060015 address 1500 a. Fetch cycle Program Counter indicates the ADD AX,DATA instruction location 46

80XX 機器結構 e.g. ADD AX,DATA 03060015 address 1500 b. Execute cycle 1. Decoder Cycle Decodes ADD AX,DATA instruction 2. Fetch Operand Cycle To fetch DATA operand from main memory 3. Computation (Execute) Cycle Adds the content of DATA to AX 4. Store Result Cycle Store result to AX (or main memory) 47

80XX 機器結構 4.Addressing a. Immediate Addressing MOV AL,40H machine code B040 value b. Direct Addressing(Simple Addressing) MOV AX,DATA address of DATA is 1500 machine code A10015 address 1500 MOV AX,[1500] 48

80XX 機器結構 c. Indirect Addressing ADD AX,[SI] machine code 0304 C 語言中指標之使用可以視為間接定址 address value SI 1500 1500 3800 49

80XX 機器結構 d. Indexed Addressing (Relative Addressing) MOV AX,DATA[SI] machine code 8B840015 address of DATA is 1500 Address value SI 2 1500 25 DATA array 33 66 1500+2 50

80XX 機器結構 * Indexed Addressing SI, DI register array access * Relative Addressing CS, DS register (base register) program starting address 51

80XX 機器結構 5.Machine code format 它可能為二個位元組, 亦可能為三個或四個位元組, 完全取決於組合語言的內容而定 Register/Memory to/from register opcode d w mod reg r/m (DISP-LO) (DISP-HI) a.opcode 是各個指令的運算碼 b.d 為方向指示 d=0 表示運算方向由運算元 1 至運算元 2, d=1 方向相反 ADD CX, AX 運算元 1, 運算元 2 52

80XX 機器結構 指令 機器碼 指令長度 CALL E8 3 CLI FA 1 JG 74 2 MOV 00 0 MUL 00 0 RET C3 1 註 : 機器碼及指令長度為 0 者, 表示有不只一種格式, 請參看附錄 部份指令對應之運算碼 53

80XX 機器結構 Register/Memory to/from register opcode d w mod reg r/m (DISP-LO) (DISP-HI) c. w 為字組指示 w=1 表示運算之暫存器為字 (Word), w=0 表位元組 (Byte) d. reg 表示使用之暫存器編號 例如 000 代表 A 暫存器, 若 w=0 則視為 AL, 若 w=1 則視為 AX e. mod 為定址指示欄 通常 mod 與 r /m 必須配合使用, 當 mod 等於 00 表示無第三 四位元組提供位置 01 表示有第三位元組提供位置 10 表示有第三 四位元組提供位置 11 參考圖 2.11 54

80XX 機器結構 reg for general register REG W=0 W=1 000 AL AX 001 CL CX 010 DL DX 011 BL BX 100 AH SP 101 CH BP 110 DH SI 111 BH DI reg for segment register REG NAME 00 ES 01 CS 10 SS 11 DS 55

80XX 機器結構 若 r/m 為 000,mod 為 01, 則定址方式為 (BX)+(SI)+D8, 其中 D8 就是放在第三位元組之地址 ( 位移 ) 同理 D16 就是使用第三及第四位元組當地址 mod and r/m MOD=11 Effective Address Calculation R/M W=0 W=1 R/M MOD=00 MOD=01 MOD=10 000 001 010 011 100 101 110 111 AL CL DL BL AH CH DH BH AX CX DX BX SP BP SI DI 000 001 010 011 100 101 110 111 (BX)+(SI) (BX)+(DI) (BP)+(SI) (BP)+(DI) (SI) (DI) Direct Address (BX) (BX)+(SI)+D8 (BX)+(DI)+D8 (BP)+(SI)+D8 (BP)+(DI)+D8 (SI)+D8 (DI)+D8 (BP)+D8 (BX)+D8 (BX)+(SI)+D16 (BX)+(DI)+D16 (BP)+(SI)+D16 (BP)+(DI)+D16 (SI)+D16 (DI)+D16 (BP)+D16 (BX)+D16 56

80XX 機器結構 Examples a. ADD CX,AX 000000 1 1 11 001 000 opcode d w mod reg r/m * 將暫存器 AX 內之值加入暫存器 CX 內 * 暫存器至暫存器之運算 * 方向相反,d=1 * r/m=000 表暫存器 AX,reg=001 表暫存器 CX 57

80XX 機器結構 ADD Register/Memory with register 000000 d w mod reg r/m (DISP-LO) (DISP-HI) Immediate to register/memory 100000 s w mod 000 r/m (DATA-LO) (DATA-HI) Immediate to accumulator 0000010 w (DATA-LO) (DATA-HI) 58

80XX 機器結構 MOV Register/Memory to/from register 100010 d w mod reg r/m (DISP-LO) (DISP-HI) Immediate to register/memory 1100011 w mod 000 r/m (DATA-LO) (DATA-HI) Immediate to register 1011 w reg (DISP-LO) (DISP-HI) 59

80XX 機器結構 MOV Memory to accumulator 1010000 w (DISP-LO) (DISP-HI) Accumulator to memory 1010001 w (DISP-LO) (DISP-HI) Register/Memory to segment register 10001110 mod 0 reg r/m (DISP-LO) (DISP-HI) 60

80XX 機器結構 Examples b.mov CX,W 100010 1 1 00 001 110 0000 1001 0000 0101 opcode d w mod reg r/m 0 9 0 5 * 將記憶體 W 內之值搬入暫存器 CX 內 * 搬動方向相反,d=1 * reg=001 表暫存器 CX * r/m=110 且 mod=00 表機器碼內直接擺 W 之地址 0509 61

80XX 機器結構 立即值至累積暫存器 第二 三位元組擺入立即值 w=0 只使用第二位元組,w=1 使用二 三位元組 Immediate to accumulator opcode w VALUE-LO VALUE-HI ADD SUB AND OR XOR 0000010w 0010110w 0010010w 0000110w 0011010w 62