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....
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...
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...
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...
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...
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...
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...
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...
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,...
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...
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.
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...
; 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......
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) {...
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...
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,}...
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,...