📄 acia.ls
字号:
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 0000 f_getch:
2074 0000 88 push a
2075 00000001 OFST: set 1
2078 0001 ce0002 ldw x,_ptlec
2079 0004 L7631:
2080 ; 30 while (ptlec == ptecr) /* equal pointers => loop */
2082 0004 c30000 cpw x,_ptecr
2083 0007 27fb jreq L7631
2084 ; 32 c = *ptlec++; /* get the received char */
2086 0009 f6 ld a,(x)
2087 000a 5c incw x
2088 ; 33 if (ptlec >= &buffer[SIZE]) /* put in in buffer */
2090 000b a30044 cpw x,#_buffer+64
2091 000e 2503 jrult L3731
2092 ; 34 ptlec = buffer;
2094 0010 ae0004 ldw x,#_buffer
2095 0013 L3731:
2096 0013 cf0002 ldw _ptlec,x
2097 ; 35 return (c);
2101 0016 5b01 addw sp,#1
2102 0018 87 retf
2135 ; 40 void outch(char c)
2135 ; 41 {
2136 switch .text
2137 0019 f_outch:
2139 0019 88 push a
2140 00000000 OFST: set 0
2143 001a L3141:
2144 ; 42 while (!(USART_SR & TRDE)) /* wait for READY */
2146 001a 720f4a30fb btjf _USART_SR,#7,L3141
2147 ; 44 USART_DR = c; /* send it */
2149 001f 7b01 ld a,(OFST+1,sp)
2150 0021 c74a31 ld _USART_DR,a
2151 ; 45 }
2154 0024 84 pop a
2155 0025 87 retf
2181 ; 51 @interrupt void recept(void)
2181 ; 52 {
2182 switch .text
2183 0026 f_recept:
2187 ; 53 USART_SR; /* clear interrupt */
2189 0026 c64a30 ld a,_USART_SR
2190 ; 54 *ptecr++ = USART_DR; /* get the char */
2192 0029 ce0000 ldw x,_ptecr
2193 002c c64a31 ld a,_USART_DR
2194 002f f7 ld (x),a
2195 0030 5c incw x
2196 ; 55 if (ptecr >= &buffer[SIZE]) /* put it in buffer */
2198 0031 a30044 cpw x,#_buffer+64
2199 0034 2503 jrult L7241
2200 ; 56 ptecr = buffer;
2202 0036 ae0004 ldw x,#_buffer
2203 0039 L7241:
2204 0039 cf0000 ldw _ptecr,x
2205 ; 57 }
2208 003c 80 iret
2239 ; 63 void main(void)
2239 ; 64 {
2240 switch .text
2241 003d f_main:
2245 ; 65 ptecr = ptlec = buffer; /* initialize pointers */
2247 003d ae0004 ldw x,#_buffer
2248 0040 cf0002 ldw _ptlec,x
2249 0043 cf0000 ldw _ptecr,x
2250 ; 66 USART_BRR1 = 0xc9; /* parameter for baud rate */
2252 0046 35c94a32 mov _USART_BRR1,#201
2253 ; 67 USART_CR1 = 0x00; /* parameter for word length */
2255 004a 725f4a34 clr _USART_CR1
2256 ; 68 USART_CR2 = 0x2c; /* parameters for interrupt */
2258 004e 352c4a35 mov _USART_CR2,#44
2259 ; 69 rim(); /* authorize interrupts */
2262 0052 9a rim
2264 0053 L1441:
2265 ; 71 outch(getch()); /* get and put a char */
2267 0053 8d000000 callf f_getch
2269 0057 8d190019 callf f_outch
2272 005b 20f6 jra L1441
2316 xdef f_main
2317 xdef f_recept
2318 xdef f_outch
2319 xdef f_getch
2320 switch .bss
2321 0000 _ptecr:
2322 0000 0000 ds.b 2
2323 xdef _ptecr
2324 0002 _ptlec:
2325 0002 0000 ds.b 2
2326 xdef _ptlec
2327 0004 _buffer:
2328 0004 000000000000 ds.b 64
2329 xdef _buffer
2349 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -