Skip to main content

Questions tagged [assembly]

This challenge is related to assembly languages. Note that challenges that require the answers to be in a specific language are generally discouraged.

Filter by
Sorted by
Tagged with
4 votes
5 answers
1k views

Here is a challenge: What is the shortest possible compiled program? Writing one line programs are fun, but they often lean on language libraries that get pulled into the final bits. How lean can you ...
Roger Hill's user avatar
3 votes
4 answers
1k views

Languages, such as C++, have introduced a new comparison operator: <=>. This operator returns -1, 0, or 1† when comparing two items together: −1 means the ...
Alexis Wilke's user avatar
3 votes
2 answers
320 views

Modern hardware can perform multiplication very fast in a constant latency of 3~4 cycles. But some tiny chips for embedded environments sometimes lack hardware multiplication, which has to be emulated ...
xiver77's user avatar
  • 2,395
6 votes
2 answers
952 views

This is the second version of the task. The original task had a defect that the given range of integers was too small. This was pointed out by @harold that other methods couldn't defeat the way of ...
xiver77's user avatar
  • 2,395
13 votes
9 answers
693 views

Related to AoC2017 Day 18, Part 2. (Anyone want to add Duet to esolangs?) Duet is an assembly-like language that involves two processes running the same program simultaneously. Each process of Duet ...
Bubbler's user avatar
  • 79.3k
12 votes
2 answers
780 views

I was trying to write a short MIPS32 code for computing the median of three registers. The rules: Assume that some values are pre-loaded into $t0, ...
M A's user avatar
  • 221
8 votes
8 answers
727 views

There's only one question for machine-language golfing, and it's for the ia32 and amd64 architectures. Here's one for a predecessor of them: the Zilog Z80! The ISA is available here. As usual, if your ...
NoLongerBreathedIn's user avatar
-3 votes
1 answer
382 views

Introduction I've always liked the idea of finding the most possible bang-for-your-buck squeezed out of a tiny chip, like the 6502. Of course, I'll need to start small. Filling the screen on 6502asm....
Tux1's user avatar
  • 69
-13 votes
1 answer
652 views

Your program is supposed to create a full red screen in MSDOS. The source of the binary (.com file) must be 5 bytes or less. No wild assumptions, the binary must work in MsDos, DosBox, and FreeDos ...
HellMood's user avatar
  • 676
6 votes
6 answers
2k views

Let's assume we've got an imaginary assembler. The assembler supports numerical labels. An infinite loop example: :1 jmp 1 Your task is, to write a ...
Kamila Szewczyk's user avatar
10 votes
0 answers
314 views

I need to construct a functor that iterates over the linear representation of a sub-lattice of size \$d_x,d_y,d_z,d_q\$ embedded in a lattice of size \$n_x,n_y,n_z,n_q\$. The sub-lattice corner is ...
user3646557's user avatar
34 votes
5 answers
3k views

Background I like my old 8-bit 6502 chip. It's even fun to solve some of the challenges here on PPCG in 6502 machine code. But some things that should be simple (like, read in data or output to stdout)...
Felix Palmen's user avatar
  • 4,276
-3 votes
2 answers
1k views

The task is simple: Create an if-statement from scratch in x86 assembly that runs in as few clock-cycles as possible. Must be x86 assembly. Can't use any of the conditional jump/branch instructions (e....
Lance Pollard's user avatar
15 votes
1 answer
1k views

As an exercise, I've created a simple solution for this challenge, in x86 Assembly Language. I'm running this with FASM on Windows. Here's my source code: ...
vasilescur's user avatar
54 votes
38 answers
11k views

I noticed that there's no such question, so here it is: Do you have general tips for golfing in x86/x64 machine code? If the tip only applies to a certain environment or calling convention, please ...
ბიმო's user avatar
2 votes
0 answers
702 views

This is a Hello World challenge! Those plain ones! Yeah.... However, it's different this time. Because here, you can't use C or C++ or Stuck or ArnoldC or whatever you want. You can only choose raw ...
180Five's user avatar
  • 47
11 votes
3 answers
2k views

What is the smallest possible runnable Mach-O executable on x86_64? The program can do nothing (not even returning a return code), but must be a valid executable (must run without errors). My try: ...
Martin M.'s user avatar
  • 223
20 votes
1 answer
1k views

Create a bootloader that executes given Brainfuck program. This is code-golf, so the program with least bytes wins. Being a bootloader, the size of the program is counted in non-zero bytes in the ...
Hannes Karppila's user avatar
2 votes
0 answers
279 views

I want to write 7 assembly instructions (28 bytes) that runs a logical equivalent of this C snippet: c = a + b + 6; while (c > 5) { c = c - a; b = b + 1; } ...
Patrick Roberts's user avatar
7 votes
4 answers
1k views

I'd like to start a series of challenges for http://box-256.com/ starting with the first challenge, “BIG SQUARE II”. After this one I'll add another for "CHECKERBOARD" and so on. Rules: Complete the ...
Baldrick's user avatar
  • 271
6 votes
1 answer
376 views

A peer of mine approached me with this challenge and I wasn't able to come up with an elegant solution. After discussing my approach, we began to wonder what the people at Code Golf would come up with....
Brett's user avatar
  • 83
22 votes
14 answers
2k views

This is an adaption of Core War, a programming KOTH dating back to the 20th century. To be more specific, it is using an incredibly simplified instruction set primarily based off of the original ...
PhiNotPi's user avatar
  • 29.3k
3 votes
0 answers
226 views

You can find the Hack Assembly Language specification here: http://www.cs.huji.ac.il/course/2002/nand2tet/docs/ch_4_machine_language.pdf You can download the Hack Computer emulator here: http://www....
Koray Tugay's user avatar
13 votes
2 answers
3k views

The task is simple: write assembly that computes the order of magnitude of an integer using as few clock cycles as possible. Order of magnitude is defined as log10, ...
Lance Pollard's user avatar
8 votes
1 answer
815 views

WinAli is a model assembler for Windows. It emulates a real CPU and is meant to help students learning and understanding the Assembly language. German Wikipedia article: http://de.wikipedia.org/wiki/...
GiantTree's user avatar
  • 925
3 votes
1 answer
540 views

I want to write x86 assembler code that can be used to boot your computer from and dims NumLock. This means you cannot rely on glibc or any other of these "comfi" libraries you cannot rely on the ...
Thorsten Staerk's user avatar
4 votes
3 answers
1k views

I want a program that outputs "hello world" on console on my x86_64 based Linux computer. Yes, a complete program, not something silly that needs an interpreter or a compiler to work. You may: use ...
Thorsten Staerk's user avatar
5 votes
5 answers
2k views

Your challenge is to write a routine, in x86 assembly, which takes a buffer containing 32-bit signed integers and writes a sorted list of the prime values to another buffer, then returns the number of ...
Polynomial's user avatar
  • 4,544
7 votes
7 answers
2k views

I come across a question in a coding competion "write a code that returns SIGSEGV(Segmentation fault ) " . Points were given on the basis of length of code. The prgramming languages available ...
Anil Arya's user avatar
  • 1,427
26 votes
13 answers
8k views

Write the shortest possible assembly-language quine. Use any ISA you want, unless it has a print-quine instruction or equivalent. Examples include x86, MIPS, ...
Hoa Long Tam's user avatar
  • 2,142