Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [assembly]

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.

3
votes
1answer
55 views

Expand every bit into a byte

I have the following code: ...
2
votes
1answer
19 views

X86 Feature detection in preperation for Long Mode

These are the three steps that need to be taken in order to successfully activate Long Mode. Error reporting is sparse as most real hardware for developing an OS is 64 bit but probably still a good ...
4
votes
1answer
20 views

Compare two strings in extended memory - classic 8052

I'm looking for a simpler code that isn't resource hungry that can compare two strings stored in different locations in the extended memory of a classic 8052 (namely the AT89S52 microcontroller) to ...
1
vote
0answers
14 views

Swapping variable length strings asynchronously with connected microcontroller (Byte-banging)

I have an AT89S52 and an AT89C4051 microcontroller (both in the 8052 family) in which the bit lines of the data bus, one control pin and one status pin are connected together. In code, the data bus is ...
-2
votes
0answers
23 views

Greatest Common Divisor (GCD) in MIPS32 assembly code [closed]

I have written a quite simple code for finding the gcd of 2 integers on mips32 assembly code. However, QtSpim doesn't respond when I load the file. Is there something wrong in my code that prevents ...
3
votes
3answers
210 views

Simple puts() function in x64 assembly

I'm trying to write as simple I/O library in x64 using linux syscalls ...
1
vote
1answer
31 views

Variadic Functions in NASM Win64 Assembly

Simple variadic function implementation in NASM Assembly. When implemented like I have below: sum.asm ...
6
votes
1answer
186 views

Tower of Hanoi in NASM Win64 Assembly

This program is an implementation of the classic puzzle Tower of Hanoi! This is my first mostly recursive Assembly program. Any advice and all topical comments on code optimization and conventions is ...
2
votes
0answers
46 views

x64 Windows Assembly - Structs in Assembly

I'm trying to code a simple person database using structs and arrays in assembly. Each person has a firstName, lastName, ...
1
vote
1answer
70 views

Guessing game in NASM Win64 Assembly

Still learning Assembly. This program is a simple guessing game to test most of the new things I've learned! Any advice and all topical comments on code optimization and conventions is appreciated! ...
20
votes
3answers
3k views

Checking if a number is prime in NASM Win64 Assembly

I'm just learning Assembly. This program is a simple attempt to determine if a given number is prime or not. Any advice and all topical comments on code optimization and conventions is appreciated! ...
0
votes
1answer
63 views

gcc constant time implemenation [closed]

I need to make the following function time constant - I have already removed if statements and have written it down to one line in the loop. ...
4
votes
1answer
63 views

Main loop in assembly for a Brainfuck interpreter

I have written 2 Brainfuck interpreters, one in C++, then another in C++ with Assembly inner loop. My interpreter code can be found here (C++/ASM, requires MSVC and MASM) and here (C++). Both are ...
3
votes
1answer
99 views

Hex Dump Utility in x86-64 Assembly: Version 1.1

I recently posted a code review and received some very useful feedback. I have spent some time implementing the suggested improvements/fixes, and wish to post a follow up review, with the new and ...
6
votes
2answers
148 views

Hex Dump Utility in x86-64 Assembly, under Linux

As a relative newbie to Assembly programming, although I can get my programs to work, I have no idea if they are disastrously constructed or not. I have created a simple Hex Dump Utility, using x86-...
3
votes
2answers
86 views

Disassembler for intel 8080 v2

As many suggestions were given for the code I posted here, I decided to show you the new version for review. I Removed the OpenCatalog class, ...
10
votes
2answers
150 views

Disassembler for intel 8080

I have written a disassembler for Intel 8080, able to translate binaries into opcodes and parameters. Sorry for posting so much code, but everything posted here is useful for the understanding of the ...
10
votes
1answer
904 views

string length in x64 assembly (fasm)

Please critique this very, very basic routine which returns the length of a given char buffer or "string." ...
1
vote
0answers
187 views

MIPS Assembly Program to access elements in the 4x4 matrix, row or column-major oder

This MIPS Assembly program will make you access the elements in the 4x4 matrix in either row or column-major order i.e. accessing all elements row by row or column by column. Output is posted below ...
5
votes
1answer
69 views

Console TicTacToe implementation

I am new to assembly and I want to know how I can improve this implementation both by speed and/or binary size optimization and making code to read and support easily. Platform: Linux, x64 Assembler:...
5
votes
2answers
65 views

Multiplying big numbers using Long Multiplication

Three weeks ago I posted Multiplying big numbers using Karatsuba's method where I made reference to my version of the classical long multiplication. That's what I'm posting today so people can compare ...
1
vote
1answer
132 views

Linked List in x86 assembly(MASM)

Module 1: ...
5
votes
1answer
60 views

Block Allocation in Fixed-Size Block Allocator

The following routine is the block-allocation procedure in a fixed-size allocator being written for library use. It is designed to be accessed from C++ (the un-mangled symbol name is ...
6
votes
1answer
198 views

SIMD memcpy assembler implementation

I am fairly rusty with assembler, let alone the AT&T syntax. I would appreciate it if someone with more experience could please review the following memcpy implementation. Note that this will only ...
11
votes
0answers
94 views

Multiplying big numbers using Karatsuba's method

The Karatsuba algorithm, first published in 1962, aims to speed up the multiplication of big numbers by reducing the number of 'single-digit-multiplications' involved. Because of its complexity (...
6
votes
1answer
395 views

Convert unsigned Integer to ASCII in x86 assembly

This is my best effort to code an x86 32 bits to get an unsigned int (4 bytes) and convert it into a string. My strategy was successively divide the number by ten and fulfill the remainder of the <...
5
votes
1answer
220 views

Dynamic Fibonacci algorithm in x86 (MASM)

My task was to implement this algorithm that uses memoization to calculate fibonnaci numbers: ...
6
votes
1answer
385 views

Quick Sort in x86 assembly (MASM)

My task was to implement Quick Sort in assembly from pseudocode. ...
25
votes
2answers
2k views

Euler's Totient Function in x86 assembly (MASM)

My task was to implement Euler's totient function, and I'm looking for any and all criticism. ...
8
votes
1answer
110 views

Caesar cipher in i686 assembly + MMX

I have written the following implementation of the Caesar cipher for an old Linux computer with a Pentium MMX chip. The code has been written with the following design goals in mind: the code should ...
10
votes
1answer
122 views

A 8086 assembly hexdump program

I am trying to learn the 8086 assembly language. So as exercise, I decided to write a hexdump program, that outputs the contents of files in a format similar to Linux hexdump. I am developing under ...
10
votes
0answers
108 views

Signed integer-to-ascii x86_64 assembler macro

I have implemented an algorithm which converts a signed integer to its ASCII equivalent string with the corresponding sign as a first byte. I have tested it on several numbers and it worked correctly. ...
6
votes
1answer
121 views

x86 FASM assembly Reverse FizzBuzz

This program counts down from 100 to 1 and: If the current number is a multiple of 3 it prints "Fizz" instead of the number If it is a multiple of 5 it prints "Buzz" instead of the number If it is a ...
2
votes
0answers
991 views

Bubble sort using user inputted numbers and size in MIPS assembly

I made this code to take user input, making a specific-sized array and printing user-inputted numbers after being sorted. It works well but I was wondering if there was a way to "shrink" it down. It ...
13
votes
2answers
153 views

Calculating (\$a^2\$ + \$b(2c-d)^2)/(3e)\$ in assembly

I made a simple assembly program to evaluate the function $$f =\frac{a^2 + b(2c-d)^2}{3e}$$ Since this is basically my first ever, I would like to hear what I can improve and know how to use ...
4
votes
1answer
52 views

x86 assembly [fasm] code which takes a number and adds 155 then shifts right

The following program takes a user-inputted integer and adds 155, shifts it to the right twice, and prints the output after the addition, then after the shift. It is written in fasm x86 assembly and ...
5
votes
1answer
46 views

Print which CPU flags are set at the start of the program

This is my first "real" x86 program developed from scratch. Please critique: ...
10
votes
1answer
326 views

Measuring the clock rate of an Intel CPU in C++

I created a short program to directly measure the clock rate of an Intel CPU. It runs, sleeps for a duration specified by the user, and then measures the number of clock cycles and the amount of time ...
3
votes
0answers
104 views

Implementing binary-heap in x86-64 assembly

I'm trying to implement some of the simplest classical data-structures in x86-64 assembly on linux. PRIMARY GOAL: Reduce memory consumption and increase performance (maybe using x86-64 architecture ...
2
votes
0answers
28 views

Write 16x16 bitmap to frame buffer

The following code writes a 16x16 bitmap to a framebuffer using up to AVX2 instuctions. I'm sure it can be improved with AVX512 ...
1
vote
1answer
511 views

Efficient LC3 assembly code to print the numbers leading up to any digit

I'm using an LC3 microarchitecture simulator to write assembly code. I've only been writing assembly for about three weeks, so I am still very new. My goal is to print all the numbers leading up to a ...
1
vote
1answer
54 views

X86-16 Function 01 -> Change destination and/or display pages

This code is intended to be included with X86-16 writing ASCIIZ strings directly to video and is dependent upon some of the declarations in that code. When combined with that code a string declared @ ...
2
votes
0answers
33 views

X86-16 writing ASCIIZ strings directly to video

While developing my OS, I decided there was a need to be more verbose about what was happening in real-mode. The idea of embedding non-printable characters in an ASCII string was born from knowledge ...
1
vote
0answers
2k views

MIPS even or odd detection program

I am learning MIPS as a part of my Computer Organization class at school and I am writing a simple program that reads in a positive integer from the user and tells the user whether the number is even ...
2
votes
0answers
36 views

String to long double conversion using FBLD

I always wanted to try fbld x87 instruction to aid to convert string to floating point value. I sure a chance to face this instruction in disassembly of all the ...
1
vote
1answer
39 views

A console application that uses the Rich Edit Form Input procedure

This console application uses the Rich Edit Form Input procedure for which you can find the source here. It presents the user with a dialog that has 5 input boxes and 2 buttons. The dialog is drawn ...
5
votes
1answer
92 views

Rich Edit Form Input (x86-16)

This procedure is the natural continuation of the Example 4 that I wrote for How buffered input works, a Stack Overflow Q/A. Features include: freely positioning the cursor. Left Moves cursor left....
3
votes
2answers
86 views

Checksum computation in x86_64

This is an implementation of the TCP/IP checksum computation as described in https://tools.ietf.org/html/rfc1071. The function is writen in DynASM, an assembler preprocessor that is part of LuaJIT. I ...
5
votes
3answers
509 views

Printing binary string in assembly

I'm writing a program to print binary string of a hardcoded word. Here is how it looks like currently: main.asm ...
9
votes
3answers
303 views

Assembly Nasm Bootloader x86

I just started with deep learning of x86 architecture and assembly so i decided to go from bare metal and write my own bootloader. To add some "functionality" i decided to make quine (from binary ...