diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/STRCOPY1.S | |
| download | Studium-master.tar.gz Studium-master.tar.bz2 | |
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/STRCOPY1.S')
| -rw-r--r-- | Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/STRCOPY1.S | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/STRCOPY1.S b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/STRCOPY1.S new file mode 100644 index 0000000..d719799 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/BASICASM/STRCOPY1.S @@ -0,0 +1,20 @@ + AREA StrCopy1, CODE
+ ENTRY ; mark the first instruction
+main
+ ADR r1, srcstr ; pointer to first string
+ ADR r0, dststr ; pointer to second string
+ BL strcopy ; copy the first into second
+ SWI 0x11 ; and exit
+
+srcstr DCB "This is my first (source) string",0
+dststr DCB "This is my second (destination) string",0
+
+ ALIGN ; realign address to word boundary
+
+strcopy
+ LDRB r2, [r1], #1 ; load byte, then update address
+ STRB r2, [r0], #1 ; store byte, then update address
+ CMP r2, #0 ; check for zero terminator
+ BNE strcopy ; keep going if not
+ MOV pc, lr ; return
+ END
|
