assembly

What exactly does the 3 operand imul instruction do in ia-32 assembly?

I'm reading the instruction imul 0xffffffd4(%ebp, %ebx, 4), %eax and I'm baffled by what it's doing exactly. I understand that imul multiplies, but I can't figure out the syntax. ...

An SSE Stdlib-esque Library?

Generally everything I come across 'on-the-net' with relation to SSE/MMX comes out as maths stuff for vectors and matracies. However, I'm looking for libraries of SSE optimized 'standard functions', like those provided by Agner Fog, or some of the SSE based string scanning algorithms in GCC. As a quick general rundown: these would be th...

MASM winsock error?

Hello everyone, I'm following along with a winsock tutorial in MASM's syntax called: Iczelion's Guide to Winsock Programming I'm stuck, I receive an error but I don't know how to fix it. The thing is that everytime I try to connect to a server with my socket, I receive a WSANOTSOCK error (a socket opperation is preformed on something th...

Simple division function in IA32 assembly

I am working on an assignment for my class. My C++ code calls the _Divide function to take in 2 values to divide and return into 'Result'. To start I move -1 into eax. Once I'm done with the process, my eax keeps returning '-1' as the value. What could I be doing wrong? Here's my assem code: public _Divide .386 .model flat .code _Divide...

Is there any C compiler to show you linked program in asm?

I am searching for a compiler or better IDE for C which could generate completely linked program, including functions from CRT, in assembler form. Is there any? I tried Visual C Express 2008. It has a disassembler, but its somewhat strange. I mean for some reason it shows many "strange" lines of code, such as mov a,#3 in about 100 lines....

MASM str and substr?

Hello everybody, I'm currently coding an irc bot in asm I have already done this once in C++, so I know how to solve most problems I encounter, but I need a substr()[*] function like the one seen in C++. I need the substr fucntion to receive the server name from a PING request so I can respond with the corresponding PONG response But I ...

Assembly - SEH - undef symbol err? What did I miss?

.386 .model flat, stdcall option casemap :none include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\masm32.inc include \masm32\include\kernel32.inc include \masm32\include\comdlg32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \mas...

Windows Assembly Doubt - x86

Hey guys, I'm building a Windows Assembly program without any macro. So I downloaded a program that was using macros, and I'm converting this into "pure" assembly code. However I'm facing one issue here. There's a label @@: that I don't understand, and also a jump jne @F that I didn't get it. What are these 2 symbols? MyWndProc: ...

TASM how to get command line arguments?

how do you get command line argument in TASM? Pretty simple in MASM32 invoke GetCL,1,addr buffer ...

How's return value implemented in assembly level?

int main(void){ printf("Hello World"); return 0; } How is 0 passed as return value in assembly level? Is there a dedicated CPU register for this job? UPDATE Here's the 2 tables on passing/return data in the pdf, but doesn't seems to have the exact info on how the calling convention of an API is determined and which register is use...

GCC Inline Assembly Multiplication

I'm trying to learn GCC inline assembly on Linux (x86), and my first experiment was to try and implement integer overflow detection for multiplication. It seems easy enough, but it is having side effects which I don't understand. So, here I want to multiply two unsigned 8-bit integers, and see if the result overflows. Basically I just...

What x86 register denotes source location in movsb instruction?

What x86 register denotes source location in movsb instruction? ...

Representing a signed 8-bit integer?

IF F6 base hex is a signed 8-bit integer, how much does it represent in decimal? ...

Convert IEEE float hex to decimal?

IF I have a IEEE float hex 42F6E979, how do I convert it to decimal? I believe the decimal representation is = 123.456001 ...

Causing a divide overflow error (x86)

I have a few questions about divide overflow errors on x86 or x86_64 architecture. Lately I've been reading about integer overflows. Usually, when an arithmetic operation results in an integer overflow, the carry bit or overflow bit in the FLAGS register is set. But apparently, according to this article, overflows resulting from divis...

Unsigned Overflow in C

Consider the following piece of C code: #include <stdint.h> uint32_t inc(uint16_t x) { return x+1; } When compiled with gcc-4.4.3 with flags -std=c99 -march=core2 -msse4.1 -O2 -pipe -Wall on a pure x86_64 system, it produces movzwl %di,%eax inc %eax retq Now, unsigned overflow is predicted in C. I do not know much about x86_64...

How do you store a decimal number with a fraction?

if I want to store 10.125 how is it done? I have this: ORG $1000 DN DC.L 10.125 END $400 and in the debug it is stored as: 00001000= 0000000A That doesnt seem to be getting the fraction part in there. This is assembly 68k. ...

MASM cmpsb problems

Hello everybody I'm having a problem comparing two strings with each other, one string receives data from an irc server, one line at a time, and the other holds hard coded data ("PING :") But every time I try and compare the strings nothing happens. Can you guys help me out? The compare function is in Handleping Here's the code I'm cu...

Can you help improve one of my college's class on low level software and peripheral interfaces?

Hello, everyone. I am a 2nd year student at the Portuguese Engineering Faculty at the University of Oporto. I am currently studying for a Joint Degree (5 yr undergrad + masters) in Informatics and Computer engineering (which is basically software engineering :P). I think the course is great, and well structured, but I was in for a nast...

Labels in GCC inline assembly

In my ongoing experimentation with GCC inline assembly, I've run into a new problem regarding labels and inlined code. Consider the following simple jump: __asm__ ( "jmp out;" "out:;" : : ); This does nothing except jump to the out label. As is, this code compiles fine. But if you place it inside a function, and the...