masm32

Creating a library in MASM while using dosbox

烈酒焚心 提交于 2019-12-12 01:45:20
问题 I have a question, i have been given an assignment to make a static library in assembly language i.e. MASM, but all the tutorials i find on the internet are either incomplete or too hard for me to understand. I am using dosbox since i have a 64 bit windows. Please help step by step Please and thank you 回答1: 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

x86 assembly (masm32) output multiplied number produces junk characters

末鹿安然 提交于 2019-12-12 01:08:28
问题 I'm coming back to assembly for the sake of it after a few months and I'm having trouble getting two numbers to multiply and output the result. Here's my code: .386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib .data sum sdword 0 .code start: mov ecx, 6 xor eax, eax mov edx, 7 mul edx push eax pop sum lea eax, sum call

Error in Assembly masm linker 'link: extra operand'

浪尽此生 提交于 2019-12-11 16:23:32
问题 I installed masm for assembly programming but i have problem with link below code .586 .MODEL FLAT .STACK 4096 INCLUDE io.h .DATA prompt BYTE "shalgham", 0 .CODE _main PROC output prompt mov eax, 0 ret _main ENDP END when i assemble above code by commandLine every thing is ok but when i want to link it below error will be print in commandLine C:\Users\mahdi\Desktop\New folder>ml /c /coff simple.asm Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All

x86 assembly - MASM32 - multiplying 3 numbers

风流意气都作罢 提交于 2019-12-11 07:24:28
问题 I have a program that multiplies 3 numbers and i am trying to understand. I have some questions and i am hoping someone can explain whats going on with the program and tell me if i am on the right track. I understand i have more than one question so i am sorry about that. .data? num1 dd ? num2 dd ? num3 dd ? .data sum dd 0 prod dd 0 .code start: main proc mov EAX, sval(input("Enter a number: ")) mov num1, EAX mov EAX, sval(input("Enter a number: ")) mov num2, EAX mov EAX, sval(input("Enter a

x86 assembly - masm32: Issues with pushing variable to stack

女生的网名这么多〃 提交于 2019-12-11 05:25:43
问题 I'm trying to make a program that gets two input numbers, multiplies them (storing the result in a variable), divides them (storing the result in another variable) and prints the result. The issue I'm having is that the first line of code push num1 returns invalid instruction operands : .data num1 db "Enter a number:" num2 db "Enter another number:" .data? buffer1 dd 100 dup(?) ; this is where I store input for num1 buffer2 dd 100 dup(?) ; " " num2 .code start: push num1 ; here is where it

MASM: .IF with signed numbers comparison

时光毁灭记忆、已成空白 提交于 2019-12-11 03:22:30
问题 I have: mov ecx, r .if ecx < 0 mov cl, 0 .elseif ecx > 255 mov cl, 255 .endif mov [eax + 2], cl r is signed integer. I want it to cap it within byte limit. But problem is when "r" is negative. It is treated as if it is unsigned. Input -> Expected output r = 300 -> 255 r = 12 -> 12 r = -134 -> 0 What actually happenes: r = 300 -> 255 r = 12 -> 12 r = -134 -> 255 <--------- Here it gets treated as if -134 is bigger than 255 How to fix it? 回答1: Shortest solution: .if SDWORD PTR ecx < 0 来源: https

does NEG instruction in assembly language sets the Overflow flag

南笙酒味 提交于 2019-12-10 11:55:26
问题 i want to know about NEG instruction, does it affects the overflow flag too!!!..i got to know that is just negate the value of a variable but couldn't know that is it affects the Overflow flag 回答1: If you want to know what instructions do, consult the reference manuals. The essential reference, namely the Intel instruction set manual says this about the NEG instruction: Flags Affected The CF flag set to 0 if the source operand is 0; otherwise it is set to 1. The OF, SF, ZF, AF, and PF flags

mov ax, bx vs. mov ax, [bx]

泪湿孤枕 提交于 2019-12-10 06:28:15
问题 What is the difference between the following two lines? mov ax, bx mov ax, [bx] If bx contains the value 100h and the value at memory address 100h is 23, does the second one copy 23 to ax ? Also, what is the difference between the two following lines? mov ax, 102h ; moves value of 102h into register ax mov ax, [102h] ; Actual address is DS:0 + 102h 回答1: Yes. The operand between the brackets is treated as an address and the value at that memory address if fetched. 来源: https://stackoverflow.com

passing arrays to functions in x86 asm

北城余情 提交于 2019-12-09 23:41:09
问题 I'm learning x86 asm and using masm, and am trying to write a function which has the equivalent signature to the following c function: void func(double a[], double b[], double c[], int len); I'm not sure how to implement it? The asm file will be compiled into a win32 DLL. So that I can understand how to do this, can someone please translate this very simple function into asm for me: void func(double a[], double b[], double c[], int len) { // a, b, and c have the same length, given by len for

error LNK2001: unresolved external symbol _MessageBox

空扰寡人 提交于 2019-12-09 05:19:02
问题 I am trying to create a helloworld program using only masm and not masm32 libs. Here is the code snippet: .386 .model flat, stdcall option casemap :none extrn MessageBox : PROC extrn ExitProcess : PROC .data HelloWorld db "Hello There!", 0 .code start: lea eax, HelloWorld mov ebx, 0 push ebx push eax push eax push ebx call MessageBox push ebx call ExitProcess end start I am able to assemble this using masm: c:\masm32\code>ml /c /coff demo.asm Microsoft (R) Macro Assembler Version 9.00.21022