assembly

How can I call sprintf from x86_64 assembly?

I am trying to convert a double to a string on the stack from x86_64 assembly code: bs.code += isa.movsd(registers.xmm0, MemRef(registers.rsp)) bs.code += isa.pop(registers.rax) bs.code += isa.push(registers.rbp) bs.code += isa.mov(registers.rbp, registers.rsp) bs.code += isa.sub(registers.rsp, ...

What would the assembly language equivalents of the operations on the original Turing machine be?

If you take the original Turing machine definition as follows: ...an infinite memory capacity obtained in the form of an infinite tape marked out into squares, on each of which a symbol could be printed. At any moment there is one symbol in the machine; it is called the scanned symbol. The machine can alter ...

recursive merge sort in MIPS using stack

Hi I am trying to implement the merge sort algorithm in a very dirty manner since it was told by our teacher to do so. This program takes the input integer array from the user and prints the value of the array each time the sort is call (just for testing. Ill correct it later). It is entirely dependent on stack . I was told to first imp...

Why is the first column of the results from otool not continuous?

Hi, I'm sorry if this is a really noob question. I'm using otool to disassemble a file and this is the result of a method that I'm interested in: _KTDriverIsRunning: 0000000000000d98 pushq %rbp 0000000000000d99 movq %rsp,%rbp 0000000000000d9c xorl %eax,%eax 0000000000000d9e testq %rdi,%rdi 0000000000000da1 je 0x00000dac 0000000000000da...

Use of mflo statement

When,where and why should the mflo statement be used in assembly language? ...

static code analysis for assembly language

Are there any open-source tools or libraries for static code analysis of simple custom assembly-like languages (for automatically generated programs) and what are they capable of (detecting unused code/registers, giving high-level expressions for code segments, call graphs etc.)? Which algorithms do exist in this field? ...

Getting around lack of inline asm using MSVC10 x64

I'm trying to write a simple device driver for Windows 7 x64 using the latest Windows Driver Kit that will parse the Interrupt Descriptor Table (IDT) and print the contents. I plan on doing this by using the SIDT (store IDT) assembly instruction, however MSVC does not allow you to use inline asm when compiling for x64. Is there any way t...

Using Multiply Accumulate Instruction Inline Assembly in C++

I am implementing a FIR filter on an ARM9 processor and am trying to use the SMLAL instruction. Initially I had the following filter implemented and it worked perfectly, except this method uses too much processing power to be used in our application. uint32_t DDPDataAcq::filterSample_8k(uint32_t sample) { // This routine is base...

the relationship between machine and assembly language

What's the relationship between machine language and assembly language programming? ...

Pointer based array access in MIPS

What do we mean by the pointer based array access in MIPS? ...

Meaning of: Array1 : .word 0:20

What is the meaning of : Array1 : .word 0:20 ...

What CPU registers are to be restored at the end of an asm procedure in Delphi

When writing a Delphi procedure or function in assembly code, which registers must be saved and restored to the original value at the end of the procedure? When calling another Delphi procedure or function from (inline) assembly code, what can I expect that other function to do with the registers? Which registers will be restored to the...

Clear instruction in MIPS: clear $t0

what does the instruction clear $t0 perform in MIPS?I mean what is the actual MIPS instruction for this pseudo-instruction? ...

How do I go about Power and Square root functions in Assembly(IA32)?

How do I go about Power and Square root functions in Assembly Language (with/out) Stack on Linux. Edit 1 : I'm programming for Intel x_86. ...

What is .cfi and .LFE in assembly code produced by GCC from c++ program?

I have the following c++ code int factorial(int n){ if(n==0){ return 1; } return n*factorial(n-1); } int main(void){ factorial(5); return 0; } When I create an assembly file using g++ -S factorial.cpp I get the following: .file "tail_call_opt.cpp" .text .globl _Z9factoriali .type _Z9fact...

Colorization and Palette Best-Fit Algorithms

Been poking around google and haven't found any like what I'm after. so what is it I'm after? well two things: firstly I'm looking for an algorithm/pseudo-code/white-papers to determine a best-fit color for a give r,g,b tuple from and array of 256 RGB tuples. Secondly, I'm looking for an algorithm/pseudo-code/white-papers to recolor a...

Can GAS (GNU Assembler) compile to iPhone/iTouch?

Hello. I am programming some applications for the iDevice market using the unofficial Open SDK, but am having difficulty installing the open toolchain on Windows, rather than Linux (I would use Linux, but I cannot on my work computer), so I am programming it in GNU Assembler (GAS). Is it possible for GAS to target an iDevice as a format...

Accessing parameters passed on the stack in an ASM function

I am writing an assembly function to be called from C that will call the sidt machine instruction with a memory address passed to the C function. From my analysis of the code produced by MSVC10, I have constructed the following code (YASM syntax): SECTION .data SECTION .text GLOBAL _sidtLoad _sidtLoad: push ebp mov ...

Need to convert this unix assembly code execution to windows equivalent

I am totally new to assembly; currently i am trying to convert the undermentioned assembly code execution to windows equivalent but not even getting a single hint. Any help in porting the undermentioned code in asm block to windows equivalent will be highly appreciated. void cpuid(uint32_t idx, uint32_t *eax, ...

How can I perform 64-bit division with a 32-bit divide instruction?

This is (AFAIK) a specific question within this general topic. Here's the situation: I have an embedded system (a video game console) based on a 32-bit RISC microcontroller (a variant of NEC's V810). I want to write a fixed-point math library. I read this article, but the accompanying source code is written in 386 assembly, so it's nei...