RosettaCodeData/Task/Loops-For/AArch64-Assembly/loops-for.aarch64

54 lines
1.9 KiB
Plaintext

/* ARM assembly AARCH64 Raspberry PI 3B */
/* program loop64.s */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data */
/*******************************************/
.data
szMessX: .asciz "X"
szCarriageReturn: .asciz "\n"
/*******************************************/
/* UnInitialized data */
/*******************************************/
.bss
/*******************************************/
/* code section */
/*******************************************/
.text
.global main
main: // entry of program
mov x2,0 // counter loop 1
1: // loop start 1
mov x1,0 // counter loop 2
2: // loop start 2
ldr x0,qAdrszMessX
bl affichageMess
add x1,x1,1 // x1 + 1
cmp x1,x2 // compare x1 x2
ble 2b // loop label 2 before
ldr x0,qAdrszCarriageReturn
bl affichageMess
add x2,x2,1 // x2 + 1
cmp x2,#5 // for five loop
blt 1b // loop label 1 before
100: // standard end of the program */
mov x0,0 // return code
mov x8,EXIT // request to exit program
svc 0 // perform the system call
qAdrszMessX: .quad szMessX
qAdrszCarriageReturn: .quad szCarriageReturn
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"