This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Understanding of code

Can anyone explain the codes below, I am completely new to C, and I think there is some mistake in Code 1

Code 1


GLOBAL __main
AREA Program, CODE, READONLY
__main MOV R0, #625 ; input
MOV R1, #0x8000
MOVS R2, #0
sqrt_loop ADDS R2, R2, R1
MUL R3, R2, R2
CMP R3, R0
IT HI
SUBHI R2, R2, R1
LSRS R1, R1, #1
BNE sqrt_loop
SVC 0x11
END

Code 2

GLOBAL __main
AREA Program, CODE, READONLY
__main
MOV R6,#8 ;
MOV R4,#8
MOV R7, #0xFFFF ;
MOVT R7, #0xFFFF
LDR R8,=TAB1
loop1 LDR R0,[R8], #4
MOV R5, #0;
CMP R7,R0
BLS toto1;
MOV R7, R0 ;
SUB R5, R4, R6
toto1 SUBS R6,R6,#1
BNE loop1 ;
SVC 0x01;
ALIGN
TAB1 DCD 0xE123, 0x981,0xFFFFFFFC,0x73,0x61B1,0xC54,0xD01A,0x720,0x4C15
END