• This repository has been archived on 28/Feb/2023
  • Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    C
  • License
    MIT License
  • Created about 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The only true brainfuck-targetting assembler.

                                                      .oooo.    .o8        .o88o. 
                                                    .dP""Y88b  "888        888 `" 
                .oooo.    .oooo.o ooo. .oo.  .oo.         ]8P'  888oooo.  o888oo  
               `P  )88b  d88(  "8 `888P"Y88bP"Y88b      .d8P'   d88' `88b  888    
                .oP"888  `"Y88b.   888   888   888    .dP'      888   888  888    
               d8(  888  o.  )88b  888   888   888  .oP     .o  888   888  888    
               `Y888""8o 8""888P' o888o o888o o888o 8888888888  `Y8bod8P' o888o   
                                                                                  
                                                                                  
                                                                                  
The only true brainfuck assembler. Produces small and efficient brainfuck code based on instruction choice.
With Lua preprocessor, labels, precise floating point, effective adresses, conditional branching, signed arithmetics,
dynamic memory allocation and all the features you'd expect from a normal assembly, it's ready for use.
Lastest changes include stack-based offsets and move semantics. Why not check it out?

etc/asmbf.pdf                    - WIP, UP TO DATE ASM2BF MANUAL AND DOCUMENTATION.

https://esolangs.org/wiki/Asm2bf - a brief showcase of select asm2bf's capabilities.

examples/                        - who doesn't love learning by examples?
test/                            - unit tests for the entire toolchain.

a functional programming language interpreter in 150 lines of asm2bf:
https://github.com/kspalaiologos/asmbf/blob/master/examples/sk.asm

asm2bf was used to create a JSON formatter webservice:
https://github.com/kspalaiologos/JSONFormatter/blob/master/jsonformatter.asm

also, a subleq interpreter approach has been taken:
https://github.com/kspalaiologos/SqEMU/blob/master/dev-sqemu.s

an optimized 8ball:
https://github.com/kspalaiologos/asmbf/blob/master/examples/8ball.asm

----------------------------------------- What can asm2bf do? ------------------------------------------

First and foremost, asm2bf is a language which is very portable. It can compile to special asm2bf
bytecode (which can be retargetted to virtually any platform in a few hours). It also outputs _pure_
brainfuck, which is executable by any brainfuck interpreter, which means, that asm2bf is able to benefit
from countless brainfuck-to-any compilers.

Secondly, asm2bf is a both a fairly low level language and a high level language. It abstracts the
concepts of effective adresses, powerful preprocessors, advanced control flow, floating point numbers,
signed arithmetic, etc..., into a robust toolkit for developing brainfuck, and, subsequently, any language
which can be a target of compilation from brainfuck or asm2bf bytecode.

Third, asm2bf in itself can be made to produce really small programs (check 8ball.asm in examples),
but it can also be used to create very complicated programs (check sk.asm). Because it provides an acceptable
level of abstraction to the programmer, it's feasible to write your proofs of concepts in asm2bf and
later optimize them to be as fast as possible using existing resources and community-created guides,
or by reading the code and experimenting yourself.

asm2bf is still, after multiple years, work in progress. It gains new features rather often. So far,
asm2bf has around 160 instructions that you can use in your programs and around 300 lines of Lua
code providing essential batteries for metaprogramming in asm2bf. It's a hobby project of mine, to which
a few people decided to contribute, but I'll try to maintain it for as long as possible.

asm2bf is capable of being the foundation of any more or less complex program. It has been used to create
an operating system (which boots and operates mainly thanks to pure brainfuck! This is possible because the
brainfuck code can directly access the memory and set up a custom interrupt handler, which executes
provided assembled machine code when the timer intterupt fires, which later modifies the interpreter
to add special instructions to it). asm2bf has also been used to create a small (~150 line) functional
programming language interpreter, which compiles to only around 20 kilobytes of brainfuck. It was also
used to create tiny brainfuck programs, as well as proofs of concepts for web development in brainfuck.

Finally, I, the author, am working on an exhaustive manual on _all_ of asm2bf, for which the progress
you can see in etc/asmbf.pdf

------------------------------------------ Get a taste of it! ------------------------------------------

