📄 armcode2.s
字号:
#*********************************************************************************************
# NAME: ARMcode2.s *
# Author: Embest *
# Desc: ARM instruction examples *
# Example for Condition Code *
# History: shw.He 2005.02.22 *
#*********************************************************************************************
/*------------------------------------------------------------------------------------------*/
/* constant define */
/*------------------------------------------------------------------------------------------*/
.global _start
/*------------------------------------------------------------------------------------------*/
/* code */
/*------------------------------------------------------------------------------------------*/
.text
.equ num, 2 /* Number of entries in jump table */
_start:
mov r0, #0 /* set up the three parameters */
mov r1, #3
mov r2, #2
bl arithfunc /* call the function */
stop:
b stop
# ********************************************************************************************
# * According R0 valude to execute the code *
# ********************************************************************************************
arithfunc: /* label the function */
cmp r0, #num /* Treat function code as unsigned integer */
bhs DoAdd /* If code is >=2 then do operation 0. */
adr r3, JumpTable /* Load address of jump table */
ldr pc, [r3,r0,LSL#2] /* Jump to the appropriate routine */
JumpTable:
.long DoAdd
.long DoSub
DoAdd:
add r0, r1, r2 /* Operation 0, >1 */
mov pc, lr /* Return */
DoSub:
sub r0, r1, r2 /* Operation 1 */
mov pc,lr /* Return */
.end /* mark the end of this file */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -