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

View File

@ -1,4 +1,4 @@
;; Copyright (C) 2021-2022, Michail Frolov aka Doczom ;; Copyright (C) 2021-2022, Michael Frolov aka Doczom
macro send_notify send_str{ macro send_notify send_str{
mov dword[run_notify.message], send_str mov dword[run_notify.message], send_str
@ -22,7 +22,7 @@ include '..\..\macros.inc'
include '..\..\KOSfuncs.inc' include '..\..\KOSfuncs.inc'
include '..\..\dll.inc' include '..\..\dll.inc'
; include 'parser.inc' ; this modul does not work include 'parser.inc'
START: START:
;init heap ;init heap
mcall 68, 11 mcall 68, 11
@ -35,43 +35,47 @@ START:
; init futex ; init futex
mcall SF_FUTEX, SSF_CREATE, futex_cmd mcall SF_FUTEX, SSF_CREATE, futex_cmd
mov [futex_handle], eax mov [futex_handle], eax
; parse cmd_line TODO: fix parser and testing ; parse cmd_line
;call pars_cmd cmp byte[PATH], 0
;test eax, eax jz @f
;jnz exit call parse_cmd
@@:
;;óñòàíîâêà ìàñêà ñîáûòèé íà ïîëó÷åíèå ïåðåïèñîâêè è íàæàòèÿ íà êíîïêó ;;óñòàíîâêà ìàñêà ñîáûòèé íà ïîëó÷åíèå ïåðåïèñîâêè è íàæàòèÿ íà êíîïêó
mcall SF_SET_EVENTS_MASK,0x05 mcall SF_SET_EVENTS_MASK, 0x05
;load driver ;load driver
mcall SF_SYS_MISC, SSF_LOAD_DRIVER_PE, [drv_ptr], 0 mcall SF_SYS_MISC, SSF_LOAD_DRIVER_PE, [drv_ptr], 0
mov dword[drv_struct.handl],eax mov dword[drv_struct.handl], eax
test eax,eax ;ïðîâåðêà çàãðóçêè test eax, eax ;ïðîâåðêà çàãðóçêè
jz error_drv jz error_drv
main: main:
mcall SF_SYS_MISC, SSF_CONTROL_DRIVER, drv_struct mcall SF_SYS_MISC, SSF_CONTROL_DRIVER, drv_struct
cmp byte[PATH], 0 cmp dword[save_ptr], 0
jz still jz still
;call add_file mcall 51, 1, thread_auto_save, thread_auto_save.stack
cmp eax, -1
jz still
mov dword[PID_AUTO_SAVE], eax
still: ;void main() still: ;void main()
call draw call draw
;;îæèäàíèå ñîáûòèÿ â òå÷åíèè 2000ìñ ;;îæèäàíèå ñîáûòèÿ â òå÷åíèè 2000ìñ
mcall SF_WAIT_EVENT_TIMEOUT,200 ;2 second mcall SF_WAIT_EVENT_TIMEOUT, 200 ;2 second
dec eax ; redraw request ? dec eax ; redraw request ?
je still je still
cmp eax,2 ;button cmp eax, 2 ;button
jz button jz button
jmp still jmp still
button: button:
mcall SF_GET_BUTTON mcall SF_GET_BUTTON
cmp eax,1 cmp eax, 1
jz still jz still
dec ah dec ah
je exit je exit
;; id button micro_info = 8 ;; id button micro_info = 8
cmp ah,7 ;// ah-1=7 cmp ah, 7 ;// ah-1=7
jnz .no_micro_info jnz .no_micro_info
xor byte[flag_micro_info],1 xor byte[flag_micro_info], 1
jmp still jmp still
.no_micro_info: .no_micro_info:
; id button log = 9 ; id button log = 9
@ -133,7 +137,7 @@ button:
; òóò âûçîâ ôóíêöèè openDialog ; òóò âûçîâ ôóíêöèè openDialog
invoke OpenDialog_Start, OpenDialog_data invoke OpenDialog_Start, OpenDialog_data
cmp [OpenDialog_data.status],1 cmp [OpenDialog_data.status], 1
jne still jne still
;mov dword[log_path], openfile_path ;mov dword[log_path], openfile_path
@ -169,31 +173,31 @@ draw:
mov dword[frame_struct.FR_BACK_COLOR], eax mov dword[frame_struct.FR_BACK_COLOR], eax
mov eax,SF_CREATE_WINDOW mov eax, SF_CREATE_WINDOW
mov ebx,0x00ff0132 mov ebx, 0x00ff0132
mov ecx,0x00150114 ; link with 80 line mov ecx, 0x00150114 ; link with 80 line
mov edx,0x14000000 mov edx, 0x14000000
add edx,[sc.work] add edx, [sc.work]
mov edi,title mov edi, title
mcall mcall
mcall SF_SYS_MISC, SSF_CONTROL_DRIVER, drv_struct mcall SF_SYS_MISC, SSF_CONTROL_DRIVER, drv_struct
cmp byte[flag_micro_info],1 cmp byte[flag_micro_info], 1
mov eax,SF_CHANGE_WINDOW mov eax, SF_CHANGE_WINDOW
mov ebx,-1 mov ebx, -1
mov ecx,ebx;-1 mov ecx, ebx
jz draw.micro jz draw.micro
mov esi,0x00000115 ; link with 58 line mov esi,0x00000115 ; link with 58 line
mov edx,0x00000132 mov edx,0x00000132
mcall mcall
;;ñîçäàíèå êíîïêè ïåðåêëþ÷åíèÿ ðåæèìà ;;ñîçäàíèå êíîïêè ïåðåêëþ÷åíèÿ ðåæèìà
mov eax,SF_DEFINE_BUTTON mov eax, SF_DEFINE_BUTTON
mov ebx,0x00fc0010 mov ebx, 0x00fc0010
mov ecx,0x001d0015 mov ecx, 0x001d0015
mov edx,0x00000008 mov edx, 0x00000008
mov esi,[sc.work_button] mov esi, [sc.work_button]
mcall mcall
;;âûâîä çíàêà íà êíîïêó ;;âûâîä çíàêà íà êíîïêó
;;òàê êàê ôóíêöèÿ writeText íå äîëæíà èçìåíÿòü ðåãèñòðû ;;òàê êàê ôóíêöèÿ writeText íå äîëæíà èçìåíÿòü ðåãèñòðû
@ -201,164 +205,164 @@ draw:
;; Äàëåå, òàê êàê òåêñò âûâîäèòñÿ ïî÷òè âñåãäà ñ îäèíàêîâûì ;; Äàëåå, òàê êàê òåêñò âûâîäèòñÿ ïî÷òè âñåãäà ñ îäèíàêîâûì
;; ñìåùåíèåì âíèç(ðàâíûì 15) äûííûå(ñòðîêè) èìåþò îäèíàêîâûé ;; ñìåùåíèåì âíèç(ðàâíûì 15) äûííûå(ñòðîêè) èìåþò îäèíàêîâûé
;; ðàçìåð , òî èñïîëüçóåòñÿ èíñòðóêöèÿ add ;; ðàçìåð , òî èñïîëüçóåòñÿ èíñòðóêöèÿ add
mov eax,SF_DRAW_TEXT mov eax, SF_DRAW_TEXT
mov ebx,0x01000020 mov ebx, 0x01000020
mov ecx,0x81000000 mov ecx, 0x81000000
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov edx,_up mov edx, _up
mcall mcall
;ñîçäàíèå êíîïêè çàïóñêà/âûêëþ÷åíèÿ ëîãà ;ñîçäàíèå êíîïêè çàïóñêà/âûêëþ÷åíèÿ ëîãà
mov eax,SF_DEFINE_BUTTON mov eax, SF_DEFINE_BUTTON
mov ebx,0x00a00070 mov ebx, 0x00a00070
mov ecx,0x004a0015 mov ecx, 0x004a0015
mov edx,0x00000009 ;id button mov edx, 0x00000009 ;id button
mov esi,[sc.work_button] mov esi, [sc.work_button]
mcall mcall
; âûâîä òåêñòà ; âûâîä òåêñòà
mov eax,SF_DRAW_TEXT mov eax, SF_DRAW_TEXT
mov ebx,0x00a8004c mov ebx, 0x00a8004c
mov ecx,0x90000000 mov ecx, 0x90000000
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov edx,[text_log_butt] mov edx, [text_log_butt]
mcall mcall
;ñîçäàíèå êíîïêè ñîõðàíåíèÿ ëîãà â ôàéë ;ñîçäàíèå êíîïêè ñîõðàíåíèÿ ëîãà â ôàéë
mov eax,SF_DEFINE_BUTTON mov eax, SF_DEFINE_BUTTON
mov ebx,0x00a00070 mov ebx, 0x00a00070
mov ecx,0x00630015 mov ecx, 0x00630015
mov edx,0x0000000a ; id=10 mov edx, 0x0000000a ; id=10
mov esi,[sc.work_button] mov esi, [sc.work_button]
mcall mcall
; âûâîä òåêñòà ; âûâîä òåêñòà
mov eax,SF_DRAW_TEXT mov eax, SF_DRAW_TEXT
mov ebx,0x00a80065 mov ebx, 0x00a80065
mov ecx,0x90000000 mov ecx, 0x90000000
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov edx,_save_log mov edx, _save_log
mcall mcall
;âûâîä "Tctl:" ;âûâîä "Tctl:"
mov ebx,0x00150035 mov ebx, 0x00150035
mov ecx,0x90000000 mov ecx, 0x90000000
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov edx,_Tctl mov edx, _Tctl
mcall mcall
;âûâîä "Tmax:" ;âûâîä "Tmax:"
add ebx, 0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tcrit hyst:" ;âûâîä "Tcrit hyst:"
;mov ebx,0x0015005f ;mov ebx,0x0015005f
add ebx, 0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tcrit:" ;âûâîä "Tcrit:"
add ebx,0x15;0x2a add ebx, 0x15;0x2a
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tdie:" ;âûâîä "Tdie:"
;mov ebx,0x00150089 ;0x00a5005f ;mov ebx,0x00150089 ;0x00a5005f
add ebx, 0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd1:" ;âûâîä "Tccd1:"
add ebx,0x2b;0x19 add ebx, 0x2b;0x19
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd2:" ;âûâîä "Tccd2:"
add ebx,0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd3:" ;âûâîä "Tccd3:"
add ebx,0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd4:" ;âûâîä "Tccd4:"
add ebx,0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd5:" ;âûâîä "Tccd5:"
mov ebx,0x009d00b4 mov ebx, 0x009d00b4
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd6:" ;âûâîä "Tccd6:"
add ebx,0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd7:" ;âûâîä "Tccd7:"
add ebx,0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;âûâîä "Tccd8:" ;âûâîä "Tccd8:"
add ebx,0x15 add ebx, 0x15
add edx,7 add edx, 7
mcall mcall
;;;;;;input data driver;;;;;;;;; ;;;;;;input data driver;;;;;;;;;
mov eax,0x004a0035 ;0x004a0020 mov eax, 0x004a0035 ;0x004a0020
mov ebx, drv_data.Tctl ;âûâîä äàííûõ îò äðàéâåðà mov ebx, drv_data.Tctl ;âûâîä äàííûõ îò äðàéâåðà
call write_data call write_data
add eax,0x15 add eax, 0x15
mov byte[write_data.defaunt_color], 1 mov byte[write_data.defaunt_color], 1
mov ebx, drv_data.Tmax mov ebx, drv_data.Tmax
call write_data call write_data
add eax,0x2a add eax, 0x2a
mov byte[write_data.defaunt_color], 1 mov byte[write_data.defaunt_color], 1
mov ebx, drv_data.Tcrit mov ebx, drv_data.Tcrit
call write_data call write_data
add eax,0x40;0x19 add eax, 0x40;0x19
mov ebx, drv_data.Tccd1 mov ebx, drv_data.Tccd1
call write_data call write_data
add eax,0x15 add eax, 0x15
add ebx,4 add ebx, 4
call write_data call write_data
add eax,0x15 add eax, 0x15
add ebx,4 add ebx, 4
call write_data call write_data
add eax,0x15 add eax, 0x15
add ebx,4 add ebx, 4
call write_data call write_data
mov eax,0x00d000b4 mov eax, 0x00d000b4
add ebx,4 add ebx, 4
call write_data call write_data
add eax,0x15 add eax, 0x15
add ebx,4 add ebx, 4
call write_data call write_data
add eax,0x15 add eax, 0x15
add ebx,4 add ebx, 4
call write_data call write_data
add eax,0x15 add eax, 0x15
add ebx,4 add ebx, 4
call write_data call write_data
mov eax,0x004a0089 mov eax, 0x004a0089
mov ebx, drv_data.Tdie mov ebx, drv_data.Tdie
mov byte[write_data.defaunt_color], 1 mov byte[write_data.defaunt_color], 1
call write_data call write_data
mov eax,0x004a005f mov eax, 0x004a005f
mov byte[write_data.defaunt_color], 1 mov byte[write_data.defaunt_color], 1
mov ebx, drv_data.Tcrit_hyst mov ebx, drv_data.Tcrit_hyst
call write_data call write_data
@ -375,31 +379,31 @@ draw:
jmp @f jmp @f
.micro: .micro:
mov esi,0x00000035 mov esi, 0x00000035
mov edx,0x000000c0 mov edx, 0x000000c0
mcall mcall
mov eax,SF_DEFINE_BUTTON mov eax, SF_DEFINE_BUTTON
mov ebx,0x00a70010 mov ebx, 0x00a70010
mov ecx,0x001d0015 mov ecx, 0x001d0015
mov edx,eax;0x00000008 mov edx, eax;0x00000008
mov esi,[sc.work_button] mov esi, [sc.work_button]
mcall mcall
mov eax,SF_DRAW_TEXT;4 mov eax, SF_DRAW_TEXT
mov ebx,0x000a0020 mov ebx, 0x000a0020
mov ecx,0x90000000 mov ecx, 0x90000000
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov edx,_Tctl mov edx, _Tctl
mcall mcall
add ebx,0x00a00000 add ebx, 0x00a00000
mov ecx,0x81000000 mov ecx, 0x81000000
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov edx,_down mov edx, _down
mcall mcall
mov eax,0x004a0020 mov eax, 0x004a0020
mov ebx, drv_data.Tctl mov ebx, drv_data.Tctl
call write_data call write_data
@@: @@:
@ -417,16 +421,16 @@ write_data:
push eax ;save koord push eax ;save koord
push ebx ;save *value push ebx ;save *value
;mov edx,[ebx] ;edx=value ;mov edx,[ebx] ;edx=value
mov esi,ebx mov esi, ebx
cmp dword[ebx],-1 ; flag ziro data cmp dword[ebx], -1 ; flag ziro data
mov ecx,0x90000000 mov ecx, 0x90000000
mov ebx,eax mov ebx, eax
jnz @f jnz @f
;write n/a ;write n/a
add ecx,[sc.work_text] add ecx, [sc.work_text]
mov eax,SF_DRAW_TEXT mov eax, SF_DRAW_TEXT
add ebx, 0x00100000 add ebx, 0x00100000
mov edx,_NA mov edx, _NA
mcall mcall
pop ebx pop ebx
pop eax pop eax
@ -454,15 +458,15 @@ write_data:
div dword[drv_data.Tcrit] div dword[drv_data.Tcrit]
cmp eax, 9 cmp eax, 9
jb @f jb @f
mov dword[.color_text],0x00d50000 ; red mov dword[.color_text], 0x00d50000 ; red
jmp .end_set_color jmp .end_set_color
@@: @@:
cmp eax, 7 cmp eax, 7
jb @f jb @f
mov dword[.color_text],0x00f07000 ; orange mov dword[.color_text], 0x00f07000 ; orange
jmp .end_set_color jmp .end_set_color
@@: @@:
mov dword[.color_text],0x0000a500 ; green mov dword[.color_text], 0x0000a500 ; green
.end_set_color: .end_set_color:
pop ecx pop ecx
pop edx pop edx
@ -477,9 +481,9 @@ write_data:
;value-value_in_1 = value_in_2 ;value-value_in_1 = value_in_2
;input value_in_2, koord_start+dot_kord+1*size_w(char=8) ;input value_in_2, koord_start+dot_kord+1*size_w(char=8)
push eax ;save koord push eax ;save koord
mov eax,[esi] ; eax = value mov eax, [esi] ; eax = value
xor edx,edx xor edx, edx
mov ebx,1000 mov ebx, 1000
div ebx div ebx
cmp eax, 100 cmp eax, 100
jae .dot_4 jae .dot_4
@ -493,49 +497,49 @@ write_data:
.dot_3: ; <-| .dot_3: ; <-|
mov edi, 8 mov edi, 8
.write: .write:
mov ecx,edx mov ecx, edx
pop edx ; edx = koord pop edx ; edx = koord
push ecx ;save mask string push ecx ;save mask string
shl edi, 16 shl edi, 16
push edx ; save koord push edx ; save koord
add edx, edi add edx, edi
mov ecx,eax ;ecx = value/1000 mov ecx, eax ;ecx = value/1000
mov ebx,0x80030000 ; ebx = mask sysfn47 mov ebx, 0x80030000 ; ebx = mask sysfn47
mov eax,SF_DRAW_NUMBER mov eax, SF_DRAW_NUMBER
mov esi,0x10000000 mov esi, 0x10000000
add esi,[.color_text] add esi, [.color_text]
mcall mcall
pop ebx ; ebx = koord pop ebx ; ebx = koord
add ebx, 0x00180000 ; x + x_size_char*3 add ebx, 0x00180000 ; x + x_size_char*3
mov eax,SF_DRAW_TEXT mov eax, SF_DRAW_TEXT
mov ecx,0x90000000 mov ecx, 0x90000000
add ecx,[.color_text] add ecx, [.color_text]
mov edx,_dot mov edx, _dot
mcall mcall
mov eax,SF_DRAW_NUMBER mov eax, SF_DRAW_NUMBER
mov edx,ebx mov edx, ebx
mov esi,0x10000000 mov esi, 0x10000000
add esi,[.color_text] add esi, [.color_text]
mov ebx,0x00030000 mov ebx, 0x00030000
add edx,0x80000 add edx, 0x80000
pop ecx pop ecx
mcall mcall
mov eax,SF_DRAW_TEXT mov eax, SF_DRAW_TEXT
mov ebx,edx mov ebx, edx
mov ecx,0x80000000 mov ecx, 0x80000000
add ecx,[.color_text] add ecx, [.color_text]
add ebx,0x180000 add ebx, 0x180000
mov edx,_t mov edx, _t
mcall mcall
mov ecx,0x90000000 mov ecx, 0x90000000
add ecx,[.color_text] add ecx, [.color_text]
add ebx,0x60000 add ebx, 0x60000
mov edx,_C mov edx, _C
mcall mcall
pop ebx pop ebx
pop eax pop eax
@ -555,6 +559,7 @@ exit:
mcall SF_FUTEX, SSF_DESTROY, [futex_handle] mcall SF_FUTEX, SSF_DESTROY, [futex_handle]
mcall 68, 13, [log_ptr] ; free page mcall 68, 13, [log_ptr] ; free page
mcall 18, 18, dword[PID_AUTO_SAVE]
mcall SF_TERMINATE_PROCESS mcall SF_TERMINATE_PROCESS
err_load_lib: err_load_lib:
@ -654,14 +659,14 @@ thread_timer:
movsd movsd
movsd movsd
; cmp dword[save_file], 0 cmp dword[save_ptr], 0
; jnz .no_save_mode jz .no_save_mode
; push dword[log_path] push dword[log_path]
; mov eax, [save_ptr] mov eax, [save_ptr]
; mov [log_path], eax mov [log_path], eax
; mcall 70, file_log mcall 70, file_log
; pop dword[log_path] pop dword[log_path]
;.no_save_mode: .no_save_mode:
jmp @b jmp @b
.err_alloc_2: .err_alloc_2:
send_notify Error_text.alloc_2 send_notify Error_text.alloc_2
@ -675,6 +680,51 @@ thread_timer:
.exit: .exit:
mov byte[futex_cmd], 0x00 mov byte[futex_cmd], 0x00
mcall -1 mcall -1
thread_auto_save:
mcall 40, 0 ;clear event mask
;calculate first data in file(4 value border graphic)
mov eax,[drv_data.Tmax]
mov ebx, graph_start_1.new_data
call int_to_str
;create file
mcall 70, .file
mov dword[.file], 3
mov dword[.log_size], 20
mov dword[.log_offset], 19
mov dword[.log_ptr], graph_start_1.new_data
@@:
mcall 5, 100*60
; add new item in file
push dword[.log_offset]
mov dword[.log_size], 4
mov dword[.log_offset], 2
mov eax,[.index_item]
imul eax,1000
mov ebx, graph_start_1.new_data
call int_to_str
mcall SF_FILE, .file
inc dword[.index_item]
pop dword[.log_offset]
mov dword[.log_size], 20
; get string y koord
mov eax,[drv_data.Tctl]
mov ebx, graph_start_1.new_data_2
call int_to_str
mcall SF_FILE, .file
add dword[.log_offset], 20
jmp @b
mcall -1
.index_item: dd 1
.file:
dd 2
.log_offset: dd 0
dd 0
.log_size: dd 19
.log_ptr: dd graph_start_1
db 0
save_ptr: dd 0 ; pointer to save file or zero
PID_AUTO_SAVE: dd 0 ; for break this thread
;Data_program; ;Data_program;
title db 'AMDtemp',0 title db 'AMDtemp',0
path_drv db '/kolibrios/drivers/sensors/k10temp.sys',0 path_drv db '/kolibrios/drivers/sensors/k10temp.sys',0
@ -725,8 +775,6 @@ log_path: dd openfile_path
futex_handle: dd 0 futex_handle: dd 0
futex_cmd: dd 0 ;1- stop 2 - save in file & no exit 3 - save in file & exit futex_cmd: dd 0 ;1- stop 2 - save in file & no exit 3 - save in file & exit
;save_file: db 0 ; 0 - no 1 - save ïî ñòàðèíêå
;save_ptr: dd 0 ; pointer to save file
drv_ptr: dd path_drv ; pointer to path on driver drv_ptr: dd path_drv ; pointer to path on driver
frame_text_1: db 'General info',0 frame_text_1: db 'General info',0
@ -799,6 +847,10 @@ run_notify:
dd 0 dd 0
db '/sys/@notify',0 db '/sys/@notify',0
align 4 align 4
graph_start_1: db '0 0000 0 ' ; 9 byte
.new_data: db '0000.0000 ' ; 10-19 byte 10 byte
.new_data_2: db '0000.0000 ' ; 20-29 byte 10 byte
align 4
graph_start: db '0 0000 0 ' ; 9 byte graph_start: db '0 0000 0 ' ; 9 byte
.new_data: db '0000.0000 ' ; 10-19 byte 10 byte .new_data: db '0000.0000 ' ; 10-19 byte 10 byte
.new_data_2: db '0000.0000 ' ; 20-29 byte 10 byte .new_data_2: db '0000.0000 ' ; 20-29 byte 10 byte
@ -856,6 +908,8 @@ STACKTOP:
rb 512 ; 512 byte for stack rb 512 ; 512 byte for stack
thread_timer.stack: thread_timer.stack:
rb 512 ; 512 byte for stack
thread_auto_save.stack:
;rb 1024 ;rb 1024
procinfo process_information procinfo process_information
openfile_path: openfile_path:

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
repne scasb
and byte[edi - 1], 0
pop eax
ret ret
.end_parser:
xor eax, eax
ret
.flag_drv: dd 0;don`t using in other code