An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture's machine code instructions.

learn more… | top users | synonyms

6
votes
1answer
29 views

Calculating the harmonic average

In this program I was required to calculate the Harmonic Average using an assembly program with a C driver. Harmonic mean is define as: $$ \frac{n}{\dfrac{1}{x_1} + \dfrac{1}{x_2} + \cdots + ...
12
votes
2answers
254 views

Find binary sequences with low peak sidelobe level of autocorrelation function

I would like to find all binary sequences from the specified range, which has low peak sidelobe level of its autocorrelation function. Here is the solution (this is simplified version of the real ...
10
votes
3answers
456 views

Reverse Polish Notation Compiler

Description A reverse polish notation based compiler. Very small subset of forth This is a proof of concept level compiler, no optimizations or over/underflow checking see the embedded POD for more ...
1
vote
0answers
28 views

Questions about style/ organization in Assembly [closed]

This is my first venture into assembly, and I'd love a few pointers regarding organization/ style. This code takes an integer and prints the cube (I'm running it on Windows, via NASM), and while the ...
6
votes
2answers
355 views

Checking substring in 8086 ASM

I have tried like this to check a substring in a mainstring in 8086. Is there any shorter way of doing this? My implementation seems lengthy. ...
16
votes
1answer
388 views

16-bit FizzBuzz in x86 NASM assembly

Since this problem involves small numbers (particularly with a small loop count of 100), it's possible to ease the modulo operation setup by simply working with 16-bit and 8-bit registers: ...
10
votes
1answer
362 views

x64 Assembly - checking for largest prime factor

Using x64 assembly, I solved the Largest Prime Factor problem on Project Euler. The problem is as follows: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of ...
2
votes
1answer
66 views

Inline assembly correctness (especially __volatile__)

Here's my inline-assembly functions, which is used my x86 32bit kernel. ...
8
votes
3answers
856 views

Integer square root in x86 assembly (NASM)

This program calculates the square root of an unsigned 32-bit number with some bit fiddling to get a very close approximation, then one iteration of the Babylonian method to get an exact value. I ...
7
votes
2answers
650 views

String length calculation implementation in Assembly (NASM)

I just made a working implementation of calculating a string's length, but I'm not exactly sure it's the most efficient way. I divide the string up in blocks of four bytes each (32 bits), and add 4 to ...
4
votes
3answers
986 views

32-bit factorial calculator in x86 NASM assembly

This program calculates the factorial of a given positive number. This is how it handles input: if negative, terminate program if 0-2, display input without calculating if greater than or equal to ...
19
votes
1answer
441 views

Stack implemented using linked list in x86_64 assembly

I wrote a stack implementation using a singly linked list in x86_64 assembly. This stack supports the usual push/pop operations ...
12
votes
1answer
517 views

Linux NASM assembly linked list implementation

Inspired by all of the lovely linked lists lately, I decided to implement one in assembly language. This code maintains two linked lists - one is a free store and the other is the active linked list. ...
4
votes
2answers
155 views

Is this C++ program correctly implemented in SSE?

I have to implement a simple program in SSE, and I don't know if I have done it in the right way (it's my first program in SSE). This is the C++ program: ...
4
votes
2answers
373 views

Alp in MASM 8086

If the number is present, the output should show the numbers that are not present. ...
8
votes
1answer
122 views

Switch-case Monstrosity for CPU Emulator

I am still working on A Z80 CPU emulator and I have decided to prototype it in javascript and then translate it into a faster language, It might be ported to C but more likely is Java - this means I ...
7
votes
2answers
411 views

Search procedure to find inputted DWORD in MASM Array

Is there any way to make this more efficient? ...
3
votes
1answer
105 views

Counter in FASM assembly

I am making a simple counter in assembly. It counts to a billion and exits. However, the performance of this is really horrible. A Java application (that does the same) outperforms it by around 10x. ...
7
votes
2answers
128 views

Improvements/suggestions for my CPU emulator

I am trying to emulate a basic CPU (Z80) as close as possible. It currently does not read real assembly code, but that will be implemented. If you have any views on how that could be implemented, ...
7
votes
1answer
505 views

Iterating string characters and passing them to a BIOS API

Which style of printing strings from the SI registry in NASM is more correct? I'm learning assembly and x86 architecture, but I'm rather new in it, so I've prepared two styles (in NASM) of printing a ...
7
votes
1answer
164 views

Embedded conditional code compaction

I'm porting some AVR code from PROGMEM/PGM_P to __flash, and I want to reduce the amount of ...
1
vote
0answers
162 views

x86_64 assembly print integer stack allocation [closed]

