assembly

Do programming language compilers first translate to assembly or directly to machine code?

I'm primarily interested in popular and widely used compilers, such as gcc. But if things are done differently with different compilers, I'd like to know that, too. Taking gcc as an example, does it compile a short program written in C directly to machine code, or does it first translate it to human-readable assembly, and only then uses...

Assembly Language Primer video tutorials?

I've seen a lot of text based Assembly tutorials but finding it tough to learn from them. What video tutorials exist for Assembly Language? ...

Is IMUL AX valid?

Hi all, I spent last hour googling, trying to find out if IMUL AX is valid command in 80x86 assembler. Sorry for not trying out, I just don't have tools at PC I'm currently using. All I need is just a quick answer yes/no. Thanks! jpou Update: Tried and verified today. Works as expected. -R AX=0002 BX=0000 CX=20CD DX=0000 SP=FFEE...

how to use movntdqa to avoid cache pollution?

i am trying to write a memcpy function that does not load the source memory to the cpu cache. The purpose is to avoid cache pollution. The memcpy function below works, but pollutes the cache like the standard memcpy does. i am using P8700 proccesoor with visual C++ 2008 express. i see the cpu cache usage with intel vtune. void memcpy(c...

how to map memory as USWC under windows/linux?

I need to map most of the computer memory as uswc to take advantage of non-caching movntdqa. Is there any easy way to do this under windows or linux? ...

How to load kernel into memory from CD-ROM using Assembly (NASM)

Hello Everyone, I'm writing a bootstrap and kernel for myself and both bootstrap and kernel will be burn on a CD-R and will function as a CD-live. It is not a linux CD-Live or something else,is totally my own bootloader and kernel. I do not want to use other booloaders (i.e. GRUB) so please don't suggest me to use them. Here is my ques...

Macros in x86 assembly coding

Can somebody please explain how to use macros in x86 assembly coding ...

MC68000 question: Layout of data in RAM

i m taking exam in 8 hrs...plese there are somethings i need to make sure that i uderstand properly before my MC68000 exam. question--- Write the following values in the memory lacations below, as the microprocessor would store them as bits or hex starting at address $8000 A 2AC543 ---- for this one do i have to add two 00 in the fro...

MC68000 question: Result of a loop

dose anyone have clue how to work on this ::::: Given the the following piece of a code, write the corresponding bit storage (in hex) at the memory location starting at $8000 Source line School MOVEM.L D6/A3-A6,-(SP) ADD.W D2,D BVS School ...

C Programming: difference between ++i and i=i+1 from an assembler point of view?

This was an interview question. I said they were the same, but this was adjudged an incorrect response. From the assembler point of view, is there any imaginable difference? I have compiled two short C programs using default gcc optimization and -S to see the assembler output, and they are the same. ...

Difference between n = 0 and n = n - n

When I read this question I remembered someone once telling me (many years ago) that from an assembler-point-of-view, these two operations are very different: n = 0; n = n - n; Is this true, and if it is, why is it so? EDIT: As pointed out by some replies, I guess this would be fairly easy for a compiler to optimize into the same th...

Assembly compilation error (gcc4.2.4=win, gcc4.3.3=fail).

So, here's a piece of code that recently started causing grief when we upgraded to gcc4.3.3 from gcc4.2.4. void testAndSet( volatile int* s, int* val ) { __asm__ __volatile__ ( "btsl $0, %0\n " "jc bitSet\n " "movl $0, %1\n " "jmp returnVector\n" "bitSet:\n " "...

Language translators: Anything to Assembly

Im just curious if there is is any sort of program/application out there that will allow to enter code in one language and translate that to another language such as asm. This seems perfectly possible....so does anything like this exist? ...

Ada and assembly

I'm looking at making a hardware debug tool that runs on the bare CPU (x86), 32-bit protected mode and no OS. Due to time constraints, I won't be writing the tool all in x86 assembly. I like the Ada language (but am inexperienced with it) and thought it might be interesting to use Ada rather than C for this project. With C one can use ...

Why are x86 registers named the way they are?

For example, the accumulator is named EAX and, while the instruction pointer is called IP. I also know that there are bytes called CL and DH. I know there must be a convention to all of the names, but what is it? ...

Trouble understanding gcc's assembly output

While writing some C code, I decided to compile it to assembly and read it--I just sort of, do this from time to time--sort of an exercise to keep me thinking about what the machine is doing every time I write a statement in C. Anyways, I wrote these two lines in C asm(";move old_string[i] to new_string[x]"); new_string[x] = old_string...

Moving data from inline assembly into array in C

Hi I have a very simple problem; I have an array which should store me the results of some inline assembler routine. The question that I have is now how can I move the data from the inline assembler into the array? I am using gcc for compiling on an x86 machine. Consider the following simple code fragement: int main() { int resul...

What does the ORG directive do in assembly code?

For reference, the code is for the motorola 68008. Say I have code such as the following: org 200 sequenceO: ds.b 5 sequenceN: ds.b 5 move.w #sequenceO, A0 move.w #sequenceN, A1 Am I correct in thinking that A0 will hold the value 200 and A1 the value 205? One of the exam questions in a past paper was: "What are the physical addres...

What dissasembler do you recomend?

I'm into hacking challenges (like rankk.com) and some of the challenges require disassembly and little modifications of PE files. I'm looking for a disassembler/debugger that is able to dump the strings, walk the assembler code and allow modifications. My knowledge in this field is very limited so I'm looking for something relatively e...

RDTSC in C inline assembly causes segmentation fault!

Hi Thanks to some help of you guys I got my little inline assembler program almost there where I want it to have. However, there now seems to happen something very strange with the rdtsc command; basically, I get a segmentation fault when calling it. int timings[64*N]; int main(void) { int i; __asm__ __volatile__ ( "...