;------------------------------------------------------------------------------
;  CHIP: SN8P25L31
;  Revision History
;  
;  V01   13/02/2014  1. First issue. 
;  V02   07/08/2014  1. Modify Information block. 
;------------------------------------------------------------------------------
.ASSEMBLY    	RedWrt_FORMAT   1
.Assembly	INC_VER		1
.Assembly	ASM_FORMAT	1
.Assembly	RAM_Size	38
.Assembly	Op_Code_13Bit	1

.Assembly	INSTRUMENT	SN8P25L31
.Assembly	BIT_FILE	SN8P25L31

.Assembly	OTP_BODY_SIZE	0x0440
.Assembly	USER_ROM_SIZE	0x0400

;.Assembly	OTP_TEST_SIZE	0x00A0
;.Assembly	MASK_TEST_FILE	SN8A1602A
.Assembly	MASK_TEST_CODE	0x0000, 0x0000, 0x0000, 0x0000
;.Assembly	OTP_TEST_FILE	SN86P
.Assembly	PGM_TYPE	8
.Assembly	CHIP_ID		0x3180
.Assembly	command		Enable_ORG4_7, GREEN_NOP_LIMIT, , NEW_CODEOPTION 
.Assembly	Port_Pins	8, 4, 0, 0, 0, 0
; Code Option 0x43F
.Assembly	OPTION		0		Fix_High
.Assembly	OPTION		1		Fix_High
.Assembly	OPTION		2		Fix_High
.Assembly	OPTION		3		Fix_High
.Assembly	OPTION		4		Fix_High
.Assembly	OPTION		5		Fix_High
.Assembly	OPTION		6		Fix_High
.Assembly	OPTION		7		Fix_High
.Assembly	OPTION		8		Fix_High
.Assembly	OPTION		9		Security	Enable	Disable
.Assembly	OPTION		10 		High_Clk	IRC_8M IRC_4M IRC_1M IRC_455K Ext_RC  32K_X'tal  x  8M_X'tal
.Help
{
	IRC_8M		:	"Internal 8M RC Oscillator"
	IRC_4M		:	"Internal 4M RC Oscillator"
	IRC_1M		:	"Internal 4M RC Oscillator"
	IRC_455K	:	"Internal 455K RC Oscillator"
	Ext_RC		:	"Connect R to VDD and Xin\nConnect C to GND and Xin"
	32K_X'tal	:	"32.768K Crystal"
	8M_X'tal	:	"Crystal/Resonator: 455Khz~8Mhz"
	8M_X'tal	:	"Crystal/Resonator: 455Khz~8Mhz"
}
.Assembly	OPTION		13 : 15		Fix_Low

;.Assembly	OPTION		13		Rst_Length  No 128*ILRC
;.Assembly	OPTION		13		Fix_High
;.Assembly	OPTION		14		Low_Power	Enabel Disable
;.Assembly	OPTION		14		Fix_High
;.Assembly	OPTION		15		Fix_High

; Code Option 0x43E
.Assembly	OPTION		16		Fix_Low
.Assembly	OPTION		17		Fix_High
.Assembly	OPTION		18		Fix_Low
.Assembly	OPTION		19		Fix_High
.Assembly	OPTION		20		Fix_High
.Assembly	OPTION		21		Fix_Low
.Assembly	OPTION		22		Fix_High
.Assembly	OPTION		23		Fix_Low
.Assembly	OPTION		24		Watch_Dog	Always_On Enable Disable X
.Assembly	OPTION		26		Reset_Pin   	P03 	Reset
.Assembly	OPTION		27		LVD22  		Disable	Enable	
.Assembly	OPTION		28		Fcpu		Fosc/4	Fosc/2
.Assembly	OPTION		29 : 31		Fix_Low

; Code Option 0x43D
.Assembly	OPTION		32		Fix_Low
.Assembly	OPTION		33		Fix_Low
.Assembly	OPTION		34		Fix_Low
.Assembly	OPTION		35		Fix_Low
.Assembly	OPTION		36		Fix_Low
.Assembly	OPTION		37		Fix_Low
.Assembly	OPTION		38		Fix_Low
.Assembly	OPTION		39		Fix_High
.Assembly	OPTION		40		Fix_High
.Assembly	OPTION		41		Fix_Low
.Assembly	OPTION		42		Fix_Low
.Assembly	OPTION		43		Fix_Low
.Assembly	OPTION		44		Fix_Low
.Assembly	OPTION		45 : 47		Fix_Low

; Code Option 0x43C
.Assembly	OPTION		48		Fix_High
.Assembly	OPTION		49		Fix_High
.Assembly	OPTION		50		Fix_Low
.Assembly	OPTION		51		Fix_Low
.Assembly	OPTION		52		Fix_Low
.Assembly	OPTION		53		Fix_Low
.Assembly	OPTION		54		Fix_Low
.Assembly	OPTION		55		Fix_Low
.Assembly	OPTION		56		Fix_Low
.Assembly	OPTION		57		Fix_Low
.Assembly	OPTION		58		Fix_Low
.Assembly	OPTION		59		Fix_Low
.Assembly	OPTION		60		Fix_Low
.Assembly	OPTION		61 : 63		Fix_Low

; Code Option 0x0400~0x043b
;.Assembly	OPTION		48 : 255	Fix_Low

; Code Option 0x0430~0x043b
.Assembly	OPTION		64 : 76		Fix_High
.Assembly	OPTION		77 : 79		Fix_Low
.Assembly	OPTION		80 : 92		Fix_High
.Assembly	OPTION		93 : 95		Fix_Low
.Assembly	OPTION		96 : 108	Fix_High
.Assembly	OPTION		109 : 111	Fix_Low
.Assembly	OPTION		112 : 124	Fix_High
.Assembly	OPTION		125 : 127	Fix_Low
.Assembly	OPTION		128 : 140	Fix_High
.Assembly	OPTION		141 : 143	Fix_Low
.Assembly	OPTION		144 : 156	Fix_High
.Assembly	OPTION		157 : 159	Fix_Low
.Assembly	OPTION		160 : 172	Fix_High
.Assembly	OPTION		173 : 175	Fix_Low
.Assembly	OPTION		176 : 188	Fix_High
.Assembly	OPTION		189 : 191	Fix_Low
.Assembly	OPTION		192 : 204	Fix_High
.Assembly	OPTION		205 : 207	Fix_Low
.Assembly	OPTION		208 : 220	Fix_High
.Assembly	OPTION		221 : 223	Fix_Low
.Assembly	OPTION		224 : 236	Fix_High
.Assembly	OPTION		237 : 239	Fix_Low
.Assembly	OPTION		240 : 252	Fix_High
.Assembly	OPTION		253 : 255	Fix_Low

; Code Option 0x0420~0x042F
.Assembly	OPTION		256 : 268	Fix_High
.Assembly	OPTION		269 : 271	Fix_Low
.Assembly	OPTION		272 : 284	Fix_High
.Assembly	OPTION		285 : 287	Fix_Low
.Assembly	OPTION		288 : 300	Fix_High
.Assembly	OPTION		301 : 303	Fix_Low
.Assembly	OPTION		304 : 316	Fix_High
.Assembly	OPTION		317 : 319	Fix_Low
.Assembly	OPTION		320 : 332	Fix_High
.Assembly	OPTION		333 : 335	Fix_Low
.Assembly	OPTION		336 : 348	Fix_High
.Assembly	OPTION		349 : 351	Fix_Low
.Assembly	OPTION		352 : 364	Fix_High
.Assembly	OPTION		365 : 367	Fix_Low
.Assembly	OPTION		368 : 380	Fix_High
.Assembly	OPTION		381 : 383	Fix_Low
.Assembly	OPTION		384 : 396	Fix_High
.Assembly	OPTION		397 : 399	Fix_Low
.Assembly	OPTION		400 : 412	Fix_High
.Assembly	OPTION		413 : 415	Fix_Low
.Assembly	OPTION		416 : 428	Fix_High
.Assembly	OPTION		429 : 431	Fix_Low
.Assembly	OPTION		432 : 444	Fix_High
.Assembly	OPTION		445 : 447	Fix_Low
.Assembly	OPTION		448 : 460	Fix_High
.Assembly	OPTION		461 : 463	Fix_Low
.Assembly	OPTION		464 : 476	Fix_High
.Assembly	OPTION		477 : 479	Fix_Low
.Assembly	OPTION		480 : 492	Fix_High
.Assembly	OPTION		493 : 495	Fix_Low
.Assembly	OPTION		496 : 508	Fix_High
.Assembly	OPTION		509 : 511	Fix_Low

