📄 acia.la
字号:
1 ; C Compiler for STM8 (COSMIC Software)
2 ; Generator V4.2.8 - 03 Dec 2008
3 ; Optimizer V4.2.8 - 03 Dec 2008
2070 ; 26 char getch(void)
2070 ; 27 {
2071 switch .text
2072 808a f_getch:
2074 808a 88 push a
2075 00000001 OFST: set 1
2078 808b ce0102 ldw x,_ptlec
2079 808e L7631:
2080 ; 30 while (ptlec == ptecr) /* equal pointers => loop */
2082 808e c30100 cpw x,_ptecr
2083 8091 27fb jreq L7631
2084 ; 32 c = *ptlec++; /* get the received char */
2086 8093 f6 ld a,(x)
2087 8094 5c incw x
2088 ; 33 if (ptlec >= &buffer[SIZE]) /* put in in buffer */
2090 8095 a30144 cpw x,#_buffer+64
2091 8098 2503 jrult L3731
2092 ; 34 ptlec = buffer;
2094 809a ae0104 ldw x,#_buffer
2095 809d L3731:
2096 809d cf0102 ldw _ptlec,x
2097 ; 35 return (c);
2101 80a0 5b01 addw sp,#1
2102 80a2 87 retf
2135 ; 40 void outch(char c)
2135 ; 41 {
2136 switch .text
2137 80a3 f_outch:
2139 80a3 88 push a
2140 00000000 OFST: set 0
2143 80a4 L3141:
2144 ; 42 while (!(USART_SR & TRDE)) /* wait for READY */
2146 80a4 720f4a30fb btjf _USART_SR,#7,L3141
2147 ; 44 USART_DR = c; /* send it */
2149 80a9 7b01 ld a,(OFST+1,sp)
2150 80ab c74a31 ld _USART_DR,a
2151 ; 45 }
2154 80ae 84 pop a
2155 80af 87 retf
2181 ; 51 @interrupt void recept(void)
2181 ; 52 {
2182 switch .text
2183 80b0 f_recept:
2187 ; 53 USART_SR; /* clear interrupt */
2189 80b0 c64a30 ld a,_USART_SR
2190 ; 54 *ptecr++ = USART_DR; /* get the char */
2192 80b3 ce0100 ldw x,_ptecr
2193 80b6 c64a31 ld a,_USART_DR
2194 80b9 f7 ld (x),a
2195 80ba 5c incw x
2196 ; 55 if (ptecr >= &buffer[SIZE]) /* put it in buffer */
2198 80bb a30144 cpw x,#_buffer+64
2199 80be 2503 jrult L7241
2200 ; 56 ptecr = buffer;
2202 80c0 ae0104 ldw x,#_buffer
2203 80c3 L7241:
2204 80c3 cf0100 ldw _ptecr,x
2205 ; 57 }
2208 80c6 80 iret
2239 ; 63 void main(void)
2239 ; 64 {
2240 switch .text
2241 80c7 f_main:
2245 ; 65 ptecr = ptlec = buffer; /* initialize pointers */
2247 80c7 ae0104 ldw x,#_buffer
2248 80ca cf0102 ldw _ptlec,x
2249 80cd cf0100 ldw _ptecr,x
2250 ; 66 USART_BRR1 = 0xc9; /* parameter for baud rate */
2252 80d0 35c94a32 mov _USART_BRR1,#201
2253 ; 67 USART_CR1 = 0x00; /* parameter for word length */
2255 80d4 725f4a34 clr _USART_CR1
2256 ; 68 USART_CR2 = 0x2c; /* parameters for interrupt */
2258 80d8 352c4a35 mov _USART_CR2,#44
2259 ; 69 rim(); /* authorize interrupts */
2262 80dc 9a rim
2264 80dd L1441:
2265 ; 71 outch(getch()); /* get and put a char */
2267 80dd 8d00808a callf f_getch
2269 80e1 8d0080a3 callf f_outch
2272 80e5 20f6 jra L1441
2316 xdef f_main
2317 xdef f_recept
2318 xdef f_outch
2319 xdef f_getch
2320 switch .bss
2321 0100 _ptecr:
2322 0100 0000 ds.b 2
2323 xdef _ptecr
2324 0102 _ptlec:
2325 0102 0000 ds.b 2
2326 xdef _ptlec
2327 0104 _buffer:
2328 0104 000000000000 ds.b 64
2329 xdef _buffer
2349 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -