diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-16 17:47:30 +0100 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-10-16 17:47:30 +0100 |
commit | 0429e03ae3db791f38bde32ff79a192de8a223c5 (patch) | |
tree | ed3ad4136d3808d77577bfaa408627ae4410f734 | |
parent | Initial Commit (diff) | |
download | Arm_Programming-0429e03ae3db791f38bde32ff79a192de8a223c5.tar.gz Arm_Programming-0429e03ae3db791f38bde32ff79a192de8a223c5.tar.bz2 Arm_Programming-0429e03ae3db791f38bde32ff79a192de8a223c5.zip |
Start refractor
-rw-r--r-- | 05.s (renamed from meadow2018.s) | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/meadow2018.s b/05.s index dbcd513..a1b5719 100644 --- a/meadow2018.s +++ b/05.s @@ -15,7 +15,9 @@ and_dog DEFB "and his dog, Spot",0 ALIGN ;4 men went to mow\n start MOV R1, #0 -main ADR R0, verse + MOV R2, #4 + +main ADR R0, verse ; change to R2 SWI 3 ADR R0, space SWI 3 @@ -28,28 +30,24 @@ main ADR R0, verse SWI 3 ;4 men, X men, + ; R2 is the number from 4 to 1 + ADR R0, R2 + SUB R0, R0, R1 + ; down to here it makes sense + CMP R0, #1 ;i need 2 counters + ADD R1, R1, #1 ;increase the substract value + SWI 4 - + BEQ singlr + + B main 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 + CMP ; we need to compare n of iterations + smaller than 3 + BLT main - B main - -plural - - B main + SWI 2 |