diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /device/lib/stm8-large/_strstr.asm | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'device/lib/stm8-large/_strstr.asm')
| -rw-r--r-- | device/lib/stm8-large/_strstr.asm | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/device/lib/stm8-large/_strstr.asm b/device/lib/stm8-large/_strstr.asm new file mode 100644 index 0000000..5b7ac3f --- /dev/null +++ b/device/lib/stm8-large/_strstr.asm @@ -0,0 +1,134 @@ +;-------------------------------------------------------- +; File Created by SDCC : free open source ANSI-C Compiler +; Version 3.9.3 #11345 (Linux) +;-------------------------------------------------------- + .module _strstr + .optsdcc -mstm8 + +;-------------------------------------------------------- +; Public variables in this module +;-------------------------------------------------------- + .globl _strstr +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + .area DATA +;-------------------------------------------------------- +; ram data +;-------------------------------------------------------- + .area INITIALIZED +;-------------------------------------------------------- +; absolute external ram data +;-------------------------------------------------------- + .area DABS (ABS) + +; default segment ordering for linker + .area HOME + .area GSINIT + .area GSFINAL + .area CONST + .area INITIALIZER + .area CODE + +;-------------------------------------------------------- +; global & static initialisations +;-------------------------------------------------------- + .area HOME + .area GSINIT + .area GSFINAL + .area GSINIT +;-------------------------------------------------------- +; Home +;-------------------------------------------------------- + .area HOME + .area HOME +;-------------------------------------------------------- +; code +;-------------------------------------------------------- + .area CODE +; ../_strstr.c: 31: char *strstr ( const char *str1, const char *str2 ) +; ----------------------------------------- +; function strstr +; ----------------------------------------- +_strstr: + sub sp, #13 +; ../_strstr.c: 33: const char *cp = str1; + ldw y, (0x11, sp) + ldw (0x01, sp), y +; ../_strstr.c: 37: if (!*str2) + ldw y, (0x13, sp) + ldw (0x03, sp), y + ldw x, y + ld a, (x) + ld (0x0d, sp), a + jrne 00122$ +; ../_strstr.c: 38: return ((char*)str1); + ldw x, (0x01, sp) + jra 00113$ +; ../_strstr.c: 40: while (*cp) +00122$: + ldw y, (0x01, sp) + ldw (0x08, sp), y +00110$: + ldw x, (0x08, sp) + ld a, (x) + jreq 00112$ +; ../_strstr.c: 43: s2 = str2; + ldw x, (0x03, sp) +; ../_strstr.c: 45: while (*s1 && *s2 && !(*s1-*s2)) + ldw y, (0x08, sp) + ldw (0x0a, sp), y + ldw (0x0c, sp), x +00105$: + ldw x, (0x0a, sp) + ld a, (x) + ld (0x07, sp), a + ldw x, (0x0c, sp) + ld a, (x) + ld (0x05, sp), a + tnz (0x07, sp) + jreq 00107$ + tnz (0x05, sp) + jreq 00107$ + clrw x + ld a, (0x07, sp) + ld xl, a + ld a, (0x05, sp) + ld (0x07, sp), a + clr (0x06, sp) + subw x, (0x06, sp) + tnzw x + jrne 00107$ +; ../_strstr.c: 46: s1++, s2++; + ldw x, (0x0a, sp) + incw x + ldw (0x0a, sp), x + ldw x, (0x0c, sp) + incw x + ldw (0x0c, sp), x + jra 00105$ +00107$: +; ../_strstr.c: 48: if (!*s2) + tnz (0x05, sp) + jrne 00109$ +; ../_strstr.c: 49: return ((char*)cp); + ldw x, (0x01, sp) + jra 00113$ +00109$: +; ../_strstr.c: 51: cp++; + ldw x, (0x08, sp) + incw x + ldw (0x08, sp), x + ldw (0x01, sp), x + jra 00110$ +00112$: +; ../_strstr.c: 54: return (NULL) ; + clrw x +00113$: +; ../_strstr.c: 55: } + addw sp, #13 + retf + .area CODE + .area CONST + .area INITIALIZER + .area CABS (ABS) |
