AMDtemp: fix parser and code style. TODO: add function for device subsystem

git-svn-id: svn://kolibrios.org@9883 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-10-16 21:00:24 +00:00
parent 8057f62185
commit 19cab98b13
2 changed files with 481 additions and 435 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
pars_cmd: ; AMDtemp -s/sd0/4/data/temp/log.grf -d"/sd0/4/data/äàò÷èê òåìïåðàòóðû com ïîðò/sensors.sys"
parse_cmd:
mov edi, PATH mov edi, PATH
mov ecx, 512 mov ecx, 512
.still: .still:
@ -9,55 +10,46 @@ pars_cmd:
jz .end_parser jz .end_parser
dec edi dec edi
mov ebx, edi ;save edi or word[edi], 0x2020 ; ïåðåâîäèì â íèæíèé ðåãèñòð
cmp byte[edi],'"'
jnz @f ;.skip_string
mov eax, [save_file]
cmp eax, [.flag_drv]
jae .str_save
cmp dword[drv_ptr], 0 cmp word[edi], '-s'
jnz .err jnz @f
mov [drv_ptr],edi
inc dword[drv_ptr]
jmp .skip_string
.str_save:
cmp dword[save_ptr], 0
jnz .err
mov [save_ptr],edi
inc dword[save_ptr]
jmp .skip_string
@@:
cmp word[edi], 's-'
jnz @f
cmp dword[save_file], 0
jnz @f
mov [save_file], edi
@@:
cmp word[edi], 'd-'
jnz @f
cmp dword[.flag_drv], 0
jnz @f
mov [.flag_drv], edi
add edi, 2 add edi, 2
sub ecx, 2
call .get_str
mov [save_ptr],eax
jmp .still
@@: @@:
cmp edi, ebx cmp word[edi], '-d'
jz .err jnz @f
add edi, 2
sub ecx, 2
call .get_str
mov [drv_ptr],eax
jmp .still
@@:
cmp byte[edi], 0
jnz @f
.end_parser:
ret
@@:
inc edi
jmp .still jmp .still
.skip_string: .get_str:
inc edi push edi
inc dword[esp]
mov al, '"' mov al, '"'
rep scasb cmp byte[edi], al
test ecx, ecx jz @f
jz .err dec dword[esp]
mov byte[edi-1], 0x00 mov al, ' '
jmp .still dec edi
.err: @@:
or eax, -1 inc edi
ret repne scasb
.end_parser: and byte[edi - 1], 0
xor eax, eax pop eax
ret ret
.flag_drv: dd 0;don`t using in other code