AREA SwpProc,CODE,READONLY EXPORT PROC0 EXPORT PROC1 SWI_ANGEL EQU 0x123456 ;SWI number for Angel semihosting ;textout routine callable from either process TextOut ;output string starting at [r14] ;need to grab semaphore here ;;;;;;;start atomic region;;;;;;;;;;;;;;;; MOV r0, #0x3 ;select Angel SYS_WRITEC function NxtTxt LDRB r1, [r14], #1 ;get next character MOV r2, #0xff Delay SUBS r2, r2, #1 BNE Delay CMP r1, #0 ;test for end mark SUBNE r1, r14, #1 ;setup r1 for call to SWI SWINE SWI_ANGEL ;if not end, print.. BNE NxtTxt ; ..and loop ADD r14, r14, #3 ;pass next word boundary BIC r14, r14, #3 ;round back to boundary ;;;;;;;end atomic region;;;;;;;;;;;;;;;;;; ;need to release semaphore here MOV pc, r14 ;return ;process 0 PROC0 MOV r4, #0xff ; LDR r0, [r4] l0 SUBS r4, r4, #1 BNE l0 BL TextOut = "Process 0, 0123456789", &0a, &0d, 0 B PROC0 ;process 1 PROC1 MOV r4, #0xff l1 SUBS r4, r4, #1 BNE l1 BL TextOut = "Process 1, 9876543210", &0a, &0d, 0 B PROC1 SEMAPHORE DCD 0 END