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

0
votes
0answers
17 views

How to print prompt in MIPS [on hold]

I am new to MIPS so be bare with me. I am trying to print a prompt for the user to enter a number. There are other things I have to do: Initialize the register $s0 to 30 Prompt the user to enter a ...
3
votes
2answers
74 views

Assembler for Hack Assembly Language in Python

My Python implementation of for Hack Assembly Language. See this question for the Java implementation. Any comment about best practices and performance improvement? ...
10
votes
3answers
86 views

Distance between two n-dimensional points (NASM)

I just finished writing a function that computes the distance between two n-dimensional points. The original one was written in C and it's basically a translation of this formula: ...
2
votes
1answer
39 views
8
votes
1answer
73 views

A Virtual Piano

I have created a virtual piano that turns the home row (excluding 'g' and 'h') and the top row (excluding 'y' and 'u') of the user's keyboard in a piano's keyboard. The home row is used for white ...
4
votes
0answers
55 views

Porting x86 assembly that is used to increment a value

I'm working on a port of some existing inline x86_64 assembly code to AArch64 compatible assembly and would appreciate the feedback. I'll post below the original x86 and my ported AArch64 code. The ...
2
votes
2answers
50 views

Assembly Summation Implementation

I wrote a simple summation program in MARS to practice using loops and jump instructions. I feel like this is pretty lightweight and wanted some feedback on possible improvements: Lowering ...
3
votes
2answers
38 views

Implementing OR with the lc-3

Today, something possessed me and I started learning assembly. My poison of choice is the lc-3, this is my very first program. It is actually only the first part of a two part problem, but this ...
7
votes
2answers
179 views

Spinlock for C++ kernel (with x86 ASM)

This is some prototype code for a spin-lock for my toy operating system. Bear in mind this means there are no standard library routines to fall back on. It's also for C++11 compilation and will only ...
3
votes
2answers
111 views

Assembler for Hack Assembly Language - Take 2

I have been reading this great book and I decided to do the Project in Chapter 5: Writing an Assembler for the Hack Assembly Language. You can find the specification for the Hack Machine Language and ...
7
votes
1answer
89 views

A BrainF*ck-ish compiler in C

-ish because I removed the input functionality from the compiler. And, the compiler does not support nested loops I've been recently reading up on compilers and how they work. Although this doesn't ...
5
votes
1answer
246 views

Assembler for Hack Assembly Language

I have been reading this great book and I decided to do the Project in Chapter 5: Writing an Assembler for the Hack Assembly Language. You can find the specification for the Hack Machine Language and ...
3
votes
1answer
252 views

Binary to ASCII converter

This is a program I wrote to convert binary to ASCII. I am still learning ARM assembly. How can I improve my program? Is there any bad programming habits in my code? ...
3
votes
1answer
86 views

MIPS assembly addition program

I am new to assembly and have made a simple addition program to sum two integers read from the keyboard. The program outputs correctly, but I want to know if there is a way to streamline my code. It ...
10
votes
2answers
326 views

Printing integers up to 1000 and are not multiples of 5

How can I shorten this? ...
1
vote
1answer
38 views

Two index computations differing in execution time

Code I have the following piece of code ...
3
votes
1answer
52 views

Improved countdown program in x86 NASM

A while back, I posted a question involving code of the same function. This post contains improved code. From the last post, I have improved size, my work with conventions, and my comments. I was ...
5
votes
1answer
247 views

Printing prime numbers in Assembly

I am learning to code in the Assembly language for the x86 architecture. I currently know of a few registers and certain arithmetic operations like add, sub, inc, dec, mov and to check for ...
12
votes
4answers
635 views

Countdown program in x86 NASM

I am fairly new to Assembly language programming and, for practice, I gave myself a problem: count down from 10 and right after 1, say "Blast off!". ...
12
votes
1answer
141 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
295 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 ...
14
votes
3answers
606 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 ...
6
votes
2answers
1k 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. ...
25
votes
2answers
717 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: ...
11
votes
2answers
420 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
115 views

Inline assembly correctness (especially __volatile__)

Here's my inline-assembly functions, which is used my x86 32bit kernel. ...
8
votes
3answers
2k 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
2k 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
2k views

32-bit factorial calculator in x86 NASM assembly

This is how it handles input: if negative, terminate program if 0-2, display input without calculating if greater than or equal to 3, calculate and display result I have also used some macros from ...
20
votes
1answer
641 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
1k 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
242 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
433 views

Alp in MASM 8086

If the number is present, the output should show the numbers that are not present. ...
8
votes
1answer
162 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
518 views

Search procedure to find inputted DWORD in MASM Array

Is there any way to make this more efficient? ...
4
votes
1answer
138 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. ...
8
votes
2answers
139 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
827 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
178 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
276 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
297 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): ...
3
votes
2answers
321 views

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
1k 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): ...
1
vote
1answer
161 views

Assembler PIC programming, is this correct? [closed]

The question is: Write the following pseudo in assembler code: ...
12
votes
1answer
304 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
357 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
2k 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
363 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 ...
14
votes
2answers
974 views

GCD/LCM calculator in x86 NASM 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
260 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 ...