Skip to content

Instantly share code, notes, and snippets.

@antonijn
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save antonijn/10363874 to your computer and use it in GitHub Desktop.

Select an option

Save antonijn/10363874 to your computer and use it in GitHub Desktop.
What code compiled by FACC might look like (FAC-syntax)
global main
main:
push bp
mov bp, sp
sub sp, 2
mov word [ss:bp - 2], 0
.for0.start:
cmp word [ss:bp - 2], 10
jnl .for0.break
sub sp, 0
mov ax, .strlit0
push ax
call printf
add sp, 2
.for0.continue:
inc word [ss:bp - 2]
add sp, 0
jmp .for0.start
.for0.break:
mov ax, 0
add sp, 2
pop bp
ret
.strlit0: db "Hello, world!", 0x0a, 0x00
include("stdio.h");
int main() {
for (int i = 0; i < 10; ++i) {
printf("Hello, world!\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment