汇编版的的HELLO WORLD

.386
.model flat, stdcall

GetStdHandle PROTO,         			; get standard handle
	nStdHandle:DWORD  					; type of console handle
	
WriteConsoleA PROTO,					; write a buffer to the console
	hConsoleOutput:DWORD,				; output handle
	lpBuffer:PTR BYTE,					; pointer to buffer
	nNumberOfCharsToWrite:DWORD,		; size of buffer
	lpNumberOfCharsWritten:PTR DWORD,	; ptr to number of bytes written
	lpReserved:DWORD					; (not used)
	
ExitProcess PROTO,          			; exit program
	dwExitCode:DWORD					; return code

.data
prompt BYTE "HELLO WORLD",0
consoleOutHandle DWORD ?    			; handle to standard output device
bytesWritten DWORD ?

STD_OUTPUT_HANDLE EQU -11

.code
main PROC
	INVOKE GetStdHandle, STD_OUTPUT_HANDLE
	mov [consoleOutHandle],eax
	mov edx, OFFSET prompt
	mov eax, 11
	INVOKE WriteConsoleA,
	    consoleOutHandle,     	; console output handle
	    edx,					; points to string
	    eax,					; string length
	    OFFSET bytesWritten,  	; returns number of bytes written
	    0
		
	INVOKE ExitProcess,0
main ENDP
END main

将以上代码保存为helloworld.asm
运行要求:
下载Visual Studio,安装C++
安装好以后,打开该命令行
在这里插入图片描述
在命令行中输入以下命令:
分别是编译,链接,运行,即可

ml /c /coff helloworld.asm
link /subsystem:console kernel32.lib user32.lib helloworld.obj
helloworld.exe
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值