Menu
  • HOME
  • TAGS

Masm32. Find min and max in array

arrays,assembly,max,procedure,masm32

a. Shouln't you use OFFSET/PTR on the first parameter? invoke getMinMax, offset result, n, offset minVal, offset maxVal getMinMax PROC arr:PTR QWORD, len:DWORD, _min:PTR QWORD, _max:PTR QWORD b. You are dangerously supposing that LEN will always be at least 2. You should test for cases with LEN=0 and LEN=1 c....

Can I make array of structure public?

assembly,masm,masm32

You can use the PUBLIC directive to make the symbol THREE accessible from other .ASM files. You also need to define THREE correctly: .data NODE STRUCT key dword ? value dword ? NODE ENDS PUBLIC THREE THREE NODE 10 DUP ({0,0}) To access the symbol THREE you need to use...

Read bytes from Dump in Masm

assembly,masm32

According to your example you are fighting with the "little endian" byte order. A byte sequence of 12 34 56 78 is loaded into a 32-bit register as 78563412. You can reverse the byte order in a 32/64-bit register with BSWAP. In the second case you need to reverse the...

Creating a library in MASM while using dosbox

assembly,masm32,dosbox

I suggest using DosBox only for running the final executable. You don't need DosBox to produce this executable, since Masm32 runs under 64 bit Windows. But the lib.exe shipped with Masm32 doesn't produce a OMF-Library suitable for link16.exe. So you have to get a lib.exe which "speaks" OMF, e.g. the...

Unhandled exception at 0x0000007b in Project.exe: 0xC0000005: Access violation

assembly,compiler-construction,masm,masm32

Two push, but only one pop. Should be farily obvious why the exception occurs. push eax ;save eax push ebx ;save ebx mov eax, 100 ;store 100 to eax? pop ebx ret If you push somthing on the stack, you must ensure that the stack balances by either manually adjusting...

Can't figure out how to print a number in MASM32

assembly,syntax,masm32

First, myvar db 52 is on the wrong place. When the program starts, the computer comes to db 52 and treats that as an instruction. Second, the 0 value (don't say character) is not an argument for StdOut and has to be at the end of the data. StdOut needs...

For MASM, what kind of output is this asking for?

assembly,masm,masm32

What you're seeing there is a linked list where: 1 is the starting index; each character is the payload; each link is the next pointer. It may be better to think of it as: start = 1 index: 0 1 2 3 4 5 6 7 char: H A C...

MASM32 compile error

assembly,compiler-errors,x86,masm32

First you need Irvine's library files (Kernel32.Lib, User32.Lib, Irvine32.lib, Irvine32.inc) which you can download from his site, i.e. download this file and install it: http://www.kipirvine.com/asm/examples/Irvine_7th_Edition.msi. Now you insert some lines at the beginning of your program: includelib C:\full\path\to\Kernel32.Lib includelib C:\full\path\to\User32.Lib includelib C:\full\path\to\Irvine32.lib ; include C:\full\path\to\Irvine32.inc The include...-line is for later...

How can I print array on MASM32?

assembly,masm,masm32

PUSH/POP r/m64 isn't valid in 32-bit mode (even if it had been, the correct MASM syntax would've been QWORD PTR [... rather than just QWORD [...). But there are other ways to move your data: You could use two PUSH DWORD PTR instructions that each push half of the data,...

Play a sound file in masm32 and to stop the other sound file at the same time [closed]

winapi,assembly,x86,masm32,playsound

Read the documentation. PlaySound function pszSound A string that specifies the sound to play. The maximum length, including the null terminator, is 256 characters. If this parameter is NULL, any currently playing waveform sound is stopped. To stop a non-waveform sound, specify SND_PURGE in the fdwSound parameter. ... fdwSound Flags...

Is it impossible use invoke in macro defenition in MASM?

assembly,masm,masm32

It's perfectly ok to use invoke from inside a macro. The problem is that you named your macro input. There's already a macro with that name in masm32\macros\macros.asm, which is included by masm32\include\masm32rt.inc, which is included by your code. So just pick a different name for your macro.

How to get content of an address in MASM32?

pointers,assembly,masm,masm32

You are trying to access a local variable that has already gone out of scope. This is a bad idea. Instead, you should rewrite your GetExecutablePath function such that it accepts a pointer to a buffer. To answer the question anyway: technically, you would use some form of memory block...

Bubble sort not working with local array in assembly language

arrays,assembly,masm32

; push numArray lea eax, numArray push eax call BubbleSort ... ... unless I'm mistaken... Edit: Ahhh... worse than that. I think you're going to have to "dereference" it in BubbleSort, too. mov edx, array ; [ebp + 8], right? ; then use edx instead of "array"... or so......

how to use a library in masm or more specifcally a .lib file?

visual-studio-2010,visual-c++,assembly,masm,masm32

I was too optimistic saying that there are many examples for a MASM-C-combination in the net. Here a step-by-step instruction for Visual Studio Express 2010 (no Masm32): MathFuncsLib.cpp: extern "C" { int Addition (int a, int b) { return a + b; } int Subtraction (int a, int b) {...

MASM32 error when I use call DumpRegs

assembly,masm32

My professor told me to delete some of the code so this is what I am left with TITLE Add and Subtract (AddSub.asm) ; This program adds and subtracts 32-bit integers. INCLUDE Irvine32.inc .data num BYTE 126d num2 SBYTE -26d num3 WORD 692Ah num4 SWORD -32789 num5 DWORD 12345678h num6...

Where does DUP operator keeps counting number?

assembly,masm,masm32

You can do what you want, but you can't do it with the DUP operator. You'll need to use the REPT (repeat) directive instead and create your own counter: .DATA NODE STRUCT NODEi_KEY DWORD ? NODEi_VALUE DWORD 0 NODE ENDS THREE LABEL NODE counter = 1 REPT 20 NODE {counter,}...

Why Masm32 only give 1 to 100 result for add and subtraction operation and beyond that I got wrong answer?

assembly,masm32

All of these operations in your code are incorrect: mov[num1 + eax-3], 0 StdIn returns the number of characters read, excluding the NUL terminator. So if you entered 100, eax will be 3, so you'll set the very first byte to 0, thereby making num1 an empty string. Even worse,...