aboutsummaryrefslogtreecommitdiff
path: root/sem3/osc/miniproject/cnasm/test.asm
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-11 12:24:56 +0100
committerJulian T <julian@jtle.dk>2020-02-11 12:24:56 +0100
commit6db1a2cdd3b96731f2e092d55d8c2136eabc52d0 (patch)
tree2be8fae8ce82d708ed9f00f376dda14420850e80 /sem3/osc/miniproject/cnasm/test.asm
parent57305119e05559c1c37e903aef89cd43f44c42c9 (diff)
Rename and cleanup
Diffstat (limited to 'sem3/osc/miniproject/cnasm/test.asm')
-rw-r--r--sem3/osc/miniproject/cnasm/test.asm39
1 files changed, 39 insertions, 0 deletions
diff --git a/sem3/osc/miniproject/cnasm/test.asm b/sem3/osc/miniproject/cnasm/test.asm
new file mode 100644
index 0000000..77a3572
--- /dev/null
+++ b/sem3/osc/miniproject/cnasm/test.asm
@@ -0,0 +1,39 @@
+global _start
+
+section .data
+ align 2
+ ; String, which is just a collection of bytes, 0xA is newline
+ str: db 'Hello, world!',0xA
+ strLen: equ $-str
+
+section .bss
+
+section .text
+ _start:
+
+ mov edx, strLen ; Arg three: the length of the string
+ mov ecx, str ; Arg two: the address of the string
+ mov ebx, 1 ; Arg one: file descriptor, in this case stdout
+ mov eax, 4 ; Syscall number, in this case the
+ int 0x80 ; Interrupt 0x80
+
+ if ( hej = 10 ) {
+ mov ebx, 0 ; Arg one: the status
+ mov eax, 1 ; Syscall number:
+ if(cool) {
+ int 0x80
+ }
+ } else {
+ while( lol ) {
+ mov hej, 0
+ }
+ }
+ while( lol ) {
+ mov hej, 0
+ }
+
+ hej
+
+ for(mov a, 0( a < 100( a++ ) {
+ test
+ }