Fucking Assembly Geniusness

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Fucking Assembly Geniusness (or FAG for short) is a brainfuck extension and esoteric programming language designed by User:MiloIzVannoy in 2025. It is designed to be a practical low-level language while retaining the soul-crushing difficulty of its predecessor. The language's name is a humorous backronym chosen in the tradition of esolang naming; it is intended purely for fun and not meant to cause offense.

Overview

FAG is based on brainfuck but introduces several critical features for systems programming:

  • Structured loops with break.
  • Bitwise operations and shifts.
  • A powerful syscall mechanism.
  • An instruction repetition suffix for shorter and more optimized code.

Language specification

Core brainfuck commands

The classic 6 commands remain unchanged: > < + - [ ] and . , repurposed for system calls

New commands/features

Instruction Repetition: (code)*hex

Repeats the code inside the parentheses hex times. If only a single instruction needs to be repeated, the parentheses can be omitted: *hexcommand. The suffix *00 uses the next four cells as a 32-bit repeat count, and *01 will do piece of code with 50% random chance

Zero Loop: { code }

A new loop that runs while the current cell is equal to zero.

Loop Break:

Breaks out of the innermost loop immediately. Stacking it in row will break out of multiple loops, can be used for conditional break

Bitwise Operations

Binary operations AND, OR, XOR use the current cell as the first operand and the next cell as the second operand. The result is stored in the current cell. The pointer is not moved by the operation. NOT and shifts are unary operators
& (AND): *p = *p & *(p+1)
| (OR): *p = *p | *(p+1)
^ (XOR): *p = *p ^ *(p+1)
~ (NOT): *p = ~*p
» (Right shift): *p = *p >> 1
« (Left shift): *p = *p << 1

Random

§ is used for moving a random number from 0 to 255 to current cell

Accumulator

Accumulator added, it can be used for swapping 2 values if there's not enough empty cells
° used for copying current cell to accumulator, and • used to pop the value and add byte from accumulator to cell

System Calls

The output command . is repurposed for syscalls. A syscall is initiated by outputting a sequence of bytes: [arg1] [arg2] ... [argN] [syscall_id] 0x00. The interpreter parses this stream and executes the corresponding system call. The input command , is used to read results from previously invoked syscalls.

Examples

Hello World (using syscalls)

// Write "Hello World!\n" to memory
>+*48 >+*65 >+*6C >+*6C >+*6F >+*20 >+*57 >+*6F >+*72 >+*6C >+*64 >+*21 >+*0A
[<]>  // Move pointer to the second byte (start of the string)
[.>] // Output bytes until zero is found
+.>.  // Hypothetical syscall sequence: output args + syscall ID 1 + 0

Computational class

As a superset of brainfuck, FAG is Turing-complete.