Questions tagged [assembly]
Use this for code written in any assembly language. Assembly-language questions also need a tag to indicate the target processor's instruction set architecture (ISA).
353 questions
8
votes
1
answer
719
views
Reed-Solomon LFSR encoder
I'm interested if the code below could be further enhanced for out-of-order execution.
Function inputs:
rcx = pointer to a 2 by 64 byte table to multiply 64 bytes ...
3
votes
1
answer
261
views
Solution to the N Queens Puzzle in the PicoBlaze assembly language
You can see it live here:
...
5
votes
2
answers
148
views
Compare two files in 16-bit DOS assembly
The task is to do a byte-by-byte comparison and print whether the files are equal or not.
Code:
...
8
votes
3
answers
898
views
Optimizing Masked Bit Shifts of Gray Code with AND Operation and Parity Count
I am trying to determine the parity of the result of a complex calculation involving two uint64_t variables, value_a and ...
4
votes
1
answer
129
views
Computing the factorial of a number in ARM assembly
I'm new to ARM assembly, and I want to improve myself.
Here is code that I wrote. It computes and returns the factorial of the integer passed in r0. Any suggestion ...
5
votes
2
answers
257
views
Hand-written IUnknown::Release in Assembly Language - Code injection
I've written the following code in assembly, which I then convert to machine opcodes and inject into a process with VirtualAlloc at runtime. This allows me to ...
6
votes
1
answer
636
views
x86 assembly program to compute some random function
As a way to refresh my knowledge on assembly, I tried to compile the below C program to x86 assembly by hand.
...
2
votes
1
answer
71
views
Simple GAS assembly program to print out all of the command line arguments provided to it
Although I've used assembly quite a bit for some simply things, I feel like I've never properly learnt how to write it idiomatically, by which I mean: which variables to use where, how best to ...
2
votes
1
answer
55
views
3
votes
1
answer
250
views
Rust implementation of fibers
I am still new to rust, so any comment about what is the rust way of doing things is welcome. this is a hand-rolled implementation of fibers or user-land context-switching.
...
10
votes
2
answers
1k
views
Number guessing game for x86
I'm new to assembly and I've just finished this guessing game that I wanted to make to improve my skills in this language. It runs in a Unix environment and does the following:
generates a random ...
2
votes
1
answer
2k
views
part of a c++ program which mods a game using code injection
https://github.com/speedrun-program/amnesia_load_screen_tool/blob/main/code_injection.cpp
https://github.com/speedrun-program/amnesia_load_screen_tool/blob/main/file_helper.h
...
5
votes
2
answers
129
views
Replace specific characters (CR and LF) in a file
Context
This program has been created to "fix" files originating from Cobol databases. In Cobol, files extracted via something called a "copy" have the same number of characters ...
5
votes
2
answers
225
views
Base64 Encoder in Assembly X86-64
I am a beginner in assembly and would like to know ways I could improve my code. I am talking more about assembly specific things and less the logic e.g. what I could've written better, like loops
<...
5
votes
1
answer
197
views
Add two huge base-10 numbers
This is some assembly code I've written to add two base-10 numbers. The input and output are represented as null-terminated ASCII strings, with digits in big-endian order.
I have also provided ...
3
votes
1
answer
351
views
Increment a binary number represented as a string
I'm an amateur at assembly, but am trying to get better at it. For fun, I decided to write code that takes in a char array and increments the number represented in binary.
Here are a few input-output ...
3
votes
1
answer
1k
views
"Hello world" in x64 assembly for Windows - Shadow space / Stack alignment
I`m currently trying to delve into x64 assembly under windows using NASM, and created a minimalistic "Hello World" application.
It is mainly meant as an educational resource for me and ...
4
votes
1
answer
862
views
First assembly program: working with strings and integers
I started learning assembly some days ago and I wrote my first program today. Nothing exceptional here: some user inputs, strings manipulations, integer to string conversion etc... The only purpose ...
1
vote
1
answer
383
views
File dump in assembly
This is a file dump program written in assembly that displays 320 bytes at a time in 20 lines.
It shows the hex code for each character and also the string
At the start of the program it asks for the ...
3
votes
1
answer
1k
views
Sum two vectors in x86 assembly
I recently made a program with C++ and ASM. Can anyone help me make this code a more efficient one, in the ASM part or both.
I would really appreciate it because I don't know every ASM instruction and ...
5
votes
0
answers
215
views
Single-threaded coroutine in C (Linux x86-64)
Background Story
I crafted a simple single-threaded coroutine in C, running on Linux x86-64.
Short Technical Explanation
1) Task
There are two types of tasks in this implementation.
Main task. This ...
19
votes
4
answers
4k
views
Minimal `printf` for integer types in x86 assembly
I'm writing a minimal C runtime targeting an old 32-bit Windows XP machine as a personal project. The C runtime provided by compilers is quite bloated. I wouldn't mind some library bloats up to ...
4
votes
0
answers
159
views
RC4 stream cipher in ARM Assembly
Below is a complete implementation of RC4 in ARM assembly. Unit tests pass, including comparison to C implementation and to published test vectors.
I'm appreciative of all feedback, comments (things ...
4
votes
0
answers
250
views
Arm Assembly Tokenize String (strtok()), Load Move, Add Efficiency
Dabbling a bit more with arm assembly, I wrote a few functions to handle string splitting. The goal was to write a few reusable functions that could be combined to emulate (roughly) what C ...
4
votes
1
answer
742
views
GNU assembly (AT&T syntax) bootloader load the next sector from floppy
I'm playing with the Real mode and was trying to code something when suddenly I exceeded the 510 boundary (.org 510) of the <...