Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
---
from: http://rosettacode.org/wiki/Include_a_file

View file

@ -0,0 +1,11 @@
;Task:
Demonstrate the language's ability to include source code from other files.
<br><br>
;See Also
* [[Compiler/Simple file inclusion pre processor]]
<br>
<br>

View file

@ -0,0 +1 @@
COPY member

View file

@ -0,0 +1,4 @@
;main.asm
org $8000
include "foo.txt"
;eof

View file

@ -0,0 +1,4 @@
;main.asm
org $8000
incbin "foo.txt"
;eof

View file

@ -0,0 +1,10 @@
;main.asm
include "Subroutines.asm"
;eof
;Subroutines.asm
include "math.asm"
;eof
;math.asm
;eof

View file

@ -0,0 +1,4 @@
;main.asm
include "Subroutines.asm"
include "math.asm"
;eof

View file

@ -0,0 +1,4 @@
org $00000000
;512 bytes containing anything really
include "myFile.asm" ;assuming no org or align directives are in this file,
;its starting memory location is guaranteed to be $00000200 (512 in decimal)

View file

@ -0,0 +1,6 @@
foo:
LEA myData,A0
MOVE.W (A0)+,D0
MyData:
include "dataTables.inc" ;a list of defined data constants that aren't supposed to be executed as instructions

View file

@ -0,0 +1,7 @@
foo:
LEA myData,A0
MOVE.W (A0)+,D0
RTS ;return from subroutine, preventing the CPU from executing the data below.
MyData:
include "dataTables.inc" ;a list of defined data constants that aren't supposed to be executed as instructions

View file

@ -0,0 +1,426 @@
'file constant include : includeConstantesARM64.inc'
/*******************************************/
/* Constantes */
/*******************************************/
.equ STDIN, 0 // Linux input console
.equ STDOUT, 1 // linux output console
.equ OPEN, 56 // call system Linux 64 bits
.equ CLOSE, 57 // call system Linux 64 bits
.equ READ, 63 // call system Linux 64 bits
.equ WRITE, 64 // call system Linux 64 bits
.equ EXIT, 93 // call system Linux 64 bits
.equ HEAPSIZE, 100000
.equ CHARPOS, '@' // position character
/* file */
.equ O_RDONLY, 0
.equ O_WRONLY, 0x0001
.equ O_RDWR, 0x0002 // open for reading and writing
.equ O_CREAT, 0x040 // create if nonexistant
.equ O_TRUNC, 0x0400 // truncate to zero length
.equ O_EXCL, 0x0800 // error if already exists
.equ AT_FDCWD, -100
'file fonctions include : includeARM64.inc'
/* File include fonctions */
.data
ptzZoneHeap: .quad zZoneHeap
.bss
.align 8
zZoneHeap: .skip HEAPSIZE
zEndZoneHeap:
.text
/******************************************************************/
/* String display with size compute */
/******************************************************************/
/* x0 contains string address (string ended with zero binary) */
affichageMess:
stp x0,x1,[sp,-16]! // save registers
stp x2,x8,[sp,-16]! // save registers
mov x2,0 // size counter
1: // loop start
ldrb w1,[x0,x2] // load a byte
cbz w1,2f // if zero -> end string
add x2,x2,#1 // else increment counter
b 1b // and loop
2: // x2 = string size
mov x1,x0 // string address
mov x0,STDOUT // output Linux standard
mov x8,WRITE // code call system "write"
svc 0 // call systeme Linux
ldp x2,x8,[sp],16 // restaur 2 registres
ldp x0,x1,[sp],16 // restaur 2 registres
ret // retour adresse lr x30
/******************************************************************/
/* Decimal conversion unsigned */
/******************************************************************/
/* x0 contains the value */
/* x1 contains the address of receiving area length >= 21 */
/* the receiving area return a string ascii left aligned */
/* and with final zero */
/* x0 return length string whitout zero final */
.equ LGZONECONV, 20
conversion10:
stp x5,lr,[sp,-16]! // save registers
stp x3,x4,[sp,-16]! // save registers
stp x1,x2,[sp,-16]! // save registers
mov x4,#LGZONECONV // position last digit
mov x5,#10 // decimal conversion
1: // loop begin
mov x2,x0 // copy starting number or successive quotients
udiv x0,x2,x5 // division by ten
msub x3,x0,x5,x2 //compute remainder
add x3,x3,#48 // digit
sub x4,x4,#1 // previous position
strb w3,[x1,x4] // store digit ascii
cbnz x0,1b // end if quotient = zero
mov x2,LGZONECONV // compute string length (20 - dernière position)
sub x0,x2,x4 // no instruction rsb in 64 bits !!!
// move result to area begin
cbz x4,3f // full area ?
mov x2,0 // start position
2:
ldrb w3,[x1,x4] // load digit
strb w3,[x1,x2] // store digit
add x4,x4,#1 // next position origin
add x2,x2,#1 // and next position destination
cmp x4,LGZONECONV - 1 // end ?
ble 2b // else loop
3:
mov w3,0
strb w3,[x1,x2] // zero final
100:
ldp x1,x2,[sp],16 // restaur des 2 registres
ldp x3,x4,[sp],16 // restaur des 2 registres
ldp x5,lr,[sp],16 // restaur des 2 registres
ret // retour adresse lr x30
/******************************************************************/
/* Decimal conversion signed */
/******************************************************************/
/* x0 contains the value */
/* x1 contains the address of receiving area length >= 21 */
/* the receiving area return a string ascii left aligned */
/* et avec un zero final */
/* x0 return length string whitout zero final */
.equ LGZONECONVS, 21
conversion10S:
stp x5,lr,[sp,-16]! // save registers
stp x3,x4,[sp,-16]! // save registers
stp x1,x2,[sp,-16]! // save registers
cmp x0,0 // is negative ?
bge 11f // no
mov x3,'-' // yes
neg x0,x0 // number inversion
b 12f
11:
mov x3,'+' // positive number
12:
strb w3,[x1]
mov x4,#LGZONECONVS // position last digit
mov x5,#10 // decimal conversion
1: // loop conversion start
mov x2,x0 // copy starting number or successive quotients
udiv x0,x2,x5 // division by ten
msub x3,x0,x5,x2 //compute remainder
add x3,x3,#48 // conversion ascii
sub x4,x4,#1 // previous position
strb w3,[x1,x4] // store digit
cbnz x0,1b // end if quotient = zero
mov x2,LGZONECONVS // compute string length (21 - dernière position)
sub x0,x2,x4 // no instruction rsb in 64 bits !!!
// move result to area begin
cmp x4,1
beq 3f // full area ?
mov x2,1 // no -> begin area
2:
ldrb w3,[x1,x4] // load a digit
strb w3,[x1,x2] // and store at begin area
add x4,x4,#1 // last position
add x2,x2,#1 // et begin last postion
cmp x4,LGZONECONVS - 1 // end ?
ble 2b // no -> loop
3:
mov w3,0
strb w3,[x1,x2] // zero final
add x0,x0,1 // string length must take into account the sign
100:
ldp x1,x2,[sp],16 // restaur 2 registers
ldp x3,x4,[sp],16 // restaur 2 registers
ldp x5,lr,[sp],16 // restaur 2 registers
ret // return address lr x30
/******************************************************************/
/* conversion hexadecimal register */
/******************************************************************/
/* x0 contains value and x1 address zone receptrice */
conversion16:
stp x0,lr,[sp,-48]! // save registres
stp x1,x2,[sp,32] // save registres
stp x3,x4,[sp,16] // save registres
mov x2,#60 // start bit position
mov x4,#0xF000000000000000 // mask
mov x3,x0 // save entry value
1: // start loop
and x0,x3,x4 // value register and mask
lsr x0,x0,x2 // right shift
cmp x0,#10 // >= 10 ?
bge 2f // yes
add x0,x0,#48 // no is digit
b 3f
2:
add x0,x0,#55 // else is a letter A-F
3:
strb w0,[x1],#1 // load result and + 1 in address
lsr x4,x4,#4 // shift mask 4 bits left
subs x2,x2,#4 // decrement counter 4 bits <= zero ?
bge 1b // no -> loop
100: // fin standard de la fonction
ldp x3,x4,[sp,16] // restaur des 2 registres
ldp x1,x2,[sp,32] // restaur des 2 registres
ldp x0,lr,[sp],48 // restaur des 2 registres
ret
/******************************************************************/
/* conversion ascii string to number */
/******************************************************************/
/* x0 contains string address ended by 0x0 or 0xA */
/* x0 return the number */
conversionAtoD:
stp x5,lr,[sp,-16]! // save registers
stp x3,x4,[sp,-16]! // save registers
stp x1,x2,[sp,-16]! // save registers
mov x1,#0
mov x2,#10 // factor ten
mov x4,x0 // save address in x4
mov x3,#0 // positive signe by default
mov x0,#0 // init résult to zéro
mov x5,#0
1: // loop to remove space at begin of string
ldrb w5,[x4],1 // load in w5 string octet
cbz w5,100f // string end -> end routine
cmp w5,#0x0A // string end -> end routine
beq 100f
cmp w5,#' ' // space ?
beq 1b // yes -> loop
2:
cmp x5,#'-' // first character is -
bne 3f
mov x3,#1 // negative number
b 4f // previous position
3: // begin loop compute digit
cmp x5,#'0' // character not a digit
blt 4f
cmp x5,#'9' // character not a digit
bgt 4f
// character is a digit
sub w5,w5,#48
mul x0,x2,x0 // multiply last result by factor
smulh x1,x2,x0 // hight
cbnz x1,99f // overflow ?
add x0,x0,x5 // no -> add to result
4:
ldrb w5,[x4],1 // load new octet and increment to one
cbz w5,5f // string end -> end routine
cmp w5,#0xA // string end ?
bne 3b // no -> loop
5:
cmp x3,#1 // test register x3 for signe
cneg x0,x0,eq // if equal egal negate value
cmn x0,0 // carry to zero no error
b 100f
99: // overflow
adr x0,szMessErrDep
bl affichageMess
cmp x0,0 // carry to one error
mov x0,#0 // if error return zéro
100:
ldp x1,x2,[sp],16 // restaur 2 registers
ldp x3,x4,[sp],16 // restaur 2 registers
ldp x5,lr,[sp],16 // restaur 2 registers
ret // retur address lr x30
szMessErrDep: .asciz "Number too large: overflow of 64 bits. :\n"
.align 4 // instruction to realign the following routines
/***************************************************/
/* reserve heap area */
/***************************************************/
// x0 contains size in byte to reserve */
// x0 returne begin address of area */
reserverPlace: // INFO: reserverPlace
stp x1,lr,[sp,-16]! // save registers
stp x2,x3,[sp,-16]! // save registers
mov x1,x0
tst x1,#0b111 // size multiple of 8 ?
beq 1f // yes
and x1,x1,0xFFFFFFFFFFFFFFF8 // else align to 8 superior
add x1,x1,8
1:
ldr x2,qAdrptzZoneHeap
ldr x0,[x2]
add x1,x1,x0 // size too large ?
ldr x3,qAdrzEndZoneHeap
cmp x1,x3
blt 2f // no it is ok
adr x0,szMessErrTas // yes -> error
bl affichageMess
mov x0,#-1
b 100f
2:
str x1,[x2] // store new pointer
100: // fin standard de la fonction
ldp x2,x3,[sp],16 // restaur 2 registers
ldp x1,lr,[sp],16 // restaur 2 registers
ret // retur address lr x30
qAdrptzZoneHeap: .quad ptzZoneHeap
qAdrzEndZoneHeap: .quad zEndZoneHeap
szMessErrTas: .asciz "Error : heap not large !!!\n"
.align 4
/***************************************************/
/* liberer place sur le tas */
/***************************************************/
// r0 contains begin address area
libererPlace: // INFO: libererPlace
stp x1,lr,[sp,-16]! // save registers
ldr x1,qAdrzZoneHeap
cmp x0,x1
blt 99f
ldr x1,qAdrzEndZoneHeap
cmp x0,x1
bge 99f
ldr x1,qAdrptzZoneHeap
str x0,[x1]
b 100f
99:
adr x0,szMessErrTas1
bl affichageMess
mov x0,-1
100:
ldp x1,lr,[sp],16 // restaur 2 registers
ret // retur address lr x30
qAdrzZoneHeap: .quad zZoneHeap
szMessErrTas1: .asciz "Error : address < or > heap addresses !!!\n"
.align 4
/******************************************************************/
/* insert string at character insertion */
/******************************************************************/
/* x0 contains the address of string 1 */
/* x1 contains the address of insertion string */
/* x0 return the address of new string on the heap */
/* or -1 if error */
strInsertAtCharInc:
stp x2,lr,[sp,-16]! // save registers
stp x3,x4,[sp,-16]! // save registers
stp x5,x6,[sp,-16]! // save registers
stp x7,x8,[sp,-16]! // save registers
mov x3,#0 // length counter
1: // compute length of string 1
ldrb w4,[x0,x3]
cmp w4,#0
cinc x3,x3,ne // increment to one if not equal
bne 1b // loop if not equal
mov x5,#0 // length counter insertion string
2: // compute length to insertion string
ldrb w4,[x1,x5]
cmp x4,#0
cinc x5,x5,ne // increment to one if not equal
bne 2b // and loop
cmp x5,#0
beq 99f // string empty -> error
add x3,x3,x5 // add 2 length
add x3,x3,#1 // +1 for final zero
mov x6,x0 // save address string 1
mov x0,x3
bl reserverPlace
cmp x0,#-1 // allocation error
beq 99f
mov x5,x0 // save address heap for output string
mov x2,0
mov x4,0
3: // loop copy string begin
ldrb w3,[x6,x2]
cmp w3,0
beq 99f
cmp w3,CHARPOS // insertion character ?
beq 5f // yes
strb w3,[x5,x4] // no store character in output string
add x2,x2,1
add x4,x4,1
b 3b // and loop
5: // x4 contains position insertion
add x8,x4,1 // init index character output string
// at position insertion + one
mov x3,#0 // index load characters insertion string
6:
ldrb w0,[x1,x3] // load characters insertion string
cmp w0,#0 // end string ?
beq 7f // yes
strb w0,[x5,x4] // store in output string
add x3,x3,#1 // increment index
add x4,x4,#1 // increment output index
b 6b // and loop
7: // loop copy end string
ldrb w0,[x6,x8] // load other character string 1
strb w0,[x5,x4] // store in output string
cmp x0,#0 // end string 1 ?
beq 8f // yes -> end
add x4,x4,#1 // increment output index
add x8,x8,#1 // increment index
b 7b // and loop
8:
mov x0,x5 // return output string address
b 100f
99: // error
mov x0,#-1
100:
ldp x7,x8,[sp],16 // restaur 2 registers
ldp x5,x6,[sp],16 // restaur 2 registers
ldp x3,x4,[sp],16 // restaur 2 registers
ldp x2,lr,[sp],16 // restaur 2 registers
ret
'Main program '
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program include.s */
/*******************************************/
/* Constantes file */
/*******************************************/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data */
/*******************************************/
.data
szMessResult: .asciz "Number = "
szRetourLigne: .asciz "\n"
/*******************************************/
/* Uninitialized data */
/*******************************************/
.bss
sZoneConv: .skip 100
.text
.global main
main:
mov x0,1000 // number
ldr x1,qAdrsZoneConv
bl conversion10S // result decimal conversion
ldr x0,qAdrszMessResult
bl affichageMess // call function display
ldr x0,qAdrsZoneConv
bl affichageMess // call function display
ldr x0, qAdrszRetourLigne
bl affichageMess
mov x0,0 // return code OK
100: // standard end programm
mov x8,EXIT // request to exit program
svc 0 // perform the system call
qAdrszMessResult: .quad szMessResult
qAdrsZoneConv: .quad sZoneConv
qAdrszRetourLigne: .quad szRetourLigne
/********************************************************/
/* File Include fonctions */
/********************************************************/
.include "../includeARM64.inc"

