Last active
December 22, 2015 18:39
-
-
Save sck/6514608 to your computer and use it in GitHub Desktop.
Super awesome recreative assembler. Execute with ruby and pipe into nasm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pushed = [] | |
def push(*args) $pushed = args; args.map {|r| "push #{r}" } end | |
def pop_pushed; $pushed.reverse.map {|r| "pop #{r}" } end | |
puts DATA.read.gsub(/^\s*jmp\s*[^\n]*/, '%error "Dijkstra said: No!"').gsub(/=([^\n]*)/) {|c| (eval $1).join("\n ") } | |
__END__ | |
BITS 64 | |
section .text | |
global math | |
math: | |
=push("rax", "rbx") | |
sub r12, r11 | |
=pop_pushed | |
jmp math | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment