digitStr BYTE \ ; 9
6.LABELαָÁî
?Assigns an alternate label name and type to an existing storage location
?LABEL does not allocate any storage of its own ?Removes the need for the PTR operator
ÓÃÀý£º .data
dwList LABEL DWORD wordList LABEL WORD
intList BYTE 00h,10h,00h,20h .code
mov eax,dwList ; 20001000h mov cx,wordList ; 1000h mov dl,intList ; 00h
1. ¼ä½ÓѰַ
0 ¼ä½Ó²Ù×÷Êý
£¨1£©An indirect operand holds the address of a variable, usually an array or string. It can be dereferenced (just like a pointer).
£¨2£©Use PTR to clarify the size attribute of a memory operand. ÓÃÀý£º .data
myCount WORD 0
.code
mov esi,OFFSET myCount
inc [esi] ; error: ambiguous inc WORD PTR [esi] ; ok
2.±äÖ·²Ù×÷Êý£º°Ñ³£Á¿ºÍ¼Ä´æÆ÷Ïà¼ÓÒԵõ½Ò»¸öÓÐЧµØÖ·
ÓÐÁ½ÖÖ¸ñʽ£º[label + reg] ÓÃÀý£º .data
13
label[reg]
arrayW WORD 1000h,2000h,3000h .code
mov esi,0
mov ax,[arrayW + esi] ; AX = 1000h
mov ax,arrayW[esi] ; alternate format add esi,2
add ax,[arrayW + esi] 3.Ö¸Õ룺°üº¬ÆäËû±äÁ¿µØÖ·µÄ±äÁ¿ ÓÃÀý£º .data
arrayW WORD 1000h,2000h,3000h ptrW DWORD arrayW .code
mov esi,ptrW
mov ax,[esi] ; AX = 1000h
Á·Ï°Ì⣺ÊéP96 µÚ7Ìâ £¬µÚ8Ìâ ×÷ÒµÌâ
5¡¢JMP ºÍLOOP
1.JMPÖ¸Áîµ¼ÖÂÏò´úÂë¶ÎÄÚµÄÄ¿µÄµØÖ·×öÎÞÌõ¼þ×ªÒÆ¡£Ä¿µÄ±êºÅµÄÆ«ÒÆµØÖ·±»×°ÈëÖ¸Áî Ö¸ÕëÖС£
¸ñʽ£ºJMP Ä¿µÄµØÖ·
JMPÖ¸ÁîÊÇÎÞÌõ¼þµÄ£¬Òò´ËÑ»·»áÎÝÐÝÖ¹µØ³ÖÐøÏÂÈ¥£¬ÖªµÀÂú×ãÆäËûÌõ¼þÍË ³öΪֹ¡£
´´½¨Ò»¸öÑ»· top: . .
jmp top £»ÎÞÏÞÑ»·
2.LOOPÖ¸Áî£ºÖØ¸´Ö´ÐÐÒ»¿éÓï¾ä£¬Ö´ÐеĴÎÊýÊÇÌØ¶¨µÄ¡£
ECX±»×Ô¶¯ÓÃ×÷¼ÆÊýÆ÷£¬ÔÚÿ´ÎÑ»·ºó¼õ1 ¸ñʽ£ºLOOP Ä¿µÄµØÖ·
Ö´ÐÐLOOPÖ¸ÁîÁ½²½£º
14
Ê×ÏÈECX¼õ1
½Ó×Å£¬Óë0±È½Ï¡£Èç¹ûECX!=0,Ìø×ªµ½Ä¿µÄµØÖ·£» Èç¹ûECX=0£¬ ²»·¢ÉúÌø×ª¡£
×¢Ò⣺ѻ·¿ªÊ¼Ö®Ç°½«ECX³õʼ»¯Îª0£¬½á¹ûÑ»·
4292967296´Î¡£ Ñ»·µÄÄ¿µÄµØÖ·Ó뵱ǰµØÖ·Ö»ÄÜÔÚÏà¾à-128~+127×Ö½Ú·¶Î§ÄÚ¡£ 3.Ñ»·µÄǶÌ×£º
.data
count DWORD ? .code
mov ecx,100 ; set outer loop count L1:
mov count,ecx ; save outer loop count mov ecx,20 ; set inner loop count L2: . .
loop L2 ; repeat the inner loop mov ecx,count ; restore outer loop count loop L1 ; repeat the outer loop
ÀýÌ⣺ÊéP98 ÕûÊýÊý×éÇóºÍ
ÊéP99 ¸´ÖÆ×Ö·û´®
µÚÎåÕ ¹ý³Ì
Ò»£®ÓëÊý¾Ý¿âÁ´½Ó
Á´½Ó¿âÊÇÒ»¸öÎļþ£¬ÆäÖаüº¬ÁËÒѾ±àÒë³É»úÆ÷ÂëµÄ¹ý³Ì ÃüÁ link hello.obj irvine32.lib
¶þ£®ÊéÖеÄÁ´½Ó¿â
CloseFile ¨C Closes an open disk file
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
15
Delay - Pauses program execution for n millisecond interval DumpMem - Writes block of memory to standard output in hex DumpRegs ¨C Displays general-purpose registers and flags (hex) GetCommandtail - Copies command-line args into array of bytes GetMaxXY - Gets number of cols, rows in console window buffer GetMseconds - Returns milliseconds elapsed since midnight
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¨C9) MsgBox, MsgBoxAsk ¨C Display popup message boxes OpenInputFile ¨C Opens existing file for input
ParseDecimal32 ¨C 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 ReadFromFile ¨C Reads input disk file into buffer
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 ¨C 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
StrLength ¨C Returns length of a string
WaitMsg - Displays message, waits for Enter key to be pressed WriteBin - Writes unsigned 32-bit integer in ASCII binary format.
WriteBinB ¨C 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 ¨C Writes byte, word, or doubleword in hexadecimal format WriteInt - Writes signed 32-bit integer in decimal format
WriteString - Writes null-terminated string to console window WriteToFile - Writes buffer to output file
16
Ïà¹ØÍÆ¼ö£º