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
0
votes
0answers
263 views

64 bit binary to ASCIIZ conversion using NASM on Ubuntu 16.04

In addition to a review, if anyone would be inclinded to put this app through its paces, that would be appreciated Preamble & supporting subroutines ...
8
votes
2answers
598 views

8088 assembly checksum implementation

The following 8088/8086 assembly program tests the modular-sum checksum of a block of data. I suspect it could be tighter; can anyone do it in fewer bytes? ...
4
votes
1answer
3k views

Using Python to remove blank lines and comments in Assembly code

I made this little script to help a friend. He studies computer engineering and is doing a project where he has to make assembly files with comments and some formatting for presentation, but, as he is ...
4
votes
1answer
153 views

Guessing game where the first player inputs a word and a hint and the second player tries to guess it

We have been given this project and I was wondering if someone could make my algorithm better using TASM and DOSBox. This is what I have done so far: ...
30
votes
3answers
6k views

Decide if the sum of three numbers is even or odd

Exercise from an Assembly course I'm enrolled into: Write a program that takes three numbers x,y,z as input, and returns: 0 if (x+y+z) is even. 1 if (x+y+z) is odd. (Note that ...
1
vote
1answer
1k views

Decide if a number is even or odd by using bitwise operator

The following exercise is from an Assembler-course I'm taking: Write a program that takes a number x as input, and returns: 0 if x is even. 1 if x is odd. Full exercise-page here: ...
2
votes
1answer
611 views

Quicksort implementation in TASM assembly

Is this assembly (TASM) implementation of quicksort efficient, and does this code follow common best practices? ...
1
vote
2answers
133 views
2
votes
0answers
846 views

A clock program in MIPS assembly that start ticking from 59:58

This is an assignment, a clock program which use MARS simulator, it starts ticking from 59:58. In this assignment I have implemented three functions ...
4
votes
0answers
410 views

Finding the length of arbitrary ASCII character strings

I have implemented this MIPS code to determine the length of given ASCII character strings. Is there a simpler way to implement this code? Is there is a built-in function in MIPS? Given String: ...
3
votes
2answers
592 views

Assembly: Sum up the single bytes of a 32bit-register to a checksum

Exercise description: "Write a program that takes a double word (4 bytes) as an argument, and then adds all the 4 bytes. It returns the sum as output. Note that all the bytes are considered to be of ...
3
votes
1answer
64 views

Converts numbers in range 0 through 15 into ASCII-coded character '0' through 'F'

This is an assignment and i have implemented the function hexasc from the description above. To run this code I'm using MARS-simulator. For the sake of ...
5
votes
1answer
114 views

Non-recursive filter to smoothen saw tooth wave

I'm currently writing some of my first assembly code for a new project, I am applying a small non-recursive filter algorithm to some saw tooth wave data held in memory, in order to blunt the edges. ...
1
vote
0answers
59 views

The ubiquitous blink program on ATmega328P

Although there is a blinking LED, the way this comes about is quite a bit different. This could be called a dead man's switch because as long as you're holding the button down, the blinking doesn't ...
3
votes
0answers
101 views

Rotate lit LEDs on a 7-segment display

I have written some Assembly code for an assignment, that has me activating the outer bounds of a 7-segment display. The toggle is every time there is a state change, so both when I flick a switch, ...
3
votes
1answer
1k views

Assembler for Hack Assembly Language from nand2tetris in Java

I have been doing a brilliant course on coursera based on the book "The Elements of Computing Systems: Building a Modern Computer from First Principles" by Simon Schocken and Noam Nisan. You can find ...
3
votes
1answer
5k views

Assembly 8086 program to input a 16-bit signed number (in string form) and output its binary equivalent

I'm working on an exercise using Assembly 8086 which inputs a number (in string form) then output the binary form. Here is what I did (tested on emu8086 by the way): Convert the string to numeric ...
3
votes
3answers
2k views

Assembly x8086 (emu8086) - Display 32bits number on screen

this is my code (assembly x8086, not MIPS, and I'm using emu8086) to display a 32-bits number on screen. Of course the basic algorithm is as follows: ...
5
votes
1answer
2k views

simple strcmp() asm64

I have implemented a simple strcmp() in asm64. I'm very new to assembly so it must be awful ! I would like to know what errors were made. ...
5
votes
0answers
473 views

8-bit AVR delay using TIMER0 (8-bit)

Using an Atmega328P clocked externally @ 16 MHz, this procedure is analogous to delay routines that use instructions to consume clock cycles. The intent of this algorithm is not to advocate any ...
7
votes
1answer
701 views

8086 ASM Bresenham's Line Algorithm Pt2

Following the successful review of my implementation of Bresenham's Line Algorithm, I've been asked to upload the full implementation of my project which creates a small animation of shapes moving ...
6
votes
3answers
306 views

Finding the maximum of a given list of data in GNU Assembly x86 (32 bit)

I am following the book Programming from the Ground Up and as an answer to a question in the Use the Concepts section of chapter 4: Convert the maximum program given in the Section called ...
2
votes
0answers
2k views

Nand2Tetris Hack Assembler

Now I know the same type of question (same task) has been asked on this site before, but I recently wrote my C++ implementation of the Hack Assembler from the Nand2Tetris Chapter 6 course (defined ...
7
votes
1answer
934 views

Assembly program which detects all numbers with two integral divisors

For an FASM assembly course I've to do the following exercise: "Write a program that takes the number n as input. Then it prints all the numbers x below n that have exactly 2 different integral ...
5
votes
2answers
4k views

Moving a cursor with the keyboard in assembly

I am a beginner in assembly. But that didn't stop me from making a simple operating system completely made in assembly. It's very simple and doesn't do much. It's just a proof of concept. I would like ...
7
votes
2answers
833 views

8086 ASM Bresenham's Line Algorithm

As part of a first year university course in computer architecture some time ago we were tasked with learning 8086 ASM. The final course work required creating a small animation of shapes moving ...
3
votes
0answers
88 views

FizzBuzz - A quartet of solutions

Since the FizzBuzz challenge is about developing ideas, I've added a third test case for which I chose divisibility by 7 and its accompanying tag "Go". This tag was purposely given a length other ...
10
votes
2answers
5k views

Assembly beginner exercise: Calculate the square numbers from 1 to n

I try to learn (flat-, FASM-) Assembly currently. For to become more familiar with the concept of branching I made a tiny program. Inspired by an exercise I had to do once in school when learning ...
5
votes
1answer
82 views

Format an Unsigned Byte to a Three ASCII Digits

I'm working on a game for the Atari VCS and have been dusting off my 30+ year old skills in writing MOS 6502 assembly language. The VCS runs at 1.19 MHz and is based on a MOS 6507 chip with some ...
2
votes
1answer
119 views

AT&T assembly - Basic loop & write - follow-up

This is a follow-up question to this one: AT&T Assembly - Basic loop & write The code loops to display "Hello, World!" ten times. I implemented the syscall...
8
votes
1answer
1k views

AT&T Assembly - Basic loop & write

The code loops to display "Hello, World!" ten times. I would like someone to criticize it. I know that's far from being good assembly but I only started learning it a few days ago and I would like to ...
6
votes
2answers
176 views

FizzBuzz in MIPS, unneccessary branches

I'm just starting out in MIPS (as is evident by the fact that I'm writing a FizzBuzz program), and my program runs fine and gives the desired output, but I feel like there is a way to do it without as ...
5
votes
2answers
910 views

FASM assembly: Write a program which checks if a number is a prime number

Coming from high-level languages like PHP and JavaScript, I'm doing an Assembly course on Udemy. Yesterday I tried to implement the following task: Write a program that takes a number m as input, ...
39
votes
2answers
1k views

Brainfuck to x86 Assembly Compiler

After my Brainfuck Interpreter written in x86 Assembly I decided that it was time to get to the next step, writing a Brainfuck Compiler in Java that generates x86 Assembly and compiles that to an ...
8
votes
2answers
2k views

Checking if CPU supports rdrand

My goal with this bit of code is to check if my processor supports rdrand and, if not, execute some other random number generating function. To check if ...
73
votes
2answers
8k views

Brainfuck Interpreter written in x86 Assembly

Story time: A week ago I found a question about optimizing Assembly code, then I remembered how awesome Brainfuck was, and the match was made very quickly. I decided to write a Brainfuck Interpreter ...
10
votes
1answer
448 views

Assembler for CPU

I recently put together an assembler for a CPU I designed. I'm looking for feedback on my program structure, formatting, or anything else. I'm self taught on all of this so I don't have opportunities ...
4
votes
2answers
1k views

x86 assembly function that determines whether an array is continuous

I wrote an x86 assembly function using MASM that tests for whether or not an array is continuous. That is to say, if an array with length n that starts with the value k, all the subsequent entries in ...
6
votes
1answer
98 views

X86 Legacy boot loader error trapping

The boot loader that I'm designing is just simply going to setup (A) Stack, (B) Segment registers (C) Load remainder of track for specified device. Conventionally, this could have been up to 4 floppy ...
3
votes
2answers
693 views

X86_64 implementation of STRCHR using NASM

As this will eventually become part of an operating system I'm developing, there is no specific adherence to any particular ABI, even though this is being developed ...
3
votes
1answer
546 views

NASM RPN Calculator

I've been learning Assembly over the past few days, and I've made a simple RPN calculator. Here is the main logic of the program, excluding utility functions such as printing: ...
2
votes
0answers
292 views

Interpreter for an assembly language with variadic instructions

I am currently implementing a virtual machine that runs a programming language similar to assembly. The difference is that an instruction in this language can have any number of operands. and the ...
8
votes
1answer
3k views

Integer-to-ASCII algorithm (x86 assembly)

This is my best effort at converting a 32 bit integer in EAX, to an 8 character ascii string (result in RDI). It will work ...
3
votes
1answer
1k views

Unsigned integer division ARM Cortex-M0+ Assembly

I am writing a subroutine for unsigned integer division in Assembly. I will call the subroutine DIVU. Inputs: R1 will be the ...
3
votes
1answer
344 views

Sum up all odd numbers between 1 and 2n + 1

Assignment: Write a program which reads a number n from the console. Then calculates the sum of all odd numbers between 1 and 2n + 1 (incl.). Assignment also on GitHub, Exercise 0.0. The ...
2
votes
1answer
10k views

MIPS program to find the sum and square sum of 10 integers

I wrote a program (hard-code) in MIPS that gets an array of 10 integers and calculates the sum and the square sum of them. The array is ...
3
votes
2answers
899 views

Hexdump utility in x86 NASM assembly

It's a simple hexdump that prints to stdout. I wanted to handle correctly input coming from the user typing at the terminal, this made the logic a little more complicated than just exiting after ...
3
votes
1answer
249 views

File shredder in x86 NASM Assembly

This is a file shredder utility that runs on Linux. It writes random bytes over the file contents, repeating this 48 times and calling sys_fsync after each pass to ...
5
votes
1answer
45 views

Program to print all evironment variables

I'm learning x86 assembly on Linux and this is the first program I wrote, so I'm looking for all kinds of ways to improve it. ...
5
votes
4answers
9k views

A simple assembly program to count the number of ones in a register

I made a simple assembly program to count the number of ones in a register. Since this is basically my first ever, I would like to hear what I can improve or if there are some major flaws in this one: ...