织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

Print hello in 64

时间:2026-01-03 20:56来源: 作者:admin 点击: 3 次
I use Visual Studio 2022 in Windows 11. The following code run OK on my machine. step1: Create a file hello.asm with contents: includelib ucrt.lib inc

I use Visual Studio 2022 in Windows 11. The following code run OK on my machine.

step1: Create a file hello.asm with contents:

includelib ucrt.lib includelib legacy_stdio_definitions.lib includelib msvcrt.lib option casemap:none .data ; , 10 means line feed character (LF) ; , 0 means adding an terminating '\0' to the string fmtStr byte 'Hello', 10, 0 .code externdef printf:proc externdef _CRT_INIT:proc externdef exit:proc main proc call _CRT_INIT push rbp mov rbp, rsp sub rsp, 32 lea rcx, fmtStr ; lea: load the address of a variable into a register call printf xor ecx, ecx ; the first argument for exit() is setting to 0 call exit main endp end

step2: open "x64 Native Tools Command Prompt for VS 2022" windows, assemble and link the code

This step use ml64.exe, the MASM assembler, together with link options, to generate hello.exe:

ml64 hello.asm /link /subsystem:console /entry:main

step3: Run the executable

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2026-01-05 22:01 最后登录:2026-01-05 22:01
栏目列表
推荐内容