MASM

How to loop in assembly language

我们两清 提交于 2019-12-04 15:56:53
问题 How would I calculate the first 12 values in the Fibonacci number sequence and be able to place it in EAX reg. and display calling DumpRegs? Using Indirect addressing I know I need a for loop here but I'm not sure how to even go about this. Any help or tips are appreciated. INCLUDE Irvine32.inc ; (insert symbol definitions here) .data ; (insert variables here) Fibonacci BYTE 1, 1, 10 DUP (?) .code main PROC ; (insert executable instructions here) ; (This below will show hexa contents of

[MASM]Another 'cannot use 16-bit register with a 32-bit address' error

耗尽温柔 提交于 2019-12-04 10:46:51
I'm learning assembly language with MASM assembler and I get stuck when I tried to assemble a simple file using this command : ml /c test.asm and the test.asm file looks like : .386 .model flat .code MOV BP,WORD PTR[BP+4] END then the problem comes: Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: test.asm test.asm(4) : error A2155: cannot use 16-bit register with a 32-bit address the question is , 32-bit address?I didn't tell the assembler to use a 32-bit address. and How can I get my code passed? I've done some

how to convert floating-point number to IEEE 754 using assembly

别说谁变了你拦得住时间么 提交于 2019-12-04 06:57:37
问题 can you please help me to convert floating-point number to IEEE 754 using assembly i have this number -1.75 and i know it equla to -1.11000000000000000000000 E+0 on IEEE754 but i dont know how to do the convert in assembly 回答1: Did you mean something like this: ; Conversion of an ASCII-coded decimal rational number (DecStr) ; to an ASCII-coded decimal binary number (BinStr) as 32-bit single (IEEE 754) include \masm32\include\masm32rt.inc ; MASM32 headers, mainly for printf .data DecStr db "-1

Can we use Two 32 bit reg(32 + 32 = 64) at a time to make it able to take 64bit values? Assembly Language 8086

淺唱寂寞╮ 提交于 2019-12-04 06:15:12
问题 Assembly Language 8086: I have make the program for addition it takes two values in console and gives us result.. it can only take value under 32 bits(8 digits) if we give higher value then it will give error of integer overflow in console If i want to give more then 32bit value in input1 and input2 how will i do it? I Want add value1 to value2 by using 32bit register and give value under 64bit(equals to 16 digits).. it is Possible to use the space of 2 reg (32+32 = 64bit)? ... How we can

mul and memory allocation in registers edx::eax with masm

房东的猫 提交于 2019-12-04 05:23:23
问题 I am trying to understand the logic of using the "mul" operand in the assembler(i am using Visual Studio Community and MASM). Why, after "mul ebx" the result is changing also edx, and not only the eax? "The result(of MUL) is stored in register AX, register pair DX:AX, or register pair EDX:EAX (depending on the operand size), with the high-order bits of the product contained in register AH, DX, or EDX". So is the location depending on the size of the operand?In which case? .586 .model flat,c

Strange output with Irvine's WriteString

不打扰是莪最后的温柔 提交于 2019-12-04 04:08:23
问题 the point of the following program is to print out the letter "c" with the combination of every background and foreground color. In the library I'm using the colors are defined 0-15 and with the following code: mov eax,FOREGROUND + (BACKGROUND * 16) call SetTextColor Here is my code: INCLUDE Irvine32.inc .data character BYTE "c" count DWORD ? background DWORD 0 .code main PROC call Clrscr mov ecx, 15 ; our main counter 0-15 colors L1: mov count, ecx ; store our outer loop counter mov ecx, 15

Inline Assembly Jump Error

試著忘記壹切 提交于 2019-12-04 02:36:41
问题 Why does this fail, once Masm reaches jmp? struct gdt_entry { unsigned short limit_low; unsigned short base_low; unsigned char base_middle; unsigned char access; unsigned char granularity; unsigned char base_high; }; struct gdt_ptr { unsigned short limit; unsigned int base; }; struct gdt_entry gdt[3]; struct gdt_ptr gp; void gdt_flush() { __asm{ lgdt [gp] mov ax, 0x10 mov ds, ax mov es, ax mov fs, ax mov gs, ax mov ss, ax ; push the address on the stack push 0x08 mov eax, offset flush2 push

Building Boost with MinGW64 without MASM

二次信任 提交于 2019-12-03 21:42:09
问题 I tried to build the Boost library for native 64bit using MinGW64 compiler, but got some failures. Any pointers are appreciated. Thanks. I got the bjam.exe (b2.exe) compiled in 64bit (with warning) and I used it the get the Boost built. I got the following error when building Boost.Context. (I wrote the command in batch for repeatable building). Anything I missed? Command: b2.exe install --prefix=%~dp0\bld\Boost.Build Error: 'ml64' is not recognized as an internal or external command,

Simple Assembly program on visual studio 2017

心不动则不痛 提交于 2019-12-03 16:31:15
.386 .model flat, c .stack 100h printf PROTO arg1:Ptr Byte .data msg1 byte "Hello World!", 0Ah, 0 .code main proc INVOKE printf, ADDR msg1 ret main endp end main Hi, I am getting the below errors: I searched around and found someone said that it can be fixed by linking the microsoft runtime library Can anyone teach me how can I exactly fix it? Thanks Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol _printf referenced in function _main testing C:\Users\Kin\Desktop\assembly\testing\testing\Source.obj 1 Error LNK1120 1 unresolved externals