Equal-Sign Directive C: #define MAX_SIZE 20 組語 (1): MAX_SIZE = 20 組語 (2): MAX_SIZE EQU <20> ; Cannot be redefined list BYTE 10,20,30,40 ListSize = ($

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

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_06

Microsoft PowerPoint - C15_LECTURE_NOTE_06

untitled


幻灯片 1

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

<4D F736F F D20C7B6C8EBCABDCFB5CDB3C9E8BCC6CAA6B0B8C0FDB5BCD1A75FD1F9D5C22E646F63>

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

学习MSP430单片机推荐参考书

ROP_bamboofox.key

Microsoft PowerPoint - os_4.ppt

CC213

C/C++语言 - C/C++数据

Microsoft PowerPoint - chap5.ppt

Bus Hound 5

微型计算机原理及应用试题 机电96

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

Linux kernel exploit研究和探索

untitled

untitled

1 CPU

Microsoft PowerPoint - chapter5.ppt

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

3.1 num = 3 ch = 'C' 2

SuperMap 系列产品介绍

科学计算的语言-FORTRAN95

PIC16F F MPLAB 08 16F LED 15 LED

ebook121-20

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING

Microsoft Word - 11.doc

四川省普通高等学校

C++ 程式設計

Microsoft PowerPoint - chap4.ppt

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

TCP/IP TCP/IP OSI IP TCP IP IP TCP/IP TCP/IP

untitled

資料轉移、定址、算術 Data Transfer, Addressing, and Arithmetic

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2

第5章:汇编语言程序设计

2.5 idlocs PIC idloc idloc 0x1234 ; 0x config idloc HEX errorlevel errorlevel Error (Warning) Message HEX 3-14 errorlevel

C语言的应用.PDF

DR2010.doc

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C Project 30 C Project 3 60 Project 40

TC35短信发送程序设计

組譯與連結(Ver6

epub83-1

微處理機期末專題

目 录

Chapter 9: Objects and Classes

数据库系统概论

( Version 0.4 ) 1

今天刚发现的, 比较简单, 于是就来简单分析下吧 该感染样本很简单, 新加了个区段放病毒执行代码, 执行病毒代码, 最后跳回原入口点来执行原文件 下面就是感染后的代码的简单分析 : ; =============== S U B R O U T I N E =====================

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

DPJJX1.DOC

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

投影片 1

AVR单片机指令系统.PDF

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha

EC51/52 GSM /GPRS MODEN

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

Microsoft PowerPoint - Lecture7II.ppt

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit

漏 洞 攻 防 EXPLOIT ATTACK & DEFENCE 栏 目 编 辑 脚 本 小 子 scriptsboy@hacker.com.cn HEAD 部 分 大 小 当 然 也 就 是 固 定 的 18200H 如 果 要 提 取 出 HEAD, 我 们 可 以 选 中 前 18200H 字

Microsoft PowerPoint - string_kruse [兼容模式]

教科書:系統程式 - 第 2 章、電腦的硬體結構

<4D F736F F F696E74202D20B5DAD2BBD5C228B4F2D3A1B0E6292E BBCE6C8DDC4A3CABD5D>


instructions.PDF

1 CPU interrupt INT trap CPU exception

Oracle 4

2/80 2

1 TPIS TPIS 2 2

A Preliminary Implementation of Linux Kernel Virus and Process Hiding

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;

untitled

12232A LED LED LED EL EL CCFL EL CCF

TABLE OF CONTENTS.MACRO COMMAND...1.MACRO DESIGN...3.ALARM LIST...4.MACRO 1. HOLE PATTERN 1-1.LINE AT ANGLE GRID SQUARE BOLT

coverage2.ppt

Outline USB Application Requirements Variable Definition Communications Code for VB Code for Keil C Practice

行业

Chemcad.doc

WinMDI 28

Microsoft PowerPoint - CA_02 Chapter5 Part-I_Single _V2.ppt

ARK-14013/14017/14018

ICD ICD ICD ICD ICD

行业

Tel:

untitled

1.1 ML_ONOFF = 1 Q 3 Q 8 C 0.3V M 2 L 1 ML_ONOFF = 0 Q 3 Q 8 C 1. + R31 VCC R21 10K ML_ONOFF R15 0:off 1:on 1K Green Light VCC=5V L1 Q VDD=12V C

Ps22Pdf

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

錄...1 說...2 說 說...5 六 率 POST PAY PREPAY DEPOSIT 更

行业

Transcription:

組語合法小抄 ASCII General-Purpose EAX accumulator EBX 好像很自由 ECX loop counter ESP stack pointer ESI, EDI index registers EBP extended frame pointer (stack) ( EIP instruction pointer (PUSH 會使 ESP 減小,POP 反之 ) Program Template INCLUDE Irvine32.inc main PROC exit main ENDP END main Status Flags: Carry:unsigned arithmetic out of range Overflow:signed arithmetic out of range Sign:result is negative Zero:result is zero Auxiliary Carry:carry from bit 3 to bit 4 Parity:sum of 1 bits is an even number BYTE, SBYTE 8b WORD, SWORD 16b DWORD, SDWORD 32b QWORD64b TBYTE 80b 0Dh = carriage return 0Ah = line feed DUP C:char arrary1[100] 組語 :array1 BYTE 100 DUP(?)

Equal-Sign Directive C: #define MAX_SIZE 20 組語 (1): MAX_SIZE = 20 組語 (2): MAX_SIZE EQU <20> ; Cannot be redefined list BYTE 10,20,30,40 ListSize = ($ - list) list WORD 1000h,2000h,3000h,4000h ListSize = ($ - list) / 2 8086 指令集數學運算 : ADC: 連同進位的加法 ADD: 加法 SUB: 減法 DEC, INC: 減一, 增一 NEG: 二補數 DIV, IDIV: 除法 (Unsigned), 整數 ( 二補數 ) 除法 MUL, IMUL: 乘法, 整數乘法 SBB: 連同借位的減法 XADD: 交換, 相加 資料移動 : LDS, LES, LSS: 載入 DS, ES, SS 暫存器 LEA: 載入有效地址 ( 將所指資料的地址放到暫存器 ) LODSn: 載入字串 (SI 所指位置內容放到暫存器 A, 增減 SI) MOV: 移動資料 MOVSn: 移動字串 ([SI] [DI}, 增減 SI, DI) MOVSX: 移動資料 ( 到較大位置 ), 延伸正負號 MOVZX: 移動資料 ( 到較大位置 ), 延伸 0 STOSn: 貯存字串 ( 暫存器 A 內容放到 DI 所指位置, 增減 DI) XCHG: 交換資料 XLAT: 翻譯 ( 以 BX 為基底, AL 為索引, 取資料放到 AL) 比較 : BSF/BSR: 位元掃描 BT/BTC/BTR/BTS: 位元測試 CMP: 比較 ( 相減, 但不存結果, 只改變旗標 ) CMPSn: 比較字串 CMPXCHG: 比較和交換 CMPXCHG8B: 比較和交換 TEST: 測試位元 (AND, 但不存結果, 只改變旗標 ) 位元移動 : RCL, RCR: 經進位旗標向左旋轉, 向右旋轉 ROL, ROR: 向左旋轉, 向右旋轉 SAL, SAR: 算術性向左移位, 向右移位 SHL, SHR: 邏輯性向左移位, 向右移位 SHLD, SHRD: 雙字組向左移位, 向右移位

旗標操作 : CLC, CLD, CLI: 清除進位 方向 插斷旗標 CMC: 將進位旗標反相 ( 補數 ) POPF: 由堆疊彈出旗標 SAHF: 將 AH 存到旗標 LAHF: 將旗標載入 AH PUSHF: 將旗標堆入堆疊 STC, STD, STI: 設定進位 方向 插斷旗標 I/O: IN: 輸入 INSn: 輸入字串 OUT: 輸出 OUTSn: 輸出字串 邏輯運算 : AND OR NOT XOR 迴圈 : LOOP: CX 減一 ; 若 CX 不是 0, 跳到指定位置 LOOPE, LOOPZ: CX 減一 ; 若 CX 不是 0, 且 ZF=1, 跳到指定位置 LOOPNE, LOOPNZ: CX 減一 ; 若 CX 不是 0, 且 ZF=0, 跳到指定位置 LOOPNEW, LOOPNZW: 程式移轉 ( 無條件 ): CALL: 呼叫副程式 INT: 插斷 IRET: 插斷回轉 RET: 回轉 JMP: 跳越 RETN/RETF: 回轉 ( 近距 )/( 遠距 ) 程式移轉 ( 有條件 ): INTO: Interrupt on overflow JA/JNBE: Jump if above (not below or equal) JAE/JNB: Jump if above or equal JB/JNAE: Jump if below JBE/JNA: Jump if below or equal JC: Jump if CF=1 ( 有進位 ) JCXZ: Jump if CX=0 JE/JZ: Jump if ZF=1 (zero, equal) JG/JNLE: Jump if greater than (not less than or equal) JGE/JNL: Jump if greater than or equal JL/JNGE: Jump if less than JLE/JNG: Jump if less than or equal JNC: Jump if CF=0 JNE/JNZ: Jump if ZF=0 JNO: Jump if OF=0 (no overflow) JNP/JPE: Jump if PF=0 (parity even) JNS: Jump if SF=0 ( 正數 ) JO: Jump if OF=1 (Overflow) JP/JPO: Jump if PF=1 (Parity Odd) JS: Jump if SF=1 ( 負數 )

STACK: POP, PUSH: 彈出, 堆入 POPF, PUSHF: 彈出, 堆入旗標 POPA, PUSHA: 彈出, 堆入所有一般用途暫存器字串 : CMPSn: 比較字串 LODSn: 載入字串 MOVSn: 移動字串 SCASn: 掃描字串 STOSn: 貯存字串 REP: 重覆 ( 前置指令, 必須配合字串指令 ) REPE, REPZ: 若相等 (ZF=1), 則重覆 REPNE, PRENZ: 若不相等 (ZF=0), 則重覆 資料型式轉換 CBW: Byte word CWD: Word Dword CDQ: Word Qword CWDE: Word extended doubleword NOP: 無動作 ( EIP++ ) OFFSET : returns the distance in bytes, of a label from the beginning of its enclosing segment bval BYTE? wval WORD? dval DWORD? dval2 DWORD? mov esi,offset bval mov esi,offset wval mov esi,offset dval ; ESI = 00404000 ; ESI = 00404001 ; ESI = 00404003 mov esi,offset dval2 ; ESI = 00404007 PTR:Overrides the default type of a label (variable). Provides the flexibility to access part of a variable. mydouble DWORD 12345678h mov ax,mydouble ; error why? mov ax,word PTR mydouble ; loads 5678h mov WORD PTR mydouble,4321h ; saves 4321h TYPE var1 BYTE? var2 WORD? mov eax,type var1 ; 1 mov eax,type var2 ; 2 LENGTHOF byte1 BYTE 10,20,30 ; 3 array1 WORD 30 DUP(?),0,0 ; 32 array2 WORD 5 DUP(3 DUP(?)) ; 15 SIZEOF byte1 BYTE 10,20,30 ; 3 array1 WORD 30 DUP(?),0,0 ; 64 array2 WORD 5 DUP(3 DUP(?)) ; 30 array3 DWORD 1,2,3,4 ; 16

Indirect Operands esi = 0000 0000 esi = OFFSET a; a= G esi = 0000 00AF [esi] = G mycount WORD 0 mov esi,offset mycount inc [esi] ; error: ambiguous inc WORD PTR [esi] ; ok Indexed Operands arrayw WORD 1000h,2000h,3000h mov esi,0 mov ax,[arrayw + esi] mov ax,arrayw[esi] add esi,2 add ax,[arrayw + esi] ; AX = 1000h ; alternate format Index Scaling arrayb BYTE 0,1,2,3,4,5 arrayw WORD 0,1,2,3,4,5 arrayd DWORD 0,1,2,3,4,5 mov esi,4 mov al,arrayb[esi*type arrayb] ; 04 mov bx,arrayw[esi*type arrayw] ; 0004 mov edx,arrayd[esi*type arrayd] ; 00000004 Pointers arrayw WORD 1000h,2000h,3000h ptrw DWORD arrayw mov esi,ptrw mov ax,[esi] ; AX = 1000h # Alternate format : ptrw DWORD OFFSET arrayw Library Procedures Overview Clrscr - Clears console, locates cursor at upper left corner CreateOutputFile - Creates new disk file for writing in output mode Crlf - Writes end of line sequence to standard output Delay - Pauses program execution for n millisecond interval DumpMem - Writes block of memory to standard output in hex DumpRegs Displays general-purpose registers and flags (hex) GetDateTime Gets the current date and time from the system GetTextColor - Returns active foreground and background text colors in the console window Gotoxy - Locates cursor at row and column on the console IsDigit - Sets Zero flag if AL contains ASCII code for decimal digit (0 9) MsgBox, MsgBoxAsk Display popup message boxes ParseDecimal32 Converts unsigned integer string to binary ParseInteger32 - Converts signed integer string to binary

Random32 - Generates 32-bit pseudorandom integer in the range 0 to FFFFFFFFh Randomize - Seeds the random number generator RandomRange - Generates a pseudorandom integer within a specified range ReadChar - Reads a single character from standard input ReadDec - Reads 32-bit unsigned decimal integer from keyboard ReadHex - Reads 32-bit hexadecimal integer from keyboard ReadInt - Reads 32-bit signed decimal integer from keyboard ReadKey Reads character from keyboard input buffer ReadString - Reads string from standard input, terminated by [Enter] SetTextColor - Sets foreground and background colors of all subsequent console text output Str_compare Compares two strings Str_copy Copies a source string to a destination string StrLength Returns length of a string Str_trim - Removes unwanted characters from a string. Str_ucase - Converts a string to uppercase letters. WaitMsg - Displays message, waits for Enter key to be pressed WriteBin - Writes unsigned 32-bit integer in ASCII binary format. WriteBinB Writes binary integer in byte, word, or doubleword format WriteChar - Writes a single character to standard output WriteDec - Writes unsigned 32-bit integer in decimal format WriteHex - Writes an unsigned 32-bit integer in hexadecimal format WriteHexB Writes byte, word, or doubleword in hexadecimal format WriteInt - Writes signed 32-bit integer in decimal format WriteStackFrame - Writes the current procedure s stack frame to the console. WriteStackFrameName - Writes the current procedure s name and stack frame to the console. WriteString - Writes null-terminated string to console window(edx) WriteWindowsMsg - Displays most recent error message generated by MS-Windows ReadString filename BYTE 80 DUP(0) mov edx,offset filename mov ecx,sizeof filename 1 call ReadString Write & Read(char.int.dec.hex.bin):EAX Textcolor: 字 + 底 *1 換行 :call clrf 比大小 :CMP eax, a JA(JB, ) 檢查 0. +.- :AND / test JS, JNS, JZ.. WriteString mov call edx,offset str1 WriteString