⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fil10.asm

📁 单片机学习系统附的实验源代码
💻 ASM
📖 第 1 页 / 共 2 页
字号:
;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.3.8 Thu Mar 17 15:42:05 2005

;--------------------------------------------------------
	.module fil10
	.optsdcc -mmcs51 --model-small
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _display_PARM_2
	.globl _disbuf_u
	.globl _main
	.globl _timer
	.globl _count
	.globl _times
	.globl _delay
	.globl _display
	.globl _delay5ms
	.globl _DIS_NUM
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
_P0	=	0x0080
_SP	=	0x0081
_DPL	=	0x0082
_DPH	=	0x0083
_PCON	=	0x0087
_TCON	=	0x0088
_TMOD	=	0x0089
_TL0	=	0x008a
_TL1	=	0x008b
_TH0	=	0x008c
_TH1	=	0x008d
_P1	=	0x0090
_SCON	=	0x0098
_SBUF	=	0x0099
_P2	=	0x00a0
_IE	=	0x00a8
_P3	=	0x00b0
_IP	=	0x00b8
_PSW	=	0x00d0
_ACC	=	0x00e0
_B	=	0x00f0
;--------------------------------------------------------
; special function bits 
;--------------------------------------------------------
_P0_0	=	0x0080
_P0_1	=	0x0081
_P0_2	=	0x0082
_P0_3	=	0x0083
_P0_4	=	0x0084
_P0_5	=	0x0085
_P0_6	=	0x0086
_P0_7	=	0x0087
_IT0	=	0x0088
_IE0	=	0x0089
_IT1	=	0x008a
_IE1	=	0x008b
_TR0	=	0x008c
_TF0	=	0x008d
_TR1	=	0x008e
_TF1	=	0x008f
_P1_0	=	0x0090
_P1_1	=	0x0091
_P1_2	=	0x0092
_P1_3	=	0x0093
_P1_4	=	0x0094
_P1_5	=	0x0095
_P1_6	=	0x0096
_P1_7	=	0x0097
_RI	=	0x0098
_TI	=	0x0099
_RB8	=	0x009a
_TB8	=	0x009b
_REN	=	0x009c
_SM2	=	0x009d
_SM1	=	0x009e
_SM0	=	0x009f
_P2_0	=	0x00a0
_P2_1	=	0x00a1
_P2_2	=	0x00a2
_P2_3	=	0x00a3
_P2_4	=	0x00a4
_P2_5	=	0x00a5
_P2_6	=	0x00a6
_P2_7	=	0x00a7
_EX0	=	0x00a8
_ET0	=	0x00a9
_EX1	=	0x00aa
_ET1	=	0x00ab
_ES	=	0x00ac
_EA	=	0x00af
_P3_0	=	0x00b0
_P3_1	=	0x00b1
_P3_2	=	0x00b2
_P3_3	=	0x00b3
_P3_4	=	0x00b4
_P3_5	=	0x00b5
_P3_6	=	0x00b6
_P3_7	=	0x00b7
_RXD	=	0x00b0
_TXD	=	0x00b1
_INT0	=	0x00b2
_INT1	=	0x00b3
_T0	=	0x00b4
_T1	=	0x00b5
_WR	=	0x00b6
_RD	=	0x00b7
_PX0	=	0x00b8
_PT0	=	0x00b9
_PX1	=	0x00ba
_PT1	=	0x00bb
_PS	=	0x00bc
_P	=	0x00d0
_F1	=	0x00d1
_OV	=	0x00d2
_RS0	=	0x00d3
_RS1	=	0x00d4
_F0	=	0x00d5
_AC	=	0x00d6
_CY	=	0x00d7
;--------------------------------------------------------
; overlayable register banks 
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
_Counts:
	.ds 4
_scount:
	.ds 4
_times::
	.ds 1
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.area	OSEG    (OVR,DATA)
	.area	OSEG    (OVR,DATA)
_display_PARM_2::
	.ds 1
;--------------------------------------------------------
; Stack segment in internal ram 
;--------------------------------------------------------
	.area	SSEG	(DATA)
__start__stack:
	.ds	1

