📄 common.s
字号:
.dbline 807
; if (i > 18) // this value seems to have to be at least as big as the fifo buffer on the pc's uart
ldi R24,18
ldi R25,0
cp R24,R16
cpc R25,R17
brge L171
.dbline 808
; RTS0_OK; // we're ok to rx more data
cbi 0x3,3
xjmp L168
L171:
.dbline 810
; else //
; RTS0_STOP; // tell em to stop sending data
sbi 0x3,3
.dbline 811
; break; //
xjmp L168
L173:
.dbline 812
; case UART1 : i = RingBufBytesFree(sizeof(UART1_RxBuffer), UART1_RxBufferRd, UART1_RxBufferWr); // work out how many bytes we have free in our buffer
lds R2,_UART1_RxBufferWr
clr R3
std y+1,R3
std y+0,R2
lds R18,_UART1_RxBufferRd
clr R19
ldi R16,96
ldi R17,0
xcall _RingBufBytesFree
movw R20,R16
.dbline 813
; if (i > 18) // this value seems to have to be at least as big as the fifo buffer on the pc's uart
ldi R24,18
ldi R25,0
cp R24,R16
cpc R25,R17
brge L174
.dbline 814
; RTS1_OK; // we're ok to rx more data
cbi 0x12,5
xjmp L168
L174:
.dbline 816
; else //
; RTS1_STOP; // tell em to stop sending data
sbi 0x12,5
.dbline 817
; break;
L167:
L168:
.dbline -2
L166:
adiw R28,2
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r i 20 I
.dbsym r Uart 20 c
.dbend
.dbfunc e SendUartStr _SendUartStr fc
; c -> R20
; Uart -> R22
; s -> R10,R11
.even
_SendUartStr::
xcall push_gset3
mov R22,R18
movw R10,R16
.dbline -1
.dbline 822
; }
; }
;
; bool SendUartStr(char *s, char Uart)
; { // Send a string down a uart
.dbline 825
; char c;
;
; if (!s) return true;
tst R10
brne L182
tst R11
brne L182
X26:
.dbline 825
ldi R16,1
xjmp L176
X27:
.dbline 827
;
; for (;*s;)
L179:
.dbline 828
; {
.dbline 829
; c = *s++;
movw R30,R10
ld R20,Z+
movw R10,R30
.dbline 830
; if (c == '\n')
cpi R20,10
brne L183
.dbline 831
; { // insert a CR (\r) before the LF (\n)
.dbline 832
; if (!SendUartByte('\r', Uart)) return false; // Send byte
mov R18,R22
ldi R16,13
xcall _SendUartByte
tst R16
brne L185
.dbline 832
clr R16
xjmp L176
L185:
.dbline 833
; }
L183:
.dbline 834
; if (!SendUartByte(c, Uart)) return false; // Send byte
mov R18,R22
mov R16,R20
xcall _SendUartByte
tst R16
brne L187
.dbline 834
clr R16
xjmp L176
L187:
.dbline 835
L180:
.dbline 827
L182:
.dbline 827
movw R30,R10
ldd R2,z+0
tst R2
brne L179
.dbline 837
; }
;
; return true;
ldi R16,1
.dbline -2
L176:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbsym r Uart 22 c
.dbsym r s 10 pc
.dbend
.dbfunc e SendUartRStr _SendUartRStr fc
; c -> R20
; Uart -> R22
; s -> R10,R11
.even
_SendUartRStr::
xcall push_gset3
mov R22,R18
movw R10,R16
.dbline -1
.dbline 841
; }
;
; bool SendUartRStr(RomChar *s, char Uart)
; { // send a string from rom
.dbline 844
; char c;
;
; if (!s) return true;
tst R10
brne L195
tst R11
brne L195
X28:
.dbline 844
ldi R16,1
xjmp L189
X29:
.dbline 846
;
; for (;*s;)
L192:
.dbline 847
; {
.dbline 848
; c = *s++;
movw R2,R10
movw R24,R2
adiw R24,1
movw R10,R24
movw R30,R2
lpm R20,Z
.dbline 849
; if (c == '\n')
cpi R20,10
brne L196
.dbline 850
; { // insert a CR (\r) before the LF (\n)
.dbline 851
; if (!SendUartByte('\r', Uart)) return false; // Send byte
mov R18,R22
ldi R16,13
xcall _SendUartByte
tst R16
brne L198
.dbline 851
clr R16
xjmp L189
L198:
.dbline 852
; }
L196:
.dbline 853
; if (!SendUartByte(c, Uart)) return false; // Send byte
mov R18,R22
mov R16,R20
xcall _SendUartByte
tst R16
brne L200
.dbline 853
clr R16
xjmp L189
L200:
.dbline 854
L193:
.dbline 846
L195:
.dbline 846
movw R30,R10
lpm R30,Z
tst R30
brne L192
.dbline 856
; }
;
; return true;
ldi R16,1
.dbline -2
L189:
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbsym r Uart 22 c
.dbsym r s 10 pkc
.dbend
.dbfunc e SendUartData _SendUartData fc
; c -> R20
; Uart -> R22
; len -> R10,R11
; s -> R12,R13
.even
_SendUartData::
xcall push_gset4
movw R10,R18
movw R12,R16
ldd R22,y+8
.dbline -1
.dbline 860
; }
;
; bool SendUartData(char *s, u16 len, char Uart)
; { // Send data down a uart
.dbline 863
; char c;
;
; if (!s) return true;
tst R12
brne L208
tst R13
brne L208
X30:
.dbline 863
ldi R16,1
xjmp L202
X31:
.dbline 865
;
; for (; len; len--)
L205:
.dbline 866
; {
.dbline 867
; c = *s++;
movw R30,R12
ld R20,Z+
movw R12,R30
.dbline 868
; if (!SendUartByte(c, Uart)) return false; // Send byte
mov R18,R22
mov R16,R20
xcall _SendUartByte
tst R16
brne L209
.dbline 868
clr R16
xjmp L202
L209:
.dbline 869
L206:
.dbline 865
movw R24,R10
sbiw R24,1
movw R10,R24
L208:
.dbline 865
tst R10
brne L205
tst R11
brne L205
X32:
.dbline 871
; }
;
; return true;
ldi R16,1
.dbline -2
L202:
xcall pop_gset4
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbsym r Uart 22 c
.dbsym r len 10 s
.dbsym r s 12 pc
.dbend
.dbfunc e SendConsoleByte _SendConsoleByte fc
; c -> R20
.even
_SendConsoleByte::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 875
; }
;
; bool SendConsoleByte(char c)
; { // send a byte
.dbline 876
; return SendUartByte(c, ConsoleUart);
clr R18
mov R16,R20
xcall _SendUartByte
.dbline -2
L211:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbend
.dbfunc e SendConsoleStr _SendConsoleStr fc
; s -> R20,R21
.even
_SendConsoleStr::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 880
; }
;
; bool SendConsoleStr(char *s)
; { // send a string from ram
.dbline 881
; return SendUartStr(s, ConsoleUart);
clr R18
movw R16,R20
xcall _SendUartStr
.dbline -2
L212:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r s 20 pc
.dbend
.dbfunc e SendConsoleRStr _SendConsoleRStr fc
; s -> R20,R21
.even
_SendConsoleRStr::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 885
; }
;
; bool SendConsoleRStr(RomChar *s)
; { // send a string from rom
.dbline 886
; return SendUartRStr(s, ConsoleUart);
clr R18
movw R16,R20
xcall _SendUartRStr
.dbline -2
L213:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r s 20 pkc
.dbend
.dbfunc e SendConsoleData _SendConsoleData fc
; len -> R22,R23
; d -> R20,R21
.even
_SendConsoleData::
xcall push_gset2
movw R22,R18
movw R20,R16
sbiw R28,1
.dbline -1
.dbline 890
; }
;
; bool SendConsoleData(char *d, u16 len)
; { // send data from ram
.dbline 891
; return SendUartData(d, len, ConsoleUart);
clr R2
std y+0,R2
movw R18,R22
movw R16,R20
xcall _SendUartData
.dbline -2
L214:
adiw R28,1
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r len 22 s
.dbsym r d 20 pc
.dbend
.dbfunc e SendDebugByte _SendDebugByte fc
; c -> R20
.even
_SendDebugByte::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 897
; }
;
; #ifdef Debug
;
; bool SendDebugByte(char c)
; { // send a byte
.dbline 898
; if (!(Flags1 & (1<<Flags1_Debug))) return true; // don't bother with debug unless the debug flag is set
lds R2,_Flags1
sbrc R2,7
rjmp L216
.dbline 898
ldi R16,1
xjmp L215
L216:
.dbline 899
; return SendUartByte(c, ConsoleUart);
clr R18
mov R16,R20
xcall _SendUartByte
.dbline -2
L215:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbend
.dbfunc e SendDebugStr _SendDebugStr fc
; s -> R20,R21
.even
_SendDebugStr::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 903
; }
;
; bool SendDebugStr(char *s)
; { // send a string from ram
.dbline 904
; if (!(Flags1 & (1<<Flags1_Debug))) return true; // don't bother with debug unless the debug flag is set
lds R2,_Flags1
sbrc R2,7
rjmp L219
.dbline 904
ldi R16,1
xjmp L218
L219:
.dbline 905
; return SendUartStr(s, ConsoleUart);
clr R18
movw R16,R20
xcall _SendUartStr
.dbline -2
L218:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r s 20 pc
.dbend
.dbfunc e SendDebugRStr _SendDebugRStr fc
; s -> R20,R21
.even
_SendDebugRStr::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 909
; }
;
; bool SendDebugRStr(RomChar *s)
; { // send a string from rom
.dbline 910
; if (!(Flags1 & (1<<Flags1_Debug))) return true; // don't bother with debug unless the debug flag is set
lds R2,_Flags1
sbrc R2,7
rjmp L222
.dbline 910
ldi R16,1
xjmp L221
L222:
.dbline 911
; return SendUartRStr(s, ConsoleUart);
clr R18
movw R16,R20
xcall _SendUartRStr
.dbline -2
L221:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r s 20 pkc
.dbend
.dbfunc e SendDebugData _SendDebugData fc
; len -> R22,R23
; d -> R20,R21
.even
_SendDebugData::
xcall push_gset2
movw R22,R18
movw R20,R16
sbiw R28,1
.dbline -1
.dbline 915
; }
;
; bool SendDebugData(char *d, u16 len)
; { // send data from ram
.dbline 916
; if (!(Flags1 & (1<<Flags1_Debug))) return true; // don't bother with debug unless the debug flag is set
lds R2,_Flags1
sbrc R2,7
rjmp L225
.dbline 916
ldi R16,1
xjmp L224
L225:
.dbline 917
; return SendUartData(d, len, ConsoleUart);
clr R2
std y+0,R2
movw R18,R22
movw R16,R20
xcall _SendUartData
.dbline -2
L224:
adiw R28,1
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r len 22 s
.dbsym r d 20 pc
.dbend
.dbfunc e SendDebugState _SendDebugState fc
.even
_SendDebugState::
.dbline -1
.dbline 921
; }
;
; bool SendDebugState(void)
; {
.dbline 922
; if (!SendConsoleRStr(DebugMessagesStr1)) return false;
ldi R16,<_DebugMessagesStr1
ldi R17,>_DebugMessagesStr1
xcall _SendConsoleRStr
tst R16
brne L228
.dbline 922
clr R16
xjmp L227
L228:
.dbline 923
; if (Flags1 & (1<<Flags1_Debug))
lds R2,_Flags1
sbrs R2,7
rjmp L230
.dbline 924
; return SendConsoleRStr(DebugMessagesStr3);
ldi R16,<_DebugMessagesStr3
ldi R17,>_DebugMessagesStr3
xcall _SendConsoleRStr
xjmp L227
L230:
.dbline 926
; else
; return SendConsoleRStr(DebugMessagesStr2);
ldi R16,<_DebugMessagesStr2
ldi R17,>_DebugMessagesStr2
xcall _SendConsoleRStr
.dbline -2
L227:
.dbline 0 ; func end
ret
.dbend
.dbfunc e SendModemByte _SendModemByte fc
; c -> R20
.even
_SendModemByte::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 931
; }
; #endif
;
; bool SendModemByte(char c)
; {
.dbline 932
; return SendUartByte(c, ModemUart);
ldi R18,1
mov R16,R20
xcall _SendUartByte
.dbline -2
L232:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r c 20 c
.dbend
.dbfunc e SendModemRStr _SendModemRStr fc
; s -> R20,R21
.even
_SendModemRStr::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 936
; }
;
; bool SendModemRStr(RomChar *s)
; {
.dbline 937
; return SendUartRStr(s, ModemUart);
ldi R18,1
movw R16,R20
xcall _SendUartRStr
.dbline -2
L233:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r s 20 pkc
.dbend
.db
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -