【问题标题】:How do i print all the numbers in value num1, num2, num3, and the long hex in rax?如何在 rax 中打印值 num1、num2、num3 和长十六进制中的所有数字?
【发布时间】:2020-02-19 21:36:18
【问题描述】:
Console         equ     -11

extern  GetStdHandle:   PROTO
extern  WriteFile:      PROTO
extern  ReadFile:       PROTO
extern  ExitProcess:    PROTO

.data
num1        byte    ?
num2        word    ?
num3        dword   ?
num4        qword   ?
stdin       qword   ?
stdout      qword   ?
numWrite    qword   ?

.code
mainCRTStartup      PROC
    sub rsp, 40     ;reserve shadow space

    mov rcx, CONSOLE
    call GetStdHandle
    mov stdin, rax

    ;Storing information into memory
    mov num1, 6dh
    mov num2, 7361h
    mov num3, 7369206dh
    mov rax, 216e754620h

    mov rcx, stdout         ;parm1 = console
    lea rdx, num2           ;parm2 = ASCII
    ;parm3 = total #bytes to display
    mov r8, 15
    lea r9, numWrite
    mov qword ptr [rsp+32], 0
    call ReadFile


    add rsp, 40
    mov rcx, 0
    call ExitProcess
mainCRTStartup      ENDP
END

【问题讨论】:

标签: windows winapi assembly x86-64


【解决方案1】:

作为注释,您可以将printf"%x" 格式一起使用,或者将"%lx"long 类型一起使用。

或者你可以使用apiitoa/ltoa

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-22
    • 2019-04-12
    • 2010-11-19
    • 2015-02-14
    • 2013-11-21
    相关资源
    最近更新 更多