?? 8880.s
字號:
.module _8880.c
.area text(rom, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
_noresponse::
.blkw 1
.area idata
.word L1
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e noresponse _noresponse pc
_handdown::
.blkw 1
.area idata
.word L2
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e handdown _handdown pc
_c_ok::
.blkw 1
.area idata
.word L3
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e c_ok _c_ok pc
_c_error::
.blkw 1
.area idata
.word L4
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e c_error _c_error pc
_c_busying::
.blkw 1
.area idata
.word L5
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e c_busying _c_busying pc
_calling::
.blkw 1
.area idata
.word L6
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e calling _calling pc
_answering::
.blkw 1
.area idata
.word L7
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e answering _answering pc
.area text(rom, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbfunc e M8880_WriteChar _M8880_WriteChar fV
; c -> R16
.even
_M8880_WriteChar::
.dbline -1
.dbline 18
; #include <iom8v.h>
; #include <macros.h>
; #include "8880.h"
; #include "serial.h"
; #include "main.h"
; #include "timer.h"
; char sendbuf[M8880_SEND_BUFSIZE];
; char recvbuf[M8880_RECV_BUFSIZE];
; M8880_STATE M8880_State;
; char *noresponse="noresponse\n";
; char *handdown="handdown\n";
; char *c_ok="ok\n";
; char *c_error="error\n";
; char *c_busying="busying\n";
; char *calling="calling\n";
; char *answering="answering\n";
; void M8880_WriteChar(char c)
; {
.dbline 19
; M8880_DataPort&=0xf0; //CLR low 4bit
in R24,0x15
andi R24,240
out 0x15,R24
.dbline 20
; M8880_CtrlPort&=~(M8880_CS|M8880_RW|M8880_RS); //CLR CS RW RS hold CLK
in R24,0x12
andi R24,79
out 0x12,R24
.dbline 21
; M8880_DataPort|=(c&0xf); //Write Data
mov R24,R16
andi R24,15
in R2,0x15
or R2,R24
out 0x15,R2
.dbline 22
; M8880_CtrlPort&=~M8880_CLK; //CLR CLK
cbi 0x12,6
.dbline 23
; NOP(); //wait a few time
nop
.dbline 24
; NOP();
nop
.dbline 25
; M8880_CtrlPort|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS; //set CS RW CLK RS
in R24,0x12
ori R24,240
out 0x12,R24
.dbline -2
L8:
.dbline 0 ; func end
ret
.dbsym r c 16 c
.dbend
.dbfunc e M8880_ReadChar _M8880_ReadChar fc
; c -> R16
.even
_M8880_ReadChar::
.dbline -1
.dbline 28
; }
; char M8880_ReadChar()
; {
.dbline 30
; char c;
; M8880_DataDDR&=0xf0; //set direction to input
in R24,0x14
andi R24,240
out 0x14,R24
.dbline 31
; M8880_CtrlPort&=~(M8880_CS|M8880_RS); //CLR CS RS hold RW CLK
in R24,0x12
andi R24,95
out 0x12,R24
.dbline 32
; M8880_CtrlPort&=~M8880_CLK; //CLR CLK
cbi 0x12,6
.dbline 33
; NOP(); //waite a few time
nop
.dbline 34
; NOP();
nop
.dbline 35
; c=M8880_DataPIN&0xf; //ReadData
in R16,0x13
andi R16,15
.dbline 36
; M8880_CtrlPort|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS; //set CS RW CLK RS
in R24,0x12
ori R24,240
out 0x12,R24
.dbline 37
; M8880_DataDDR|=0X0F; //restore direction
in R24,0x14
ori R24,15
out 0x14,R24
.dbline 38
; return c;
.dbline -2
L9:
.dbline 0 ; func end
ret
.dbsym r c 16 c
.dbend
.dbfunc e M8880_WriteCtrl _M8880_WriteCtrl fV
; flag -> R18
; c -> R16
.even
_M8880_WriteCtrl::
.dbline -1
.dbline 41
; }
; void M8880_WriteCtrl(char c,char flag)
; {
.dbline 42
; M8880_DataPort&=0xf0; //clear low 4bit
in R24,0x15
andi R24,240
out 0x15,R24
.dbline 43
; M8880_CtrlPort&=~(M8880_CS|M8880_RW); //CLR CS RW HOLD RS CLK
in R24,0x12
andi R24,207
out 0x12,R24
.dbline 44
; if (flag) //if we need to write CRB
tst R18
breq L11
X0:
.dbline 45
; M8880_DataPort|=((c&0xf)|M8880_BIT3); //so we need to set bit3
mov R24,R16
andi R24,15
ori R24,8
in R2,0x15
or R2,R24
out 0x15,R2
rjmp L12
L11:
.dbline 47
; else //else
; M8880_DataPort|=(c&(0xf&(~M8880_BIT3))); //we need to clear bit3
mov R24,R16
andi R24,7
in R2,0x15
or R2,R24
out 0x15,R2
L12:
.dbline 48
; M8880_CtrlPort&=~M8880_CLK; //CLR CLK
cbi 0x12,6
.dbline 49
; NOP(); //wait a few time
nop
.dbline 50
; NOP();
nop
.dbline 51
; M8880_CtrlPort|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS; //set CS RW CLK RS
in R24,0x12
ori R24,240
out 0x12,R24
.dbline 52
; if (flag){ //if we need to write CRB ...
tst R18
breq L13
X1:
.dbline 52
.dbline 53
; M8880_DataPort&=0xf0;
in R24,0x15
andi R24,240
out 0x15,R24
.dbline 54
; M8880_CtrlPort&=~(M8880_CS|M8880_RW);
in R24,0x12
andi R24,207
out 0x12,R24
.dbline 55
; M8880_DataPort|=(c>>4);
mov R24,R16
swap R24
andi R24,#0x0F
in R2,0x15
or R2,R24
out 0x15,R2
.dbline 56
; M8880_CtrlPort&=~M8880_CLK;
cbi 0x12,6
.dbline 57
; NOP();
nop
.dbline 58
; NOP();
nop
.dbline 59
; M8880_CtrlPort|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS; //set CS RW CLK
in R24,0x12
ori R24,240
out 0x12,R24
.dbline 60
; }
L13:
.dbline -2
L10:
.dbline 0 ; func end
ret
.dbsym r flag 18 c
.dbsym r c 16 c
.dbend
.dbfunc e M8880_ReadState _M8880_ReadState fc
; c -> R16
.even
_M8880_ReadState::
.dbline -1
.dbline 63
; }
; char M8880_ReadState(void)
; {
.dbline 65
; char c;
; M8880_DataDDR&=0xf0;
in R24,0x14
andi R24,240
out 0x14,R24
.dbline 66
; M8880_CtrlPort&=~(M8880_CS);
cbi 0x12,5
.dbline 67
; M8880_CtrlPort&=~M8880_CLK;
cbi 0x12,6
.dbline 68
; NOP();
nop
.dbline 69
; NOP();
nop
.dbline 70
; c=M8880_DataPIN&0xf;
in R16,0x13
andi R16,15
.dbline 71
; M8880_CtrlPort|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS; //set CS RW CLK
in R24,0x12
ori R24,240
out 0x12,R24
.dbline 72
; M8880_DataDDR|=0X0F;
in R24,0x14
ori R24,15
out 0x14,R24
.dbline 73
; return c;
.dbline -2
L15:
.dbline 0 ; func end
ret
.dbsym r c 16 c
.dbend
.dbfunc e M8880_Init _M8880_Init fV
.even
_M8880_Init::
.dbline -1
.dbline 76
; }
; void M8880_Init(void)
; {
.dbline 77
; M8880_State.SendCount=0;
clr R2
sts _M8880_State,R2
.dbline 78
; M8880_State.CurSend=sendbuf;
ldi R24,<_sendbuf
ldi R25,>_sendbuf
sts _M8880_State+1+1,R25
sts _M8880_State+1,R24
.dbline 79
; M8880_State.Sending=0;
sts _M8880_State+10,R2
.dbline 80
; M8880_State.RecvIntCount=0;
sts _M8880_State+3,R2
.dbline 81
; M8880_State.RecvStartPtr=recvbuf;
ldi R24,<_recvbuf
ldi R25,>_recvbuf
sts _M8880_State+4+1,R25
sts _M8880_State+4,R24
.dbline 82
; M8880_State.RecvEndPtr=recvbuf;
sts _M8880_State+6+1,R25
sts _M8880_State+6,R24
.dbline 83
; M8880_State.CurRecv=recvbuf;
sts _M8880_State+8+1,R25
sts _M8880_State+8,R24
.dbline 84
; M8880_DataDDR|=0xf;
in R24,0x14
ori R24,15
out 0x14,R24
.dbline 85
; M8880_DataPort&=~0xf;
in R24,0x15
andi R24,240
out 0x15,R24
.dbline 86
; M8880_CtrlPort|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS;
in R24,0x12
ori R24,240
out 0x12,R24
.dbline 87
; M8880_CtrlDDR|=M8880_CS|M8880_RW|M8880_CLK|M8880_RS;
in R24,0x11
ori R24,240
out 0x11,R24
.dbline 88
; M8880_ReadState();
rcall _M8880_ReadState
.dbline 89
; M8880_WriteCtrl(0x00,0);
clr R18
clr R16
rcall _M8880_WriteCtrl
.dbline 90
; M8880_WriteCtrl(0x00,0);
clr R18
clr R16
rcall _M8880_WriteCtrl
.dbline 91
; M8880_WriteCtrl((M8880_BIT0|M8880_BIT2),-1);
ldi R18,255
ldi R16,5
rcall _M8880_WriteCtrl
.dbline 92
; M8880_ReadState();
rcall _M8880_ReadState
.dbline 101
; #if M8880_INT==1
; PORTD|=0x8;
; DDRD&=~0x8;
; MCUCR&=~((1<<ISC11)|(1<<ISC10));
; MCUCR|=(1<<ISC11);
; GICR|=(1<<INT1);
; GIFR|=(1<<INT1);
; #else
; PORTD|=0x4;
sbi 0x12,2
.dbline 102
; DDRD&=~0x4;
cbi 0x11,2
.dbline 103
; MCUCR&=~((1<<ISC01)|(1<<ISC00));
in R24,0x35
andi R24,252
out 0x35,R24
.dbline 104
; MCUCR|=(1<<ISC01);
in R24,0x35
ori R24,2
out 0x35,R24
.dbline 105
; GICR|=(1<<INT0);
in R24,0x3b
ori R24,64
out 0x3b,R24
.dbline 106
; GIFR|=(1<<INT0);
in R24,0x3a
ori R24,64
out 0x3a,R24
.dbline -2
L16:
.dbline 0 ; func end
ret
.dbend
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
_dec::
.blkw 1
.area idata
.word L23
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbsym e dec _dec pc
.area vector(rom, abs)
.org 2
rjmp _int0_isr
.area data(ram, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.area text(rom, con, rel)
.dbfile E:\Shuaihu\AVR\8880\8880.c
.dbfunc e int0_isr _int0_isr fV
; c -> R10
.even
_int0_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
st -y,R10
.dbline -1
.dbline 112
; #endif
; }
; char *dec="01234567890*#abcd";
; #pragma interrupt_handler int0_isr:iv_INT0
; void int0_isr(void)
; {
.dbline 114
; char c;
; c=M8880_ReadState();
rcall _M8880_ReadState
mov R10,R16
.dbline 115
; if (c&M8880_BIT1){
sbrs R16,1
rjmp L25
X2:
.dbline 115
.dbline 116
; M8880_State.SendCount--;
lds R24,_M8880_State
subi R24,1
sts _M8880_State,R24
.dbline 117
; if (M8880_State.SendCount>0){
ldi R24,0
lds R2,_M8880_State
cp R24,R2
brsh L27
X3:
.dbline 117
.dbline 118
; M8880_State.CurSend++;
lds R24,_M8880_State+1
lds R25,_M8880_State+1+1
adiw R24,1
sts _M8880_State+1+1,R25
sts _M8880_State+1,R24
.dbline 119
; M8880_WriteChar(*M8880_State.CurSend);
movw R30,R24
ldd R16,z+0
rcall _M8880_WriteChar
.dbline 120
; }else{
rjmp L28
L27:
.dbline 120
.dbline 121
; M8880_State.CurSend=sendbuf;
ldi R24,<_sendbuf
ldi R25,>_sendbuf
sts _M8880_State+1+1,R25
sts _M8880_State+1,R24
.dbline 122
; M8880_State.Sending=0;
clr R2
sts _M8880_State+10,R2
.dbline 123
; }
L28:
.dbline 124
; }
L25:
.dbline 125
; if ((c&M8880_BIT2)&&((c&M8880_BIT3)==0)){
sbrs R10,2
rjmp L33
X4:
sbrc R10,3
rjmp L33
X5:
.dbline 125
.dbline 126
; if (M8880_State.RecvIntCount>0){
ldi R24,0
lds R2,_M8880_State+3
cp R24,R2
brsh L35
X6:
.dbline 126
.dbline 127
; M8880_State.RecvIntCount--;
mov R24,R2
subi R24,1
sts _M8880_State+3,R24
.dbline 128
; *M8880_State.CurRecv++=dec[M8880_ReadChar()];
rcall _M8880_ReadChar
lds R2,_dec
lds R3,_dec+1
mov R30,R16
clr R31
add R30,R2
adc R31,R3
ldd R2,z+0
lds R30,_M8880_State+8
lds R31,_M8880_State+8+1
st Z+,R2
sts _M8880_State+8+1,R31
sts _M8880_State+8,R30
.dbline 129
; if (M8880_State.CurRecv==recvbuf+M8880_RECV_BUFSIZE)
ldi R24,<_recvbuf+50
ldi R25,>_recvbuf+50
cp R30,R24
cpc R31,R25
brne L40
X7:
.dbline 130
; M8880_State.CurRecv=recvbuf;
ldi R24,<_recvbuf
ldi R25,>_recvbuf
sts _M8880_State+8+1,R25
sts _M8880_State+8,R24
L40:
.dbline 131
; if (M8880_State.RecvIntCount==0)
lds R2,_M8880_State+3
tst R2
brne L45
X8:
.dbline 132
; M8880_State.RecvEndPtr=M8880_State.CurRecv;
lds R2,_M8880_State+8
lds R3,_M8880_State+8+1
sts _M8880_State+6+1,R3
sts _M8880_State+6,R2
L45:
.dbline 133
; }
L35:
.dbline 134
; }
L33:
.dbline -2
L24:
.dbline 0 ; func end
ld R10,y+
ld R0,y+
out 0x3f,R0
ld R31,y+
ld R30,y+
ld R27,y+
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -