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.

Filter by
Sorted by
Tagged with
2
votes
1answer
37 views

FizzBuzz in arm64

I made a FizzBuzz program in arm64; I print out the values in hex instead of decimal. This was the first arm64 program I made and I'm looking for advice on how I can improve it. The code to print out ...
0
votes
0answers
19 views

81 variations of the rounded rectangle

If we apply outward curving, inward curving, and no curving at all, individually to each of the 4 corners of the rectangle, we get next 81 variations: The code implements next BASIC command: ...
1
vote
0answers
75 views

Binary to hex in ARM64 SIMD assembly

As an exercise in learning ARM64 assembly (aka AArch64), I wrote this function to convert 64-bit binary to hexadecimal with SIMD instructions. I'm most interested in feedback on the algorithm, ...
2
votes
1answer
96 views

setjmp and longjmp implementation in mmix

I've written an implementation of setjmp and longjmp in MMIX (assuming no name mangling). I also hand-assembled it. Are there any mistakes anyone can spot? ...
1
vote
1answer
106 views

MASM) assembly implementation of recursive Fibonacci

I'm trying to teach myself assembly via MASM, below is my first implementation of the recursive form of the fibonacci sequence. I timed it against an equivalent C implementation in release mode and ...
4
votes
1answer
233 views

Decimal to binary conversion in ARM assembly

I'm "playing" with ARM assembly on a Raspberry Pi, reading various tutorials and posts to help - no, it's not a college assignment, I'm too old for college! I'm pleased with getting the ...
0
votes
1answer
122 views

Writing a recursive factorial function in x86-64

The following assembly program works to print the factorial of a number: ...
-1
votes
1answer
65 views

Fork Bomb virus in Assembly

I made a fork bomb virus in Assembly. Now, I want to make my code better. Here is my code: ...
6
votes
3answers
160 views

Fastest (in clock cycles) 16-bit x 16-bit unsigned integer division algorithm for ATMEGA1284?

I am trying to create an optimized 16-bit division algorithm for the AVR ATMEGA1284. The goal is to reduce the number of clock cycles as much as possible. AVR INSTRUCTION SET MANUAL: https://ww1....
1
vote
1answer
53 views

Converting decimal to binary in Assembly

The longest example program in my PicoBlaze Simulator in JavaScript is this decimal-to-binary converter: ...
24
votes
4answers
2k views

x86-64 Assembly - Sum of multiples of 3 or 5

I'm trying to learn some basic x86 assembly and so I've begun solving Project Euler problems. I was hoping for some critique of my code that, hopefully, includes either the efficiency of the ...
1
vote
0answers
44 views

C++ calculation of curling number in sequences (Assembly?)

I'm writing a program that creates curling sequences -- in short this means that we start with a given sequences, consisting of 2's and 3's (i.e. a mix of 22 of them), and look for repetition at the ...
3
votes
2answers
147 views

Very simple OS in Assembly

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter. Here is my code: ...
3
votes
1answer
77 views

How do I optimize the bubble sort in Assembly8086?

I tried to implement bubble sort in Assembly 8086. ...
3
votes
0answers
42 views

Assembly REPL in Python using ctypes

I created a assembly REPL using some ctypes hacks to run the assembly code. Any suggestions on how I could improve it? I am unconcerned about some of the "obvious" security issues such as ...
5
votes
1answer
77 views

Find all the digits in a string

S is a given character string, then I have to find all the digits characters of S. Did I make it unnecessarily complicated? <...
6
votes
1answer
77 views

Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1)

Given a byte string S of length l, obtain the string D of length l-1 as D(i) = S(i) * S(i+1) (each element of D is the product of two consecutive elements of S). ...
4
votes
2answers
234 views

x86_64 nasm criticism on malloc and free implementation

I have made my own malloc implementation using this resource as a guide https://danluu.com/malloc-tutorial/ I was hoping to receive some feed back on how I can improve upon it, and If I did any major ...
7
votes
1answer
87 views

x / 2 + 100 * (a + b) - 3 / (c + d) + e * e in assembly

write an algorithm for: x / 2 + 100 * (a + b) - 3 / (c + d) + e * e knowing that: a, c - word, b, d - byte, e - doubleword, x - qword ...
4
votes
1answer
48 views

Trivial string-reverser in MASM64

I've been learning MASM64 over the last few days and written a simple demo, so I can get feedback on my understanding of x64 assembly programming. It's really basic: it asks the user for their name, ...
2
votes
1answer
40 views

Debounce counter for PIC micro - Suggestions for improvement

I developed this code for a vertical debounce counter for the PIC micro (PIC16F57). The code is called every 512 microseconds. It takes 5 bits from PORTB and compares it to a last known debounced ...
1
vote
1answer
59 views

Criticism on x86_64 nasm printBigInt and bigPow implementation

The first "method" I have coded is _bigPow which can pow(x, y) on any number which is really big. And the _printBigInt prints a very big integer. Plus I have tried to comment most parts of ...
6
votes
1answer
137 views

CodeWars - Assembly Language - Check List For Value

I'm doing assembly language problems on CodeWars, a website with practice problems. Problem https://www.codewars.com/kata/545991b4cbae2a5fda000158/train/nasm Create a method that accepts a list and ...
3
votes
0answers
56 views

Printing a decimal number as a string

I've written a short script to print a number to a string. This actually was very difficult for me to do -- I'm not sure if this is actually a tricky task or just because I'm so new to asm I was ...
4
votes
1answer
112 views

Print a list of strings in assembly

How does the following program look to print a list of strings? What places can I improve? Are there easier ways to print something like a linebreak after each string rather than hardcoding the ...
2
votes
1answer
65 views

Program to find the maximum number/factor in a list

I have written the following basic assembly program to find the maximum number in a list divisible by a number. Here is what I have thus far: ...
2
votes
1answer
110 views

x86 program to do an exponent

For continuity, my last question was with adding numbers together with a function call: Example x86-64 program. In this one I've tried to apply the lessons pointed out in the previous answer (stack ...
4
votes
2answers
134 views

Criticism on x86_64 nasm assembly strToInt and printInt implementation

I am pretty new to assembly I would like criticism on two "methods" I have written. One converts string to int and the other prints an int to stdout. Any advise helps out. ...
2
votes
2answers
86 views

Exponentiation by squaring in x64 Linux Assembly

I am learning some assembly for a compiler project I am working on and I have come across the Exponentiation by Squaring algorithm when it came to calculating x ^ n. To get a grasp on how the ...
3
votes
1answer
93 views

Example x86-64 program

I wrote the following x86 program to make sure I'm following the correct practices in calling a function and then exiting to the OS: ...
3
votes
1answer
939 views

Simple input and output in assembly x86_64

I am new assembly programming in Linux (x86_64) and I want to make sure that I am programing in a correct way. I wrote a program that just takes an input from the user and then writes his input to ...
7
votes
1answer
100 views

Can I shorten this assembly code to test if a number is even?

Here is MIPS code to return 1 if a number is even, 0 otherwise: isEven: andi $t0, $a0, 1 li $t1, 1 sub $v0, $t1, $t0 jr $ra My question is whether ...
7
votes
1answer
97 views

Project Euler #1 AT&T Assembly

To practice learning x64 AT&T Assembly (GAS), I implemented three solutions for Project Euler Problem 1 (find the sum of all the multiples of 3 or 5 below 1000). The codes and a rough pseudocode ...
7
votes
1answer
313 views

x64 NASM Assembler: Binary Search

While quarantine I decided to look into the assembly language, as it's quite interesting to see how code works on the lower levels. To challenge myself I made a binary search algorithm. The OS is ...
5
votes
1answer
69 views

Hailstone Sequence in NASM

For practice, I wrote some NASM code that prints out the hailstone sequence of a (unfortunately, hardcoded) number. This is by far the most complex code I've ever written in NASM. I'd like advice on ...
3
votes
2answers
106 views

HybridSort of QuickSort and MergeSort

I'll try to publish a paper about the programming language I've made (ArithmeticExpressionCompiler, short AEC) in Osječki Matematički List and, in order to demonstrate its usability for implementing ...
3
votes
1answer
69 views

Fibonacci Sequence using Recursion with Memoisation

File fibonacci.aec: ...
1
vote
0answers
40 views

Analog Clock in AEC

I've made a simple terminal-based analog clock for Linux in AEC. Here we go: ...
4
votes
1answer
390 views

Selection sort algorithm in x86_64 Yasm assembler

I returned to study assembly language. And this is actually my first function written in Yasm. Implementing this function is a suggested project from this book. I slightly modified the pseudo code ...
5
votes
2answers
185 views

SSE Assembly vs GCC Compiler - Dot Product

I am currently taking an introductory course in computer architecture. Our goal was to write a dot-product function in x86 Assembly which would use SSE and SIMD (without AVX). I am not to that ...
3
votes
1answer
67 views

A very fast Game of Life

The rules of John Conway's Game of Life are simple: An OFF pixel that has 3 live neighbours is turned ON. An ON pixel that has anything other than 2 or 3 live neighbours is turned OFF. Many people ...
2
votes
1answer
40 views

Printing all permutations of digits of a number

So, a long time ago, I've made a program that prints all the permutations of digits of a number in AEC. Now I have refactored it a bit, and I would be interested in what you think about it. ...
3
votes
1answer
63 views

Pascal's Triangle in AEC

So, I am trying to make people interested in my compiler project (in the early stages of development) by making some simple and clear programs in my programming language. Here is my implementation of ...
5
votes
1answer
100 views

An echo program, mostly in C and completely from scratch

This is an echo program with no runtime or standard library. It's meant to be compiled with -nostdlib on an amd64 Linux system. ...
2
votes
1answer
103 views

An assembler to assemble a hypothetical instruction set [closed]

We have been given a college assignment (Yeah even during lockdown!!) to implement an assembler to assemble the reference instructions given here. The following is my code to implement pass1 of the ...
2
votes
1answer
84 views

Is this the rigth way to write power and factorial functions with nasm?

I wrote factorial and power functions with nasm but I don't know if it is the right to write assembly code. For example, by executing the functions I make some changes in the registers and I don't ...
5
votes
2answers
148 views

x86 Single Stage Bootloader

I'm learning OS development and have written a single stage bootloader that loads the kernel, enters to protected mode and finally jumps to the kernel. I'll very appreciate any feedback and ...
4
votes
1answer
51 views

A fast generator of palindrome dates in chronological order

02/02/2020 is a palindrome day because reading the date left-to-right or right-to-left still refers to the same calendar date. And because it doesn't matter whether you use the DD/MM/YYYY format or ...
5
votes
1answer
402 views

Program for string length in x86

It takes in a string from the command line. prints out the length of the string. I'm mostly looking for tips and general convention suggestions But I'm open to any other criticism also. Roast it ...
1
vote
0answers
216 views

Simple arithmetic operations in MASM using dosbox [closed]

This program does simple arithmetic calculation (+. -, *, /, %) in masm. I've tested the code. ...

1
2 3 4 5
7