Abbreviations, easy: Difference between revisions

correction program arm assembly raspberry pi
(correction program arm assembly raspberry pi)
Line 188:
RIGHT REPEAT *error* PUT MOVE RESTORE *error* *error* *error* POWERINPUT<br><br>
Also note that an &nbsp; ''error'' &nbsp; is noted by: &nbsp; &nbsp; *error* }}
<pre> Correction program 15/11/2020 </pre>
 
 
{{works with|as|Raspberry Pi}}
<lang ARM Assembly>
Line 230 ⟶ 229:
szMessErreur: .asciz "Error detected.\n"
szMessErrBuffer: .asciz "buffer size too less !!"
szMessErrorAbr: .asciz "*error*"
szMessInput: .asciz "Enter command (or quit to stop) : "
szCmdQuit: .asciz "QUIT"
szValTest1: .asciz "Quit"
szValTest2: .asciz "Rep"
/*********************************/
/* UnInitialized data */
Line 302 ⟶ 303:
mov r8,r0
mov r9,r1
mov r4,r0 bl computeLength @ length input command
mov r0r4,r5r0 @ lengthsave commandlength tableinput
mov r2,#0 @ indice
mov r3,#0 @ find counter
Line 308 ⟶ 311:
ldr r1,[r9,r2,lsl #2] @ load a item
cmp r1,#0 @ end ?
beq 3f5f
bl comparStringSpe @
cmp r0,#0 @ no found other search
beq 2f4f
mov r2r6,#0
mov r1r5,#0
42: @ loop count capital letters
ldrb r3r0,[r5r1,r2r6]
cmp r3r0,#0
beq 5f3f
tst r3r0,#0x20 @ capital letter ?
addeq r1r5,r1r5,#1
add r2r6,r2r6,#1
b 4b2b
53:
cmp r4,r1r5 @ input < command capital letters
blt 99f4f @ errorno correct
add r3,r3,#1 @ else increment counter
mov r5r7,r1 @ and save address command
24:
add r2,r2,#1 @ increment indice
b 1b @ and loop
35:
cmp r3,#1 @ no find or multiple find ?
bne 99f @ error
@ one find
mov r0,r8r7 @ length input command table
bl computeLength
mov r4,r0 @ length input
mov r0,r5 @ length command table
bl computeLength
cmp r4,r0 @ length input > command ?
bgt 99f @ error
 
mov r2,#0
mov r1,#0
4: @ loop count capital letters
ldrb r3,[r5,r2]
cmp r3,#0
beq 5f
tst r3,#0x20 @ capital letter ?
addeq r1,r1,#1
add r2,r2,#1
b 4b
5:
cmp r4,r1 @ input < command capital letters
blt 99f @ error
mov r4,#0x20 @ 5 bit to 1
mov r2,#0
6:
ldrb r3,[r5r7,r2]
cmp r3,#0
beq 7f
bic r3,r3,r4 @ convert to capital letter
strstrb r3,[r8,r2]
add r2,r2,#1
b 6b
7:
strb r3,[r8,r2]
mov r0,r8 @ return string input address
b 100f
Line 576 ⟶ 579:
.include "../affichage.inc"
</lang>
 
<pre>
Enter command (or quit to stop) : testriG
RIGHT
error
Enter command (or quit to stop) : sorePEAT
REPEAT
error
Enter command (or quit to stop) : soscopies
*error*
SOS
Enter command (or quit to stop) : rgtput
PUT
error
Enter command (or quit to stop) : rgtleftmo
MOVE
RGTLEFT
Enter command (or quit to stop) : rest
RESTORE
Enter command (or quit to stop) : types
*error*
Enter command (or quit to stop) : fup.
*error*
Enter command (or quit to stop) : 6
*error*
Enter command (or quit to stop) : poweRin
POWERINPUT
Enter command (or quit to stop) : quit
QUIT