Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -0,0 +1,168 @@
|
|||
/* ARM assembly AARCH64 Raspberry PI 3B */
|
||||
/* program varenvir64.s */
|
||||
|
||||
/***********************/
|
||||
/* Constantes */
|
||||
/***********************/
|
||||
/* for this file see task include a file in language AArch64 assembly*/
|
||||
.include "../includeConstantesARM64.inc"
|
||||
|
||||
/*******************************************/
|
||||
/* Macros */
|
||||
/*******************************************/
|
||||
//.include "../../ficmacros64.inc" @ for developer debugging
|
||||
|
||||
/***********************/
|
||||
/* Initialized data */
|
||||
/***********************/
|
||||
.data
|
||||
szMessDebutPgm: .asciz "Program 64 bits start. \n"
|
||||
szMessFinOK: .asciz "Program normal end. \n"
|
||||
szCarriageReturn: .asciz "\n"
|
||||
szmessresUser: .asciz "result for USER :"
|
||||
szmessresHome: .asciz "result for HOME :"
|
||||
szmessresPath: .asciz "result for PATH :"
|
||||
szVarRech: .asciz "USER="
|
||||
.equ LGVARRECH, . - szVarRech - 1 // car zero final
|
||||
szVarRech1: .asciz "HOME="
|
||||
.equ LGVARRECH1, . - szVarRech1 - 1 // car zero final
|
||||
szVarRech2: .asciz "PATH="
|
||||
.equ LGVARRECH2, . - szVarRech2 - 1 // car zero final
|
||||
/***********************/
|
||||
/* UnInitialized data */
|
||||
/***********************/
|
||||
.bss
|
||||
.align 4
|
||||
/***********************/
|
||||
/* code section */
|
||||
/***********************/
|
||||
.text
|
||||
.global main
|
||||
main: // entry of program
|
||||
ldr x0,qAdrszMessDebutPgm
|
||||
bl affichageMess
|
||||
mov fp,sp // fp <- start address
|
||||
mov x0,fp
|
||||
|
||||
// variable search USER
|
||||
ldr x2,[fp] // number param
|
||||
add x2,x2,#2
|
||||
ldr x1,qAdrszVarRech
|
||||
1:
|
||||
ldr x0,[fp,x2,lsl #3] // load variable address
|
||||
cmp x0,#0 // end ?
|
||||
beq 2f
|
||||
mov x4,x0
|
||||
bl searchSubBeginString // search variable name
|
||||
cmp x0,#-1 // no find ?
|
||||
cinc x2,x2,eq
|
||||
beq 1b
|
||||
ldr x0,qAdrszmessresUser
|
||||
bl affichageMess
|
||||
add x0,x4,#LGVARRECH
|
||||
bl affichageMess // display result
|
||||
ldr x0,qAdrszCarriageReturn
|
||||
bl affichageMess
|
||||
|
||||
2:
|
||||
ldr x2,[fp] // search variable HOME
|
||||
add x2,x2,#2
|
||||
ldr x1,qAdrszVarRech1
|
||||
3:
|
||||
ldr x0,[fp,x2,lsl #3]
|
||||
cmp x0,#0
|
||||
beq 4f
|
||||
mov x4,x0
|
||||
bl searchSubBeginString
|
||||
cmp x0,#-1
|
||||
cinc x2,x2,eq
|
||||
beq 3b
|
||||
ldr x0,qAdrszmessresHome
|
||||
bl affichageMess
|
||||
add x0,x4,#LGVARRECH
|
||||
bl affichageMess
|
||||
ldr x0,qAdrszCarriageReturn
|
||||
bl affichageMess
|
||||
|
||||
4:
|
||||
ldr x2,[fp] // search variable PATH
|
||||
add x2,x2,#2
|
||||
ldr x1,qAdrszVarRech2
|
||||
5:
|
||||
ldr x0,[fp,x2,lsl #3]
|
||||
cmp x0,#0
|
||||
beq 6f
|
||||
mov x4,x0
|
||||
bl searchSubBeginString
|
||||
cmp x0,#-1
|
||||
cinc x2,x2,eq
|
||||
beq 5b
|
||||
ldr x0,qAdrszmessresPath
|
||||
bl affichageMess
|
||||
add x0,x4,#LGVARRECH
|
||||
bl affichageMess
|
||||
ldr x0,qAdrszCarriageReturn
|
||||
bl affichageMess
|
||||
|
||||
6:
|
||||
ldr x0,qAdrszMessFinOK
|
||||
bl affichageMess
|
||||
100: // standard end of the program
|
||||
mov x0, #0 // return code
|
||||
mov x8,EXIT
|
||||
svc 0 // perform the system call
|
||||
|
||||
qAdrszMessDebutPgm: .quad szMessDebutPgm
|
||||
qAdrszMessFinOK: .quad szMessFinOK
|
||||
qAdrszCarriageReturn: .quad szCarriageReturn
|
||||
qAdrszVarRech: .quad szVarRech
|
||||
qAdrszVarRech1: .quad szVarRech1
|
||||
qAdrszVarRech2: .quad szVarRech2
|
||||
qAdrszmessresUser: .quad szmessresUser
|
||||
qAdrszmessresPath: .quad szmessresPath
|
||||
qAdrszmessresHome: .quad szmessresHome
|
||||
/******************************************************************/
|
||||
/* search a substring at the string beguining */
|
||||
/******************************************************************/
|
||||
/* r0 contains the address of the input string */
|
||||
/* r1 contains the address of substring */
|
||||
/* r0 returns index of substring in string or -1 if not found */
|
||||
searchSubBeginString:
|
||||
stp x1,lr,[sp,-16]! // save registers
|
||||
stp x2,x3,[sp,-16]!
|
||||
stp x4,x5,[sp,-16]!
|
||||
mov x2,#0 // counter byte input string
|
||||
mov x3,#0 // counter byte string
|
||||
1:
|
||||
ldrb w4,[x1,x3]
|
||||
ldrb w5,[x0,x2] // load byte string
|
||||
cmp x5,#0
|
||||
beq 3f
|
||||
cmp x4,#0 // zero final ?
|
||||
csel x0,xzr,x0,eq // yes string find in position 0
|
||||
beq 100f
|
||||
cmp x5,x4 // compare character
|
||||
beq 2f
|
||||
mov x0,#-1 // no return no find
|
||||
b 100f
|
||||
2:
|
||||
add x2,x2,#1 // and increment counter byte
|
||||
add x3,x3,#1 // and increment
|
||||
b 1b // and loop
|
||||
3:
|
||||
mov x2,-1 //
|
||||
cmp x4,#0
|
||||
mov x0,#-1 // yes returns no find
|
||||
bne 100f
|
||||
mov x0,#0 // string find in position 0
|
||||
100:
|
||||
ldp x4,x5,[sp],16
|
||||
ldp x2,x3,[sp],16
|
||||
ldp x1,lr,[sp],16 // restaur registers
|
||||
ret
|
||||
|
||||
/***************************************************/
|
||||
/* ROUTINES INCLUDE */
|
||||
/***************************************************/
|
||||
/* for this file see task include a file in language AArch64 assembly*/
|
||||
.include "../includeARM64.inc"
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program commandLine.s */
|
||||
/* REMARK 1 : this program use routines in a include file
|
||||
see task Include a file language arm assembly
|
||||
for the routine affichageMess conversion10
|
||||
see at end of this program the instruction include */
|
||||
|
||||
/***********************/
|
||||
/* Constantes */
|
||||
/***********************/
|
||||
.include "../constantes.inc"
|
||||
|
||||
|
||||
/*******************************************/
|
||||
/* Macros */
|
||||
/*******************************************/
|
||||
//.include "../../ficmacros32.inc" @ for developer debugging
|
||||
|
||||
/***********************/
|
||||
/* Initialized data */
|
||||
/***********************/
|
||||
.data
|
||||
szMessDebutPgm: .asciz "Program 32 bits start. \n"
|
||||
szMessFinOK: .asciz "Program normal end. \n"
|
||||
szCarriageReturn: .asciz "\n"
|
||||
szmessresUser: .asciz "result for USER :"
|
||||
szmessresHome: .asciz "result for HOME :"
|
||||
szmessresPath: .asciz "result for PATH :"
|
||||
szVarRech: .asciz "USER="
|
||||
.equ LGVARRECH, . - szVarRech - 1 @ car zero final
|
||||
szVarRech1: .asciz "HOME="
|
||||
.equ LGVARRECH1, . - szVarRech1 - 1 @ car zero final
|
||||
szVarRech2: .asciz "PATH="
|
||||
.equ LGVARRECH2, . - szVarRech2 - 1 @ car zero final
|
||||
/***********************/
|
||||
/* UnInitialized data */
|
||||
/***********************/
|
||||
.bss
|
||||
.align 4
|
||||
/***********************/
|
||||
/* code section */
|
||||
/***********************/
|
||||
.text
|
||||
.global main
|
||||
main: @ entry of program
|
||||
ldr r0,iAdrszMessDebutPgm
|
||||
bl affichageMess
|
||||
mov fp,sp @ fp <- start address
|
||||
mov r0,fp
|
||||
|
||||
@ variable search USER
|
||||
ldr r2,[fp] @ number param
|
||||
add r2,r2,#2
|
||||
ldr r1,iAdrszVarRech
|
||||
1:
|
||||
ldr r0,[fp,r2,lsl #2] @ load variable address
|
||||
cmp r0,#0 @ end ?
|
||||
beq 2f
|
||||
mov r4,r0
|
||||
bl searchSubBeginString @ search variable name
|
||||
cmp r0,#-1 @ no find ?
|
||||
addeq r2,#1
|
||||
beq 1b
|
||||
ldr r0,iAdrszmessresUser
|
||||
bl affichageMess
|
||||
add r0,r4,#LGVARRECH
|
||||
bl affichageMess @ display result
|
||||
ldr r0,iAdrszCarriageReturn
|
||||
bl affichageMess
|
||||
|
||||
2:
|
||||
ldr r2,[fp] @ search variable HOME
|
||||
add r2,r2,#2
|
||||
ldr r1,iAdrszVarRech1
|
||||
3:
|
||||
ldr r0,[fp,r2,lsl #2]
|
||||
cmp r0,#0
|
||||
beq 4f
|
||||
mov r4,r0
|
||||
bl searchSubBeginString
|
||||
cmp r0,#-1
|
||||
addeq r2,#1
|
||||
beq 3b
|
||||
ldr r0,iAdrszmessresHome
|
||||
bl affichageMess
|
||||
add r0,r4,#LGVARRECH
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszCarriageReturn
|
||||
bl affichageMess
|
||||
|
||||
4:
|
||||
ldr r2,[fp] @ search variable PATH
|
||||
add r2,r2,#2
|
||||
ldr r1,iAdrszVarRech2
|
||||
5:
|
||||
ldr r0,[fp,r2,lsl #2]
|
||||
cmp r0,#0
|
||||
beq 6f
|
||||
mov r4,r0
|
||||
bl searchSubBeginString
|
||||
cmp r0,#-1
|
||||
addeq r2,#1
|
||||
beq 5b
|
||||
ldr r0,iAdrszmessresPath
|
||||
bl affichageMess
|
||||
add r0,r4,#LGVARRECH
|
||||
bl affichageMess @ affichage message dans console
|
||||
ldr r0,iAdrszCarriageReturn
|
||||
bl affichageMess
|
||||
|
||||
6:
|
||||
ldr r0,iAdrszMessFinOK
|
||||
bl affichageMess
|
||||
100: @ standard end of the program
|
||||
mov r0, #0 @ return code
|
||||
mov r7, #EXIT @ request to exit program
|
||||
swi 0 @ perform the system call
|
||||
|
||||
iAdrszMessDebutPgm: .int szMessDebutPgm
|
||||
iAdrszMessFinOK: .int szMessFinOK
|
||||
iAdrszCarriageReturn: .int szCarriageReturn
|
||||
iAdrszVarRech: .int szVarRech
|
||||
iAdrszVarRech1: .int szVarRech1
|
||||
iAdrszVarRech2: .int szVarRech2
|
||||
iAdrszmessresUser: .int szmessresUser
|
||||
iAdrszmessresPath: .int szmessresPath
|
||||
iAdrszmessresHome: .int szmessresHome
|
||||
/******************************************************************/
|
||||
/* search a substring at the string beguining */
|
||||
/******************************************************************/
|
||||
/* r0 contains the address of the input string */
|
||||
/* r1 contains the address of substring */
|
||||
/* r0 returns index of substring in string or -1 if not found */
|
||||
searchSubBeginString:
|
||||
push {r1-r5,lr} @ save registers
|
||||
mov r2,#0 @ counter byte input string
|
||||
mov r3,#0 @ counter byte string
|
||||
1:
|
||||
ldrb r4,[r1,r3]
|
||||
ldrb r5,[r0,r2] @ load byte string
|
||||
cmp r5,#0
|
||||
beq 3f
|
||||
cmp r4,#0 @ zero final ?
|
||||
moveq r0,#0 @ yes string find in position 0
|
||||
beq 100f
|
||||
cmp r5,r4 @ compare character
|
||||
beq 2f
|
||||
mov r0,#-1 @ no return no find
|
||||
b 100f
|
||||
2:
|
||||
add r2,r2,#1 @ and increment counter byte
|
||||
add r3,r3,#1 @ and increment
|
||||
b 1b @ and loop
|
||||
3: @
|
||||
cmp r4,#0
|
||||
movne r0,#-1 @ yes returns no find
|
||||
bne 100f
|
||||
mov r0,#0 @ string find in position 0
|
||||
100:
|
||||
pop {r1-r5,lr} @ restaur registers
|
||||
bx lr
|
||||
|
||||
/***************************************************/
|
||||
/* ROUTINES INCLUDE */
|
||||
/***************************************************/
|
||||
.include "../affichage.inc"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
##
|
||||
system.Environment.GetEnvironmentVariable('TEMP').Println;
|
||||
Loading…
Add table
Add a link
Reference in a new issue