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 (1)

0
votes
1answer
20 views

Absolute value function in MIPS

The following is my implementation of the absolute value function in the MIPS assembly language. I would very much like to hear constructive criticism of my code from you as well as any words of ...
2
votes
1answer
41 views

Recursive spinlock for C using ASM, revision #1

Precursor for this revision here in code-review: Recursive spinlock for C using ASM Improvements have been made thanks to forsvarir. Now I am trying to optimize this lock so it becomes more ...
10
votes
2answers
93 views

Brainf*ck interpreter written in x86 assembly

I have written a program in x86 assembly (Intel syntax/MASM) that interprets brainfuck code that is fed to it via an interactive console and prints the final stack to stdout. Note that it does not ...
1
vote
1answer
59 views

Recursive spinlock for C using ASM

My history of C/ASM locks here in codereview: Simple spinlock for C using ASM Simple spinlock for C using ASM, revision #1 (basis for this approach. If this one fails, then so will the one below.) ...
3
votes
1answer
50 views

Simple spinlock for C using ASM, revision #1

Revision #1 for Simple spinlock for C using ASM The code: ...
5
votes
1answer
64 views

Simple spinlock for C using ASM

This is my second attempt to make simple lock using extended assembly. See http://stackoverflow.com/questions/37241553/locks-around-memory-manipulation-via-inline-assembly/37246263 The code: ...
-1
votes
1answer
114 views

Motorola 6809 Prime finder

I'm trying to make a small program which takes a number (form 1 to 1000) and shows the primes between 2 and that number. Right now I have a quite functioning program (except a couple of bugs), but the ...
6
votes
2answers
115 views

x86 assembly method that mimics strcat

I'm trying to learn x86 assembly and hopefully move on to projects of the scope that more than one person would be involved. This is a (relatively) simple subroutine written in Intel x86 assembly ...
1
vote
1answer
125 views

HPC kernel for DGEMM: compiler v.s. assembly

This is a correct version, for computing a small matrix multiplication: C += A * B, where C is ...
5
votes
1answer
87 views

8086/DOS assembly keyboard I=input, data loss in registers

I am working on a project for class, and it works as required by the rubric, though I am wondering if there is a slightly better way to implement a few things. I was docked a few points for an ...
3
votes
0answers
16 views

Using STORAGE macro using QSAM for input/output

I was wondering if you can help me out. I wanted to know if there is an easier way to do the following. My code works but I feel like there is a lot things going out with multiple loops and wanted to ...
4
votes
2answers
76 views

FizzBuzz in ToyVM

Since I have my own virtual machine and an assembler for it, I decided to test it with a FizzBuzz implementation. I have this: fizzbuzz.toy ...
3
votes
2answers
64 views

Assembler for ToyVM

After rolling my own virtual machine, I decided to implement an assembler for it. Ironically, it's all Java, since I needed to do a lot of text manipulations. Please, tell me anything that comes to ...
9
votes
1answer
455 views

ToyVM - a small and simple virtual machine in C - follow-up

(See the previous and initial iteration) Now I have refactored the code in order to conform to the suggestions made in the answers to the first iteration. I have this: toyvm.h: ...
3
votes
1answer
71 views

Hardware interrupt handler in C++

I wrote this class to use a C++ function as hardware interrupt handler. The idea is to have a single entry point where I can switch stacks, and call a chain of ...
7
votes
2answers
108 views

ToyVM - a small and simple virtual machine in C + FizzBuzz demonstration

(See also the next iteration.) I have this small virtual machine. What is there: Stack and, thus, recursion. Conditional and unconditional jumps and, thus, choice and iteration. What is not ...
4
votes
0answers
220 views

Cooperative multi-tasking / coroutine implementation

Here is my implementation of user-level cooperative threads in C++14, which I'm working on for a hobby project. It's not entirely finished but works pretty well so far. The target operating system is ...
2
votes
1answer
128 views

Simple calculation program in assembly MASM

I am a beginner in assembly. This program calculates: (Z+Z)+(X-Y) ...
4
votes
0answers
44 views

Parallel popcount of packed bytes

I want to do a popcount of bytes in an array. Not a total popcount of everything, but lots of little popcounts for every individual byte to determine the neighborhood count in GoL. The following ...
2
votes
0answers
46 views

Benchmarking function variations

I'm trying to benchmark two variations of one of my functions. Namely, these functions are for displaying integer values on the command line. The first of these uses my own implementation and prints ...
1
vote
1answer
46 views

FizzBuzz in the MIPS ISA

The title pretty much explains it. This is the first program I've written in assembly, so any criticism, either on programming style or saving instructions, would be appreciated. ...
1
vote
0answers
45 views

