summaryrefslogtreecommitdiff
path: root/device/include/pic16
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/include/pic16
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/include/pic16')
-rw-r--r--device/include/pic16/adc.h467
-rw-r--r--device/include/pic16/ctype.h72
-rw-r--r--device/include/pic16/delay.h52
-rw-r--r--device/include/pic16/errno.h43
-rw-r--r--device/include/pic16/float.h86
-rw-r--r--device/include/pic16/gstack.h37
-rw-r--r--device/include/pic16/i2c.h122
-rw-r--r--device/include/pic16/limits.h58
-rw-r--r--device/include/pic16/malloc.h129
-rw-r--r--device/include/pic16/math.h94
-rw-r--r--device/include/pic16/p18fxxx.inc114
-rw-r--r--device/include/pic16/pic16devices.txt2571
-rw-r--r--device/include/pic16/pic18fregs.h1217
-rw-r--r--device/include/pic16/sdcc-lib.h34
-rw-r--r--device/include/pic16/signal.h262
-rw-r--r--device/include/pic16/stdarg.h38
-rw-r--r--device/include/pic16/stddef.h44
-rw-r--r--device/include/pic16/stdint.h165
-rw-r--r--device/include/pic16/stdio.h120
-rw-r--r--device/include/pic16/stdlib.h84
-rw-r--r--device/include/pic16/string.h77
-rw-r--r--device/include/pic16/usart.h167
22 files changed, 6053 insertions, 0 deletions
diff --git a/device/include/pic16/adc.h b/device/include/pic16/adc.h
new file mode 100644
index 0000000..e430ac8
--- /dev/null
+++ b/device/include/pic16/adc.h
@@ -0,0 +1,467 @@
+/*-------------------------------------------------------------------------
+ adc.c - A/D conversion module library header
+
+ Copyright (C) 2004, 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.
+-------------------------------------------------------------------------*/
+/*
+ * Devices implemented:
+ * PIC18F[24][45][28]
+ * PIC18F2455-style
+ */
+
+#ifndef __ADC_H__
+#define __ADC_H__
+
+/* link I/O libarary */
+#pragma library io
+
+/*
+ * adc_open's `channel' argument:
+ *
+ * one of ADC_CHN_*
+ */
+
+/* channel selection (CHS field in ADCON0) */
+#define ADC_CHN_0 0x00
+#define ADC_CHN_1 0x01
+#define ADC_CHN_2 0x02
+#define ADC_CHN_3 0x03
+#define ADC_CHN_4 0x04
+#define ADC_CHN_5 0x05
+#define ADC_CHN_6 0x06
+#define ADC_CHN_7 0x07
+#define ADC_CHN_8 0x08
+#define ADC_CHN_9 0x09
+#define ADC_CHN_10 0x0a
+#define ADC_CHN_11 0x0b
+#define ADC_CHN_12 0x0c
+#define ADC_CHN_13 0x0d
+#define ADC_CHN_14 0x0e
+#define ADC_CHN_DAC 0x0e /* 13k50-style */
+#define ADC_CHN_15 0x0f
+#define ADC_CHN_FVR 0x0f /* 13k50-style */
+/* more channels: 23k22-style */
+#define ADC_CHN_16 0x10
+#define ADC_CHN_17 0x11
+#define ADC_CHN_18 0x12
+#define ADC_CHN_19 0x13
+#define ADC_CHN_20 0x14
+#define ADC_CHN_21 0x15
+#define ADC_CHN_22 0x16
+#define ADC_CHN_23 0x17
+#define ADC_CHN_24 0x18
+#define ADC_CHN_25 0x19
+#define ADC_CHN_26 0x1a
+#define ADC_CHN_27 0x1b
+#define ADC_CHN_K_CTMU 0x1d
+#define ADC_CHN_K_DAC 0x1e
+#define ADC_CHN_K_FVR 0x1f
+
+
+/*
+ * adc_open's `fosc' argument:
+ *
+ * ADC_FOSC_* | ADC_ACQT_* | ADC_CAL | ADC_TRIGSEL_*
+ *
+ * 7 6 5 4 3 2 1 0
+ * +-----+-----+-----+-----+-----+-----+-----+-----+
+ * | TRG | CAL | ACQT | FOSC/ADCS |
+ * +-----+-----+-----+-----+-----+-----+-----+-----+
+ */
+
+/* oscillator frequency (ADCS field) */
+#define ADC_FOSC_2 0x00
+#define ADC_FOSC_4 0x04
+#define ADC_FOSC_8 0x01
+#define ADC_FOSC_16 0x05
+#define ADC_FOSC_32 0x02
+#define ADC_FOSC_64 0x06
+#define ADC_FOSC_RC 0x07
+
+/* acquisition time (13k50/2220/24j50/65j50-styles only) */
+#define ADC_ACQT_0 (0x00 << 3)
+#define ADC_ACQT_2 (0x01 << 3)
+#define ADC_ACQT_4 (0x02 << 3)
+#define ADC_ACQT_6 (0x03 << 3)
+#define ADC_ACQT_8 (0x04 << 3)
+#define ADC_ACQT_12 (0x05 << 3)
+#define ADC_ACQT_16 (0x06 << 3)
+#define ADC_ACQT_20 (0x07 << 3)
+
+/* calibration enable (24j50/65j50-style only) */
+#define ADC_CAL 0x40
+
+/* trigger selection (23k22-style only) */
+#define ADC_TRIGGER 0x80
+
+
+/*
+ * adc_open's `pcfg' argment:
+ *
+ * ADC_CFG_* (see below, style-specific)
+ */
+
+
+/*
+ * adc_open's `config' argument:
+ *
+ * ADC_FRM_* | ADC_INT_* | ADC_VCFG_* | ADC_NVCFG_* | ADC_PVCFG_*
+ *
+ * 7 6 5 4 3 2 1 0
+ * +-----+-----+-----+-----+-----+-----+-----+-----+
+ * | FRM | INT | VCFG | PVCFG | NVCFG |
+ * +-----+-----+-----+-----+-----+-----+-----+-----+
+ */
+
+/* output format */
+#define ADC_FRM_LJUST 0x00
+#define ADC_FRM_RJUST 0x80
+
+/* interrupt on/off flag */
+#define ADC_INT_OFF 0x00
+#define ADC_INT_ON 0x40
+
+/* reference voltage configuration (not for 18f242-style ADC) */
+#define ADC_VCFG_VDD_VSS 0x00
+#define ADC_VCFG_AN3_VSS 0x10
+#define ADC_VCFG_VDD_AN2 0x20
+#define ADC_VCFG_AN3_AN2 0x30
+
+/* reference voltage configuration (13k50-style) */
+#define ADC_NVCFG_VSS 0x00
+#define ADC_NVCFG_AN5 0x01
+
+#define ADC_PVCFG_VDD (0x00 << 2)
+#define ADC_PVCFG_AN4 (0x01 << 2)
+#define ADC_PVCFG_FVR (0x02 << 2)
+
+/* reference voltage configuration (23k22-style) */
+#define ADC_NVCFG_AN2 0x01
+#define ADC_PVCFG_AN3 (0x01 << 2)
+#define ADC_TRIGSEL_CCP5 (0x00 << 7)
+#define ADC_TRIGSEL_CTMU (0x01 << 7)
+
+
+/*
+ * Distinguishing between ADC-styles:
+ * - 18f24j50-style devices have separate ANCON0/ANCON1
+ * registers for A/D port pin configuration, whereas
+ * 18f65j50-style devices multiplex ANCONx and ADCONx
+ *
+ * ADCON0:
+ * bit 18f242 18f1220 18f1230 18f13k50 18f2220 18f24j50 18f65j50 18f23k22
+ * 0 ADON ADON ADON ADON ADON ADON ADON ADON
+ * 1 - GO GO GO GO GO GO GO
+ * 2 GO CHS0 CHS0 CHS0 CHS0 CHS0 CHS0 CHS0
+ * 3 CHS0 CHS1 CHS1 CHS1 CHS1 CHS1 CHS1 CHS1
+ * 4 CHS1 CHS2 - CHS2 CHS2 CHS2 CHS2 CHS2
+ * 5 CHS2 - - CHS3 CHS3 CHS3 CHS3 CHS3
+ * 6 ADCS0 VCFG0 - - - VCFG0 VCFG0 CHS4
+ * 7 ADCS1 VCFG1 SEVTEN - (ADCAL) VCFG1 VCFG1 -
+ *
+ * ADCON1:
+ * bit 18f242 18f1220 18f1230 18f13k50 18f2220 18f24j50 18f65j50 18f23k22
+ * 0 PCFG0 PCFG0 PCFG0 NVCFG0 PCFG0 ADCS0 ADCS0 NVCFG0
+ * 1 PCFG1 PCFG1 PCFG1 NVCFG1 PCFG1 ADCS1 ADCS1 NVCFG1
+ * 2 PCFG2 PCFG2 PCFG2 PVCFG0 PCFG2 ADCS2 ADCS2 PVCFG0
+ * 3 PCFG3 PCFG3 PCFG3 PVCFG1 PCFG3 ACQT0 ACQT0 PVCFG1
+ * 4 - PCFG4 VCFG0 - VCFG0 ACQT1 ACQT1 -
+ * 5 - PCFG5 - VCFG1 ACQT2 ACQT2 -
+ * 6 ADCS2 PCFG6 - - ADCAL ADCAL -
+ * 7 ADFM - - - ADFM ADFM TRIGSEL
+ *
+ * ADCON2:
+ * bit 18f242 18f1220 18f1230 18f13k50 18f2220 18f24j50 18f65j50 18f23k22
+ * 0 ADCS0 ADCS0 ADCS0 ADCS0
+ * 1 ADCS1 ADCS1 ADCS1 ADCS1
+ * 2 ADCS2 ADCS2 ADCS2 ADCS2
+ * 3 ACQT0 ACQT0 ADQT0 ACQT0
+ * 4 ACQT1 ACQT1 ADQT1 ACQT1
+ * 5 ACQT2 ACQT2 ADQT2 ACQT2
+ * 6 - - - -
+ * 7 ADFM ADFM ADFM ADFM
+ */
+#include "pic18fam.h"
+
+
+
+/* Port configuration (PCFG (and VCFG) field(s) in ADCON1) */
+#if (__SDCC_ADC_STYLE == 0)
+
+#warning The target device is not supported by the SDCC PIC16 ADC library.
+
+#elif (__SDCC_ADC_STYLE == 1802420)
+
+#define ADC_CFG_8A_0R 0x00
+#define ADC_CFG_7A_1R 0x01
+#define ADC_CFG_5A_0R 0x02
+#define ADC_CFG_4A_1R 0x03
+#define ADC_CFG_3A_0R 0x04
+#define ADC_CFG_2A_1R 0x05
+#define ADC_CFG_0A_0R 0x06
+#define ADC_CFG_6A_2R 0x08
+#define ADC_CFG_6A_0R 0x09
+#define ADC_CFG_5A_1R 0x0a
+#define ADC_CFG_4A_2R 0x0b
+#define ADC_CFG_3A_2R 0x0c
+#define ADC_CFG_2A_2R 0x0d
+#define ADC_CFG_1A_0R 0x0e
+#define ADC_CFG_1A_2R 0x0f
+
+#elif (__SDCC_ADC_STYLE == 1812200)
+
+/*
+ * These devices use a bitmask in ADCON1 to configure AN0..AN6
+ * as digital ports (bit set) or analog input (bit clear).
+ *
+ * These settings are selected based on their similarity with
+ * the 2220-style settings; 1220-style is more flexible, though.
+ *
+ * Reference voltages are configured via adc_open's config parameter
+ * using ADC_VCFG_*.
+ */
+
+#define ADC_CFG_6A 0x00
+#define ADC_CFG_5A 0x20
+#define ADC_CFG_4A 0x30
+#define ADC_CFG_3A 0x38
+#define ADC_CFG_2A 0x3c
+#define ADC_CFG_1A 0x3e
+#define ADC_CFG_0A 0x3f
+
+#elif (__SDCC_ADC_STYLE == 1812300)
+
+/*
+ * These devices use a bitmask in ADCON1 to configure AN0..AN3
+ * as digital ports (bit set) or analog input (bit clear).
+ *
+ * These settings are selected based on their similarity with
+ * the 2220-style settings; 1230-style is more flexible, though.
+ *
+ * Reference voltages are configured via adc_open's config parameter
+ * using ADC_VCFG_*.
+ */
+
+#define ADC_CFG_4A 0x00
+#define ADC_CFG_3A 0x08
+#define ADC_CFG_2A 0x0c
+#define ADC_CFG_1A 0x0e
+#define ADC_CFG_0A 0x0f
+
+#define ADC_VCFG_AVDD 0x00 /* AVdd */
+#define ADC_VCFG_VREF 0x10 /* Vref+ */
+
+#elif (__SDCC_ADC_STYLE == 1813502)
+
+/*
+ * These devices use a bitmask in ANSEL/H to configure
+ * AN7..0/AN15..8 as digital ports (bit clear) or analog
+ * inputs (bit set).
+ *
+ * These settings are selected based on their similarity with
+ * the 2220-style settings; 13k50-style is more flexible, though.
+ *
+ * Reference voltages are configured via adc_open's config parameter
+ * using ADC_PVCFG_* and ADC_NVCFG_*.
+ */
+
+#define ADC_CFG_16A 0xFFFF
+#define ADC_CFG_15A 0x7FFF
+#define ADC_CFG_14A 0x3FFF
+#define ADC_CFG_13A 0x1FFF
+#define ADC_CFG_12A 0x0FFF
+#define ADC_CFG_11A 0x07FF
+#define ADC_CFG_10A 0x03FF
+#define ADC_CFG_9A 0x01FF
+#define ADC_CFG_8A 0x00FF
+#define ADC_CFG_7A 0x007F
+#define ADC_CFG_6A 0x003F
+#define ADC_CFG_5A 0x001F
+#define ADC_CFG_4A 0x000F
+#define ADC_CFG_3A 0x0007
+#define ADC_CFG_2A 0x0003
+#define ADC_CFG_1A 0x0001
+#define ADC_CFG_0A 0x0000
+
+#elif (__SDCC_ADC_STYLE == 1822200)
+
+/*
+ * The reference voltage configuration should be factored out into
+ * the config argument (ADC_VCFG_*) to adc_open to facilitate a
+ * merger with the 1220-style ADC.
+ */
+
+#define ADC_CFG_16A 0x00
+/* 15 analog ports cannot be configured! */
+#define ADC_CFG_14A 0x01
+#define ADC_CFG_13A 0x02
+#define ADC_CFG_12A 0x03
+#define ADC_CFG_11A 0x04
+#define ADC_CFG_10A 0x05
+#define ADC_CFG_9A 0x06
+#define ADC_CFG_8A 0x07
+#define ADC_CFG_7A 0x08
+#define ADC_CFG_6A 0x09
+#define ADC_CFG_5A 0x0a
+#define ADC_CFG_4A 0x0b
+#define ADC_CFG_3A 0x0c
+#define ADC_CFG_2A 0x0d
+#define ADC_CFG_1A 0x0e
+#define ADC_CFG_0A 0x0f
+
+/*
+ * For compatibility only: Combined port and reference voltage selection.
+ * Consider using ADC_CFG_nA and a separate ADC_VCFG_* instead!
+ */
+
+#define ADC_CFG_16A_0R 0x00
+#define ADC_CFG_16A_1R 0x10
+#define ADC_CFG_16A_2R 0x30
+
+/* Can only select 14 or 16 analog ports ... */
+#define ADC_CFG_15A_0R 0x00
+#define ADC_CFG_15A_1R 0x10
+#define ADC_CFG_15A_2R 0x30
+
+#define ADC_CFG_14A_0R 0x01
+#define ADC_CFG_14A_1R 0x11
+#define ADC_CFG_14A_2R 0x31
+#define ADC_CFG_13A_0R 0x02
+#define ADC_CFG_13A_1R 0x12
+#define ADC_CFG_13A_2R 0x32
+#define ADC_CFG_12A_0R 0x03
+#define ADC_CFG_12A_1R 0x13
+#define ADC_CFG_12A_2R 0x33
+#define ADC_CFG_11A_0R 0x04
+#define ADC_CFG_11A_1R 0x14
+#define ADC_CFG_11A_2R 0x34
+#define ADC_CFG_10A_0R 0x05
+#define ADC_CFG_10A_1R 0x15
+#define ADC_CFG_10A_2R 0x35
+#define ADC_CFG_09A_0R 0x06
+#define ADC_CFG_09A_1R 0x16
+#define ADC_CFG_09A_2R 0x36
+#define ADC_CFG_08A_0R 0x07
+#define ADC_CFG_08A_1R 0x17
+#define ADC_CFG_08A_2R 0x37
+#define ADC_CFG_07A_0R 0x08
+#define ADC_CFG_07A_1R 0x18
+#define ADC_CFG_07A_2R 0x38
+#define ADC_CFG_06A_0R 0x09
+#define ADC_CFG_06A_1R 0x19
+#define ADC_CFG_06A_2R 0x39
+#define ADC_CFG_05A_0R 0x0a
+#define ADC_CFG_05A_1R 0x1a
+#define ADC_CFG_05A_2R 0x3a
+#define ADC_CFG_04A_0R 0x0b
+#define ADC_CFG_04A_1R 0x1b
+#define ADC_CFG_04A_2R 0x3b
+#define ADC_CFG_03A_0R 0x0c
+#define ADC_CFG_03A_1R 0x1c
+#define ADC_CFG_03A_2R 0x3c
+#define ADC_CFG_02A_0R 0x0d
+#define ADC_CFG_02A_1R 0x1d
+#define ADC_CFG_02A_2R 0x3d
+#define ADC_CFG_01A_0R 0x0e
+#define ADC_CFG_01A_1R 0x1e
+#define ADC_CFG_01A_2R 0x3e
+#define ADC_CFG_00A_0R 0x0f
+
+#elif (__SDCC_ADC_STYLE == 1823222)
+
+/* use ANSELA, ANSELB, ANSELC, ANSELD, ANSELE registers and
+ * TRISA, TRISB, TRISC, TRISD, TRISE registers to set
+ * corresponding port to analog mode
+ * Note: 46k22 supports up to 28 ADC ports */
+
+
+#elif (__SDCC_ADC_STYLE == 1824501) || (__SDCC_ADC_STYLE == 1865501)
+
+/*
+ * These devices use a bitmask in ANCON0/1 to configure
+ * AN7..0/AN15..8 as digital ports (bit set) or analog
+ * inputs (bit clear).
+ *
+ * These settings are selected based on their similarity with
+ * the 2220-style settings; 24j50/65j50-style is more flexible, though.
+ *
+ * Reference voltages are configured via adc_open's config parameter
+ * using ADC_VCFG_*.
+ */
+
+#define ADC_CFG_16A 0x0000
+#define ADC_CFG_15A 0x8000
+#define ADC_CFG_14A 0xC000
+#define ADC_CFG_13A 0xE000
+#define ADC_CFG_12A 0xF000
+#define ADC_CFG_11A 0xF800
+#define ADC_CFG_10A 0xFC00
+#define ADC_CFG_9A 0xFE00
+#define ADC_CFG_8A 0xFF00
+#define ADC_CFG_7A 0xFF80
+#define ADC_CFG_6A 0xFFC0
+#define ADC_CFG_5A 0xFFE0
+#define ADC_CFG_4A 0xFFF0
+#define ADC_CFG_3A 0xFFF8
+#define ADC_CFG_2A 0xFFFC
+#define ADC_CFG_1A 0xFFFE
+#define ADC_CFG_0A 0xFFFF
+
+#else /* unhandled ADC style */
+
+#error No supported ADC style selected.
+
+#endif /* __SDCC_ADC_STYLE */
+
+
+
+#if (__SDCC_ADC_STYLE == 1813502) \
+ || (__SDCC_ADC_STYLE == 1824501) \
+ || (__SDCC_ADC_STYLE == 1865501)
+typedef unsigned int sdcc_pcfg_t;
+#else /* other styles */
+typedef unsigned char sdcc_pcfg_t;
+#endif
+
+/* initialize AD module */
+void adc_open (unsigned char channel, unsigned char fosc, sdcc_pcfg_t pcfg, unsigned char config);
+
+/* shutdown AD module */
+void adc_close (void);
+
+/* begin a conversion */
+void adc_conv (void);
+
+/* return 1 if AD is performing a conversion, 0 if done */
+char adc_busy (void) __naked;
+
+/* get value of conversion */
+int adc_read (void) __naked;
+
+/* setup conversion channel */
+void adc_setchannel (unsigned char channel);
+
+#endif
+
diff --git a/device/include/pic16/ctype.h b/device/include/pic16/ctype.h
new file mode 100644
index 0000000..e04884c
--- /dev/null
+++ b/device/include/pic16/ctype.h
@@ -0,0 +1,72 @@
+/*-------------------------------------------------------------------------
+ ctype.h - ANSI functions forward declarations
+
+ Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
+ Modified for pic16 port by Vangelis Rokas, 2004, <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.
+-------------------------------------------------------------------------*/
+/*
+ Revisions:
+ 1.0 - June.1.2000 1.0 - Bela Torok / bela.torok@kssg.ch
+ order: function definitions -> macros
+ corretced macro: isalpha(c)
+ added macros: _tolower(c), _toupper(c), tolower(c), toupper(c) toascii(c)
+*/
+
+#ifndef __CTYPE_H
+#define __CTYPE_H 1
+
+/* link the C libarary */
+#pragma library c
+
+#include <sdcc-lib.h>
+
+extern char iscntrl (unsigned char ) ;
+extern char isdigit (unsigned char ) ;
+extern char isgraph (unsigned char ) ;
+extern char islower (unsigned char ) ;
+extern char isupper (unsigned char ) ;
+extern char isprint (unsigned char ) ;
+extern char ispunct (unsigned char ) ;
+extern char isspace (unsigned char ) ;
+extern char isxdigit (unsigned char ) ;
+
+#define isalnum(c) (isalpha(c) || isdigit(c))
+#define isalpha(c) (isupper(c) || islower(c))
+
+/* ANSI versions of _tolower & _toupper
+#define _tolower(c) ((c) - ('a' - 'A'))
+#define _toupper(c) ((c) + ('a' - 'A'))
+*/
+
+// The _tolower & _toupper functions below can applied to any
+// alpha characters regardless of the case (upper or lower)
+#define _tolower(c) ((c) | ('a' - 'A'))
+#define _toupper(c) ((c) & ~('a' - 'A'))
+
+#define tolower(c) ((isupper(c)) ? _tolower(c) : (c))
+#define toupper(c) ((islower(c)) ? _toupper(c) : (c))
+#define toascii(c) ((c) & 0x7F)
+
+#endif
diff --git a/device/include/pic16/delay.h b/device/include/pic16/delay.h
new file mode 100644
index 0000000..1a73410
--- /dev/null
+++ b/device/include/pic16/delay.h
@@ -0,0 +1,52 @@
+/*-------------------------------------------------------------------------
+ delay.h - delay functions header file
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __DELAY_H__
+#define __DELAY_H__
+
+#pragma library c
+
+/*
+ * the delayNNtcy family of functions performs a
+ * delay of NN cycles. Possible values for NN are:
+ * 10 10*n cycles delay
+ * 100 100*n cycles delay
+ * 1k 1000*n cycles delay
+ * 10k 10000*n cycles delay
+ * 100k 100000*n cycles delay
+ * 1m 1000000*n cycles delay
+ */
+
+void delay10tcy(unsigned char) __wparam;
+void delay100tcy(unsigned char) __wparam;
+void delay1ktcy(unsigned char) __wparam;
+void delay10ktcy(unsigned char) __wparam;
+void delay100ktcy(unsigned char) __wparam;
+void delay1mtcy(unsigned char) __wparam;
+
+#endif
diff --git a/device/include/pic16/errno.h b/device/include/pic16/errno.h
new file mode 100644
index 0000000..a3811f5
--- /dev/null
+++ b/device/include/pic16/errno.h
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ errno.h - Error codes used in the math functions
+
+ Copyright (C) 2001, Jesus Calvino-Fraga jesusc@ieee.org
+ Ported to PIC16 port by Vangelis Rokas, 2004 <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.
+-------------------------------------------------------------------------*/
+
+#ifndef _PIC16_ERRNO_H
+#define _PIC16_ERRNO_H
+
+/* link with C library */
+#pragma library c
+
+extern int errno;
+
+/* Error Codes: */
+
+#define EDOM 33 /* Math argument out of domain of functions */
+#define ERANGE 34 /* Math result not representable */
+
+#endif /* _PIC16_ERRNO_H */
diff --git a/device/include/pic16/float.h b/device/include/pic16/float.h
new file mode 100644
index 0000000..c22f4f4
--- /dev/null
+++ b/device/include/pic16/float.h
@@ -0,0 +1,86 @@
+/*-------------------------------------------------------------------------
+ float.h - ANSI functions forward declarations
+
+ Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
+ Adopted for pic16 port library by Vangelis Rokas <vrokas AT otenet.gr> (2004)
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __FLOAT_H
+#define __FLOAT_H 1
+
+#include <sdcc-lib.h>
+#include <limits.h>
+
+#define FLT_RADIX 2
+#define FLT_MANT_DIG 24
+#define FLT_EPSILON 1.192092896E-07F
+#define FLT_DIG 6
+#define FLT_MIN_EXP (-125)
+#define FLT_MIN 1.175494351E-38F
+#define FLT_MIN_10_EXP (-37)
+#define FLT_MAX_EXP (+128)
+#define FLT_MAX 3.402823466E+38F
+#define FLT_MAX_10_EXP (+38)
+
+/* the following deal with IEEE single-precision numbers */
+#define EXCESS 126
+#define SIGNBIT ((unsigned long)0x80000000)
+#define HIDDEN (unsigned long)(1ul << 23)
+#define SIGN(fp) (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
+#define EXP(fp) (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
+#define MANT(fp) (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
+#define NORM 0xff000000
+#define PACK(s,e,m) ((s) | ((unsigned long)(e) << 23) | (m))
+
+
+float __uchar2fs (unsigned char) _FS_REENTRANT;
+float __schar2fs (signed char) _FS_REENTRANT;
+float __uint2fs (unsigned int) _FS_REENTRANT;
+float __sint2fs (signed int) _FS_REENTRANT;
+float __ulong2fs (unsigned long) _FS_REENTRANT;
+float __slong2fs (signed long) _FS_REENTRANT;
+unsigned char __fs2uchar (float) _FS_REENTRANT;
+signed char __fs2schar (float) _FS_REENTRANT;
+unsigned int __fs2uint (float) _FS_REENTRANT;
+signed int __fs2sint (float) _FS_REENTRANT;
+unsigned long __fs2ulong (float) _FS_REENTRANT;
+signed long __fs2slong (float) _FS_REENTRANT;
+
+float __fsadd (float, float) _FS_REENTRANT;
+float __fssub (float, float) _FS_REENTRANT;
+float __fsmul (float, float) _FS_REENTRANT;
+float __fsdiv (float, float) _FS_REENTRANT;
+
+char __fslt (float, float) _FS_REENTRANT;
+char __fseq (float, float) _FS_REENTRANT;
+char __fsneq (float, float) _FS_REENTRANT;
+char __fsgt (float, float) _FS_REENTRANT;
+
+#endif
+
+
+
+
+
diff --git a/device/include/pic16/gstack.h b/device/include/pic16/gstack.h
new file mode 100644
index 0000000..444cb92
--- /dev/null
+++ b/device/include/pic16/gstack.h
@@ -0,0 +1,37 @@
+/*-------------------------------------------------------------------------
+ gstack.h - debug stack tracing header
+
+ Copyright (C) 2004, 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_GSTACK_H__
+#define __PIC16_GSTACK_H__
+
+/* link the debug library */
+#pragma library debug
+
+extern void (* _gstack_overflow_handler)(void);
+
+#endif /* __PIC16_GSTACK_H__ */
diff --git a/device/include/pic16/i2c.h b/device/include/pic16/i2c.h
new file mode 100644
index 0000000..67ff8c6
--- /dev/null
+++ b/device/include/pic16/i2c.h
@@ -0,0 +1,122 @@
+/*-------------------------------------------------------------------------
+ i2c.h - I2C communications module library header
+
+ 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.
+-------------------------------------------------------------------------*/
+/*
+ * Devices implemented:
+ * PIC18F[24][45][28]
+ */
+
+#ifndef __I2C_H__
+#define __I2C_H__
+
+/* link the I/O library */
+#pragma library io
+
+#include <pic18fregs.h>
+
+
+#define _I2CPARAM_SPEC __data
+
+
+/* I2C modes of operation */
+#define I2C_SLAVE10B_INT 0x0f
+#define I2C_SLAVE7B_INT 0x0e
+#define I2C_SLAVE_IDLE 0x0b
+#define I2C_MASTER 0x08
+#define I2C_SLAVE10B 0x07
+#define I2C_SLAVE7B 0x06
+
+
+/* slew rate control */
+#define I2C_SLEW_OFF 0x80
+#define I2C_SLEW_ON 0x00
+
+/* macros to generate hardware conditions on I2C module */
+
+/* generate stop condition */
+#define I2C_STOP() do { SSPCON2bits.PEN = 1; } while (0)
+
+/* generate start condition */
+#define I2C_START() do { SSPCON2bits.SEN = 1; } while (0)
+
+/* generate restart condition */
+#define I2C_RESTART() do { SSPCON2bits.RSEN = 1; } while (0)
+
+/* generate not acknowledge condition */
+#define I2C_NACK() do { SSPCON2bits.ACKDT = 1; SSPCON2bits.ACKEN = 1; } while (0)
+
+/* generate acknowledge condition */
+#define I2C_ACK() do { SSPCON2bits.ACKDT = 0; SSPCON2bits.ACKEN = 1; } while (0)
+
+/* wait until I2C is idle */
+#define I2C_IDLE() do { /* busy waiting */ } while ((SSPCON2 & 0x1f) | (SSPSTATbits.R_W))
+
+/* is data ready from I2C module ?? */
+#define I2C_DRDY() (SSPSTATbits.BF)
+
+
+/* function equivalent to macros for generating hardware conditions */
+
+/* stop */
+void i2c_stop(void);
+
+/* start */
+void i2c_start(void);
+
+/* restart */
+void i2c_restart(void);
+
+/* not acknowledge */
+void i2c_nack(void);
+
+/* acknowledge */
+void i2c_ack(void);
+
+/* wait until I2C goes idle */
+void i2c_idle(void);
+
+/* is character ready in I2C buffer ?? */
+unsigned char i2c_drdy(void);
+
+/* read a character from I2C module */
+unsigned char i2c_readchar(void);
+
+/* read a string from I2C module */
+char i2c_readstr(_I2CPARAM_SPEC unsigned char *ptr, unsigned char len);
+
+/* write a character to I2C module */
+char i2c_writechar(unsigned char dat);
+
+/* write a string to I2C module */
+char i2c_writestr(unsigned char *ptr);
+
+/* configure I2C port for operation */
+void i2c_open(unsigned char mode, unsigned char slew, unsigned char addr_brd);
+
+void i2c_close(void);
+
+#endif /* __I2C_H__ */
diff --git a/device/include/pic16/limits.h b/device/include/pic16/limits.h
new file mode 100644
index 0000000..0fba262
--- /dev/null
+++ b/device/include/pic16/limits.h
@@ -0,0 +1,58 @@
+/*-------------------------------------------------------------------------
+ limits.h - ANSI defines constants for sizes of integral types
+
+ Copyright (C) 1999, Sandeep Dutta . sandeep.dutta@usa.net
+ Adopted for the pic16 port by Vangelis Rokas <vrokas AT otenet.gr> 2004
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __LIMITS_H
+#define __LIMITS_H 1
+
+#define CHAR_BIT 8 /* bits in a char */
+#define SCHAR_MAX 127
+#define SCHAR_MIN -128
+#define UCHAR_MAX 0xff
+#define UCHAR_MIN 0
+#ifdef __SDCC_CHAR_UNSIGNED
+#define CHAR_MAX UCHAR_MAX
+#define CHAR_MIN UCHAR_MIN
+#else
+#define CHAR_MAX SCHAR_MAX
+#define CHAR_MIN SCHAR_MIN
+#endif
+#define INT_MIN -32768
+#define INT_MAX 32767
+#define SHRT_MAX INT_MAX
+#define SHRT_MIN INT_MIN
+#define UINT_MAX 0xffff
+#define UINT_MIN 0
+#define USHRT_MAX UINT_MAX
+#define USHRT_MIN UINT_MIN
+#define LONG_MIN -2147483648
+#define LONG_MAX 2147483647
+#define ULONG_MAX 0xffffffff
+#define ULONG_MIN 0
+
+#endif
diff --git a/device/include/pic16/malloc.h b/device/include/pic16/malloc.h
new file mode 100644
index 0000000..f30c9b5
--- /dev/null
+++ b/device/include/pic16/malloc.h
@@ -0,0 +1,129 @@
+/*-------------------------------------------------------------------------
+ malloc.h - dynamic memory allocation header
+
+ Copyright (C) 2004, 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.
+-------------------------------------------------------------------------*/
+
+/*
+ * Structure of memory block header:
+ * bit 7 (MSB): allocated flag
+ * bits 0-6: pointer to next block (max length: 126)
+ *
+ */
+
+
+#ifndef __MALLOC_H__
+#define __MALLOC_H__
+
+
+/* set EMULATION to 1 to enable native Linux malloc emulation layer. This is
+ * for debugging purposes only */
+
+#ifndef EMULATION
+#define EMULATION 0
+#endif
+
+#if EMULATION
+//#define malloc pic16_malloc
+//#define free pic16_free
+//#define realloc pic16_realloc
+//#define calloc pic16_calloc
+
+//#define lmalloc pic16_lmalloc
+//#define lfree pic16_lfree
+//#define lrealloc pic16_lrealloc
+//#define lcalloc pic16_lcalloc
+#define _MALLOC_SPEC
+
+#else
+
+#pragma library c
+
+#define _MALLOC_SPEC __data
+
+#endif
+
+/* when MALLOC_MAX_FIRST is 1, the memory allocator tries to find a block
+ * that fits the requested size without merging (initially), if this block
+ * is not found, then tries to merge adjacent blocks. If MALLOC_MAX_FIRST is
+ * set 0, then the allocator tries to merge adjacent blocks in the first
+ * place. Both behaviours may give better results when used in certain
+ * circumstancs. I.e. if realloc is to be used, leaving some space after the
+ * block, will allow realloc to allocate it, otherwise it may result in much
+ * more memory fragmentation. An algorithm can be implemented to allow small
+ * fragments to be allocated but this is much too complicated for the PIC18F's
+ * architecture */
+#define MALLOC_MAX_FIRST 0
+
+#define MAX_BLOCK_SIZE 0x7f /* 127 bytes */
+#define MAX_HEAP_SIZE 0x200 /* 512 bytes */
+#define _MAX_HEAP_SIZE (MAX_HEAP_SIZE-1)
+
+#define ALLOC_FLAG 0x80
+#define HEADER_SIZE 1
+
+/* memory block header, max size 127 bytes, 126 usable */
+typedef union {
+ unsigned char datum;
+ struct {
+ unsigned count: 7;
+ unsigned alloc: 1;
+ } bits;
+} _malloc_rec;
+
+
+/* initialize heap, should be called before any call to malloc/realloc/calloc */
+void _initHeap(unsigned char _MALLOC_SPEC *dHeap, unsigned int heapsize);
+
+
+/* start searching for a block of size at least bSize, merge adjacent blocks
+ * if necessery */
+_malloc_rec _MALLOC_SPEC *_mergeHeapBlock(_malloc_rec _MALLOC_SPEC *sBlock, unsigned char bSize);
+
+
+/* allocate a memory block */
+unsigned char _MALLOC_SPEC *malloc(unsigned char len);
+
+
+/* same as malloc, but clear memory */
+unsigned char _MALLOC_SPEC *calloc(unsigned char len);
+
+
+/* expand or reduce a memory block, if mblock is NULL, then same as malloc */
+unsigned char _MALLOC_SPEC *realloc(unsigned char _MALLOC_SPEC *mblock, unsigned char len);
+
+
+/* free a memory block */
+void free(unsigned char _MALLOC_SPEC *);
+
+
+/* returns the size of all the unallocated memory */
+unsigned int memfree(void);
+
+
+/* return the size of the maximum unallocated memory block */
+unsigned int memfreemax(void);
+
+#endif /* __MALLOC_H__ */
diff --git a/device/include/pic16/math.h b/device/include/pic16/math.h
new file mode 100644
index 0000000..ceb5940
--- /dev/null
+++ b/device/include/pic16/math.h
@@ -0,0 +1,94 @@
+/*-------------------------------------------------------------------------
+ math.h - Floating point math function declarations
+
+ Copyright (C) 2001, Jesus Calvino-Fraga <jesusc AT ieee.org>
+ Ported to PIC16 port by Vangelis Rokas, 2004 <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.
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_MATH_H
+#define __PIC16_MATH_H 1
+
+#pragma library math
+
+#include <sdcc-lib.h>
+
+#define PI 3.1415926536
+#define TWO_PI 6.2831853071
+#define HALF_PI 1.5707963268
+#define QUART_PI 0.7853981634
+#define iPI 0.3183098862
+#define iTWO_PI 0.1591549431
+#define TWO_O_PI 0.6366197724
+
+// EPS=B**(-t/2), where B is the radix of the floating-point representation
+// and there are t base-B digits in the significand. Therefore, for floats
+// EPS=2**(-12). Also define EPS2=EPS*EPS.
+#define EPS 244.14062E-6
+#define EPS2 59.6046E-9
+#define XMAX 3.402823466E+38
+
+union float_long
+{
+ float f;
+ long l;
+};
+
+/**********************************************
+ * Prototypes for float ANSI C math functions *
+ **********************************************/
+
+/* Trigonometric functions */
+float sinf(float x) _MATH_REENTRANT;
+float cosf(float x) _MATH_REENTRANT;
+float tanf(float x) _MATH_REENTRANT;
+float cotf(float x) _MATH_REENTRANT;
+float asinf(float x) _MATH_REENTRANT;
+float acosf(float x) _MATH_REENTRANT;
+float atanf(float x) _MATH_REENTRANT;
+float atan2f(float x, float y);
+
+/* Hyperbolic functions */
+float sinhf(float x) _MATH_REENTRANT;
+float coshf(float x) _MATH_REENTRANT;
+float tanhf(float x) _MATH_REENTRANT;
+
+/* Exponential, logarithmic and power functions */
+float expf(float x);
+float logf(float x) _MATH_REENTRANT;
+float log10f(float x) _MATH_REENTRANT;
+float powf(float x, float y);
+float sqrtf(float a) _MATH_REENTRANT;
+
+/* Nearest integer, absolute value, and remainder functions */
+float fabsf(float x) _MATH_REENTRANT;
+float frexpf(float x, int *pw2);
+float ldexpf(float x, int pw2);
+float ceilf(float x) _MATH_REENTRANT;
+float floorf(float x) _MATH_REENTRANT;
+float modff(float x, float * y);
+
+int isnan(float f);
+int isinf(float f);
+#endif /* _PIC16_MATH_H */
diff --git a/device/include/pic16/p18fxxx.inc b/device/include/pic16/p18fxxx.inc
new file mode 100644
index 0000000..56eac99
--- /dev/null
+++ b/device/include/pic16/p18fxxx.inc
@@ -0,0 +1,114 @@
+;--------------------------------------------------------------------------
+; p18fxxx.inc
+;
+; 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.
+;--------------------------------------------------------------------------
+
+#ifndef __P18FXXX__
+#define __P18FXXX__ 1
+
+
+ list r=dec, n=96, st=off, mm=off
+
+ nolist
+
+; This header file defines configurations, registers, and other useful bits of
+; information common to all PIC18Fxxx microcontrollers.
+
+FSR0 equ 0
+FSR1 equ 1
+FSR2 equ 2
+
+FAST equ 1
+
+W equ 0
+A equ 0
+ACCESS equ 0
+BANKED equ 1
+
+; Register Files
+
+TOSU equ 0x0FFF
+TOSH equ 0x0FFE
+TOSL equ 0x0FFD
+
+STKPTR equ 0x0FFC
+
+PCLATU equ 0x0FFB
+PCLATH equ 0x0FFA
+PCL equ 0x0FF9
+
+TBLPTRU equ 0x0FF8
+TBLPTRH equ 0x0FF7
+TBLPTRL equ 0x0FF6
+TABLAT equ 0x0FF5
+
+PRODH equ 0x0FF4
+PRODL equ 0x0FF3
+
+INDF0 equ 0x0FEF
+POSTINC0 equ 0x0FEE
+POSTDEC0 equ 0x0FED
+PREINC0 equ 0x0FEC
+PLUSW0 equ 0x0FEB
+FSR0H equ 0x0FEA
+FSR0L equ 0x0FE9
+
+WREG equ 0x0FE8
+
+INDF1 equ 0x0FE7
+POSTINC1 equ 0x0FE6
+POSTDEC1 equ 0x0FE5
+PREINC1 equ 0x0FE4
+PLUSW1 equ 0x0FE3
+FSR1H equ 0x0FE2
+FSR1L equ 0x0FE1
+
+BSR equ 0x0FE0
+
+INDF2 equ 0x0FDF
+POSTINC2 equ 0x0FDE
+POSTDEC2 equ 0x0FDD
+PREINC2 equ 0x0FDC
+PLUSW2 equ 0x0FDB
+FSR2H equ 0x0FDA
+FSR2L equ 0x0FD9
+
+STATUS equ 0x0FD8
+
+PORTC equ 0x0F82
+PORTB equ 0x0F81
+PORTA equ 0x0F80
+
+; Status Register Bit Definitions
+
+C equ 0
+DC equ 1
+Z equ 2
+OV equ 3
+N equ 4
+
+ list
+#endif
diff --git a/device/include/pic16/pic16devices.txt b/device/include/pic16/pic16devices.txt
new file mode 100644
index 0000000..090252f
--- /dev/null
+++ b/device/include/pic16/pic16devices.txt
@@ -0,0 +1,2571 @@
+#--------------------------------------------------------------------------
+# pic16devices.txt - Specification of devices supported by the PIC16
+# target of the Small Devices C Compiler (SDCC).
+#
+# Copyright (C) 2008 Raphael Neider <rneider at web.de>
+# Copyright (C) 2012 Molnar Karoly <molnarkaroly@users.sf.net>
+#
+# 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.
+#--------------------------------------------------------------------------
+
+#
+# Lines starting with a hash '#' are ignored.
+# A new device specification must begin with a 'name' command.
+# Numbers can be given in any way acceptable for scanf's %d,
+# i.e., octal (0[0-7]*), decimal ([1-9][0-9]*), or hexadecimal
+# (0[xX][0-9a-fA-F]+).
+# Strings must not be quoted and may not contain whitespace!
+#
+# Valid commands are:
+# name <name>
+# Begin specification of device type <name>, e.g. 18f6720.
+# Aliases 'p<name>' and 'pic<name>' will be recognized as well.
+# using <name>
+# Import specification from the named entry, which must be defined
+# earlier. Later commands overrule imported ones.
+# ramsize <size>
+# This device has <size> bytes of RAM.
+# split <offset>
+# Addresses below <offset> refer to bank 0, addresses above <offset>
+# refer to SFRs in bank 15 for references via the access bank.
+# configrange <first> <last>
+# Configuration registers occupy addresses <first> to <last> (both
+# included).
+# configword <address> <mask> <value> [<and-mask>]
+# The config word at address <address> only implements the bits
+# indicated via <mask> (all others will be forced to 0 by the
+# compiler).
+# Unless overridden in C code, use the given default <value>.
+# The optional <and-mask> will be applied to the value just before
+# emitting it into the .asm file (used to disable XINST by default).
+# idlocrange <first> <last>
+# ID locations occupy addresses <first> to <last> (both included).
+# idword <address> <value>
+# Unless overridden in C code, use the given default <value>.
+#
+
+name 18f13k22
+ramsize 256
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xFF 0x27
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x88 0x88
+configword 0x300006 0xCD 0x85 0xBF
+configword 0x300008 0x03 0x03
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f13k50
+ramsize 512
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x38 0x00
+configword 0x300001 0xFF 0x27
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x88 0x88
+configword 0x300006 0xCD 0x85 0xBF
+configword 0x300008 0x03 0x03
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f14k22
+using 18f13k22
+ramsize 512
+
+name 18f14k50
+using 18f13k50
+ramsize 768
+
+name 18f23k20
+ramsize 512
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x8F 0x8B
+configword 0x300006 0xC5 0x85 0xBF
+configword 0x300008 0x03 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f23k22
+ramsize 512
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xFF 0x25
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x3F 0x3F
+configword 0x300005 0xBF 0xBF
+configword 0x300006 0xC5 0x85 0xBF
+configword 0x300008 0x03 0x03
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f24j10
+ramsize 1024
+split 0x80
+configrange 0x003FF8 0x003FFD
+configword 0x003FF8 0xE1 0xFF 0xBF
+configword 0x003FF9 0x04 0xF7
+configword 0x003FFA 0xC7 0xFF
+configword 0x003FFB 0x0F 0xFF
+configword 0x003FFD 0x01 0xFF
+XINST 1
+
+name 18f24j11
+ramsize 3776
+split 0x60
+configrange 0x003FF8 0x003FFF
+configword 0x003FF8 0xE1 0xE1 0xBF
+configword 0x003FF9 0x04 0xF4
+configword 0x003FFA 0xDF 0xDF
+configword 0x003FFB 0x0F 0xFF
+configword 0x003FFC 0xFF 0xFF
+configword 0x003FFD 0x09 0xF9
+configword 0x003FFE 0xCF 0xCF
+configword 0x003FFF 0x01 0xF1
+XINST 1
+
+name 18f24j50
+using 18f24j11
+configword 0x003FF8 0x6F 0xEF 0xBF
+configword 0x003FF9 0x07 0xF7
+
+name 18f24k20
+using 18f23k20
+ramsize 768
+
+name 18f24k22
+using 18f23k22
+ramsize 768
+
+name 18f24k50
+ramsize 2048
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x3B 0x00
+configword 0x300001 0xEF 0x25
+configword 0x300002 0x5F 0x5F
+configword 0x300003 0x3F 0x3F
+configword 0x300005 0xD3 0xD3
+configword 0x300006 0xE5 0xA5 0xBF
+configword 0x300008 0x03 0x03
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f25j10
+ramsize 1024
+split 0x80
+configrange 0x007FF8 0x007FFD
+configword 0x007FF8 0xE1 0xFF 0xBF
+configword 0x007FF9 0x04 0xF7
+configword 0x007FFA 0xC7 0xFF
+configword 0x007FFB 0x0F 0xFF
+configword 0x007FFD 0x01 0xFF
+XINST 1
+
+name 18f25j11
+ramsize 3776
+split 0x60
+configrange 0x007FF8 0x007FFF
+configword 0x007FF8 0xE1 0xE1 0xBF
+configword 0x007FF9 0x04 0xF4
+configword 0x007FFA 0xDF 0xDF
+configword 0x007FFB 0x0F 0xFF
+configword 0x007FFC 0xFF 0xFF
+configword 0x007FFD 0x09 0xF9
+configword 0x007FFE 0xDF 0xDF
+configword 0x007FFF 0x01 0xF1
+XINST 1
+
+name 18f25j50
+using 18f25j11
+configword 0x007FF8 0x6F 0xEF 0xBF
+configword 0x007FF9 0x07 0xF7
+
+name 18f25k20
+using 18f23k20
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f25k22
+using 18f23k22
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f25k50
+using 18f24k50
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f25k80
+ramsize 3648
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x5D 0x5D 0xBF
+configword 0x300001 0xDF 0x08
+configword 0x300002 0x7F 0x7F
+configword 0x300003 0x7F 0x7F
+configword 0x300005 0x89 0x89
+configword 0x300006 0x11 0x91
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f26j11
+ramsize 3776
+split 0x60
+configrange 0x00FFF8 0x00FFFF
+configword 0x00FFF8 0xE1 0xE1 0xBF
+configword 0x00FFF9 0x04 0xF4
+configword 0x00FFFA 0xDF 0xDF
+configword 0x00FFFB 0x0F 0xFF
+configword 0x00FFFC 0xFF 0xFF
+configword 0x00FFFD 0x09 0xF9
+configword 0x00FFFE 0xFF 0xFF
+configword 0x00FFFF 0x01 0xF1
+XINST 1
+
+name 18f26j13
+ramsize 3760
+split 0x60
+configrange 0x00FFF8 0x00FFFF
+configword 0x00FFF8 0x7F 0xFF 0xBF
+configword 0x00FFF9 0x04 0xF4
+configword 0x00FFFA 0xFF 0xFF
+configword 0x00FFFB 0x0F 0xFF
+configword 0x00FFFC 0xFF 0xFF
+configword 0x00FFFD 0x0F 0xFF
+configword 0x00FFFE 0xBF 0xBF
+configword 0x00FFFF 0x03 0xF3
+XINST 1
+
+name 18f26j50
+using 18f26j11
+configword 0x00FFF8 0x6F 0xEF 0xBF
+configword 0x00FFF9 0x07 0xF7
+
+name 18f26j53
+using 18f26j13
+ramsize 3776
+configword 0x00FFF9 0x07 0xF7
+configword 0x00FFFD 0x0B 0xFB
+configword 0x00FFFF 0x0B 0xFB
+
+name 18f26k20
+using 18f23k20
+ramsize 3936
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f26k22
+using 18f23k22
+ramsize 3936
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f26k80
+using 18f25k80
+
+name 18f27j13
+ramsize 3760
+split 0x60
+configrange 0x01FFF8 0x01FFFF
+configword 0x01FFF8 0x7F 0xFF 0xBF
+configword 0x01FFF9 0x04 0xF4
+configword 0x01FFFA 0xFF 0xFF
+configword 0x01FFFB 0x0F 0xFF
+configword 0x01FFFC 0xFF 0xFF
+configword 0x01FFFD 0x0F 0xFF
+configword 0x01FFFE 0xFF 0xFF
+configword 0x01FFFF 0x03 0xF3
+XINST 1
+
+name 18f27j53
+using 18f27j13
+ramsize 3776
+configword 0x01FFF9 0x07 0xF7
+configword 0x01FFFD 0x0B 0xFB
+configword 0x01FFFF 0x0B 0xFB
+
+name 18f43k20
+using 18f23k20
+
+name 18f43k22
+using 18f23k22
+
+name 18f44j10
+using 18f24j10
+
+name 18f44j11
+using 18f24j11
+
+name 18f44j50
+using 18f24j11
+configword 0x003FF8 0x6F 0xEF 0xBF
+configword 0x003FF9 0x07 0xF7
+
+name 18f44k20
+using 18f23k20
+ramsize 768
+
+name 18f44k22
+using 18f23k22
+ramsize 768
+
+name 18f45j10
+using 18f25j10
+
+name 18f45j11
+using 18f25j11
+
+name 18f45j50
+using 18f25j11
+configword 0x007FF8 0x6F 0xEF 0xBF
+configword 0x007FF9 0x07 0xF7
+
+name 18f45k20
+using 18f23k20
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f45k22
+using 18f23k22
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f45k50
+ramsize 2048
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x3B 0x00
+configword 0x300001 0xEF 0x25
+configword 0x300002 0x5F 0x5F
+configword 0x300003 0x3F 0x3F
+configword 0x300005 0xD3 0xD3
+configword 0x300006 0xE5 0x85 0xBF
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f45k80
+using 18f25k80
+
+name 18f46j11
+using 18f26j11
+
+name 18f46j13
+using 18f26j13
+
+name 18f46j50
+using 18f26j11
+configword 0x00FFF8 0x6F 0xEF 0xBF
+configword 0x00FFF9 0x07 0xF7
+
+name 18f46j53
+using 18f26j13
+ramsize 3776
+configword 0x00FFF9 0x07 0xF7
+configword 0x00FFFD 0x0B 0xFB
+configword 0x00FFFF 0x0B 0xFB
+
+name 18f46k20
+using 18f23k20
+ramsize 3936
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f46k22
+using 18f23k22
+ramsize 3936
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f46k80
+using 18f25k80
+
+name 18f47j13
+using 18f27j13
+
+name 18f47j53
+using 18f27j13
+ramsize 3776
+configword 0x01FFF9 0x07 0xF7
+configword 0x01FFFD 0x0B 0xFB
+configword 0x01FFFF 0x0B 0xFB
+
+name 18f63j11
+ramsize 1024
+split 0x60
+configrange 0x001FF8 0x001FFD
+configword 0x001FF8 0xE1 0xE1 0xBF
+configword 0x001FF9 0x04 0xF4
+configword 0x001FFA 0xC7 0xC7
+configword 0x001FFB 0x0F 0xFF
+configword 0x001FFC 0x00 0xF8
+configword 0x001FFD 0x01 0xF1
+XINST 1
+
+name 18f63j90
+using 18f63j11
+
+name 18f64j11
+ramsize 1024
+split 0x60
+configrange 0x003FF8 0x003FFD
+configword 0x003FF8 0xE1 0xE1 0xBF
+configword 0x003FF9 0x04 0xF4
+configword 0x003FFA 0xC7 0xC7
+configword 0x003FFB 0x0F 0xFF
+configword 0x003FFC 0x00 0xF8
+configword 0x003FFD 0x01 0xF1
+XINST 1
+
+name 18f64j90
+using 18f64j11
+
+name 18f65j10
+ramsize 2048
+split 0x60
+configrange 0x007FF8 0x007FFD
+configword 0x007FF8 0xE1 0xE1 0xBF
+configword 0x007FF9 0x04 0xF4
+configword 0x007FFA 0xC7 0xC7
+configword 0x007FFB 0x0F 0xFF
+configword 0x007FFC 0x00 0xF8
+configword 0x007FFD 0x01 0xF3
+XINST 1
+
+name 18f65j11
+using 18f65j10
+configword 0x007FFD 0x01 0xF1
+
+name 18f65j15
+ramsize 2048
+split 0x60
+configrange 0x00BFF8 0x00BFFD
+configword 0x00BFF8 0xE1 0xE1 0xBF
+configword 0x00BFF9 0x04 0xF4
+configword 0x00BFFA 0xC7 0xC7
+configword 0x00BFFB 0x0F 0xFF
+configword 0x00BFFC 0x00 0xF8
+configword 0x00BFFD 0x01 0xF3
+XINST 1
+
+name 18f65j50
+using 18f65j10
+ramsize 3904
+configword 0x007FF8 0xEF 0xEF 0xBF
+configword 0x007FF9 0x07 0xF7
+configword 0x007FFD 0x09 0xF9
+
+name 18f65j90
+using 18f65j10
+configword 0x007FFA 0xC7 0xFF
+configword 0x007FFD 0x01 0xF1
+
+name 18f65j94
+ramsize 4096
+split 0x60
+configrange 0x007FF0 0x007FFF
+configword 0x007FF0 0x60 0xE0 0xBF
+configword 0x007FF1 0x07 0xF7
+configword 0x007FF2 0xAF 0xAF
+configword 0x007FF3 0x0F 0xFF
+configword 0x007FF4 0x33 0x33
+configword 0x007FF5 0x00 0xF0
+configword 0x007FF6 0xFF 0xFF
+configword 0x007FF7 0x07 0xF7
+configword 0x007FF8 0x03 0x03
+configword 0x007FF9 0x0F 0xFF
+configword 0x007FFA 0xFF 0xFF
+configword 0x007FFB 0x0F 0xFF
+configword 0x007FFC 0x1D 0x1D
+configword 0x007FFD 0x00 0xF0
+configword 0x007FFE 0xF8 0xF8
+configword 0x007FFF 0x03 0xF3
+XINST 1
+
+name 18f65k22
+ramsize 2048
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x5D 0x5D 0xBF
+configword 0x300001 0xDF 0x08
+configword 0x300002 0x7F 0x7F
+configword 0x300003 0x7F 0x7F
+configword 0x300004 0x01 0x01
+configword 0x300005 0x89 0x89
+configword 0x300006 0x91 0x91
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f65k80
+using 18f25k80
+configword 0x300005 0x8F 0x8F
+
+name 18f65k90
+using 18f65k22
+
+name 18f66j10
+ramsize 2048
+split 0x60
+configrange 0x00FFF8 0x00FFFD
+configword 0x00FFF8 0xE1 0xE1 0xBF
+configword 0x00FFF9 0x04 0xF4
+configword 0x00FFFA 0xC7 0xC7
+configword 0x00FFFB 0x0F 0xFF
+configword 0x00FFFC 0x00 0xF8
+configword 0x00FFFD 0x01 0xF3
+XINST 1
+
+name 18f66j11
+using 18f66j10
+ramsize 3904
+configword 0x00FFFD 0x09 0xFF
+
+name 18f66j15
+ramsize 3936
+split 0x60
+configrange 0x017FF8 0x017FFD
+configword 0x017FF8 0xE1 0xE1 0xBF
+configword 0x017FF9 0x04 0xF4
+configword 0x017FFA 0xC7 0xC7
+configword 0x017FFB 0x0F 0xFF
+configword 0x017FFC 0x00 0xF8
+configword 0x017FFD 0x01 0xF3
+XINST 1
+
+name 18f66j16
+using 18f66j15
+ramsize 3904
+configword 0x017FFD 0x09 0xFF
+
+name 18f66j50
+using 18f66j10
+ramsize 3904
+configword 0x00FFF8 0xEF 0xEF 0xBF
+configword 0x00FFF9 0x07 0xF7
+configword 0x00FFFD 0x09 0xF9
+
+name 18f66j55
+using 18f66j15
+ramsize 3904
+configword 0x017FF8 0xEF 0xEF 0xBF
+configword 0x017FF9 0x07 0xF7
+configword 0x017FFD 0x09 0xF9
+
+name 18f66j60
+using 18f66j10
+ramsize 4096
+configword 0x00FFFD 0x04 0xF7
+
+name 18f66j65
+using 18f66j15
+ramsize 4096
+configword 0x017FFD 0x04 0xF7
+
+name 18f66j90
+using 18f66j10
+ramsize 3923
+configword 0x00FFFA 0xDF 0xDF
+configword 0x00FFFC 0x02 0x02
+configword 0x00FFFD 0x01 0xF1
+
+name 18f66j93
+ramsize 3923
+split 0x60
+configrange 0x00FFF8 0x00FFFD
+configword 0x00FFF8 0x61 0xE1 0xBF
+configword 0x00FFF9 0x04 0xF4
+configword 0x00FFFA 0xDF 0xDF
+configword 0x00FFFB 0x0F 0xFF
+configword 0x00FFFC 0x02 0x02
+configword 0x00FFFD 0x01 0xF1
+XINST 1
+
+name 18f66j94
+ramsize 4096
+split 0x60
+configrange 0x00FFF0 0x00FFFF
+configword 0x00FFF0 0x60 0xE0 0xBF
+configword 0x00FFF1 0x07 0xF7
+configword 0x00FFF2 0xAF 0xAF
+configword 0x00FFF3 0x0F 0xFF
+configword 0x00FFF4 0x33 0x33
+configword 0x00FFF5 0x00 0xF0
+configword 0x00FFF6 0xFF 0xFF
+configword 0x00FFF7 0x07 0xF7
+configword 0x00FFF8 0x03 0x03
+configword 0x00FFF9 0x0F 0xFF
+configword 0x00FFFA 0xFF 0xFF
+configword 0x00FFFB 0x0F 0xFF
+configword 0x00FFFC 0x1D 0x1D
+configword 0x00FFFD 0x00 0xF0
+configword 0x00FFFE 0xF8 0xF8
+configword 0x00FFFF 0x03 0xF3
+XINST 1
+
+name 18f66j99
+ramsize 4096
+split 0x60
+configrange 0x017FF0 0x017FFF
+configword 0x017FF0 0x60 0xE0 0xBF
+configword 0x017FF1 0x07 0xF7
+configword 0x017FF2 0xAF 0xAF
+configword 0x017FF3 0x0F 0xFF
+configword 0x017FF4 0x33 0x33
+configword 0x017FF5 0x00 0xF0
+configword 0x017FF6 0xFF 0xFF
+configword 0x017FF7 0x07 0xF7
+configword 0x017FF8 0x03 0x03
+configword 0x017FF9 0x0F 0xFF
+configword 0x017FFA 0xFF 0xFF
+configword 0x017FFB 0x0F 0xFF
+configword 0x017FFC 0x1D 0x1D
+configword 0x017FFD 0x00 0xF0
+configword 0x017FFE 0xF8 0xF8
+configword 0x017FFF 0x03 0xF3
+XINST 1
+
+name 18f66k22
+using 18f65k22
+ramsize 4096
+
+name 18f66k80
+using 18f25k80
+configword 0x300005 0x8F 0x8F
+
+name 18f66k90
+using 18f65k22
+ramsize 4096
+
+name 18f67j10
+ramsize 3936
+split 0x60
+configrange 0x01FFF8 0x01FFFD
+configword 0x01FFF8 0xE1 0xE1 0xBF
+configword 0x01FFF9 0x04 0xF4
+configword 0x01FFFA 0xC7 0xC7
+configword 0x01FFFB 0x0F 0xFF
+configword 0x01FFFC 0x00 0xF8
+configword 0x01FFFD 0x01 0xF3
+XINST 1
+
+name 18f67j11
+using 18f67j10
+ramsize 3904
+configword 0x01FFFD 0x09 0xFF
+
+name 18f67j50
+using 18f67j10
+ramsize 3904
+configword 0x01FFF8 0xEF 0xEF 0xBF
+configword 0x01FFF9 0x07 0xF7
+configword 0x01FFFD 0x09 0xF9
+
+name 18f67j60
+using 18f67j10
+ramsize 4096
+configword 0x01FFFD 0x04 0xF7
+
+name 18f67j90
+using 18f67j10
+ramsize 3923
+configword 0x01FFFA 0xDF 0xDF
+configword 0x01FFFC 0x02 0x02
+configword 0x01FFFD 0x01 0xF1
+
+name 18f67j93
+ramsize 3923
+split 0x60
+configrange 0x01FFF8 0x01FFFD
+configword 0x01FFF8 0x61 0xE1 0xBF
+configword 0x01FFF9 0x04 0xF4
+configword 0x01FFFA 0xDF 0xDF
+configword 0x01FFFB 0x0F 0xFF
+configword 0x01FFFC 0x02 0x02
+configword 0x01FFFD 0x01 0xF1
+XINST 1
+
+name 18f67j94
+ramsize 4096
+split 0x60
+configrange 0x01FFF0 0x01FFFF
+configword 0x01FFF0 0x60 0xE0 0xBF
+configword 0x01FFF1 0x07 0xF7
+configword 0x01FFF2 0xAF 0xAF
+configword 0x01FFF3 0x0F 0xFF
+configword 0x01FFF4 0x33 0x33
+configword 0x01FFF5 0x00 0xF0
+configword 0x01FFF6 0xFF 0xFF
+configword 0x01FFF7 0x07 0xF7
+configword 0x01FFF8 0x03 0x03
+configword 0x01FFF9 0x0F 0xFF
+configword 0x01FFFA 0xFF 0xFF
+configword 0x01FFFB 0x0F 0xFF
+configword 0x01FFFC 0x1D 0x1D
+configword 0x01FFFD 0x00 0xF0
+configword 0x01FFFE 0xF8 0xF8
+configword 0x01FFFF 0x03 0xF3
+XINST 1
+
+name 18f67k22
+using 18f65k22
+ramsize 4096
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18f67k90
+using 18f65k22
+ramsize 4096
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18f83j11
+using 18f63j11
+configword 0x001FFC 0xF8 0xF8
+
+name 18f83j90
+using 18f63j11
+
+name 18f84j11
+using 18f64j11
+configword 0x003FFC 0xF8 0xF8
+
+name 18f84j90
+using 18f64j11
+
+name 18f85j10
+using 18f65j10
+configword 0x007FFC 0xF8 0xF8
+configword 0x007FFD 0x03 0xF3
+
+name 18f85j11
+using 18f65j10
+configword 0x007FFC 0xF8 0xF8
+configword 0x007FFD 0x01 0xF1
+
+name 18f85j15
+using 18f65j15
+configword 0x00BFFC 0xF8 0xF8
+configword 0x00BFFD 0x03 0xF3
+
+name 18f85j50
+ramsize 3904
+split 0x60
+configrange 0x007FF8 0x007FFD
+configword 0x007FF8 0xEF 0xEF 0xBF
+configword 0x007FF9 0x07 0xF7
+configword 0x007FFA 0xC7 0xC7
+configword 0x007FFB 0x0F 0xFF
+configword 0x007FFC 0xF8 0xF8
+configword 0x007FFD 0x0F 0xFF
+XINST 1
+
+name 18f85j90
+using 18f65j10
+configword 0x007FFD 0x01 0xF1
+
+name 18f85j94
+using 18f65j94
+configword 0x007FF8 0xFB 0xFB
+
+name 18f85k22
+using 18f65k22
+configword 0x300004 0xF9 0xF9
+configword 0x300005 0x8B 0x8B
+
+name 18f85k90
+using 18f65k22
+configword 0x300005 0x8B 0x8B
+
+name 18f86j10
+using 18f66j10
+configword 0x00FFFC 0xF8 0xF8
+configword 0x00FFFD 0x03 0xF3
+
+name 18f86j11
+using 18f66j10
+ramsize 3904
+configword 0x00FFFC 0xF8 0xF8
+configword 0x00FFFD 0x0F 0xFF
+
+name 18f86j15
+using 18f66j15
+configword 0x017FFC 0xF8 0xF8
+configword 0x017FFD 0x03 0xF3
+
+name 18f86j16
+using 18f66j15
+ramsize 3904
+configword 0x017FFC 0xF8 0xF8
+configword 0x017FFD 0x0F 0xFF
+
+name 18f86j50
+ramsize 3904
+split 0x60
+configrange 0x00FFF8 0x00FFFD
+configword 0x00FFF8 0xEF 0xEF 0xBF
+configword 0x00FFF9 0x07 0xF7
+configword 0x00FFFA 0xC7 0xC7
+configword 0x00FFFB 0x0F 0xFF
+configword 0x00FFFC 0xF8 0xF8
+configword 0x00FFFD 0x0F 0xFF
+XINST 1
+
+name 18f86j55
+ramsize 3904
+split 0x60
+configrange 0x017FF8 0x017FFD
+configword 0x017FF8 0xEF 0xEF 0xBF
+configword 0x017FF9 0x07 0xF7
+configword 0x017FFA 0xC7 0xC7
+configword 0x017FFB 0x0F 0xFF
+configword 0x017FFC 0xF8 0xF8
+configword 0x017FFD 0x0F 0xFF
+XINST 1
+
+name 18f86j60
+using 18f66j10
+ramsize 4096
+configword 0x00FFFD 0x07 0xF7
+
+name 18f86j65
+using 18f66j15
+ramsize 4096
+configword 0x017FFD 0x07 0xF7
+
+name 18f86j72
+using 18f66j93
+
+name 18f86j90
+using 18f66j93
+configword 0x00FFF8 0xE1 0xE1 0xBF
+configword 0x00FFFC 0x02 0xF2
+
+name 18f86j93
+using 18f66j93
+configword 0x00FFFC 0x02 0xF2
+
+name 18f86j94
+using 18f66j94
+configword 0x00FFF8 0xFB 0xFB
+
+name 18f86j99
+using 18f66j99
+configword 0x017FF8 0xFB 0xFB
+
+name 18f86k22
+using 18f65k22
+ramsize 4096
+configword 0x300004 0xF9 0xF9
+configword 0x300005 0x8B 0x8B
+
+name 18f86k90
+using 18f65k22
+ramsize 4096
+configword 0x300005 0x8B 0x8B
+
+name 18f87j10
+using 18f67j10
+configword 0x01FFFC 0xF8 0xF8
+configword 0x01FFFD 0x03 0xF3
+
+name 18f87j11
+using 18f67j10
+ramsize 3904
+configword 0x01FFFC 0xF8 0xF8
+configword 0x01FFFD 0x0F 0xFF
+
+name 18f87j50
+ramsize 3904
+split 0x60
+configrange 0x01FFF8 0x01FFFD
+configword 0x01FFF8 0xEF 0xEF 0xBF
+configword 0x01FFF9 0x07 0xF7
+configword 0x01FFFA 0xC7 0xC7
+configword 0x01FFFB 0x0F 0xFF
+configword 0x01FFFC 0xF8 0xF8
+configword 0x01FFFD 0x0F 0xFF
+XINST 1
+
+name 18f87j60
+using 18f67j10
+ramsize 4096
+configword 0x01FFFD 0x07 0xF7
+
+name 18f87j72
+using 18f67j93
+
+name 18f87j90
+using 18f67j93
+configword 0x01FFF8 0xE1 0xE1 0xBF
+configword 0x01FFFC 0x02 0xF2
+
+name 18f87j93
+using 18f67j93
+configword 0x01FFFC 0x02 0xF2
+
+name 18f87j94
+using 18f67j94
+configword 0x01FFF8 0xFB 0xFB
+
+name 18f87k22
+ramsize 4096
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x5D 0x5D 0xBF
+configword 0x300001 0xDF 0x08
+configword 0x300002 0x7F 0x7F
+configword 0x300003 0x7F 0x7F
+configword 0x300004 0xF9 0xF9
+configword 0x300005 0x8B 0x8B
+configword 0x300006 0x91 0x91
+configword 0x300008 0xFF 0xFF
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0xFF 0xFF
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0xFF 0xFF
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f87k90
+using 18f87k22
+configword 0x300004 0x01 0x01
+
+name 18f95j94
+using 18f65j94
+configword 0x007FF8 0xFB 0xFB
+
+name 18f96j60
+using 18f66j10
+ramsize 4096
+configword 0x00FFFC 0xF8 0xF8
+configword 0x00FFFD 0x07 0xF7
+
+name 18f96j65
+using 18f66j15
+ramsize 4096
+configword 0x017FFC 0xF8 0xF8
+configword 0x017FFD 0x07 0xF7
+
+name 18f96j94
+using 18f66j94
+configword 0x00FFF8 0xFB 0xFB
+
+name 18f96j99
+using 18f66j99
+configword 0x017FF8 0xFB 0xFB
+
+name 18f97j60
+using 18f67j10
+ramsize 4096
+configword 0x01FFFC 0xF8 0xF8
+configword 0x01FFFD 0x07 0xF7
+
+name 18f97j94
+using 18f67j94
+configword 0x01FFF8 0xFB 0xFB
+
+name 18f242
+ramsize 768
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0x27 0x27
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x0F 0x0F
+configword 0x300005 0x01 0x01
+configword 0x300006 0x85 0x85
+configword 0x300008 0x03 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f248
+ramsize 768
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0x27 0x27
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x0F 0x0F
+configword 0x300006 0x85 0x85
+configword 0x300008 0x03 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f252
+using 18f242
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f258
+using 18f248
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f442
+using 18f242
+
+name 18f448
+using 18f248
+
+name 18f452
+using 18f242
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f458
+using 18f248
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f1220
+ramsize 256
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0xCF
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x80 0x80
+configword 0x300006 0x85 0x85
+configword 0x300008 0x03 0x03
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f1230
+ramsize 256
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300004 0x0E 0x0E
+configword 0x300005 0x89 0x81
+configword 0x300006 0xF1 0x81 0xBF
+configword 0x300008 0x03 0x03
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f1320
+using 18f1220
+
+name 18f1330
+using 18f1230
+
+name 18f2220
+using 18f242
+ramsize 512
+configword 0x300001 0xCF 0xCF
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x83 0x83
+
+name 18f2221
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f2320
+ramsize 512
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0xCF
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x83 0x83
+configword 0x300006 0x85 0x85
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f2321
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f2331
+ramsize 768
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0xCF
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x3F 0x3F
+configword 0x300004 0x3C 0x3C
+configword 0x300005 0x80 0x9D
+configword 0x300006 0x85 0x85
+configword 0x300008 0x03 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x03 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x03 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f2410
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18f2420
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18f2423
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18f2431
+using 18f2331
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f2439
+using 18f248
+ramsize 640
+split 0x80
+configword 0x300001 0x07 0x22
+
+name 18f2450
+# 0x200..0x3FF is not implemented, but we leave that to the linker ;-)
+ramsize 1280
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x3F 0x00
+configword 0x300001 0xCF 0x05
+configword 0x300002 0x3F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x86 0x82
+configword 0x300006 0xCD 0x85 0xBF
+configword 0x300008 0x03 0x03
+configword 0x300009 0x40 0x40
+configword 0x30000A 0x03 0x03
+configword 0x30000B 0x60 0x60
+configword 0x30000C 0x03 0x03
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f2455
+ramsize 2048
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x3F 0x00
+configword 0x300001 0xCF 0x05
+configword 0x300002 0x3F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x87 0x83
+configword 0x300006 0xC5 0x85 0xBF
+configword 0x300008 0x07 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x07 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x07 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f2458
+using 18f2455
+
+name 18f2480
+using 18f23k20
+ramsize 768
+configword 0x300005 0x86 0x82
+configword 0x300006 0xD5 0x85 0xBF
+
+name 18f2510
+ramsize 1536
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x87 0x83
+configword 0x300006 0xC5 0x85 0xBF
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0x40 0x40
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0x60 0x60
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f2515
+using 18f2510
+ramsize 4096
+configword 0x300008 0x07 0x0F
+configword 0x30000A 0x07 0x0F
+configword 0x30000C 0x07 0x0F
+
+name 18f2520
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18f2523
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18f2525
+ramsize 4096
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x87 0x83
+configword 0x300006 0xC5 0x85 0xBF
+configword 0x300008 0x07 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x07 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x07 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f2539
+ramsize 1408
+split 0x80
+configrange 0x300001 0x30000D
+configword 0x300001 0x07 0x22
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x0F 0x0F
+configword 0x300006 0x85 0x85
+configword 0x300008 0x07 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x07 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x07 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f2550
+using 18f2455
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f2553
+using 18f2455
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f2580
+ramsize 1536
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x86 0x82
+configword 0x300006 0xD5 0x85 0xBF
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f2585
+using 18f2525
+split 0x60
+configword 0x300005 0x86 0x82
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f2610
+using 18f2510
+ramsize 4096
+
+name 18f2620
+using 18f2510
+ramsize 4096
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18f2680
+using 18f2580
+ramsize 4096
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f2682
+ramsize 4096
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x86 0x82
+configword 0x300006 0xF5 0x85 0xBF
+configword 0x300008 0x1F 0x3F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x1F 0x3F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x1F 0x3F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f2685
+using 18f2682
+configword 0x300008 0x3F 0x3F
+configword 0x30000A 0x3F 0x3F
+configword 0x30000C 0x3F 0x3F
+
+name 18f4220
+using 18f2320
+configword 0x300008 0x03 0x0F
+configword 0x30000A 0x03 0x0F
+configword 0x30000C 0x03 0x0F
+
+name 18f4221
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f4320
+using 18f2320
+
+name 18f4321
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f4331
+using 18f2331
+configword 0x300005 0x9D 0x9D
+
+name 18f4410
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18f4420
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18f4423
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18f4431
+ramsize 768
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0xCF
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x3F 0x3F
+configword 0x300004 0x3C 0x3C
+configword 0x300005 0x9D 0x9D
+configword 0x300006 0x85 0x85
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f4439
+using 18f248
+ramsize 640
+split 0x80
+configword 0x300001 0x07 0x22
+
+name 18f4450
+using 18f2450
+configword 0x300006 0xED 0x85 0xBF
+
+name 18f4455
+using 18f2455
+configword 0x300006 0xE5 0x85 0xBF
+
+name 18f4458
+using 18f2455
+configword 0x300006 0xE5 0x85 0xBF
+
+name 18f4480
+using 18f23k20
+ramsize 768
+configword 0x300005 0x86 0x82
+configword 0x300006 0xD5 0x85 0xBF
+
+name 18f4510
+using 18f2510
+
+name 18f4515
+using 18f2525
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18f4520
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18f4523
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18f4525
+using 18f2525
+
+name 18f4539
+using 18f2539
+
+name 18f4550
+ramsize 2048
+split 0x60
+configrange 0x300000 0x30000D
+configword 0x300000 0x3F 0x00
+configword 0x300001 0xCF 0x05
+configword 0x300002 0x3F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x87 0x83
+configword 0x300006 0xE5 0x85 0xBF
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f4553
+using 18f4550
+
+name 18f4580
+using 18f2580
+
+name 18f4585
+using 18f2525
+split 0x60
+configword 0x300005 0x86 0x82
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f4610
+using 18f2510
+ramsize 4096
+
+name 18f4620
+using 18f2510
+ramsize 4096
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18f4680
+using 18f2580
+ramsize 4096
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18f4682
+using 18f2682
+
+name 18f4685
+using 18f2682
+configword 0x300008 0x3F 0x3F
+configword 0x30000A 0x3F 0x3F
+configword 0x30000C 0x3F 0x3F
+
+name 18f6310
+ramsize 768
+split 0x60
+configrange 0x300001 0x30000C
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300004 0x00 0xC3
+configword 0x300005 0x85 0x81
+configword 0x300006 0xC1 0x81 0xBF
+configword 0x300008 0x01 0x01
+configword 0x30000C 0x00 0x01
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f6390
+ramsize 768
+split 0x60
+configrange 0x300001 0x300008
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x85 0x81
+configword 0x300006 0xC1 0x81 0xBF
+configword 0x300008 0x01 0x01
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f6393
+using 18f6390
+
+name 18f6410
+using 18f6310
+
+name 18f6490
+using 18f6390
+
+name 18f6493
+using 18f6390
+
+name 18f6520
+ramsize 2048
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0x27 0x27
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x0F 0x0F
+configword 0x300004 0x00 0x83
+configword 0x300005 0x01 0x03
+configword 0x300006 0x85 0x85
+configword 0x300008 0x0F 0xFF
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0xFF
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0xFF
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f6525
+ramsize 3840
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0x2F 0x2F
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x1F 0x1F
+configword 0x300004 0x00 0x83
+configword 0x300005 0x81 0x83
+configword 0x300006 0x85 0x85
+configword 0x300008 0x07 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x07 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x07 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f6527
+ramsize 3936
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x85 0x81
+configword 0x300006 0xF5 0x85 0xBF
+configword 0x300008 0x07 0xFF
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x07 0xFF
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x07 0xFF
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f6585
+using 18f6525
+ramsize 3328
+
+name 18f6620
+using 18f6520
+ramsize 3840
+
+name 18f6621
+using 18f6525
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f6622
+using 18f6527
+configword 0x300008 0x0F 0xFF
+configword 0x30000A 0x0F 0xFF
+configword 0x30000C 0x0F 0xFF
+
+name 18f6627
+ramsize 3936
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300005 0x85 0x83
+configword 0x300006 0xF5 0x85 0xBF
+configword 0x300008 0x3F 0xFF
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x3F 0xFF
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x3F 0xFF
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f6628
+using 18f6627
+
+name 18f6680
+using 18f6525
+ramsize 3328
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18f6720
+using 18f6520
+ramsize 3840
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18f6722
+using 18f6627
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18f6723
+using 18f6627
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18f8310
+using 18f6310
+configword 0x300004 0xC3 0xC3
+configword 0x30000C 0x01 0x01
+
+name 18f8390
+using 18f6390
+
+name 18f8393
+using 18f6390
+
+name 18f8410
+using 18f6310
+configword 0x300004 0xC3 0xC3
+configword 0x30000C 0x01 0x01
+
+name 18f8490
+using 18f6390
+
+name 18f8493
+using 18f6390
+
+name 18f8520
+using 18f6520
+configword 0x300004 0x83 0x83
+
+name 18f8525
+using 18f6525
+configword 0x300004 0x83 0x83
+configword 0x300005 0x83 0x83
+
+name 18f8527
+ramsize 3936
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0xCF 0x07
+configword 0x300002 0x1F 0x1F
+configword 0x300003 0x1F 0x1F
+configword 0x300004 0xF3 0xF3
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+configword 0x300008 0x07 0xFF
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x07 0xFF
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x07 0xFF
+configword 0x30000D 0x40 0x40
+XINST 1
+idlocrange 0x200000 0x200007
+
+name 18f8585
+using 18f6525
+ramsize 3328
+configword 0x300004 0x83 0x83
+configword 0x300005 0x83 0x83
+
+name 18f8620
+using 18f6520
+ramsize 3840
+configword 0x300004 0x83 0x83
+
+name 18f8621
+ramsize 3840
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0x2F 0x2F
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x1F 0x1F
+configword 0x300004 0x83 0x83
+configword 0x300005 0x83 0x83
+configword 0x300006 0x85 0x85
+configword 0x300008 0x0F 0x0F
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0x0F 0x0F
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0x0F 0x0F
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f8622
+using 18f8527
+configword 0x300008 0x0F 0xFF
+configword 0x30000A 0x0F 0xFF
+configword 0x30000C 0x0F 0xFF
+
+name 18f8627
+using 18f8527
+configword 0x300008 0x3F 0xFF
+configword 0x30000A 0x3F 0xFF
+configword 0x30000C 0x3F 0xFF
+
+name 18f8628
+using 18f8527
+configword 0x300008 0x3F 0xFF
+configword 0x30000A 0x3F 0xFF
+configword 0x30000C 0x3F 0xFF
+
+name 18f8680
+using 18f8621
+ramsize 3328
+
+name 18f8720
+ramsize 3840
+split 0x60
+configrange 0x300001 0x30000D
+configword 0x300001 0x27 0x27
+configword 0x300002 0x0F 0x0F
+configword 0x300003 0x0F 0x0F
+configword 0x300004 0x83 0x83
+configword 0x300005 0x01 0x03
+configword 0x300006 0x85 0x85
+configword 0x300008 0xFF 0xFF
+configword 0x300009 0xC0 0xC0
+configword 0x30000A 0xFF 0xFF
+configword 0x30000B 0xE0 0xE0
+configword 0x30000C 0xFF 0xFF
+configword 0x30000D 0x40 0x40
+idlocrange 0x200000 0x200007
+
+name 18f8722
+using 18f8527
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18f8723
+using 18f8527
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18lf13k22
+using 18f13k22
+
+name 18lf13k50
+using 18f13k50
+
+name 18lf14k22
+using 18f13k22
+ramsize 512
+
+name 18lf14k50
+using 18f13k50
+ramsize 768
+
+name 18lf23k22
+using 18f23k22
+
+name 18lf24j10
+using 18f24j10
+
+name 18lf24j11
+using 18f24j11
+
+name 18lf24j50
+using 18f24j11
+configword 0x003FF8 0x6F 0xEF 0xBF
+configword 0x003FF9 0x07 0xF7
+
+name 18lf24k22
+using 18f23k22
+ramsize 768
+
+name 18lf24k50
+using 18f24k50
+
+name 18lf25j10
+using 18f25j10
+
+name 18lf25j11
+using 18f25j11
+
+name 18lf25j50
+using 18f25j11
+configword 0x007FF8 0x6F 0xEF 0xBF
+configword 0x007FF9 0x07 0xF7
+
+name 18lf25k22
+using 18f23k22
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf25k50
+using 18f45k50
+configword 0x300006 0xE5 0xA5 0xBF
+
+name 18lf25k80
+using 18f25k80
+
+name 18lf26j11
+using 18f26j11
+
+name 18lf26j13
+using 18f26j13
+
+name 18lf26j50
+using 18f26j11
+configword 0x00FFF8 0x6F 0xEF 0xBF
+configword 0x00FFF9 0x07 0xF7
+
+name 18lf26j53
+using 18f26j13
+ramsize 3776
+configword 0x00FFF9 0x07 0xF7
+configword 0x00FFFD 0x0B 0xFB
+configword 0x00FFFF 0x0B 0xFB
+
+name 18lf26k22
+using 18f23k22
+ramsize 3936
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf26k80
+using 18f25k80
+
+name 18lf27j13
+using 18f27j13
+
+name 18lf27j53
+using 18f27j13
+ramsize 3776
+configword 0x01FFF9 0x07 0xF7
+configword 0x01FFFD 0x0B 0xFB
+configword 0x01FFFF 0x0B 0xFB
+
+name 18lf43k22
+using 18f23k22
+
+name 18lf44j10
+using 18f24j10
+
+name 18lf44j11
+using 18f24j11
+
+name 18lf44j50
+using 18f24j11
+configword 0x003FF8 0x6F 0xEF 0xBF
+configword 0x003FF9 0x07 0xF7
+
+name 18lf44k22
+using 18f23k22
+ramsize 768
+
+name 18lf45j10
+using 18f25j10
+
+name 18lf45j11
+using 18f25j11
+
+name 18lf45j50
+using 18f25j11
+configword 0x007FF8 0x6F 0xEF 0xBF
+configword 0x007FF9 0x07 0xF7
+
+name 18lf45k22
+using 18f23k22
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf45k50
+using 18f45k50
+
+name 18lf45k80
+using 18f25k80
+
+name 18lf46j11
+using 18f26j11
+
+name 18lf46j13
+using 18f26j13
+
+name 18lf46j50
+using 18f26j11
+configword 0x00FFF8 0x6F 0xEF 0xBF
+configword 0x00FFF9 0x07 0xF7
+
+name 18lf46j53
+using 18f26j13
+ramsize 3776
+configword 0x00FFF9 0x07 0xF7
+configword 0x00FFFD 0x0B 0xFB
+configword 0x00FFFF 0x0B 0xFB
+
+name 18lf46k22
+using 18f23k22
+ramsize 3936
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf46k80
+using 18f25k80
+
+name 18lf47j13
+using 18f27j13
+
+name 18lf47j53
+using 18f27j13
+ramsize 3776
+configword 0x01FFF9 0x07 0xF7
+configword 0x01FFFD 0x0B 0xFB
+configword 0x01FFFF 0x0B 0xFB
+
+name 18lf65k80
+using 18f25k80
+configword 0x300005 0x8F 0x8F
+
+name 18lf66k80
+using 18f25k80
+configword 0x300005 0x8F 0x8F
+
+name 18lf242
+using 18f242
+
+name 18lf248
+using 18f248
+
+name 18lf252
+using 18f242
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf258
+using 18f248
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf442
+using 18f242
+
+name 18lf448
+using 18f248
+
+name 18lf452
+using 18f242
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf458
+using 18f248
+ramsize 1536
+configword 0x300008 0x0F 0x0F
+configword 0x30000A 0x0F 0x0F
+configword 0x30000C 0x0F 0x0F
+
+name 18lf1220
+using 18f1220
+
+name 18lf1230
+using 18f1230
+
+name 18lf1320
+using 18f1220
+
+name 18lf1330
+using 18f1230
+
+name 18lf2220
+using 18f2320
+configword 0x300008 0x03 0x0F
+configword 0x30000A 0x03 0x0F
+configword 0x30000C 0x03 0x0F
+
+name 18lf2221
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf2320
+using 18f2320
+
+name 18lf2321
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf2331
+using 18f2331
+
+name 18lf2410
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18lf2420
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18lf2423
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18lf2431
+using 18f4431
+configword 0x300005 0x80 0x9D
+
+name 18lf2439
+using 18f248
+ramsize 640
+split 0x80
+configword 0x300001 0x07 0x22
+
+name 18lf2450
+# 0x200..0x3FF is not implemented, but we leave that to the linker ;-)
+using 18f2450
+
+name 18lf2455
+using 18f2455
+
+name 18lf2458
+using 18f2455
+
+name 18lf2480
+using 18f23k20
+ramsize 768
+configword 0x300005 0x86 0x82
+configword 0x300006 0xD5 0x85 0xBF
+
+name 18lf2510
+using 18f2510
+
+name 18lf2515
+using 18f2525
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18lf2520
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18lf2523
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18lf2525
+using 18f2525
+
+name 18lf2539
+using 18f2539
+
+name 18lf2550
+using 18f4550
+configword 0x300006 0xC5 0x85 0xBF
+
+name 18lf2553
+using 18f4550
+configword 0x300006 0xC5 0x85 0xBF
+
+name 18lf2580
+using 18f2580
+
+name 18lf2585
+using 18f2525
+split 0x60
+configword 0x300005 0x86 0x82
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf2610
+using 18f2510
+ramsize 4096
+
+name 18lf2620
+using 18f2510
+ramsize 4096
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18lf2680
+using 18f2580
+ramsize 4096
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf2682
+using 18f2682
+
+name 18lf2685
+using 18f2682
+configword 0x300008 0x3F 0x3F
+configword 0x30000A 0x3F 0x3F
+configword 0x30000C 0x3F 0x3F
+
+name 18lf4220
+using 18f2320
+configword 0x300008 0x03 0x0F
+configword 0x30000A 0x03 0x0F
+configword 0x30000C 0x03 0x0F
+
+name 18lf4221
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf4320
+using 18f2320
+
+name 18lf4321
+using 18f13k22
+ramsize 512
+split 0x80
+configword 0x300001 0xCF 0x07
+configword 0x300005 0x87 0x83
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf4331
+using 18f2331
+configword 0x300005 0x9D 0x9D
+
+name 18lf4410
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18lf4420
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18lf4423
+using 18f23k20
+ramsize 768
+split 0x80
+configword 0x300005 0x87 0x83
+
+name 18lf4431
+using 18f4431
+
+name 18lf4439
+using 18f248
+ramsize 640
+split 0x80
+configword 0x300001 0x07 0x22
+
+name 18lf4450
+using 18f2450
+configword 0x300006 0xED 0x85 0xBF
+
+name 18lf4455
+using 18f2455
+configword 0x300006 0xE5 0x85 0xBF
+
+name 18lf4458
+using 18f2455
+configword 0x300006 0xE5 0x85 0xBF
+
+name 18lf4480
+using 18f23k20
+ramsize 768
+configword 0x300005 0x86 0x82
+configword 0x300006 0xD5 0x85 0xBF
+
+name 18lf4510
+using 18f2510
+
+name 18lf4515
+using 18f2525
+configword 0x300009 0x40 0x40
+configword 0x30000B 0x60 0x60
+
+name 18lf4520
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18lf4523
+using 18f2510
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18lf4525
+using 18f2525
+
+name 18lf4539
+using 18f2539
+
+name 18lf4550
+using 18f4550
+
+name 18lf4553
+using 18f4550
+
+name 18lf4580
+using 18f2580
+
+name 18lf4585
+using 18f2525
+split 0x60
+configword 0x300005 0x86 0x82
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf4610
+using 18f2510
+ramsize 4096
+
+name 18lf4620
+using 18f2510
+ramsize 4096
+configword 0x300009 0xC0 0xC0
+configword 0x30000B 0xE0 0xE0
+
+name 18lf4680
+using 18f2580
+ramsize 4096
+configword 0x300006 0xF5 0x85 0xBF
+
+name 18lf4682
+using 18f2682
+
+name 18lf4685
+using 18f2682
+configword 0x300008 0x3F 0x3F
+configword 0x30000A 0x3F 0x3F
+configword 0x30000C 0x3F 0x3F
+
+name 18lf6310
+using 18f6310
+
+name 18lf6390
+using 18f6390
+
+name 18lf6393
+using 18f6390
+
+name 18lf6410
+using 18f6310
+
+name 18lf6490
+using 18f6390
+
+name 18lf6493
+using 18f6390
+
+name 18lf6520
+using 18f6520
+
+name 18lf6525
+using 18f6525
+
+name 18lf6527
+using 18f6527
+
+name 18lf6585
+using 18f6525
+ramsize 3328
+
+name 18lf6620
+using 18f6520
+ramsize 3840
+
+name 18lf6621
+using 18f8621
+configword 0x300004 0x00 0x83
+configword 0x300005 0x81 0x83
+
+name 18lf6622
+using 18f6527
+configword 0x300008 0x0F 0xFF
+configword 0x30000A 0x0F 0xFF
+configword 0x30000C 0x0F 0xFF
+
+name 18lf6627
+using 18f6627
+
+name 18lf6628
+using 18f6627
+
+name 18lf6680
+using 18f8621
+ramsize 3328
+configword 0x300004 0x00 0x83
+configword 0x300005 0x81 0x83
+
+name 18lf6720
+using 18f8720
+configword 0x300004 0x00 0x83
+
+name 18lf6722
+using 18f6627
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18lf6723
+using 18f6627
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18lf8310
+using 18f6310
+configword 0x300004 0xC3 0xC3
+configword 0x30000C 0x01 0x01
+
+name 18lf8390
+using 18f6390
+
+name 18lf8393
+using 18f6390
+
+name 18lf8410
+using 18f6310
+configword 0x300004 0xC3 0xC3
+configword 0x30000C 0x01 0x01
+
+name 18lf8490
+using 18f6390
+
+name 18lf8493
+using 18f6390
+
+name 18lf8520
+using 18f6520
+configword 0x300004 0x83 0x83
+
+name 18lf8525
+using 18f6525
+configword 0x300004 0x83 0x83
+configword 0x300005 0x83 0x83
+
+name 18lf8527
+using 18f8527
+
+name 18lf8585
+using 18f6525
+ramsize 3328
+configword 0x300004 0x83 0x83
+configword 0x300005 0x83 0x83
+
+name 18lf8620
+using 18f6520
+ramsize 3840
+configword 0x300004 0x83 0x83
+
+name 18lf8621
+using 18f8621
+
+name 18lf8622
+using 18f8527
+configword 0x300008 0x0F 0xFF
+configword 0x30000A 0x0F 0xFF
+configword 0x30000C 0x0F 0xFF
+
+name 18lf8627
+using 18f8527
+configword 0x300008 0x3F 0xFF
+configword 0x30000A 0x3F 0xFF
+configword 0x30000C 0x3F 0xFF
+
+name 18lf8628
+using 18f8527
+configword 0x300008 0x3F 0xFF
+configword 0x30000A 0x3F 0xFF
+configword 0x30000C 0x3F 0xFF
+
+name 18lf8680
+using 18f8621
+ramsize 3328
+
+name 18lf8720
+using 18f8720
+
+name 18lf8722
+using 18f8527
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
+
+name 18lf8723
+using 18f8527
+configword 0x300008 0xFF 0xFF
+configword 0x30000A 0xFF 0xFF
+configword 0x30000C 0xFF 0xFF
diff --git a/device/include/pic16/pic18fregs.h b/device/include/pic16/pic18fregs.h
new file mode 100644
index 0000000..bb161c1
--- /dev/null
+++ b/device/include/pic16/pic18fregs.h
@@ -0,0 +1,1217 @@
+/*
+ *
+ * This file is generated automatically by the device-manager.pl program.
+ *
+ * Copyright (C) 2012-2015, Molnar Karoly <molnarkaroly@users.sf.net>
+ *
+ */
+
+#ifndef __PIC18FREGS_H__
+#define __PIC18FREGS_H__
+
+#if defined(__SDCC_PIC18F13K22)
+ #include <pic18f13k22.h>
+
+#elif defined(__SDCC_PIC18F13K50)
+ #include <pic18f13k50.h>
+
+#elif defined(__SDCC_PIC18F14K22)
+ #include <pic18f14k22.h>
+
+#elif defined(__SDCC_PIC18F14K50)
+ #include <pic18f14k50.h>
+
+#elif defined(__SDCC_PIC18F23K20)
+ #include <pic18f23k20.h>
+
+#elif defined(__SDCC_PIC18F23K22)
+ #include <pic18f23k22.h>
+
+#elif defined(__SDCC_PIC18F24J10)
+ #include <pic18f24j10.h>
+
+#elif defined(__SDCC_PIC18F24J11)
+ #include <pic18f24j11.h>
+
+#elif defined(__SDCC_PIC18F24J50)
+ #include <pic18f24j50.h>
+
+#elif defined(__SDCC_PIC18F24K20)
+ #include <pic18f24k20.h>
+
+#elif defined(__SDCC_PIC18F24K22)
+ #include <pic18f24k22.h>
+
+#elif defined(__SDCC_PIC18F24K50)
+ #include <pic18f24k50.h>
+
+#elif defined(__SDCC_PIC18F25J10)
+ #include <pic18f25j10.h>
+
+#elif defined(__SDCC_PIC18F25J11)
+ #include <pic18f25j11.h>
+
+#elif defined(__SDCC_PIC18F25J50)
+ #include <pic18f25j50.h>
+
+#elif defined(__SDCC_PIC18F25K20)
+ #include <pic18f25k20.h>
+
+#elif defined(__SDCC_PIC18F25K22)
+ #include <pic18f25k22.h>
+
+#elif defined(__SDCC_PIC18F25K50)
+ #include <pic18f25k50.h>
+
+#elif defined(__SDCC_PIC18F25K80)
+ #include <pic18f25k80.h>
+
+#elif defined(__SDCC_PIC18F26J11)
+ #include <pic18f26j11.h>
+
+#elif defined(__SDCC_PIC18F26J13)
+ #include <pic18f26j13.h>
+
+#elif defined(__SDCC_PIC18F26J50)
+ #include <pic18f26j50.h>
+
+#elif defined(__SDCC_PIC18F26J53)
+ #include <pic18f26j53.h>
+
+#elif defined(__SDCC_PIC18F26K20)
+ #include <pic18f26k20.h>
+
+#elif defined(__SDCC_PIC18F26K22)
+ #include <pic18f26k22.h>
+
+#elif defined(__SDCC_PIC18F26K80)
+ #include <pic18f26k80.h>
+
+#elif defined(__SDCC_PIC18F27J13)
+ #include <pic18f27j13.h>
+
+#elif defined(__SDCC_PIC18F27J53)
+ #include <pic18f27j53.h>
+
+#elif defined(__SDCC_PIC18F43K20)
+ #include <pic18f43k20.h>
+
+#elif defined(__SDCC_PIC18F43K22)
+ #include <pic18f43k22.h>
+
+#elif defined(__SDCC_PIC18F44J10)
+ #include <pic18f44j10.h>
+
+#elif defined(__SDCC_PIC18F44J11)
+ #include <pic18f44j11.h>
+
+#elif defined(__SDCC_PIC18F44J50)
+ #include <pic18f44j50.h>
+
+#elif defined(__SDCC_PIC18F44K20)
+ #include <pic18f44k20.h>
+
+#elif defined(__SDCC_PIC18F44K22)
+ #include <pic18f44k22.h>
+
+#elif defined(__SDCC_PIC18F45J10)
+ #include <pic18f45j10.h>
+
+#elif defined(__SDCC_PIC18F45J11)
+ #include <pic18f45j11.h>
+
+#elif defined(__SDCC_PIC18F45J50)
+ #include <pic18f45j50.h>
+
+#elif defined(__SDCC_PIC18F45K20)
+ #include <pic18f45k20.h>
+
+#elif defined(__SDCC_PIC18F45K22)
+ #include <pic18f45k22.h>
+
+#elif defined(__SDCC_PIC18F45K50)
+ #include <pic18f45k50.h>
+
+#elif defined(__SDCC_PIC18F45K80)
+ #include <pic18f45k80.h>
+
+#elif defined(__SDCC_PIC18F46J11)
+ #include <pic18f46j11.h>
+
+#elif defined(__SDCC_PIC18F46J13)
+ #include <pic18f46j13.h>
+
+#elif defined(__SDCC_PIC18F46J50)
+ #include <pic18f46j50.h>
+
+#elif defined(__SDCC_PIC18F46J53)
+ #include <pic18f46j53.h>
+
+#elif defined(__SDCC_PIC18F46K20)
+ #include <pic18f46k20.h>
+
+#elif defined(__SDCC_PIC18F46K22)
+ #include <pic18f46k22.h>
+
+#elif defined(__SDCC_PIC18F46K80)
+ #include <pic18f46k80.h>
+
+#elif defined(__SDCC_PIC18F47J13)
+ #include <pic18f47j13.h>
+
+#elif defined(__SDCC_PIC18F47J53)
+ #include <pic18f47j53.h>
+
+#elif defined(__SDCC_PIC18F63J11)
+ #include <pic18f63j11.h>
+
+#elif defined(__SDCC_PIC18F63J90)
+ #include <pic18f63j90.h>
+
+#elif defined(__SDCC_PIC18F64J11)
+ #include <pic18f64j11.h>
+
+#elif defined(__SDCC_PIC18F64J90)
+ #include <pic18f64j90.h>
+
+#elif defined(__SDCC_PIC18F65J10)
+ #include <pic18f65j10.h>
+
+#elif defined(__SDCC_PIC18F65J11)
+ #include <pic18f65j11.h>
+
+#elif defined(__SDCC_PIC18F65J15)
+ #include <pic18f65j15.h>
+
+#elif defined(__SDCC_PIC18F65J50)
+ #include <pic18f65j50.h>
+
+#elif defined(__SDCC_PIC18F65J90)
+ #include <pic18f65j90.h>
+
+#elif defined(__SDCC_PIC18F65J94)
+ #include <pic18f65j94.h>
+
+#elif defined(__SDCC_PIC18F65K22)
+ #include <pic18f65k22.h>
+
+#elif defined(__SDCC_PIC18F65K80)
+ #include <pic18f65k80.h>
+
+#elif defined(__SDCC_PIC18F65K90)
+ #include <pic18f65k90.h>
+
+#elif defined(__SDCC_PIC18F66J10)
+ #include <pic18f66j10.h>
+
+#elif defined(__SDCC_PIC18F66J11)
+ #include <pic18f66j11.h>
+
+#elif defined(__SDCC_PIC18F66J15)
+ #include <pic18f66j15.h>
+
+#elif defined(__SDCC_PIC18F66J16)
+ #include <pic18f66j16.h>
+
+#elif defined(__SDCC_PIC18F66J50)
+ #include <pic18f66j50.h>
+
+#elif defined(__SDCC_PIC18F66J55)
+ #include <pic18f66j55.h>
+
+#elif defined(__SDCC_PIC18F66J60)
+ #include <pic18f66j60.h>
+
+#elif defined(__SDCC_PIC18F66J65)
+ #include <pic18f66j65.h>
+
+#elif defined(__SDCC_PIC18F66J90)
+ #include <pic18f66j90.h>
+
+#elif defined(__SDCC_PIC18F66J93)
+ #include <pic18f66j93.h>
+
+#elif defined(__SDCC_PIC18F66J94)
+ #include <pic18f66j94.h>
+
+#elif defined(__SDCC_PIC18F66J99)
+ #include <pic18f66j99.h>
+
+#elif defined(__SDCC_PIC18F66K22)
+ #include <pic18f66k22.h>
+
+#elif defined(__SDCC_PIC18F66K80)
+ #include <pic18f66k80.h>
+
+#elif defined(__SDCC_PIC18F66K90)
+ #include <pic18f66k90.h>
+
+#elif defined(__SDCC_PIC18F67J10)
+ #include <pic18f67j10.h>
+
+#elif defined(__SDCC_PIC18F67J11)
+ #include <pic18f67j11.h>
+
+#elif defined(__SDCC_PIC18F67J50)
+ #include <pic18f67j50.h>
+
+#elif defined(__SDCC_PIC18F67J60)
+ #include <pic18f67j60.h>
+
+#elif defined(__SDCC_PIC18F67J90)
+ #include <pic18f67j90.h>
+
+#elif defined(__SDCC_PIC18F67J93)
+ #include <pic18f67j93.h>
+
+#elif defined(__SDCC_PIC18F67J94)
+ #include <pic18f67j94.h>
+
+#elif defined(__SDCC_PIC18F67K22)
+ #include <pic18f67k22.h>
+
+#elif defined(__SDCC_PIC18F67K90)
+ #include <pic18f67k90.h>
+
+#elif defined(__SDCC_PIC18F83J11)
+ #include <pic18f83j11.h>
+
+#elif defined(__SDCC_PIC18F83J90)
+ #include <pic18f83j90.h>
+
+#elif defined(__SDCC_PIC18F84J11)
+ #include <pic18f84j11.h>
+
+#elif defined(__SDCC_PIC18F84J90)
+ #include <pic18f84j90.h>
+
+#elif defined(__SDCC_PIC18F85J10)
+ #include <pic18f85j10.h>
+
+#elif defined(__SDCC_PIC18F85J11)
+ #include <pic18f85j11.h>
+
+#elif defined(__SDCC_PIC18F85J15)
+ #include <pic18f85j15.h>
+
+#elif defined(__SDCC_PIC18F85J50)
+ #include <pic18f85j50.h>
+
+#elif defined(__SDCC_PIC18F85J90)
+ #include <pic18f85j90.h>
+
+#elif defined(__SDCC_PIC18F85J94)
+ #include <pic18f85j94.h>
+
+#elif defined(__SDCC_PIC18F85K22)
+ #include <pic18f85k22.h>
+
+#elif defined(__SDCC_PIC18F85K90)
+ #include <pic18f85k90.h>
+
+#elif defined(__SDCC_PIC18F86J10)
+ #include <pic18f86j10.h>
+
+#elif defined(__SDCC_PIC18F86J11)
+ #include <pic18f86j11.h>
+
+#elif defined(__SDCC_PIC18F86J15)
+ #include <pic18f86j15.h>
+
+#elif defined(__SDCC_PIC18F86J16)
+ #include <pic18f86j16.h>
+
+#elif defined(__SDCC_PIC18F86J50)
+ #include <pic18f86j50.h>
+
+#elif defined(__SDCC_PIC18F86J55)
+ #include <pic18f86j55.h>
+
+#elif defined(__SDCC_PIC18F86J60)
+ #include <pic18f86j60.h>
+
+#elif defined(__SDCC_PIC18F86J65)
+ #include <pic18f86j65.h>
+
+#elif defined(__SDCC_PIC18F86J72)
+ #include <pic18f86j72.h>
+
+#elif defined(__SDCC_PIC18F86J90)
+ #include <pic18f86j90.h>
+
+#elif defined(__SDCC_PIC18F86J93)
+ #include <pic18f86j93.h>
+
+#elif defined(__SDCC_PIC18F86J94)
+ #include <pic18f86j94.h>
+
+#elif defined(__SDCC_PIC18F86J99)
+ #include <pic18f86j99.h>
+
+#elif defined(__SDCC_PIC18F86K22)
+ #include <pic18f86k22.h>
+
+#elif defined(__SDCC_PIC18F86K90)
+ #include <pic18f86k90.h>
+
+#elif defined(__SDCC_PIC18F87J10)
+ #include <pic18f87j10.h>
+
+#elif defined(__SDCC_PIC18F87J11)
+ #include <pic18f87j11.h>
+
+#elif defined(__SDCC_PIC18F87J50)
+ #include <pic18f87j50.h>
+
+#elif defined(__SDCC_PIC18F87J60)
+ #include <pic18f87j60.h>
+
+#elif defined(__SDCC_PIC18F87J72)
+ #include <pic18f87j72.h>
+
+#elif defined(__SDCC_PIC18F87J90)
+ #include <pic18f87j90.h>
+
+#elif defined(__SDCC_PIC18F87J93)
+ #include <pic18f87j93.h>
+
+#elif defined(__SDCC_PIC18F87J94)
+ #include <pic18f87j94.h>
+
+#elif defined(__SDCC_PIC18F87K22)
+ #include <pic18f87k22.h>
+
+#elif defined(__SDCC_PIC18F87K90)
+ #include <pic18f87k90.h>
+
+#elif defined(__SDCC_PIC18F95J94)
+ #include <pic18f95j94.h>
+
+#elif defined(__SDCC_PIC18F96J60)
+ #include <pic18f96j60.h>
+
+#elif defined(__SDCC_PIC18F96J65)
+ #include <pic18f96j65.h>
+
+#elif defined(__SDCC_PIC18F96J94)
+ #include <pic18f96j94.h>
+
+#elif defined(__SDCC_PIC18F96J99)
+ #include <pic18f96j99.h>
+
+#elif defined(__SDCC_PIC18F97J60)
+ #include <pic18f97j60.h>
+
+#elif defined(__SDCC_PIC18F97J94)
+ #include <pic18f97j94.h>
+
+#elif defined(__SDCC_PIC18F242)
+ #include <pic18f242.h>
+
+#elif defined(__SDCC_PIC18F248)
+ #include <pic18f248.h>
+
+#elif defined(__SDCC_PIC18F252)
+ #include <pic18f252.h>
+
+#elif defined(__SDCC_PIC18F258)
+ #include <pic18f258.h>
+
+#elif defined(__SDCC_PIC18F442)
+ #include <pic18f442.h>
+
+#elif defined(__SDCC_PIC18F448)
+ #include <pic18f448.h>
+
+#elif defined(__SDCC_PIC18F452)
+ #include <pic18f452.h>
+
+#elif defined(__SDCC_PIC18F458)
+ #include <pic18f458.h>
+
+#elif defined(__SDCC_PIC18F1220)
+ #include <pic18f1220.h>
+
+#elif defined(__SDCC_PIC18F1230)
+ #include <pic18f1230.h>
+
+#elif defined(__SDCC_PIC18F1320)
+ #include <pic18f1320.h>
+
+#elif defined(__SDCC_PIC18F1330)
+ #include <pic18f1330.h>
+
+#elif defined(__SDCC_PIC18F2220)
+ #include <pic18f2220.h>
+
+#elif defined(__SDCC_PIC18F2221)
+ #include <pic18f2221.h>
+
+#elif defined(__SDCC_PIC18F2320)
+ #include <pic18f2320.h>
+
+#elif defined(__SDCC_PIC18F2321)
+ #include <pic18f2321.h>
+
+#elif defined(__SDCC_PIC18F2331)
+ #include <pic18f2331.h>
+
+#elif defined(__SDCC_PIC18F2410)
+ #include <pic18f2410.h>
+
+#elif defined(__SDCC_PIC18F2420)
+ #include <pic18f2420.h>
+
+#elif defined(__SDCC_PIC18F2423)
+ #include <pic18f2423.h>
+
+#elif defined(__SDCC_PIC18F2431)
+ #include <pic18f2431.h>
+
+#elif defined(__SDCC_PIC18F2439)
+ #include <pic18f2439.h>
+
+#elif defined(__SDCC_PIC18F2450)
+ #include <pic18f2450.h>
+
+#elif defined(__SDCC_PIC18F2455)
+ #include <pic18f2455.h>
+
+#elif defined(__SDCC_PIC18F2458)
+ #include <pic18f2458.h>
+
+#elif defined(__SDCC_PIC18F2480)
+ #include <pic18f2480.h>
+
+#elif defined(__SDCC_PIC18F2510)
+ #include <pic18f2510.h>
+
+#elif defined(__SDCC_PIC18F2515)
+ #include <pic18f2515.h>
+
+#elif defined(__SDCC_PIC18F2520)
+ #include <pic18f2520.h>
+
+#elif defined(__SDCC_PIC18F2523)
+ #include <pic18f2523.h>
+
+#elif defined(__SDCC_PIC18F2525)
+ #include <pic18f2525.h>
+
+#elif defined(__SDCC_PIC18F2539)
+ #include <pic18f2539.h>
+
+#elif defined(__SDCC_PIC18F2550)
+ #include <pic18f2550.h>
+
+#elif defined(__SDCC_PIC18F2553)
+ #include <pic18f2553.h>
+
+#elif defined(__SDCC_PIC18F2580)
+ #include <pic18f2580.h>
+
+#elif defined(__SDCC_PIC18F2585)
+ #include <pic18f2585.h>
+
+#elif defined(__SDCC_PIC18F2610)
+ #include <pic18f2610.h>
+
+#elif defined(__SDCC_PIC18F2620)
+ #include <pic18f2620.h>
+
+#elif defined(__SDCC_PIC18F2680)
+ #include <pic18f2680.h>
+
+#elif defined(__SDCC_PIC18F2682)
+ #include <pic18f2682.h>
+
+#elif defined(__SDCC_PIC18F2685)
+ #include <pic18f2685.h>
+
+#elif defined(__SDCC_PIC18F4220)
+ #include <pic18f4220.h>
+
+#elif defined(__SDCC_PIC18F4221)
+ #include <pic18f4221.h>
+
+#elif defined(__SDCC_PIC18F4320)
+ #include <pic18f4320.h>
+
+#elif defined(__SDCC_PIC18F4321)
+ #include <pic18f4321.h>
+
+#elif defined(__SDCC_PIC18F4331)
+ #include <pic18f4331.h>
+
+#elif defined(__SDCC_PIC18F4410)
+ #include <pic18f4410.h>
+
+#elif defined(__SDCC_PIC18F4420)
+ #include <pic18f4420.h>
+
+#elif defined(__SDCC_PIC18F4423)
+ #include <pic18f4423.h>
+
+#elif defined(__SDCC_PIC18F4431)
+ #include <pic18f4431.h>
+
+#elif defined(__SDCC_PIC18F4439)
+ #include <pic18f4439.h>
+
+#elif defined(__SDCC_PIC18F4450)
+ #include <pic18f4450.h>
+
+#elif defined(__SDCC_PIC18F4455)
+ #include <pic18f4455.h>
+
+#elif defined(__SDCC_PIC18F4458)
+ #include <pic18f4458.h>
+
+#elif defined(__SDCC_PIC18F4480)
+ #include <pic18f4480.h>
+
+#elif defined(__SDCC_PIC18F4510)
+ #include <pic18f4510.h>
+
+#elif defined(__SDCC_PIC18F4515)
+ #include <pic18f4515.h>
+
+#elif defined(__SDCC_PIC18F4520)
+ #include <pic18f4520.h>
+
+#elif defined(__SDCC_PIC18F4523)
+ #include <pic18f4523.h>
+
+#elif defined(__SDCC_PIC18F4525)
+ #include <pic18f4525.h>
+
+#elif defined(__SDCC_PIC18F4539)
+ #include <pic18f4539.h>
+
+#elif defined(__SDCC_PIC18F4550)
+ #include <pic18f4550.h>
+
+#elif defined(__SDCC_PIC18F4553)
+ #include <pic18f4553.h>
+
+#elif defined(__SDCC_PIC18F4580)
+ #include <pic18f4580.h>
+
+#elif defined(__SDCC_PIC18F4585)
+ #include <pic18f4585.h>
+
+#elif defined(__SDCC_PIC18F4610)
+ #include <pic18f4610.h>
+
+#elif defined(__SDCC_PIC18F4620)
+ #include <pic18f4620.h>
+
+#elif defined(__SDCC_PIC18F4680)
+ #include <pic18f4680.h>
+
+#elif defined(__SDCC_PIC18F4682)
+ #include <pic18f4682.h>
+
+#elif defined(__SDCC_PIC18F4685)
+ #include <pic18f4685.h>
+
+#elif defined(__SDCC_PIC18F6310)
+ #include <pic18f6310.h>
+
+#elif defined(__SDCC_PIC18F6390)
+ #include <pic18f6390.h>
+
+#elif defined(__SDCC_PIC18F6393)
+ #include <pic18f6393.h>
+
+#elif defined(__SDCC_PIC18F6410)
+ #include <pic18f6410.h>
+
+#elif defined(__SDCC_PIC18F6490)
+ #include <pic18f6490.h>
+
+#elif defined(__SDCC_PIC18F6493)
+ #include <pic18f6493.h>
+
+#elif defined(__SDCC_PIC18F6520)
+ #include <pic18f6520.h>
+
+#elif defined(__SDCC_PIC18F6525)
+ #include <pic18f6525.h>
+
+#elif defined(__SDCC_PIC18F6527)
+ #include <pic18f6527.h>
+
+#elif defined(__SDCC_PIC18F6585)
+ #include <pic18f6585.h>
+
+#elif defined(__SDCC_PIC18F6620)
+ #include <pic18f6620.h>
+
+#elif defined(__SDCC_PIC18F6621)
+ #include <pic18f6621.h>
+
+#elif defined(__SDCC_PIC18F6622)
+ #include <pic18f6622.h>
+
+#elif defined(__SDCC_PIC18F6627)
+ #include <pic18f6627.h>
+
+#elif defined(__SDCC_PIC18F6628)
+ #include <pic18f6628.h>
+
+#elif defined(__SDCC_PIC18F6680)
+ #include <pic18f6680.h>
+
+#elif defined(__SDCC_PIC18F6720)
+ #include <pic18f6720.h>
+
+#elif defined(__SDCC_PIC18F6722)
+ #include <pic18f6722.h>
+
+#elif defined(__SDCC_PIC18F6723)
+ #include <pic18f6723.h>
+
+#elif defined(__SDCC_PIC18F8310)
+ #include <pic18f8310.h>
+
+#elif defined(__SDCC_PIC18F8390)
+ #include <pic18f8390.h>
+
+#elif defined(__SDCC_PIC18F8393)
+ #include <pic18f8393.h>
+
+#elif defined(__SDCC_PIC18F8410)
+ #include <pic18f8410.h>
+
+#elif defined(__SDCC_PIC18F8490)
+ #include <pic18f8490.h>
+
+#elif defined(__SDCC_PIC18F8493)
+ #include <pic18f8493.h>
+
+#elif defined(__SDCC_PIC18F8520)
+ #include <pic18f8520.h>
+
+#elif defined(__SDCC_PIC18F8525)
+ #include <pic18f8525.h>
+
+#elif defined(__SDCC_PIC18F8527)
+ #include <pic18f8527.h>
+
+#elif defined(__SDCC_PIC18F8585)
+ #include <pic18f8585.h>
+
+#elif defined(__SDCC_PIC18F8620)
+ #include <pic18f8620.h>
+
+#elif defined(__SDCC_PIC18F8621)
+ #include <pic18f8621.h>
+
+#elif defined(__SDCC_PIC18F8622)
+ #include <pic18f8622.h>
+
+#elif defined(__SDCC_PIC18F8627)
+ #include <pic18f8627.h>
+
+#elif defined(__SDCC_PIC18F8628)
+ #include <pic18f8628.h>
+
+#elif defined(__SDCC_PIC18F8680)
+ #include <pic18f8680.h>
+
+#elif defined(__SDCC_PIC18F8720)
+ #include <pic18f8720.h>
+
+#elif defined(__SDCC_PIC18F8722)
+ #include <pic18f8722.h>
+
+#elif defined(__SDCC_PIC18F8723)
+ #include <pic18f8723.h>
+
+#elif defined(__SDCC_PIC18LF13K22)
+ #include <pic18lf13k22.h>
+
+#elif defined(__SDCC_PIC18LF13K50)
+ #include <pic18lf13k50.h>
+
+#elif defined(__SDCC_PIC18LF14K22)
+ #include <pic18lf14k22.h>
+
+#elif defined(__SDCC_PIC18LF14K50)
+ #include <pic18lf14k50.h>
+
+#elif defined(__SDCC_PIC18LF23K22)
+ #include <pic18lf23k22.h>
+
+#elif defined(__SDCC_PIC18LF24J10)
+ #include <pic18lf24j10.h>
+
+#elif defined(__SDCC_PIC18LF24J11)
+ #include <pic18lf24j11.h>
+
+#elif defined(__SDCC_PIC18LF24J50)
+ #include <pic18lf24j50.h>
+
+#elif defined(__SDCC_PIC18LF24K22)
+ #include <pic18lf24k22.h>
+
+#elif defined(__SDCC_PIC18LF24K50)
+ #include <pic18lf24k50.h>
+
+#elif defined(__SDCC_PIC18LF25J10)
+ #include <pic18lf25j10.h>
+
+#elif defined(__SDCC_PIC18LF25J11)
+ #include <pic18lf25j11.h>
+
+#elif defined(__SDCC_PIC18LF25J50)
+ #include <pic18lf25j50.h>
+
+#elif defined(__SDCC_PIC18LF25K22)
+ #include <pic18lf25k22.h>
+
+#elif defined(__SDCC_PIC18LF25K50)
+ #include <pic18lf25k50.h>
+
+#elif defined(__SDCC_PIC18LF25K80)
+ #include <pic18lf25k80.h>
+
+#elif defined(__SDCC_PIC18LF26J11)
+ #include <pic18lf26j11.h>
+
+#elif defined(__SDCC_PIC18LF26J13)
+ #include <pic18lf26j13.h>
+
+#elif defined(__SDCC_PIC18LF26J50)
+ #include <pic18lf26j50.h>
+
+#elif defined(__SDCC_PIC18LF26J53)
+ #include <pic18lf26j53.h>
+
+#elif defined(__SDCC_PIC18LF26K22)
+ #include <pic18lf26k22.h>
+
+#elif defined(__SDCC_PIC18LF26K80)
+ #include <pic18lf26k80.h>
+
+#elif defined(__SDCC_PIC18LF27J13)
+ #include <pic18lf27j13.h>
+
+#elif defined(__SDCC_PIC18LF27J53)
+ #include <pic18lf27j53.h>
+
+#elif defined(__SDCC_PIC18LF43K22)
+ #include <pic18lf43k22.h>
+
+#elif defined(__SDCC_PIC18LF44J10)
+ #include <pic18lf44j10.h>
+
+#elif defined(__SDCC_PIC18LF44J11)
+ #include <pic18lf44j11.h>
+
+#elif defined(__SDCC_PIC18LF44J50)
+ #include <pic18lf44j50.h>
+
+#elif defined(__SDCC_PIC18LF44K22)
+ #include <pic18lf44k22.h>
+
+#elif defined(__SDCC_PIC18LF45J10)
+ #include <pic18lf45j10.h>
+
+#elif defined(__SDCC_PIC18LF45J11)
+ #include <pic18lf45j11.h>
+
+#elif defined(__SDCC_PIC18LF45J50)
+ #include <pic18lf45j50.h>
+
+#elif defined(__SDCC_PIC18LF45K22)
+ #include <pic18lf45k22.h>
+
+#elif defined(__SDCC_PIC18LF45K50)
+ #include <pic18lf45k50.h>
+
+#elif defined(__SDCC_PIC18LF45K80)
+ #include <pic18lf45k80.h>
+
+#elif defined(__SDCC_PIC18LF46J11)
+ #include <pic18lf46j11.h>
+
+#elif defined(__SDCC_PIC18LF46J13)
+ #include <pic18lf46j13.h>
+
+#elif defined(__SDCC_PIC18LF46J50)
+ #include <pic18lf46j50.h>
+
+#elif defined(__SDCC_PIC18LF46J53)
+ #include <pic18lf46j53.h>
+
+#elif defined(__SDCC_PIC18LF46K22)
+ #include <pic18lf46k22.h>
+
+#elif defined(__SDCC_PIC18LF46K80)
+ #include <pic18lf46k80.h>
+
+#elif defined(__SDCC_PIC18LF47J13)
+ #include <pic18lf47j13.h>
+
+#elif defined(__SDCC_PIC18LF47J53)
+ #include <pic18lf47j53.h>
+
+#elif defined(__SDCC_PIC18LF65K80)
+ #include <pic18lf65k80.h>
+
+#elif defined(__SDCC_PIC18LF66K80)
+ #include <pic18lf66k80.h>
+
+#elif defined(__SDCC_PIC18LF242)
+ #include <pic18lf242.h>
+
+#elif defined(__SDCC_PIC18LF248)
+ #include <pic18lf248.h>
+
+#elif defined(__SDCC_PIC18LF252)
+ #include <pic18lf252.h>
+
+#elif defined(__SDCC_PIC18LF258)
+ #include <pic18lf258.h>
+
+#elif defined(__SDCC_PIC18LF442)
+ #include <pic18lf442.h>
+
+#elif defined(__SDCC_PIC18LF448)
+ #include <pic18lf448.h>
+
+#elif defined(__SDCC_PIC18LF452)
+ #include <pic18lf452.h>
+
+#elif defined(__SDCC_PIC18LF458)
+ #include <pic18lf458.h>
+
+#elif defined(__SDCC_PIC18LF1220)
+ #include <pic18lf1220.h>
+
+#elif defined(__SDCC_PIC18LF1230)
+ #include <pic18lf1230.h>
+
+#elif defined(__SDCC_PIC18LF1320)
+ #include <pic18lf1320.h>
+
+#elif defined(__SDCC_PIC18LF1330)
+ #include <pic18lf1330.h>
+
+#elif defined(__SDCC_PIC18LF2220)
+ #include <pic18lf2220.h>
+
+#elif defined(__SDCC_PIC18LF2221)
+ #include <pic18lf2221.h>
+
+#elif defined(__SDCC_PIC18LF2320)
+ #include <pic18lf2320.h>
+
+#elif defined(__SDCC_PIC18LF2321)
+ #include <pic18lf2321.h>
+
+#elif defined(__SDCC_PIC18LF2331)
+ #include <pic18lf2331.h>
+
+#elif defined(__SDCC_PIC18LF2410)
+ #include <pic18lf2410.h>
+
+#elif defined(__SDCC_PIC18LF2420)
+ #include <pic18lf2420.h>
+
+#elif defined(__SDCC_PIC18LF2423)
+ #include <pic18lf2423.h>
+
+#elif defined(__SDCC_PIC18LF2431)
+ #include <pic18lf2431.h>
+
+#elif defined(__SDCC_PIC18LF2439)
+ #include <pic18lf2439.h>
+
+#elif defined(__SDCC_PIC18LF2450)
+ #include <pic18lf2450.h>
+
+#elif defined(__SDCC_PIC18LF2455)
+ #include <pic18lf2455.h>
+
+#elif defined(__SDCC_PIC18LF2458)
+ #include <pic18lf2458.h>
+
+#elif defined(__SDCC_PIC18LF2480)
+ #include <pic18lf2480.h>
+
+#elif defined(__SDCC_PIC18LF2510)
+ #include <pic18lf2510.h>
+
+#elif defined(__SDCC_PIC18LF2515)
+ #include <pic18lf2515.h>
+
+#elif defined(__SDCC_PIC18LF2520)
+ #include <pic18lf2520.h>
+
+#elif defined(__SDCC_PIC18LF2523)
+ #include <pic18lf2523.h>
+
+#elif defined(__SDCC_PIC18LF2525)
+ #include <pic18lf2525.h>
+
+#elif defined(__SDCC_PIC18LF2539)
+ #include <pic18lf2539.h>
+
+#elif defined(__SDCC_PIC18LF2550)
+ #include <pic18lf2550.h>
+
+#elif defined(__SDCC_PIC18LF2553)
+ #include <pic18lf2553.h>
+
+#elif defined(__SDCC_PIC18LF2580)
+ #include <pic18lf2580.h>
+
+#elif defined(__SDCC_PIC18LF2585)
+ #include <pic18lf2585.h>
+
+#elif defined(__SDCC_PIC18LF2610)
+ #include <pic18lf2610.h>
+
+#elif defined(__SDCC_PIC18LF2620)
+ #include <pic18lf2620.h>
+
+#elif defined(__SDCC_PIC18LF2680)
+ #include <pic18lf2680.h>
+
+#elif defined(__SDCC_PIC18LF2682)
+ #include <pic18lf2682.h>
+
+#elif defined(__SDCC_PIC18LF2685)
+ #include <pic18lf2685.h>
+
+#elif defined(__SDCC_PIC18LF4220)
+ #include <pic18lf4220.h>
+
+#elif defined(__SDCC_PIC18LF4221)
+ #include <pic18lf4221.h>
+
+#elif defined(__SDCC_PIC18LF4320)
+ #include <pic18lf4320.h>
+
+#elif defined(__SDCC_PIC18LF4321)
+ #include <pic18lf4321.h>
+
+#elif defined(__SDCC_PIC18LF4331)
+ #include <pic18lf4331.h>
+
+#elif defined(__SDCC_PIC18LF4410)
+ #include <pic18lf4410.h>
+
+#elif defined(__SDCC_PIC18LF4420)
+ #include <pic18lf4420.h>
+
+#elif defined(__SDCC_PIC18LF4423)
+ #include <pic18lf4423.h>
+
+#elif defined(__SDCC_PIC18LF4431)
+ #include <pic18lf4431.h>
+
+#elif defined(__SDCC_PIC18LF4439)
+ #include <pic18lf4439.h>
+
+#elif defined(__SDCC_PIC18LF4450)
+ #include <pic18lf4450.h>
+
+#elif defined(__SDCC_PIC18LF4455)
+ #include <pic18lf4455.h>
+
+#elif defined(__SDCC_PIC18LF4458)
+ #include <pic18lf4458.h>
+
+#elif defined(__SDCC_PIC18LF4480)
+ #include <pic18lf4480.h>
+
+#elif defined(__SDCC_PIC18LF4510)
+ #include <pic18lf4510.h>
+
+#elif defined(__SDCC_PIC18LF4515)
+ #include <pic18lf4515.h>
+
+#elif defined(__SDCC_PIC18LF4520)
+ #include <pic18lf4520.h>
+
+#elif defined(__SDCC_PIC18LF4523)
+ #include <pic18lf4523.h>
+
+#elif defined(__SDCC_PIC18LF4525)
+ #include <pic18lf4525.h>
+
+#elif defined(__SDCC_PIC18LF4539)
+ #include <pic18lf4539.h>
+
+#elif defined(__SDCC_PIC18LF4550)
+ #include <pic18lf4550.h>
+
+#elif defined(__SDCC_PIC18LF4553)
+ #include <pic18lf4553.h>
+
+#elif defined(__SDCC_PIC18LF4580)
+ #include <pic18lf4580.h>
+
+#elif defined(__SDCC_PIC18LF4585)
+ #include <pic18lf4585.h>
+
+#elif defined(__SDCC_PIC18LF4610)
+ #include <pic18lf4610.h>
+
+#elif defined(__SDCC_PIC18LF4620)
+ #include <pic18lf4620.h>
+
+#elif defined(__SDCC_PIC18LF4680)
+ #include <pic18lf4680.h>
+
+#elif defined(__SDCC_PIC18LF4682)
+ #include <pic18lf4682.h>
+
+#elif defined(__SDCC_PIC18LF4685)
+ #include <pic18lf4685.h>
+
+#elif defined(__SDCC_PIC18LF6310)
+ #include <pic18lf6310.h>
+
+#elif defined(__SDCC_PIC18LF6390)
+ #include <pic18lf6390.h>
+
+#elif defined(__SDCC_PIC18LF6393)
+ #include <pic18lf6393.h>
+
+#elif defined(__SDCC_PIC18LF6410)
+ #include <pic18lf6410.h>
+
+#elif defined(__SDCC_PIC18LF6490)
+ #include <pic18lf6490.h>
+
+#elif defined(__SDCC_PIC18LF6493)
+ #include <pic18lf6493.h>
+
+#elif defined(__SDCC_PIC18LF6520)
+ #include <pic18lf6520.h>
+
+#elif defined(__SDCC_PIC18LF6525)
+ #include <pic18lf6525.h>
+
+#elif defined(__SDCC_PIC18LF6527)
+ #include <pic18lf6527.h>
+
+#elif defined(__SDCC_PIC18LF6585)
+ #include <pic18lf6585.h>
+
+#elif defined(__SDCC_PIC18LF6620)
+ #include <pic18lf6620.h>
+
+#elif defined(__SDCC_PIC18LF6621)
+ #include <pic18lf6621.h>
+
+#elif defined(__SDCC_PIC18LF6622)
+ #include <pic18lf6622.h>
+
+#elif defined(__SDCC_PIC18LF6627)
+ #include <pic18lf6627.h>
+
+#elif defined(__SDCC_PIC18LF6628)
+ #include <pic18lf6628.h>
+
+#elif defined(__SDCC_PIC18LF6680)
+ #include <pic18lf6680.h>
+
+#elif defined(__SDCC_PIC18LF6720)
+ #include <pic18lf6720.h>
+
+#elif defined(__SDCC_PIC18LF6722)
+ #include <pic18lf6722.h>
+
+#elif defined(__SDCC_PIC18LF6723)
+ #include <pic18lf6723.h>
+
+#elif defined(__SDCC_PIC18LF8310)
+ #include <pic18lf8310.h>
+
+#elif defined(__SDCC_PIC18LF8390)
+ #include <pic18lf8390.h>
+
+#elif defined(__SDCC_PIC18LF8393)
+ #include <pic18lf8393.h>
+
+#elif defined(__SDCC_PIC18LF8410)
+ #include <pic18lf8410.h>
+
+#elif defined(__SDCC_PIC18LF8490)
+ #include <pic18lf8490.h>
+
+#elif defined(__SDCC_PIC18LF8493)
+ #include <pic18lf8493.h>
+
+#elif defined(__SDCC_PIC18LF8520)
+ #include <pic18lf8520.h>
+
+#elif defined(__SDCC_PIC18LF8525)
+ #include <pic18lf8525.h>
+
+#elif defined(__SDCC_PIC18LF8527)
+ #include <pic18lf8527.h>
+
+#elif defined(__SDCC_PIC18LF8585)
+ #include <pic18lf8585.h>
+
+#elif defined(__SDCC_PIC18LF8620)
+ #include <pic18lf8620.h>
+
+#elif defined(__SDCC_PIC18LF8621)
+ #include <pic18lf8621.h>
+
+#elif defined(__SDCC_PIC18LF8622)
+ #include <pic18lf8622.h>
+
+#elif defined(__SDCC_PIC18LF8627)
+ #include <pic18lf8627.h>
+
+#elif defined(__SDCC_PIC18LF8628)
+ #include <pic18lf8628.h>
+
+#elif defined(__SDCC_PIC18LF8680)
+ #include <pic18lf8680.h>
+
+#elif defined(__SDCC_PIC18LF8720)
+ #include <pic18lf8720.h>
+
+#elif defined(__SDCC_PIC18LF8722)
+ #include <pic18lf8722.h>
+
+#elif defined(__SDCC_PIC18LF8723)
+ #include <pic18lf8723.h>
+
+#else
+ #error The sdcc is not supported by this processor!
+#endif
+
+#ifndef __CONCAT2
+ #define __CONCAT2(a, b) a##b
+#endif
+
+#ifndef __CONCAT
+ #define __CONCAT(a, b) __CONCAT2(a, b)
+#endif
+
+#define __CONFIG(address, value) \
+ static const __code unsigned char __at(address) __CONCAT(_conf, __LINE__) = (value)
+
+#define Nop() __asm nop __endasm
+#define ClrWdt() __asm clrwdt __endasm
+#define Sleep() __asm sleep __endasm
+#define Reset() __asm reset __endasm
+
+ // To pointer manipulations. (From the sdcc/src/pic16/gen.h file.)
+#define GPTR_TAG_MASK 0xC0 // Generated by the device-manager.pl program.
+#define GPTR_TAG_DATA 0x80
+#define GPTR_TAG_EEPROM 0x40
+#define GPTR_TAG_CODE 0x00
+
+#endif // #ifndef __PIC18FREGS_H__
diff --git a/device/include/pic16/sdcc-lib.h b/device/include/pic16/sdcc-lib.h
new file mode 100644
index 0000000..41e6654
--- /dev/null
+++ b/device/include/pic16/sdcc-lib.h
@@ -0,0 +1,34 @@
+/*-------------------------------------------------------------------------
+ sdcc-lib.h - SDCC Library Main Header
+
+ Copyright (C) 2004, 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_SDCC_LIB_H
+#define __PIC16_SDCC_LIB_H 1
+
+#include <../asm/pic16/features.h>
+
+#endif
diff --git a/device/include/pic16/signal.h b/device/include/pic16/signal.h
new file mode 100644
index 0000000..2e15709
--- /dev/null
+++ b/device/include/pic16/signal.h
@@ -0,0 +1,262 @@
+/*-------------------------------------------------------------------------
+ signal.h - Signal handler header
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __SIGNAL_H__
+#define __SIGNAL_H__
+
+/* interrupt testing arguments */
+#define SIG_RB SIG_RBIF
+#define SIG_INT0 SIG_INT0IF
+#define SIG_INT1 SIG_INT1IF
+#define SIG_INT2 SIG_INT2IF
+#define SIG_CCP1 SIG_CCP1IF
+#define SIG_CCP2 SIG_CCP2IF
+#define SIG_TMR0 SIG_TMR0IF
+#define SIG_TMR1 SIG_TMR1IF
+#define SIG_TMR2 SIG_TMR2IF
+#define SIG_TMR3 SIG_TMR3IF
+#define SIG_EE SIG_EEIF
+#define SIG_BCOL SIG_BCOLIF
+#define SIG_LVD SIG_LVDIF
+#define SIG_PSP SIG_PSPIF
+#define SIG_AD SIG_ADIF
+#define SIG_RC SIG_RCIF
+#define SIG_TX SIG_TXIF
+#define SIG_SSP SIG_SSPIF
+#define SIG_MSSP SIG_SSPIF /* just an alias */
+#define SIG_USB SIG_USBIF
+
+/* define name to be the interrupt handler for interrupt #vecno */
+#define DEF_ABSVECTOR(vecno, name) \
+void __ivt_ ## name(void) __interrupt(vecno) __naked \
+{ \
+ __asm goto _ ## name __endasm; \
+}
+
+/* Define name to be the handler for high priority interrupts,
+ * use like this:
+ * DEF_INTHIGH(high_handler)
+ * DEF_HANDLER(SIG_TMR0, timer0_handler)
+ * DEF_HANDLER2(SIG_TMR1, SIG_TMR1IE, timer1_handler)
+ * ...
+ * END_DEF
+ *
+ * SIGHANDLER(timer0_handler)
+ * {
+ * // code to handle timer0 interrupts
+ * }
+ * SIGHANDLER(timer1_handler)
+ * {
+ * // code to handle timer1 interrupts
+ * }
+ */
+#define DEF_INTHIGH(name) \
+DEF_ABSVECTOR(1, name) \
+void name(void) __naked __interrupt \
+{
+
+/* Define name to be the handler for high priority interrupts,
+ * use like this:
+ * DEF_INTLOW(low_handler)
+ * DEF_HANDLER(SIG_RB, portb_handler)
+ * DEF_HANDLER2(SIG_LVD, SIG_LVDIE, lowvolt_handler)
+ * ...
+ * END_DEF
+ *
+ * SIGHANDLER(portb_handler)
+ * {
+ * // code to handle PORTB change interrupts
+ * }
+ * SIGHANDLER(lowvolt_handler)
+ * {
+ * // code to handle low voltage interrupts
+ * }
+ */
+#define DEF_INTLOW(name) \
+DEF_ABSVECTOR(2, name) \
+void name(void) __naked __interrupt \
+{
+
+/* finish an interrupt handler definition */
+#define END_DEF \
+ __asm retfie __endasm; \
+}
+
+/* Declare handler to be the handler function for the given signal.
+ * sig should be one of SIG_xxx from above, handler should be a
+ * function defined using SIGHANDLER(handler) or
+ * SIGHANDLERNAKED(handler).
+ * ATTENTION: This macro ignores the signal's enable bit!
+ * Use DEF_HANDLER2(SIG_xxx, SIGxxxIE, handler) instead!
+ * To be used together with DEF_INTHIGH and DEF_INTLOW.
+ */
+#define DEF_HANDLER(sig, handler) \
+ __asm btfsc sig, 0 __endasm; \
+ __asm goto _ ## handler __endasm;
+
+/* Declare handler to be the handler function for the given signal.
+ * sig should be one of SIG_xxx from above,
+ * sig2 should also be a signal (probably SIG_xxxIE from below) and
+ * handler should be a function defined using SIGHANDLER(handler)
+ * or SIGHANDLERNAKED(handler).
+ * To be used together with DEF_INTHIGH and DEF_INTLOW.
+ */
+#define DEF_HANDLER2(sig1,sig2,handler) \
+ __asm btfss sig1, 0 __endasm; \
+ __asm bra $+8 __endasm; \
+ __asm btfsc sig2, 0 __endasm; \
+ __asm goto _ ## handler __endasm;
+
+/* Declare or define an interrupt handler function. */
+#define SIGHANDLER(handler) void handler (void) __interrupt
+#define SIGHANDLERNAKED(handler) void handler (void) __naked __interrupt
+
+
+/*
+ * inline assembly compatible bit definitions
+ */
+#define SIG_RBIF _INTCON, 0
+#define SIG_RBIE _INTCON, 3
+#define SIG_RBIP _INTCON2, 0
+
+#define SIG_INT0IF _INTCON, 1
+#define SIG_INT0IE _INTCON, 4
+/*#define SIG_INT0IP not selectable, always ? */
+
+#define SIG_TMR0IF _INTCON, 2
+#define SIG_TMR0IE _INTCON, 5
+#define SIG_TMR0IP _INTCON2, 2
+
+#define SIG_INT1IF _INTCON3, 0
+#define SIG_INT1IE _INTCON3, 3
+#define SIG_INT1IP _INTCON3, 6
+
+#define SIG_INT2IF _INTCON3, 1
+#define SIG_INT2IE _INTCON3, 4
+#define SIG_INT2IP _INTCON3, 7
+
+/* device dependent -- should be moved to pic18f*.h */
+#define SIG_TMR1IDX 0
+#define SIG_TMR1SUF 1
+#define SIG_TMR2IDX 1
+#define SIG_TMR2SUF 1
+#define SIG_CCP1IDX 2
+#define SIG_CCP1SUF 1
+#define SIG_SSPIDX 3
+#define SIG_SSPSUF 1
+#define SIG_TXIDX 4
+#define SIG_TXSUF 1
+#define SIG_RCIDX 5
+#define SIG_RCSUF 1
+#define SIG_ADIDX 6
+#define SIG_ADSUF 1
+#define SIG_PSPIDX 7
+#define SIG_PSPSUF 1
+
+#define SIG_CCP2IDX 0
+#define SIG_CCP2SUF 2
+#define SIG_TMR3IDX 1
+#define SIG_TMR3SUF 2
+#define SIG_LVDIDX 2
+#define SIG_LVDSUF 2
+#define SIG_BCOLIDX 3
+#define SIG_BCOLSUF 2
+#define SIG_EEIDX 4
+#define SIG_EESUF 2
+#define SIG_USBIDX 5
+#define SIG_USBSUF 2
+
+/* device independent */
+#define __concat(a,b) __concat2(a,b)
+#define __concat2(a,b) a ## b
+
+#define SIG_PIR(suf) __concat(_PIR,suf)
+#define SIG_PIE(suf) __concat(_PIE,suf)
+#define SIG_IPR(suf) __concat(_IPR,suf)
+
+#define SIG_TMR1IF SIG_PIR(SIG_TMR1SUF), SIG_TMR1IDX
+#define SIG_TMR1IE SIG_PIE(SIG_TMR1SUF), SIG_TMR1IDX
+#define SIG_TMR1IP SIG_IPR(SIG_TMR1SUF), SIG_TMR1IDX
+
+#define SIG_TMR2IF SIG_PIR(SIG_TMR2SUF), SIG_TMR2IDX
+#define SIG_TMR2IE SIG_PIE(SIG_TMR2SUF), SIG_TMR2IDX
+#define SIG_TMR2IP SIG_IPR(SIG_TMR2SUF), SIG_TMR2IDX
+
+#define SIG_CCP1IF SIG_PIR(SIG_CCP1SUF), SIG_CCP1IDX
+#define SIG_CCP1IE SIG_PIE(SIG_CCP1SUF), SIG_CCP1IDX
+#define SIG_CCP1IP SIG_IPR(SIG_CCP1SUF), SIG_CCP1IDX
+
+#define SIG_SSPIF SIG_PIR(SIG_SSPSUF), SIG_SSPIDX
+#define SIG_SSPIE SIG_PIE(SIG_SSPSUF), SIG_SSPIDX
+#define SIG_SSPIP SIG_IPR(SIG_SSPSUF), SIG_SSPIDX
+/* aliases: MSSP */
+#define SIG_MSSPIF SIG_SSPIF //SIG_PIR(SIG_SSPSUF), SIG_SSPIDX
+#define SIG_MSSPIE SIG_SSPIE //SIG_PIE(SIG_SSPSUF), SIG_SSPIDX
+#define SIG_MSSPIP SIG_SSPIP //SIG_IPR(SIG_SSPSUF), SIG_SSPIDX
+
+#define SIG_TXIF SIG_PIR(SIG_TXSUF), SIG_TXIDX
+#define SIG_TXIE SIG_PIE(SIG_TXSUF), SIG_TXIDX
+#define SIG_TXIP SIG_IPR(SIG_TXSUF), SIG_TXIDX
+
+#define SIG_RCIF SIG_PIR(SIG_RCSUF), SIG_RCIDX
+#define SIG_RCIE SIG_PIE(SIG_RCSUF), SIG_RCIDX
+#define SIG_RCIP SIG_IPR(SIG_RCSUF), SIG_RCIDX
+
+#define SIG_ADIF SIG_PIR(SIG_ADSUF), SIG_ADIDX
+#define SIG_ADIE SIG_PIE(SIG_ADSUF), SIG_ADIDX
+#define SIG_ADIP SIG_IPR(SIG_ADSUF), SIG_ADIDX
+
+#define SIG_PSPIF SIG_PIR(SIG_PSPSUF), SIG_PSPIDX
+#define SIG_PSPIE SIG_PIE(SIG_PSPSUF), SIG_PSPIDX
+#define SIG_PSPIP SIG_IPR(SIG_PSPSUF), SIG_PSPIDX
+
+#define SIG_CCP2IF SIG_PIR(SIG_CCP2SUF), SIG_CCP2IDX
+#define SIG_CCP2IE SIG_PIE(SIG_CCP2SUF), SIG_CCP2IDX
+#define SIG_CCP2IP SIG_IPR(SIG_CCP2SUF), SIG_CCP2IDX
+
+#define SIG_TMR3IF SIG_PIR(SIG_TMR3SUF), SIG_TMR3IDX
+#define SIG_TMR3IE SIG_PIE(SIG_TMR3SUF), SIG_TMR3IDX
+#define SIG_TMR3IP SIG_IPR(SIG_TMR3SUF), SIG_TMR3IDX
+
+#define SIG_LVDIF SIG_PIR(SIG_LVDSUF), SIG_LVDIDX
+#define SIG_LVDIE SIG_PIE(SIG_LVDSUF), SIG_LVDIDX
+#define SIG_LVDIP SIG_IPR(SIG_LVDSUF), SIG_LVDIDX
+
+#define SIG_BCOLIF SIG_PIR(SIG_BCOLSUF), SIG_BCOLIDX
+#define SIG_BCOLIE SIG_PIE(SIG_BCOLSUF), SIG_BCOLIDX
+#define SIG_BCOLIP SIG_IPR(SIG_BCOLSUF), SIG_BCOLIDX
+
+#define SIG_EEIF SIG_PIR(SIG_EESUF), SIG_EEIDX
+#define SIG_EEIE SIG_PIE(SIG_EESUF), SIG_EEIDX
+#define SIG_EEIP SIG_IPR(SIG_EESUF), SIG_EEIDX
+
+#define SIG_USBIF SIG_PIR(SIG_USBSUF), SIG_USBIDX
+#define SIG_USBIE SIG_PIE(SIG_USBSUF), SIG_USBIDX
+#define SIG_USBIP SIG_IPR(SIG_USBSUF), SIG_USBIDX
+
+#endif /* __SIGNAL_H__ */
diff --git a/device/include/pic16/stdarg.h b/device/include/pic16/stdarg.h
new file mode 100644
index 0000000..c1e7f69
--- /dev/null
+++ b/device/include/pic16/stdarg.h
@@ -0,0 +1,38 @@
+/*-------------------------------------------------------------------------
+ stdarg.h - ANSI macros for variable parameter list
+
+ Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
+ Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@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.
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_STDARG_H
+#define __PIC16_STDARG_H 1
+
+typedef unsigned char * va_list;
+#define va_start(list, last) list = (unsigned char *)&last + sizeof(last)
+#define va_arg(list, type) *((type *)((list += sizeof(type)) - sizeof(type)))
+#define va_end(list) list = ((va_list) 0)
+
+#endif /* __PIC16_STDARG_H */
diff --git a/device/include/pic16/stddef.h b/device/include/pic16/stddef.h
new file mode 100644
index 0000000..4839efe
--- /dev/null
+++ b/device/include/pic16/stddef.h
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ stddef.h - ANSI functions forward declarations
+
+ Copyright (C) 2004, Maarten Brock <sourceforge.brock AT dse.nl>
+ Ported to PIC16 port by Raphael Neider <rneider AT web.de> (2005)
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_STDDEF_H
+#define __PIC16_STDDEF_H 1
+
+#ifndef NULL
+ #define NULL (void *)0
+#endif
+
+#ifndef _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+#endif
+
+#define offsetof(s, m) __builtin_offsetof (s, m)
+
+#endif /* __PIC16_STDDEF_H */
diff --git a/device/include/pic16/stdint.h b/device/include/pic16/stdint.h
new file mode 100644
index 0000000..c451e43
--- /dev/null
+++ b/device/include/pic16/stdint.h
@@ -0,0 +1,165 @@
+/*-------------------------------------------------------------------------
+ stdint.h - ISO C99 7.18 Integer types <stdint.h>
+
+ Copyright (C) 2005, Maarten Brock <sourceforge.brock AT dse.nl>
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef _STDINT_H
+#define _STDINT_H 1
+
+/* Exact integral types. */
+
+/* Signed. */
+
+typedef signed char int8_t;
+typedef short int int16_t;
+typedef long int int32_t;
+
+/* Unsigned. */
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned long int uint32_t;
+
+
+/* Small types. */
+
+/* Signed. */
+typedef signed char int_least8_t;
+typedef short int int_least16_t;
+typedef long int int_least32_t;
+
+/* Unsigned. */
+typedef unsigned char uint_least8_t;
+typedef unsigned short int uint_least16_t;
+typedef unsigned long int uint_least32_t;
+
+
+/* Fast types. */
+
+/* Signed. */
+typedef signed char int_fast8_t;
+typedef int int_fast16_t;
+typedef long int int_fast32_t;
+
+/* Unsigned. */
+typedef unsigned char uint_fast8_t;
+typedef unsigned int uint_fast16_t;
+typedef unsigned long int uint_fast32_t;
+
+
+/* Types for `void *' pointers. */
+typedef long int intptr_t;
+typedef unsigned long int uintptr_t;
+
+
+/* Largest integral types. */
+typedef long int intmax_t;
+typedef unsigned long int uintmax_t;
+
+
+/* Limits of integral types. */
+
+/* Minimum of signed integral types. */
+# define INT8_MIN (-128)
+# define INT16_MIN (-32767-1)
+# define INT32_MIN (-2147483647L-1)
+/* Maximum of signed integral types. */
+# define INT8_MAX (127)
+# define INT16_MAX (32767)
+# define INT32_MAX (2147483647L)
+
+/* Maximum of unsigned integral types. */
+# define UINT8_MAX (255)
+# define UINT16_MAX (65535)
+# define UINT32_MAX (4294967295UL)
+
+/* Minimum of signed integral types having a minimum size. */
+# define INT_LEAST8_MIN (-128)
+# define INT_LEAST16_MIN (-32767-1)
+# define INT_LEAST32_MIN (-2147483647L-1)
+/* Maximum of signed integral types having a minimum size. */
+# define INT_LEAST8_MAX (127)
+# define INT_LEAST16_MAX (32767)
+# define INT_LEAST32_MAX (2147483647L)
+
+/* Maximum of unsigned integral types having a minimum size. */
+# define UINT_LEAST8_MAX (255)
+# define UINT_LEAST16_MAX (65535)
+# define UINT_LEAST32_MAX (4294967295UL)
+
+/* Minimum of fast signed integral types having a minimum size. */
+# define INT_FAST8_MIN (-128)
+# define INT_FAST16_MIN (-32767-1)
+# define INT_FAST32_MIN (-2147483647L-1)
+
+/* Maximum of fast signed integral types having a minimum size. */
+# define INT_FAST8_MAX (127)
+# define INT_FAST16_MAX (32767)
+# define INT_FAST32_MAX (2147483647L)
+
+/* Maximum of fast unsigned integral types having a minimum size. */
+# define UINT_FAST8_MAX (255)
+# define UINT_FAST16_MAX (65535)
+# define UINT_FAST32_MAX (4294967295UL)
+
+/* Values to test for integral types holding `void *' pointer. */
+# define INTPTR_MIN (-2147483647L-1)
+# define INTPTR_MAX (2147483647L)
+# define UINTPTR_MAX (4294967295UL)
+
+/* Minimum for largest signed integral type. */
+# define INTMAX_MIN (-__INT32_C(-2147483647L)-1)
+/* Maximum for largest signed integral type. */
+# define INTMAX_MAX (__INT32_C(2147483647L))
+
+/* Maximum for largest unsigned integral type. */
+# define UINTMAX_MAX (__UINT32_C(4294967295UL))
+
+
+/* Limits of other integer types. */
+
+/* Limits of `ptrdiff_t' type. */
+# define PTRDIFF_MIN (-2147483647L-1)
+# define PTRDIFF_MAX (2147483647L)
+
+/* Limit of `size_t' type. */
+# define SIZE_MAX (65535)
+
+/* Signed. */
+# define INT8_C(c) c
+# define INT16_C(c) c
+# define INT32_C(c) c ## L
+
+/* Unsigned. */
+# define UINT8_C(c) c ## U
+# define UINT16_C(c) c ## U
+# define UINT32_C(c) c ## UL
+
+/* Maximal type. */
+# define INTMAX_C(c) c ## L
+# define UINTMAX_C(c) c ## UL
+
+
+#endif /* stdint.h */
diff --git a/device/include/pic16/stdio.h b/device/include/pic16/stdio.h
new file mode 100644
index 0000000..aff4d49
--- /dev/null
+++ b/device/include/pic16/stdio.h
@@ -0,0 +1,120 @@
+/*-------------------------------------------------------------------------
+ stdio.h - ANSI functions forward declarations
+
+ Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
+ Ported to PIC16 port by Vangelis Rokas, 2004 <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.
+-------------------------------------------------------------------------*/
+
+#ifndef __STDIO_H
+#define __STDIO_H 1
+
+/* link the C library */
+#pragma library c
+
+#include <stdarg.h>
+
+#include <sdcc-lib.h>
+
+#ifndef NULL
+ #define NULL (void *)0
+#endif
+
+#ifndef _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+#endif
+
+/* stream descriptor definition */
+typedef char *FILE;
+
+/* USART and MSSP module stream descriptors */
+
+/* since FILE is declared as a generic pointer,
+ * the upper byte is used to dereference the pointer
+ * information. For the stream descriptors we
+ * use the 5th bit and the lower nubble bits.
+ * Descriptors are denoted by an 1 in bit 5,
+ * further dereference is made for:
+ * <stream> <3:0> bits
+ * USART 0 (0x0)
+ * MSSP 1 (0x1)
+ * USER 15 (0xf)
+ *
+ * There is a special value for GPSIM specific (see below)
+ * which is:
+ * GPSIM 14 (0xe)
+ *
+ *
+ * if further stream descriptors need to be added then more
+ * bits of the upper byte can be used
+ */
+
+#define USART_DEREF 0x0
+#define MSSP_DEREF 0x1
+#define USER_DEREF 0xf
+
+#define STREAM_USART ((FILE *)(0x00200000UL))
+#define STREAM_MSSP ((FILE *)(0x00210000UL))
+#define STREAM_USER ((FILE *)(0x002f0000UL))
+
+/* this is a custom dereference which points to a custom
+ * port of GPSIM simulator. This port redirects characters
+ * to /tmp/gpsim.debug.1 file (used for debugging purposes)
+ * NOTICE: This feature is not part of the official gpsim
+ * distribution. Contact vrokas AT users.sourceforge.net
+ * for more info */
+#define GPSIM_DEREF 0xe
+#define STREAM_GPSIM ((FILE *)(0x002e0000UL))
+
+extern FILE *stdin;
+extern FILE *stdout;
+
+/* printf_small() supports float print */
+void printf_small (const char *fmt, ...);
+
+/* printf_tiny() does not support float print */
+void printf_tiny (const char *fmt, ...); // __reentrant;
+
+extern int printf (const char *fmt, ...);
+extern int fprintf (FILE *stream, const char *fmt, ...);
+extern int sprintf (char *str, const char *fmt, ...);
+
+extern int vprintf (const char *fmt, va_list ap);
+extern int vfprintf (FILE *stream, const char *fmt, va_list ap);
+extern int vsprintf (char *str, const char *fmt, va_list ap);
+
+#define PUTCHAR(C) void putchar (char C) __wparam
+extern PUTCHAR (c);
+
+extern void __stream_putchar (FILE *stream, char c);
+
+extern void __stream_usart_putchar (char c) __wparam __naked;
+extern void __stream_mssp_putchar (char c) __wparam __naked;
+extern void __stream_gpsim_putchar (char c) __wparam __naked;
+
+extern char *gets (char *str);
+extern char getchar (void);
+
+#endif /* __STDIO_H */
diff --git a/device/include/pic16/stdlib.h b/device/include/pic16/stdlib.h
new file mode 100644
index 0000000..4418dba
--- /dev/null
+++ b/device/include/pic16/stdlib.h
@@ -0,0 +1,84 @@
+/*-------------------------------------------------------------------------
+ stdlib.h - ANSI functions forward declarations
+
+ Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
+ Ported to PIC16 port by Vangelis Rokas, 2004 <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.
+-------------------------------------------------------------------------*/
+
+#ifndef __STDLIB_H__
+#define __STDLIB_H__ 1
+
+#pragma library c
+
+#include <stdint.h>
+
+#ifndef NULL
+# define NULL (void *)0
+#endif
+
+#define RAND_MAX 0x7fffffff
+
+/* absolute value */
+int abs (int j);
+long int labs (long int j);
+
+/* initialize random seed */
+void srand (unsigned long seed);
+
+/* return a random number between 0 and RAND_MAX */
+long rand (void);
+
+/* reentrant version of rand() */
+long rand_r (unsigned long *ctx);
+
+/* returns the CRC16 checksum of the data buffer, takes as
+ * last argument an old value of crc16 checksum */
+uint16_t crc16 (uint8_t *, uint32_t, uint16_t);
+
+/* convert a ASCII string to float */
+float atof (char *);
+
+/* convert a ASCII string to integer */
+int atoi (char *);
+
+/* convert a ASCII string to long */
+long atol (char *);
+
+/* convert an unsigned/signed integer to ASCII string */
+void uitoa (unsigned int, __data char *, unsigned char);
+void itoa (int, __data char*, unsigned char);
+
+/* convert an unsigned/signed long integer to ASCII string */
+void ultoa (unsigned long, __data char *, unsigned char);
+void ltoa (long, __data char*, unsigned char);
+
+/* helper functions: convert a float to ASCII string */
+extern char x_ftoa (float, __data char *, unsigned char, unsigned char);
+
+/* George M. Gallant's version of ftoa() */
+extern void g_ftoa (__data char *, float, char);
+
+
+#endif /* __STDLIB_H__ */
diff --git a/device/include/pic16/string.h b/device/include/pic16/string.h
new file mode 100644
index 0000000..7a5852d
--- /dev/null
+++ b/device/include/pic16/string.h
@@ -0,0 +1,77 @@
+/*-------------------------------------------------------------------------
+ string.h - ANSI functions forward declarations
+
+ Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
+ Ported to PIC16 port by Vangelis Rokas, 2004 <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.
+-------------------------------------------------------------------------*/
+
+#ifndef __STRING_H /* { */
+#define __STRING_H 1
+
+#define _STRING_SPEC __data
+
+#pragma library c
+
+#ifndef NULL
+# define NULL (void *)0
+#endif
+
+#ifndef _SIZE_T_DEFINED
+# define _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+#endif
+
+char *strcat (char *, char *);
+char *strchr (char *, char);
+int strcmp (char *, char *);
+char *strcpy (char *, char *);
+int strcspn(char *, char *);
+int strlen (char *);
+char *strlwr (char *);
+char *strncat(char *, char *, size_t );
+int strncmp(char *, char *, size_t );
+char *strncpy(char *, char *, size_t );
+char *strpbrk(char *, char *);
+char *strrchr(char *, char);
+int strspn (char *, char *);
+char *strstr (char *, char *);
+char *strtok (char *, char *);
+char *strupr (char *);
+
+void *memccpy(void *, void *, char, size_t);
+void *memchr(const void *, char, size_t);
+int memcmp (const void *, const void *, size_t);
+void *memcpy (void *, const void *, size_t);
+void *memmove (void *, const void *, size_t);
+void *memrchr(void *, char, size_t);
+void *memset (_STRING_SPEC void *, unsigned char, size_t );
+
+__code void *memchrpgm(__code void *, char, size_t);
+__data void *memchrram(__data void *, char, size_t);
+__data void *memcpypgm2ram(__data void *, __code void *, size_t);
+__data void *memcpyram2ram(__data void *, __data void *, size_t);
+
+
+#endif /* } */
diff --git a/device/include/pic16/usart.h b/device/include/pic16/usart.h
new file mode 100644
index 0000000..9805606
--- /dev/null
+++ b/device/include/pic16/usart.h
@@ -0,0 +1,167 @@
+/*-------------------------------------------------------------------------
+ usart.h - USART communications module library header
+
+ 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.
+-------------------------------------------------------------------------*/
+
+#ifndef __USART_H__
+#define __USART_H__
+
+#pragma library io
+
+
+#define RAM_SCLS __data
+
+/* configuration bit masks for open function */
+#define USART_TX_INT_ON 0xff
+#define USART_TX_INT_OFF 0x7f
+#define USART_RX_INT_ON 0xff
+#define USART_RX_INT_OFF 0xbf
+#define USART_BRGH_HIGH 0xff
+#define USART_BRGH_LOW 0xef
+#define USART_CONT_RX 0xff
+#define USART_SINGLE_RX 0xf7
+#define USART_SYNC_MASTER 0xff
+#define USART_SYNC_SLAVE 0xfb
+#define USART_NINE_BIT 0xff
+#define USART_EIGHT_BIT 0xfd
+#define USART_SYNCH_MODE 0xff
+#define USART_ASYNCH_MODE 0xfe
+
+/*
+ * USART styles:
+ *
+ * --- Families with 1 USART ---
+ *
+ * INIT:
+ * RCSTA<7> = 1 (SPEN)
+ * TXSTA<4> = 0 (SYNC)
+ * TXSTA<5> = 1 (TXEN)
+ *
+ * 18f1220:
+ * RB1/AN5/TX and RB4/AN6/RX
+ *
+ * TRISB<1> = TRISB<4> = 1 (TX, RX)
+ * ADCON1<5> = ADCON1<6> = 1 (PCFG<5>, PCFG<6>)
+ * SPBRGH:SPBRG
+ *
+ * 18f13k50:
+ * RB7/TX and RB5/AN11/RX
+ *
+ * TRISB<7> = TRISB<5> = 1 (TX, RX)
+ * ANSELH<3> = 0 (ANS11/RX)
+ * SPBRGH:SPBRG
+ *
+ * 18f2220:
+ * RC6/TX and RC7/RX
+ *
+ * TRISC<6> = 0 (TX)
+ * TRISC<7> = 1 (RX)
+ * SPBRG
+ *
+ * 18f2221/18f2331/18f23k20/18f2410/18f2420/18f2423/18f2455/18f24j10/18f2525:
+ * RC6/TX and RC7/RX
+ *
+ * TRISC<6> = TRISC<7> = 1 (TX, RX)
+ * SPBRGH:SPBRG
+ *
+ * 18f2450/18f2480/18f2585/18f2682/18f6585/18f6680/18f8585/18f8680:
+ * RC6/TX and RC7/RX
+ *
+ * TRISC<6> = 0 (TX)
+ * TRISC<7> = 1 (RX)
+ * SPBRGH:SPBRG
+ *
+ * --- Families with 2+ USARTs ---
+ *
+ * INIT:
+ * RCSTA1<7> = 1 (SPEN)
+ * TXSTA1<4> = 0 (SYNC)
+ * TXSTA1<5> = 1 (TXEN)
+ *
+ * 18f24j50/18f6527/18f65j50/18f66j60:
+ * RC6/TX1 and RC7/RX1 (EUSART1)
+ *
+ * TRISC<6> = 0 (TX1)
+ * TRISC<7> = 1 (RX1)
+ * SPBRGH1:SPBRG1
+ *
+ * 18f6520:
+ * RC6/TX1 and RC7/RX1 (EUSART1)
+ *
+ * TRISC<6> = 0 (TX1)
+ * TRISC<7> = 1 (RX1)
+ * SPBRG1
+ *
+ */
+#include "pic18fam.h"
+
+#if (__SDCC_USART_STYLE == 0)
+#warning The target device is not supported by the SDCC PIC16 USART library.
+#endif
+
+#if (__SDCC_USART_STYLE == 1822200) || \
+ (__SDCC_USART_STYLE == 1865200)
+#define __SDCC_NO_SPBRGH 1
+#endif /* device lacks SPBRGH */
+
+
+#if __SDCC_NO_SPBRGH
+typedef unsigned char sdcc_spbrg_t;
+#else /* !__SDCC_NO_SPBRGH */
+typedef unsigned int sdcc_spbrg_t;
+#endif /* !__SDCC_NO_SPBRGH */
+
+
+/* status bits */
+union USART
+{
+ unsigned char val;
+ struct
+ {
+ unsigned RX_NINE:1;
+ unsigned TX_NINE:1;
+ unsigned FRAME_ERROR:1;
+ unsigned OVERRUN_ERROR:1;
+ unsigned fill:4;
+ };
+};
+
+void usart_open (unsigned char config, sdcc_spbrg_t spbrg) __wparam;
+void usart_close (void);
+
+unsigned char usart_busy (void) __naked;
+unsigned char usart_drdy (void) __naked;
+
+unsigned char usart_getc (void);
+void usart_gets (RAM_SCLS char * buffer, unsigned char len);
+
+void usart_putc (unsigned char data) __wparam __naked;
+void usart_puts (char * data);
+
+
+void usart_baud (sdcc_spbrg_t baudconfig) __wparam;
+
+#endif