如何在 MASM 32 位代码中强制推送参数大小?

问题描述 投票:0回答:1

如何控制MASM 5.0+中push指令的大小?

push 42  ; I need this to be 2 bytes: opcode + 1 byte of data.
push 42  ; I need this to be 5 bytes: opcode + 4 bytes of data.

在 NASM 中是

push strict byte 42
push strict dword 42
。我正在寻找 MASM 的等效项。

assembly x86 masm
1个回答
0
投票

这似乎适用于 Microsoft (R) Macro Assembler (x64) 版本 14.37.32822.0

push byte ptr 42
push word ptr 42
push dword ptr 42
push 42

生成的操作码是

6a2a            push    2Ah
66682a00        push    2Ah
682a000000      push    2Ah
6a2a            push    2Ah

堆栈布局是

000000da`eb36fbf6 000000000000002a 
000000da`eb36fbfe 000000000000002a 
000000da`eb36fc06 00000000002a002a 
© www.soinside.com 2019 - 2024. All rights reserved.