Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,124 @@
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program repeatstring.s */
/*******************************************/
/* Constantes */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
.equ BUFFERSIZE, 2000
/*******************************************/
/* Macros */
/*******************************************/
//.include "../../ficmacros64.inc" // for developer debugging
/*********************************/
/* Initialized data */
/*********************************/
.data
szMessDebutPgm: .asciz "Program 64 bits start. \n"
szCarriageReturn: .asciz "\n"
szMessFinOK: .asciz "Program normal end. \n"
szMessErreur: .asciz "Error Buffer too small!!!\n"
szString1: .asciz "ho"
/*********************************/
/* UnInitialized data */
/*********************************/
.bss
.align 4
sZoneConv: .skip 24
sBuffer: .skip BUFFERSIZE
/*********************************/
/* code section */
/*********************************/
.text
.global main
main:
ldr x0,qAdrszMessDebutPgm
bl affichageMess // start message
ldr x0,qAdrszString1 // load phrase adress
ldr x1,qAdrsBuffer
mov x2,#5
bl repeatString
cmp x0,#0
ble 99f
ldr x0,qAdrsBuffer // buffer display
bl affichageMess
ldr x0,qAdrszCarriageReturn
bl affichageMess
ldr x0,qAdrszMessFinOK
bl affichageMess
b 100f
99:
ldr x0,qAdrszMessErreur // error
bl affichageMess
mov x0, #1 // return code error
b 100f
100:
mov x8,EXIT
svc #0 // system call
qAdrszMessDebutPgm: .quad szMessDebutPgm
qAdrszMessFinOK: .quad szMessFinOK
qAdrszMessErreur: .quad szMessErreur
qAdrszString1: .quad szString1
qAdrsBuffer: .quad sBuffer
qAdrsZoneConv: .quad sZoneConv
qAdrszCarriageReturn: .quad szCarriageReturn
/******************************************************************/
/* test if number is aritmetic number */
/******************************************************************/
/* x0 contains string address */
/* x1 contains buffer address */
/* x2 number repeat */
/* x0 return buffer writed length or -1 if error*/
repeatString:
stp x3,lr,[sp,-16]! // save registers
stp x4,x5,[sp,-16]! // save registers
stp x6,x7,[sp,-16]! // save registers
mov x3,#0 // indice repeat
mov x4,#0 // indice buffer
1:
mov x5,#0 // indice string
2:
ldrb w6,[x0,x5] // load string characters
cmp x6,#0 // end string ?
beq 3f
strb w6,[x1,x4] // store char in buffer
add x4,x4,#1 // increment indice
add x5,x5,#1
b 2b // and loop
3:
mul x6,x5,x2 // compute repeat length string
cmp x6,#BUFFERSIZE // compare to buffer length
bge 99f // error ?
add x3,x3,#1 // increment repeat counter
cmp x3,x2 // end ?
blt 1b
mov x6,#0
strb w6,[x1,x4] // final zero
mov x0,x4 // return length
b 100f
99:
mov x0,#-1 // error
100:
ldp x6,x7,[sp],16 // restaur r egisters
ldp x4,x5,[sp],16 // restaur registers
ldp x3,lr,[sp],16 // restaur registers
ret
/***************************************************/
/* ROUTINES INCLUDE */
/***************************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeARM64.inc"

View file

@ -0,0 +1,119 @@
/* ARM assembly Raspberry PI */
/* program repeatstring.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"
.equ BUFFERSIZE, 2000
/*******************************************/
/* Macros */
/*******************************************/
//.include "../../ficmacros32.inc" @ for developer debugging
/*********************************/
/* Initialized data */
/*********************************/
.data
szMessDebutPgm: .asciz "Program 32 bits start. \n"
szCarriageReturn: .asciz "\n"
szMessFinOK: .asciz "Program normal end. \n"
szMessErreur: .asciz "Error Buffer too small!!!\n"
szString1: .asciz "ha"
/*********************************/
/* UnInitialized data */
/*********************************/
.bss
.align 4
sZoneConv: .skip 24
sBuffer: .skip BUFFERSIZE
/*********************************/
/* code section */
/*********************************/
.text
.global main
main:
ldr r0,iAdrszMessDebutPgm
bl affichageMess @ start message
ldr r0,iAdrszString1 @ load phrase adress
ldr r1,iAdrsBuffer
mov r2,#5
bl repeatString
cmp r0,#0
ble 99f
ldr r0,iAdrsBuffer @ buffer display
bl affichageMess
ldr r0,iAdrszCarriageReturn
bl affichageMess
ldr r0,iAdrszMessFinOK
bl affichageMess
b 100f
99:
ldr r0,iAdrszMessErreur @ error
bl affichageMess
mov r0, #1 @ return code error
b 100f
100:
mov r7,#EXIT @ program end
svc #0 @ system call
iAdrszMessDebutPgm: .int szMessDebutPgm
iAdrszMessFinOK: .int szMessFinOK
iAdrszMessErreur: .int szMessErreur
iAdrszString1: .int szString1
iAdrsBuffer: .int sBuffer
iAdrsZoneConv: .int sZoneConv
iAdrszCarriageReturn: .int szCarriageReturn
/******************************************************************/
/* test if number is aritmetic number */
/******************************************************************/
/* r0 contains string address */
/* r1 contains buffer address */
/* r2 number repeat */
/* r0 return buffer writed length or -1 if error*/
repeatString:
push {r3-r6,lr} @ save registers
mov r3,#0 @ indice repeat
mov r4,#0 @ indice buffer
1:
mov r5,#0 @ indice string
2:
ldrb r6,[r0,r5] @ load string characters
cmp r6,#0 @ end string ?
beq 3f
strb r6,[r1,r4] @ store char in buffer
add r4,r4,#1 @ increment indice
add r5,r5,#1
b 2b @ and loop
3:
mul r6,r5,r2 @ compute repeat length string
cmp r6,#BUFFERSIZE @ compare to buffer length
movge r0,#-1 @ error ?
bge 100f
add r3,r3,#1 @ increment repeat counter
cmp r3,r2 @ end ?
blt 1b
mov r6,#0
strb r6,[r1,r4] @ final zero
mov r0,r4 @ return length
100:
pop {r3-r6,pc} @ restaur registers
/***************************************************/
/* ROUTINES INCLUDE */
/***************************************************/
.include "../affichage.inc"

View file

@ -0,0 +1,5 @@
# by Artyom Bologov
H
s/.*/&&&&&/
p
Q

View file

@ -0,0 +1 @@
(dup "back" 3 true)

View file

@ -0,0 +1 @@
'' | fill -c 'ha' -w 5

View file

@ -0,0 +1 @@
..<5 | each { 'ha' } | str join

View file

@ -0,0 +1,4 @@
process
repeat for integer i from 1 to 5
output "ha"
again

View file

@ -1,14 +1 @@
// Repeat a string, in V
// Tectonics: v run repeat-a-string.v
module main
import strings
// starts here
pub fn main() {
// A strings module function to repeat strings
println(strings.repeat_string("ha", 5))
// Another strings module function to repeat a byte
// This indexes the string to get the first byte of the rune array
println(strings.repeat("*"[0], 5))
}
println('ha'.repeat(5))