Chinaunix首页 | 论坛 | 博客
  • 博客访问: 282615
  • 博文数量: 17
  • 博客积分: 2096
  • 博客等级: 大尉
  • 技术积分: 535
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-28 18:55
文章分类

全部博文(17)

文章存档

2010年(16)

2008年(5)

分类: 嵌入式

2008-05-23 14:23:44

 

;Copy string from table1 to table2
AREA blkCpy,CODE,READONLY
SWI_ANGEL EQU 0x123456 ;SWI number for Angel semihosting

MACRO
$l Exit ;Angel SWI call to terminate execution
$l MOV r0, #0x18 ;Angel SWIreason_ReportException(0x18)
LDR r1, =0x20026 ;report ADP_Stopped_ApplicationExit
SWI SWI_ANGEL ;ARM semihosting SWI
MEND

MACRO
$l WriteC ;Angel SWI call to output char in [r1]
$l MOV r0, #0x3 ;select Angel SYS_WRITEC function
SWI SWI_ANGEL
MEND

ENTRY ;code entry point
ADR r1, TABLE1 ;r1->TABLE1
ADR r2, TABLE2 ;r2->TABLE2
ADR r3, T1END ;r3->T1END
LOOP1 LDR r4, [r1], #4 ;GET TABLE1 1st WORD
STR r4, [r2], #4 ;COPY INTO TABLE2
CMP r1, r3 ;FINISHED?
BLT LOOP1 ;IF NOT, DO MORE
ADR r1, TABLE2-1 ;r1->TABLE2
MOV r0, #0x3
LOOP2 LDRB r4, [r1,#1]! ;get next byte
CMP r4, #0 ;CHECK FOR TEXT END
SWINE SWI_ANGEL ;IF NOT END, PRINT...
BNE LOOP2 ;.. AND LOOP BACK
Exit ;FINISH
ALIGN
TABLE1 = "This is the right string!", &0a, &0d, 0
T1END
TABLE2 = "This is the wrong string!", 0
END

阅读(1186) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~