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

📄 8880.s

📁 使用8880实现DTMF通信及拨号的程序.
💻 S
📖 第 1 页 / 共 2 页
字号:
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R9,y+
	ld R8,y+
	ld R7,y+
	ld R6,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbsym r c 10 c
	.dbend
	.dbfunc e M8880_Send _M8880_Send fV
;              c -> R20,R21
;          count -> R10
;              x -> R12,R13
	.even
_M8880_Send::
	rcall push_xgset303C
	mov R10,R18
	movw R12,R16
	.dbline -1
	.dbline 137
; }
; void M8880_Send(char *x,char count)
; {
	.dbline 139
;  	char *c;
; 	if (count==0) return;
	tst R10
	brne L54
X9:
	.dbline 139
	rjmp L50
L53:
	.dbline 140
; 	while(M8880_State.Sending);
L54:
	.dbline 140
	lds R2,_M8880_State+10
	tst R2
	brne L53
X10:
	.dbline 141
; 	M8880_State.SendCount=count;
	sts _M8880_State,R10
	.dbline 142
; 	M8880_State.Sending=-1;
	ldi R24,255
	sts _M8880_State+10,R24
	.dbline 143
; 	c=sendbuf;
	ldi R20,<_sendbuf
	ldi R21,>_sendbuf
	.dbline 144
;  	for (;count>0;count--){
	rjmp L61
L58:
	.dbline 144
	.dbline 145
; 		*c++=*x++;
	movw R30,R12
	movw R26,R20
	ld R0,Z+
	movw R12,R30
	st X+,R0
	movw R20,R26
	.dbline 146
; 	}
L59:
	.dbline 144
	dec R10
L61:
	.dbline 144
	ldi R24,0
	cp R24,R10
	brlo L58
X11:
	.dbline 147
; 	M8880_WriteChar(*M8880_State.CurSend);
	lds R30,_M8880_State+1
	lds R31,_M8880_State+1+1
	ldd R16,z+0
	rcall _M8880_WriteChar
	.dbline -2
L50:
	.dbline 0 ; func end
	rjmp pop_xgset303C
	.dbsym r c 20 pc
	.dbsym r count 10 c
	.dbsym r x 12 pc
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
_number::
	.blkb 2
	.area idata
	.byte 10,1
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.blkb 2
	.area idata
	.byte 2,3
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.blkb 2
	.area idata
	.byte 4,5
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.blkb 2
	.area idata
	.byte 6,7
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.blkb 2
	.area idata
	.byte 8,9
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.dbsym e number _number A[10:10]c
	.area text(rom, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.dbfunc e M8880_Dial _M8880_Dial fV
;              c -> R20,R21
;              x -> R10,R11
	.even
_M8880_Dial::
	rcall push_xgset300C
	movw R10,R16
	.dbline -1
	.dbline 151
; }
; char number[]={10,1,2,3,4,5,6,7,8,9};
; void M8880_Dial(char *x)
; {
	.dbline 153
;  	char *c;
; 	if (*x==0) return;
	movw R30,R10
	ldd R2,z+0
	tst R2
	brne L67
X12:
	.dbline 153
	rjmp L63
L66:
	.dbline 154
; 	while(M8880_State.Sending);
L67:
	.dbline 154
	lds R2,_M8880_State+10
	tst R2
	brne L66
X13:
	.dbline 155
; 	M8880_State.SendCount=0;
	clr R2
	sts _M8880_State,R2
	.dbline 156
; 	M8880_State.Sending=-1;
	ldi R24,255
	sts _M8880_State+10,R24
	.dbline 157
; 	c=sendbuf;
	ldi R20,<_sendbuf
	ldi R21,>_sendbuf
	rjmp L72
L71:
	.dbline 158
;  	while(*x){
	.dbline 159
; 		*c++=number[(*x++)-'0'];
	ldi R24,<_number-48
	ldi R25,>_number-48
	movw R30,R10
	ld R2,Z+
	movw R10,R30
	mov R30,R2
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	movw R30,R20
	st Z+,R2
	movw R20,R30
	.dbline 160
; 		M8880_State.SendCount++;
	lds R24,_M8880_State
	subi R24,255    ; addi 1
	sts _M8880_State,R24
	.dbline 161
; 	}
L72:
	.dbline 158
	movw R30,R10
	ldd R2,z+0
	tst R2
	brne L71
X14:
	.dbline 162
; 	M8880_WriteChar(*M8880_State.CurSend);
	lds R30,_M8880_State+1
	lds R31,_M8880_State+1+1
	ldd R16,z+0
	rcall _M8880_WriteChar
	.dbline -2
L63:
	.dbline 0 ; func end
	rjmp pop_xgset300C
	.dbsym r c 20 pc
	.dbsym r x 10 pc
	.dbend
	.dbfunc e M8880_Recv _M8880_Recv fV
;          count -> R18
;            buf -> R16,R17
	.even
_M8880_Recv::
	.dbline -1
	.dbline 165
; }
; void M8880_Recv(char* buf,char count)
; {
	.dbline 166
;  	if (count==0) return;
	tst R18
	brne L77
X15:
	.dbline 166
	rjmp L76
L77:
	.dbline 167
; 	M8880_State.RecvIntCount=count;
	sts _M8880_State+3,R18
L80:
	.dbline 168
; 	while(M8880_State.RecvStartPtr==M8880_State.RecvEndPtr);
L81:
	.dbline 168
	lds R2,_M8880_State+6
	lds R3,_M8880_State+6+1
	lds R4,_M8880_State+4
	lds R5,_M8880_State+4+1
	cp R4,R2
	cpc R5,R3
	breq L80
X16:
	rjmp L86
L85:
	.dbline 169
; 	while(M8880_State.RecvStartPtr!=M8880_State.RecvEndPtr){
	.dbline 170
; 	 	*buf++=*M8880_State.RecvStartPtr++;
	lds R30,_M8880_State+4
	lds R31,_M8880_State+4+1
	movw R26,R16
	ld R0,Z+
	sts _M8880_State+4+1,R31
	sts _M8880_State+4,R30
	st X+,R0
	movw R16,R26
	.dbline 171
; 		if (M8880_State.RecvStartPtr==recvbuf+M8880_RECV_BUFSIZE)
	ldi R24,<_recvbuf+50
	ldi R25,>_recvbuf+50
	lds R2,_M8880_State+4
	lds R3,_M8880_State+4+1
	cp R2,R24
	cpc R3,R25
	brne L91
X17:
	.dbline 172
; 		   M8880_State.RecvStartPtr=recvbuf;
	ldi R24,<_recvbuf
	ldi R25,>_recvbuf
	sts _M8880_State+4+1,R25
	sts _M8880_State+4,R24
L91:
	.dbline 173
; 	}
L86:
	.dbline 169
	lds R2,_M8880_State+6
	lds R3,_M8880_State+6+1
	lds R4,_M8880_State+4
	lds R5,_M8880_State+4+1
	cp R4,R2
	cpc R5,R3
	brne L85
X18:
	.dbline 174
; 	 *buf=0;
	clr R2
	movw R30,R16
	std z+0,R2
	.dbline -2
L76:
	.dbline 0 ; func end
	ret
	.dbsym r count 18 c
	.dbsym r buf 16 pc
	.dbend
	.dbfunc e M8880_CPDial _M8880_CPDial fV
;              c -> R20
;              x -> R12,R13
;            buf -> R10,R11
	.even
_M8880_CPDial::
	rcall push_xgset303C
	movw R10,R16
	.dbline -1
	.dbline 177
; }
; void M8880_CPDial(char *buf)
; {
	.dbline 182
; 	 int x;
; #if M8880_INT==1
; 	 GICR&=~(1<<INT1);
; #else
; 	 GICR&=~(1<<INT0);
	in R24,0x3b
	andi R24,191
	out 0x3b,R24
	.dbline 184
; #endif
;  	 M8880_WriteCtrl(M8880_BIT0|M8880_BIT1|M8880_BIT2|M8880_BIT3,-1);
	ldi R18,255
	ldi R16,15
	rcall _M8880_WriteCtrl
	rjmp L98
L97:
	.dbline 185
; 	 while(*buf!=0){
	.dbline 187
; 	  char c;
; 	  c=*buf++;
	movw R30,R10
	ld R20,Z+
	movw R10,R30
	.dbline 188
; 	  c-=('0');
	subi R20,48
	.dbline 189
; 	  M8880_WriteChar(number[c]);
	ldi R24,<_number
	ldi R25,>_number
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	rcall _M8880_WriteChar
L100:
	.dbline 190
; 	  while(((x=M8880_ReadState())&M8880_BIT0)==0x0);
L101:
	.dbline 190
	rcall _M8880_ReadState
	mov R2,R16
	clr R3
	movw R12,R2
	sbrs R16,0
	rjmp L100
X19:
	.dbline 191
; 	 };
L98:
	.dbline 185
	movw R30,R10
	ldd R2,z+0
	tst R2
	brne L97
X20:
	.dbline 191
	.dbline 192
; 	 M8880_WriteCtrl(M8880_BIT0|M8880_BIT2,-1);
	ldi R18,255
	ldi R16,5
	rcall _M8880_WriteCtrl
	.dbline 193
; 	 M8880_ReadState();
	rcall _M8880_ReadState
	.dbline 198
; #if M8880_INT==1
; 	 GIFR|=(1<<INT1);
; 	 GICR|=(1<<INT1);
; #else
; 	 GIFR|=(1<<INT0);
	in R24,0x3a
	ori R24,64
	out 0x3a,R24
	.dbline 199
; 	 GICR|=(1<<INT0);
	in R24,0x3b
	ori R24,64
	out 0x3b,R24
	.dbline -2
L96:
	.dbline 0 ; func end
	rjmp pop_xgset303C
	.dbsym r c 20 c
	.dbsym r x 12 I
	.dbsym r buf 10 pc
	.dbend
	.area vector(rom, abs)
	.org 4
	rjmp _int1_isr
	.area text(rom, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
	.dbfunc e int1_isr _int1_isr fV
	.even
_int1_isr::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R6
	st -y,R7
	st -y,R8
	st -y,R9
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	st -y,R30
	st -y,R31
	in R0,0x3f
	st -y,R0
	.dbline -1
	.dbline 204
; #endif
; }
; #pragma interrupt_handler int1_isr:iv_INT1
; void int1_isr(void)
; {
	.dbline 205
;  	 if ((sysoption.calling==0) && sysoption.autoanswer){
	lds R2,_sysoption+1
	tst R2
	brne L104
X21:
	lds R2,_sysoption+4
	tst R2
	breq L104
X22:
	.dbline 205
	.dbline 206
; 	 	M8880_Handup;
	sbi 0x15,5
	.dbline 206
	.dbline 207
; 		sysoption.calling=2;
	ldi R24,2
	sts _sysoption+1,R24
	.dbline 208
; 		serial_send(answering);
	lds R16,_answering
	lds R17,_answering+1
	rcall _serial_send
	.dbline 209
; 		MCUCR|=0xc;
	in R24,0x35
	ori R24,12
	out 0x35,R24
	.dbline 210
; 		TCCR1B=0x05;
	ldi R24,5
	out 0x2e,R24
	.dbline 211
; 	 }
L104:
	.dbline 212
; 	 if (sysoption.calling==3){
	lds R24,_sysoption+1
	cpi R24,3
	brne L109
X23:
	.dbline 212
	.dbline 213
; 		M8880_Handdown;
	cbi 0x15,5
	.dbline 214
; 	 	sysoption.calling=0;
	clr R2
	sts _sysoption+1,R2
	.dbline 215
; 	 	MCUCR&=~0xc;
	in R24,0x35
	andi R24,243
	out 0x35,R24
	.dbline 216
; 		MCUCR|=0x8;
	in R24,0x35
	ori R24,8
	out 0x35,R24
	.dbline 217
; 		serial_send("aa");
	ldi R16,<L113
	ldi R17,>L113
	rcall _serial_send
	.dbline 218
; 		serial_send(handdown);
	lds R16,_handdown
	lds R17,_handdown+1
	rcall _serial_send
	.dbline 219
; 	 }
L109:
	.dbline -2
L103:
	.dbline 0 ; func end
	ld R0,y+
	out 0x3f,R0
	ld R31,y+
	ld R30,y+
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R9,y+
	ld R8,y+
	ld R7,y+
	ld R6,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
_M8880_State::
	.blkb 11
	.dbstruct 0 11 tagM8880_STATE
	.dbfield 0 SendCount c
	.dbfield 1 CurSend pc
	.dbfield 3 RecvIntCount c
	.dbfield 4 RecvStartPtr pc
	.dbfield 6 RecvEndPtr pc
	.dbfield 8 CurRecv pc
	.dbfield 10 Sending c
	.dbend
	.dbsym e M8880_State _M8880_State S[tagM8880_STATE]
_recvbuf::
	.blkb 50
	.dbsym e recvbuf _recvbuf A[50:50]c
_sendbuf::
	.blkb 50
	.dbsym e sendbuf _sendbuf A[50:50]c
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L113:
	.blkb 3
	.area idata
	.byte 'a,'a,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L23:
	.blkb 18
	.area idata
	.byte 48,49,50,51,52,53,54,55,56,57,48,42,35,'a,'b,'c
	.byte 'd,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L7:
	.blkb 11
	.area idata
	.byte 'a,'n,'s,'w,'e,'r,'i,'n,'g,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L6:
	.blkb 9
	.area idata
	.byte 'c,'a,'l,'l,'i,'n,'g,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L5:
	.blkb 9
	.area idata
	.byte 'b,'u,'s,'y,'i,'n,'g,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L4:
	.blkb 7
	.area idata
	.byte 'e,'r,'r,'o,'r,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L3:
	.blkb 4
	.area idata
	.byte 'o,'k,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L2:
	.blkb 10
	.area idata
	.byte 'h,'a,'n,'d,'d,'o,'w,'n,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
L1:
	.blkb 12
	.area idata
	.byte 'n,'o,'r,'e,'s,'p,'o,'n,'s,'e,10,0
	.area data(ram, con, rel)
	.dbfile E:\Shuaihu\AVR\8880\8880.c
; }

⌨️ 快捷键说明

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