				;file c:\users\edenlai\desktop\esk310\seven segment\SEVEN SEGMENT.c
				;1	/************************************************************
				;2	* PROGRAM : SEVEN SEGMENT
				;3	* Wire Connection:
				;4	*   ESK303 (VDD) connects to ESK310 (5V)
				;5	*   ESK303 (GND) connects to ESK310 (GND)
				;6	*   ESK303 (C0~C6) connects to ESK310 ((JP7)a~g)
				;7	* Created on 2021/08/27 by Best Modules Corp.
				;8	*************************************************************/
				;9	
				;10	#include "HT66F2390.h"
				;11	#include "setup.h"
				;12	
				;13	void main()
				;14	{	
				@code .SECTION 'CODE'
				include HT66F2390.inc
0000	1F0B	clr     PBP
0001	2802	jmp     _main_startup1
				@start .SECTION 'CODE'
				_main_startup1:
				@start .SECTION 'CODE'
0002	0F00	mov     a, 0H
0003	008B	mov     PBP, a
0004	2841	jmp     _main
0005	7F67	sz      i[98].6
0006	7D07	sz      i[2].2
0007	666D	call    E6DH
0008	5B4F	rrca    i[74]
0009	3F06	sz      PCL.6
000A	0000	nop
000B	0000	nop
				L000C:
000C	0000	nop
000D	0000	nop
000E	0000	nop
				L000F:
000F	0000	nop
0010	1785	sdz     ACC
0011	280F	jmp     L000F
				L0012:
0012	0000	nop
0013	1785	sdz     ACC
0014	2812	jmp     L0012
0015	5782	sdz     rc[1]
0016	2812	jmp     L0012
0017	0003	ret
				;15		setup();
				_main:
				_main:
0041	203D	call    _setup
				;16		unsigned char i;	
				;17		while(1)
				;18		{	
				;19			for(i=0;i<10;i++)
				_L12:
0042	5F05	clr     i[0]
004F	5485	inc     i[0]
0050	0F09	mov     a, 9H
0051	4205	sub     a, i[0]
0052	3C0A	sz      C
0053	2843	jmp     _L10
0054	2842	jmp     _L12
0055	2855	jmp     $
				L0E6D:
				org	0e6dh
0E6D	0000	nop
				;20			{	
				;21				SEGMENT_Port=SEGMENT_TAB[i];	
				_L10:
0043	0F0A	mov     a, AH
0044	4305	add     a, i[0]
0045	0083	mov     MP1L, a
0046	0F80	mov     a, 80H
0047	1F04	clr     MP1H
0048	1384	adcm    a, MP1H
0049	2030	call    L0030
004A	009B	mov     PC, a
				;22				Delay10ms(100);							//delay 1 second 
004B	0F64	mov     a, 64H
004C	4083	mov     delay, a
004D	5F04	clr     delay[1]
004E	2018	call    _Delay10ms
				;23			}
				;24		}
				;25	}
				;file c:\users\edenlai\desktop\esk310\seven segment\setup.h
				;1	#define SEGMENT_Port	_pc
				;2	#define SEGMENT_PortC	_pcc
				;3	const unsigned char SEGMENT_TAB[] = {0x67,0x7F,0x07,0x7D,0x6D,0x66,0x4F,0x5B,0x06,0x3F};		//Seven-Segment Table
				;4	
				;5	void setup()									//Delay1ms
				;6	{	
				;7		_wdtc=0xAB;									//Turn off the watchdog timer
				_setup:
				_setup:
003D	0FAB	mov     a, ABH
003E	00BE	mov     WDTC, a
				;8		SEGMENT_PortC=0;							//Set SEGMENT_Port to output mode
003F	1F1C	clr     PCC
0040	0003	ret
				;9	}
				;10	
				;11	void Delay1ms(unsigned short delay)				//Delay1ms
				;12	{	
				;13		unsigned short i;											
				;14		for(i=0;i<delay;i++) GCC_DELAY(2000);		//GCC_DELAY(0.5us)
				;15	}	
				;16	
				;17	void Delay10ms(unsigned short delay)			//Delay10ms
				;18	{	
				;19		unsigned short i;											
				;20		for(i=0;i<delay;i++) GCC_DELAY(20000);		//GCC_DELAY(0.5us)
				_Delay10ms:
				_Delay10ms:
0018	5F00	clr     rb
0019	5F01	clr     rc
001A	2828	jmp     _L7
				_L8:
001B	0F13	mov     a, 13H
001C	4082	mov     rc[1], a
001D	0F7B	mov     a, 7BH
001E	340B	clr     PBP0
001F	348B	clr     PBP1
0020	350B	clr     PBP2
0021	200C	call    L000C
0022	350B	clr     PBP2
0023	348B	clr     PBP1
0024	340B	clr     PBP0
0025	5480	inc     rb
0026	3D0A	sz      Z
0027	5481	inc     rc
				_L7:
0028	4700	mov     a, rb
0029	4203	sub     a, delay[0]
002A	4701	mov     a, rc
002B	5204	sbc     a, delay[1]
002C	3B0A	snz     CZ
002D	281B	jmp     _L8
002E	0003	ret
002F	1483	inc     MP1L
				L0030:
0030	3F84	sz      MP1H.7
0031	2834	jmp     L0034
0032	0702	mov     a, [02H]
0033	0003	ret
				L0034:
0034	1B04	rrca    MP1H
0035	0E3F	and     a, 3FH
0036	0089	mov     TBHP, a
0037	1B03	rrca    MP1L
0038	0087	mov     TBLP, a
0039	1D05	tabrd   ACC
003A	3C0A	sz      C
003B	0708	mov     a, TBLH
003C	0003	ret
				;21	}
				data .SECTION 'DATA'
				__pc DB DUP (?) ; __pc
				__pcc DB DUP (?) ; __pcc
				__wdtc DB DUP (?) ; __wdtc
				rb DB DUP (?)
				rc DB DUP (?)
				delay DB 2 DUP (?) ; delay
				i DB DUP (?) ; i
