From 92ad493aaec8325637a467903b506ec22c49f485 Mon Sep 17 00:00:00 2001 From: Manuel Palenzuela Date: Tue, 15 Oct 2019 20:51:15 +0100 Subject: Initial Commit --- 01.s | 44 ++++++++++++++++++++++++++++++++++++++++++++ 02.s | 18 ++++++++++++++++++ 03.s | 12 ++++++++++++ 04.s | 12 ++++++++++++ meadow2018.s | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+) create mode 100644 01.s create mode 100644 02.s create mode 100644 03.s create mode 100644 04.s create mode 100644 meadow2018.s 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 -- cgit 1.4.1