; Code Option 0x0410~0x041F
.Assembly	OPTION		512 : 524	Fix_High
.Assembly	OPTION		525 : 527	Fix_Low
.Assembly	OPTION		528 : 540	Fix_High
.Assembly	OPTION		541 : 543	Fix_Low
.Assembly	OPTION		544 : 556	Fix_High
.Assembly	OPTION		557 : 559	Fix_Low
.Assembly	OPTION		560 : 572	Fix_High
.Assembly	OPTION		573 : 575	Fix_Low
.Assembly	OPTION		576 : 588	Fix_High
.Assembly	OPTION		589 : 591	Fix_Low
.Assembly	OPTION		592 : 604	Fix_High
.Assembly	OPTION		605 : 607	Fix_Low
.Assembly	OPTION		608 : 620	Fix_High
.Assembly	OPTION		621 : 623	Fix_Low
.Assembly	OPTION		624 : 636	Fix_High
.Assembly	OPTION		637 : 639	Fix_Low
.Assembly	OPTION		640 : 652	Fix_High
.Assembly	OPTION		653 : 655	Fix_Low
.Assembly	OPTION		656 : 668	Fix_High
.Assembly	OPTION		669 : 671	Fix_Low
.Assembly	OPTION		672 : 684	Fix_High
.Assembly	OPTION		685 : 687	Fix_Low
.Assembly	OPTION		688 : 700	Fix_High
.Assembly	OPTION		701 : 703	Fix_Low
.Assembly	OPTION		704 : 716	Fix_High
.Assembly	OPTION		717 : 719	Fix_Low
.Assembly	OPTION		720 : 732	Fix_High
.Assembly	OPTION		733 : 735	Fix_Low
.Assembly	OPTION		736 : 748	Fix_High
.Assembly	OPTION		749 : 751	Fix_Low
.Assembly	OPTION		752 : 764	Fix_High
.Assembly	OPTION		765 : 767	Fix_Low

; Code Option 0x0400~0x040F
.Assembly	OPTION		768 : 780	Fix_High
.Assembly	OPTION		781 : 783	Fix_Low
.Assembly	OPTION		784 : 796	Fix_High
.Assembly	OPTION		797 : 799	Fix_Low
.Assembly	OPTION		800 : 812	Fix_High
.Assembly	OPTION		813 : 815	Fix_Low
.Assembly	OPTION		816 : 828	Fix_High
.Assembly	OPTION		829 : 831	Fix_Low
.Assembly	OPTION		832 : 844	Fix_High
.Assembly	OPTION		845 : 847	Fix_Low
.Assembly	OPTION		848 : 860	Fix_High
.Assembly	OPTION		861 : 863	Fix_Low
.Assembly	OPTION		864 : 876	Fix_High
.Assembly	OPTION		877 : 879	Fix_Low
.Assembly	OPTION		880 : 892	Fix_High
.Assembly	OPTION		893 : 895	Fix_Low
.Assembly	OPTION		896 : 908	Fix_High
.Assembly	OPTION		909 : 911	Fix_Low
.Assembly	OPTION		912 : 924	Fix_High
.Assembly	OPTION		925 : 927	Fix_Low
.Assembly	OPTION		928 : 940	Fix_High
.Assembly	OPTION		941 : 943	Fix_Low
.Assembly	OPTION		944 : 956	Fix_High
.Assembly	OPTION		957 : 959	Fix_Low
.Assembly	OPTION		960 : 972	Fix_High
.Assembly	OPTION		973 : 975	Fix_Low
.Assembly	OPTION		976 : 988	Fix_High
.Assembly	OPTION		989 : 991	Fix_Low
.Assembly	OPTION		992 : 1004	Fix_High
.Assembly	OPTION		1005 : 1007	Fix_Low
.Assembly	OPTION		1008 : 1020	Fix_High
.Assembly	OPTION		1021 : 1023	Fix_Low


.Assembly	OPTION		2ffh

	STK4H			EQU		026h
	STK4L			EQU		027h
	STK3H			EQU		028h
	STK3L			EQU		029h
	STK2H			EQU		02Ah
	STK2L			EQU		02Bh
	STK1H			EQU		02Ch
	STK1L			EQU		02Dh
	STK0H			EQU		02Eh
	STK0L			EQU		02Fh
	
	Z			EQU		030H
	Y			EQU		031H
	
	P0			EQU 		032H
		FP00	EQU 	P0.0
		FP01	EQU 	P0.1
		FP02	EQU 	P0.2
		FP03	EQU_R 	P0.3
		FP04	EQU 	P0.4
		FP05	EQU 	P0.5
		FP06	EQU 	P0.6
		FP07	EQU 	P0.7

	P1			EQU 		033H
		FP10	EQU 	P1.0
		FP11	EQU 	P1.1
		FP12	EQU 	P1.2
		FP13	EQU 	P1.3


	P0M			EQU		034H
		FP00M	EQU		P0M.0
		FP01M	EQU		P0M.1
		FP02M	EQU		P0M.2
		FP04M	EQU		P0M.4
		FP05M	EQU		P0M.5
		FP06M	EQU		P0M.6
		FP07M	EQU		P0M.7
	P1M			EQU		035H
		FP10M	EQU		P1M.0
		FP11M	EQU		P1M.1
		FP12M	EQU		P1M.2
		FP13M	EQU		P1M.3

	PDR        EQU     036H
	    FP00DR   EQU     PDR.0
	    FP01DR   EQU     PDR.1
	    FP02DR   EQU     PDR.2
  	
	    FP10DR   EQU     PDR.4
	    FP11DR   EQU     PDR.5
	    FP12DR   EQU     PDR.6

	PUR        EQU     037H
	    FP00UR   EQU     PUR.0
	    FP01UR   EQU     PUR.1
	    FP02UR   EQU     PUR.2
  	
	    FP04UR   EQU     PUR.4
	    FP05UR   EQU     PUR.5
	    FP06UR   EQU     PUR.6
	    FP07UR   EQU     PUR.7

	T0M			EQU		038H
		FT0EG	   EQU	T0M.2
		FT0CKS	   EQU	T0M.3
		FT0RATE0   EQU	T0M.4
		FT0RATE1   EQU	T0M.5
		FT0RATE2   EQU	T0M.6
		FT0ENB     EQU	T0M.7
	T0C			EQU		039H

	INT			EQU		03AH
		FP00IEN	EQU		INT.0
		FICIIEN	EQU		INT.1
		FT0IEN	EQU		INT.2
		FP00IRQ	EQU		INT.4
		FICIIRQ	EQU		INT.5
		FT0IRQ	EQU		INT.6
		FGIE	EQU		INT.7

	PFLAG			EQU		03BH
		FZ	EQU		PFLAG.0
		FDC	EQU		PFLAG.1
		FC	EQU		PFLAG.2
		FCPUM0 	EQU		PFLAG.3
		FCPUM1	EQU		PFLAG.4
		FNPD	EQU		PFLAG.5
		FNT0	EQU		PFLAG.6

	PCL			EQU		03CH
	PCH			EQU		03DH

	WDTR			EQU_W		03EH
	@YZ			EQU		03FH
; -----------------------------------------------------
; Clear watchdog macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 2 

	@RST_WDT	macro		
 		   MOV  A, #0x5A
		   MOV  WDTR, A
	endm
; -----------------------------------------------------
; Sleep Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 1

	SleepMode	macro	
		BSET	FCPUM0
	endm
; -----------------------------------------------------
; Green Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 3

	GreenMode	macro	
		BSET	FCPUM1
		NOP
		NOP
	endm


.TEXT
{
	//{{SONIX_OPTION_RULE
	
	ENDP
	//}}SONIX_OPTION_RULE
}
