assembly

x86 assembly on x64 operating systems

Hello Recently i decided that it was worth getting a try on basic x86 assembly so that it would be easier to debug programs, etc, etc. So I started (about a week ago) learning x86 assembly, in that time, I upgraded my computer to 8GB ram, so obviusly my x86 Windows XP installation was wasting up all that memory, now, I'm running a x64 W...

Equivalent of InterlockedIncrement in Linux/gcc

It would be a very simple question (could be duplicated), but I was unable to find it. Win32 API provides a very handy set of atomic operations (as intrinsics) such as InterlockedIncrement which emits lock add x86 code. Also, InterlockedCompareExchange is mapped to lock cmpxchg. But, I want to do that in Linux with gcc. Since I'm worki...

Help with simple assembly mmx exercise

Given a vector of bytes with length multiple of 8, how can I, using mmx instructions, convert all 2's to 5's, for example? .data v1 BYTE 1, 2, 3, 4, 1, 2, 3, 4 Thanks. edit: 2's and 5's are just an example. They are actually parameters of a procedure. ...

Overwhelmed while learning assembly. Orientation please

Recently I decided that learning assembly would be a good idea, but right now, I'm really overwhelmed by all the material I have read about assembly in forums, here, tutos etc (Some of it is really old) so I would love to have some orientation about the assembly language, how to "compile" etc, I would also like it to be able to run on my...

Assembly: Jump from one section to another

In x86 assembly, how can I perform an unconditional jump from one section another? Eg: .section .text main: ... jmp here ... .section .another here: ... I guess this is a far jump. I get a segfault when trying to run this. Any workaround? ...

ASM .com won't run

Hello I found this sample tutorial The clueless guide to Hello World in nasm about basic ASM, when I compile it, everyting goes just fine!!! Great, but when I run it I get this message: This version of hi.com is not compatible with the version of Windows you are running This happens on Windows 7 x64 (Which i was told would run fine...

Question about "push" and the stack

If you push something into the stack multiple times (in a loop for example), does the stack keep growing or is the previous value replaced? For example, repeating push EDI 5 times. Would the stack have 5 EDIs? ...

assembler programming in user space

Hi, Is it possible to have a piece of code like this in user space? I mean is it possible to read/write co-processor register in user space in Netbsd / Linux? XYZ]# cat pmc.c static inline int arm11_pmc_ctrl_read(void) { unsigned int val; __asm volatile ("mrc p15, 0, %0, c15, c12, 0" : "=r" (val)); return val; } int mai...

Why does Visual Studio use xchg ax,ax

I was looking through the disassmbly of my program (because it crashed), and noticed lots of xchg ax, ax I googled it and found out it's essentially a nop, but why does visual studio do an xchg instead of a noop? The application is a C# .NET3.5 64-bit application, compiled by visual studio ...

Assembly mask logic question

This is very simple, but I haven't been able to figure it out yet. This question is regarding a assembly mmx, but it's pure logic. Imagine the following scenario: MM0: 04 03 02 01 04 03 02 01 <-- input MM1: 02 02 02 02 02 02 02 02 MM2: 04 03 02 01 04 03 02 01 <-- copy of input after pcmpgtw MM0, MM1 MM0: FF FF 00 00 FF FF 00 0...

masm assembly unresolved externals

My class is working out of the "Assembly programming for Intel computers" book (5th edition) and I'm trying to get the programs to assemble. The book comes with Irvine32.inc which is supposed to make IO and stuff easier. I have those in the same directory as the .asm file I'm trying to compile. Whenever I do ml /Fe test.exe test.asm /lin...

Can anyone solve this 8080 assembly code 'puzzle'?

Hi, A friend of mine was given 8080 assembly code as part of a puzzle he's trying to solve. This is the code: 3E 02 4F C6 04 47 11 41 01 21 69 00 19 76 He needs the values of B, DE, C and HL Can anyone solve this or point me in the right direction on how to run this? Thx! Update Spoiler: The solution seems to be: C = 02, B = 06, D...

Z80 (TI-83+) stops working on CALL

Every time I assemble an application for the TI-83+ calculator (Z80 processor), it stops running at CALL. Here is an example ("Hello") — it starts running just fine, but the calculator freezes at the CALL instruction. Anything I put before CALL works just fine, and anything I put after doesn't run. This is a disassembly of the code, to s...

Create a Fully-Featured Environment For MIPS Assembly Development

I'm giving a try to MIPS Assembly by reading the MIPS Assembly Language Programming book, but I don't know the tools that are suggested and that are optional. What I need is Tools that are needed What is the best emulator and how to configure it? At the time I just have cross-compiled binutils targeted to mips-elf. I'm using Linux U...

Beginner Errors On When Compiling a MIPS Assembly Source

I'm trying to learn MIPS Assembly by learning MIPS Assembly Language Programming. In the book I have this code(extracted from the page 37 of the book): .data prompt: .asciiz "\n Please Input a Value: " bye: .asciiz "\n Bye!" .globl main .text main: li $v0, 4 la $a0, prompt syscall li $v0, 5 syscall beqz $v0, end m...

Can the Visual Studio ARM Assembler produce binaries that don't require an OS?

I'll admit upfront that I don't know a whole lot about ARM development, so I probably have by information wrong here. Visual Studio comes with an ARM assembler (armasm.exe), which is extremely convenient because I use the tools included with VS for basically everything and I'm not too wild about paying for an ARM assembler that comes bu...

assembler usage of prefetch commands

Hi! I'm writing some (arm) inline assembly code that works on a huge array of C structs in a loop and stores some data into another array. the processor supports the PLD prefetching command. if i'm accessing the data in successive order, is there a gain in performance if I use the prefetch command to load the startadress of the next s...

How To Build a Hello World For Nintendo 64?

I'm reading MIPS Assembly Language Programming, but now I want to build a simple "game" for Nintendo 64. I want to print a Hello, World to the screen, but someone can help with this. As I don't have nothing to start. I've choose for Nintendo 64 because of my friend told me that it uses MIPS and I've already have the emulator. ...

Where can I find an assembler for the x86?

I study ASM-86 language at high school and I want to program a little at home. Do you know any "compiler" for this language that I can program and view the state of the memory? ...

Is assembler portable between Linux distros?

Is a program shipped in assembler format portable between Linux distributions (modulo CPU architecture differences)? Here's the background to my question: I'm working on a new programming language (named Aklo), whose modus operandi will be the classic compiling to .s and feeding the result to the GNU assembler. Obviously it would be ni...