ia-32

Dumping the values of the registers in GCC

I need to get the values in the registers with GCC. Something similar to this: EAX=00000002 EBX=00000001 ECX=00000005 EDX=BFFC94C0 ESI=8184C544 EDI=00000000 EBP=0063FF78 ESP=0063FE3C CF=0 SF=0 ZF=0 OF=0 Getting the 32-bit registers is easy enough, but I'm not sure what the simplest way to get the flags is. In the examples ...

Trouble examining byte code in MSVC++

I've been messing around with the free Digital Mars Compiler at work (naughty I know), and created some code to inspect compiled functions and look at the byte code for learning purposes, seeing if I can learn anything valuable from how the compiler builds its functions. However, recreating the same method in MSVC++ has failed miserably ...

Why is printf showing -1.#IND for FPTAN results?

I am working on a program which produces assembler code from expressions. One of the functions required is tan(x) which currently works using the following sequence of code (the addresses are filled in at run time): fld [0x00C01288]; fld st(0); fsin; fld st(1); fcos; fdivp; fst [0x0030FA8C]; However, I would like to use the FPTAN opco...

Byte order of DEC VAX vs IA-32

A description of the problem follows. You can skip to the bottom line if you're not interested. I am working with a data file with this description: A 109-slice MRI data set of a human head. Complete slices are stored consecutively as a 256 x 256 array. Pixels consist of 2 consecutive bytes making one binary integer. Data taken o...

Is there a way to store part of a 16 bit value in an 8 bit variable in Assembly?

I created one variable that stores a 16 bit variable, and I'm tring to store the upper half in an 8 bit variable. How do I do this? EDIT: its for the IA-32, and I don't think i can use registers EDIT2: I am allowed to use registers. ...

Cannot access label through segment registers, error in assembly

INCLUDE Irvine16.inc .data byteArray BYTE 6 DUP(?) listSize = ($ - byteArray) aSum WORD 0 soffset = 0 .code main PROC mov ax, @data mov ds, ax mov cx, listSize Loop1: mov ax, 0 movzx ax, [byteArray + soffset] add aSum, ax soffset = soffset + 1 loop Loop1 exit main ENDP END main ...

Integer Overflow IA 32

How does overflow work in ia-32? For instance, what would happen to the following code? What flags would it throw? movl $0x1, %eax addl $7fffffff, %eax Thanks! ...

Linux IA-32 memory model

Hi, I'm looking on the Linux IA-32 memory model processes see and have a simple question to it. What is there in the grey areas in the picture? Or is it just to show start and end of the memory? So, do text start at 0x0 and stack start at 0xFFFFFFFF? Best regards, Lasse Espeholt ...

Working with double-precision numbers in inline assembly (GCC, IA-32)

I'm just starting to learn assembly in my computer science class, and I have an assignment to round a floating-point value using a specified rounding mode. I've tried to implement this using fstcw, fldcw, and frndint. I modify the rounding control bits, round the number, and then restore the previous control bits (a requirement of the as...

IA-32: Pushing a byte onto a stack isn't possible on Pentium, why?

Hi, I've come to learn that you cannot push a byte directly onto the Intel Pentium's stack, can anyone explain this to me please? The reason that I've been given is because the esp register is word-addressable (or, that is the assumption in our model) and it must be an "even address". I would have assumed decrementing the value of some...

Question about the Intel's IA-32 software developer manual

I'm studying the Intel's IA-32 software developer manual. In particular, I'm reading the following manual: http://www.intel.com/Assets/PDF/manual/253666.pdf. Let's take for example the ADD instruction. On page 79 it is written that you can add an r8 (8-bit register) to an r/m8 (8-bit register or memory location). A few rows below, it is ...

Interaction between for loops with clock function?!

Can someone explain me the exact interaction in context of delay between the two for loops with clock function. How does for1 interact with for2 on the cout statement(30 on 640000000)? start=clock(); cout<<endl<<start<<endl; for(delay=0; delay<30; delay++) for(i=0; i<640000000; i++); end=clock(); cout<<end<<endl; cout<<"Num of tick...

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. ...

Where does the frame pointer point after set up?

Despite looking at textbooks trying to grasp this, I'm having trouble. 0x08048b29 <func+0>: push %ebp 0x08048b2a <func+1>: mov %esp,%ebp 0x08048b2c <func+3>: push %ebx ... 0x08048b30 <phase_2+7>: lea -0x28(%ebp),%eax In the lea instruction, I understand that %eax gets the value at 0x28 before %ebp, but wh...