aboutsummaryrefslogtreecommitdiffstats
path: root/travis/test
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 15:37:54 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-11-11 21:43:46 +0300
commitfa747e71a878bfa0e1bbb8d31e5f381fa297bf7f (patch)
tree15454b1f3c39d96f02813b4fc8d461c762bf35e7 /travis/test
parent88ef14eed8994ab60ff9dd893d88dbd4837a80f0 (diff)
downloadnasm-fa747e71a878bfa0e1bbb8d31e5f381fa297bf7f.tar.gz
nasm-fa747e71a878bfa0e1bbb8d31e5f381fa297bf7f.tar.xz
nasm-fa747e71a878bfa0e1bbb8d31e5f381fa297bf7f.zip
test: nasm-t -- Add lnxhello
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'travis/test')
-rw-r--r--travis/test/lnxhello.asm49
-rw-r--r--travis/test/lnxhello.json11
-rw-r--r--travis/test/lnxhello.o.tbin0 -> 784 bytes
3 files changed, 60 insertions, 0 deletions
diff --git a/travis/test/lnxhello.asm b/travis/test/lnxhello.asm
new file mode 100644
index 00000000..5fd74055
--- /dev/null
+++ b/travis/test/lnxhello.asm
@@ -0,0 +1,49 @@
+;
+; Assembly "Hello, World!" for Linux
+;
+
+
+; Properly defined in <sys/syscall.h>
+%define SYS_exit 1
+%define SYS_write 4
+
+ section .text
+
+ global _start
+_start:
+ ; gdb doesn't like to stop at the entry point address, so
+ ; we put a nop here for pure convenience
+ nop
+
+
+write_hello:
+ mov edx, hello_len
+ mov ecx, hello
+
+.loop:
+ mov eax, SYS_write
+ mov ebx, 1 ; stdout
+ int 80h
+
+ cmp eax, -4096
+ ja error
+
+ add ecx, eax
+ sub edx, eax
+ jnz .loop
+
+ok:
+ mov eax, SYS_exit
+ xor ebx, ebx
+ int 80h
+ hlt
+
+error:
+ mov eax, SYS_exit
+ mov ebx, 1 ; Error
+ int 80h
+ hlt
+
+ section .rodata
+hello: db "Hello, World!", 10
+hello_len equ $-hello
diff --git a/travis/test/lnxhello.json b/travis/test/lnxhello.json
new file mode 100644
index 00000000..b62b8909
--- /dev/null
+++ b/travis/test/lnxhello.json
@@ -0,0 +1,11 @@
+[
+ {
+ "description": "Assembly 'Hello, World! for Linux",
+ "id": "lnxhello",
+ "format": "elf32",
+ "source": "lnxhello.asm",
+ "target": [
+ { "output": "lnxhello.o" }
+ ]
+ }
+]
diff --git a/travis/test/lnxhello.o.t b/travis/test/lnxhello.o.t
new file mode 100644
index 00000000..d0532cd7
--- /dev/null
+++ b/travis/test/lnxhello.o.t
Binary files differ