【文章內(nèi)容簡介】
n PROC mov eax,10000h 。 EAX = 10000h add eax,40000h 。 EAX = 50000h sub eax,20200h 。 EAX = 30000h call DumpRegs INVOKE ExitProcess,0 main ENDP END main Program template TITLE Program Template () 。 Program Description: 。 Author: 。 Creation Date: 。 Revisions: 。 Date: Modified by: INCLUDE .data 。 (insert variables here) .code main PROC 。 (insert executable instructions here) exit main ENDP 。 (insert additional procedures here) END main Assemblelink execute cycle ? The following diagram describes the steps from creating a source program through executing the piled program. ? If the source code is modified, Steps 2 through 4 must be repeated. S ou r c eF i l eO bj ec tF i l eLi s ti ngF i l eLi nkLi brar yE x ec uta bl eF i l eMapF i l eO utp utS t e p 1 : t e x t e d it o rS t e p 2 :a s s e mblerS t e p 3 :li n k e rS t e p 4 :OS loa d e r ? Called a batch file ? Run it to assemble and link programs ? Contains a mand that executes (the Microsoft Assembler) ? Contains a mand that executes (the 32bit Microsoft Linker) ? CommandLine syntax: make32 progName (progName includes the .asm extension) (use to assemble and link Realmode programs) Listing file ? Use it to see how your program is piled ? Contains – source code – addresses – object code (machine language) – segment names – symbols (variables, procedures, and constants) ? Example: Defining data ? Intrinsic data types ? Data Definition Statement ? Defining BYTE and SBYTE Data ? Defining WORD and SWORD Data ? Defining DWORD and SDWORD Data ? Defining QWORD Data ? Defining TBYTE Data ? Defining Real Number Data ? Little Endian Order ? Adding Variables to the AddSub Program ? Declaring Uninitialized Data Intrinsic data types (1 of 2) ? BYTE, SBYTE – 8bit unsigned integer。 8bit signed integer ? WORD, SWORD – 16bit unsigned amp。 signed integer ? DWORD, SDWORD – 32bit unsigned amp。 signed integer ? QWORD – 64bit integer ? TBYTE – 80bit integer Intrinsic data types (2 of 2) ? REAL4 – 4byte IEEE short real ? REAL8 – 8byte IEEE long real ? REAL10 – 10byte IEEE extended real Data definition statement ? A data definition statement sets aside storage in memory for a variable. ? May optionally assign a name (label) to the data ? Syntax: [name] directive initializer [,initializer] . . . At least one initializer is required, can be ? ? All initializers bee binary data in memory Defining BYTE and SBYTE Data value1 BYTE 39。A39。 。 character constant value2 BYTE 0 。 smallest unsigned byte value3 BYTE 255 。 largest unsigned byte value4 SBYTE 128 。 smallest signed byte value5 SBYTE +127 。 largest signed byte value6 BYTE ? 。 uninitialized byte E