Keil Logo

Understanding of code

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Author
Noman Tufail
Posted
24-Feb-2019 23:43 GMT
Toolset
None
New! 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
Author
Peta Parka
Posted
25-Feb-2019 07:09 GMT
Toolset
None
New! RE: Understanding of code

It's not C.

Author
Andrew Neil
Posted
25-Feb-2019 10:16 GMT
Toolset
None
New! RE: Understanding of code

As already noted, it is not 'C' !

It is Assembler.

Assembler is not standardised across processors - so it's important to know what Assembler this is.

You could start with some books on the principles of assembly programming:

http://www.keil.com/books

Author
Oxa Smith
Posted
18-Mar-2019 11:13 GMT
Toolset
None
New! RE: Understanding of code

I know where you can find an answer. Here - http://www.domyhomeworkfor.me This online service have quality writers in more than 50 disciplines. Java, Statistice, Python, Code etc.
100% Confidentiality

Author
Westonsupermare Pier
Posted
18-Mar-2019 18:37 GMT
Toolset
None
New! RE: Understanding of code

Try cargocoderwankers.com also

Next Thread | Thread List | Previous Thread Start a Thread | Settings

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.