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
1
vote
0answers
57 views

Legacy boot E820 entries written to low memory

In another post of mine, there was some discussion about a small area just above (see end of page @) BDA (500H - 534H) that handles DOS print screen. As not to ...
4
votes
1answer
204 views

E820 display using X86 legacy boot sector or DOS 6.22 com file

The time has come in the development of the initialization process of my OS to get details about memory. I could have done this a lot simpler as both systems I use, have 4 gigs, but on every system ...
2
votes
1answer
61 views

Asserting CPUID and enabling A20

At this point, the user will probably want to know if this system is Long Mode capable, which is indicated by the word CPUID in green. This is determined by attempting to toggle bit 21 in EFLAGS. <...
3
votes
1answer
64 views

Binary values in hexidecimal notation written directly to video memory

In X86 Legacy boot loader prologue the first seven instructions preserve the state of the 8 general purpose and 6 segment registers. This is where they are displayed, right justified without leading ...
4
votes
2answers
470 views

BIOS Video Service INT 10H (functions 9 and 13H) functionality

On the way to protected or long modes, real mode code needs to provide a lot of visual feedback. Video services INT 10H provide this functionality, but lack ...
4
votes
2answers
123 views

X86 Legacy boot loader prologue

No matter the ultimate goal of any legacy X86 system, startup or prologue, should take into consideration the fundamentals. In this case, the intention before dropping into protected or long modes, ...
7
votes
5answers
166 views

Assembler-program which reverses the content of EAX

Following exercise: Write a program that takes a number (of size 4 bytes) x as input, and then reverses all the bits of x, and outputs the result. By reversing all bits we mean that the ...
3
votes
1answer
4k views

MIPS assembly program to read integer byte by byte

I try to learn assembly by writing small programs. This MIPS program is supposed to read an integer from the terminal and print it byte by byte in hexadecimal. I think it works but I didn't check ...
3
votes
4answers
906 views

Merge two sorted arrays in NASM

I have the following function which I wrote in NASM to merge two sorted arrays. Its not a standalone, but its supposed to be compiled into a .o file and then linked ...
0
votes
0answers
369 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
892 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
5k 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
419 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: ...
32
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
2k 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
739 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
136 views
2
votes
0answers
1k 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 ...
6
votes
0answers
2k 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
959 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
82 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
118 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
62 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
108 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, ...
6
votes
1answer
2k 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
6k 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
3k 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
4k 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
592 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
1k 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
755 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
3k 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
1k 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
6k 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
1k 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
105 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
8k 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
87 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
138 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
2k 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
385 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
1k 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, ...
40
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 ...
76
votes
2answers
9k 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 ...
11
votes
1answer
494 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
2k 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
104 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
1k 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
697 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: ...

1 2 3
4
5
7