x86

moving data between Assembler Registers

Dear All, What is the purpose of just several 'mov' type statements one after another in Assembler. It seems to me that just moving data between different registers is rather 'purposeless', although it most likely not so. Example: Worker work = new Worker(); // C# statement 00000035 B9 40 9E 31 00 mov ecx,319E40h 0000003...

Extended Interrupt 13, Reading an unformatted Disk.

It's been a while since I did any ASM, and decided to once again try and write a small bootloader, testing with qemu. My issue is with interupt 13, for some reason the carry flag is being set, so the read is failing. Currently, my disk image looks like: 512 Byte BootLoader <- This (as far as I'm aware) Is block 0 in LBA Main Function <...

x86 and x64 stack frames

What is the difference when the compiler allocates variables on the stack in x86 v x64 architectures? Say I have a function foo(){ int i = 5; i += 4; } how is this allocated on the stack differently in these two architectures? ...

Create Executable From Assembly Code

Hello, I need to create an executable from the next assembly code: .MODEL SMALL .DATA TEXT DB 'Hello world!$' .CODE .STACK 20 .STARTUP MOV AX, @DATA MOV DS, AX MOV AH, 9 MOV BL, 02H INT 10H MOV Dx, OFFSET TEXT INT 21H MOV AH, 4CH INT 21H END It works with Turbo Assembler (tasm.exe), but I don't want to continue working with it, becau...

What does "int 0x80" mean in assembly code?

Can someone explain what the following assembly code does? int 0x80 ...

Why is a 16-bit register used with BSR instruction in this code snippet?

In this hardcore article there's a function find_maskwidth() that basically detects the number of bits required to represent itemCount dictinct values: unsigned int find_maskwidth( unsigned int itemCount ) { unsigned int maskWidth, count = itemCount; __asm { mov eax, count mov ecx, 0 mov maskWidth, ecx ...

How to write to & read from network card in x86 assembly?

Hi, does anyone know how to gain access to devices such as an ethernet port on a mainboard or on a pci card? Are there special registers? Opcodes? Do I have to make a call to the OS? If so, how? Thanks in advance. ...

Benefits of x87 over SSE

I know that x87 has higher internal precision, which is probably the biggest difference that people see between it and SSE operations. But I have to wonder, is there any other benefit to using x87? I have a habit of typing -mfpmath=sse automatically in any project, and I wonder if I'm missing anything else that the x87 FPU offers. ...

Is an entire process’s virtual address space split into pages

Note: I'm attempting to study a high-level overview of Virtual Memory allocation Is an entire process's virtual address space split into pages, of a particular size: .text .bss .data Does this also include heap space and stack - or is this always non-pageable? ...

Purpose of ESI & EDI registers?

What is the actual purpose and use of the EDI & ESI registers in assembler? I know they are used for string operations for one thing. Can someone also give an example? ...

How do you determine 32 or 64 bit architecture of Windows using Java?

How do you determine 32 or 64 bit architecture of Windows using Java? Thanks. ...

How can I find the current date in intel x86 Assembly?

I need to find the find the current date in binary for Intel x86 Assembly on Windows. I'm allowed to use Windows procedures. ...

How do I determine whether an application I am installing is 32bit or 64bit?

I want to be able to predict the default install location of an application. On a 64 bit machine, if it is a 32bit application, it would install in "Program Files (x86)" and if it were a 64bit application, it would install in "Program Files". My goal is to install the application with its default location and validate if the install was...

Why would one use "movl $1, %eax" as opposed to, say, "movb $1, %eax"

As the title states, why would one use "movl $1, %eax" as opposed to, say, "movb $1, %eax", I was told that movl would zero out the high order bits of %eax, but isn't %eax a register that's equivalent to the size of the system's wordsize? meaning that movl is in actuality an integer operation (and not a long?) I'm clearly a bit confused...

Printing out a number in assembly language?

mov al,10 add al,15 How do I print the value of 'al'? ...

Side-effects of x86 assembly right-shift operator SHR?

I'm tracing through a program with an ASM debugger ollydbg and I come across this code snippet, which is a loop segment: CPU Disasm Address Hex dump Command Comments 007D05EC |. 33C9 XOR ECX,ECX 007D05EE |. 8BFF MOV EDI,EDI 007D05F0 |> 8B54B4 10 /MOV EDX,DWORD PTR S...

AT&T inline syntax

can anyone show my the correct AT&T syntax to do what i'm doing below in INTEL i've shown my attempts at AT&T, but they don't compile... unsigned int CheckIfGenuineIntel(void) { unsigned int VendorIdentificationString[4] = {0, 0, 0, 0}; #if defined( _DO_INTEL_ ) __asm__ __volatile__ ( "xor eax, eax\n\t" "cpu...

What is the fastest way to test if a double number is integer (in modern intel X86 processors)

Our server application does a lot of integer tests in a hot code path, currently we use the following function: inline int IsInteger(double n) { return n-floor(n) < 1e-8 } This function is very hot in our workload, so I want it to be as fast as possible. I also want to eliminate the "floor" library call if I can. Any suggestions? ...

Modern equivalent to DPMI

In the old days of DOS there was DPMI (DOS Protected Mode Interface). I allowed amongst other things the ability for your programs to break the 640K barrier. In more modern times with CPUs having EMT64 (Extended Memory 64 Technology) i7s with 12 gig ram, is there an equivalent technology that allows me to use this extra memory from a 32...

Segmentation fault when executing program compiled from x86 assembly?

Hi everybody! I'm new to assembly language and I have to implement a function, in my case sin(x), that could be called from a C source file. I have to make 2 separate files: *.c and *.s When compiling through gcc on ubuntu all good, but when the program executes it gives me the error "Segmentation fault"... To compile I type: gcc -c -o...