assembly

In this x86-64 instruction encoding documentation, what's the use of having 8, 16, 32, 64 bit GPRs? [duplicate]

放肆的年华 提交于 2021-01-28 07:37:10
问题 This question already has answers here : The advantages of using 32bit registers/instructions in x86-64 (2 answers) Intel X86 Assembly: How to tell many bits wide is an argument? (1 answer) x86 find out operand size of instruction given only the hex machine code? (2 answers) Why is default operand size 32 bits in 64 mode? (1 answer) 64 bit assembly, when to use smaller size registers (5 answers) Closed 3 months ago . I'm learning (slowly and painfully) about x86-64 instructions, and found

Comparing variables in NASM Assembly

僤鯓⒐⒋嵵緔 提交于 2021-01-28 07:36:27
问题 Serious trouble trying to get this working .. just starting NASM assembly so sorry if this is a noob of an issue, but any help is appreciated thankyou! Trying to get the two variables to render equal so the jump after cmp works. This is frustrating me greatly, as the direct values ( if a mov eax and ebx to be "5" ) it works so is it an address problem? I'm not sure. section .data str_equal db "Equal!", 0xA len_equal equ $ - str_equal str_number_a db "5" str_number_b db "5" section .text

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 - printf doesn't print without “\n”

好久不见. 提交于 2021-01-28 07:31:08
问题 So I'm confused. I'm going through the book "Programming from the Ground Up" and am working with using libraries. printf is working just fine so long as I include a "\n" in the string, but without it it will print absolutely nothing. Any idea why this happens? Code: .section .data my_str: .ascii "Jimmy Joe is %d years old!\n\0" my_num: .long 76 .section .text .globl _start _start: pushl my_num pushl $my_str call printf movl $1, %eax movl $0, %ebx int $0x80 Also, when I use -m elf_i386 for 32

Comparing variables in NASM Assembly

夙愿已清 提交于 2021-01-28 07:19:23
问题 Serious trouble trying to get this working .. just starting NASM assembly so sorry if this is a noob of an issue, but any help is appreciated thankyou! Trying to get the two variables to render equal so the jump after cmp works. This is frustrating me greatly, as the direct values ( if a mov eax and ebx to be "5" ) it works so is it an address problem? I'm not sure. section .data str_equal db "Equal!", 0xA len_equal equ $ - str_equal str_number_a db "5" str_number_b db "5" section .text

The difference between signed and unsigned, what means a negative byte?

二次信任 提交于 2021-01-28 07:02:41
问题 I need to solve the problem below, but I don't understand the concepts needed for solution. Let's consider the following string of doublewords: B234* A68C *h, * 52B4 *78C8h, * 1AB3 *C470h, F9DC* 98B6 *h. It is required to: 1) print on the screen the words ' ranks that have the minimum value from each doubleword (considering them unsigned ) The answer is '2112' (the bold words have the minimum value) 2) print on the screen the sum of the bytes that have the maximum value from these words

Invalid float point operation on Move?

泪湿孤枕 提交于 2021-01-28 06:41:40
问题 I´m experiencing an weird issue that I have never seen before, in Delphi 2010 sometimes when using the routine CopyMemory (Which internally calls Move) I get an Invalid Float Point Operation exception, when such thing could happen when using Move?? I have a debug information in assembler, I have checked the source code of Move and the problem happens in FILD instruction, I found that FILD converts an integer value from memory to float point in a register and it could trigger that invalid

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

Writing a putchar in Assembly for x86_64 with 64 bit Linux?

旧城冷巷雨未停 提交于 2021-01-28 06:10:27
问题 I am trying to use the write syscall in order to reproduce the putchar function behavior which prints a single character. My code is as follows, asm_putchar: push rbp mov rbp, rsp mov r8, rdi call: mov rax, 1 mov rdi, 1 mov rsi, r8 mov rdx, 1 syscall return: mov rsp, rbp pop rbp ret 回答1: From man 2 write , you can see the signature of write is, ssize_t write(int fd, const void *buf, size_t count); It takes a pointer ( const void *buf ) to a buffer in memory. You can't pass it a char by value,

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