summaryrefslogtreecommitdiff
path: root/device/lib/pic16/libc/delay
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/pic16/libc/delay
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/pic16/libc/delay')
-rw-r--r--device/lib/pic16/libc/delay/delay100ktcy.S73
-rw-r--r--device/lib/pic16/libc/delay/delay100tcy.S66
-rw-r--r--device/lib/pic16/libc/delay/delay10ktcy.S73
-rw-r--r--device/lib/pic16/libc/delay/delay10tcy.S58
-rw-r--r--device/lib/pic16/libc/delay/delay1ktcy.S66
-rw-r--r--device/lib/pic16/libc/delay/delay1mtcy.S80
6 files changed, 416 insertions, 0 deletions
diff --git a/device/lib/pic16/libc/delay/delay100ktcy.S b/device/lib/pic16/libc/delay/delay100ktcy.S
new file mode 100644
index 0000000..4da07c2
--- /dev/null
+++ b/device/lib/pic16/libc/delay/delay100ktcy.S
@@ -0,0 +1,73 @@
+;--------------------------------------------------------------------------
+; delay100ktcy.S
+;
+; Copyright (C) 2005, Vangelis Rokas <vrokas at otenet.gr>
+;
+; This library is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option) any
+; later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this library; see the file COPYING. If not, write to the
+; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+; MA 02110-1301, USA.
+;
+; As a special exception, if you link this library with other files,
+; some of which are compiled with SDCC, to produce an executable,
+; this library does not by itself cause the resulting executable to
+; be covered by the GNU General Public License. This exception does
+; not however invalidate any other reasons why the executable file
+; might be covered by the GNU General Public License.
+;--------------------------------------------------------------------------
+
+ include <p18fxxx.inc>
+
+ extern _delay10tcy
+ extern _delay1ktcy
+
+ global _delay100ktcy
+
+ code
+
+_delay100ktcy:
+ ; polynomial for 100ktcy delay is f(x) = 100000 * (x-1) + 100000
+ decf WREG, f
+
+ movwf POSTDEC1
+ movlw 99
+ call _delay1ktcy
+
+ movlw 99
+ call _delay10tcy
+
+ movf PREINC1, w
+
+ bz @delay100k_end
+ bra $+2
+
+@delay100k_loop:
+ movwf POSTDEC1
+
+ movlw 99
+ call _delay1ktcy
+
+ movlw 99
+ call _delay10tcy
+
+ bra $+2
+ bra $+2
+ nop
+ movf PREINC1, w
+ decfsz WREG, f
+ bra @delay100k_loop
+
+@delay100k_end:
+ return
+
+ end
diff --git a/device/lib/pic16/libc/delay/delay100tcy.S b/device/lib/pic16/libc/delay/delay100tcy.S
new file mode 100644
index 0000000..76792fc
--- /dev/null
+++ b/device/lib/pic16/libc/delay/delay100tcy.S
@@ -0,0 +1,66 @@
+;--------------------------------------------------------------------------
+; delay100tcy.S
+;
+; Copyright (C) 2005, Vangelis Rokas <vrokas at otenet.gr>
+;
+; This library is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option) any
+; later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this library; see the file COPYING. If not, write to the
+; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+; MA 02110-1301, USA.
+;
+; As a special exception, if you link this library with other files,
+; some of which are compiled with SDCC, to produce an executable,
+; this library does not by itself cause the resulting executable to
+; be covered by the GNU General Public License. This exception does
+; not however invalidate any other reasons why the executable file
+; might be covered by the GNU General Public License.
+;--------------------------------------------------------------------------
+
+ include <p18fxxx.inc>
+
+ extern _delay10tcy
+
+ global _delay100tcy
+
+ code
+
+_delay100tcy:
+ ; polynomial for 100tcy delay is f(x) = 100 * (x-1) + 100
+ decf WREG, f
+ movwf POSTDEC1
+ movlw 9
+ call _delay10tcy
+
+ movf PREINC1, w
+
+ bz @delay100_end
+ bra $+2
+
+@delay100_loop:
+ movwf POSTDEC1
+
+ movlw 9
+ call _delay10tcy
+
+ bra $+2
+
+ movf PREINC1, w
+ nop
+ bra $+2
+ decfsz WREG, f
+ bra @delay100_loop
+
+@delay100_end:
+ return
+
+ end
diff --git a/device/lib/pic16/libc/delay/delay10ktcy.S b/device/lib/pic16/libc/delay/delay10ktcy.S
new file mode 100644
index 0000000..efb37ce
--- /dev/null
+++ b/device/lib/pic16/libc/delay/delay10ktcy.S
@@ -0,0 +1,73 @@
+;--------------------------------------------------------------------------
+; delay10ktcy.S
+;
+; Copyright (C) 2005, Vangelis Rokas <vrokas at otenet.gr>
+;
+; This library is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option) any
+; later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this library; see the file COPYING. If not, write to the
+; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+; MA 02110-1301, USA.
+;
+; As a special exception, if you link this library with other files,
+; some of which are compiled with SDCC, to produce an executable,
+; this library does not by itself cause the resulting executable to
+; be covered by the GNU General Public License. This exception does
+; not however invalidate any other reasons why the executable file
+; might be covered by the GNU General Public License.
+;--------------------------------------------------------------------------
+
+ include <p18fxxx.inc>
+
+ extern _delay10tcy
+ extern _delay1ktcy
+
+ global _delay10ktcy
+
+ code
+
+_delay10ktcy:
+ ; polynomial for 10ktcy delay is f(x) = 10000 * (x-1) + 10000
+ decf WREG, f
+
+ movwf POSTDEC1
+ movlw 9
+ call _delay1ktcy
+
+ movlw 99
+ call _delay10tcy
+
+ movf PREINC1, w
+
+ bz @delay10k_end
+ bra $+2
+
+@delay10k_loop:
+ movwf POSTDEC1
+
+ movlw 9
+ call _delay1ktcy
+
+ movlw 99
+ call _delay10tcy
+
+ bra $+2
+ bra $+2
+ nop
+ movf PREINC1, w
+ decfsz WREG, f
+ bra @delay10k_loop
+
+@delay10k_end:
+ return
+
+ end
diff --git a/device/lib/pic16/libc/delay/delay10tcy.S b/device/lib/pic16/libc/delay/delay10tcy.S
new file mode 100644
index 0000000..6dcd889
--- /dev/null
+++ b/device/lib/pic16/libc/delay/delay10tcy.S
@@ -0,0 +1,58 @@
+;--------------------------------------------------------------------------
+; delay10tcy.S
+;
+; Copyright (C) 2005, Vangelis Rokas <vrokas at otenet.gr>
+;
+; This library is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option) any
+; later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this library; see the file COPYING. If not, write to the
+; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+; MA 02110-1301, USA.
+;
+; As a special exception, if you link this library with other files,
+; some of which are compiled with SDCC, to produce an executable,
+; this library does not by itself cause the resulting executable to
+; be covered by the GNU General Public License. This exception does
+; not however invalidate any other reasons why the executable file
+; might be covered by the GNU General Public License.
+;--------------------------------------------------------------------------
+
+ include <p18fxxx.inc>
+
+ global _delay10tcy
+
+ code
+
+_delay10tcy:
+ ; polynomial for 10tcy delay is f(x) = 10 * (x-1) + 10
+ decf WREG, f
+ nop
+
+ movf WREG, w
+ bz @delay10_end
+
+ bra $+2
+
+@delay10_loop:
+ bra $+2
+ bra $+2
+ bra $+2
+
+ nop
+ decfsz WREG, f
+ bra @delay10_loop
+
+@delay10_end:
+
+ return
+
+ end
diff --git a/device/lib/pic16/libc/delay/delay1ktcy.S b/device/lib/pic16/libc/delay/delay1ktcy.S
new file mode 100644
index 0000000..6282369
--- /dev/null
+++ b/device/lib/pic16/libc/delay/delay1ktcy.S
@@ -0,0 +1,66 @@
+;--------------------------------------------------------------------------
+; delay1ktcy.S
+;
+; Copyright (C) 2005, Vangelis Rokas <vrokas at otenet.gr>
+;
+; This library is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option) any
+; later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this library; see the file COPYING. If not, write to the
+; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+; MA 02110-1301, USA.
+;
+; As a special exception, if you link this library with other files,
+; some of which are compiled with SDCC, to produce an executable,
+; this library does not by itself cause the resulting executable to
+; be covered by the GNU General Public License. This exception does
+; not however invalidate any other reasons why the executable file
+; might be covered by the GNU General Public License.
+;--------------------------------------------------------------------------
+
+ include <p18fxxx.inc>
+
+ extern _delay10tcy
+
+ global _delay1ktcy
+
+ code
+
+_delay1ktcy:
+ ; polynomial for 1ktcy delay is f(x) = 1000 * (x-1) + 1000
+ decf WREG, f
+
+ movwf POSTDEC1
+ movlw 99
+ call _delay10tcy
+
+ movf PREINC1, w
+
+ bz @delay1k_end
+ bra $+2
+
+@delay1k_loop:
+ movwf POSTDEC1
+ movlw 99
+ call _delay10tcy
+
+ bra $+2
+ bra $+2
+ nop
+
+ movf PREINC1, w
+ decfsz WREG, f
+ bra @delay1k_loop
+
+@delay1k_end:
+ return
+
+ end
diff --git a/device/lib/pic16/libc/delay/delay1mtcy.S b/device/lib/pic16/libc/delay/delay1mtcy.S
new file mode 100644
index 0000000..4956891
--- /dev/null
+++ b/device/lib/pic16/libc/delay/delay1mtcy.S
@@ -0,0 +1,80 @@
+;--------------------------------------------------------------------------
+; delay1mtcy.S
+;
+; Copyright (C) 2005, Vangelis Rokas <vrokas at otenet.gr>
+;
+; This library is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 2, or (at your option) any
+; later version.
+;
+; This library is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this library; see the file COPYING. If not, write to the
+; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+; MA 02110-1301, USA.
+;
+; As a special exception, if you link this library with other files,
+; some of which are compiled with SDCC, to produce an executable,
+; this library does not by itself cause the resulting executable to
+; be covered by the GNU General Public License. This exception does
+; not however invalidate any other reasons why the executable file
+; might be covered by the GNU General Public License.
+;--------------------------------------------------------------------------
+
+ include <p18fxxx.inc>
+
+ extern _delay10tcy
+ extern _delay100tcy
+ extern _delay10ktcy
+
+ global _delay1mtcy
+
+ code
+
+_delay1mtcy:
+ ; polynomial for 1mtcy delay is f(x) = 100000 * (x-1) + 100000
+ decf WREG, f
+
+ movwf POSTDEC1
+ movlw 99
+ call _delay10ktcy
+
+ movlw 99
+ call _delay100tcy
+
+ movlw 9
+ call _delay10tcy
+
+ movf PREINC1, w
+
+ bz @delay1m_end
+ bra $+2
+
+@delay1m_loop:
+ movwf POSTDEC1
+
+ movlw 99
+ call _delay10ktcy
+
+ movlw 99
+ call _delay100tcy
+
+ movlw 9
+ call _delay10tcy
+
+ bra $+2
+ bra $+2
+ nop
+ movf PREINC1, w
+ decfsz WREG, f
+ bra @delay1m_loop
+
+@delay1m_end:
+ return
+
+ end