Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
141
Task/Create-an-HTML-table/ARM-Assembly/create-an-html-table.arm
Normal file
141
Task/Create-an-HTML-table/ARM-Assembly/create-an-html-table.arm
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program crehtml.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 MAXILINE, 5
|
||||
.equ MAXIRANDOMNUMBER, 3
|
||||
|
||||
|
||||
/*********************************/
|
||||
/* Initialized data */
|
||||
/*********************************/
|
||||
.data
|
||||
szMessDebutPgm: .asciz "Program start. \n"
|
||||
szRetourLigne: .asciz "\n"
|
||||
szMessFinOK: .asciz "Program normal end. \n"
|
||||
szMessErreur: .asciz "Error !!!\n"
|
||||
|
||||
szarrayheader: .asciz "<html><table> \n"
|
||||
szarrayend: .asciz "</table></html>\n"
|
||||
szLine1: .asciz "<tr><th></th><th>X</th><th>Y</th><th>Z</th></tr>\n"
|
||||
szDebLine: .asciz "<TR><TD align=\042right\042>"
|
||||
szEndLine: .asciz "</TD></TR>\n"
|
||||
szEndCol: .asciz "</TD><TD align=\042right\042>"
|
||||
.align 4
|
||||
iGraine: .int 1234567 @ seed for number random
|
||||
/*********************************/
|
||||
/* UnInitialized data */
|
||||
/*********************************/
|
||||
.bss
|
||||
sZoneConv: .skip 24
|
||||
.align 4
|
||||
|
||||
/*********************************/
|
||||
/* code section */
|
||||
/*********************************/
|
||||
.text
|
||||
.global main
|
||||
main:
|
||||
ldr r0,iAdrszMessDebutPgm
|
||||
bl affichageMess @ start message
|
||||
ldr r0,iAdrszarrayheader
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszLine1
|
||||
bl affichageMess
|
||||
mov r4,#1 @ line counter
|
||||
1: @ begin line loop
|
||||
ldr r0,iAdrszDebLine
|
||||
bl affichageMess
|
||||
mov r0,r4 @ convert line to décimal
|
||||
ldr r1,iAdrsZoneConv
|
||||
bl conversion10
|
||||
mov r2,#0 @ add final zero
|
||||
strb r2,[r1,r0]
|
||||
ldr r0,iAdrsZoneConv @ and display N° line
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszEndCol
|
||||
bl affichageMess
|
||||
mov r5,#0 @ random number counter
|
||||
2:
|
||||
mov r0,#10000 @ limit random number
|
||||
bl genereraleas @ call random
|
||||
ldr r1,iAdrsZoneConv @ conversion to décimal
|
||||
bl conversion10
|
||||
mov r2,#0 @ add final zero
|
||||
strb r2,[r1,r0]
|
||||
ldr r0,iAdrsZoneConv @ and display random number
|
||||
bl affichageMess
|
||||
ldr r0,iAdrszEndCol
|
||||
bl affichageMess
|
||||
add r5,r5,#1 @ increment counter
|
||||
cmp r5,#MAXIRANDOMNUMBER @ and loop
|
||||
blt 2b
|
||||
ldr r0,iAdrszEndLine
|
||||
bl affichageMess
|
||||
add r4,r4,#1 @ increment line counter
|
||||
cmp r4,#MAXILINE @ and loop
|
||||
blt 1b
|
||||
ldr r0,iAdrszarrayend
|
||||
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
|
||||
iAdrsZoneConv: .int sZoneConv
|
||||
iAdrszarrayheader: .int szarrayheader
|
||||
iAdrszLine1: .int szLine1
|
||||
iAdrszDebLine: .int szDebLine
|
||||
iAdrszEndCol: .int szEndCol
|
||||
iAdrszEndLine: .int szEndLine
|
||||
iAdrszarrayend: .int szarrayend
|
||||
/***************************************************/
|
||||
/* Generation random number */
|
||||
/***************************************************/
|
||||
/* r0 contains limit */
|
||||
genereraleas:
|
||||
push {r1-r4,lr} @ save registers
|
||||
ldr r4,iAdriGraine
|
||||
ldr r2,[r4]
|
||||
ldr r3,iNbDep1
|
||||
mul r2,r3,r2
|
||||
ldr r3,iNbDep1
|
||||
add r2,r2,r3
|
||||
str r2,[r4] @ maj de la graine pour l appel suivant
|
||||
cmp r0,#0
|
||||
beq 100f
|
||||
mov r1,r0 @ divisor
|
||||
mov r0,r2 @ dividende
|
||||
bl division
|
||||
mov r0,r3 @ résult = remainder
|
||||
|
||||
100: @ end function
|
||||
pop {r1-r4,pc} @ restaur registers
|
||||
iAdriGraine: .int iGraine
|
||||
iNbDep1: .int 0x343FD
|
||||
iNbDep2: .int 0x269EC3
|
||||
|
||||
/***************************************************/
|
||||
/* ROUTINES INCLUDE */
|
||||
/***************************************************/
|
||||
.include "../affichage.inc"
|
||||
Loading…
Add table
Add a link
Reference in a new issue