		opt nolist
;
; Device type definition for PIC16F877
;

__progmem_size		equ	8192
__data_eeprom_size	equ	256

__config		set	0x3f7f

		set_pic_type "PIC16F877", "14-bit"

__do_config	macro	; keyword, value

		if streqcase("\1", "cp")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config | 0x3030
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config & 0xcfcf
				exitm
			endif
		endif

		if streqcase("\1", "bkbug")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config | 0x0800
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config & 0xf7ff
				exitm
			endif
		endif

		if streqcase("\1", "wrt")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config & 0xfdff
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config | 0x0200
				exitm
			endif
		endif

		if streqcase("\1", "cpd")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config | 0x0100
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config & 0xfeff
				exitm
			endif
		endif

		if streqcase("\1", "lvp")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config & 0xff7f
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config | 0x0080
				exitm
			endif
		endif

		if streqcase("\1", "boden")| streqcase("\1", "bod")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config & 0xffbf
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config | 0x0040
				exitm
			endif
		endif

		if streqcase("\1", "pwrte")| streqcase("\1", "pwrt")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config | 0x0008
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config & 0xfff7
				exitm
			endif
		endif

		if streqcase("\1", "wdte")| streqcase("\1", "wdt")
			if streqcase("\2", "no") | streqcase("\2", "off")
__config			set	__config & 0xfffb
				exitm
			endif
			if streqcase("\2", "yes") | streqcase("\2", "on")
__config			set	__config | 0x0004
				exitm
			endif
		endif

		if streqcase("\1", "osc")
			if streqcase("\2", "lp")
__config			set	(__config & 0xfffc) | 0x0000
				exitm
			endif
			if streqcase("\2", "xt")
__config			set	(__config & 0xfffc) | 0x0001
				exitm
			endif
			if streqcase("\2", "hs")
__config			set	(__config & 0xfffc) | 0x0002
				exitm
			endif
			if streqcase("\2", "rc")
__config			set	(__config & 0xfffc) | 0x0003
				exitm
			endif
		endif

		endm

		opt list
