²Ä¤@³¹¤w¸g´£¹L°Æµ{¦¡¦p¦ó«Å§i¡B¦p¦ó©I¥s¡B¦p¦ó±q°Æµ{¦¡ªð¦^¡A¦ýÁÙ¥¼¯u¥¿«Ø¥ß¹L°Æµ{¦¡¡A¤]¨S»¡¹L©I¥s¹Lµ{¤¤°ïÅ|ªºÅܤƱ¡§Î¡C¦b³o¤@³¹¸Ì¡A¤p¤ì°¸±N¥H¨D±o¨â¥¿¾ã¼Æªº³Ì¤j¤½¦]¼Æ¤Î³Ì¤p¤½¿¼Æ¬°¨Ò¤l¡A¨Ó»¡©ú³oÓ¹Lµ{¡C¦¹µ{¦¡ºÙ¬° GCD_LCM.ASM¡C
§A¥i¥H¸Õ·Q¡A¦pªG¥s§A¼¶¼g³oÓµ{¦¡¡A¸Ó¦p¦ó°µ¡H³Ì³æ¯Âªº¤è¦¡¡AÀ³¸Ó¬O¦bµ{¦¡¤@¶}©l¡A´N¦b¡u©R¥O´£¥Ü¡v¦r¤¸Åã¥Ü¤@Ó¦r¦ê¡A´£¥Ü¨Ï¥ÎªÌ¿é¤J¤@Ó¥¿¾ã¼Æ¡Aµ¥¿é¤J§¹¦¨±N¥¦¦s¤J¤@ÓÅܼƤ¤¡A¥H«Ý«áÄò¨Ï¥Î¡C³o¬q¹Lµ{ÁÙn«½Æ¤@¦¸¡A¦]¬°³oÓ½t¬G¡A³o¬qµ{¦¡¥i¥H¼g¦¨°Æµ{¦¡¡C
¥Ñ±µ¤U¨Ó¡A´N¬O¨D±o³o¨â¥¿¾ã¼Æªº³Ì¤j¤½¦]¼Æ¤F¡C³oÓµ{¦¡¤ù¬q¦³«Ü±j¯Pªº¥Øªº©Ê¡A¬Æ¦Ü¥i¥H¿W¥ß¥X¨ÓÀ³¥Î¨ì¨ä¥Lµ{¦¡¤W¡AÅý¨ä¥Lµ{¦¡©I¥s¡A©Ò¥H³o¬qµ{¦¡¤]¥i¥H»s§@¦¨°Æµ{¦¡¡C
¥Ñ¥H¤W¬Ý¨Ó¡AGCD_LCM.ASM ¦Ü¤Ö¥i¥H¦³¨âÓ¦Û¦æ«Ø¥ßªº°Æµ{¦¡¡A«eªÌºÙ¬°¡uinput_integer¡v¡A«áªÌºÙ¬°¡ufind_gcd_lcm¡v¡C
¥ý¤¶²Ð¡uGCD_LCM.ASM¡v·|¥Î¨ìªº·s«ü¥O¡C
XCHG ªº»yªk¬O
XCHG ¥Øªº¹Bºâ¤¸,¨Ó·½¹Bºâ¤¸
XCHG ªº¥\¥Î¬O¬Û¤¬¥æ´«¥Øªº¹Bºâ¤¸»P¨Ó·½¹Bºâ¤¸¤§¼ÆÈ¡A³o¨âÓ¹Bºâ¤¸¥i¥H¬OÅܼƩμȦs¾¹¡A¦ý¤£¯à³£¬OÅܼơC¨Ò¦p©³¤Uªº¨Ò¤l¡G
mov rax,5 mov rcx,8 xchg rax,rcx
³Ì«á RAX¡×8¡ARCX¡×5¡C
80x86 ®a±Úªº¼ªk«ü¥O¦³¨âºØ¡AMUL »P IMUL¡A«eªÌ¬O¥Î¨ÓpºâµL¸¹¼Æ ( µL¸¹¼Æ¥i¥H¬Ý¦¨¬O¥¿¾ã¼Æ )¡A«áªÌ«h¬O¥Î¨Ópºâ¦³¸¹¼Æªº¡C¦¹³B¶È¤¶²Ð MUL¡A¨ä»yªk¦p¤U¡G
MUL ¹Bºâ¤¸
MUL «á±±µµÛªº¹Bºâ¤¸¨ä¹ê´N¬O¼¼Æ¡A¥i¥H¬O¼È¦s¾¹©ÎÅܼƦý¤£¥i¥H¬O±`¼Æ¡C³Q¼¼Æ©ñ¦b AL¡BAX¡BEAX¡BRAX ùØ¡A¦Ü©ó¬Oþ¤@Ó¡Aµø¼¼Æªºªø«×¨Ó¨M©w¡A³Q¼¼Æªºªø«×¥²¶·»P¼¼Æªø«×¬Û¦P¡C¨Ò¦p¼¼Æ¬O¤K¦ì¤¸ªø¡A¨º»ò³Q¼¼Æ¤]¬O¤K¦ì¤¸ªø¡A©Ò¥H³Q¼¼Æ´N©ñ¦b AL ùØ¡C
MUL ¹Bºâ¤§«á¡A¼¿nªºªø«×¬O¼¼Æ¦ì¼Æ»P³Q¼¼Æ¦ì¼Æ¤§©M¡C¥H§Ú̼ô±xªº¤Q¶i¦ì¼Æ¨Ó»¡¡A¨â¦ì¼Æ¼¨â¦ì¼Æ³Ì¤jȬO¥|¦ì¼Æ¡A¨Ò¦p 99¡Ñ99¡×9801¡C¦P²z¡A¤KÓ¦ì¼Æªº¤G¶i¦ì¼Æ¼¤KÓ¦ì¼Æªº¤G¶i¦ì¼Æ©Ò±o¤§¼¿n¬°¤Q¤»Ó¦ì¼Æªº¤G¶i¦ì¼Æ¡A¦Ó¤KÓ¦ì¼Æ¤£´N¬O¤K¦ì¤¸¶Ü¡H©Ò¥H AL ¼¥H¤K¦ì¤¸¼È¦s¾¹©ÎÅܼơA©Ò±oªº¼¿nn©ñ¦b¤Q¤»¦ì¤¸ªº AX ¼È¦s¾¹ùØ¡C¤£¦P¦ì¤¸ªº¼ªk¾ã²z¦¨¤Uªí¡G
¼ªk¤è¦¡ | ¼¼Æ | ³Q¼¼Æ | ¼¿n | ½d¨Ò | |
¹Bºâ«e | ¹Bºâ«á | ||||
¤K¦ì¤¸¼ªk | 8 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | AL | AX | ;pºâ 2¡Ñ3¡×6 MOV AX,0102H MOV BX,0103H MUL BL |
AX=0006 BX=0103H |
¤Q¤»¦ì¤¸¼ªk | 16 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | AX | DX:AX | ;pºâ 200H¡Ñ106¡×20C00H MOV DX,0FFFFH MOV AX,200H MOV BX,106H MUL BX |
DX=0002 AX=0C00H BX=0106H |
¤T¤Q¤G¦ì¤¸¼ªk ¥u¯à¥Î©ó 386µ¥¯Å¥H¤W | 32 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | EAX | EDX:EAX | ;pºâ 80000001H¡Ñ2¡×100000002H MOV EDX,88887777H MOV EAX,80000001H MOV EBX,2 MUL EBX |
EDX=1 EAX=2 EBX=2 |
¤»¤Q¥|¦ì¤¸¼ªk ¥u¯à¥Î©ó x64µ¥¯Å¥H¤W | 64 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | RAX | RDX:RAX | ;pºâ 8¡Ñ8¡×40H MOV RDX,123456789ABCDEF0H MOV RAX,8 MOV RBX,8 MUL RBX |
RDX=0 RAX=40H RBX=8 |
¤Wªí¤¤¤Q¤»¦ì¤¸ªº¼ªk¡A¼¼Æ»P³Q¼¼Æ³£¬O¤Q¤»¦ì¤¸ªø¡A¼¼Æ¬O¤Q¤»¦ì¤¸ªº¼È¦s¾¹©ÎÅܼơA³Q¼¼Æ«h©T©w©ñ©ó AX ¼È¦s¾¹¤¤¡C¹Bºâ¤§«á©Ò±o¤§¼¿n¬°¤T¤Q¤G¦ì¤¸¡A¦ý¨Ã¤£¬O©ñ¦b EAX ¼È¦s¾¹ùØ¡C³o¬O¦]¬°¦b x86 CPU ®a±Ú¤¤¡A³Ì¦ªº CPU ¬O¤Q¤»¦ì¤¸ªº 8086¡A¨ä¼È¦s¾¹³£¬O¤Q¤»¦ì¤¸ªø¡A¨S¦³¤T¤Q¤G¦ì¤¸ªº¼È¦s¾¹¡C¤£±o¤w¡A¥u¯à¥Î¨âӼȦs¾¹¦s©ñ¡A^¯Sº¸¥Î DX¡BAX ¦s©ñ¡A¥H DX:AX ªí¥Ü¡ADX ¬O¸û°ª¦ìªº¦r²Õ¡AAX ¬O¸û§C¦ìªº¦r²Õ¡C¨ì¤F¤T¤Q¤G¦ì¤¸¡B¤»¤Q¥|¦ì¤¸ªº¼ªk¡A¤]¥Î¦¹ºD¨Ò¦s©ñ¼¿n¡C
MUL ¤£¼vÅT¹sȺX¼Ð¡A§Y¨Ï©Ò±oªº¼¿n¬°¹s¡F¦ý¬O·|¼vÅT¶i¦ìºX¼Ð¡C°õ¦æ MUL ¤§«á¡A§â¼¿nªº¦ì¼Æ§¡¤À¨â³¡¤À¡A¸û°ª¦ì¤£¬°¹s®É¶i¦ìºX¼Ð³]¦¨¤@¡A§_«h³]¬°¹s¡C¨Ò¦p¡G
mov ax,8000h mov cx,8 mul cx
°õ¦æ§¹«á DX:AX¡×0006:4000¡A¦]¬° DX ¤£¬°¹s¬G CPU ·|§â¶i¦ìºX¼Ð³]¬°¤@¡C
DIV «ü¥O¬O¥\¥Î¬Opºâ¥¿¾ã¼Æªº°£ªk¡A¦Ü©ó¦³¸¹¼Æªº°£ªk¡A¬O¥Î IDIV «ü¥O¡A¨£²Ä 13 ³¹¡CDIV ªº»yªk¦p¤U¡G
DIV ¹Bºâ¤¸
¹Bºâ¤¸¬O°£¼Æ¡A¥i¥HÅܼƩμȦs¾¹¡A¦ý¤£¥i¥H¬O±`¼Æ¡CDIV «ü¥Oªº³Q°£¼Æ¨Ã¨S¦³¼g¥X¨Ó¡A¹w³]¬O AX¡BDX:AX¡BEDX:EAX¡BRDX:RAX¡A¦Ü©ó¬Oþ¤@Ó¡An¬Ý¹Bºâ¤¸¨M©w¡C¨ä³W«h¬O³Q°£¼Æªº¦ì¤¸Ó¼Æ¬O°£¼Æªº¨â¿ªø¡C¨Ì¾Ú¹Bºâ¤¸ªºªø«×¡A¥i¤À¬°¥|ºØ°£ªk¡G①¤K¦ì¤¸°£ªk¡B②¤Q¤»¦ì¤¸°£ªk¡B③¤T¤Q¤G¦ì¤¸°£ªk¡B④¤»¤Q¥|¦ì¤¸°£ªk¡C¹Bºâ«áªº°Ó©M¾l¼Æ¡A¤À§O¦s©ó¼È¦s¾¹¤¤¡A¾ã²z¦p¤Uªí¡G
°£ªk¤è¦¡ | °£¼Æ | ³Q°£¼Æ | °Ó¼Æ | ¾l¼Æ | ½d¨Ò | ||
¹Bºâ«e | ¹Bºâ«á | ||||||
¤K¦ì¤¸°£ªk | 8 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | AX | AL | AH | ;pºâ 7¡Ò2¡×3⋯⋯1 MOV AX,7 MOV CL,2 DIV CL |
AX=0103¡]AL¡×°Ó¡AAH¡×¾l¼Æ¡^ CL=2 | |
¤Q¤»¦ì¤¸°£ªk | 16 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | DX:AX | AX | DX | ;pºâ 9¡Ò4¡×2⋯⋯1 MOV DX,0 MOV AX,9 MOV CX,4 DIV CX | AX=2¡]°Ó¡^ DX=1¡]¾l¼Æ¡^ | |
¤T¤Q¤G¦ì¤¸°£ªk ¥u¯à¥Î©ó 386µ¥¯Å¥H¤W | 32 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | EDX:EAX | EAX | EDX | ;pºâ¤T¦Ê»õ¡Ò¤K»õ¡×37⋯⋯400000000 MOV EDX,6 MOV EAX,0FC23AC00H MOV ECX,2FAF0800H DIV ECX |
EAX=25H¡]°Ó¡^ EDX=17D78400H¡]¾l¼Æ¡^ | |
¤»¤Q¥|¦ì¤¸°£ªk ¥u¯à¥Î©ó x64µ¥¯Å¥H¤W | 64 ¦ì¤¸ÅÜ¼Æ ©Î¼È¦s¾¹ | RDX:RAX | RAX | RDX | ;10CDEFAB1234567890H¡Ò10000000H ;¡×1CDEFAB123H⋯⋯4567890H MOV RDX,1 MOV RAX,0CDEFAB1234567890H MOV RCX,10000000H DIV RCX |
RAX=1CDEFAB123H¡]°Ó¡^ RDX=4567890H¡]¾l¼Æ¡^ |
¥H¤Wªíªº¤T¤Q¤G¦ì¤¸°£ªk¬°¨Ò¡A¦pªGnpºâ¤T¦Ê»õ°£¥H¤K»õ¡A¤T¦Ê»õ´«ºâ¦¨¤Q¤»¶i¦ì¬O 6 FC23 AC00H¡A¥e¥Î¤»¤Q¥|¦ì¤¸¡F¤K»õ¬O 2FAF 0800H¡A¥e¤F¤T¤Q¤G¦ì¤¸¡C©Ò¥H§â EDX ³]¬° 6¡AEAX ³]¬° 0FC23 AC00H¡A³o¼Ë´N§¹¦¨³Q°£¼Æªº³]©w¡C°£¼Æ¥i¥H¬O¤T¤Q¤G¦ì¤¸ªºÅܼƩμȦs¾¹¡A¦¹¨Ò¬O ECX¡A©Ò¥H±N ECX ³]¬° 2FAF 0800H¡]¤Q¶i¦ì 800000000¡×¤K»õ¡^¡C¹Bºâ«áªº°Ó¬° 37¡]¤Q¤»¶i¦ì 25H¡^¡A¾l¼Æ¬°¥|»õ¡]¤Q¤»¶i¦ì 17D7 8400H¡^¡C
ÁÙ¦³Ó°ÝÃD¡A¬JµM DIV ¦³¥|ºØ¤§¦h¡A¨º»ò¦b°µ¹Bºâ®Én¿ï¥Îþ¤@ºØ¦ì¤¸¼Æªº°£ªk©O¡H¨ä¹ê¤£Ãø¡A¨Ì¾Ú°£¼Æªº¤j¤p¨Ó§P©w§Y¥i¡CÁÙ¬O¥H¬O¤T¦Ê»õ°£¥H¤K»õ¬°¨Ò¡C°£¼Æ¬O¤K»õ¡A´«ºâ¦¨¤Q¤»¶i¦ì¬O 2FAF 0800H¡A¥e¤F¤T¤Q¤G¦ì¤¸¡A¦]¦¹´N¿ï¥Î¤T¤Q¤G¦ì¤¸ªº°£ªk¡C¤]¥i¥H°Ñ¦Ò²Ä¤@³¹ªºªí®æ±oª¾¡A¤T¤Q¤G¦ì¤¸ªº¼Æ³Ì¦h¯àªí¥Ü¥|¤Q¤G»õ¡A¦]¦¹¥Î¤T¤Q¤G¦ì¤¸ªí¥Ü¤K»õ¡Aºïºï¦³¾l¡]·íµM§A¤]¥i¥H°õ·N¥Î¤»¤Q¥|¦ì¤¸°£ªk¡A¦ý±þÂû²j¥Î¤û¤M¡^¡C¤T¤Q¤G¦ì¤¸ªº°£ªk³Q°£¼Æ©ñ¦b EDX:EAD ¤º¡A¦]¦¹ EDX¡×6¡AEAX¡×0FC23 AC00H¡A°£¼Æ¥un¬O 32 ¦ì¤¸ªºÅܼƩμȦs¾¹§Y¥i¡A¨Ò¦p ECX¡A¬G¨Ï ECX¡×2FAF 0800H¡A´N¯à°÷¬Û°£¤F¡Aµ²ªG°Ó©ñ¦b EAX¡×25H¡A¾l¼Æ¤»»õ©ñ¦b EDX ¤º¡C
DIV ¤£¼vÅTºX¼Ð¼È¦s¾¹¡A¦ýnª`·N°Ó·|¤£·|¶W¹L¼È¦s¾¹©Ò¯à¦s©ñªº¤j¤p¡C¨Ò¦p 0F000¡Ò2¡×7800H¡]¤Q¶i¦ì¬O61440¡Ò2¡×30720¡^¡A¦pªG¥Î¤K¦ì¤¸ªº°£ªk¡A©Ò±oªº°Ó©ñ¦b AL¡A¦ý©ñ¤£¤U¡A´N·|µo¥Í¿ù»~¡A³oºØ¿ù»~ºÙ°£ªk·¸¦ì¡C³q±`°£¼Æ¤Ó¤p¥B³Q°£¼Æ¤Ó¤j¡A´N·|µo¥Í³oºØ±¡§Î¡A¥i¥H°Ñ¦Ò¡uDOS ²Õ¦X»y¨¥²Ä¤C³¹µù¤@¡v¡C
¦b¤é±`¥Í¬¡¤¤¡A±`¨Ï¥Î¡©©Î¡ª³oÓ´yz¡C¨Ò¦p±ß¶º«á¡A¶ý¶ý»¡¡G¡u¬~§¹¸J¡©©Î¡ªË§¹¼p¾l´N¯à¥´¹q°Ê¡C¡v·N«ä´N¬O¬~¸J¸ò˼p¾l¨â¥ó¨Æ¡A¥un¦³¤@¼Ë§¹¦¨´N¯à¥´¹q°Ê¡C§â°µ§¹¨Æ±¡·í§@¯u¡A¥H¡u1¡vªí¥Ü¡F¨Æ±¡¥¼°µ§¹¡A¬°°²¡A¥H¡u0¡vªí¥Ü¡C¯àª±¹q°Ê¬°¯u¡A¥H¡u1¡vªí¥Ü¡F¤£¯àª±¹q°Ê¬°°²¡A¥H¡u0¡vªí¥Ü¡Cµ²ªG¦p¤Uªí¡G¨Æ¥ó¥Ò¥Nªí¨S¬~¸J¤]¨S˼p¾l¡A©Ò¥H¤£¯àª±¹q°Ê¡F¨Æ¥ó¤Aªí¥Ü¬~¸J¦ý¨S˼p¾l¡A¥i¥H¥´¹q°Ê¡K¡K
¨Æ¥ó | ¬~§¹¸J | ˧¹¼p¾l | ¬O§_¯àª±¹q°Ê |
¥Ò | 0 | 0 | 0 |
¤A | 1 | 0 | 1 |
¤þ | 0 | 1 | 1 |
¤B | 1 | 1 | 1 |
¦b¹q¸£¤¤¡A¡©©Î¡ª¹Bºâ¤]¹³¤W±¡u¯à§_¥´¹q°Ê¡vªº¨Ò¤l¤@¼Ë¡C¤]´N¬O»¡¡A¨âÓ¤@¦ì¤¸ªº¹Bºâ¤¸°µ¡©OR¡ª¹Bºâ¡A¥un¦³¤@Ó¹Bºâ¤¸¬°¤@¡Aµ²ªG´N¬O¤@¡F¥u¦³¨âÓ¹Bºâ¤¸³£¬O¹s¡Aµ²ªG¤~¬O¹s¡COR ¹Bºâªº¯uȪí¦p¤U¡G
0 OR 0¡×0 1 OR 0¡×1 0 OR 1¡×1 1 OR 1¡×1
x86 ªº«ü¥O OR «ü¥Oªº»yªk¬O
OR ¥Øªº¹Bºâ¤¸,¨Ó·½¹Bºâ¤¸
OR «ü¥O¬O±N¨Ó·½¹Bºâ¤¸ªº¨CӦ줸»P¥Øªº¹Bºâ¤¸¬Û¹ïÀ³ªº¦ì¤¸§@ OR ¹Bºâ¡A¦A±N¨äµ²ªG¦s¤J¥Øªº¹Bºâ¤¸¤¤¡C¥Øªº¹Bºâ¤¸¥i¥H¬O¼È¦s¾¹¡BÅܼơA¨Ó·½¹Bºâ¤¸¥i¥H¬O¼È¦s¾¹¡BÅܼƻP±`¼Æ¡C¥Øªº¹Bºâ¤¸»P¨Ó·½¹Bºâ¤¸¤£¯à¦P®É¬OÅܼơA¦Ó¥Bªø«×¥²¶·¬Û¦P¡A³£¬O¤K¦ì¤¸©Î¤Q¤»¦ì¤¸¼e¡C
¦¹¥~¡AOR «ü¥O¤]·|¨Ì¾Úµ²ªG³]©wºX¼Ð¼È¦s¾¹¤¤ªº¹sȺX¼Ð¡C°²¦pµ²ªG¬°¹s¡A·|¨Ï¹sȺX¼ÐÅܬ°¡u1¡v¡A§_«h¹sȺX¼Ð¬°¡u0¡v¡COR ¤£·|µo¥Íɦì©Î¶i¦ì¡A¦]¦¹¶i¦ìºX¼Ð³£·|³]¬°¹s¡C
¨Ò¦p¡AAL¡×32H¡A°õ¦æ¡uOR AL,0C3H¡v«áªºµ²ªG¦p¥k¹Ï¡A³Ì«áµ²ªG¬° F3¡A¦]¦¹ AL ¤]·|Åܦ¨ F3¡C
OR «ü¥O¦³¤@¶µ¯S©Ê¡A¦pªG¹ï¦Û¤v§@ OR ¹Bºâµ²ªG¬°¹s¡A«h¦Û¤v¥»¨ì¨Ó¤]¬O¹s¡C¦b²Õ¦X»y¨¥ùØ¡A±`±`¥Î³oºØ©Ê½è¥hÀˬd¬YӼȦs¾¹¬O§_¬°¹s¡C¨Ò¦p¦b¡ugcd_lcm.asm¡vªº²Ä 36 ¦æ¡A¡uor rdx,rdx¡v´N¬O¥Î¨ÓÀˬd¾l¼Æ¬O§_¬°¹s¡C
JMP ªº»yªk¬O
JMP ¼Ð°O
JMP ¬O¡uJump¡vªº·N«ä¡A§YµL±ø¥ó¸õÅD¨ì¼Ð°O ( label ) ªº¦ì§}³BÄ~Äò°õ¦æ¡C
¦pªG¼Ð°O¬O¡u@f¡v©Î¡u@b¡vªº¸Ü¡A¥²©w·|¦³¤@Ó¬O¡u@@:¡vªº¼Ð°O¡C¦pªG¬O¡uJMP @f¡v¡A¥Nªí©¹°ª¦ì§}¸õÅD¨ì³Ìªñªº¡u@@:¡v³B¡F¦pªG¬O¡uJMP @b¡v¡A¥Nªí©¹§C¦ì§}¸õÅD¨ì³Ìªñªº¡u@@:¡v³B¡C·|¦³¡u@@:¡v¼Ð°Oªºì¦]¡A¥Dn¬O¦]¬°²Õ¦X»y¨¥¥Î¨ì¸õÅD«ü¥Oªº¾÷·|¤£¤Ö¡A¦ý¬O¨C¦¸³£n¬°¼Ð°O¨úÓ¦W¦r«Ü³Â·Ð¡A¦]¦¹¥Î¡u@@:¡v¥N´À¡C
ENTER «ü¥O¯à²¤Æ«Ø¥ß°ïÅ|®Øªº¤u§@¡A¥¦·|§¹¦¨¥H¤U¤T¥ó¨Æ±¡¡G①§â RBP ±À¤J°ïÅ|¡F②§â RSP ¤§È¦s¤J RBP ùØ¡F③«O¯d°Ï°ìÅܼƪºªÅ¶¡¡C¦³Ãö RBP ¼È¦s¾¹¡B°ïÅ|®Øµy«á¤¶²Ð¡CENTER ªº»yªk¬O¡G
ENTER ¹Bºâ¤¸1,¹Bºâ¤¸2
³o¸Ìªº¹Bºâ¤¸1 »P¹Bºâ¤¸2 ³£¥u¯à¬O±`¼Æ¡C¹Bºâ¤¸1¥Nªín¬°°Ï°ìÅܼƫO¯d¦h¤Ö¦ì¤¸²ÕªºªÅ¶¡¡A¦pªG°Æµ{¦¡¨S¦³°Ï°ìÅܼơA¬G¥i¥Î¡uENTER 0,0¡v¡A³o¼Ë´N¬Û·í©ó¡G
push rbp mov rbp,rsp
¦pªG°Æµ{¦¡¦³¨âÓ¸ê®ÆÃþ«¬¬O QWORD ªº°Ï°ìÅܼơA¦û¥Î¤Q¤»Ó¦ì¤¸²Õ¡A¥i¥Î¡uENTER 16,0¡v¡Aµ¥®Ä©ó¤U±ªº«ü¥O¡G
push rbp mov rbp,rsp sub rsp,16
¹Bºâ¤¸2¬O¥i¥H¤K¦ì¤¸ªº±`¼Æ¡A¥Î¨Ó¤ä´©±_ª¬°Æµ{¦¡¡A´N¬O«ü¤@ӰƵ{¦¡¥Ò¤º¥]§t¥t¤@ӰƵ{¦¡¤A¡A¦Ó¤A¯à°÷¨Ï¥Î¥Òªº°Ï°ìÅܼơC³o¸Ìªº¥]§t°Æµ{¦¡¤A¡A¨Ã¤£¬O©I¥s°Æµ{¦¡¤A¡A¦Ó¬Oì©lµ{¦¡¤¤°Æµ{¦¡¥Ò¸Ì±¤S¦³°Æµ{¦¡¤Aªº·N«ä¡A¦p¤U±µ{¦¡¡G
°Æµ{¦¡¥Ò¡@¡@PROC ¡@¡@¡@¡@¡@¡@enter 16,0 ⁝ ¡@°Æµ{¦¡¤A PROC ⁝ ¡@°Æµ{¦¡¤A ENDP ⁝ °Æµ{¦¡¥Ò¡@¡@ENDP
¦b³oºØ±¡§Î¤U¡A°Æµ{¦¡¥Ò¨Ï¥Î¡uENTER xx,0¡v¡A°Æµ{¦¡¤A¨Ï¥Î¡uENTER yy,1¡v¡C³oºØ±_ª¬°Æµ{¦¡¦]¬°¯àŪ¨ú¤W¤@¼h°Æµ{¦¡ªº°Ï°ìÅܼơA·|Åܱo«Ü½ÆÂø¡A¦]¦¹¹³ C »y¨¥´N¸T¥Î³oºØ°Æµ{¦¡¡Aªì¾ÇªÌ»P¦Ñ¤â³£³Ì¦n¤Ö¥Î¡C
LEAVE «ü¥O¨S¦³¹Bºâ¤¸¡A¥¦¬O¥Î¨Ó§R¥h°ïÅ|®Øªº¡A»yªk¬O¡G
LEAVE
LEAVE ªº¹Lµ{«ê¦n»P ENTER ¬Û¤Ï¡G①§â RBP ¤§È¦s¤J RSP ùØ¡F②¦Û°ïÅ|¼u¥X¤@¼ÆȨì RBP¡CLEAVE ¨Ã¨S¦³¹³ ENTER ¨º¼Ë¦³¡uADD RSP,XX¡vªº¹Lµ{¡A¨Æ¹ê¤W¤]¤£¶·³oÓ¥\¯à¡A¦]¬° LEAVE ·|§âì¨Ó¦s©ó RBP ¤¤ªº°ïÅ|³»¨ú¦^¡A³o¼Ë´N§¹¦¨§R°£°Ï°ìÅܼƪº¥\¯à¤F¡CÁ`¤§¡ALEAVE «ü¥O¬Û·í©ó©³¤U¨âÓ«ü¥Oªº²Õ¦X¡G
mov rsp,rbp pop rbp
StrToInt ¯à§â¥Hªü©Ô§B¼Æ¦r²Õ¦¨ªº¦r¦ê¡]©³¤UºÙ¬°¼Æ¦r¦r¦ê¡^Åܦ¨¤Q¤»¶i¦ìÂù¦r²Õ¼Æ¡]Âù¦r²Õ§Y 32 ¦ì¤¸¡^¡C¨ä쫬¬°¡G
invoke StrToInt,\
lpSrc ; string to be converted
StrToInt ¥u¦³¤@ӰѼơA¥H¹sµ²§Àªº¼Æ¦r¦r¦ê¦ì§}¡A¦¹¦r¦ê¥²¶·«ö¥H¤U¦C¶¶§Ç²Õ¦¨¡G①¡u-¡v¸¹¥Nªít¼Æ¡A¦pªG¥¿¼Æ¥u¯à¬Ù²¤¤£¥i¼g¥X¨Ó¡F②µM«á¬O¼ÆÓªü©Ô§B¼Æ¦r¡A0¡ã9¡A²Õ¦¨ªº¤å¦r¡F③³Ì«á¬O¡u0¡vªí¥Ü¦r¦êµ²§ô¡C©I¥s StrToInt «e¥²¶·¥[¤W
INCLUDE SHLWAPI.INC ;¤º§t StrToInt ªºì«¬
INCLUDELIB SHLWAPI.LIB
YÂà´«¥¢±Ñ¡A¦^¶ÇȬ°¹s¡FY¦¨¥\¡A¦^¶ÇȬ°¦r¦êÂà´««áªº¼ÆÈ¡C¨Ò¦p
szNumber DB "314",0 ⁝ invoke StrToInt,OFFSET szNumber
©I¥s§¹ StrToInt ¤§«á¡AEAX ¬° 13AH¡A§Y¤Q¶i¦ìªº 314¡CY szNumber ¬°¡u"314PI"¡v¡A¨º»ò StrToInt ÁÙ¬O¯à°÷Âà´«¡A¦ý¥u¨ì 4 ¬°¤î¡A«á±ªºµLªkÂà´«¡A©Ò¥H EAX ¬° 314¡C
¶Ç¤J StrToInt ªº¼Æ¦r¦r¦ê¥i¥H¬OÂù¦r²ÕµL¸¹¼Æ©ÎÂù¦r²Õ¦³¸¹¼Æ¡AÂà´««á³£Åܦ¨¤Q¤»¶i¦ìªºÂù¦r²Õ¼Æ¡A¦s©ó EAX ªð¦^¡C
°²¦p¼Æ¦r¦r¦ê¬OµL¸¹¼Æ¡A¨º»ò½d³ò¦b "0"¡ã"4294967295"¡AÂà´««á EAX ¦b 0¡ã0FFFF FFFFH¡F
°²¦p¼Æ¦r¦r¦ê¬O¦³¸¹¼Æ¡A¨º»ò½d³ò¦b "¡Ð2147483648"¡ã"2147483647"¡AÂà´««á EAX ¦b 8000 0000H¡ã7FFF FFFFH¡C
ÁöµM¤W±´£¨ì¼Æ¦r¦r¦ê¦³¨º¼Ëªº½d³ò¡A¦ý¨Æ¹ê¤W¥i¥H¶W¹L¡A¶W¹Lªº³¡¤À·|¡u¦^±²¡v¡C¨Ò¦p¼Æ¦r¦r¦ê¬O "4294967296"¡AÂà´««á EAX ¬° 0¡F¼Æ¦r¦r¦ê¬O "4294967297"¡AÂà´««á EAX ¬° 1¡F¼Æ¦r¦r¦ê¬O "4294967298"¡AÂà´««á EAX ¬° 2¡K¡K¨Ã¤£·|µo¥Í¿ù¡A¦ýµ²ªG»¡¬O¿ù»~«o¤]¯à²z¸Ñ¡C¦pªGn¼Æ¦r¦r¦ê¶W¹L¦¹½d³ò¡A¥i§ï¥Î StrToInt64Ex API¡C
wsprintf ¬O¼Ò¥é C »y¨¥ªº printf ¨ç¦¡¡A¥i¥H¼ÆÓÅܼƩM¦r¦ê¨Ì¾Ú®æ¦¡±±¨î¦r¦ê¤¤«ü©wªº®æ¦¡¡A¼g¨ì¬YÓ°O¾ÐÅé¤W¡Cwsprintf ¥Îªk¬O¡G
invoke wsprintf,\ lpOut,\ ; pointer to buffer for output lpFmt,\ ; pointer to format-control string ⁝ ; optional arguments
lpOut »P lpFmt ³£¬O¦r¦êªº¦ì§}¡A«eªÌ¬O¿é¥Xªº½w½Ä°Ï¦r¦ê¦ì§}¡A«áªÌ¬O®æ¦¡±±¨î¦r¦êªº¦ì§}¡F¦Ó²Ä¤TӰѼƥH«á¬OÅܼƩμȦs¾¹ªº¦Cªí¡A¨äÁ`¼Æ¸ò®æ¦¡±±¨î¦r¦ê¤¤¡u%¡vªºÓ¼Æ¬Û¦P¡C
®æ¦¡±±¨î¦r¦ê¼Ð§t®æ¦¡³W½d¡]format specifications¡^¤Î¨ä¥L¤å¦r¡Awsprintf ·|¨Ì®æ¦¡³W½dªº¶¶§Ç°t¦XÅܼƩμȦs¾¹ªº¦Cªí¡A¤@¤@±NÅܼƩM¦r¦êÂà´«¦Ó¼g¤J½w½Ä°Ï¦r¦ê¡C®æ¦¡³W½d³£¥H¦Ê¤À¤ñ²Å¸¹¡]%¡^¶}©l¡A¨ä¼Ë¤l¦p¤U¡A¨ä¤¤¥H¤@¹ï¤¤¬A¸¹¬A¦íªº¥i¥H¬Ù²¤¡G
%[-][#][0][width][.precision]type
¦pªG wsprintf °õ¦æ¦¨¥\¡A¦^¶ÇȬO¦³¦h¤ÖÓ¦r¤¸¦s¤J½w½Ä°Ï¡]¤£§tµ²§Àªº¡u0¡v¡^¡F¦pªG¥¢±Ñ¡A¦^¶ÇȤp©ó®æ¦¡±±¨î¦r¦êªº¦r¤¸Ó¼Æ¡C
¨Ò¦p©³¤Uªº¨Ò¤l¡G
.DATA kilo DQ 1024 szKilo DB "1K¬O",0 szFmt DB "%s%d¡A¬Û·í©ó¤Q¤»¶i¦ìªº%x¡C",0 szBuffer DB 80 DUP (?) ⁝ lea rcx,szBuffer lea rdx,szFmt lea r8,szKilo mov r9,kilo mov QWORD PTR [rsp+20h],r9 call wsprintfA
®æ¦¡±±¨î¦r¦ê¤¤ªº¡u%¡v¦r¤¸¦@¦³¤TÓ¡A¦]¦¹®æ¦¡³W½d¤]¦³¤TÓ¡]¥H¥Õ¦â¼Ð¥Ü¡^¡A¦ÓÅܼƻP¦r¦ê¦Cªí¤¤¤]¦³¤TÓ¤¸¯À¡C³o¤TӮ榡³W½d¨Ì§Ç¬O¡u%s¡v( ¦r¦ê )¡B¡u%d¡v( ¤Q¶i¦ì¦³¸¹¼Æ )¡B¡u%x¡v( ¤Q¤»¶i¦ì¼Æ )¡A¦]¦¹ÅܼƻP¦r¦ê¦Cªí¤¤¨Ì§Ç¬O¦r¦ê¦ì§}¤Î¨âÓÅÜ¼Æ ( kilo )¡C°õ¦æ«á¡AwsprintfA ·|§â szBuffer ¦r¦ê·|Åܦ¨
1K¬O1024¡A¬Û·í©ó¤Q¤»¶i¦ìªº400¡C
¨ä¤¤¡©1K¬O¡ª¬O¥Ñ¡u%s¡v¹Bºâªºµ²ªG¡A¡©1024¡ª¬O¡u%d¡vªºµ²ªG¡A¡©400¡ª¬O¡u%x¡vªºµ²ªG¡C
LOCAL °²«ü¥O¬O¥Î¨Ó©w¸q°Ï°ìÅÜ¼Æ ( local variables¡A¤j³°Â½¦¨§½³¡Åܶq )¡C°Ï°ìÅܼƬ۹ï©ó¥þ°ìÅÜ¼Æ ( global variables¡A¥þ§½Åܶq ) ¦Ó¨Óªº¡A¥¦Ìªº®t§O¦b©ó°Ï°ìÅܼƥu¯à¦b¬YӰƵ{¦¡¤¤©w¸q¡A¤]¥u¦³¦b³oӰƵ{¦¡¤¤¤~¯à¦s¨ú ( ¥]§tקï»PŪ¨ú )¡A¨ä¥L°Æµ{¦¡»P¥Dµ{¦¡³£µLªk¦s¨ú¡F¦Ó¥þ°ìÅܼƫh¬O¥ô·N°Æµ{¦¡©Î¥Dµ{¦¡³£¯à¦s¨ú¡C¤]¦]¬°¥þ°ìÅܼƦb¥ô¦ó¦a¤è³£¥i¥Hקï¨ä¼ÆÈ¡A¥HP©ó³y¦¨»P«Ü³\¦h°Æµ{¦¡¬ÛÃö¡A¹ï©óµ{¦¡ªººûÅ@·|¼W¥[³\¦ht¾á¡A¤×¨ä¬Oµ{¦¡«Ü¤j®É§ó¥[§xÃø¡C²{¥NªºÆ[©À»{¬°¡A¤£¥²nªº¥þ°ìÅܼƬO¼gµ{¦¡ªºÃa²ßºD¤§¤@¡A¦]¦¹¯à¤£¨Ï¥Î´N§O¥Î¡A¾¨¶q¨Ï¥Î°Ï°ìÅܼơC
¨º»ò¦p¦ó©w¸q°Ï°ìÅܼƩO¡H¦b²Õ¦X»y¨¥¸Ì¨Ï¥Î LOCAL °²«ü¥O¡A¥¦ªº»yªk¬O¡G
LOCAL ÅܼƦWºÙ[¤¸¯ÀÓ¼Æ]:¸ê®ÆÃþ«¬,...
©w¸q°Ï°ìÅܼƦ³´X¶µ²Ó¸`nª`·N¡G
¨Ò¦p©³¤Uªº¨Ò¤l¡A©w¸q¤F¨âÓ¥|¦r²Õªº°Ï°ìÅܼơAqRead »P qWritten¡A»P¤@Ó 24 ¦ì¤¸²Õªøªº sNumber ¦r¦ê¡G
LOCAL qRead:QWORD,qWritten:QWORD LOCAL sNumber[24]:BYTE
§Ú̪¾¹D¥þ°ìÅܼƬO¦s©ñ¦b¡u.DATA¡v©Î¡u.DATA?¡v°Ï¬q¤º¡A¨º»ò°Ï°ìÅܼƦs©ñ¦bþ¸Ì©O¡Hµª®×¬O¦b°ïÅ|¸Ì¡A¤]´N¬O³oÓì¦]¡A¥u¦³¦b°õ¦æ®É¤~¯à½T»{°Ï°ìÅܼƪº¦ì§}¡C¤]¦]¬°¦p¦¹¡A¦pªGn¨ú±o°Ï°ìÅܼƪº¦ì§}¡A¥²¶·¨Ï¥Î¡uLEA ¥Øªº¹Bºâ¤¸,°Ï°ìÅܼơv¡AµLªk¨Ï¥Î¡uMOV ¹Bºâ¤¸,OFFSET °Ï°ìÅܼơv³o¼Ëªº«ü¥O¡C
©³¤U¥ý¨ÓÂsÄý GCD_LCM.ASM ªºì©lµ{¦¡¡Aºò±µµÛ»¡©ú¼¶¼g°Æµ{¦¡®ÉÀ³ª`·N¨Æ¶µ¡A¥]§t¦p¦ó¦b°ïÅ|¤¤¦w±Æ°Ï°ìÅܼƻP¨ä¦s¨ú¡C
©³¤U¬O GCD_LCM.ASM ì©lµ{¦¡ªº¤º®e¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
25 26 27 28
29 30 31 32
33 34 35 36
37 38 39 40
41 42 43 44
45 46 47 48
49 50 51 52
53 54 55 56
57 58 59 60
61 62 63 64
65 66 67 68
69 70 71 72
73 74 75 76
77 78 79 80
81 82 83 84
85 86 87 88
89 90 91 92
93 94 95 96
97 98 99 100
101 102 103 104
105 106 107 108
109 110 111 112
113 114 115 116
117 118 119 120
121 122 123 124
125 126 127 128
129 130 131 132
133 134 135 136
137 138 139 140
141 142 143 144
145 146 147 148
149 150 151 152
153 154 155 156
157 158 159 160
161 162 163 164 |
;pºâ¨â¾ã¼Æªº³Ì¤j¤½¦]¼Æ¡]GCD¡^»P³Ì¤p¤½¿¼Æ¡]LCM¡^
;²ÕĶ»P³sµ²¡G
;path e:\masm32\bin64;%path%
;set link=/subsystem:console /entry:main
;ml64 gcd_lcm.asm
OPTION CASEMAP:NONE
EXTRN GetStdHandle:PROC,WriteConsoleA:PROC,ReadConsoleA:PROC
EXTRN ExitProcess:PROC,StrToIntA:PROC,wsprintfA:PROC
INCLUDELIB e:\masm32\lib64\kernel32.lib
INCLUDELIB e:\masm32\lib64\shlwapi.lib
INCLUDELIB e:\masm32\lib64\user32.lib
STD_INPUT_HANDLE EQU -10
STD_OUTPUT_HANDLE EQU -11
INVALID_HANDLE_VALUE EQU -1
;***************************************************************************************************
.CONST
sStr1 DB "pºâ¨â¥¿¾ã¼Æªº³Ì¤j¤½¦]¼Æ»P³Ì¤p¤½¿¼Æ",0dh,0ah,"¿é¤J²Ä¤@Ó¥¿¾ã¼Æ¡]¤p©ó¤@»õ¡^¡G"
sStr2 DB "¿é¤J²Ä¤GÓ¥¿¾ã¼Æ¡]¤p©ó¤@»õ¡^¡G"
szFmt DB "%d»P%dªº³Ì¤j¤½¦]¼Æ¬O%d¡A³Ì¤p¤½¿¼Æ¬O%I64u¡C",0
sError1 DB "½Ð¿é¤Jªü©Ô§B¼Æ¦r¥B¤£¯à¬°¹s¡C"
sError2 DB "µLªk¨ú±o¼Ð·Ç¿é¥X/¿é¤J¸Ë¸m¡C"
;***************************************************************************************************
.DATA
hOut DQ ?
hIn DQ ?
n1 DQ ?
n2 DQ ?
Gcd DQ ?
Lcm DQ ?
sBuffer DB 48 DUP (0)
;***************************************************************************************************
.CODE
;---------------------------------------------------------------------------------------------------
;§Q¥ÎÁÓÂà¬Û°£ªk¡Apºâ¨â¾ã¼ÆªºGCD¡F¦A§Q¥ÎLCM¡×num1*num2/GCD¨DLCM
;¿é¤J¡Gnum1¡Bnum2¨âÓ¾ã¼Æ
;¡@¡@¡@pGcdLcm¡ÐGCD»PLCMªº¦s©ñ¦ì§}¡A«ü¦V¨âÓ¥|¦r²Õ¡A¦ì§}§Cªº¦sGCD¡A°ªªº¦sLCM
find_gcd_lcm PROC num1:QWORD,num2:QWORD,pGcdLcm:QWORD
mov r10,rcx
mov r11,rdx
mov pGcdLcm,r8
cmp rcx,rdx ;RCX¡×num1¡ARDX¡×num2
jb below ;YRCX¤p©óRDX¡A«h¸õÅD¨ìbelow
again: xchg rcx,rdx ;¾l¼ÆÅܬ°¤U¦¸ªº°£¼Æ
below: mov rax,rdx
xor rdx,rdx ;RDX:RAX¡]³Q°£¼Æ¡^°£¥HRCX¡]°£¼Æ¡^
div rcx ;°£¼Æ¡×RCX
or rdx,rdx ;¾l¼Æ¬°RDX¡AY¬°¹s«h³Ì«á¤@¦¸ªº°£¼Æ§Y¬°GCD
jnz again
mov [r8],rcx;§â³Ì¤j¤½¦]¼Æ¦s¤JpGcdLcm©Ò«üªº¦ì§}
mov rax,r10
mul r11
div rcx
mov [r8+8],rax
ret
find_gcd_lcm ENDP
;---------------------------------------------------------------------------------------------------
;§âpStr¦ì§}¤Wªº¦r¦ê¡]ªølenStrӦ줸²Õ¡^¦L¦b¼Ð·Ç¿é¥X¸Ë¸m¡]hOutput¡^¿Ã¹õ¤W¡A·í°µ´£¥Ü¨Ï¥ÎªÌ¸Ó¿é¤J¤°»ò
;¸ê®Æ¡Aµ¥¨Ï¥ÎªÌ¿é¤J§¹²¦¡AÂà´«¾ã¼Æ¼ÆÈ¡A¦s©óRAX
;¿é¤J¡GhOutput¡Ð¼Ð·Ç¿é¥X¸Ë¸m¥N½X¡A¦L¥X´£¥Ü¦r¦ê®É¨Ï¥Î
;¡@¡@¡@hInput¡Ð¼Ð·Ç¿é¤J¸Ë¸m¥N½X¡A¨Ï¥ÎªÌ¿é¤J¦r¦ê®É¨Ï¥Î
;¡@¡@¡@pStr¡Ð´£¥Ü¦r¦ê¦ì§}
;¡@¡@¡@lenStr¡Ð´£¥Ü¦r¦êªø«×
;¿é¥X¡GRAX¡×0¡Ð¥¢±Ñ
;¡@¡@¡@RAX¡Ú0¡Ð¦¨¥\¡ARAX¡×¨Ï¥ÎªÌ¿é¤Jªº¥¿¾ã¼Æ
input_integer PROC hOutput:QWORD,hInput:QWORD,pStr:QWORD,lenStr:QWORD
LOCAL qRead:QWORD,qWritten:QWORD
LOCAL sNumber[24]:BYTE
sub rsp,28h
mov hOutput,rcx ;§â«e¥|ӰѼƫO¦s¦b°ïÅ|¸Ì
mov hInput,rdx
mov pStr,r8
mov lenStr,r9
mov rdx,pStr
mov r8,lenStr
lea r9,qWritten
mov QWORD PTR [rsp+20h],0
call WriteConsoleA ;¦L¥XpStr©Ò«ü¦ì§}ªº¦r¦ê
or rax,rax
jz exit
mov rcx,hInput
lea rdx,sNumber
mov r8,14
lea r9,qRead
mov QWORD PTR [rsp+20h],0
call ReadConsoleA ;¿é¤J¼ÆÈ(¦¹¬°¼ÆȧΦ¡ªºASCII¦r¦ê)
or rax,rax
jz exit
lea rcx,sNumber
call StrToIntA ;§â¼ÆȧΦ¡ªºASCII¦r¦êÅܦ¨¼ÆÈ
exit: add rsp,28h
ret
input_integer ENDP
;---------------------------------------------------------------------------------------------------
main PROC
sub rsp,38h
;¨ú±o¼Ð·Ç¿é¥X¿é¤J¸Ë¸m¥N½X¡A¦pªG¥¢±Ñ¸õ¦Üerr2³B¡A¦L¥X¿ù»~°T®§«á°h¥XGCD_LCM
mov rcx,STD_OUTPUT_HANDLE
call GetStdHandle
cmp rax,INVALID_HANDLE_VALUE
je err2
mov hOut,rax
mov rcx,STD_INPUT_HANDLE
call GetStdHandle
cmp rax,INVALID_HANDLE_VALUE
je err2
mov hIn,rax
;¦L¥X´£¥Ü¡AÅý¨Ï¥ÎªÌ¿é¤J¨âÓ¥¿¾ã¼Æ¡CYµo¥Í¿ù»~¡A¸õ¦Üerr1¦L¥X
;°T®§«á°h¥XGCD_LCM¡F§_«h§â¿é¤Jªº¨â¥¿¾ã¼Æ¤À§O¦s©ón1¡Bn2
mov rcx,hOut
mov rdx,hIn
lea r8,sStr1
mov r9,SIZEOF sStr1
call input_integer ;¿é¤J²Ä¤@Ó¾ã¼Æ
or rax,rax
jz err1
mov n1,rax
mov rcx,hOut
mov rdx,hIn
lea r8,sStr2
mov r9,SIZEOF sStr2
call input_integer ;¿é¤J²Ä¤GÓ¾ã¼Æ
or rax,rax
jz err1
mov n2,rax
;¨Dn1¡Bn2ªº³Ì¤j¤½¦]¼Æ»P³Ì¤p¤½¿¼Æ¡A¤À§O¦s¤JGcd¡BLcmÅܼƸÌ
mov rcx,n1
mov rdx,n2
lea r8,Gcd
call find_gcd_lcm
;§â¡un1»Pn2ªº³Ì¤j¤½¦]¼Æ¬OGcd¡A³Ì¤p¤½¿¼Æ¬OLcm¡C¡v¦r¦ê¦s¤JsBuffer¤¤¡C
;¦¹¥|Ó¼Æȳ£¤w³QwsprintfAÂà´«¦¨¤Q¶i¦ì¼Æ§Î¦¡ªº¦r¦ê¡C
lea rcx,sBuffer
lea rdx,szFmt
mov r8,n1
mov r9,n2
mov r10,Gcd
mov r11,Lcm
mov QWORD PTR [rsp+20h],r10
mov QWORD PTR [rsp+28h],r11
call wsprintfA
;§â¸Ó¦r¦ê¦L¥X¨Ó
lea rdx,sBuffer
pnt_it: mov rcx,hOut
mov r8,rax
lea r9,n1
mov QWORD PTR [rsp+20h],0
call WriteConsoleA
jmp @f
err1: lea rdx,sError1
mov rax,SIZEOF sError1
jmp pnt_it
err2: lea rdx,sError2
mov rax,SIZEOF sError2
jmp pnt_it
@@: xor rcx,rcx
call ExitProcess
main ENDP
;***************************************************************************************************
END |
²ÕĶ»P³sµ²ªº¤èªk¡A¸ò«e¤@³¹¬Û¦P¡Anª`·Nªº¬O¥²¶·³]©w¡uset link=/subsystem:console /entry:main¡v¡C
GCD_LCM ªº¶i¤JÂI¦b²Ä 97 ¦æ¡A¡umain PROC¡v¡C±µ¤U¨Óªº²Ä¤@¹D«ü¥O¬O¡usub rsp,38H¡v¡A³o¬O¦]¬°¦b main ¤¤©I¥s¤F¦n´XÓ Win64 API ¤Î input_integer¡Bfind_gcd_lcm °Æµ{¦¡¡A¥¦Ì©Ò»Ýªº°Ñ¼Æn«O¯d¦b°ïÅ|¤W¡C§Q¥Î¡usub rsp,38H¡v¡A¨Ï RSP ´î¤Ö 38H Ӧ줸²Õ¡A°ïÅ|³»©¹§C¦ì§}²¾°Ê¡A´N¯à«O¯d 38 Ӧ줸²ÕªºªÅ¶¡¡C¦b main ¤¤³Ì¦h°Ñ¼Æªº°Æµ{¦¡¬O wsprintfA¡A¦@¦³¤»Ó°Ñ¼Æ¡A©Ò¥H¨Ï RSP ´î¥h 38H ( °Ñ¾\²Ä¤G³¹¦b°ïÅ|¤¤«O¯d°Ñ¼ÆªÅ¶¡»P¹ï»ô¸`ªºÃä¬Éªºµ¦²¤ )¡C
main ¥Dµ{¦¡¤jP¥i¤À¬°¤KÓ³¡¤À¡G
¥»³¹¤@¶}©l´N´£¹L¡A¥»³¹ªº«ÂI¬O©I¥s°Æµ{¦¡ªº¹Lµ{¡A¦Ó¥B¨ä¥L³¡¤À¤£¬O¸Ñ»¡¹L¡A´N¬O¤£Ãø¡A©Ò¥H¤£»¡©ú¤F¡C©Ò¥H¡A©³¤U¨Ó¬Ý¬Ý²Ä¤T³¡¤À»P²Ä¥|³¡¤À¡C
input_integer ·|§â´£¥Ü¦r¦ê¡A¤]´N¬O¡upºâ¨â¥¿¾ã¼Æªº³Ì¤j¤½¦]¼Æ¡K¡K¿é¤J²Ä¤@Ó¥¿¾ã¼Æ¡K¡K¡v³o¼Ëªº¦r¦êÅã¥Ü¦b¡u©R¥O´£¥Ü¦r¤¸¡v¤º¡A¦P®É¤]nÅý¨Ï¥ÎªÌ¿é¤J¡A¦]¦¹¤@©w»Ýn¶Ç¤J¨âӰѼơG¼Ð·Ç¿é¥X¸Ë¸m¥N½X¤Î¼Ð·Ç¿é¤J¸Ë¸m¥N½X¡C¦A¥[¤Wn¦L¥X¦r¦ê¡A¤@©w¤]n¦³¿é¤J¦r¦ê¦ì§}¤Î¦r¦êªø«×¡C³o¼Ë¥[°_¨Ó´N¦³¥|ӰѼƤF¡C¦]¦¹«Å§i input_integer ªºµ{¦¡½X¦p¤U¡G
;§âpStr¦ì§}¤Wªº¦r¦ê¡]ªølenStrӦ줸²Õ¡^¦L¦b¼Ð·Ç¿é¥X¸Ë¸m¡]hOutput¡^¿Ã¹õ¤W¡A·í°µ´£¥Ü¨Ï¥ÎªÌ¸Ó¿é¤J¤°»ò
;¸ê®Æ¡Aµ¥¨Ï¥ÎªÌ¿é¤J§¹²¦¡AÂà´«¾ã¼Æ¼ÆÈ¡A¦s©óRAX
;¿é¤J¡GhOutput¡Ð¼Ð·Ç¿é¥X¸Ë¸m¥N½X¡A¦L¥X´£¥Ü¦r¦ê®É¨Ï¥Î
;¡@¡@¡@hInput¡Ð¼Ð·Ç¿é¤J¸Ë¸m¥N½X¡A¨Ï¥ÎªÌ¿é¤J¦r¦ê®É¨Ï¥Î
;¡@¡@¡@pStr¡Ð´£¥Ü¦r¦ê¦ì§}
;¡@¡@¡@lenStr¡Ð´£¥Ü¦r¦êªø«×
;¿é¥X¡GRAX¡×0¡Ð¥¢±Ñ
;¡@¡@¡@RAX¡Ú0¡Ð¦¨¥\¡ARAX¡×¨Ï¥ÎªÌ¿é¤Jªº¥¿¾ã¼Æ
input_integer PROC hOutput:QWORD,hInput:QWORD,pStr:QWORD,lenStr:QWORD
³o¤]´N¬O¦b GCD_LCM.ASM ªº²Ä 57¡ã65 ¦æ¡C³q±`¦b«Å§i°Æµ{¦¡®É¡A¤]n¾i¦¨¨}¦n²ßºD¡A¦b°Æµ{¦¡«e¥[¤Wµù¸Ñ¡A¥H»¡©ú³oӰƵ{¦¡ªº¥Î³~¡B°Ñ¼Æ¤Î¦^¶ÇÈ¡A¥H§Q¤§«áקï¡C
³o¥|ӰѼƥ²¶·¼g¦b¡uPROC¡v¤§«á¡A¥H¡u°Ñ¼Æ¦WºÙ:¸ê®ÆÃþ«¬¡vªº¤è¦¡«Å§i¡A¦pªG¦³«Ü¦h°Ñ¼Æ´N¥H±µ¦b«á±¡A¥H¡u,¡v¹j¶}¡C³o¨Ç¡u°Ñ¼Æ¦WºÙ¡v¥u¯à¦b³oӰƵ{¦¡ªº½d³ò¦³®Ä¡A¤]´N¬O»¡¥u¦³³oӰƵ{¦¡¦s¨ú¡A¨ä¥L°Æµ{¦¡©Î¥Dµ{¦¡³£µLªk¦s¨ú¡C¦pªG¦b°Æµ{¦¡¤¤·Q¨Ï¥Î¨ì¥iÅܪº¼È¦s¾¹ ( ¨£²Ä¹s³¹¥iÅÜ»P¤£Åܪº¼È¦s¾¹ )¡A¤]¥i¥H¨Ï¥Î USES ±N¨ä«O¦s°_¨Ó¡C¨Ò¦p·Qn«O¦s RSI ¤Î RDI¡A¥i¥H³o¼Ë«Å§i ( ¼È¦s¾¹¤§¶¡¥HªÅ¥Õ¤À¹j )¡G
input_integer PROC USES rsi rdi hOutput:QWORD,hInput:QWORD,pStr:QWORD,lenStr:QWORD
¨º main ¤S¦p¦ó©I¥s input_integer ©O¡H¦b GCD_LCM.ASM ¤¤©I¥s input_integer ªºµ{¦¡½X¦³¨â³B¡A¦p¤U¡G
¿é¤J²Ä¤@Ó¾ã¼Æ | ¿é¤J²Ä¤GÓ¾ã¼Æ |
mov rcx,hOut mov rdx,hIn lea r8,sStr1 mov r9,SIZEOF sStr1 call input_integer ;¿é¤J²Ä¤@Ó¾ã¼Æ |
mov rcx,hOut mov rdx,hIn lea r8,sStr2 mov r9,SIZEOF sStr2 call input_integer ;¿é¤J²Ä¤GÓ¾ã¼Æ |
¥Dµ{¦¡§â°Ñ¼Æ¶Çµ¹°Æµ{¦¡®É¡A¤£¯à¥Î¦b«Å§i°Æµ{¦¡®É¡A©ñ¦b PROC ¤§«áªº¡u°Ñ¼Æ¦WºÙ¡v¡A¥²¶·¨Ì¾Ú x64 ©I¥sºD¨Ò¡C¤]´N¬O«e¥|ӰѼƥ²¶·¦s¤J RCX¡BRDX¡BR8¡BR9 ¼È¦s¾¹¸Ì¡A¶W¹Lªº³¡¤Àn¦s¤J°ïÅ|¸Ì ( ¹³¬O [RSP+20h]¡B[RSP+28h]¡K¡K )¡A³Ì«á¤~°õ¦æ CALL «ü¥O¡C¹³¤W±ªí¤¤ªº¼Ë¤l¡A¤]´N¬O GCD_LCM.ASM ªº²Ä 113¡ã117 ¦æ©Î¬O²Ä 122¡ã126 ¦æ¡C
¦pªG°Æµ{¦¡¤¤n¥Î¨ì°Ï°ìÅܼơA¥i¥H¥Î¡uLOCAL¡v°²«ü¥O©w¸q°Ï°ìÅܼơCLOCAL ¥²¶·ºò±µµÛ PROC ¤§«á¡A¹³©³¤Uªº¼Ë¤l¡G
input_integer PROC hOutput:QWORD,hInput:QWORD,pStr:QWORD,lenStr:QWORD LOCAL qRead:QWORD,qWritten:QWORD LOCAL sNumber[24]:BYTE
¦b°Æµ{¦¡¤¤¡An¦s¨ú°Ñ¼Æ¡A¤~¨Ï¥Î©ñ¦b PROC ¤§«áªº¡u°Ñ¼Æ¦WºÙ¡v¡Cn¦s¨ú°Ï°ìÅܼƮɡA¤]¬O¥Î LOCAL ©w¸q®ÉÔªºÅܼƦWºÙ¡C°Ñ¼Æ»P°Ï°ìÅܼơA³£¥u¦³¦b¨ä«Å§i»P©w¸qªº°Æµ{¦¡¤º¤~¦³®Ä¡A¤~¯à¦s¨ú¡Cì¦]«Ü²³æ¡A¥¦Ì³£¦s©ñ¦b°ïÅ|¤¤¡A©I¥s§¹²¦¡A°ïÅ|®Ø¤]´N¾P·´¤F¡A·íµM¨ä¥L°Æµ{¦¡¬Æ¦Ü¥Dµ{¦¡³£µLªk¦s¨ú¡C
©³¤Uªº¨Ò¤l´N¬O¦b input_integer §â쥻¦s¦b¥|ӼȦs¾¹ªº°Ñ¼ÆÈ¡A¦s¤J°Ñ¼Æ¤¤¡A¨£¡uGCD_LCM.ASM¡vªº²Ä 69¡ã72 ¦æ¡C³q±`¶i¤J°Æµ{¦¡¥H«á¡A·|°µ³o¥ó¨Æ±¡¡AÅý¼È¦s¾¹¥i¥H¥Î§@¨ä¥L¥Î³~¡A¨Ò¦p°µ¼°£¹Bºâµ¥µ¥¡F·íµM¤]¥i¥H¤£°µ¡Aµø»Ýn¦Ó©w¡C
mov hOutput,rcx ;§â«e¥|ӰѼƫO¦s¦b°ïÅ|¸Ì
mov hInput,rdx
mov pStr,r8
mov lenStr,r9
©³¤U¬O¨ú±o°Ï°ìÅÜ¼Æ sNumber ªº¦ì§}¡A¨£¡uGCD_LCM.ASM¡vªº²Ä 91 ¦æ¡G
lea rcx,sNumber
¨Æ¹ê¤W¡A¦b«Å§i°Æµ{¦¡¡B©w¸q°Ï°ìÅܼơA¥H¤Î¦bµ²§ô°Æµ{¦¡®É°õ¦æ RET «ü¥Oªº¦a¤è¡A²ÕĶ¾¹³£·|²K¥[¤@¨Ç«ü¥O¡AÅý¦b°Æµ{¦¡¤§¤¤¥H RBP ¬°°ò·Ç¦s¨ú°Ñ¼Æ¤Î°Ï°ìÅܼơC©³¤Uªºªí®æ¡A¬O¥H input_integer ¬°¨Ò¤l¡A§âì©lµ{¦¡»P²ÕĶ«áµ{¦¡½X¨Ã¦C§@¬°¤ñ¸û¡G
ì©lµ{¦¡ | ²ÕĶ«áµ²ªG |
input_integer PROC hOutput:QWORD,hInput:QWORD,\ pStr:QWORD,lenStr:QWORD LOCAL qRead:QWORD,qWritten:QWORD LOCAL sNumber[24]:BYTE sub rsp,28h mov hOutput,rcx mov hInput,rdx mov pStr,r8 mov lenStr,r9 ⁝ lea rcx,sNumber call StrToIntA exit: add rsp,28h ret input_integer ENDP |
push rbp mov rbp,rsp add rsp,-40 sub rsp,28h mov [rbp+10h],rcx mov [rbp+18h],rdx mov [rbp+20h],r8 mov [rbp+28h],r9 ⁝ lea rcx,[rbp-28h] call StrToIntA add rsp,28h leave ret |
¤Wªí¤¤¡A¥ªÄæ¾í¦â¦r¬O«Å§i input_integer¡A²ÕĶ¦¨¥kÃä¾í¦â¦rªº¡upush rbp¡v»P¡umov rpb,rsp¡v¡F¥ªÄæ¶À¦r¬O©w¸q°Ï°ìÅܼƪº¨â¦æ¡A²ÕĶ«á¶ÈÅܦ¨¤@¹D«ü¥O¡uadd rsp,-40¡v¡F¥ªÄæ¥Õ¦â¦r¬Oµ²§ô°Æµ{¦¡ªð¦^¥Dµ{¦¡ªº¡uret¡v«ü¥O¡A²ÕĶ«áÅܬ°¨â¹D«ü¥O¡uleave¡v»P¡uret¡v¡C¬°¤°»ò·|³o¼Ë©O¡H³o¬O¬°¤F¦s¨ú°Ñ¼Æ¤Î°Ï°ìÅܼƩҰµªº³]©w¡A«Ý·|¨à¥H x64dbg ¹ï input_integer ¶i¦æ³æ¨B®É¡A´N¯à©úÁA¤F¡C
²{¦b´N¥Î x64dbg ¸ü¤J GCD_LCM.EXE¡A¦p¤U¹Ï¡C«e±ªº²Ä 97¡ã110 ¦æ³£¸õ¹L¡A¦Ó³]¸m input_integer °Ñ¼Æªº³¡¤À¤]¸õ¹L¡A¦b§Y±N°õ¦æ¡ucall input_integer¡v«e³]¸m¤¤Â_ÂI ( ¥H·Æ¹«ÂIÀ»¦ì§} 13FBC1100 ³B¡A¦A«ö¡uF2¡vÁä¡A¨£¤U¹ÏÂŦâ®Ø )¡C ª`·N¨ì¤W¹Ï¤Ï²ÕĶ°Ïªº¾í¦â®Ø¤ºªºªð¦^¦ì§}¬O 13FBC1105¡A«Ý·|·|¥Î¨ì¡C¥t¥~¡A¥Hºñ¦â®Ø®Ø°_¨Óªº¬O GCD_LCM.EXE ¶i¤JÂI«áªº²Ä¤@Ó«ü¥O¡A¡usub rsp,38h¡v¡Aèè¤w´£¬°¦ón¨Ï RSP ´î¥h 38H¡A³o¸Ì´N¤£¦AÂØz¡F¦¹®É RSP ¬° 2DF7D8H¡A©Ò¥H´î¥h¤§«á RSP ¬° 2DF7A0H¡A¬Gªð¦^¦ì§}À³¦s¦b°ïÅ|¦ì§} 2DF798H ³B¡C
«ö¤U¡uF9¡vÁä°õ¦æ¡A¨ì¤¤Â_ÂI 13FBC1100 ³B·|°±¤U¨Ó¡A¦A«ö¡uF7¡vÁä°õ¦æ¡ucall input_integer¡v¡A¶i¤J input_integer °Æµ{¦¡¸Ì±¡A¦p¤U¹Ï¡C¥ýÆ[¹î°ïÅ|°Ïªº 2DF798H ¦ì§}¤W¤w±À¤Jªð¦^¦ì§}¡C¦A¨ÓÆ[¹î¤Ï²ÕĶ°Ï¡A¥HÂŦâ®Ø®Ø¦íªº¬O input_integer °Æµ{¦¡¡A»Pì©lµ{¦¡ GCD_LCM.ASM ¤ñ¸û¡A´N·|µo²{¦h¥X¤F¥H¬õ¦â®Ø®Ø¦íªº¥|¦æµ{¦¡½X¡G①¡upush rbp¡v¡B②¡umov rbp,rsp¡v¡B③¡uadd rsp,FFFFFFFFFFFFFFD8¡v¡B④¡uleave¡v¡C °£¤F¦h¥X¥|Ó«ü¥O¥~¡A°Ñ¼Æ»P°Ï°ìÅܼƳ£Åܦ¨¥H¡u[rbp+xx]¡v©Î¡u[rbp-xx]¡vªí¥Ü¡A¨Ò¦p GCD_LCM.ASM ªº²Ä 69¡ã72 ¦æ¬O§â¦s©ó¼È¦s¾¹ªº¥|ӰѼƫO¦s¦b°ïÅ|¤¤¡A쥻ªºµ{¦¡½X¬O
mov hOutput,rcx ;§â«e¥|ӰѼƫO¦s¦b°ïÅ|¸Ì
mov hInput,rdx
mov pStr,r8
mov lenStr,r9
µ²ªGÅܦ¨¤W¹Ï¥Hºñ¦â®Ø®Ø¦íªº«ü¥O¡C
RBP ¬O CPU ¤º¤@Ó 64 ¦ì¤¸ªº¼È¦s¾¹¡A^¤å¦W¦r¥s base pointer register¡A¥i¥H½Ķ¦¨°ò©³«ü¼Ð¼È¦s¾¹¡A³q±`¬O¥Î¨Ó·í°µ°ò·Ç¡A¦s¨ú°ïÅ|¤¤ªº°Ñ¼Æ¥H¤Î°Ï°ìÅܼƥΪº¼È¦s¾¹¡C¹³³oºØ¥H¼È¦s¾¹¬°°ò·Ç¦A¥[¤W©Î´î¥h¤@Ó±`¼Æ¡A·í°µ¦ì§}¡A¦A¨ì¦ì§}¥hŪ¨ú©Î¼g¤J¼ÆȪº¤è¦¡¡A¬O¶¡±µ©w§}ªº¤@ºØ¡C
±q³o¸Ì´N¥i¥H¬Ý¥X¨Ó¡A¦b°Æµ{¦¡¤¤n¦s¨ú°Ñ¼Æ©Î°Ï°ìÅܼơA³£¬O¥H RBP ·í¦¨°ò·Ç¡C¦h¥X¨Óªº«e¨â¹D«ü¥O¡A´N¬O§âì¨Óªº RBP È«O¦s¦b°ïÅ|¸Ì¡AµM«á§â RBP «ü¦V·í«e RSP ©Ò«üªº¦ì§}¡A³o¼Ë¬J¯à«O¦sì¨Óªº RSP È¡A¤]¥i¥H§â·í«e RSP ©Ò«üªº¦ì§}·í°µ¬O°ò·Ç¦ì§}¡A¦s¨ú²Ä¤@ӰѼƮɴN¥H¡u[rbp+10h]¡vªí¥Ü¡B²Ä¤GӰѼƮɴN¥H¡u[rbp+18h]¡vªí¥Ü¡K¡K¡CµM«á RSP ´N¯à¦Û¥Ñ¨Ï¥Î¡A³o¼Ë´N¯à¦b°Æµ{¦¡¸Ì¦AÄ~Äò©I¥s¨ä¥L°Æµ{¦¡©Î Win64 API¡A¦Ó¤£·|¦³°ÝÃD¡Cµ¥¨ì°Æµ{¦¡µ²§ô®É¡A°õ¦æ¦h¥X¨Óªº²Ä¥|¹D«ü¥O¡uleave¡v¥H¨Ï RBP «ì´_ìÈ¨Ã¨Ï RSP ©Ò«üªº°ïÅ|³»¬Oªð¦^¦ì§}¡CLEAVE «ü¥O¹ê»Ú¤W¥i¥H¬Ý¦¨¬O
mov rsp,rbp pop rbp
¦p¦¹¤@¨Ó¡ARSP ´NÁÙ즨ì¨Óªº°ïÅ|³»¤F¡ARBP ¤]«ì´_¦¨è¶i¤J°Æµ{¦¡®ÉÔªº¼ÆȤF¡C
¦h¥X¨Óªº²Ä¤T¹D«ü¥O¬O¡uadd rsp,FFFFFFFFFFFFFFD8¡v¡A³oÓ«ü¥O¬O¦]¬°°Ï°ìÅܼƳy¦¨ªº¡CGCD_LCM.ASM ªº²Ä 66¡ã67 ¦æ¬O¡G
LOCAL qRead:QWORD,qWritten:QWORD LOCAL sNumber[24]:BYTE
³o¨â¦æ¬O©w¸q°Ï°ìÅܼơC¨âÓ¥|¦r²ÕÅܼơA¦@ 16 Ӧ줸²Õ¡A¦A¥[¤W¤@Ó 24 Ӧ줸²Õªº¦r¦êÅܼơAÁ`¦@ 40 Ӧ줸²Õ¡A´«¦¨¤Q¤»¶i¦ì¬O 28H¡C¤]´N¬O¥²¶·¦b°ïÅ|«O¯d 28H Ӧ줸²Õ§@¬°°Ï°ìÅܼƪºªÅ¶¡¡A¥»¨ÓÀ³¸Ó¬O¥Î¡usub rsp,28h¡v¡A¦ý¬O´î¥h 28H¡A¬Û·í©ó¥[¤W -28H¡At 28H ¨ä¹ê´N¬O¡uFFFFFFFFFFFFFFD8H¡v¡C( µù¤@ )
ºò±µµÛ¦b¡uadd rsp,FFFFFFFFFFFFFFD8¡v«áªº«ü¥O¬O¡usub rsp,28¡v( ¨£¡uGCD_LCM.ASM¡v²Ä 68 ¦æ )¡C¦b°Æµ{¦¡¤¤¡A¤j³¡¤À®ÉÔ³£ÁÙ·|¦A©I¥s¨ä¥L°Æµ{¦¡©Î Win64 API¡C³o«O¯dªº 28H Ӧ줸²Õªº°ïÅ|ªÅ¶¡¡A¬Oµ¹ input_integer ¤º¡A©I¥s¨ä¥L°Æµ{¦¡©Î Win64 API ®Éªº°Ñ¼Æ¨Ï¥Î¡C
¦b input_integer °Æµ{¦¡¤º¡AÁÙ©I¥s¤TÓ Win64 API¡A¤À§O¬O WriteConsoleA¡BReadConsoleA¡BStrToIntA¡A°Ñ¼Æ³Ì¦hªº¬O WriteConsoleA¡BReadConsoleA¡A¦³¤Ó°Ñ¼Æ¡A©Ò¥H§â RSP ´î¥h 28H¡C
³oÓ«O¯dµ¹ input_integer ¤º©I¥s°Æµ{¦¡®É¡A°Ñ¼Æ©Ò¨Ï¥Îªº°ïÅ|¡A¦bªð¦^ main ®É¤]¥²¶·¥Ñ©I¥s¤è²M°£¡A¤]´N¬O¥Ñ input_integer ¾P·´¡C¦]¦¹¦b¡uGCD_LCM.ASM¡v²Ä 93 ¦æ¦³¤@¹D¡uadd rsp,28h¡v«ü¥O¡A¨ä§@¥Î´N¬O²M²z°ïÅ|¡C¨£²Ä¤G³¹x64 ©I¥sºD¨Òªº²Ä 5 ÂI»¡©ú¡C
©³¤U¤p¤ì°¸·Q¸É¥R¤@ÂI¡C¦³®ÉÔ¦b¼¶¼g°Æµ{¦¡®É¡A·|n¥Î¨ì¬Y¨Ç¡u¤£Åܪº¼È¦s¾¹¡v¡A¨Ò¦p¦b³B²z¦r¦ê®É±`¥Î¨ì RSI¡BRDI¡A³o®ÉÔ¥²¶·±N¨ä«O¯d°_¨Ó¡A¥i¥H§Q¥Î PROC ªºÄݩʡСÐUSES¡C°²³] input_integer n«O¦s RSI¡BRDI¡A¨º»ò¥i¥H³o¼Ë¼g
input_integer PROC USES esi edi hOutput:QWORD,hInput:QWORD,pStr:QWORD,lenStr:QWORD
«O¦s°_¨Óªº¼È¦s¾¹¤§¶¡¥HªÅ¥Õ¬Û¹j¡C³o¼Ëªº¸Ü¡A²ÕĶ¾¹·|¦Û°Ê¦b¡uadd rsp,-40¡v»P¡usub rsp,28h¡v¤§¶¡¡A¥[¤W¡upush rsi¡v»P¡upush rdi¡v¡AÅܦ¨
add rsp,-40 push rsi push rdi sub rsp,28h
¦Ó¥B¦b°Æµ{¦¡ªð¦^¥Dµ{¦¡ªº¡uret¡v«e·|¥[¤W¡upop rdi¡v»P¡upop rsi¡v¡A¦A¥[¤Wì¥ý²K¥[ªº¡uleave¡v«ü¥O¡A³Ì«áÅܦ¨
pop rdi pop rsi leave ret
³o¼Ë´N¯à§â¤£Åܪº¼È¦s¾¹«O¦s¦b°ïÅ|¸Ì¡AµM«á¦w¤ß¦a¨Ï¥Î¥¦Ì¡A¤£¥²¾á¤ßµ{¦¡±Y¼ì¡C¦Ó³oºØ°Ê§@¥u»Ýn¦b PROC ¥[¤W¡uUSES¡v¡A¤£¶·¦A²K¥[ÃB¥~ªº«ü¥O¡A«D±`¤è«K¡C
¦n¤F¡A¨¥Âk¥¿¶Ç¡C²{¦b§Y±N°õ¦æ input_integer ªº²Ä¤@Ó«ü¥O¡A¡upush rbp¡v¤Î¤§«áªº´XÓ«ü¥O¡A¦ý³£¤w¸ÑÄÀ¹L¤F¡C©Ò¥Hª½±µ¸õ¹L¡A«ö 12 ¦¸¡uF7¡vÁä¡A¨ì¡ucall WriteConsoleA¡v¡AµM«á«ö¡uF8¡vÁä¡A¦A«ö 7 ¦¸¡uF7¡vÁä¡A¨ì¡ucall ReadConsoleA¡v°±¤î¡C¦p¤U¹Ï¡G µM«á«ö¡uF8¡vÁä¡A³o®ÉÔ¬O©I¥s ReadConsoleA¡Aµ¥«Ý¨Ï¥ÎªÌ¿é¤J¡C¥²¶·¦b¿Ã¹õ³Ì©³¤Uªº¤u§@¦C§ä¨ì¡u©R¥O´£¥Ü¦r¤¸¡v¡A¦b¨ä¤º¿é¤J¼ÆÈ¡C°²³]¿é¤J¡u12345678¡v¡A«ö¡uEnter¡vÁä¿é¤J§¹²¦¡C¦p¤U¹Ï¡G
±µµÛ¡A¨Ï¥ÎªÌ¥²¶·¦Û¦æ¤Á´«¨ì x64dbg µøµ¡Æ[¹îµ²ªG¡A¦p¤U¹Ï¡G ¬Ý¨ì¤W¹Ïªº°ïÅ|°Ï¤¤¡AReadConsoleA ¤w¸g¦b°Ï°ìÅܼơAsNumber¡A¸Ì±¶ñ¤J¤F§ÚÌèè¿é¤Jªº¦r¦ê¡C§ÚÌ¿é¤Jªº¬O¦r¦ê¡A©Ò¥H¥ý¿é¤Jªº¦r¤¸¦b§C¦ì§}¡A¡u1¡v¦b§C¦ì§}¡B¡u8¡v¦b°ª¦ì§}¡F¦ý¬O¡A¦b°ïÅ|°Ïªº¸ê®Æ¬O¥H¾ã¼Æ§Î¦¡ªí¥Ü¡A©Ò¥H¡u8¡v¬O°ª¦ì¼Æ¡B¡u1¡v¬O§C¦ì¼Æ¡C§Ú̬ݨ쪺±Æ¦C±¡§Î¡A´N¦p¦P sNumber ¦r¦ê¡A¥Î¤£²`¤£²LªºÂŦâ®Ø½u®Ø¦íªº¨º¼Ë¡C¥t¥~¨âÓ°Ï°ìÅܼơA¤]Åã¥Ü¦b¹Ï¤W¡C³o¸Ì¥i¥HÀËÅç qRead ªº¼ÆÈ¡A§ÚÌÁ`¦@¿é¤J¤QÓ¦r¤¸ ( ¥]§t 0DH¡B0AH )¡A©Ò¥H qRead ¤¤ªº¼ÆȬ° 0AH¡A§Y¤Q¶i¦ìªº 10 ( ¥H²HÂŦ⪺®Ø½u®Ø¦í )¡C
¨ì¦¹¤w¸g¤¶²Ð§¹©I¥s°Æµ{¦¡®É¡A°ïÅ|ºØºØÅܤƪº±¡§Î¡C¦ýèè¬O¥H x64dbg °lÂܾãÓ¹Lµ{¨Ó»¡©ú¡A¦³ÂI¨à·Ðº¾¡A©³¤U¥H¹Ï¤ù²©ú§ãn¦a¾ã²z¾ãÓ¹Lµ{¡C
¦¹¥~¡A¤p¤ì°¸¨p¤U´¢´ú¡A¥H«á¤j·§¦A¤]¨S¦³¾÷·|¤¶²Ð¡A©I¥s°Æµ{¦¡®É°ïÅ|ªºÅܤƹLµ{¤F¡C©Ò¥H¬°¤F§ó§¹¾ã»¡©ú¡A¤p¤ì°¸°²³] input_integer °Æµ{¦¡¦³¤Ó°Ñ¼Æ¡A¦Ó¥B PROC ¦³¨Ï¥Î¡uUSES¡vÄÝ©Ê¡A©Ò¥H input_integer °Æµ{¦¡Åܦ¨¡G
input_integer PROC USES rsi rdi hOutput:QWORD,hInput:QWORD,pStr:QWORD,lenStr:QWORD,fifth:QWORD LOCAL qRead:QWORD,qWritten:QWORD LOCAL sNumber[24]:BYTE ⁝ ret input_integer ENDP
¸g¹L²ÕĶ«áªº input_integer °Æµ{¦¡·|Åܦ¨¤Uªí¥ªÃäÄæ¦ì¡A¦Ó©I¥sªº¤è¦¡«h¬O¤Uªí¥kÃäÄæ¦ì¡G
push rbp mov rbp,rsp add rsp,-28h push rsi push rdi sub rsp,28h ⁝ pop rdi pop rsi leave ret |
mov rcx,°Ñ¼Æ¤@ mov rdx,°Ñ¼Æ¤G mov r8,°Ñ¼Æ¤T mov r9,°Ñ¼Æ¥| mov QWORD PTR [rsp+20h],°Ñ¼Æ¤ call input_integer |
¨ä°ïÅ|ªºÅܤƹLµ{¡A¦p¤U¹Ï¡C¹Ï¤@¬O©|¥¼©I¥s input_integer¡A¤]´N¬O§Y±N°õ¦æ¡ucall input_integer¡v¦ýÁÙ¥¼°õ¦æ®É¡A°ïÅ|¤ºªº±¡§Î¡C³o®ÉÔ¡A°ïÅ|³»«ü¦V°Ñ¼Æ¤@ªº¦ì§}¡A¨Ì¾Ú x64 ©I¥sºD¨Ò¡A¦¹¦ì§}¦p¥H¤Q¤»¶i¦ìªí¥Ü¡A¨ä¡uÓ¦ì¼Æ¡v¥²¶·¬O¹s¡C¨£¤U¹Ï¤@¡A¦¹¦ì§}¬O¡u2DF7A0¡v¡A²Å¦X¦¹¶µºD¨Ò¡C
·íµM¡A°Ñ¼Æ¤@ÁÙ¥¼¯u¥¿¦s¤J¨ì³oÓ¦ì§}ªº°O¾ÐÅ餺¡A°Ñ¼Æ¤G¡B¤T¡B¥|¤]¬O¦p¦¹¡F¥u¬O¯d¤U¼v¤lªÅ¶¡¡Aµ¥¶i¤J°Æµ{¦¡«á¦A§â³o¨Ç°Ñ¼Æ¶ñ¤J°ïÅ|¤º ( ¤£¹L°Æµ{¦¡¬O§_¯uªºn§â³o¨Ç°Ñ¼Æ«O¦s¦b¼v¤lªÅ¶¡¤¤¡A¥i¥H¦Û¥Ñ¨M©w )¡C²Ä¤@¡ã¥|ӰѼƬO¦s¤J¼È¦s¾¹¤¤¶Çµ¹°Æµ{¦¡¡A²Ä¤Ó°Ñ¼Æ¥H¤Î¥H«áªº°Ñ¼Æ«h¬O¥²¶·¥H°ïÅ|¶Çµ¹°Æµ{¦¡¡C²Ä¤Ó°Ñ¼Æªº¦ì§}¬O¡uRSP¡Ï20h¡v¡F²Ä¤»Ó°Ñ¼Æªº¦ì§}¬O¡uRSP¡Ï28h¡v( ¦pªG¦³ªº¸Ü )¡K¡K¨ä¾l¨Ì¦¹Ãþ±À¡C
§ÚÌ¥i¥H¦Û¥Ñ¬°°Ñ¼Æ¡B°Ï°ìÅܼƨúÓÅT«Gªº¦WºÙ¡A¦Ó²ÕĶ¾¹·|¦Û°Êpºâ¥X¦ì§}¨Ó¡C¦ý¬O¦pªG¶W¹L¥|ӰѼơA¦h¥X¨Óªº´N¥u¯à¥Î¹³¡u[rsp+20h]¡v³oºØ¤è¦¡ªí¥Ü¡A¤£¹L¥H«á·|¥[¤J¥]§tÀÉ©Î¥H UASM ²ÕĶ¡A¤]¥i¥H¤£¥Î³oºØ¤è¦¡ªí¥Ü¡C
¹³³o¼Ë¡A©I¥s°Æµ{¦¡®É¡A¥Ñ³Ì«á¤@ӰѼƩҦs©ñªº°ïÅ|ªÅ¶¡¶}©l¡A©¹°ïÅ|ªº§C¦ì§}¤À§O¬O¦UӰѼơBªð¦^¦ì§}¡Bì¨Óªº RBP¡A°Ï°ìÅܼƨì«O¯dªº¼È¦s¾¹¡A³o¤@¬q°ïÅ|¤º®eºÙ¬°¡u°ïÅ|®Ø¡v( stack frame¡A¤j³°Â½Ä¶¦¨¡u´Ì´V¡v )¡C
find_gcd_lcm ¬O§Q¥ÎÁÓÂà¬Û°£ªk¡A¨D±o¨â¥¿¾ã¼Æªº³Ì¤j¤½¦]¼Æ¡AµM«á¦A¥H¨â¼Æ¤§¼¿n°£¥H³Ì¤j¤½¦]¼Æ¡A©Ò±o¤§°Ó§Y¬°³Ì¤p¤½¿¼Æ¡C
ÁÓÂà¬Û°£ªk¤]¥s¼Ú´X¨½±oºâªk ( Euclidean algorithm )¡A¬Opºâ¨â¾ã¼Æªº³Ì¤j¤½¦]¼Æªº¤èªk¡C¹Lµ{¬O¨â¼Æ¬Û°£©Ò±oªº¾l¼Æ¬°¤U¦¸¬Û°£ªº°£¼Æ¡A¤U¦¸¬Û°£ªº³Q°£¼Æ¬°ì¨Óªº°£¼Æ¡A³o¼Ë¤@ª½¬Û°£ª½¨ì¾ã°£¬°¤î¡A³Ì«á¤@¦¸ªº°£¼Æ§Y¬°³Ì¤j¤½¦]¼Æ¡C¨Ò¦pn¨D 18¡B48 ªº³Ì¤j¤½¦]¼Æªº¹Lµ{¡A¥i¥H°Ñ¦Ò¤U¹Ï¡G ²Ä¤@¦¸¬Û°£ªº³Q°£¼Æ¡A·íµM¬O¿ï¾Ü¸û¤jªº¼Æ¡A¸û¤pªº¬O°£¼Æ¡A©Ò¥H¥Î¡u48¡Ò18¡×2¡K12¡v¡C²Ä¤G¦¸¬Û°£ªº³Q°£¼Æ¬O²Ä¤@¦¸ªº°£¼Æ¡A¦Ó°£¼Æ«h¬O²Ä¤@¦¸ªº¾l¼Æ¡A©Ò¥H¬O¡u18¡Ò12¡×1¡K6¡v( ¨Æ¹ê¤W¡A¾l¼Æ¤@©w¤ñ°£¼Æ¤p¡A©Ò¥HÁÙ¬O¿ï¾Ü¸û¤jªº¬°³Q°£¼Æ¡A¸û¤pªº¬°°£¼Æ )¡C²Ä¤T¦¸¬Û°£ªº³Q°£¼Æ¬O²Ä¤G¦¸ªº°£¼Æ¡A¦Ó°£¼Æ«h¬O²Ä¤G¦¸ªº¾l¼Æ¡A©Ò¥H¬O¡u12¡Ò6¡×3¡K0¡v¡Aµ²ªG¾ã°£¡A©Ò¥H³Ì¤j¤½¦]¼Æ´N¬O³Ì«á¤@¦¸ªº°£¼Æ¡A6¡C
¦pªG§â³o¹Lµ{µe¦¨¹q¸£µ{¦¡ªº¬yµ{¹Ï¡A´NÅܦ¨¤U±ªº¼Ë¤l¡G
ÁÓÂà¬Û°£ªkªºì²z½Ð°Ñ¾\HPM ³q°T²Ä¤Q¨÷²Ä¤Q¤@´Á¡A³o¸Ì¤£¤¶²Ð¡A¦¹³Bn¬Ýªº¬O²ÕĶ«áªº°Æµ{¦¡¡A¦p¤U¹Ï¡G ¥HÂŦâ®Ø½u®Ø¦íªº´N¬O find_gcd_lcm °Æµ{¦¡¡Cì©lµ{¦¡ªº find_gcd_lcm ¤º¨S¦³°Ï°ìÅܼơA¤]¨S¦³©I¥s¨ä¥L°Æµ{¦¡©Î Win64 API¡A¥u¬O³æ¯Âªºpºâ¡A©Ò¥H¤£¶·n½Õ¾ã RSP ¤§È¡C
¦b find_gcd_lcm ¸Ì¡A¨Æ¹ê¤W¤]¤£»Ýn§â°Ñ¼Æ¦s¤J°O¾ÐÅ餤¡A¥Î¼È¦s¾¹Àx¦s´N°÷¥Î¤F¡C¦ý¬O¬°¤F»¡©ú¡A¤p¤ì°¸ÁÙ¬O¦b GCD_LCM.ASM ªº²Ä 40 ¦æ¼g¤F¡umov pGcdLcm,r8¡v¡A¨ä¹ê³o¬O¦h¾lªº¡C¥¦¬O§â²Ä¤TӰѼƦs¤J¼v¤lªÅ¶¡¡C·Ó«e±ªº©Ò»¡ªº¹Ï¤T¡A²Ä¤TӰѼƪº¦ì§}¬O¦b¡uRBP¡Ï20h¡v¡AªGµM¦b¤W¹ÏÂŦâ®Ø½u¤º§â¡umov pGcdLcm,r8¡v²ÕĶ¦¨¡umov [rbp+20h],r8¡v¡C
find_gcd_lcm ªº²Ä¤TӰѼƬO¤@Ó¦ì§}¡A·í find_gcd_lcm pºâ§¹¨â¼Æªº³Ì¤j¤½¦]¼Æ»P³Ì¤p¤½¿¼Æ«á¡A·|§â«eªÌ¦s¤J¦¹¦ì§}ªº°O¾ÐÅ餺¡A§â«áªÌ¦s¤J¤ñ¦¹¦ì§}¦A°ª¤KӦ줸²Õªº¦ì§}¤§°O¾ÐÅ餺¡C¦b Win64 API ¤¤¡A¤]¦³³\¦h°Ñ¼Æ¬O³oºØ¼Ë¤l¡C
¥»³¹¤@¶}©l´N»¡¡A³o¤@³¹¬On»¡©ú¦p¦ó¦Û¦æ«Å§i°Æµ{¦¡¥H¤Î¨ä©I¥s»P°õ¦æªº¹Lµ{¡C
²Ä¤@¡B«Å§i°Æµ{¦¡¨Ï¥Î PROC/ENDP °²«ü¥O¡A
label PROC USES ¼È¦s¾¹¦Cªí °Ñ¼Æ1:¸ê®ÆÃþ«¬,°Ñ¼Æ2:¸ê®ÆÃþ«¬... ¡@¡@¡@¡@LOCAL ÅܼƦWºÙ:¸ê®ÆÃþ«¬ ¡@¡@¡@¡@µ{¦¡¤ù¬q label ENDP
¸Ô²Ó±¡§Î°Ñ¾\²Ä¤@³¹«Å§i°Æµ{¦¡¡GPROC/END¡C³o¸Ìn»¡ªº¬O¡G①¦bì©lµ{¦¡¸Ì¡A«Å§i°Æµ{¦¡n¦b°õ¦æ CALL ¤§«e¡A§_«h´N·|µo¥Í¿ù»~¡C②¦pªG¦³¨Ï¥Î°Ï°ìÅܼơALOCAL ¥²¶·ºò±µµÛ PROC ¤§«á¡A¦pªG¤£³o¼Ë¤]·|µo¥Í¿ù»~¡C
²Ä¤G¡A¥Dµ{¦¡¥²¶·«O¯d°ïÅ|ªÅ¶¡¨Ñµ¹°Æµ{¦¡ªº°Ñ¼Æ¨Ï¥Î¡A³o¦³¨âºØµ¦²¤¡G①¦b¥Dµ{¦¡¤@¶}©l®É¡Aµ{¦¡³]p®v¦Û¦æ²ÎpþӰƵ{¦¡ªº°Ñ¼Æ³Ì¦h¡A«O¯d°ïÅ|ªÅ¶¡ªº¦h¤Ö¥H¦¹°Æµ{¦¡¬°·Ç¡C②¨C¦¸©I¥s°Æµ{¦¡®É¡A¨Ì³oӰƵ{¦¡ªº°Ñ¼Æ«O¯d°ïÅ|ªÅ¶¡¡C¥i¥H°Ñ¦Ò²Ä¤@³¹ªº FIRST.ASM »P²Ä¤G³¹ªº FIRST1.ASM¡A«eªÌ±Ä¥Îµ¦²¤①¡A«áªÌ±Ä¥Îµ¦²¤②¡C§Y¨Ï¦p¦¹¡A©¹«á§Ú̸ü¤J¥]§tÀɩαĥΠUASM ²ÕĶ¾¹®É¡A´X¥G¤£¥²¾á¤ß³oÓ°ÝÃD¡A¦]¬°¥]§tÀÉ»P²ÕĶ¾¹³£¤wÀ°µ{¦¡³]p®v¦w±Æ¦n¤F¡C
²Ä¤T¡B©I¥s§¹¤§«á¡A¥Dµ{¦¡¥²¶·¾P·´«O¯dµ¹°Æµ{¦¡°Ñ¼Æªº°ïÅ|ªÅ¶¡¡C³o¦³¨âºØ±¡§Î¡G①¥Dµ{¦¡µ²§ô®É©I¥s ExitProcess¡A³o¼Ë´Nµ²§ôµ{¦¡¡A±±¨îÅvÂkÁÙµ¹ Windows §@·~¨t²Î¡A´N¤£¶·¾á¤ß³oºØ±¡§Î¡C②¦pªG¬O°Æµ{¦¡¤¤¤S©I¥s¨ä¥L°Æµ{¦¡¡A§â«eªÌ·í§@¥Ò°Æµ{¦¡¡A¥Ò°Æµ{¦¡¤¤¥i¯à·|©I¥s A °Æµ{¦¡¡BB °Æµ{¦¡µ¥µ¥¡F¤£¹L¦bµ²§ô¥Ò°Æµ{¦¡¤§«e¡A²ÕĶ¾¹·|¦Û°Ê´¡¤J¡uLEAVE¡v«ü¥O¡A³o¼Ë´N¾P·´«O¯dµ¹°Æµ{¦¡°Ñ¼Æªº°ïÅ|ªÅ¶¡¤F¡C¦]¦¹µ{¦¡³]p®v¨ä¹ê¤£¥²¾á¤ß²Ä¤T¥ó¨Æ¡A¦]¬°²ÕĶ¾¹¤w¸g¦w±Æ¦n¤F¡C
²Ä¥|¡B¤]¬O³Ì«nªº¤@ÂI¡C¤£ºÞ©¹«á¨Ï¥Î①ML64.EXE ²ÕĶ¾¹»P hutch-- ¥D¾Éªº¥]§tÀÉ©Î②¨Ï¥Î UASM ²ÕĶ¾¹»P WinInc ¥]§tÀÉ¡A©¹«á©I¥s°Æµ{¦¡©Î Win64 API ³£¥Î¡uINVOKE¡v°²«ü¥O©Î¥¨¶°¡A¦Ó¥B¤£»Ý¾á¤ß¤W±ºØºØ²Ó¸`¡C¤p¤ì°¸ªá¤F³o»ò¦hªº½g´T¡A¤¶²Ð³o»ò½ÆÂøªº¹Lµ{¡A¥u¬°´¦¯}³o²Ó¸`¡AÅý³o¹Lµ{Åu¦b¶§¥ú¤U¡A¬°¤j²³©Òª¾¡A³o¤~¬O²Õ¦X»y¨¥ªº¥»¦â¡C
±µ¤U¨Ó¡AÁÙn¦Aªá¨â³¹ªº½g´T¤¶²Ð¥¨¶°¡A³o¼Ë¤~¯à§ó©úÁA INVOKE ¨ì©³¦b°µ¤°»ò¡C
¦³Ãöt¼Æªºì²z¡A¥H«á¦A»¡¡C¦ý¬O¡A²{¦b§ÚÌ¥i¥H¥Î¡u¤pºâ½L¡vÅçÃҬݬݡA¦b 64 ¦ì¤¸ªº°O¾ÐÅ餤¡G
-28H¡×FFFFFFFFFFFFFFD8H
¶}±Ò¥ª¤U¨¤¡u¶}©l¡v¡÷¡uÀ³¥Îµ{¦¡¡v¡÷¡u¤pºâ½L¡v¡AµM«á¦b¤W±ªº¥D¿ï³æ¿ï¡uÀ˵ø¡v¡÷¡uµ{¦¡³]p®v¡v¡A¶i¤J¤£¦PÃþ«¬ªºpºâ¾÷«á¡A¦p¤U±¥ª¹Ï¡A¿ï¥ªÃ䪺¡u¤Q¤»¶i¦ì¡v¶ê§Î«ö¶s¡AµM«á¿é¤J 28¡C¦¹®É¿Ã¹õ¤W·|Åã¥Ü¤Q¤»¶i¦ìªº 28¡A¦¹®ÉÁÙ¬O¥¿¼Æ¡A¨£¤U±¥ª¹Ï¡C²{¦b«ö¤U¡u¡Ó¡v«ö¶s ( ¹Ï¤¤¡u·Æ¹«´å¼Ð¡v©Ò«ü³B¡A¨ä«ö¶s²¤±a¾í¦â )¡A´N·|Åܦ¨t¼Æ¡A¤]´N¬O -28H¡A¦Ó¤pºâ½LÅã¥Ü¬°¡uFFFFFFFFFFFFFFD8¡v¡C¤]´N¬O»¡¡G
-28H¡×FFFFFFFFFFFFFFD8H