View file

@ -0,0 +1 @@
(include-book "filename")

View file

@ -0,0 +1 @@
(ld "filename.lisp")

View file

@ -0,0 +1 @@
load["script.ant"]

View file

@ -0,0 +1,438 @@
'file constantes.inc'
/************************************/
/* Constantes */
/************************************/
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall end program
.equ WRITE, 4 @ Linux syscall write
.equ BRK, 0x2d @ Linux syscall heap
.equ MKDIR, 0x27 @ Linux Syscal create directory
.equ CHGDIR, 0xC @ Linux Syscal change directory
.equ CREATE, 0x8 @ Linux Syscal create file
.equ CLOSE, 0x6 @ Linux Syscal close file
.equ HEAPSIZE, 100000
.equ CHARPOS, '@' @ character insertion
'file source include '
/* file affichage.inc */
.data
/*************************************************/
szMessErr: .ascii "Error code hexa : "
sHexa: .space 9,' '
.ascii " decimal : "
sDeci: .space 15,' '
.asciz "\n"
ptzZoneHeap: .int zZoneHeap
/*************************************************/
.bss
.align 4
zZoneHeap: .skip HEAPSIZE
zEndZoneHeap:
.text
/******************************************************************/
/* display text with size calculation */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
push {r0,r1,r2,r7,lr} @ save registres
mov r2,#0 @ counter length
1: @ loop length calculation
ldrb r1,[r0,r2] @ read octet start position + index
cmp r1,#0 @ if 0 its over
addne r2,r2,#1 @ else add 1 in the length
bne 1b @ and loop
@ so here r2 contains the length of the message
mov r1,r0 @ address message in r1
mov r0,#STDOUT @ code to write to the standard output Linux
mov r7, #WRITE @ code call system "write"
svc #0 @ call systeme
pop {r0,r1,r2,r7,lr} @ restaur des 2 registres */
bx lr @ return
/******************************************************************/
/* Converting a register to a decimal unsigned */
/******************************************************************/
/* r0 contains value and r1 address area */
/* r0 return size of result (no zero final in area) */
/* area size => 11 bytes */
.equ LGZONECAL, 10
conversion10:
push {r1-r4,lr} @ save registers
mov r3,r1
mov r2,#LGZONECAL
1: @ start loop
bl divisionpar10U @ unsigned r0 <- dividende. quotient ->r0 reste -> r1
add r1,#48 @ digit
strb r1,[r3,r2] @ store digit on area
cmp r0,#0 @ stop if quotient = 0
subne r2,#1 @ else previous position
bne 1b @ and loop
@ and move digit from left of area
mov r4,#0
2:
ldrb r1,[r3,r2]
strb r1,[r3,r4]
add r2,#1
add r4,#1
cmp r2,#LGZONECAL
ble 2b
@ and move spaces in end on area
mov r0,r4 @ result length
mov r1,#' ' @ space
3:
strb r1,[r3,r4] @ store space in area
add r4,#1 @ next position
cmp r4,#LGZONECAL
ble 3b @ loop if r4 <= area size
100:
pop {r1-r4,lr} @ restaur registres
bx lr
/***************************************************/
/* Converting a register to a signed decimal */
/***************************************************/
/* r0 contains value and r1 area address */
conversion10S:
push {r0-r4,lr} @ save registers
mov r2,r1 @ debut zone stockage
mov r3,#'+' @ par defaut le signe est +
cmp r0,#0 @ negative number ?
movlt r3,#'-' @ yes
mvnlt r0,r0 @ number inversion
addlt r0,#1
mov r4,#10 @ length area
1: @ start loop
bl divisionpar10U
add r1,#48 @ digit
strb r1,[r2,r4] @ store digit on area
sub r4,r4,#1 @ previous position
cmp r0,#0 @ stop if quotient = 0
bne 1b
strb r3,[r2,r4] @ store signe
subs r4,r4,#1 @ previous position
blt 100f @ if r4 < 0 -> end
mov r1,#' ' @ space
2:
strb r1,[r2,r4] @store byte space
subs r4,r4,#1 @ previous position
bge 2b @ loop if r4 > 0
100:
pop {r0-r4,lr} @ restaur registers
bx lr
/***************************************************/
/* division par 10 unsigned */
/***************************************************/
/* r0 dividende */
/* r0 quotient */
/* r1 remainder */
divisionpar10U:
push {r2,r3,r4, lr}
mov r4,r0 @ save value
//mov r3,#0xCCCD @ r3 <- magic_number lower raspberry 3
//movt r3,#0xCCCC @ r3 <- magic_number higter raspberry 3
ldr r3,iMagicNumber @ r3 <- magic_number raspberry 1 2
umull r1, r2, r3, r0 @ r1<- Lower32Bits(r1*r0) r2<- Upper32Bits(r1*r0)
mov r0, r2, LSR #3 @ r2 <- r2 >> shift 3
add r2,r0,r0, lsl #2 @ r2 <- r0 * 5
sub r1,r4,r2, lsl #1 @ r1 <- r4 - (r2 * 2) = r4 - (r0 * 10)
pop {r2,r3,r4,lr}
bx lr @ leave function
iMagicNumber: .int 0xCCCCCCCD
/***************************************************/
/* display error message */
/***************************************************/
/* r0 contains error code r1 : message address */
displayError:
push {r0-r2,lr} @ save registers
mov r2,r0 @ save error code
mov r0,r1
bl affichageMess
mov r0,r2 @ error code
ldr r1,iAdrsHexa
bl conversion16 @ conversion hexa
mov r0,r2 @ error code
ldr r1,iAdrsDeci @ result address
bl conversion10S @ conversion decimale
ldr r0,iAdrszMessErr @ display error message
bl affichageMess
100:
pop {r0-r2,lr} @ restaur registers
bx lr @ return
iAdrszMessErr: .int szMessErr
iAdrsHexa: .int sHexa
iAdrsDeci: .int sDeci
/******************************************************************/
/* Convert a string to a number stored in a registry */
/******************************************************************/
/* r0 contains the address of the area terminated by 0 or 0A */
/* r0 returns a number */
conversionAtoD:
push {fp,lr} @ save 2 registers
push {r1-r7} @ save others registers
mov r1,#0
mov r2,#10 @ factor
mov r3,#0 @ counter
mov r4,r0 @ save address string -> r4
mov r6,#0 @ positive sign by default
mov r0,#0 @ initialization to 0
1: /* early space elimination loop */
ldrb r5,[r4,r3] @ loading in r5 of the byte located at the beginning + the position
cmp r5,#0 @ end of string -> end routine
beq 100f
cmp r5,#0x0A @ end of string -> end routine
beq 100f
cmp r5,#' ' @ space ?
addeq r3,r3,#1 @ yes we loop by moving one byte
beq 1b
cmp r5,#'-' @ first character is -
moveq r6,#1 @ 1 -> r6
beq 3f @ then move on to the next position
2: /* beginning of digit processing loop */
cmp r5,#'0' @ character is not a number
blt 3f
cmp r5,#'9' @ character is not a number
bgt 3f
/* character is a number */
sub r5,#48
ldr r1,iMaxi @ check the overflow of the register
cmp r0,r1
bgt 99f @ overflow error
mul r0,r2,r0 @ multiply par factor 10
add r0,r5 @ add to r0
3:
add r3,r3,#1 @ advance to the next position
ldrb r5,[r4,r3] @ load byte
cmp r5,#0 @ end of string -> end routine
beq 4f
cmp r5,#0x0A @ end of string -> end routine
beq 4f
b 2b @ loop
4:
cmp r6,#1 @ test r6 for sign
moveq r1,#-1
muleq r0,r1,r0 @ if negatif, multiply par -1
b 100f
99: /* overflow error */
ldr r0,=szMessErrDep
bl affichageMess
mov r0,#0 @ return zero if error
100:
pop {r1-r7} @ restaur other registers
pop {fp,lr} @ restaur 2 registers
bx lr @return procedure
/* constante program */
iMaxi: .int 1073741824
szMessErrDep: .asciz "Too large: overflow 32 bits.\n"
.align 4
/******************************************************************/
/* Converting a register to hexadecimal */
/******************************************************************/
/* r0 contains value and r1 address area */
conversion16:
push {r1-r4,lr} @ save registers
mov r2,#28 @ start bit position
mov r4,#0xF0000000 @ mask
mov r3,r0 @ save entry value
1: @ start loop
and r0,r3,r4 @value register and mask
lsr r0,r2 @ move right
cmp r0,#10 @ compare value
addlt r0,#48 @ <10 ->digit
addge r0,#55 @ >10 ->letter A-F
strb r0,[r1],#1 @ store digit on area and + 1 in area address
lsr r4,#4 @ shift mask 4 positions
subs r2,#4 @ counter bits - 4 <= zero ?
bge 1b @ no -> loop
100:
pop {r1-r4,lr} @ restaur registers
bx lr @return
/***************************************************/
/* integer division unsigned */
/***************************************************/
division:
/* r0 contains dividend */
/* r1 contains divisor */
/* r2 returns quotient */
/* r3 returns remainder */
push {r4, lr}
mov r2, #0 @ init quotient
mov r3, #0 @ init remainder
mov r4, #32 @ init counter bits
b 2f
1: @ loop
movs r0, r0, LSL #1 @ r0 <- r0 << 1 updating cpsr (sets C if 31st bit of r0 was 1)
adc r3, r3, r3 @ r3 <- r3 + r3 + C. This is equivalent to r3 ? (r3 << 1) + C
cmp r3, r1 @ compute r3 - r1 and update cpsr
subhs r3, r3, r1 @ if r3 >= r1 (C=1) then r3 <- r3 - r1
adc r2, r2, r2 @ r2 <- r2 + r2 + C. This is equivalent to r2 <- (r2 << 1) + C
2:
subs r4, r4, #1 @ r4 <- r4 - 1
bpl 1b @ if r4 >= 0 (N=0) then loop
pop {r4, lr}
bx lr
/***************************************************/
/* reserve heap area */
/***************************************************/
// r0 contains size in byte to reserve */
// r0 returne begin address of area */
reserverPlace: @ INFO: reserverPlace
push {r1,r2,r3,lr} @ save des registres
mov r1,r0
tst r1,#0b11 @ size multiple of 4 ?
beq 1f @ yes
and r1,#0xFFFFFFFC @ else align to 4 superior
add r1,#4
1:
ldr r2,iAdrptzZoneHeap
ldr r0,[r2]
add r1,r1,r0 @ size too large ?
ldr r3,iAdrzEndZoneHeap
cmp r1,r3
blt 2f @ no it is ok
adr r0,szMessErrTas @ yes -> error
bl affichageMess
mov r0,#-1
b 100f
2:
str r1,[r2] @ store new pointer
100: @ fin standard de la fonction
pop {r1,r2,r3,lr} @ restaur des registres
bx lr @ retour de la fonction en utilisant lr
iAdrptzZoneHeap: .int ptzZoneHeap
iAdrzEndZoneHeap: .int zEndZoneHeap
szMessErrTas: .asciz "Error : heap not large !!!\n"
.align 4
/***************************************************/
/* liberer place sur le tas */
/***************************************************/
// r0 contains begin address area
libererPlace: @ INFO: libererPlace
push {r1,lr} @ save des registres
ldr r1,iAdrzZoneHeap
cmp r0,r1
blt 99f
ldr r1,iAdrzEndZoneHeap
cmp r0,r1
bge 99f
ldr r1,iAdrptzZoneHeap
str r0,[r1]
b 100f
99:
adr r0,szMessErrTas1
bl affichageMess
mov r0,#-1
100:
pop {r1,lr} @ restaur registers
bx lr
iAdrzZoneHeap: .int zZoneHeap
szMessErrTas1: .asciz "Error : address < or > heap addresses !!!\n"
.align 4
/******************************************************************/
/* insert string at character insertion */
/******************************************************************/
/* r0 contains the address of string 1 */
/* r1 contains the address of insertion string */
/* r0 return the address of new string on the heap */
/* or -1 if error */
strInsertAtCharInc:
push {r1-r7,lr} @ save registres
mov r3,#0 // length counter
1: // compute length of string 1
ldrb r4,[r0,r3]
cmp r4,#0
addne r3,r3,#1 // increment to one if not equal
bne 1b // loop if not equal
mov r5,#0 // length counter insertion string
2: // compute length to insertion string
ldrb r4,[r1,r5]
cmp r4,#0
addne r5,r5,#1 // increment to one if not equal
bne 2b // and loop
cmp r5,#0
beq 99f // string empty -> error
add r3,r3,r5 // add 2 length
add r3,r3,#1 // +1 for final zero
mov r6,r0 // save address string 1
mov r0,r3
bl reserverPlace
mov r5,r0 // save address heap for output string
cmp r0,#-1 // allocation error
beq 99f
mov r2,#0
mov r4,#0
3: // loop copy string begin
ldrb r3,[r6,r2]
cmp r3,#0
beq 99f
cmp r3,#CHARPOS // insertion character ?
beq 5f // yes
strb r3,[r5,r4] // no store character in output string
add r2,r2,#1
add r4,r4,#1
b 3b // and loop
5: // r4 contains position insertion
add r7,r4,#1 // init index character output string
// at position insertion + one
mov r3,#0 // index load characters insertion string
6:
ldrb r0,[r1,r3] // load characters insertion string
cmp r0,#0 // end string ?
beq 7f // yes
strb r0,[r5,r4] // store in output string
add r3,r3,#1 // increment index
add r4,r4,#1 // increment output index
b 6b // and loop
7: // loop copy end string
ldrb r0,[r6,r7] // load other character string 1
strb r0,[r5,r4] // store in output string
cmp r0,#0 // end string 1 ?
beq 8f // yes -> end
add r4,r4,#1 // increment output index
add r7,r7,#1 // increment index
b 7b // and loop
8:
mov r0,r5 // return output string address
b 100f
99: // error
mov r0,#-1
100:
pop {r1-r7,lr} @ restaur registers
bx lr @ return
'File Main program'
/* ARM assembly Raspberry PI */
/* program include.s */
/* Constantes */
.include "./constantes.inc"
/* Initialized data */
.data
szMessageOK: .asciz "Hello \n"
/* code section */
.text
.global main
main: @ entry of program
push {fp,lr} @ saves registers
ldr r0,iAdrszMessageOK
bl affichageMess
100: @ standard end of the program
mov r0, #0 @ return code
pop {fp,lr} @restaur registers
mov r7, #EXIT @ request to exit program
swi 0 @ perform the system call
iAdrszMessageOK: .int szMessageOK
/*********************************/
/* include source display */
/*********************************/
.include "./affichage.inc"

View file

@ -0,0 +1 @@
awk -f one.awk -f two.awk

View file

@ -0,0 +1,9 @@
# one.awk
BEGIN {
sayhello()
}
# two.awk
function sayhello() {
print "Hello world"
}

View file

@ -0,0 +1 @@
@include "filename.awk"

View file

@ -0,0 +1,4 @@
INCLUDE "D2:REAL.ACT" ;from the Action! Tool Kit
PROC Main()
RETURN

View file

@ -0,0 +1,7 @@
with Ada.Text_IO, Another_Package; use Ada.Text_IO;
-- the with-clause tells the compiler to include the Text_IO package from the Ada standard
-- and Another_Package. Subprograms from these packages may be called as follows:
-- Ada.Text_IO.Put_Line("some text");
-- Another_Package.Do_Something("some text");
-- The use-clause allows the program author to write a subprogram call shortly as
-- Put_Line("some text");

View file

@ -0,0 +1,5 @@
10 REMPROGRAM TWO
20 DEF FN A(X) = X * Y
30 PRINT FN A(2)
SAVE PROGRAM TWO

View file

@ -0,0 +1,10 @@
10 REMPROGRAM ONE
20 Y = 6
30 DEF FN A(X) = X * Y
40 PRINT FN A(2)
50 D$ = CHR$ (4)
60 PRINT D$"BLOADCHAIN,A520"
70 CALL 520"PROGRAM TWO"
SAVE PROGRAM ONE
RUN

View file

@ -0,0 +1,6 @@
; import a file
do.import {file.art}
; import another file
; from relative folder location
do.import relative "another_file.art"

View file

@ -0,0 +1,2 @@
#Include FileOrDirName
#IncludeAgain FileOrDirName

View file

@ -0,0 +1 @@
prgmOTHER

View file

@ -0,0 +1,2 @@
REM $INCLUDE: 'file.bi'
'$INCLUDE: 'file.bi'

View file

@ -0,0 +1 @@
CALL filepath$

View file

@ -0,0 +1 @@
other = 42

View file

@ -0,0 +1,3 @@
' Include a file
INCLUDE "other.bac"
PRINT other

View file

@ -0,0 +1 @@
call file2.bat

View file

@ -0,0 +1 @@
get$"<i>module</i>"

View file

@ -0,0 +1 @@
source myfile.csh

View file

@ -0,0 +1,4 @@
/* The C# language specification does not give a mechanism for 'including' one source file within another,
* likely because there is no need - all code compiled within one 'assembly' (individual IDE projects
* are usually compiled to separate assemblies) can 'see' all other code within that assembly.
*/

View file

@ -0,0 +1,5 @@
/* Standard and other library header names are enclosed between chevrons */
#include <stdlib.h>
/* User/in-project header names are usually enclosed between double-quotes */
#include "myutil.h"

View file

@ -0,0 +1,2 @@
/* In C++20,you can use the import statement */
import <iostream>;

View file

@ -0,0 +1,4 @@
COPY "copy.cpy". *> The full stop is mandatory, wherever the COPY is.
COPY "another-copy.cpy" REPLACING foo BY bar
SPACE BY ZERO
==text to replace== BY ==replacement text==.

View file

@ -0,0 +1 @@
Machine.add(me.dir() + "/MyOwnClassesDefinitions.ck");

View file

@ -0,0 +1 @@
#include "inkey.ch"

View file

@ -0,0 +1 @@
(load "path/to/file")

View file

@ -0,0 +1 @@
(load "path/to/file")

View file

@ -0,0 +1,2 @@
require "socket" # includes a file from standard library or /lib relative to current directory
require "./myfile" # includes a file relative to current directory

View file

@ -0,0 +1 @@
import std.stdio;

View file

@ -0,0 +1 @@
mixin(import("code.txt"));

View file

@ -0,0 +1 @@
static immutable array = import("data.txt");

View file

@ -0,0 +1,5 @@
{$INCLUDE Common} // Inserts the contents of Common.pas into the current unit
{$I Common} // Same as the previous line, but in a shorter form
{$INCLUDE_ONCE Common} // Inserts the contents of Common.pas into the current unit only if not included already
{$FILTER Common} // Inserts the contents of Common.pas into the current unit after filtering
{$F Common} // Same as the previous line, but in a shorter form

View file

@ -0,0 +1,4 @@
uses SysUtils; // Lets you use the contents of SysUtils.pas from the current unit
{$Include Common} // Inserts the contents of Common.pas into the current unit
{$I Common} // Same as the previous line, but in a shorter form

View file

@ -0,0 +1,4 @@
func my(){
showln "hello"
//this is program.dgn
}

View file

@ -0,0 +1,2 @@
include "program.dgn"
my() // output : hello

View file

@ -0,0 +1,2 @@
(defun sum (ls)
(apply '+ ls) )

View file

@ -0,0 +1,3 @@
(add-to-list 'load-path "./")
(load "./file1.el")
(insert (format "%d" (sum (number-sequence 1 100) )))

View file

@ -0,0 +1 @@
-include("my_header.hrl"). % Includes the file at my_header.erl

View file

@ -0,0 +1 @@
include my_header.e

View file

@ -0,0 +1 @@
USING: vocaba vocabb... ;

View file

@ -0,0 +1 @@
include matrix.fs

View file

@ -0,0 +1 @@
include ''char-literal-constant''

View file

@ -0,0 +1,10 @@
' person.bi file
Type Person
name As String
age As UInteger
Declare Operator Cast() As String
End Type
Operator Person.Cast() As String
Return "[" + This.name + ", " + Str(This.age) + "]"
End Operator

View file

@ -0,0 +1,12 @@
' FB 1.05.0 Win 64
' main.bas file
#include "person.bi"
Dim person1 As Person
person1.name = "Methuselah"
person1.age = 969
Print person1
Print
Print "Press any key to quit"
Sleep

View file

@ -0,0 +1,5 @@
include resources "SomeImage.png"
include resources "SomeMovie.mpeg"
include resources "SomeSound.aiff"
include resources "SomeIcon.icns"
include resources "Info.plist" //Custom preference file to replace FB's generic app preferences

View file

@ -0,0 +1 @@
Read("file");

View file

@ -0,0 +1,6 @@
Public Sub Form_Open()
Dim sFile As String
sFile = File.Load("FileToLoad")
End

View file

@ -0,0 +1 @@
load "filename.gnuplot"

View file

@ -0,0 +1 @@
load "-" # read standard input

View file

@ -0,0 +1,2 @@
load "< myprogram" # run myprogram, read its output
load "< echo print 123"

View file

@ -0,0 +1 @@
call "filename.gnuplot" 123 456 "arg3"

View file

@ -0,0 +1,13 @@
// main.go
package main
import "fmt"
func hello() {
fmt.Println("Hello from main.go")
}
func main() {
hello()
hello2()
}

View file

@ -0,0 +1,8 @@
// main2.go
package main
import "fmt"
func hello2() {
fmt.Println("Hello from main2.go")
}

View file

@ -0,0 +1 @@
#include "inkey.ch"

View file

@ -0,0 +1,7 @@
-- Due to Haskell's module system, textual includes are rarely needed. In
-- general, one will import a module, like so:
import SomeModule
-- For actual textual inclusion, alternate methods are available. The Glasgow
-- Haskell Compiler runs the C preprocessor on source code, so #include may be
-- used:
#include "SomeModule.hs"

View file

@ -0,0 +1 @@
$INCLUDE "ishelllink.inc"

View file

@ -0,0 +1 @@
$USE "libraries\\mylib.lib"

View file

@ -0,0 +1 @@
Success=LOADRESOURCE(ID,Type,Variable)

View file

@ -0,0 +1,12 @@
@RESCURSOR
@RESBITMAP
@RESICON
@RESMENU
@RESDIALOG
@RESSTRING
@RESACCEL
@RESDATA
@RESMESSAGETABLE
@RESGROUPCURSOR
@RESGROUPICON
@RESVERSION

View file

@ -0,0 +1 @@
$include "filename.icn"

View file

@ -0,0 +1 @@
require 'myheader.ijs'

View file

@ -0,0 +1 @@
load 'myheader.ijs'

View file

@ -0,0 +1 @@
0!:0<'myheader.ijs'

View file

@ -0,0 +1,4 @@
public class Class1 extends Class2
{
//code here
}

View file

@ -0,0 +1,9 @@
public class Class1
{
Class2 c2=new Class2();
static void main(String[] args)
{
c2.func1();
c2.func2();
}
}

View file

@ -0,0 +1,6 @@
var s = document.createElement('script');
s.type = 'application/javascript';
// path to the desired file
s.src = 'http://code.jquery.com/jquery-1.6.2.js';
document.body.appendChild(s);

View file

@ -0,0 +1 @@
$.getScript("http://example.com/script.js");

View file

@ -0,0 +1 @@
require(["jquery"], function($) { /* ... */ });

View file

@ -0,0 +1 @@
var $ = require('$');

View file

@ -0,0 +1 @@
import $ from "jquery";

View file

@ -0,0 +1,3 @@
include "gort";
hello

View file

@ -0,0 +1 @@
def hello: "Klaatu barada nikto";

View file

@ -0,0 +1,2 @@
$ jq -n -c -f Include_a_file.jq
Klaatu barada nikto.

View file

@ -0,0 +1,2 @@
source('file');
require('module');

View file

@ -0,0 +1 @@
include("foo.jl")

View file

@ -0,0 +1 @@
import MyModule

View file

@ -0,0 +1 @@
using MyModule

View file

@ -0,0 +1 @@
fun f() = println("f called")

View file

@ -0,0 +1,7 @@
// version 1.1.2
import package1.f // import f from package `package1`
fun main(args: Array<String>) {
f() // invoke f without qualification
}

View file

@ -0,0 +1 @@
web_response -> include('my_file.inc')

View file

@ -0,0 +1,8 @@
# Execute and copy variables defined in code.lang only
ln.bindLibrary(code.lang)
# Execute and copy translations defined in code.lang only
ln.link(code.lang)
# Execute and copy variables and translations defined in code.lang
ln.include(code.lang)

View file

@ -0,0 +1 @@
include('myfile.lasso')

View file

@ -0,0 +1,13 @@
-- load Lingo code from file
fp = xtra("fileIO").new()
fp.openFile(_movie.path&"someinclude.ls", 1)
code = fp.readFile()
fp.closeFile()
-- create new script member, assign loaded code
m = new(#script)
m.name = "someinclude"
m.scriptText = code
-- use it instantly in the current script (i.e. the script that contained the above include code)
script("someinclude").foo()

View file

@ -0,0 +1,5 @@
:- object(foo).
:- include(bar).
:- end_object.

View file

@ -0,0 +1 @@
require "myheader"

View file

@ -0,0 +1,23 @@
Document A$={
Module Global Beta {
Print "This is Beta"
x=10
Print x
}
Print "This is statement to execute"
Beta ' this call not happen
}
Save.Doc A$, "TestThis.Gsb"
Module checkit {
\\ we can delete Global
\\ usinf New Modules we get latest TestThis, excluding statements calling modules.
Load New Modules TestThis
\\ check if Beta exist
Print Module(Beta)=True
\\ so now we call Beta
Beta
Print Valid(x)=False ' x is local to beta
}
Checkit
\\ now Beta erased (after return form Checkit)
Print Module(Beta)=False

View file

@ -0,0 +1,10 @@
\\ we can delete global
Module Global alfa {
Print "this is alfa"
X=10
}
Module Checkit {
Inline Code alfa
Print X=10
}
Checkit

Some files were not shown because too many files have changed in this diff Show more