
;------------------------------------------------------------------------------
;  CHIP: SN8DW100
;  Revision History
;  
;  V01   2015/04/08______First issue
;  V02 	 2015/04/13______Modify CHS1/CHS2/REGC register	
;  V03 	 2015/04/17______Modify §R°£ PEROMH5/ PEROMH6/ PEROMH7 /PERAMH3/ PERAMH4
;  V04 	 2015/04/21______INTEN/INTRQ modify	
;  V05	 2015/04/28______LBTM
;  V06	 2015/05/08______Remove Rbank 3 & 4 
;  V07	 2015/05/11______ADD SIO
;  V08	 2015/06/02______Modify P0UR R/W 

;------------------------------------------------------------------------------
.Assembly	INC_VER		1
.ASSEMBLY	RedWrt_FORMAT   1
.Assembly	ASM_FORMAT	1
.Assembly	L_ROM_Size 	1
.Assembly	RAM_Size	1280

.Assembly	INSTRUMENT	SN8DW100
.Assembly	BIT_FILE	SN8DW100

.Assembly	OTP_BODY_SIZE	0x2000
.Assembly	USER_ROM_SIZE	0x1FF8
.Assembly	COMMAND		Enable_ORG4_7, EB_ICE, INFOR_PAGE_256WORD
.Assembly	PGM_TYPE	6
.Assembly	MASK_TEST_CODE	0x0000, 0x0000, 0x0000, 0x0000
.Assembly	Port_Pins	8, 8, 0, 6, 0, 8

.Assembly	CHIP_ID		0x9500

//.Assembly	LCD_Start_Address	0x1F00


;==============================================================================================================
; Code Option 0x1FFF

.Assembly	OPTION			0		LOWPOWER	Enable	Disable	
;.Assembly	OPTION			0		Filter		Disable	Enable	
.Assembly	OPTION			1		Security	Enable	Disable
.Assembly	OPTION			2		High_Clk_DIV	Fhosc/1 Fhosc/2	Fhosc/4 Fhosc/8 
.Assembly	OPTION			4		Fix_High
.Assembly	OPTION		        5		Fix_High	;			
.Assembly	OPTION		        6		Fix_High	;Only IHRC	
.Assembly	OPTION		        7		Fix_High
.Assembly	OPTION			8		Watch_Dog	x x x x x Enable x x x x Disable x x x x Always_On 
.Assembly	OPTION			12		NDT18		Disable Enable	
.Assembly	OPTION			13		NDT33		Disable Enable	
.Assembly	OPTION			14		Hold_time	4ms	2ms			
.Assembly	OPTION			15		Fix_High



; Code Option 0x1FFE
.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		Fix_Low
.Assembly	OPTION			25		Fix_High
.Assembly	OPTION			26		Fix_Low
.Assembly	OPTION			27 : 31		Fix_High

; Code Option 0x1FFD
.Assembly	OPTION			32 : 40		Fix_High ;(IHRC_CAL_Data)
.Assembly	OPTION			41 : 47		Fix_High

; Code Option 0x1FFC
.Assembly	OPTION			48		Fix_Low		;LD16[2:0]<--> 48~50
.Assembly	OPTION			49		Fix_Low
.Assembly	OPTION			50		Fix_High 	
.Assembly	OPTION			51		Fix_Low		;AVDDR[6:3]<--> 51~54
.Assembly	OPTION			52		Fix_Low		
.Assembly	OPTION			53		Fix_Low		
.Assembly	OPTION			54		Fix_High 
.Assembly	OPTION			55 : 63		Fix_High ;	

;==============================================================================================================

.Assembly	OPTION		2ffh

	L			EQU		080H
	H			EQU		081H
	R			EQU		082H
	Z			EQU		083H
	Y			EQU		084H
	X			EQU		085H

	PFLAG			EQU		086H
		FZ		EQU		PFLAG.0
		FDC		EQU		PFLAG.1
		FC		EQU		PFLAG.2

	RBANK			EQU		087H
		FRBNKS0		EQU		RBANK.0
		FRBNKS1		EQU		RBANK.1
		FRBNKS2		EQU		RBANK.2
