MASM

error A2022: instruction operands must be the same size

旧城冷巷雨未停 提交于 2019-12-02 07:01:55
Hey so I am getting this error when I run this code: 1>------ Build started: Project: Project, Configuration: Debug Win32 ------ 1> Assembling [Inputs]... 1>assign2.asm(32): error A2022: instruction operands must be the same size 1>assign2.asm(33): error A2022: instruction operands must be the same size 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations\masm.targets(49,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\assign2.obj" /Fl"Project.lst" /I "c:\Irvine" /W3 /errorReport:prompt /Taassign2.asm" exited with code 1. ========== Build: 0 succeeded, 1

How can I convert a number in a string to any base in assembly?

陌路散爱 提交于 2019-12-02 06:37:01
How can I convert a number contained in a string from any base to any other base? Bases can be anything i.e.: 2, 16, 10, 4, 8, 9. I'm expecting the user to enter the base number. The user will enter the output base (the base to be converted to). The user will enter the number he wants to convert. Pre thoughts: I will save the input base and the output base in variables. Then I'll save the number he enters in a string (because he could enter any kind of number (hex, binary, base-5..). I'm just trying to figure out how to convert that string to a number so i can convert it to the output base.

Assigning value to the variable present in previous line using $ sign

我是研究僧i 提交于 2019-12-02 06:11:09
问题 I'm trying to understand the MS-DOS v2.0 source code, and in particular some of the code in MSDATA.ASM. This code was originally assembled with a 35+ year old MASM assembler (a version that wasn't commercially available). The code I'm interested in is near the beginning: SUBTTL Initialized data and data used at DOS initialization PAGE ; DATA AREA for MS-DOS IFNDEF KANJI KANJI EQU 0 ;FALSE ENDIF CONSTANTS SEGMENT BYTE PUBLIC 'CONST' EXTRN international_table:BYTE EXTRN Current_Country:WORD ORG

There is an assembly code written for Windows API, how to compile it on Linux and run with Wine

坚强是说给别人听的谎言 提交于 2019-12-02 05:47:59
There is an example code in this introduction , like below: ; Sample x64 Assembly Program ; Chris Lomont 2009 www.lomont.org extrn ExitProcess: PROC ; external functions in system libraries extrn MessageBoxA: PROC .data caption db '64-bit hello!', 0 message db 'Hello World!', 0 .code Start PROC sub rsp,28h ; shadow space, aligns stack mov rcx, 0 ; hWnd = HWND_DESKTOP lea rdx, message ; LPCSTR lpText lea r8, caption ; LPCSTR lpCaption mov r9d, 0 ; uType = MB_OK call MessageBoxA ; call MessageBox API function mov ecx, eax ; uExitCode = MessageBox(...) call ExitProcess Start ENDP End The above

error A2070: invalid instruction operands while using nested while loop in assembly language

◇◆丶佛笑我妖孽 提交于 2019-12-02 05:33:00
问题 I am trying nested while loop in assembly using masm. I am getting the "error A2070: invalid instruction operands" at line 15 i.e at the endw directive of internal while loop while running the following code. INCLUDE Irvine32.inc .data i byte 1 j byte 2 .code main PROC xor eax,eax .while i<5 mov j, 2 .while j<i mov al, j call writeDec call crlf inc j .endw inc i .endw exit main ENDP END main I cant find the reason for this. Can anyone help me? 回答1: The error is here: .while j<i You cannot

Assembly bit memory limit in arithmetic

别来无恙 提交于 2019-12-02 05:18:13
I wanted to add the following numbers: 40, 90, 50 and 155 and I get a total of 355. I wanted to experiment and test out whether the register AL will have a bit limit of (2^8) - 1, and when I compiled the code and execute the code, I get decimal of 1376331855. How did that happen? Also, I thought 355 is greater than 255, and as a result should display an overflow exception. I understand if I use MOVZX I will be able to carry the calculation into the higher register of AX. Also, I am very confused with the difference between AL and AH. Is there a different in memory allocation for AL and AH?

Assembly x86 division with DX:AX

断了今生、忘了曾经 提交于 2019-12-02 05:17:21
I'm working with masm and I've encountered a scenario I do not readily understand how to solve, for example: X = (A)/(C*D) If I multiple C*D first, my value is DX:AX and to my knowledge, I cannot use that as a divisor. If I do division separately as A/C and A/D, I run the risk of losing precision (from the reminders, etc.). What's the best way to implement this? As you correctly note, you can't use a 32-bit number as the divisor in a 16-bit division, but since we're only interested in doing integer division that's not a problem. There are two cases to consider (for unsigned division): DX == 0

在win10下配置DOSBOX和masm

梦想的初衷 提交于 2019-12-02 05:12:34
1、建立一个文件夹xxx将masm中的lnk.exe,masm.exe,ml.exe和debug.exe放到文件夹中,并mount C X:\xxx C: 单步运行程序 debug xxx.exe debug将程序加载入内存,设置CS:IP指向程序的入口,但debug并不放弃对CPU的控制,所以可以使用相关命令单步执行程序。 来源: https://www.cnblogs.com/aeron99/p/11731431.html

Assembly MASM Dealing with Negative Integers

可紊 提交于 2019-12-02 04:48:48
问题 I was instructed to write a program in assembly that will carry out the following arithmetic: ((A + B) / C) * ((D - A) + E) I've succeeded in doing this when no negative values come into to play, but suppose A = 5, B = 4, C = 3, D = 2, and E = 1. This gives us ((5 + 4) / 3) * ((2 - 5) + 1) or -6. this is where I need help. I've done some research, and have found 2's compliment to be a solution, but I'm not sure to implement it into my code. If someone could help me, I'd be very grateful!

x86 masm hello world

允我心安 提交于 2019-12-02 03:39:47
问题 I am trying to compile a hello world on windows with the ML and LINK that ship with VS 2010. .MODEL FLAT .STACK 4096 .data msg db "Hello World!",0 .code INCLUDELIB MSVCRT EXTRN printf:NEAR EXTRN exit:NEAR PUBLIC _main _main PROC mov eax, offset msg push eax call printf mov eax,0 push eax call exit _main ENDP END _main I keep getting linker errors saying that printf and exit are unresolved external symbols. I have a couple of questions. What are the command line options to use with ML and LINK