ARM Assembler raspberry pi : using \' putty \' The code i have only print once :
ID: 3872135 • Letter: A
Question
ARM Assembler raspberry pi : using ' putty '
The code i have only print once :
@ File: once.s
.global _start
_start:
_write:
MOV R0, #1
LDR R1, =string
MOV R2, #12
MOV R7, #4
SWI 0
_exit:
MOV R7, #1
SWI 0
.data
string:
.ascii "Hello World "
- I need to use any conditional branch in the for loop to print ten times.
- I have learned so far : AND, ORR, EOR, CMP, CMN, TST, TEQ, SUB, SUBS, SUBGT, SUBGTS, BAL _exit, BL _doSomething, ADDEQ, LDR, =string, .ascii, .data, MOV R7, #1 ; MOV PC, LR
Thank you.
You are expected to use branches to recreate the functionality of a for loop and achieve this result. Use the write system cal to print to the console. Save this program as labla.s. Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello WorldExplanation / Answer
You can use "REM A typical for loop" methodology of ARM assembler. This is used to loop for a fixed no of times just like in for loop.The syntax of this structure is as following:-
FOR ch=0 TO 10
// any thing that you want inside for loop.
REM REPEAT loop equivalent
so if you want to print hello world 10 times you can use the following code:
FOR ch=1 TO 10
.data
string:
.ascii "Hello World
REM REPEAT loop equivalent