summaryrefslogtreecommitdiff
path: root/device/lib/stm8-large/_memcmp.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-large/_memcmp.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-large/_memcmp.asm')
-rw-r--r--device/lib/stm8-large/_memcmp.asm101
1 files changed, 101 insertions, 0 deletions
diff --git a/device/lib/stm8-large/_memcmp.asm b/device/lib/stm8-large/_memcmp.asm
new file mode 100644
index 0000000..a8f78b6
--- /dev/null
+++ b/device/lib/stm8-large/_memcmp.asm
@@ -0,0 +1,101 @@
+;--------------------------------------------------------
+; File Created by SDCC : free open source ANSI-C Compiler
+; Version 3.9.3 #11345 (Linux)
+;--------------------------------------------------------
+ .module _memcmp
+ .optsdcc -mstm8
+
+;--------------------------------------------------------
+; Public variables in this module
+;--------------------------------------------------------
+ .globl _memcmp
+;--------------------------------------------------------
+; 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
+; ../_memcmp.c: 31: int memcmp (const void * buf1, const void * buf2, size_t count)
+; -----------------------------------------
+; function memcmp
+; -----------------------------------------
+_memcmp:
+ sub sp, #5
+; ../_memcmp.c: 33: if (!count)
+; ../_memcmp.c: 34: return(0);
+ ldw x, (0x0d, sp)
+; ../_memcmp.c: 36: while ( --count && *((char *)buf1) == *((char *)buf2) ) {
+ jreq 00107$
+ ldw y, (0x0d, sp)
+ ldw (0x04, sp), y
+00104$:
+ ldw x, (0x04, sp)
+ decw x
+ ldw (0x04, sp), x
+ ldw x, (0x09, sp)
+ ldw y, (0x0b, sp)
+ ldw (0x01, sp), y
+ ld a, (x)
+ ld (0x03, sp), a
+ ldw y, (0x01, sp)
+ ld a, (y)
+ ldw y, (0x04, sp)
+ jreq 00106$
+ cp a, (0x03, sp)
+ jrne 00106$
+; ../_memcmp.c: 37: buf1 = (char *)buf1 + 1;
+ incw x
+ ldw (0x09, sp), x
+; ../_memcmp.c: 38: buf2 = (char *)buf2 + 1;
+ ldw x, (0x01, sp)
+ incw x
+ ldw (0x0b, sp), x
+ jra 00104$
+00106$:
+; ../_memcmp.c: 41: return( *((unsigned char *)buf1) - *((unsigned char *)buf2) );
+ clrw x
+ exg a, xl
+ ld a, (0x03, sp)
+ exg a, xl
+ ld (0x05, sp), a
+ clr (0x04, sp)
+ subw x, (0x04, sp)
+00107$:
+; ../_memcmp.c: 42: }
+ addw sp, #5
+ retf
+ .area CODE
+ .area CONST
+ .area INITIALIZER
+ .area CABS (ABS)