【发布时间】:2015-09-17 13:01:57
【问题描述】:
我一直试图让它打印 12345 有一段时间了。任何人都可以提供关于我应该做什么的提示吗?它将打印三行文本,然后在第四行打印“年龄”,我猜这是第 2 行堆栈中的剩余部分。
bits 64
global main
extern printf
section .text
main:
; function setup
push rbp
mov rbp, rsp
sub rsp, 32
;
lea rdi, [rel message]
mov al, 0
call printf
;above code correctly prints message
;where the issue lies
push rbp
mov rbp, rsp
;sub rsp, 32
mov rax, 12345
;push rax
mov al,0
call printf
; function return
mov eax, 0
add rsp, 32
pop rbp
ret
section .data
message: db 'Lab 3 - Modified Hello program',0x0D,0x0a,'COSC2425 - Pentium assembly language',0x0D,0x0a,'Processed with NASM and GNU gcc',0x0D,0x0a
count dq 12345
【问题讨论】:
标签: assembly printf nasm x86-64 calling-convention