masm32

Confusing brackets in MASM32

陌路散爱 提交于 2019-12-01 11:44:55
问题 I am trying to get to grips with MASM32 and am confused by the following: I thought that brackets were used for indirection so if I have the a pre-defined variable .data item dd 42 then mov ebx, item would put the contents of 'item', i.e. the number 42, into ebx and mov ebx, [item] would put the address of 'item', i.e. where the 42 is stored, into ebx. But the following code in a console app: mov ebx, item invoke dwtoa, ebx, ADDR valuestr invoke StdOut, ADDR valuestr mov ebx, [item] invoke

Outputting Hello World in MASM using WIN32 Functions

自闭症网瘾萝莉.ら 提交于 2019-12-01 05:40:35
Contents Intro Code Assembling and Running Miscellaneous Question 1. Intro This isn't a question per se (though there is one at the bottom) but a HelloWorld app for people on StackOverflow to experiment with. When I was first trying programing in MASM I tried to find a working HelloWorld application that used the WIN32 API calls (so not linking to C libraries) but couldn't find one (in MASM Syntax). So now that I have some experience I have written one for others wanting to learn assembly to fiddle with. 2. Code .386 ; 386 Processor Instruction Set .model flat,stdcall ; Flat memory model and

Outputting Hello World in MASM using WIN32 Functions

安稳与你 提交于 2019-12-01 03:11:49
问题 Contents Intro Code Assembling and Running Miscellaneous Question 1. Intro This isn't a question per se (though there is one at the bottom) but a HelloWorld app for people on StackOverflow to experiment with. When I was first trying programing in MASM I tried to find a working HelloWorld application that used the WIN32 API calls (so not linking to C libraries) but couldn't find one (in MASM Syntax). So now that I have some experience I have written one for others wanting to learn assembly to

A2004 Problem With MASM32

别说谁变了你拦得住时间么 提交于 2019-11-29 12:48:14
I have a problem with the MASM32 assembler The following code is a Hello World example that I copied from the MASM32 tutorial: .model small .stack .data message db "Hello world!", "$" .code _main proc mov ax,seg message mov ds,ax mov ah,09 lea dx,message int 21h mov ax,4c00h int 21h _main endp end _main On attempt to assemble, MASM32 throws A2004 error with the following comment: C:\masm32\console.asm(11) : error A2004: symbol type conflict Can anyone help me with that? This code worked perfectly fine with the TASM assembler, but now I have to use MASM32 and I am having this A2004 error for

Reverse byte order of EAX register

蹲街弑〆低调 提交于 2019-11-29 12:08:45
Example: 0xAABBCCDD will turn into 0xDDCCBBAA My program crashes, due to Access Violation exception right in the first XOR operation. It seems like there's a better naive solution, using shifting or rotating, but anyways, here's the code: ;; ######################################################################### .486 .model flat, stdcall option casemap :none ; case sensitive ;; ######################################################################### include \masm32\include\masm32.inc include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib

Randomizing Numbers in Assembly with MASM32

一个人想着一个人 提交于 2019-11-28 14:52:52
How can I randomize a number using Assembly with Masm32? What can I use to create a random numbers generator? Thank you very much! Get random numbers with MASM32 The MASM32 SDK comes with some examples which implement random generators. It isn't the worst idea to use them for own purposes. The following examples are just examples and lack - among others - in an error handling. The examples generate and produce 30 random numbers in the range [0..11]. A linear congruential generator with a=134775813 and b=c (like Delphi) is in \masm32\examples\exampl03\lcd\lcd.asm . .686 .MODEL flat, STDCALL

x86 assembly (masm32) - Can I use int 21h on windows xp to print things?

こ雲淡風輕ζ 提交于 2019-11-28 11:45:10
问题 Just wondering, in regards to my post Alternatives to built-in Macros , is it possible to avoid using the StdOut macro by using the int 21h windows API? Such as: .data msg dd 'This will be displayed' ;original macro usage: invoke StdOut, addr msg ;what I want to know will work push msg int 21h ; If this does what I think it does, it should print msg Does such a thing exist (as in using int 21h to print things), or does something like it exist, but not exactly int 21h. Or am I completely wrong

A2004 Problem With MASM32

烈酒焚心 提交于 2019-11-28 06:38:17
问题 I have a problem with the MASM32 assembler The following code is a Hello World example that I copied from the MASM32 tutorial: .model small .stack .data message db "Hello world!", "$" .code _main proc mov ax,seg message mov ds,ax mov ah,09 lea dx,message int 21h mov ax,4c00h int 21h _main endp end _main On attempt to assemble, MASM32 throws A2004 error with the following comment: C:\masm32\console.asm(11) : error A2004: symbol type conflict Can anyone help me with that? This code worked

Reverse byte order of EAX register

﹥>﹥吖頭↗ 提交于 2019-11-28 05:16:55
问题 Example: 0xAABBCCDD will turn into 0xDDCCBBAA My program crashes, due to Access Violation exception right in the first XOR operation. It seems like there's a better naive solution, using shifting or rotating, but anyways, here's the code: ;; ######################################################################### .486 .model flat, stdcall option casemap :none ; case sensitive ;; ######################################################################### include \masm32\include\masm32.inc

Randomizing Numbers in Assembly with MASM32

允我心安 提交于 2019-11-27 09:06:33
问题 How can I randomize a number using Assembly with Masm32? What can I use to create a random numbers generator? Thank you very much! 回答1: Get random numbers with MASM32 The MASM32 SDK comes with some examples which implement random generators. It isn't the worst idea to use them for own purposes. The following examples are just examples and lack - among others - in an error handling. The examples generate and produce 30 random numbers in the range [0..11]. A linear congruential generator with a