MASM

Coverting String Decimal to Binary and Hexa in Assembly 8086

陌路散爱 提交于 2021-01-29 16:14:29
问题 I'm trying to convert a string I read with this code to binary and hexa. READ_STRING: MOV DX, offset buffer MOV AH, 0Ah INT 21h MOV SI, 1d MOV AX, 0 XOR CX, CX MOV CL, buffer[SI] INC SI LOOP_1: MOV DX, 10 MUL DX MOV DL, buffer[SI] SUB DL, 30h MOV DH, 0 ADD AX, DX INC SI LOOP LOOP_1 RET So far I have this code for binary output but it always prints "1001" (9 in decimal): NEXT: XOR AX, AX XOR BX, BX XOR CX, CX MOV CL, 2 MOV AL, byte ptr[nombre] MOV DI, offset binaire ; DIV : divide AX by CL.

Can't output coprocessor float from variable two times in a row

谁说胖子不能爱 提交于 2021-01-29 14:35:55
问题 Good afternoon! In this example, I simply add two numbers with a comma, save the variable in tbyte and display the same variable two times in a row on the screen, but the first time I get 11.1 , as it should be, and the second time 4.667261E-062 . Why is this happening? And one more question, is it possible in tbyte to somehow save and access numbers by array type? for example, storing numbers in dd , I just could save and read them in increments of 4, for example, result [0] , result [4] ,

Looping and processing string byte-by-byte in MASM assembly

半腔热情 提交于 2021-01-29 04:54:55
问题 I am using MASM assembly and I am trying to write a loop that processes the string str1 byte-by-byte, changing each lowercase letter into the corresponding capital letter using bit operations. If the letter is already capital, leave it alone. Nothing seems to happen to my string str1 when I execute my code and I'm having difficulty figuring out why, maybe I shouldn't be processing my array as such, but nonetheless, here's the code: .386 .MODEL FLAT str1 dword "aBcD", cr, Lf, 0 .... .code

Looping and processing string byte-by-byte in MASM assembly

巧了我就是萌 提交于 2021-01-29 04:51:18
问题 I am using MASM assembly and I am trying to write a loop that processes the string str1 byte-by-byte, changing each lowercase letter into the corresponding capital letter using bit operations. If the letter is already capital, leave it alone. Nothing seems to happen to my string str1 when I execute my code and I'm having difficulty figuring out why, maybe I shouldn't be processing my array as such, but nonetheless, here's the code: .386 .MODEL FLAT str1 dword "aBcD", cr, Lf, 0 .... .code

How does 32-bit MASM mode differ from 64-bit?

十年热恋 提交于 2021-01-28 11:15:06
问题 To write a complete program in 32-bit assembly language using MASM one may start like this, .686 .model flat,c .stack 100h .data number sdword 5 .code main proc mov eax,number ret main endp end main whereas in 64-bit mode the code is written as .data number sdword 5 .code main proc mov eax,number ret main endp end The settings are set to default which led to occur an error while assembling in a 64-bit mode not because the platform is set to Win32, but instead the default entry point

Assembly - Move with Zero Fill for Different Data Sizes

╄→гoц情女王★ 提交于 2021-01-28 07:36:04
问题 Currently learning assembly language using Masm. This is for an assignment in my class. I must do certain calculations using 32-bit registers (EAX and EBX). I have to handle BYTE, WORD, and DWORD variables. Not really complicated. I do not really understand why am I getting so many errors when assembling the current code: INCLUDE Irvine32.inc .data ; (declare variables) bNum01 BYTE 64 bNum02 BYTE 32 bNum03 BYTE 16 bSum BYTE ? bDiff BYTE ? bResult BYTE ? wNum01 WORD 64 wNum02 WORD 32 wNum03

x86 Assembly Input a set of Integers

非 Y 不嫁゛ 提交于 2021-01-28 06:31:27
问题 The code below asks a user to input integers and the code will spit the same set of integers back to the user. include irvine32.inc .data input dword ? prompt1 byte "Input your numbers: ",0 .code mWriteNum Macro input push ecx push eax mov eax, offset input call writedec pop eax push ecx endM mReadInput MACRO input push ecx push eax mov eax, offset input mov ecx, sizeof input call Readint mov input, eax pop eax pop ecx endM main proc call clrscr mov edx, offset prompt1 call writeString

What is the largest integer number base 16 that can be store in a variable of type dword?

耗尽温柔 提交于 2021-01-28 05:48:42
问题 What's the largest number it can store? More importantly, could someone explain why dword can't store a larger number? 回答1: It has nothing to do with the base used per se. The largest number a DWORD can store is constrained by the fact that DWORD (at least in typical usage of DWORD, which is a Microsoft typedef) is a 32 bit wide unsigned integer. That means the largest number it can store is 2^32-1. In binary that's 11111111111111111111111111111111 . In hex it's 0xFFFFFFFF, as @GregHewgill

Confused about pointers and values in Assembly

最后都变了- 提交于 2021-01-28 04:21:52
问题 I'm using the MASM Assembler. Let's look at this short code (from a book I've been reading): .data var1 BYTE 10h .code main proc mov esi,OFFSET byteVal mov al,[esi] ; AL = 10h I didn't exactly understand how byteVal is translated to machine code - I know it's an identifier, a symbolic name. As I understand, at runtime byteVal is the memory address of the value 10h, right? but the book says that these two instructions are the same: mov al var1 mov al,[var1] I don't understand why they do the

error A2008: syntax error :

不羁岁月 提交于 2021-01-28 01:32:33
问题 I'm trying to write a bootloader for an OS I'm developing. I'm getting a syntax error on the first line. Here is my assembly code: .286 ; CPU Type .model TINY ; memory of model ;---------------------- EXTERNS ----------------------------- extrn _BootMain:near ; prototype of C func ;------------------------------------------------------------ ;------------------------------------------------------------ .code org 07c00h ; for BootSector _main: jmp short _start ; go to main nop ;---------------