win32汇编冒泡排序 且 编译通过

113 篇文章 1 订阅
30 篇文章 0 订阅
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
.data
ArrayA dword 3,1,7,5,2
szCaption db 'MessageBox',0
szText db 100 dup(0)
szCharsFormat db 'After Bubble Sort : ArrayA :%d,%d,%d,%d,%d',0
.code
BubbleSort proc uses eax ecx esi,
	pArray:ptr dword,
	Count:dword
local @exchange:dword
	mov ecx,Count
	dec ecx
	mov @exchange,0
		L1:
			push ecx
			mov esi,pArray
			mov @exchange,0
				L2:
					mov eax,[esi]
					cmp [esi+4],eax
					jge L3
					xchg eax,[esi+4]
					mov [esi],eax
					mov @exchange,1
						L3:
							add esi,4
				loop L2
			cmp @exchange,0
			je L4
			pop ecx
		loop L1
	L4:ret
BubbleSort endp
start:
invoke BubbleSort,addr ArrayA,5
invoke wsprintf,addr szText,addr szCharsFormat,ArrayA,ArrayA+4,ArrayA+8,\
ArrayA+12,ArrayA+16
invoke MessageBox,NULL,offset szText,offset szCaption,MB_OK
invoke ExitProcess,NULL
end start

D:\programming\assembler>ml /IE:\masm32\include bubbleSort.asm /c
Microsoft (R) Macro Assembler Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: bubbleSort.asm

***********
ASCII build
***********


D:\programming\assembler>link /subsystem:windows bubbleSort.obj
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值