assembly

Use of r1 stack pointer when handling external exception on PowerPC

I'm writing an assembler routine to handle the 0x500 external/decrementer exception in an EABI embedded PowerPC application. In my assembler routine called from the 0x500 vector point I want to use some memory to context save registers before branching to the handler function in 'C'. Because i) the exception model guarantees the previ...

What is the MTMSREE PowerPC op?

I'm looking at a core dump of a (Xenon) PowerPC executable compiled with MSVC. The function I'm debugging has an op that the MSVC disassembler calls mtmsree r13. mtmsree isn't in the IBM docs for the PPC; what does this op do? It immediately follows a mfmsr and obviously it's moving something to the machine state register, but I don't ...

Where can I find assembler instruction specification info for the Motorola 68000?

I'm looking for information for machine language instruction encoding formats for the Motorola 68000 processor. I have used the The Motorola Mc68000 Microprocessor Family: Assembly Language, Interface Design, and System Design book for this before, but I no longer own a copy of the book. Does anyone know where I can find this informati...

Can you help with this assembly language code?

Hi, I've been looking through a piece of code of a pc game that I'm trying to "improve". (ok so maybe I suck at the game but I still want to play it). Could you please look into the following code: fld dword ptr[ebp+00007B1C] fsub dword ptr[esp+64] fst dword ptr[ebp+00007B1C] call 004A2E48 This code is called every second for the lev...

Inline assembly in C: Dynamic registers

I'm trying to inline some assembly code in my C code: __asm { mov reg,val }; The problem: I want to define the register and value dynamically. I know the 'val' can be a variable written in the C code, but I don't know how can I choose the register dynamically (i.e decide according to user input- register 'dh' or 'dl'). Any suggestion...

Inline assembly in C: INT command and C variables

I'm trying to use assembly in C code using C variables. My code looks like this: __asm { INT interruptValue }; Where 'interruptValue' is a variable I get from the user (e.g 15 or 15h). When I try to compile I get: Assembler error: 'Invalid instruction operands' I don't know what is the correct type for interruptValue . I trie...

asm subroutine handling int and char from c++ file

how are an int and char handled in an asm subroutine after being linked with a c++ program? e.g. extern "C" void LCD_ byte (char byte, int cmd_ data); how does LCD_ byte handle the "byte" and "cmd_ data"? how do I access "byte" and "cmd_ data" in the assembly code? thanks ...

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

Assembly and multicore CPUs

What x86-64 instructions are used to enable/disable other cores/processors and how does one start executing code on them? Is there documentation somewhere on how this is done by the operating system? ...

I don't understand how Assembly works with ASCII?

I have a program that's supposed to take values and print them back out. But when the user enters something like 12, (C in HEX) the program prints out some weird letter, that I think is the representation in ASCII. Is there a way to make it save those numbers as raw numbers? I'm doing the input and output through an external library, so ...

How does binary translate to hardware?

I understand how code is compiled to assembly, and that assembly is a 1:1 replacement with binary codes. Can somebody help me understand how binary is connected to the hardware? How is the binary physically read and run? How does an if statement work in the hardware? From google searches I'm thinking that maybe my question title should ...

Are there any instructions in x86 assembly that exist only in 64-bit mode?

Some old x86 instructions are undefined in 64-bit mode. For instance LDS, LES and LSS, or short opcodes of the INC r16 (40 + rw) and INC r32 (40 + rd) instructions. Are there any instructions that are defined only in 64-bit mode, and not in 32-bit protected mode? Edit: The context is development of an x86 processor. I want to make s...

Whats a good place to start learning assembly?

I need to learn assembly using SSE instructions and need gcc to link the ASM code with c code. I have no idea where to start and google hasn't helped. ...

Enabling hardware watchdog in msm800

Hi I need to enable the hardware watchdog of an msm800 embedded computer. Unfortunately I hardly know anything about using assembly languages. This is what the documentation for the device says: Function: WATCHDOG Number: EBh Description: Enables strobes and disables the Watchdog. After power-up, the Watchdog is...

Debugging using Lauterbach (Trace32)

While using trace, I found that a few functions are not listed in the source while trying to find them in order to put a breakpoint. These functions seems to appear only when I view the source in assembly format. I spoke to my seniors, they told me if any function is only called once, it will be optimised by Trace and will appear as inl...

assembly return

a small portion of my code swi r6,r0,LCD_ CONT addi r10,r0,6 firstdelay: addi r10,r10,-1 bnei r10,firstdelay swi r0,r0,LCD_ CONT addi r10,r0,30 seconddelay: addi r10,r10,-1 bnei r10,seconddelay swi r5,r0,LCD_DATA i have to delay multiple times throughout the program but want to keep it small. id like to write ...

Disable Hardware & Software Interrupts

Hello! Is it possible to disable all interrupts with a ASM/C/C++ program to get full control about the processor? If yes -> how? If not -> how do "atomic" operation system calls work (for example entering a critical section)? Sorry for my English! Thanks for your help! ...

Why is SSE scalar sqrt(x) slower than rsqrt(x) * x?

I've been profiling some of our core math on an Intel Core Duo, and while looking at various approaches to square root I've noticed something odd: using the SSE scalar operations, it is faster to take a reciprocal square root and multiply it to get the sqrt, than it is to use the native sqrt opcode! I'm testing it with a loop something ...

Use debug.exe to restore a deleted file

Years ago I read a tutorial about the Windows DEBUG command. The article also described how the tool could be used to restore a deleted file. Could anyone give me a hint on how that was done? ...