;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
	.area ISEG    (DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
	.area BSEG    (BIT)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
	.area XSEG    (XDATA)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG   (XDATA)
;--------------------------------------------------------
; interrupt vector 
;--------------------------------------------------------
	.area CSEG    (CODE)
__interrupt_vect:
	ljmp	__sdcc_gsinit_startup
	ljmp	_count
	.ds	5
	ljmp	_timer
	.ds	5
	reti
	.ds	7
	reti
	.ds	7
	reti
	.ds	7
	reti
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area GSINIT  (CODE)
	.area GSFINAL (CODE)
	.area GSINIT  (CODE)
__sdcc_gsinit_startup:
	mov	sp,#__start__stack - 1
	lcall	__sdcc_external_startup
	mov	a,dpl
	jz	__sdcc_init_data
	ljmp	__sdcc_program_startup
__sdcc_init_data:
;	_mcs51_genXINIT() start
	mov	r1,#l_XINIT
	mov	a,r1
	orl	a,#(l_XINIT >> 8)
	jz	00003$
	mov	r2,#((l_XINIT+255) >> 8)
	mov	dptr,#s_XINIT
	mov	r0,#s_XISEG
	mov	p2,#(s_XISEG >> 8)
00001$:	clr	a
	movc	a,@a+dptr
	movx	@r0,a
	inc	dptr
	inc	r0
	cjne	r0,#0,00002$
	inc	p2
00002$:	djnz	r1,00001$
	djnz	r2,00001$
	mov	p2,#0xFF
00003$:
;	_mcs51_genXINIT() end
;	_mcs51_genRAMCLEAR() start
	mov	r0,#l_XSEG
	mov	a,r0
	orl	a,#(l_XSEG >> 8)
	jz	00005$
	mov	r1,#((l_XSEG + 255) >> 8)
	mov	dptr,#s_XSEG
	clr     a
00004$:	movx	@dptr,a
	inc	dptr
	djnz	r0,00004$
	djnz	r1,00004$
00005$:	mov	@r0,a
	djnz	r0,00005$
;	_mcs51_genRAMCLEAR() end
	.area GSFINAL (CODE)
	ljmp	__sdcc_program_startup
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area HOME    (CODE)
	.area CSEG    (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area CSEG    (CODE)
__sdcc_program_startup:
	lcall	_main
;	return from main will lock up
	sjmp .
;------------------------------------------------------------
;Allocation info for local variables in function 'count'
;------------------------------------------------------------
;------------------------------------------------------------
;c:/hj51avr/code/c/fil10.c:37: void count (void) interrupt 0 {
;	-----------------------------------------
;	 function count
;	-----------------------------------------
_count:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
	push	acc
	push	b
	push	dpl
	push	dph
	push	psw
	mov	psw,#0x00
;c:/hj51avr/code/c/fil10.c:38: Counts++;                 //结果只是简单地增加计数值
;     genPlus
;     genPlusIncr
	inc	_Counts
	clr	a
	cjne	a,_Counts,00103$
	inc	(_Counts + 1)
	cjne	a,(_Counts + 1),00103$
	inc	(_Counts + 2)
	cjne	a,(_Counts + 2),00103$
	inc	(_Counts + 3)
00103$:
00101$:
	pop	psw
	pop	dph
	pop	dpl
	pop	b
	pop	acc
	reti
;------------------------------------------------------------
;Allocation info for local variables in function 'timer'
;------------------------------------------------------------
;------------------------------------------------------------
;c:/hj51avr/code/c/fil10.c:41: void timer(void) interrupt 1{
;	-----------------------------------------
;	 function timer
;	-----------------------------------------
_timer:
	push	acc
	push	b
	push	dpl
	push	dph
	push	psw
	mov	psw,#0x00
;c:/hj51avr/code/c/fil10.c:42: TH0 = 0;
;     genAssign
	mov	_TH0,#0x00
;c:/hj51avr/code/c/fil10.c:43: TL0 = 0;
;     genAssign
	mov	_TL0,#0x00
;c:/hj51avr/code/c/fil10.c:44: times ++;   
;     genPlus
;     genPlusIncr
	inc	_times
;c:/hj51avr/code/c/fil10.c:46: if(times == 10)
;     genCmpEq
	mov	a,_times
;       Peephole 112.b  changed ljmp to sjmp
;       Peephole 199    optimized misc jump sequence
	cjne    a,#0x0A,00103$
;00106$:
;       Peephole 200    removed redundant sjmp
00107$:
;c:/hj51avr/code/c/fil10.c:48: scount = Counts;
;     genAssign
	mov	_scount,_Counts
	mov	(_scount + 1),(_Counts + 1)
	mov	(_scount + 2),(_Counts + 2)
	mov	(_scount + 3),(_Counts + 3)
;c:/hj51avr/code/c/fil10.c:49: Counts = 0;
;     genAssign
	clr	a
	mov	(_Counts + 3),a
	mov	(_Counts + 2),a
	mov	(_Counts + 1),a
	mov	_Counts,a
;c:/hj51avr/code/c/fil10.c:50: times = 0;
;     genAssign
	mov	_times,#0x00
00103$:
	pop	psw
	pop	dph
	pop	dpl
	pop	b
	pop	acc
	reti
;------------------------------------------------------------
;Allocation info for local variables in function 'main'
;------------------------------------------------------------
;------------------------------------------------------------
;c:/hj51avr/code/c/fil10.c:54: void main()
;	-----------------------------------------
;	 function main
;	-----------------------------------------
_main:
;c:/hj51avr/code/c/fil10.c:57: P1 = 255;          //关闭LED显示
;     genAssign
	mov	_P1,#0xFF
;c:/hj51avr/code/c/fil10.c:58: P0 = 0;            //关闭数码显示
;     genAssign
	mov	_P0,#0x00
;c:/hj51avr/code/c/fil10.c:59: P2 = 255;          //
;     genAssign

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -