summaryrefslogtreecommitdiff
path: root/device/lib/stm8/_strspn.asm
diff options
context:
space:
mode:
authorXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
committerXavier ASUS <xavi92psx@gmail.com>2019-10-18 00:31:54 +0200
commit268a53de823a6750d6256ee1fb1e7707b4b45740 (patch)
tree42c1799a9a82b2f7d9790ee9fe181d72a7274751 /device/lib/stm8/_strspn.asm
downloadsdcc-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/_strspn.asm')
-rw-r--r--device/lib/stm8/_strspn.asm93
1 files changed, 93 insertions, 0 deletions
diff --git a/device/lib/stm8/_strspn.asm b/device/lib/stm8/_strspn.asm
new file mode 100644
index 0000000..addf0de
--- /dev/null
+++ b/device/lib/stm8/_strspn.asm
@@ -0,0 +1,93 @@
+;--------------------------------------------------------
+; File Created by SDCC : free open source ANSI-C Compiler
+; Version 3.9.3 #11345 (Linux)
+;--------------------------------------------------------
+ .module _strspn
+ .optsdcc -mstm8
+
+;--------------------------------------------------------
+; Public variables in this module
+;--------------------------------------------------------
+ .globl _strchr
+ .globl _strspn
+;--------------------------------------------------------
+; 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
+; ../_strspn.c: 31: size_t strspn ( const char * string, const char * control )
+; -----------------------------------------
+; function strspn
+; -----------------------------------------
+_strspn:
+ sub sp, #2
+; ../_strspn.c: 36: while (ch = *string) {
+ clrw x
+ ldw (0x01, sp), x
+ ldw y, (0x05, sp)
+00104$:
+ ld a, (y)
+ ld xl, a
+ tnz a
+ jreq 00106$
+; ../_strspn.c: 37: if ( strchr(control,ch) )
+ clr a
+ ld xh, a
+ pushw y
+ pushw x
+ ldw x, (0x0b, sp)
+ pushw x
+ call _strchr
+ addw sp, #4
+ popw y
+ tnzw x
+ jreq 00106$
+; ../_strspn.c: 38: count++ ;
+ ldw x, (0x01, sp)
+ incw x
+ ldw (0x01, sp), x
+; ../_strspn.c: 41: string++ ;
+ incw y
+ jra 00104$
+00106$:
+; ../_strspn.c: 44: return count ;
+ ldw x, (0x01, sp)
+; ../_strspn.c: 45: }
+ addw sp, #2
+ ret
+ .area CODE
+ .area CONST
+ .area INITIALIZER
+ .area CABS (ABS)