I have made this simple assembly program that prints an integer in hexadecimal. It works, but I don't understand why it works with only a stack size of 15, when to print a 64 bit integer including ...
4
votes
1answer
254 views

Is this CPUID parser ideal for any usage?

NOTE: I'm not perfectly sure of some of the parsed data, so any corrections are more than welcome. Parser (cpuid.c): ...
1
vote
2answers
241 views

Please review polling for Nios 2

The program listens to the Altera FPGA DE2 board's keys that can start and stop and reset a counter: ...
7
votes
3answers
846 views

x86 strcpy - can this be shortened?

I got about 4 days of assembly knowledge so, I need a review on this strcpy function and if it can be done better (At least I have the feeling). Full code (with the test included): ...
0
votes
1answer
122 views

Assembler PIC programming, is this correct? [closed]

The question is: Write the following pseudo in assembler code: ...
11
votes
1answer
252 views

x64 assembly clearmem / zeromem

I've just started learning assembly yesterday, and the first useful thing I've written is a clearmem function. I'm looking for general feedback regarding my coding ...
3
votes
1answer
305 views

Fastest fill memory with specified 64-bit value

I need to fast fill some memory block in C#, so I wrote something like this (in Ffree Pascal COmpiler + Lazarus in 64 bit mode): ...
6
votes
1answer
1k views

Calculating prime factors in MIPS assembly

The goal of this was to be able to enter any number and print out the prime factors of that number. Are there any shorter ways of writing this code? I'm not very familiar with low-level syntax and was ...
6
votes
1answer
328 views

RC4 in 8051 assembly optimization

I've been playing around with 8051 assembly lately and thought I would make a little project of implementing RC4, since it is pretty interesting and the algorithm doesn't seem too hard. Plus, taking ...
8
votes
2answers
716 views

GCD/LCM calculator in x86 assembly

After creating a similar program in C++, I've decided to try to write it in x86 assembly language (the type of assembly I was taught in college). I'd like to receive feedback regarding syntax and ...
5
votes
1answer
178 views

Computing a mathematical function in MIPS assembly

This code computes the function (3x^2-4x+16) / (5x^2+2x-4). I ran the program and it works, but I am fairly new to assembly language and am not quite sure how to ...
3
votes
1answer
242 views

Trying to improve and better understand Intel SSE intrinsics

I've been writing a collection of signal processing function optimized with SSE intrinsics (mostly for audio processing). Here is a linear interpolation function I wrote. It works well and is quite ...
2
votes
1answer
679 views

Nios 2 interrupt handler

This is homework for which we have prepared Nios 2 assembly: ...
7
votes
1answer
316 views

Writing SIMD libraries for C++ on FASM in x86-64 Linux

I have recently started a project of SIMD libraries development for C++ on FASM for x86-64 Linux. I would be glad to hear any opinion or feedback about the project, cleanness of the code and ...
7
votes
1answer
394 views

Listing the first five perfect numbers in MIPS assembly

I've done some programming in the past, but I'm new to MIPS, which I'm trying to learn on my own. This program lists the first five perfect numbers. It uses the Lucas-Lehmer and Miller-Rabin primality ...
5
votes
1answer
245 views

First steps with amd64 assembly

I try to learn amd64 assembler. This is the first thing I tried. This piece of assembly should replicate the functionality of the following piece of C code, which turns a binary sha-256 hash into a ...
5
votes
1answer
289 views

The beginnings of a bootloader using GNU-based tools

This is a personal project of mine. I am currently in the research phase of developing my own bootloader that will be used to load a single task operating system. I am far away from the final goal, ...
4
votes
1answer
1k views

SSE2 assembly optimization - multiply unsigned shorts and add the result

I am attempting to optimize a piece of C code which aims to multiply a series of pairs of unsigned shorts and add the result. I am only concerned about the high 16 bits of the result, and I can ...
52
votes
9answers
11k views

Fastest way to clamp an integer to the range 0-255

I'm working on some image processing code that can generate pixel values outside of the normal range of 0 to 255, and I'd like to clamp them back into the valid range. I know that there are saturating ...
2
votes
2answers
952 views

Correct User Input - x86 Linux Assembly [closed]

So I am working on an x86 Assembly program for Linux using NASM. This program basically asks the user for their name and their favorite color. After doing this and storing the two strings in variables ...
6
votes
1answer
290 views

Improving this bilinear scaling SSE2 code on Core 2 CPUs

I am looking for some help with improving this bilinear scaling SSE2 code on Core 2 CPUs. On my Atom N270 and on an i7, this code is about 2x faster than the MMX code. But under Core 2 CPUs, it is ...