;		FRBNKS3		EQU		RBANK.3
;		FRBNKS4		EQU		RBANK.4


	W0			EQU		088H
	W1			EQU		089H
	W2			EQU		08AH
	W3			EQU		08BH
	W4			EQU		08CH
	W5			EQU		08DH
	W6			EQU		08EH
	W7			EQU		08FH

	VREG			EQU		090H

		FAVDDREN 	EQU		VREG.0
		FAVEN		EQU		VREG.1
		FACMEN		EQU		VREG.2
		FBGEN		EQU		VREG.3
		PGAEH0		EQU		VREG.4
		PGAEH1		EQU		VREG.5
		


	ADCM1			EQU		092H
		FRVS0		EQU		ADCM1.0
		FRVS1		EQU		ADCM1.1
		FRVS2		EQU		ADCM1.2
		FRVS3		EQU		ADCM1.3
		FOSR0		EQU		ADCM1.4
		FOSR1		EQU		ADCM1.5
		FOSR2		EQU		ADCM1.6
		FOSR3		EQU		ADCM1.7

	ADCM2			EQU		093H
		FADEN		EQU		ADCM2.0
		FDRDY		EQU		ADCM2.1
		FADGN		EQU		ADCM2.2
		FGR		EQU		ADCM2.3
		FGX		EQU		ADCM2.4
		FINREN		EQU		ADCM2.5
		FCIC		EQU		ADCM2.6



	ADCM3			EQU		094H
		FADCKS0		EQU		ADCM3.0
		FADCKS1		EQU		ADCM3.1
		FADCKS2		EQU		ADCM3.2
		FCPCSK0		EQU		ADCM3.4
		FCPCSK1		EQU		ADCM3.5
		FCPCSK2		EQU		ADCM3.6
		FACHPEN		EQU		ADCM3.7


	LBTM			EQU		095H
		FLBTEN		EQU		LBTM.0
		FLBTO		EQU		LBTM.1
		FLBTSEL0	EQU		LBTM.2
		FLBTSEL1	EQU		LBTM.3
		FLBTSEL2	EQU		LBTM.4
		FLBTSEL3	EQU		LBTM.5
		FP01IO		EQU		LBTM.6



	CHS1			EQU		096H
		MUX10		EQU		CHS1.0
		MUX11		EQU		CHS1.1
		MUX12		EQU		CHS1.2
		MUX13		EQU		CHS1.3
		MUX20		EQU		CHS1.4
		MUX21		EQU		CHS1.5
		MUX30		EQU		CHS1.6


	CHS2			EQU		097H
		MUX40		EQU		CHS2.0
		MUX41		EQU		CHS2.1
		MUX42		EQU		CHS2.2
		MUX43		EQU		CHS2.3
		MUX44		EQU		CHS2.4
		MUXA0		EQU		CHS2.6
		MUXA1		EQU		CHS2.7


	ADCDH			EQU_R		09CH
	ADCDM			EQU_R		09DH
	ADCDL			EQU_R		09EH

	AMPM			EQU		09FH
		FAMPEN		EQU		AMPM.0
		FPCHPEN		EQU		AMPM.1
		FGS0		EQU		AMPM.2
		FGS1		EQU		AMPM.3
		FGS2		EQU		AMPM.4
		FSW100K		EQU		AMPM.5
		FAVDDRS0	EQU		AMPM.6
		FAVDDRS1	EQU		AMPM.7


	P0M			EQU		0A0H	
		FP00M		EQU		P0M.0
		FP01M		EQU		P0M.1
		FP02M		EQU		P0M.2
		FP03M		EQU		P0M.3
	

	P0UR       		EQU		0A4H
	    	FP00R  		EQU		P0UR.0
	    	FP01R  	 	EQU		P0UR.1
	    	FP02R   	EQU		P0UR.2		
	    	FP03R   	EQU		P0UR.3


  		
	P0			EQU 		0A8H	
		FP00		EQU 		P0.0
		FP01		EQU 		P0.1
		FP02		EQU 		P0.2
		FP03		EQU 		P0.3	

	
	
       INTEN			EQU		0B0H
		FP00IEN		EQU		INTEN.0
		FSIOIEN		EQU		INTEN.4
		FMSPIEN		EQU		INTEN.5
		FT0IEN		EQU		INTEN.6
		FADCIEN		EQU		INTEN.7

 
       INTRQ			EQU		0B2H
		FP00IRQ		EQU		INTRQ.0
		FSIOIRQ		EQU		INTRQ.4
		FMSPIRQ		EQU		INTRQ.5
		FT0IRQ		EQU		INTRQ.6
		FADCIRQ		EQU		INTRQ.7

	

	OSCM			EQU		0B6H
		FSTPHX		EQU		OSCM.1
		FCLKMD		EQU		OSCM.2
		FCPUM0		EQU		OSCM.3
		FCPUM1		EQU		OSCM.4

	WDTR			EQU_W		0B7H
	PCH			EQU		0B8H
	PCL			EQU		0B9H

	STKP			EQU		0BAH
		FSTKPB0		EQU		STKP.0
		FSTKPB1		EQU		STKP.1
		FSTKPB2		EQU		STKP.2
		FSTKPB3		EQU		STKP.3		
		FGIE		EQU		STKP.7		
	
	PEDGE			EQU		0BBH	
		FP00G0		EQU		PEDGE.0	 
		FP00G1		EQU		PEDGE.1	


	@HL			EQU		0BCH
	@YZ			EQU		0BDH
	

	T0M			EQU		0C0H

		FT0RATE0 	EQU  		T0M.4
		FT0RATE1 	EQU  		T0M.5
		FT0RATE2 	EQU  		T0M.6
		FT0ENB		EQU  		T0M.7

	T0C			EQU		0C1H



	MSPSTAT			EQU		0D0H
		FBF	 	EQU_R  		MSPSTAT.0
		FRED_WRT 	EQU_R  		MSPSTAT.2
		FS	 	EQU_R  		MSPSTAT.3
		FP	 	EQU_R  		MSPSTAT.4
		FD_A	 	EQU_R  		MSPSTAT.5
		FCKE	 	EQU  		MSPSTAT.6

	MSPM1			EQU		0D1H
		FMSPC	 	EQU  		MSPM1.0
		FMSPWK	 	EQU  		MSPM1.2
		FSLRXCKP 	EQU  		MSPM1.3
		FCKP	 	EQU  		MSPM1.4
		FMSPENB	 	EQU  		MSPM1.5
		FMSPOV	 	EQU  		MSPM1.6
		FWCOL	 	EQU  		MSPM1.7

	MSPM2			EQU		0D2H
		FSEN	 	EQU  		MSPM2.0
		FRSEN	 	EQU  		MSPM2.1
		FPEN	 	EQU  		MSPM2.2
		FRCEN	 	EQU  		MSPM2.3
		FACKEN	 	EQU  		MSPM2.4
		FACKDT	 	EQU  		MSPM2.5
		FACKSTAT 	EQU  		MSPM2.6
		FGCEN	 	EQU  		MSPM2.7

	MSPBUF			EQU		0D3H
	MSPADR			EQU		0D4H

	SIOM			EQU		0D5H
		FSENB		EQU		SIOM.7
		FSTART		EQU		SIOM.6
		FSRATE1		EQU		SIOM.5
		FSRATE0		EQU		SIOM.4
		FMLSB		EQU		SIOM.3
		FSCKMD		EQU		SIOM.2
		FCPOL		EQU		SIOM.1
		FCPHA		EQU		SIOM.0

	SIOR			EQU_W		0D6H
	SIOB			EQU		0D7H



	PECMD			EQU		0DAH
	PEROML			EQU		0DBH
	PEROMH			EQU		0DCH
		PEROMH0		EQU		PEROMH.0
		PEROMH1		EQU		PEROMH.1
		PEROMH2		EQU		PEROMH.2
		PEROMH3		EQU		PEROMH.3
		PEROMH4		EQU		PEROMH.4		

	PERAML			EQU		0DDH
	PERAMH			EQU		0DEH
		PERAMH0		EQU  		PERAMH.0		
		PERAMH1		EQU  		PERAMH.1		
		PERAMH2		EQU  		PERAMH.2		


	PERAMCNT		EQU		0DFH

		PERAMCNT0	EQU  		PERAMCNT.3		
		PERAMCNT1	EQU  		PERAMCNT.4
		PERAMCNT2	EQU  		PERAMCNT.5
		PERAMCNT3	EQU  		PERAMCNT.6
		PERAMCNT4	EQU  		PERAMCNT.7



	STK0L			EQU		0E0H
	STK0H			EQU		0E1H
	STK1L			EQU		0E2H
	STK1H			EQU		0E3H
	STK2L			EQU		0E4H
	STK2H			EQU		0E5H
	STK3L			EQU		0E6H
	STK3H			EQU		0E7H
	STK4L			EQU		0E8H
	STK4H			EQU		0E9H
	STK5L			EQU		0EAH
	STK5H			EQU		0EBH
	STK6L			EQU		0ECH
	STK6H			EQU		0EDH
	STK7L			EQU		0EEH
	STK7H			EQU		0EFH
	STK8L			EQU		0F0H
	STK8H			EQU		0F1H
	STK9L			EQU		0F2H
	STK9H			EQU		0F3H
	STK10L			EQU		0F4H
	STK10H			EQU		0F5H
	STK11L			EQU		0F6H
	STK11H			EQU		0F7H
	STK12L			EQU		0F8H
	STK12H			EQU		0F9H
	STK13L			EQU		0FAH
	STK13H			EQU		0FBH
	STK14L			EQU		0FCH
	STK14H			EQU		0FDH
	STK15L			EQU		0FEH
	STK15H			EQU		0FFH


; -----------------------------------------------------
; Clear watchdog macro. 
;  
; Total Cycle: 2

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

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

	GreenMode	macro	
		B0BSET	FCPUM1
		NOP
		NOP
	endm
; -----------------------------------------------------
; Slow Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 2

	SlowMode	macro	
		B0BSET	FCLKMD
		B0BSET	FSTPHX
	endm
; -----------------------------------------------------
;  Slow mode to Normal Mode control macro for compatibility in S8KD-2 ICE
;  
; Total Cycle: 5

	Slow2Normal	macro	
		B0BCLR	FSTPHX
		NOP
		NOP
		NOP
		B0BCLR	FCLKMD
	endm
; -----------------------------------------------------		
.TEXT
{
	//{{SONIX_OPTION_RULE
        
	ENDP
	//}}SONIX_OPTION_RULE
}			  								