win32汇编_简单的双精度浮点数冒泡排序,无聊送分
时间:2010-12-29
来源:互联网
双精度浮点(double型)冒泡排序,从小到大,无聊送分
--------------------------------------
Assembly code
--------------------------------------
Assembly code
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ ;-=- Double BubbleSort By G-Spider @2010 ;-=- ml /c /coff sort.asm ;-=- link /subsystem:console sort.obj ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ .386 .model flat,stdcall include user32.inc include kernel32.inc include msvcrt.inc includelib user32.lib includelib kernel32.lib includelib msvcrt.lib .data fmt0 db '%lf',0 fmt1 db '%.4lf ',0 fmt2 db 0dh,0ah,0 inform db 'Please input 6 real nums:',0dh,0ah,0 outform db 'Sort nums: ',0dh,0ah,0 szPause db 'Pause',0 .data? ArrTEST qword 10 dup(?) .code ;**************************** DoubleBubbleSort proc lpDest:DWORD,count:DWORD ;//双精度浮点冒泡排序,从小到大 mov edx, count mov ecx, 1 LOOP1: test ecx,ecx jz EXIT mov esi, lpDest xor ecx, ecx dec edx xor ebx, ebx LOOP2: cmp ebx, edx jge LOOP1 inc ebx ;//比较 fld QWORD PTR[esi] fcom QWORD PTR[esi+8] fnstsw ax test ah, 65 jne NEXT2 ;//需要交换 fld QWORD PTR[esi+8] fstp QWORD PTR[esi] fstp QWORD PTR[esi+8] mov ecx, 1 add esi, 8 jmp LOOP2 NEXT2: ;//无须交换,恢复堆栈 fstp st(0) add esi, 8 jmp LOOP2 EXIT: xor eax,eax ret DoubleBubbleSort ENDP ;**************************** _Input proc count:DWORD ;//输入count个双精度浮点数到数组ArrTEST[]中 xor ecx,ecx mov edi,offset ArrTEST @@: cmp ecx,count je EXIT push ecx lea eax,dword ptr[edi+ecx*8] push eax push offset fmt0 call crt_scanf add esp,8 pop ecx inc ecx jmp @B EXIT: xor eax,eax ret _Input endp ;**************************** _Output proc lpDest:DWORD,count:DWORD xor ecx,ecx mov edi,lpDest @@: cmp ecx,count je EXIT push ecx fld qword ptr[edi+ecx*8] sub esp,8 fstp qword ptr[esp] push offset fmt1 call crt_printf add esp,12 pop ecx inc ecx jmp @B EXIT: xor eax,eax ret _Output endp ;**************************** start: invoke crt_printf,offset inform ;//数据输入 invoke _Input,6 ;-------- ;//冒泡排序 invoke DoubleBubbleSort,offset ArrTEST,6 ;-------- invoke crt_printf,offset outform ;//数据输出 invoke _Output,offset ArrTEST,6 ;-------- invoke crt_printf,offset fmt2 invoke crt_system,offset szPause invoke ExitProcess,0 end start
作者: G_Spider 发布时间: 2010-12-29
写的好!膜拜!
作者: znxllyuan 发布时间: 2010-12-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28