📄 cs8900.lst
字号:
86 P3OUT &= ~IOW; // toggle IOW-signal
\ 000010 F2C080001900 BIC.B #0x80, &0x19
87 P3OUT = IOR | IOW | (TX_FRAME_PORT + 1); // and put next address on bus
\ 000016 F240C1001900 MOV.B #0xc1, &0x19
88 P5OUT = Data >> 8; // write high order byte to data bus
\ 00001C 8C10 SWPB R12
\ 00001E 3CF0FF00 AND.W #0xff, R12
\ 000022 C24C3100 MOV.B R12, &0x31
89 P3OUT &= ~IOW; // toggle IOW-signal
\ 000026 F2C080001900 BIC.B #0x80, &0x19
90 P3OUT |= IOW;
\ 00002C F2D080001900 BIS.B #0x80, &0x19
91 }
\ 000032 3041 RET
92 //------------------------------------------------------------------------------
93 // copies bytes from MCU-memory to frame port
94 // NOTES: * MCU-memory MUST start at word-boundary
95 //------------------------------------------------------------------------------
\ In segment CODE, align 2
96 void CopyToFrame8900(void *Source, unsigned int Size)
\ CopyToFrame8900:
97 {
98 unsigned int *pSource = Source;
99
100 P5DIR = 0xff; // data port to output
\ 000000 F2433200 MOV.B #0xff, &0x32
\ 000004 1A3C JMP ??CopyToFrame8900_1
101
102 while (Size > 1)
103 {
104 P3OUT = IOR | IOW | TX_FRAME_PORT; // put address on bus
\ ??CopyToFrame8900_0:
\ 000006 F240C0001900 MOV.B #0xc0, &0x19
105 P5OUT = *pSource; // write low order byte to data bus
\ 00000C E24C3100 MOV.B @R12, &0x31
106 P3OUT &= ~IOW; // toggle IOW-signal
\ 000010 F2C080001900 BIC.B #0x80, &0x19
107 P3OUT = IOR | IOW | (TX_FRAME_PORT + 1); // and put next address on bus
\ 000016 F240C1001900 MOV.B #0xc1, &0x19
108 P5OUT = (*pSource++) >> 8; // write high order byte to data bus
\ 00001C 2F4C MOV.W @R12, R15
\ 00001E 8F10 SWPB R15
\ 000020 3FF0FF00 AND.W #0xff, R15
\ 000024 C24F3100 MOV.B R15, &0x31
\ 000028 2C53 ADD.W #0x2, R12
109 P3OUT &= ~IOW; // toggle IOW-signal
\ 00002A F2C080001900 BIC.B #0x80, &0x19
110 P3OUT |= IOW;
\ 000030 F2D080001900 BIS.B #0x80, &0x19
111 Size -= 2;
\ 000036 3E50FEFF ADD.W #0xfffe, R14
112 }
\ ??CopyToFrame8900_1:
\ 00003A 2E93 CMP.W #0x2, R14
\ 00003C E42F JC ??CopyToFrame8900_0
113
114 if (Size) // if odd num. of bytes...
\ 00003E 0E93 CMP.W #0x0, R14
\ 000040 0B24 JEQ ??CopyToFrame8900_2
115 {
116 P3OUT = IOR | IOW | TX_FRAME_PORT; // put address on bus
\ 000042 F240C0001900 MOV.B #0xc0, &0x19
117 P5OUT = *pSource; // write byte to data bus
\ 000048 E24C3100 MOV.B @R12, &0x31
118 P3OUT &= ~IOW; // toggle IOW-signal
\ 00004C F2C080001900 BIC.B #0x80, &0x19
119 P3OUT |= IOW;
\ 000052 F2D080001900 BIS.B #0x80, &0x19
120 }
121 }
\ ??CopyToFrame8900_2:
\ 000058 3041 RET
122 //------------------------------------------------------------------------------
123 // reads a word in little-endian byte order from
124 // a specified port-address
125 //------------------------------------------------------------------------------
\ In segment CODE, align 2
126 unsigned int Read8900(unsigned char Address)
\ Read8900:
127 {
128 unsigned int ReturnValue;
129
130 P5DIR = 0x00; // data port to input
\ 000000 C2433200 MOV.B #0x0, &0x32
131 P3OUT = IOR | IOW | Address; // put address on bus
\ 000004 4E4C MOV.B R12, R14
\ 000006 7ED0C000 BIS.B #0xc0, R14
\ 00000A C24E1900 MOV.B R14, &0x19
132 P3OUT &= ~IOR; // IOR-signal low
\ 00000E F2C040001900 BIC.B #0x40, &0x19
133 ReturnValue = P5IN; // get low order byte from data bus
\ 000014 5F423000 MOV.B &0x30, R15
\ 000018 3FF0FF00 AND.W #0xff, R15
134 P3OUT = IOR | IOW | (Address + 1); // IOR high and put next address on bus
\ 00001C 5C53 ADD.B #0x1, R12
\ 00001E 7CD0C000 BIS.B #0xc0, R12
\ 000022 C24C1900 MOV.B R12, &0x19
135 P3OUT &= ~IOR; // IOR-signal low
\ 000026 F2C040001900 BIC.B #0x40, &0x19
136 ReturnValue |= P5IN << 8; // get high order byte from data bus
\ 00002C 5E423000 MOV.B &0x30, R14
\ 000030 3EF0FF00 AND.W #0xff, R14
\ 000034 3EF0FF00 AND.W #0xff, R14
\ 000038 8E10 SWPB R14
\ 00003A 0FDE BIS.W R14, R15
137 P3OUT |= IOR;
\ 00003C F2D040001900 BIS.B #0x40, &0x19
138 P5DIR = 0xff; // data port to output
\ 000042 F2433200 MOV.B #0xff, &0x32
139
140 return ReturnValue;
\ 000046 0C4F MOV.W R15, R12
\ 000048 3041 RET
141 }
142 //------------------------------------------------------------------------------
143 // reads a word in little-endian byte order from RX_FRAME_PORT
144 //------------------------------------------------------------------------------
\ In segment CODE, align 2
145 unsigned int ReadFrame8900(void)
\ ReadFrame8900:
146 {
147 unsigned int ReturnValue;
148
149 P5DIR = 0x00; // data port to input
\ 000000 C2433200 MOV.B #0x0, &0x32
150 P3OUT = IOR | IOW | RX_FRAME_PORT; // access to RX_FRAME_PORT
\ 000004 F240C0001900 MOV.B #0xc0, &0x19
151 P3OUT &= ~IOR; // IOR-signal low
\ 00000A F2C040001900 BIC.B #0x40, &0x19
152 ReturnValue = P5IN; // get 1st byte from data bus (low-byte)
\ 000010 5C423000 MOV.B &0x30, R12
\ 000014 3CF0FF00 AND.W #0xff, R12
153 P3OUT = IOR | IOW | (RX_FRAME_PORT + 1); // IOR high and put next address on bus
\ 000018 F240C1001900 MOV.B #0xc1, &0x19
154 P3OUT &= ~IOR; // IOR-signal low
\ 00001E F2C040001900 BIC.B #0x40, &0x19
155 ReturnValue |= P5IN << 8; // get 2nd byte from data bus (high-byte)
\ 000024 5F423000 MOV.B &0x30, R15
\ 000028 3FF0FF00 AND.W #0xff, R15
\ 00002C 3FF0FF00 AND.W #0xff, R15
\ 000030 8F10 SWPB R15
\ 000032 0CDF BIS.W R15, R12
156 P3OUT |= IOR;
\ 000034 F2D040001900 BIS.B #0x40, &0x19
157 P5DIR = 0xff; // data port to output
\ 00003A F2433200 MOV.B #0xff, &0x32
158
159 return ReturnValue;
\ 00003E 3041 RET
160 }
161 //------------------------------------------------------------------------------
162 // reads a word in big-endian byte order from RX_FRAME_PORT
163 // (useful to avoid permanent byte-swapping while reading
164 // TCP/IP-data)
165 //------------------------------------------------------------------------------
\ In segment CODE, align 2
166 unsigned int ReadFrameBE8900(void)
\ ReadFrameBE8900:
167 {
168 unsigned int ReturnValue;
169
170 P5DIR = 0x00; // data port to input
\ 000000 C2433200 MOV.B #0x0, &0x32
171 P3OUT = IOR | IOW | RX_FRAME_PORT; // access to RX_FRAME_PORT
\ 000004 F240C0001900 MOV.B #0xc0, &0x19
172 P3OUT &= ~IOR; // IOR-signal low
\ 00000A F2C040001900 BIC.B #0x40, &0x19
173 ReturnValue = P5IN << 8; // get 1st byte from data bus (high-byte)
\ 000010 5C423000 MOV.B &0x30, R12
\ 000014 3CF0FF00 AND.W #0xff, R12
\ 000018 3CF0FF00 AND.W #0xff, R12
\ 00001C 8C10 SWPB R12
174 P3OUT = IOR | IOW | (RX_FRAME_PORT + 1); // IOR high and put next address on bus
\ 00001E F240C1001900 MOV.B #0xc1, &0x19
175 P3OUT &= ~IOR; // IOR-signal low
\ 000024 F2C040001900 BIC.B #0x40, &0x19
176 ReturnValue |= P5IN; // get 2nd byte from data bus (low-byte)
\ 00002A 5F423000 MOV.B &0x30, R15
\ 00002E 3FF0FF00 AND.W #0xff, R15
\ 000032 0CDF BIS.W R15, R12
177 P3OUT |= IOR;
\ 000034 F2D040001900 BIS.B #0x40, &0x19
178 P5DIR = 0xff; // data port to output
\ 00003A F2433200 MOV.B #0xff, &0x32
179
180 return ReturnValue;
\ 00003E 3041 RET
181 }
182 //------------------------------------------------------------------------------
183 // reads a word in little-endian byte order from
184 // a specified port-address
185 // NOTE: this func. xfers the high-byte 1st, must be used to
186 // access some special registers (e.g. RxStatus)
187 //------------------------------------------------------------------------------
\ In segment CODE, align 2
188 unsigned int ReadHB1ST8900(unsigned char Address)
\ ReadHB1ST8900:
189 {
190 unsigned int ReturnValue;
191
192 P5DIR = 0x00; // data port to input
\ 000000 C2433200 MOV.B #0x0, &0x32
193 P3OUT = IOR | IOW | (Address + 1); // put address on bus
\ 000004 4E4C MOV.B R12, R14
\ 000006 5E53 ADD.B #0x1, R14
\ 000008 7ED0C000 BIS.B #0xc0, R14
\ 00000C C24E1900 MOV.B R14, &0x19
194 P3OUT &= ~IOR; // IOR-signal low
\ 000010 F2C040001900 BIC.B #0x40, &0x19
195 ReturnValue = P5IN << 8; // get high order byte from data bus
\ 000016 5F423000 MOV.B &0x30, R15
\ 00001A 3FF0FF00 AND.W #0xff, R15
\ 00001E 3FF0FF00 AND.W #0xff, R15
\ 000022 8F10 SWPB R15
196 P3OUT = IOR | IOW | Address; // IOR high and put next address on bus
\ 000024 7CD0C000 BIS.B #0xc0, R12
\ 000028 C24C1900 MOV.B R12, &0x19
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -