assembly

DOS execution of assembly code

I'm writing a chunk of assembly that will register a tsr and then exit. I'm struggling to figure out how to properly assemble this to a format that I can execute in dos. i'm have access to ubuntu 9.04 and windows xp. (linux method is preffered). If anyone can tell me how i go about assembling my code into a dos executable format, and t...

How to move the value of a floating point register to a general-purpose register in MIPS?

I have the following bit of MIPS assembly, run on the MARS simulator, given below: .data x: .space 4 # 4 bytes = 32 bits li $v0, 6 syscall At this point, the floating point value I need is in $f0, but I need to move the value to x. If I could transfer the contents of the floating point register $f0 to $t0, I would be able to do this...

Best textbook for PowerPC assembly and arch?

Does anyone know of a good introductory textbook on the PowerPC architecture and assembly language that I could recommend to people on my team? Our company now mostly targets a particular PPC platform for our realtime application, and some of the younger programmers on my team are struggling a bit with release-mode debugging and use of...

Conditional Compilation in assembler (.s) code for iPhone - how?

I have a few lines of assembler arm code in an .s file. Just a few routines i need to call. It works fine when building for the device, however when i switch to iPhone Simulator i get "no such instruction" errors. I tried to compile parts of the .s file conditionally with what i know: #if !TARGET_IPHONE_SIMULATOR But the assembler do...

How to translate "pushl 2000" from AT&T asm to Intel syntax on i386

I'm trying to translate the following from AT&T assembly to Intel assembly: pushl 2000 Now this compiles down to: ff 35 d0 07 00 00 pushl 0x7d0 But no matter what I try, I cannot get the same in Intel synax, I've tried: intel asm disassembly after compiling to at&t push 2000 68 d0 07 00 00 push $0x7d0 push [200...

Efficient Way to Print MIPS Int Array

I'm working on a homework assignment translating a C program we wrote to MIPS. My question is about general MIPS coding and not project specific issues though. I've run into an issue with printing my output. I have an array and output string declared as such: array: .word 7, 2, 5, -3, 3, 6, -4, 1 output1: .asciiz "Array: \0" I'm tryin...

8086 assembler,INT 16,2

Hi,I got stuck at this thing,I want to see if right shift button has been pressed,so I have this assambler code: mov ah,2 int 16h ;calling INT 16,2 - Read Keyboard Flags interrupt mov ah,10000000b shl al,7 and al,10000000b cmp al,ah ;check if first bit is 1 je rshift jmp final rshift: mov ah,9 lea dx,rsh ;rs...

Installing GNU Assembler in OSX

No matter how hard I google, I can't seem to find a (relatively) easy-to-follow instruction on how to install the GNU Assembler on a mac. Any pointers would help. Thanks. ...

Left Shift Overflow on 68k/x86?

I heard that the Motorola 68000 and Intel x86 architectures handle overflow from left shifting differently. Specifically the 68k LSL vs. the Intel SAL/SHL assembly instructions. Does anyone know the specifics of this? Do they set different flags, or set them differently? I tried to look this up in the reference manuals, but I don't see ...

Implement atomic increment using atomic swap?

Suppose I'm writing (assembly) code for a CPU whose only atomic operation is an unconditional swap -- no LL/SC, no compare-and-swap, just plain swap. (An ARM9 would be an example of such a beast.) Is there a way to perform atomic increment/decrement operations using the swap operation? There is a relatively easy answer, which is to use ...

Very fast memcpy for image processing?

I am doing image processing in C that requires copying large chunks of data around memory - the source and destination never overlap. What is the absolute fastest way to do this on the x86 platform using GCC (where SSE, SSE2 but NOT SSE3 are available)? I expect the solution will either be in assembly or using GCC intrinsics? I found...

Can we use decimal numbers (base-10) directly in MC6800?

In Motorolla 6800, can we use decimal numbers (base-10) directly like we use #$02 for hexadecimal. ...

x86 Assembly Keyboard Input Without INT

I need to make an animation which will accelerate when the user keeps a key pressed, and return to normal speed when the key is released. I can't "wait" for the user to enter a key like most DOS and BIOS interrupts do, since it'll stop the animation. I tried to use option 01H INT 16H, which works without pausing the program, but it doe...

x86 Assembly: What's the main prologue and epilogue?

Hello, I'm following this tutorial on x86 assembly. Every example so far uses what the author calls a "c-driver" program, compiled with the assembly module, for means of some "initialization". Something like: int main(void) { int ret = asm_main(); return ret; } And then the asm_main function is written normally, using a C calling...

save inline asm register value to C pointer, can get it on GCC but not VC

hi there, for the sake of simplicity ill just paste an example instead of my entire code which is a bit huge. while im porting my code to VC++ instead of using GCC i need to rewrite a few inline assembly functions that receive pointers and save values on those pointers. imagine cpuid for example: void cpuid( int* peax, int* pebx, int* ...

How are mutex and lock structures implemented?

I understand the concept of locks, mutex and other synchronization structures, but how are they implemented? Are they provided by the OS, or are these structures dependent on special CPU instructions for the CPUs MMU? ...

What is causing this segmentation fault while using SSE instructions?

This problem is driving me a bit crazy. The code seems to be segmentation faulting for no good reason: #define MULT_FLOAT4(X, Y) ({ \ asm volatile ( \ "movups (%0), %%xmm0\n\t" \ "mulps (%1), %%xmm0\n\t" \ "movups %%xmm0, (%1)" \ :: "r" (X), "r" (Y)); }) int main(void) { int before; float a[4...

How to debug programms written in fasm under linux using gdb?

I wrote simple "hello, world" in fasm, and its works, but how i can generate debug info for gdb and edb (Evan's Debugger)? Fasm compiler could only produce debugging symbols in its specific format - "fas", which of course gbd couldn't understood. ...

Disassemble into x86_64 on OSX10.6 (But with _Intel_ Syntax)

I know of otool -tv, but I would much rather use the Intel syntax rather than AT&Ts, mainly to easily follow along in a book and not have to look over thousands of %'s and $'s. I'd also appreciate any tips to where I might find gdb's config file. EDIT: I forgot: I'm running a 64bit processor, but was wondering if it would be possible...

Can't break out of a simple Assembly loop

Hello, I've been asked to create a simple loop in assembly language but I am having trouble as the loop doesn't end when it should, it continues in an infinite loop. I need to give the ECX a variable which is taken by input, but in my code below even when I specify the counter directly is still falls into an infinite loop. My code is ...