Measuring CPU frequency in *nix

I have this small function for reading the TSC (time-stamp counter) in *nix. Using it seems to report my CPU frequency more or less correctly. ...
7
votes
1answer
71 views

Assembler listings parser components: Operands parser

I'm building the above mentioned parser. It reads a string of assembler instructions. I want to become a better coder, so I wanted to get a code review to start learning to do things property. As we ...
11
votes
4answers
622 views

Detecting arithmetic overflow in C with NASM

This snippet is about detecting whether the carry flag is set or cleared. I work on Mac OSX, so my snippet supports Mac only. First, we need a routine that does the job: func.s: ...
17
votes
2answers
318 views

Fast 32x32 bit multiply on ARM M0

I have a time-critical calculation running on an ARM Cortex-M0. This is the fastest 32x32 bit -> 64 bit multiplication that I can come up with. The following C compiles almost 1-1 to assembly ...
8
votes
2answers
124 views

Implementing min of 3 numbers in Mic-1 code

I have the following algorithm to find a minimum of three input numbers: ...
6
votes
1answer
44 views

Brainfix to NASM converter written in C (revision 2)

See this post for the previous question. I have made several enhancements to this compiler and language that make it a lot easier to work with, as well as slightly decreasing executable size (if new ...
6
votes
2answers
130 views

Brainf*ck to NASM converter written in C

I have made a very simple Brainfuck to NASM converter, that is usable for practically all programs. It has one trivial optimisation (to subsitute ADD for ...
4
votes
0answers
212 views

Selection Sort in Assembly [closed]

I was wondering if there could be anything done to clean up this code a bit. There is also a problem where every so often the sorted array will only display a fraction of the original amount of ...
3
votes
1answer
43 views

Routine for convert decimal digits to Densely Packed Decimal

I've written an amd64 assembly routine (in gas syntax using the System V calling convention) to convert three decimal digits to densely packed decimal because I wasn't satisfied by the performance of ...
6
votes
1answer
102 views

A C function for returning the address of the calling function

Suppose you are given two functions, foo and bar, and neither of them are inlined. Now, if ...
1
vote
0answers
81 views

Variations on binary searching an ordered list

In the wikipedia article about the binary search algorithm (https://en.wikipedia.org/wiki/Binary_search_algorithm) a small paragraph in particular got my attention. Midpoint and width A ...
6
votes
2answers
220 views

Finding multiples of 3 or 5 with MIPS assembly (Project Euler #1)

I just started learning MIPS assembly at my university and I would like some feedback on this code. The program is Project Euler Problem #1, finding the sum of multiples of 3 or 5 less than 1000. It ...
11
votes
2answers
197 views

A low tech approach to measuring game speed

Whilst developing a game I needed a delay routine capable of doing delays ranging from 0.5 sec to just a few msec. The obvious choice was to use the BIOS delay function 86h on int 15h. In a true real ...
14
votes
1answer
134 views

Embedded FizzBuzz

Recently, I have started to enter the realms of embedded systems programming. And, as my first major project, I thought I'd do the obvious: FizzBuzz. However, this is a little different: this is a ...
2
votes
2answers
210 views

Assembling an Interrupt Handler

- INTERRUPT HANDLER - ...
8
votes
1answer
68 views

Assembling a Sequence

I've completed the "Sequence Counter" level of TIS-100, but this is horrendously inefficient. My cycle counts are at about twice the minimum possible according to the charts: I'm not really as ...
12
votes
2answers
444 views

Inefficient differential converter

Following Pimgd's question, I decided to take a look at the TIS-100 myself. This is my solution to the 3rd challenge, building a differential converter. Requirements: Read values from IN.A and ...
8
votes
2answers
165 views

Filling a memory segment with a bit pattern

I want to fill a memory segment with a certain byte pattern using powerpc assembly: ...
33
votes
5answers
2k views

The loaderless bootloader

I began this month with trying to discover how shellcode is made. My search led me to wanting to learn assembly, so I wrote a simple bootloader with NASM: ...
7
votes
1answer
101 views

Monte Carlo Pi (MASM)

I'm currently trying to brush up on my assembly skills and, being at the FPU section of the tutorial, I implemented a very basic version of a Monte-Carlo-Algorithm to compute pi. I deliberately use ...
26
votes
2answers
7k views

Counting Sequence Length in TIS-100

I picked up a programming game, TIS-100. Programming manual can be found on Steam as well, but I have described the relevant syntax in my question. Basically, you're dealing with some old machine ...
3
votes
2answers
265 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
147 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: \$\text{dist}(x,y)=...
2
votes
1answer
169 views
9
votes
1answer
974 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 ...
3
votes
0answers
90 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
410 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
59 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 ...