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
3
votes
2answers
61 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 ...
6
votes
1answer
67 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
32 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
34 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
48 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
63 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
47 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
56 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
60 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
49 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
76 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
75 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
54 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
53 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
87 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 ...
6
votes
1answer
69 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
64 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
59 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
93 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
53 views
1
vote
0answers
39 views

Analog Clock in AEC

I've made a simple terminal-based analog clock for Linux in AEC. Here we go: ...
4
votes
1answer
48 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
96 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 ...
2
votes
0answers
29 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
38 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
37 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
94 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
102 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
65 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
121 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
46 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 ...
4
votes
1answer
79 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
61 views

Simple arithmetic operations in MASM using dosbox [closed]

This program does simple arithmetic calculation (+. -, *, /, %) in masm. I've tested the code. ...
5
votes
1answer
95 views

Assembler for Brookshear Machine

As a small exercise in Python, I created an Assembler for the rather simple Brookshear Machine (see f.e. Brookshear Machine, please note, however, that the instruction set differs from mine). The ...
3
votes
0answers
31 views

Instant to-and-from Roman Numeral Conversion

Ⅰ Roman numerals are composed of digits taken from a small set of uppercase characters. Lowercase characters were first used in the Middle Ages. $$I,V,X,L,C,D,M$$ With these digits we can represent ...
4
votes
2answers
35 views

A progression of quines - follow up

This is a follow up on A progression of quines. Based on the reviews I got, I have reworked my first and fifth programs. The nice quine The answer I received from ecm made me realize that my nice ...
3
votes
1answer
42 views

Key-scanning macro in NASM Win16 against DOSBOX (Intel 8086)

Supports backspacing, but not wrapped backspacing. ...
6
votes
1answer
124 views

Multitasking in NASM Win16 Assembly

Requirements (Installed using Scoop) scoop install nasm dosbox Build (Using NASM) nasm -g tasks.asm -o tasks.com ...
4
votes
1answer
116 views

fasm convert hex byte to binary string

This fasm x64 (Linux) code seems very crude and repetitive, but it gets the job done. How could I perform this task in a more idiomatic manner? ...
9
votes
2answers
112 views

A progression of quines

A quine is a program whose only job it is to reproduce the source file that was used to create the executable in the first place. This stackoverflow post provides some reasoning about its usefulness. ...
3
votes
1answer
44 views

x64 fasm strlen

This is a simple strlen function with registers documented: ...
1
vote
1answer
182 views

Shifting bits in assembly (nasm)

I wrote a function which takes a byte and shifts the bits around. That is, there shall be the same number of 1 bits and 0 bits in the output but the bits will be shifted in position: ...
4
votes
1answer
161 views

Printing a string in NASM Win16 Assembly

A small script that simply prints a given string. It's an improved snippet that combines some recommendations given in my post on string helper functions. ...
6
votes
2answers
208 views

String helper functions in NASM Win16 Assembly

Environment NASM is required to build this program, and DosBox is required to run it. I'd recommend installing these using the Scoop Package Manager. Feel free to ignore install statements for any ...
3
votes
1answer
42 views

Ubuntu 18.04.3 ASCII strings length with embedded VT100 control codes

As my applications rely on VT-100 emulation, I found that I had to do quite a few workarounds to determine the number of visible characters in a string with embedded VT-100 control codes. So that led ...
6
votes
1answer
85 views

Cat program in x64 FASM

I wrote cat program in x64 FASM and I would like to know if there is anything that can be improved. This implementation of cat supports: Reading from stdin. Multiple arguments. I checked few cases ...
6
votes
1answer
142 views

Cat program in x86 NASM

I wrote cat program in x86 NASM and I would like to know if there is anything that can be improved. This implementation of cat ...
7
votes
4answers
89 views

Ubuntu 18.04.3 LTS get terminal columns and rows NASM

As part of the prologue of all my console applications, I need to determine the extents of the current terminal so if there are less than 132 columns or 43 lines the user can be warned output may not ...
5
votes
2answers
99 views

Display hexadecimal value stored at a register

I read a book about OS development and faced with a simple exercise: write a function that prints a hexadecimal value stored at a register. The program runs as a boot sector. I would really ...
7
votes
3answers
209 views

String routines

These are a few string routines (just the mem* ones). I've tried to optimize them the best I can without having them be too big, but I'm unsure if I've done a good ...

1
2 3 4 5 6