String case: Difference between revisions
Content added Content deleted
VincentARM (talk | contribs) (Add task to arm assembly raspberry pi) |
VincentARM (talk | contribs) (add task to aarch64 assembly raspberry pi 3) |
||
Line 314: | Line 314: | ||
ALPHABETA |
ALPHABETA |
||
alphabeta</pre> |
alphabeta</pre> |
||
=={{header|AArch64 Assembly}}== |
|||
{{works with|as|Raspberry Pi 3B version Buster 64 bits <br> or android 64 bits with application Termux }} |
|||
<syntaxhighlight lang AArch64 Assembly> |
|||
/* ARM assembly AARCH64 Raspberry PI 3B */ |
|||
/* program strcase64.s */ |
|||
/************************************/ |
|||
/* Constantes */ |
|||
/************************************/ |
|||
/* for this file see task include a file in language AArch64 assembly*/ |
|||
.include "../includeConstantesARM64.inc" |
|||
/************************************/ |
|||
/* Initialized data */ |
|||
/************************************/ |
|||
.data |
|||
szMessResult: .asciz "Result: \n" |
|||
szString: .asciz "alphaBETA" |
|||
szCarriageReturn: .asciz "\n" |
|||
szMessStart: .asciz "Program 64 bits start.\n" |
|||
/************************************/ |
|||
/* UnInitialized data */ |
|||
/************************************/ |
|||
.bss |
|||
sBuffer: .skip 80 |
|||
sBuffex1: .skip 80 |
|||
/************************************/ |
|||
/* code section */ |
|||
/************************************/ |
|||
.text |
|||
.global main |
|||
main: // entry of program |
|||
ldr x0,qAdrszMessStart |
|||
bl affichageMess |
|||
ldr x1,qAdrszString |
|||
ldr x3,qAdrsBuffer |
|||
ldr x4,qAdrsBuffex1 |
|||
mov x6,#0b100000 // 1 -> bit 5 |
|||
mov x2,#0 |
|||
1: |
|||
ldrb w0,[x1,x2] // load byte of string |
|||
mov x5,x0 |
|||
cmp x0,#'A' // select alpha characters lower or upper |
|||
blt 3f |
|||
cmp x0,#'z' |
|||
bgt 3f |
|||
cmp x0,#'Z' |
|||
ble 2f |
|||
cmp x0,#'a' |
|||
bge 2f |
|||
b 3f |
|||
2: |
|||
orr x0,x0,x6 // converion in lower case (1 -> bit 5) |
|||
bic x5,x0,x6 // converion in upper case (0 -> bit 5) |
|||
3: |
|||
strb w0,[x3,x2] // store lower character |
|||
strb w5,[x4,x2] // store upper character |
|||
cmp x0,#0 // end string ? |
|||
add x2,x2,#1 // increment index character |
|||
bne 1b // loop |
|||
ldr x0,qAdrszMessResult |
|||
bl affichageMess |
|||
ldr x0,qAdrsBuffer |
|||
bl affichageMess |
|||
ldr x0,qAdrszCarriageReturn |
|||
bl affichageMess |
|||
ldr x0,qAdrsBuffex1 |
|||
bl affichageMess |
|||
ldr x0,qAdrszCarriageReturn |
|||
bl affichageMess |
|||
100: // standard end of the program |
|||
mov x0, #0 // return code |
|||
mov x8, #EXIT // request to exit program |
|||
svc 0 // perform the system call |
|||
qAdrszString: .quad szString |
|||
qAdrsBuffer: .quad sBuffer |
|||
qAdrsBuffex1: .quad sBuffex1 |
|||
qAdrszMessResult: .quad szMessResult |
|||
qAdrszCarriageReturn: .quad szCarriageReturn |
|||
qAdrszMessStart: .quad szMessStart |
|||
/***************************************************/ |
|||
/* ROUTINES INCLUDE */ |
|||
/***************************************************/ |
|||
/* for this file see task include a file in language AArch64 assembly*/ |
|||
.include "../includeARM64.inc" |
|||
</syntaxhighlight> |
|||
{{Out}} |
|||
<pre> |
|||
Program 64 bits start. |
|||
Result: |
|||
alphabeta |
|||
ALPHABETA |
|||
</pre> |
|||
=={{header|Action!}}== |
=={{header|Action!}}== |
||
{{libheader|Action! Tool Kit}} |
{{libheader|Action! Tool Kit}} |