;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
|