ÄÚÈÝ·¢²¼¸üÐÂʱ¼ä : 2024/11/15 20:07:18ÐÇÆÚÒ» ÏÂÃæÊÇÎÄÕµÄÈ«²¿ÄÚÈÝÇëÈÏÕæÔĶÁ¡£
¡¶»ã±àÓïÑÔ³ÌÐòÉè¼Æ¡·ÆÚÄ©¸´Ï°Ìâ
£¨2008Çï¼¾£©
1¡¢ÏÖÓУ¨AX£©=2000H£¬£¨BX£©=1200H£¬£¨SI£©=0002H£¬£¨DI£©=0003H£¬£¨DS£©=3000H£¬£¨SS£©=3000H£¬£¨SP£©=0000H£¬£¨31200H£©=50H£¬£¨31201H£©=02H£¬£¨31202H£©=0F7H£¬£¨31203H£©=90HÇëд³öÏÂÁи÷ÌõÖ¸Áî¶ÀÁ¢Ö´ÐÐÍêºó£¬ÓйؼĴæÆ÷¼°´æ´¢µ¥ÔªµÄÄÚÈÝ£¬Èô¸ÃÖ¸ÁîÓ°ÏìÌõ¼þÂ룬ÔòÇë¸ø³öÌõ¼þÂëSF£¬ZF£¬OF£¬CFµÄÖµ¡£
1¡¢ADD AX£¬ 1200H 2¡¢SUB AX£¬ BX 3¡¢MOV [BX]£¬ AX 4¡¢PUSH AX
5¡¢DEC BYTE PTR [1200H] 6¡¢NEG WORD PTR [1200H] 7¡¢SAR BYTE PTR 1200[SI]£¬1 8¡¢ROL BYTE RTR [BX+SI+1]£¬1 9¡¢MUL WORD PTR [BX][SI] 10¡¢DVI BYTE PTR 1200[DI] 2¡¢¼ÙÉ裨CS£©=3000H£¬£¨DS£©=4000H£¬£¨ES£©=2000H£¬£¨SS£©=5000H£¬£¨AX£©=2060H£¬£¨BX£©=3000H£¬£¨CX£©=0005H£¬£¨DX£©=0£¬£¨SI£©=2060H£¬£¨DI£©=3000H£¬£¨43000H£©=0A006H£¬£¨23000H£©=0B116H£¬£¨33000H£©=0F802H£¬£¨25060H£©=00B0H£¬£¨SP£©=0FFFEH£¬£¨CF£©=1£¬£¨DF£©=1£¬Çëд³öÏÂÁи÷ÌõÖ¸Áî¶ÀÁ¢Ö´ÐÐÍêºó£¬ÓйؼĴæÆ÷¼°´æ´¢µ¥ÔªµÄÄÚÈÝ£¬Èô¸ÃÖ¸ÁîÓ°ÏìÌõ¼þÂ룬Çë¸ø³öÌõ¼þÂëSF£¬ZF£¬OF£¬CFµÄÖµ¡£
1¡¢SBB AX£¬ BX
2¡¢CMP AX£¬ WORD PTR[SI+0FA0H] 3¡¢MUL BYTE PTR[BX] 4¡¢AAM
5¡¢DIV BH
6¡¢SAR AX£¬ CL
7¡¢XOR AX£¬ 0FFE7H 8¡¢REP STOSB
9¡¢JMP WORD PTR [BX] 10¡¢XCHG AX£¬ ES£º[BX+SI] 3¡¢ÅжÏÏÂÁÐÖ¸ÁîÊÇ·ñÕýÈ·
1¡¢POP CS £¨ £© 2¡¢PUSH WORD PTR 20[BX+SI-2] £¨ £© 3¡¢LEA BX£¬ 4[BX] £¨ £© 4¡¢JMP BYTE PTR[BX] £¨ £© 5¡¢SAR AX£¬5 £¨ £© 6¡¢MOV BYTE PTR[BX]£¬1000 £¨ £© 7¡¢CMP [DI]£¬[SI] £¨ £©
»ã±àÓïÑÔ³ÌÐòÉè¼Æ µÚ1Ò³£¨¹²5Ò³£©
8¡¢ADD BX£¬OFFSET A £¨ £© 9¡¢IN AL£¬DX £¨ £© 10¡¢MUL 25 £¨ £© 4¡¢Ìî¿Õ
£¨1£©Ò»¸öÓÐ16¸ö×ÖµÄÊý¾ÝÇø£¬ËüµÄÆðʼµØַΪ70A0£ºDDF6£¬ÄÇô¸ÃÊý¾ÝÇøµÄ×îºóÒ»¸ö×Öµ¥ÔªÎïÀíµØַΪ£¨ H£©
£¨2£©¼ÙÉ裨SS£©=2250H£¬£¨SP£©=0140H£¬Èç¹ûÔÚ¶ÑÕ»ÖдæÈë5¸öÊý¾Ý£¬ÔòÕ»¶¥µÄÎïÀíµØַΪ£¨ H£©¡£Èç¹ûÓÖ´Ó¶ÑÕ»ÖÐÈ¡³ö3¸öÊý¾Ý£¬ÔòÕ»¶¥µÄÎïÀíµØַΪ£¨ H£©¡£
£¨3£©ÔÚsub ax, bxÖ¸ÁîÖ´Ðкó£¬CF=1£¬ËµÃ÷£º
£¨a£©×î¸ßÓÐЧλ ¡£
£¨b£©¶Ô Êý£¬²Ù×÷½á¹û²Â³ö¡£ £¨4£©Ä³³ÌÐòµÄÊý¾Ý¶Î¶¨ÒåÈçÏ£º DATASG SEGMENT
PARTLIST DB ¡®PART#¡® DB 60 DB ¡®PRICE¡® DW 0125
DB ¡®DESCRIPTION¡¯ DB ¡®RADIO¡¯
LISTLENG EQU ( )£»Êý×鳤¶È£¬Óñí´ïʽ±íʾ¡£ DATASG ENDS 5¡¢Ä³³ÌÐòÉè¼ÆÊý¾ÝÇøÈçÏ£º ORG 100H
NAMES DB ¡®TOM.. ¡®,20 DB ¡®ROSE. ¡®,25 DB ¡®KATE. ¡®,22
£¨1£© Áгö¸ÃÊý¾ÝÇøµÄLISTÇåµ¥£¨¼´¸÷×Ö½Úµ¥ÔªµÄ´æ´¢Çé¿ö£©¡£
£¨2£© ÏÂÁи÷×éÖ¸ÁÈôΪºÏ·¨Ö¸ÁÇëд³öÖ´ÐкóµÄ½á¹û£»ÈôΪ·Ç·¨Ö¸ÁÇëÖ¸
³öÆä´íÎó¡£
£¨a£© MOV BX£¬OFFSET NAMES
MOV AX£¬[BX+5]
£¨b£© MOV BX£¬ OFFSET NAMES+11 CMP [BX]£¬BYTE PTR NAMES+5 £¨c£© MOV BX£¬6 * 2
MOV SI£¬5
MOV DI£¬OFFSET [BX][SI] INC [DI]
£¨d£© MOV SI£¬5
LEA DI£¬NAMES 6[SI]
»ã±àÓïÑÔ³ÌÐòÉè¼Æ µÚ2Ò³£¨¹²5Ò³£©
MOV AL£¬[DI] 6¡¢±à³Ì
£¨1£©¶¨ÒåºêÖ¸ÁîBIGER£º°Ñ×Ö±äÁ¿XºÍYÖнϴóÕß´æÈëBIG£¬ÈôXºÍYÏàµÈʱ£¬Ôò°ÑÆäÖÐÖ®Ò»´æÈëBIG¡£
£¨2£©ºêÖ¸ÁîDISPÍê³É£º¸ù¾Ý²»Í¬µÄ¹¦ÄÜÂ루2£¬6£¬9£©·Ö±ð²úÉúÏÔʾµ¥×Ö·û»ò×Ö·û´®µÄ³ÌÐò¶Î¡£
²¢µ÷ÓãºDISP 2£¬0DH DISP 2£¬0AH DISP 9£¬STRING
£¨3£©¶¨ÒåºêÖ¸ÁîPRINTBK£ºÀûÓÃDOSµ÷ÓÃÍê³É´òÓ¡»úÁ¬Ðø´òÓ¡Ò»´®×Ö·ûµÄ¹¦ÄÜ£¬Èç¹û×Ö·û´®ÖгöÏÖÁбí·ûTAB£¨ASCIIÂëΪ09H£©£¬Ôò´òÓ¡8¸ö¿Õ¸ñ·û£¨ASCIIÂëΪ20H£©À´´úÌæËü£¬×Ö·û´®Ê×µØÖ·¼°³¤¶ÈΪ±äÔª¡£ £¨4£©ÏÖÓÐ data segment
ARRAY DW 64 DUP£¨ £¿£© DW 5 DUP£¨ £¿£© Data ends
ÊÔ±àÖÆÒ»³ÌÐò¶Î£¬ÒªÇóÔÚARRAY+8µ½ARRAY+10£¨Á½Õ߶¼°üÀ¨ÔÚÄÚ£©µ¥ÔªÖвåÈë5¸ö0¡££¨Ìáʾ£ºÏÈ°Ñ´ÓARRAY+8µ¥Ôª¿ªÊ¼µÄÊý¾ÝºóÒÆ5¸öµ¥Ôª£¬È»ºóÔÙÔڹ涨λÖòåÈë0Öµ£©
7¡¢ÊÔ·ÖÎöÏÂÁгÌÐòÖ´ÐÐÍêºó£¬Aµ¥ÔªµÄÄÚÈÝÊÇʲô£¿ Data segment
A dw 0 B dw 0
C dw 230£¬20£¬54 Data ends Code segment ©«
MOV BX£¬OFFSET C MOV AX£¬[BX] MOV B AX MOV AX£¬2[BX] ADD AX£¬B MOV A£¬ AX ©« Code ends
8¡¢³ÌÐòÌî¿Õ¡£¼ÙÉèXºÍX+2µ¥ÔªµÄÄÚÈÝΪ˫¾«¶ÈÊýP£¬YºÍY+2µ¥ÔªµÄÄÚÈÝΪ˫¾«¶ÈÊýQ£¨X£¬YΪµÍλ×Ö£©£¬ÏÂÁгÌÐò¶Îʹ2P>Qʱ£¨AX£©=1£¬2P<=Qʱ£¨AX£©=2¡£Çë°Ñ³ÌÐò¶ÎÌîдÍêÕû¡£
MOV DX£¬X+2 MOV AX£¬X
»ã±àÓïÑÔ³ÌÐòÉè¼Æ µÚ3Ò³£¨¹²5Ò³£©