7 ;-----------------------------------
\r
9 ;-----------------------------------
\r
15 ;-----------------------------------
\r
17 ;-----------------------------------
\r
19 macro cmpe a, b, c {
\r
24 ;-----------------------------------
\r
26 ;-----------------------------------
\r
28 macro cmpne a, b, c {
\r
33 ;-----------------------------------
\r
34 ; Shell`s initialization
\r
36 ;-----------------------------------
\r
58 mov eax, dword [esi + 30]
\r
66 ; Convert PID to STR
\r
77 mov ebx, __shell.name__
\r
86 mov [ebx + 0], dword "-SHE"
\r
87 mov [ebx + 4], word "LL"
\r
88 mov [ebx + 6], byte 0
\r
93 mov ecx, __shell.name__
\r
98 mov [__shell.buf__], eax
\r
107 ;-----------------------------------
\r
108 ; Wait answer from shell
\r
111 ; edi - shell-buffer
\r
112 ;-----------------------------------
\r
122 cmpne [edi], byte 0, @b
\r
127 ;-----------------------------------
\r
129 ; without arguments
\r
130 ;-----------------------------------
\r
135 mov edi, [__shell.buf__]
\r
141 mov ecx, __shell.name__
\r
147 ;-----------------------------------
\r
148 ; Print char to shell
\r
152 ;-----------------------------------
\r
157 mov edi, [__shell.buf__]
\r
165 ;-----------------------------------
\r
166 ; Print string to shell
\r
170 ;-----------------------------------
\r
172 shell.print_string:
\r
175 mov edi, [__shell.buf__]
\r
184 cmpne [eax], byte 0, @b
\r
187 mov edi, [__shell.buf__]
\r
193 ;-----------------------------------
\r
194 ; Print number to shell
\r
198 ;-----------------------------------
\r
206 mov [__shell.str__], "-"
\r
220 mov ebx, __shell.str__
\r
231 mov eax, __shell.str__
\r
232 cmpe [eax], byte "-", @f
\r
235 call shell.print_string
\r
240 ;-----------------------------------
\r
241 ; Get char from shell
\r
245 ;-----------------------------------
\r
248 push ebx ecx edx esi edi
\r
250 mov edi, [__shell.buf__]
\r
255 pop edi esi edx ecx ebx
\r
258 ;-----------------------------------
\r
259 ; Get string from shell
\r
262 ; eax - addres of memory for str
\r
263 ;-----------------------------------
\r
268 mov edi, [__shell.buf__]
\r
278 cmpne [edi], byte 0, @b
\r
285 ;-----------------------------------
\r
286 ; Get number from shell
\r
290 ;-----------------------------------
\r
293 push ebx ecx edx esi edi
\r
295 mov eax, __shell.str__
\r
296 call shell.get_string
\r
301 cmpne [ebx], byte "-", @f
\r
306 sub [ebx], byte "0"
\r
310 cmpne [ebx], byte 10, @b
\r
317 pop edi esi edx ecx ebx
\r
321 ;-----------------------------------
\r
323 ; without arguments
\r
324 ;-----------------------------------
\r
329 mov edi, [__shell.buf__]
\r
336 ;-----------------------------------
\r
337 ; Print char to shell
\r
341 ;-----------------------------------
\r
343 macro shpc [char] {
\r
346 call shell.print_char
\r
350 ;-----------------------------------
\r
351 ; Go to new line in shell
\r
352 ; without arguments
\r
353 ;-----------------------------------
\r
360 ;-----------------------------------
\r
361 ; Print string to shell
\r
365 ;-----------------------------------
\r
367 macro shps [string] {
\r
368 local ..string, ..label
\r
370 ..string db string, 0
\r
375 call shell.print_string
\r
379 ;-----------------------------------
\r
380 ; Print string to shell
\r
383 ; arg1 - addres of string
\r
384 ;-----------------------------------
\r
386 macro shpsa [addr] {
\r
389 call shell.print_string
\r
393 ;-----------------------------------
\r
394 ; Print number to shell
\r
398 ;-----------------------------------
\r
403 call shell.print_num
\r
408 ;-----------------------------------
\r
409 ; Get char from shell
\r
413 ;-----------------------------------
\r
416 call shell.get_char
\r
419 ;-----------------------------------
\r
420 ; Get string from shell
\r
423 ; arg1 - addres of memory for str
\r
424 ;-----------------------------------
\r
426 macro shgs [addr] {
\r
428 call shell.get_string
\r
431 ;-----------------------------------
\r
432 ; Get number from shell
\r
435 ; arg1 - addres of memory for num
\r
436 ;-----------------------------------
\r
438 macro shgn [addr] {
\r
446 ;-----------------------------------
\r
447 ; Wait any char from shell
\r
448 ; without arguments
\r
449 ;-----------------------------------
\r
453 call shell.get_char
\r
457 ;-----------------------------------
\r
459 ; without arguments
\r
460 ;-----------------------------------
\r
466 ;-----------------------------------
\r
475 ;-----------------------------------
\r
477 macro shchs str, chs {
\r
478 local ..loop1, ..loop2, ..chs, ..start, ..res
\r
489 call shell.get_char
\r
493 cmpe al, [ebx], ..res
\r
495 cmpe [ebx], byte 0, ..loop1
\r
500 call shell.print_char
\r