assembly

Equivalent asm code for C/C++ codes

Possible Duplicate: How do you get assembler output from C/C++ source in gcc? Hello out there! I have a C and C++ source code that I wanted to see in assembly code. How can I produce an equivalent asm codes for those? What tools should I use? Or is it already possible in using tools such as the gcc compiler? Then what command...

x86-64 and far calls / jumps

Quick summary: in x86-64 mode, are far jumps as slow as in x86-32 mode? On the x86 processor, jumps fall into three types: short, with a PC-offset of +/-127 bytes (2 byte instruction) near, with a +/- 32k offset that "rolls around" the current segment (3 byte instruction) far, which can jump anywhere (5 byte instruction) short and n...

Mach-O 64-bit format does not support 32-bit absolute addresses

Hi, I have a sample piece of code that writes the value of the xmm6 register into a memory location. The code is in NASM: value: dd 0 movq [value], xmm6 However I am getting the error when I tried to compile it to macho64 format: 64-bit format does not support 32-bit absolute addresses. Is there a way to resolve this? I am...

JITs fundamentals

I understand somewhat how "int a = b+abs(c)" can be translated to simple assembly instructions and then translate that to some binary blob. But how can this be run and be interacted with dynamically in memory? -- edit -- I know C doesn't have an eval feature. But what it's compiled to does. I mean this is what makes Java like JITs, and...

Debugging Assembly Code (Intel 8086)

I'm in an Assembly class focusing on the intel 8086 architecture (all compiling / linking / execution comes from running DOS on win7 via DOS-Box). I've finished programming the latest assignment, but as I have yet to program any program successfully the first time through, I am now stuck trying to debug my code. I have visual studio 20...

Upgraded xcode 3.2.3 and breakpoints now show in asm view only

I just upgraded to xcode 3.2.3 and snow leopard and my breakpoints now only show in asm. All the files in the callstack leading up to the topmost one show in my C source however. Does anyone know of an issue where after upgrading the breakpoints suddenly do not show in C, or is this some simple option that possibly got set when it read...

x86 memory and I/O map

Hi, the semester is over so I sank a bit into assembly again. I have read some articles and parts of x86 family user's manual concerning the memory map and I/Os and I still haven't figured out how does it work.. As I understand it now, I can access the I/Os with IN and OUT instructions, in that case is it like the port number I use as a...

Decompiling an ARM asm back to C

I wrote a nice ARM assembler routine a few years back and it has done its job beautifully over the years on the ARM embedded systems it was designed for. Now, the time has come to port it on to non-ARM systems and I was wondering if there was tool or some sort of method to take my original ARM assembler source and get a rudimentory C fi...

Resources for x86 decompilation

I'd like to get a solid understanding of the low level process for representing and running a program. I've decided to do this by writing a program to parse and display object file information (headers, sections, etc.). I've nearly finished this part. A natural extension is to decompile the remaining relevant data into assembly instructi...

Getting assembly language programming skills

Hello, I am a DSP,Embedded software programmer, looking to improve my assembly language programming skills. For 7 years of my career i have been programming in C, Matlab, little bit of assembly language coding.(ARM assembly, DSP processor assembly). Now i want to improve my assembly language coding skills(it can be any assembly languag...

Basic NES Emulation theory - I'm stuck

In advance, I apologize for the open endedness, and general wishy-washiness of this question, because to be honest my knowledge of the topic is very patchy and I'm finding it hard to even describe my problem. I really didn't want to post, but I'm completely and utterly stuck. I have started a NES emulator. It's interpreted (so no dynami...

DOS debug like program for 32-bit x86 assembly

Many of you may recall the old DOS program--debug. Though outdated in many respects, one of the nice things about it was that one could easily find the byte-sequence for a given instruction without having to go through the steps of writing a program, compiling, disassembling, examining the file contents, .... Enter the instruction, the...

Fastest factorial implementation with 64-bit result in assembly.

This is not homework, just something I though of. So, straight computing factorial is not exactly fast; memoization can help, but if the result is to fit into 32 or 64 bits, then the factorial only can work for inputs 0 through 12 and 20 respectively. So ... we might as well use a lookup table: n n! 0 1 1 1 2 2 ...

8086 Assembly interrupts for reading/writing binary to/from files?

I need to read in about 1KB or so of data at a time, manipulate it, and write it to another file. I need to do this for at least 100 MB. I have never done any file IO in assembly before. What interrupts do I need to call and what needs to be in what registers? ...

Getting 64-bit CPUID sample code to compile in VS2008

I'm trying to get some c & ASM sample code I found running in Visual Studio 2008. I don't think the problem is the difference between VS 2005-2008. This example is supposed to get the CPUID on 64-bit systems. (My attempts getting the ASM-only 32-bit examples to compile failed too) I can copy and paste this code into a new project, bu...

Large binary shifts in 8086 assembly?

I have a binary chunk of data 512 bytes long, I was wondering what the most efficient way would be if I wanted to shift it once to the right. My best guess right now (very new to assembly) would be that I would have to first check a chunk (probably int) to see what it would shift out, shift, then carry in whatever the previous int would...

What language and tools were originally used to develop Sega MD/Genesis games?

Someone has suggested to me it was assembler, though I think there were some visual design tools, too. So how did they make it? ...

What are IN & OUT instructions in x86 used for?

I've encoutered these to instructions IN & OUT while reading "Understanding Linux Kernel" book. I've looked up reference manual. 5.1.9 I/O Instructions These instructions move data between the processor’s I/O ports and a register or memory. IN Read from a port OUT Write to a port INS/INSB Input string from port/Inpu...

Unexplained stack allocation in native C code built for x64 under Visual Studio 2010.

I am trying to use CL 16.0 for x64 (VS 2010) to produce some readable 64-bit ASM code for an example, but CL insists on preallocating a ton of stack space (28h bytes), with the following line: sub rsp, 40 ; 00000028H (actual value depends on number of local vars of course) Question is, how can I disable this behavior? It is difficult...

Assembly? LD & MOV

What's the difference between that instructions? By example in the ARM9 processor, it shouldn't be: ASM: mov r0, 0 C: r0 = 0; ASM: ld r0, 0 C: r0 = 0; ? I don't know why to use one or other :S ...