Rev 1282 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1282 | Rev 1318 | ||
---|---|---|---|
Line 27... | Line 27... | ||
27 | jnz exit |
27 | jnz exit |
28 | ; initialize console |
28 | ; initialize console |
29 | push 1 |
29 | push 1 |
30 | call [con_start] |
30 | call [con_start] |
31 | push title |
31 | push title |
32 | push -1 |
32 | push 25 |
33 | push -1 |
33 | push 80 |
34 | push -1 |
34 | push 25 |
35 | push -1 |
35 | push 80 |
36 | call [con_init] |
36 | call [con_init] |
37 | ; main loop |
37 | ; main loop |
38 | push str1 |
38 | push str1 |
39 | call [con_write_asciiz] |
39 | call [con_write_asciiz] |
40 | main: |
40 | main: |
Line 100... | Line 100... | ||
100 | mcall connect, [socketnum], sockaddr1, 18 |
100 | mcall connect, [socketnum], sockaddr1, 18 |
Line 101... | Line 101... | ||
101 | 101 | ||
102 | mcall 40, 1 shl 7 ; + 7 |
102 | mcall 40, 1 shl 7 ; + 7 |
Line -... | Line 103... | ||
- | 103 | call [con_cls] |
|
- | 104 | ||
103 | call [con_cls] |
105 | mcall 18, 7 |
- | 106 | push eax |
|
- | 107 | mcall 51, 1, thread, mem - 2048 |
|
Line 104... | Line 108... | ||
104 | 108 | pop ecx |
|
105 | mcall 51, 1, thread, mem - 2048 |
109 | mcall 18, 3 |
Line 106... | Line 110... | ||
106 | 110 | ||
Line 113... | Line 117... | ||
113 | 117 | ||
114 | mov esi, buffer_ptr |
118 | mov esi, buffer_ptr |
Line 115... | Line 119... | ||
115 | mov byte [esi + eax], 0 |
119 | mov byte [esi + eax], 0 |
116 | 120 | ||
117 | @@: |
121 | @@: |
118 | cmp byte [esi], 0xff ; 'IAC' = Interpret As Command |
122 | cmp byte [esi], 0xff ; Interpret As Command |
119 | jne @f |
123 | jne @f |
120 | ; TODO: parse options, for now, we will reply with 'WONT' to everything |
124 | ; TODO: parse options, for now, we will reply with 'WONT' to everything |
121 | mov byte [esi + 1], 252 ; WONT |
125 | mov byte [esi + 1], 252 ; WONT |
Line -... | Line 126... | ||
- | 126 | add esi, 3 ; a command is always 3 bytes |
|
- | 127 | jmp @r |
|
- | 128 | ||
- | 129 | ||
- | 130 | @@: |
|
- | 131 | cmp byte [esi], 0x1b ; escape character |
|
- | 132 | jne @f |
|
- | 133 | cmp word [esi+1], 0x485b ; move cursor to beginning |
|
- | 134 | jne @f |
|
- | 135 | push 0 |
|
- | 136 | push 0 |
|
- | 137 | call [con_set_cursor_pos] |
|
122 | add esi, 3 ; a command is always 3 bytes |
138 | add esi, 3 |
123 | jmp @r |
139 | |
Line 124... | Line 140... | ||
124 | 140 | ||
125 | @@: |
141 | @@: |
Line 158... | Line 174... | ||
158 | 174 | ||
159 | 175 | ||
- | 176 | ||
160 | 177 | thread: |
|
161 | thread: |
178 | mcall 40, 0 |
162 | mcall 40, 0 |
179 | .loop: |
163 | call [con_getch2] |
180 | call [con_getch2] |
Line 164... | Line 181... | ||
164 | mov byte [send_data], al |
181 | mov byte [send_data], al |
165 | mcall send, [socketnum], send_data, 1 |
182 | mcall send, [socketnum], send_data, 1 |
166 | jmp thread |
183 | jmp .loop |
167 | 184 | ||
168 | ; data |
185 | ; data |
169 | title db 'Telnet',0 |
186 | title db 'Telnet',0 |
170 | str1 db 'Telnet v0.1',10,' for KolibriOS # 1250 or later. ',10,10,0 |
187 | str1 db 'Telnet v0.1',10,' for KolibriOS # 1281 or later. ',10,10,'If you dont know where to connect to, try towel.blinkenlights.nl',10,10,0 |
171 | str2 db '> ',0 |
188 | str2 db '> ',0 |
Line 197... | Line 214... | ||
197 | con_init, 'con_init', \ |
214 | con_init, 'con_init', \ |
198 | con_write_asciiz, 'con_write_asciiz', \ |
215 | con_write_asciiz, 'con_write_asciiz', \ |
199 | con_exit, 'con_exit', \ |
216 | con_exit, 'con_exit', \ |
200 | con_gets, 'con_gets',\ |
217 | con_gets, 'con_gets',\ |
201 | con_cls, 'con_cls',\ |
218 | con_cls, 'con_cls',\ |
202 | con_getch2, 'con_getch2' |
219 | con_getch2, 'con_getch2',\ |
- | 220 | con_set_cursor_pos, 'con_set_cursor_pos' |
|
203 | i_end: |
221 | i_end: |
Line 204... | Line 222... | ||
204 | 222 | ||
205 | socketnum dd ? |
223 | socketnum dd ? |
206 | buffer_ptr rb BUFFERSIZE |
224 | buffer_ptr rb BUFFERSIZE |