summary refs log tree commit diff
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-10-15 20:51:15 +0100
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-10-15 20:51:15 +0100
commit92ad493aaec8325637a467903b506ec22c49f485 (patch)
tree41a20e36bdb2eb46790b4b999167a0e8df582e87
downloadArm_Programming-92ad493aaec8325637a467903b506ec22c49f485.tar.gz
Arm_Programming-92ad493aaec8325637a467903b506ec22c49f485.tar.bz2
Arm_Programming-92ad493aaec8325637a467903b506ec22c49f485.zip
Initial Commit
-rw-r--r--01.s44
-rw-r--r--02.s18
-rw-r--r--03.s12
-rw-r--r--04.s12
-rw-r--r--meadow2018.s55
5 files changed, 141 insertions, 0 deletions
diff --git a/01.s b/01.s
new file mode 100644
index 0000000..c5257f2
--- /dev/null
+++ b/01.s
@@ -0,0 +1,44 @@
+    B main
+
+
+green_bottles   DEFB " green bottles",0
+hanging DEFB " hanging on the wall",0
+comma   DEFB ",\n",0
+line3   DEFB "And if one green bottle should accidentally fall,\n",0
+line4   DEFB "There will be ",0
+stop    DEFB ".\n",0
+
+        ALIGN
+main    MOV R0,#10
+        SWI 4
+        ADR R0,green_bottles
+        SWI 3
+        ADR R0,hanging
+        SWI 3
+        ADR R0,comma
+        SWI 3
+        
+        MOV R0,#10
+        SWI 4
+        ADR R0,green_bottles
+        SWI 3
+        ADR R0,hanging
+        SWI 3
+        ADR R0,comma
+        SWI 3
+
+        ADR R0, line3
+        SWI 3
+        
+        ADR R0, line4
+        SWI 3
+        MOV R0, #9
+        SWI 4
+        ADR R0,green_bottles
+        SWI 3
+        ADR R0,hanging
+        SWI 3
+        ADR R0,stop
+        SWI 3
+
+        SWI 2  
diff --git a/02.s b/02.s
new file mode 100644
index 0000000..bee9c54
--- /dev/null
+++ b/02.s
@@ -0,0 +1,18 @@
+    B main
+
+hello DEFB "Hello World\n",0
+bye DEFB "Goodbye Universe\n",0
+name DEFB "My name is Steve Bagley\n",0
+
+    ALIGN
+
+main    ADR R0, hello
+    SWI 3
+
+    ADR R0, name
+    SWI 3
+
+    ADR R0, bye
+    SWI 3
+
+    SWI 2
diff --git a/03.s b/03.s
new file mode 100644
index 0000000..61f6c88
--- /dev/null
+++ b/03.s
@@ -0,0 +1,12 @@
+    B main
+
+hello DEFB "Hello World\n",0
+bye   DEFB "Goodbye Universe\n",0
+
+    ALIGN
+main ADR R0, hello
+     SWI 3
+     ADR R0, bye
+     SWI 3
+
+     B main
diff --git a/04.s b/04.s
new file mode 100644
index 0000000..c942d1b
--- /dev/null
+++ b/04.s
@@ -0,0 +1,12 @@
+    B main
+
+  hello DEFB "Hello World\n",0
+  bye   DEFB "Goodbye Universe\n",0
+
+    ALIGN
+  main ADR R0, hello
+       SWI 3
+  submain     ADR R0, bye
+       SWI 3
+ 
+       B submain
diff --git a/meadow2018.s b/meadow2018.s
new file mode 100644
index 0000000..dbcd513
--- /dev/null
+++ b/meadow2018.s
@@ -0,0 +1,55 @@
+        B start
+
+
+verse	DEFW	4
+menmow  DEFB 	"went to mow\n",0
+mowdow  DEFB    "Went to mow a meadow\n",0
+men     DEFB    "men",0
+man     DEFB    "man",0
+comma   DEFB    ",",0
+nl      DEFB    "\n",0
+space   DEFB    " ",0
+and_dog DEFB    "and his dog, Spot",0
+
+        
+        ALIGN
+;4 men went to mow\n
+start   MOV R1, #0
+main    ADR R0, verse
+        SWI 3
+        ADR R0, space
+        SWI 3
+        ADR R0, men
+        SWI 3
+        ADR R0, menmow
+
+;Went to mow a meadow\n
+        ADR R0, mowdow
+        SWI 3
+
+;4 men, X men,
+        
+
+
+        ADR R0, mowdow
+        SWI 3
+
+        ADR R0, verse
+        SUBS R0, R0, R1 ; SUBS
+        ADD R1, R1, #1 ;increase the substract value
+        SWI 4
+        
+        BHI #0 print_plural
+        BEQ #0 singular
+
+        SWI 2  
+
+
+singular  
+
+
+        B main
+
+plural
+
+    B main