MASM

what is the equivalent of _emit in MASM

只谈情不闲聊 提交于 2020-01-24 09:49:26
问题 I'm trying to port some inline assembly code written in Visual Studio into MASM64. The original code uses _emit which is a pseudo instruction that defines one byte at the current location in the current text segment. How would I do the same in x64 assembly MASM? 回答1: You can just use db , as in: db 10h You do this most often in a data segment, unless things have changed in the 64-bit version of MASM, it should work in the code segment as well. 来源: https://stackoverflow.com/questions/6916050

.STACK is not allocating the correct size in MASM

≡放荡痞女 提交于 2020-01-24 09:27:05
问题 Based on Microsoft MASM Documentation, the usage of .STACK directive is When used with .MODEL, defines a stack segment (with segment name STACK). The optional size specifies the number of bytes for the stack (default 1,024). The .STACK directive automatically closes the stack statement. (32-bit MASM only.) For the sake of experimentation, I made the .STACK to allocate 1,073,741,824 bytes (1 GB) Note that I'm running the code in Visual Studio 2013, console project. .586 .MODEL FLAT .STACK

How do you compare variable types in assembly?

混江龙づ霸主 提交于 2020-01-24 08:38:28
问题 This might be a bit of a stupid syntax question, but is there a way you can make conditional jumps based on variable type? I'm trying to write a macro (for a class) that can take a byte, word, or double word as an argument and write it to the screen. mWriteInt MACRO integer:REQ ;cmp integer, DWORD ;je dwordOp movsx eax, word ptr integer call WriteInt mov edx, OFFSET endl call WriteString ; for a DWORD ; dwordOp: ENDM So basically, the code executed should be different based on what type of

How do you compare variable types in assembly?

眉间皱痕 提交于 2020-01-24 08:38:05
问题 This might be a bit of a stupid syntax question, but is there a way you can make conditional jumps based on variable type? I'm trying to write a macro (for a class) that can take a byte, word, or double word as an argument and write it to the screen. mWriteInt MACRO integer:REQ ;cmp integer, DWORD ;je dwordOp movsx eax, word ptr integer call WriteInt mov edx, OFFSET endl call WriteString ; for a DWORD ; dwordOp: ENDM So basically, the code executed should be different based on what type of

【MASM】hello world

限于喜欢 提交于 2020-01-17 22:54:51
include io32.inc ;IO库文件 .data ;数据定义 msg byte "hello,world!",13,10,0 ;字符串,试过了,单双引号均可 .code ;代码段 start: ;主程序 mov eax,offset msg ;参数移入,offset取址 call dispmsg ;调用 exit 0 ;return 0 ;子程序 end start ;汇编结束 来源: CSDN 作者: cout8 链接: https://blog.csdn.net/u011956367/article/details/104025062

Displaying Graphics in BIOS

99封情书 提交于 2020-01-16 18:57:08
问题 Using MASM32 is it possible to display bitmaps stored in a binary file embedded with the executable to the console? Can anyone show me how? Addendum: I'm not talking about a full fledge GUI here. Just the ability to display character bitmaps on the screen. They would be stored as 8x8 binary images in a file that we link to the executable. 回答1: You can do anything using MASM you could do with C or C++. However, using MASM doesn't give you any special abilities (you will still need to access

Displaying Graphics in BIOS

和自甴很熟 提交于 2020-01-16 18:56:20
问题 Using MASM32 is it possible to display bitmaps stored in a binary file embedded with the executable to the console? Can anyone show me how? Addendum: I'm not talking about a full fledge GUI here. Just the ability to display character bitmaps on the screen. They would be stored as 8x8 binary images in a file that we link to the executable. 回答1: You can do anything using MASM you could do with C or C++. However, using MASM doesn't give you any special abilities (you will still need to access

Outputting registers to the console with MASM

帅比萌擦擦* 提交于 2020-01-15 11:59:08
问题 I'm one day into learning ASM and I've done a few tutorials, and even successfully modified the tutorial content to use jmp and cmp, etc instead of the MASM .if and .while macros. I've decided to try and write something very, very simple to begin with before I continue with more advanced tutorials. I'm writing a Fibonacci number generator. Here is the source I have so far: .386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc

error a2070 invalid instruction operands [duplicate]

半腔热情 提交于 2020-01-15 08:37:18
问题 This question already has answers here : error A2070: invalid instruction operands (2 answers) Closed 2 years ago . I'm newbie in Win32 Assembly: I learn code this program, it's Window simple. But I get the error: error a2070 invalid instruction operands (MASM) I have searched on google about this error, but I still don't understand. .386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc

Converting an ascii character into decimal in Assembly for use with WriteConsoleA and readConsoleA

若如初见. 提交于 2020-01-14 03:37:14
问题 I am in a fix. I need to input numbers from the user and then perform arithmetic calculations on the input. I'm just a beginner now and till now I've not used any IO, except in a program which asks the user for a name and prints an output, using WriteConsoleA and ReadConsoleA. I couldn't find any help on google, on how to convert ascii characters to decimals for input and how to convert decimals to ascii for output. I'd prefer to do this manually before using any of the library functions. I