Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,81 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program colorText.s */
|
||||
|
||||
/* Constantes */
|
||||
.equ STDOUT, 1 @ Linux output console
|
||||
.equ EXIT, 1 @ Linux syscall
|
||||
.equ WRITE, 4 @ Linux syscall
|
||||
|
||||
.equ BUFFERSIZE, 100
|
||||
|
||||
/* Initialized data */
|
||||
.data
|
||||
szMessStartPgm: .asciz "Program start \n"
|
||||
szMessEndPgm: .asciz "Program normal end.\n"
|
||||
szMessColorRed: .asciz "Color red.\n"
|
||||
szCodeInit: .asciz "\033[0m" @ color reinit
|
||||
szCodeRed: .asciz "\033[31m" @ color red
|
||||
szMessBlue: .asciz "\033[34mColor Blue\n" @ color blue
|
||||
szMessTwoColor: .asciz "\033[32mColor Green \033[35m Color Velvet\n"
|
||||
szMessTest: .asciz "\033[33m\033[1mMessage yellow bold\n"
|
||||
|
||||
szCarriageReturn: .asciz "\n"
|
||||
|
||||
/* UnInitialized data */
|
||||
.bss
|
||||
|
||||
/* code section */
|
||||
.text
|
||||
.global main
|
||||
main:
|
||||
|
||||
ldr r0,iAdrszMessStartPgm @ display start message
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszCodeRed @ color red
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszMessColorRed
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszMessBlue @ message color blue
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszMessTwoColor @ message two colors
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszMessTest
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszCodeInit @ color reinitialize
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszMessEndPgm @ display end message
|
||||
bl affichageMess
|
||||
|
||||
100: @ standard end of the program
|
||||
mov r0, #0 @ return code
|
||||
mov r7, #EXIT @ request to exit program
|
||||
svc 0 @ perform system call
|
||||
iAdrszMessStartPgm: .int szMessStartPgm
|
||||
iAdrszMessEndPgm: .int szMessEndPgm
|
||||
iAdrszCodeInit: .int szCodeInit
|
||||
iAdrszCodeRed: .int szCodeRed
|
||||
iAdrszMessBlue: .int szMessBlue
|
||||
iAdrszMessColorRed: .int szMessColorRed
|
||||
iAdrszMessTwoColor: .int szMessTwoColor
|
||||
iAdrszMessTest: .int szMessTest
|
||||
iAdrszCarriageReturn: .int szCarriageReturn
|
||||
|
||||
/******************************************************************/
|
||||
/* display text with size calculation */
|
||||
/******************************************************************/
|
||||
/* r0 contains the address of the message */
|
||||
affichageMess:
|
||||
push {r0,r1,r2,r7,lr} @ save registers
|
||||
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 system
|
||||
pop {r0,r1,r2,r7,lr} @ restaur registers
|
||||
bx lr @ return
|
||||
Loading…
Add table
Add a link
Reference in a new issue