assembly

unboxing using the ASM Java library

I'm using the ASM Java library to replace some reflection. I generate the body of this method: void set(Object object, int fieldIndex, Object value); With this generated method, I can set fields on an object at runtime without using reflection. It works great. However, I found it fails for primitive fields. Here is the relevant part o...

Fastest way to scan for bit pattern in a stream of bits

I need to scan for a 16 bit word in a bit stream. It is not guaranteed to be aligned on byte or word boundaries. What is the fastest way of achieving this? There are various brute force methods; using tables and/or shifts but are there any "bit twiddling shortcuts" that can cut down the number of calculations by giving yes/no/maybe co...

Hidden features of x86 assembly language?

What are some hidden-features of x86 Assembly Language? What Tips and Tricks do you have for working with x86 Assembly language? ...

Advice for learning Linux x86-64 assembly & documentation

Does anyone have documentation pertaining to learning the fundamentals of Linux x86-64 assembly? I'm not sure whether or not to learn it as is, or to learn x86 first, and learn it later, but being as I have an x86-64 computer and not an x86, I was thinking of learning x86-64 instead ;) Maybe someone could give me some incentive, and di...

Efficiency of C vs Assembler

Hi all, How much faster is the following assembler code: shl ax, 1 Versus the following C code: num = num * 2; How can I even find out? ...

How do you Echo Data?

Is there a way to echo DATA in 6800 assembly? If I have it stored like this: DATA DC.W 1,2,3,9,8,7 ...

Workflow for writing ARM assembly code on the iphone

I would like to begin writing ARM assembler and running it on the iPhone. This is not with the intent of using in an app to be released to the app store. Basically I would like to solve problems on ProjectEuler using ARM and the iPhone. Just for hobby and educational purposes. How can I go about doing this? I have not been able to come u...

How can I suppress the “terminate batch job” in Win7 cmd.exe

As discussed in another question, it's possible to patch cmd.exe to suppress the "Terminate batch job (Y/N)?" message. Patching instructions are available for Windows XP. Unfortunately, these patching directions are out of date for Windows 7, and I don't know enough assembly to update them. (I do know how to use a hex editor, and was a...

Fast in-register sort of bytes?

Given a register of 4 bytes (or 16 for SIMD), there has to be an efficient way to sort the bytes in-register with a few instructions. Thanks in advance. ...

Assembly language je jump function

Hello everyone! I am trying to find online the usage of the assembly language function "je". I read that je means jump if equal and that is exactly what I want. What is the actual usage of this function, or in other words, how to I type this function to check a value and jump if it is equal to something? Please let me know. BTW, I am u...

What happens in assembly language when you call a method/function?

If I have a program in C++/C that (language doesn't matter much, just needed to illustrate a concept): #include <iostream> void foo() { printf("in foo"); } int main() { foo(); return 0; } What happens in the assembly? I'm not actually looking for assembly code as I haven't gotten that far in it yet, but what's the ba...

Debugging disassembled libraries with gdb

Hello, in Linux and Mac OS X I can use stepi and nexti to debug an application without debugging information. On Mac OS X gdb shows the functions that are called inside the library, although sometimes advancing several assembler instructions in each stepi instruction. On Linux, when I step into a dynamic library gdb gets lost. For ins...

return from a JMP in assembly x86?

Hi, I am calling a PROC to test two values in assembly x86 16bits and then jump if the value is bigger than zero, so I am doing something like this: TESTIT PROC CMP AX,1 JG FOO RET TESTIT ENDP FOO: ;do something END FOO MAIN: CALL TESTIT .EXIT END MAIN END My questions is simple, how do I return back from F...

Call assembly in buffer in C

Is this possible? I want to place intel assembly code into a char buffer, and then execute that code from within a C program If I placed the assembly code into a buffer, could I cast it into a function pointer and call that? I am using GCC and linux ...

Is IAR assembler possible to import #define from C header to assembler?

Hi All, I have a mixed assembler and C project based on IAR ARM. I have some #define in C header, I like to use (import) them in assembler file. Could anybody tell me it is possible? Many thanks. ...

ml64 - warning A6004: procedure argument or local not referenced

I have a function written for th e x64 microsft macro assembler in visual studio 2005. The function recieves 3 arguments: theFunction PROC firstP:QWORD, secondP:QWORD, thirdP:QWORD the x64 calling convention state the the first 4 arguments will reside in registers rcx, rdx, r8 & r9. When I'm using the arguments in the function, I'm re...

Includes in inline assembly

We are working on a toy operating system as a assignment for a class. I'm having some trouble with writing of the kernel panic function. It should save all registers, call some printf-like function, then print the saved registers and halt the cpu. Right now it's defined as a macro: #define panic(...) \ do{ \ asm volatile("S...

convert c to mips assembly language

I am trying to convert some instruction to MIPS code. But have no idea how to do that.. i know c language so i can decode it to C but dont know how to convert it to MIPS. I need to write a main create an array of 10 integers Declare a variable make a loop to check if it is odd or even print a string saying "it is odd or it is even crea...

Decompiling EXE to ASM

I want to make a basic antivirus for my free time. Basically I learned about the basic structure of the EXE(windows) file. How do I extract the ASM code from the file and the PE header? ...

GCC: Inline assembly - good for?

So I just found out GCC could do inline assembly and I was wondering two things: What's the benefit of being able to inline assembly? Is it possible to use GCC as an assembly compiler/assembler to learn assembly? I've found a couple articles but they are all oldish, 2000 and 2001, not really sure of their relevance. Thanks ...