Skip to content

Commit

Permalink
Got compiler to be able to compile "hello, world" program.
Browse files Browse the repository at this point in the history
Although it just says "hi", since I don't have strings.
  • Loading branch information
Kragen Javier Sitaker committed Oct 9, 2008
1 parent b659298 commit afceadb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ hello42
a.out
tmp.*
Q
hi
8 changes: 8 additions & 0 deletions build
Expand Up @@ -3,9 +3,17 @@ set -ve
if ! ./tinyboot.py hello42.tbf1 > hello42; then cat hello42; exit 1; fi
chmod 755 hello42
./hello42 || echo $?

./tinyboot.py Q.tbf1
if ! ./tinyboot.py tinyboot1.tbf1 < Q.tbf1 > Q; then cat Q; exit 1; fi
chmod 755 Q
strace ./Q

./tinyboot.py hi.tbf1
if ! ./tinyboot.py tinyboot1.tbf1 < hi.tbf1 > hi; then cat hi; exit 1; fi
chmod 755 hi
strace ./hi

if ! ./tinyboot.py tinyboot1.tbf1 < tinyboot1.tbf1 > tb1; then cat tb1; exit 1; fi
chmod 755 tb1
./tb1 || echo $?
Expand Down
3 changes: 3 additions & 0 deletions hi.tbf1
@@ -0,0 +1,3 @@
( simple program to print out "hi" )
v h b 104 b 105 b 10
^ h 3 W Q
4 changes: 3 additions & 1 deletion tinyboot1.tbf1
Expand Up @@ -102,9 +102,11 @@ v `
v M ( system call routine; called in program with lowercase `m`)
( syscall number already in %eax )
( xchg %ebp, %esp) b 135 b 236
( this really weird order is basically a special case for write(2)
( first we pop the first argument, then the third, then the second)
( pop %ebx) b 91
( pop %ecx) b 89
( pop %edx) b 90
( pop %ecx) b 89
( int 0x80) b 205 b 128
( xchg %ebp, %esp) b 135 b 236
( ret) b 195
Expand Down

0 comments on commit afceadb

Please sign in to comment.