; Sierpinski triangle fractal viewer

@loop1
    mov r2, 0
    
    @loop2
        mov r3, r1
        band r3, r2
        cge r3, 1
        mov r3, .*
        cmov r3, 32
        out r3
        clt r2, 63
        cadd r2, 1
        cjn %loop2
    
    out 10
    
    clt r1, 63
    cadd r1, 1
    cjn %loop1

--------------------------------------- Installation Instruction ---------------------------------------

1. Pull the repository from github: `git clone https://github.com/kspalaiologos/asmbf'
2. Run the configure script and build asm2bf:
    `./configure --with-target=release && make all && sudo make install`

-------------------------------------- State-of-art Documentation --------------------------------------

There is the esolang wiki article which you can check out. Feel free to join the discord server for
asm2bf, where you can discuss the project or ask me about learning asm2bf: https://discord.gg/m4Wcenn.

You can also check out the manual (etc/asmbf.pdf); although up to date, it's not complete.

---------------------------------------------- Dependencies ---------------------------------------------

Term::ReadKey, File::Basename, Term::ANSIColor               @ cpan
gcc, bison, flex, make, autotools, ncurses

--------------------------------------------- Windows Build ---------------------------------------------

To _configure_ this project on Windows, you need either Cygwin or MinGW (msys). The build should look
exactly the same like the Linux one.

Note that building the project on Windows and targets other than `release' and `auto' is unsupported.

More Repositories

1

bzip3

A better and stronger spiritual successor to BZip2.
C
673
star
2

malbolge-lisp

A lightweight (350MB) Lisp interpreter in Malbolge Unshackled, often dubbed the hardest turing complete programming language.
TeX
484
star
3

kamilalisp

A functional, flexible and concise Lisp.
Java
271
star
4

C-Learning-Resources

Resources for learning C that are the best in my opinion.
116
star
5

qbdiff

building and applying patches to binary files
C
67
star
6

sdlgames

A collection of small games made using SDL and C/++.
C++
23
star
7

tinyz80

A minimal Z80 implementation.
C
21
star
8

A-Programming-Language

An effort to transcribe Ken Iverson's "A Programming Language" book to LaTeX.
TeX
18
star
9

blc-mb

Binary Lambda Calculus evaluation engine written in Malbolge.
C
17
star
10

tiny6502

a small (~140 line) and portable 6502 emulator demo.
Assembly
16
star
11

typeracer

A ncurses-powered typing game
C
16
star
12

modern-rzip

A backup suite. Supports FLZMA2, bzip3, LZ4, Zstandard, LSH i-node ordering deduplicating archiver, long range deduplication, encryption and recovery records
C
15
star
13

Maja

A slick numerics-oriented Mathematical library for Java
Java
15
star
14

tau

a reasonably fast syntax highlighter
C
13
star
15

writings

a single place to collectively store every bit of my writings i deem at least remotely valuable.
TeX
13
star
16

lc-apl

Journey to the Center of the Lambda Calculus
APL
12
star
17

asm2ws

alpha-grade whitespace toolchain
C
11
star
18

lz4huf

An attempt to marry a fast Lempel-Ziv codec (LZ4) with a fast entropy coder (Huff0).
C
10
star
19

ski

a 666-byte, public domain SKI combinator calculus evaluator in C, minsky machines and other stuff
Perl
9
star
20

mblzp

A lightweight (8MB) implementation of the McIlroy-Tamayo Lempel-Ziv variation in Malbolge Unshackled.
C
9
star
21

mri

minecraft region interchange - compressing minecraft savefiles with bzip3.
C
9
star
22

compression

playing with small decompressors and good ratios :)
9
star
23

adler32-sse2

Adler32 implementation used in Alpha64 at ~13GiB/s in a 1 kilobyte binary.
Assembly
8
star
24

ski-windows

a 976-byte, GUI SKI calculus evaluator written in x86 assembly for windows
Assembly
8
star
25

nonalphanumeric-c

A compiler targetting a subset of C which doesn't use letters nor numbers.
C
8
star
26

cosmopolitan-sk

SK calculus reducer in as many programming languages as possible.
TSQL
7
star
27

elfdude

a small & primitive elf32 packer.
Assembly
7
star
28

rezip

Turn any archive format supported by libarchive into an uncompressed zip file for better archiving purposes.
C
6
star
29

cursed-asm

Use AT&T syntax on even lines and Intel syntax on odd lines
Assembly
6
star
30

LambdaCalculus

Dead simple implementation of Lambda Calculus.
C
6
star
31

dirac

Delightfully Intricate Reasonably Amazing Calculator
C
6
star
32

aoc2023

Advent Of Code 2023 in APL, Haskell and C.
Haskell
6
star
33

recreational

My submissions for Code guessing, Code golf and other recreational programming things.
C
6
star
34

b2all

Collection of brainfuck-to-anything compilers in brainfuck.
Brainfuck
6
star
35

dev-urandom

An assortment of random programs that serve random purposes.
C++
6
star
36

MacroLogger

Simple C logging library utilizing only C89 preprocessor and standard library. It's possible to turn on ANSI colors and GNU preprocessor extensions (and they are by default)).
C
6
star
37

esofun

esofun is an array, imperative, procedural and functional language mix.
C++
5
star
38

euler-apl

project euler solved in APL
APL
5
star
39

apl-misc-math

Miscellaneous mathematical and numerical utilities in APL.
APL
5
star
40

x86lisp

2158 byte Lisp interpreter for Windows.
5
star
41

cask

An alternative way to package Java applications.
Java
4
star
42

e8e9

A command-line wrapper for Shelwien's e8e9 algorithm.
C
4
star
43

dx

Domain eXtensions for Dyalog APL
APL
3
star
44

elf-infection

Source code for https://palaiologos.rocks/essays/posts/elf-infection/
Assembly
3
star
45

snakes

A KoTH programming game host for the Esolangs Discord server.
C
3
star
46

apl-logic

Logic gate system emulation in APL.
APL
3
star
47

apio

a very good and not bad c++ utility library.
C++
3
star
48

constant-overhead

Measuring constant overhead of various programming languages.
C
3
star
49

yarg

Yet another UNIX-like argument parser for C. CC0-licensed.
C
2
star
50

Proton

Proton is toolkit for desktop app creation in ActionScript3
AutoIt
2
star
51

dyalog-hs

Dyalog APL Competition solved with Haskell.
Haskell
2
star
52

yaspell

Yet Another Spellchecker. WIP.
Shell
2
star
53

sublime-v2

sublime: an asm2bf execution bot written in typescript
Perl
2
star
54

rust-jni-template

A template for developing JNI libraries using the Rust programming language
Java
2
star
55

euler

Project Euler solved in Brainfuck.
Brainfuck
2
star
56

kspalaiologos

Github description, I guess.
2
star
57

Chess.fl

Chess.fl is simple Flash library for managing chessboards.
ActionScript
1
star
58

minits

a crude testing platform used by malbolgelisp ca. August of 2021, preserved for historical reasons.
TypeScript
1
star
59

TinyURL-Shortener

TinyURL frontend script written in Bash. Requires cURL to be installed on target machine.
Shell
1
star
60

dotfiles

A stripped down version of my dotfiles hopefully suitable for use by others.
Shell
1
star
61

ILoCore-Release

Binaries of ILoCore Minecraft 1.14 plugin.
1
star
62

Chemal

The chemical balancer
ActionScript
1
star
63

code-guessing-backend

a (yet incomplete), fully automated code guessing automation platform.
Shell
1
star
64

namechanger

simple bash script to replace one pattern with another for each of your github repositories
Shell
1
star
65

sdlmine

A SDL2 minesweeper in 1000 lines of code.
C
1
star
66

sdlreversi

A reversi/othello game under 500 lines of C++ code.
C++
1
star
67

MANIAC-2

Replica of the first computer to beat human in a chess-like game.
C
1
star
68

ctlsh

A C port of the Trend Micro Locality Sensitive Hashing library.
C
1
star
69

ppmdj1

A Github mirror of Dymitry Shkarin's PPMd var. J
C++
1
star
70

xpar

an error/erasure code system guarding data integrity
C
1
star
71

kcrypt2

a proof-of-concept for cryptographic systems based on polynomial reconstruction.
C
1
star