aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-09-21 23:53:09 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-09-21 23:53:09 -0400
commitf854cf73452aac23a57b3b75ce6eb243bb4ef2cd (patch)
treec967e70e0749901898e0fa324db3653489c5c1f9
parentee31e013358c87e83ce3b218c307e4480080e927 (diff)
downloadasmfun-f854cf73452aac23a57b3b75ce6eb243bb4ef2cd.tar.gz
Initial commit
-rw-r--r--Makefile11
-rwxr-xr-xprog1bin0 -> 1054 bytes
-rw-r--r--prog1.asm38
3 files changed, 49 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..64435ba
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,11 @@
+all: prog1
+
+prog1: prog1.o
+ ld -m elf_i386 -o $@ $<
+
+prog1.o: prog1.asm
+ nasm -f elf -g -o $@ $<
+
+.PHONY: clean
+clean:
+ rm -rf *.o prog1
diff --git a/prog1 b/prog1
new file mode 100755
index 0000000..de7e4ce
--- /dev/null
+++ b/prog1
Binary files differ
diff --git a/prog1.asm b/prog1.asm
new file mode 100644
index 0000000..bf69e45
--- /dev/null
+++ b/prog1.asm
@@ -0,0 +1,38 @@
+global _start
+
+section .text
+
+; while edx <= ecx
+loop:
+ cmp ecx, edx
+ jle exit
+
+ ; ebx++
+ add edx, 1
+
+ ; loop()
+ jmp loop
+
+exit:
+ ; exit value is edx, let's put it in ebx
+ mov ebx, edx
+
+ ; clear registers
+ mov edx, 0
+ mov ecx, 0
+
+ ; initate exit syscall
+ ; exit(ebx)
+ mov eax, 1
+ int 80h
+ ret
+
+_start:
+ mov eax, 0
+ mov edx, 0
+ mov ecx, 255
+ jmp loop
+
+ ; exit is ebx
+ ;mov ebx, 0
+