AMDtemp: updated the interface and the function of saving graph. The program uses futex.
TODO: fix parser and add check drivers list git-svn-id: svn://kolibrios.org@9870 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e25f14c9ba
commit
2fbbec1b40
@ -1,22 +1,48 @@
|
||||
;; Copyright (C) 2021-2022, Michail Frolov aka Doczom
|
||||
|
||||
macro send_notify send_str{
|
||||
mov dword[run_notify.message], send_str
|
||||
mcall SF_FILE, run_notify
|
||||
}
|
||||
|
||||
use32
|
||||
org 0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd START
|
||||
dd I_END ; à §¬¥à ¯à®£à ¬¬ë
|
||||
dd MEM ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
|
||||
dd I_END
|
||||
dd MEM
|
||||
dd STACKTOP
|
||||
dd PATH
|
||||
dd 0
|
||||
|
||||
include '..\..\proc32.inc'
|
||||
include '..\..\macros.inc'
|
||||
include '..\..\KOSfuncs.inc'
|
||||
include '..\..\dll.inc'
|
||||
|
||||
; include 'parser.inc' ; this modul does not work
|
||||
START:
|
||||
;init heap
|
||||
mcall 68, 11
|
||||
; load lib
|
||||
stdcall dll.Load, @IMPORT
|
||||
or eax, eax
|
||||
jnz err_load_lib
|
||||
; init opendial
|
||||
invoke OpenDialog_Init, OpenDialog_data
|
||||
; init futex
|
||||
mcall SF_FUTEX, SSF_CREATE, futex_cmd
|
||||
mov [futex_handle], eax
|
||||
; parse cmd_line TODO: fix parser and testing
|
||||
;call pars_cmd
|
||||
;test eax, eax
|
||||
;jnz exit
|
||||
;;óñòàíîâêà ìàñêà ñîáûòèé íà ïîëó÷åíèå ïåðåïèñîâêè è íàæàòèÿ íà êíîïêó
|
||||
mcall SF_SET_EVENTS_MASK,0x05
|
||||
;load driver
|
||||
mcall SF_SYS_MISC, SSF_LOAD_DRIVER_PE, path_drv, 0
|
||||
mcall SF_SYS_MISC, SSF_LOAD_DRIVER_PE, [drv_ptr], 0
|
||||
mov dword[drv_struct.handl],eax
|
||||
test eax,eax ;ïðîâåðêà çàãðóçêè
|
||||
jz error_drv
|
||||
@ -24,7 +50,7 @@ main:
|
||||
mcall SF_SYS_MISC, SSF_CONTROL_DRIVER, drv_struct
|
||||
cmp byte[PATH], 0
|
||||
jz still
|
||||
call add_file
|
||||
;call add_file
|
||||
still: ;void main()
|
||||
call draw
|
||||
;;îæèäàíèå ñîáûòèÿ â òå÷åíèè 2000ìñ
|
||||
@ -44,18 +70,108 @@ button:
|
||||
je exit
|
||||
;; id button micro_info = 8
|
||||
cmp ah,7 ;// ah-1=7
|
||||
jnz still
|
||||
jnz .no_micro_info
|
||||
xor byte[flag_micro_info],1
|
||||
jmp still
|
||||
.no_micro_info:
|
||||
; id button log = 9
|
||||
cmp ah, 8 ; 9-1
|
||||
jnz .no_log_button
|
||||
cmp dword[text_log_butt], _start_log
|
||||
jnz .log_stop
|
||||
|
||||
cmp dword[log_ptr], 0
|
||||
jnz @f
|
||||
mcall 68, SSF_MEM_ALLOC, 19 ; íà÷àëüíûå äàííûå äëÿ Graph
|
||||
test eax, eax
|
||||
jz .err_alloc_mem
|
||||
|
||||
mov [log_ptr], eax
|
||||
mov dword[log_size], 19
|
||||
mov edi, eax
|
||||
mov eax,[drv_data.Tmax]
|
||||
mov ebx, graph_start.new_data
|
||||
call int_to_str
|
||||
mov esi, graph_start
|
||||
; set base value in log
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsw
|
||||
movsb
|
||||
@@:
|
||||
mcall 51, 1, thread_timer, thread_timer.stack
|
||||
mov dword[text_log_butt], _stop_log
|
||||
jmp still
|
||||
.log_stop:
|
||||
; ïðîáóæäàåì ïîòîê ÷åðåç ôüþòåêñ
|
||||
mov byte[futex_cmd], 1 ; stop thread
|
||||
mcall SF_FUTEX, SSF_WAKE, [futex_handle], 1
|
||||
mcall 68, 1 ; ïåðåêëþ÷àåì ïîòîêè, äëÿ òîãî, ÷òîáû ñîîáùåíèå ïðèøëî ïîòîêó ñ òàéìåðîì
|
||||
|
||||
; ìåíÿåì òåêñò â êíîïêå
|
||||
mov dword[text_log_butt], _start_log
|
||||
jmp still
|
||||
.err_alloc_mem:
|
||||
send_notify Error_text.alloc_1
|
||||
jmp still
|
||||
.no_log_button:
|
||||
; id button save = 10
|
||||
cmp ah, 9 ; 10-1
|
||||
jnz still
|
||||
cmp dword[log_ptr], 0
|
||||
jnz @f
|
||||
send_notify Error_text.save_log
|
||||
jmp still
|
||||
@@:
|
||||
cmp byte[futex_cmd], 2 ; 2 - save file
|
||||
jnz @f
|
||||
send_notify Error_text.save_log_1
|
||||
jmp still
|
||||
@@:
|
||||
; òóò âûçîâ ôóíêöèè openDialog
|
||||
invoke OpenDialog_Start, OpenDialog_data
|
||||
|
||||
cmp [OpenDialog_data.status],1
|
||||
jne still
|
||||
|
||||
;mov dword[log_path], openfile_path
|
||||
|
||||
; ïðîáóæäàåì ïîòîê ÷åðåç ôüþòåêñ
|
||||
mov byte[futex_cmd], 2 ; save_log
|
||||
mcall SF_FUTEX, SSF_WAKE, [futex_handle], 1
|
||||
test eax, eax
|
||||
jnz still
|
||||
|
||||
mcall 51, 1, thread_timer, thread_timer.stack
|
||||
mcall 68, 1 ; ïåðåêëþ÷àåì ïîòîêè, äëÿ òîãî, ÷òîáû ñîîáùåíèå ïðèøëî ïîòîêó ñ òàéìåðîì
|
||||
@@:
|
||||
mov byte[futex_cmd], 3 ; save_log & exit
|
||||
mcall SF_FUTEX, SSF_WAKE, [futex_handle], 1
|
||||
test eax, eax
|
||||
jz @b
|
||||
mcall 68, 1 ; ïåðåêëþ÷àåì ïîòîêè, äëÿ òîãî, ÷òîáû ñîîáùåíèå ïðèøëî ïîòîêó ñ òàéìåðîì
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw:
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
|
||||
mov eax, dword[sc.work_graph]
|
||||
mov dword[frame_struct.FR_OUTER_COLOR], eax
|
||||
mov eax, dword[sc.work_light]
|
||||
mov dword[frame_struct.FR_INNER_COLOR], eax
|
||||
mov eax, dword[sc.work_text]
|
||||
mov dword[frame_struct.FR_FORE_COLOR], eax
|
||||
mov eax, dword[sc.work]
|
||||
mov dword[frame_struct.FR_BACK_COLOR], eax
|
||||
|
||||
|
||||
mov eax,SF_CREATE_WINDOW
|
||||
mov ebx,0x00ff013f
|
||||
mov ecx,0x001500cc
|
||||
mov ebx,0x00ff0132
|
||||
mov ecx,0x00150114 ; link with 80 line
|
||||
mov edx,0x14000000
|
||||
add edx,[sc.work]
|
||||
mov edi,title
|
||||
@ -63,26 +179,18 @@ draw:
|
||||
|
||||
mcall SF_SYS_MISC, SSF_CONTROL_DRIVER, drv_struct
|
||||
|
||||
cmp byte[PATH], 0
|
||||
jz @f
|
||||
dec dword[update_flag]
|
||||
jnz @f
|
||||
call add_new_item
|
||||
mov dword[update_flag], 30
|
||||
@@:
|
||||
|
||||
cmp byte[flag_micro_info],1
|
||||
mov eax,SF_CHANGE_WINDOW
|
||||
mov ebx,-1
|
||||
mov ecx,ebx;-1
|
||||
jz draw.micro
|
||||
|
||||
mov esi,0x000000cc
|
||||
mov edx,0x0000013f
|
||||
mov esi,0x00000115 ; link with 58 line
|
||||
mov edx,0x00000132
|
||||
mcall
|
||||
;;ñîçäàíèå êíîïêè ïåðåêëþ÷åíèÿ ðåæèìà
|
||||
mov eax,SF_DEFINE_BUTTON
|
||||
mov ebx,0x01250010
|
||||
mov ebx,0x00fc0010
|
||||
mov ecx,0x001d0015
|
||||
mov edx,0x00000008
|
||||
mov esi,[sc.work_button]
|
||||
@ -94,31 +202,73 @@ draw:
|
||||
;; ñìåùåíèåì âíèç(ðàâíûì 15) äûííûå(ñòðîêè) èìåþò îäèíàêîâûé
|
||||
;; ðàçìåð , òî èñïîëüçóåòñÿ èíñòðóêöèÿ add
|
||||
mov eax,SF_DRAW_TEXT
|
||||
mov ebx,0x01290020
|
||||
mov ebx,0x01000020
|
||||
mov ecx,0x81000000
|
||||
add ecx,[sc.work_text]
|
||||
mov edx,_up
|
||||
mcall
|
||||
|
||||
;ñîçäàíèå êíîïêè çàïóñêà/âûêëþ÷åíèÿ ëîãà
|
||||
mov eax,SF_DEFINE_BUTTON
|
||||
mov ebx,0x00a00070
|
||||
mov ecx,0x004a0015
|
||||
mov edx,0x00000009 ;id button
|
||||
mov esi,[sc.work_button]
|
||||
mcall
|
||||
; âûâîä òåêñòà
|
||||
mov eax,SF_DRAW_TEXT
|
||||
mov ebx,0x00a8004c
|
||||
mov ecx,0x90000000
|
||||
add ecx,[sc.work_text]
|
||||
mov edx,[text_log_butt]
|
||||
mcall
|
||||
|
||||
;ñîçäàíèå êíîïêè ñîõðàíåíèÿ ëîãà â ôàéë
|
||||
mov eax,SF_DEFINE_BUTTON
|
||||
mov ebx,0x00a00070
|
||||
mov ecx,0x00630015
|
||||
mov edx,0x0000000a ; id=10
|
||||
mov esi,[sc.work_button]
|
||||
mcall
|
||||
; âûâîä òåêñòà
|
||||
mov eax,SF_DRAW_TEXT
|
||||
mov ebx,0x00a80065
|
||||
mov ecx,0x90000000
|
||||
add ecx,[sc.work_text]
|
||||
mov edx,_save_log
|
||||
mcall
|
||||
|
||||
;âûâîä "Tctl:"
|
||||
mov ebx,0x000a0020
|
||||
mov ebx,0x00150035
|
||||
mov ecx,0x90000000
|
||||
add ecx,[sc.work_text]
|
||||
mov edx,_Tctl
|
||||
mcall
|
||||
|
||||
;âûâîä "Tmax:"
|
||||
add ebx,0x15
|
||||
add ebx, 0x15
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
;âûâîä "Tcrit hyst:"
|
||||
;mov ebx,0x0015005f
|
||||
add ebx, 0x15
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
;âûâîä "Tcrit:"
|
||||
add ebx,0x2a
|
||||
add ebx,0x15;0x2a
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
;âûâîä "Tdie:"
|
||||
;mov ebx,0x00150089 ;0x00a5005f
|
||||
add ebx, 0x15
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
;âûâîä "Tccd1:"
|
||||
add ebx,0x19
|
||||
add ebx,0x2b;0x19
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
@ -138,7 +288,7 @@ draw:
|
||||
mcall
|
||||
|
||||
;âûâîä "Tccd5:"
|
||||
mov ebx,0x00a50078
|
||||
mov ebx,0x009d00b4
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
@ -156,18 +306,8 @@ draw:
|
||||
add ebx,0x15
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
;âûâîä "Tdie:"
|
||||
mov ebx,0x00a5005f
|
||||
add edx,7
|
||||
mcall
|
||||
|
||||
;âûâîä "Tcrit hyst:"
|
||||
mov ebx,0x000a004a
|
||||
add edx,7
|
||||
mcall
|
||||
;;;;;;input data driver;;;;;;;;;
|
||||
mov eax,0x004a0020
|
||||
mov eax,0x004a0035 ;0x004a0020
|
||||
mov ebx, drv_data.Tctl ;âûâîä äàííûõ îò äðàéâåðà
|
||||
call write_data
|
||||
|
||||
@ -181,7 +321,7 @@ draw:
|
||||
mov ebx, drv_data.Tcrit
|
||||
call write_data
|
||||
|
||||
add eax,0x19
|
||||
add eax,0x40;0x19
|
||||
mov ebx, drv_data.Tccd1
|
||||
call write_data
|
||||
|
||||
@ -197,7 +337,7 @@ draw:
|
||||
add ebx,4
|
||||
call write_data
|
||||
|
||||
mov eax,0x00E50078
|
||||
mov eax,0x00d000b4
|
||||
add ebx,4
|
||||
call write_data
|
||||
|
||||
@ -213,15 +353,26 @@ draw:
|
||||
add ebx,4
|
||||
call write_data
|
||||
|
||||
mov eax,0x00E5005f
|
||||
mov eax,0x004a0089
|
||||
mov ebx, drv_data.Tdie
|
||||
mov byte[write_data.defaunt_color], 1
|
||||
call write_data
|
||||
|
||||
mov eax,0x007a004a
|
||||
mov eax,0x004a005f
|
||||
mov byte[write_data.defaunt_color], 1
|
||||
mov ebx, drv_data.Tcrit_hyst
|
||||
call write_data
|
||||
|
||||
mov dword[frame_struct.FR_WIDTH], 0x0f008a
|
||||
mov dword[frame_struct.FR_HEIGHT], 0x280075
|
||||
mov dword[frame_struct.FR_TEXT], frame_text_1
|
||||
invoke frame_draw, frame_struct
|
||||
|
||||
mov dword[frame_struct.FR_WIDTH],0x0f0114
|
||||
mov dword[frame_struct.FR_HEIGHT], 0xa70060
|
||||
mov dword[frame_struct.FR_TEXT], frame_text_2
|
||||
invoke frame_draw, frame_struct
|
||||
|
||||
jmp @f
|
||||
.micro:
|
||||
mov esi,0x00000035
|
||||
@ -263,8 +414,8 @@ draw:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
align 4
|
||||
write_data:
|
||||
push eax
|
||||
push ebx
|
||||
push eax ;save koord
|
||||
push ebx ;save *value
|
||||
;mov edx,[ebx] ;edx=value
|
||||
mov esi,ebx
|
||||
cmp dword[ebx],-1 ; flag ziro data
|
||||
@ -274,6 +425,7 @@ write_data:
|
||||
;write n/a
|
||||
add ecx,[sc.work_text]
|
||||
mov eax,SF_DRAW_TEXT
|
||||
add ebx, 0x00100000
|
||||
mov edx,_NA
|
||||
mcall
|
||||
pop ebx
|
||||
@ -284,11 +436,17 @@ write_data:
|
||||
push eax
|
||||
push edx
|
||||
push ecx
|
||||
mov dword[.color_text], 0x000000cf ;blue
|
||||
cmp byte[.defaunt_color], 1
|
||||
jnz @f
|
||||
mov dword[.color_text], 0x000000cf ;blue
|
||||
;mov dword[.color_text], 0x000000cf ;blue
|
||||
jmp .end_set_color
|
||||
@@:
|
||||
cmp dword[drv_data.Tcrit], -1
|
||||
jz .end_set_color
|
||||
cmp dword[drv_data.Tcrit], 0
|
||||
jz .end_set_color
|
||||
|
||||
xor edx, edx
|
||||
mov eax, [esi]
|
||||
imul eax, 10
|
||||
@ -304,7 +462,7 @@ write_data:
|
||||
mov dword[.color_text],0x00f07000 ; orange
|
||||
jmp .end_set_color
|
||||
@@:
|
||||
mov dword[.color_text],0x0000d000 ; green
|
||||
mov dword[.color_text],0x0000a500 ; green
|
||||
.end_set_color:
|
||||
pop ecx
|
||||
pop edx
|
||||
@ -318,42 +476,45 @@ write_data:
|
||||
;input ".", koord_start+dot_koord*size_w(char)
|
||||
;value-value_in_1 = value_in_2
|
||||
;input value_in_2, koord_start+dot_kord+1*size_w(char=8)
|
||||
push eax
|
||||
mov eax,[esi]
|
||||
push eax ;save koord
|
||||
mov eax,[esi] ; eax = value
|
||||
xor edx,edx
|
||||
mov ebx,1000
|
||||
div ebx
|
||||
cmp eax,100
|
||||
cmp eax, 100
|
||||
jae .dot_4
|
||||
cmp eax,10
|
||||
cmp eax, 10
|
||||
jae .dot_3 ; ----|
|
||||
mov edi,0x0c;0x10; |
|
||||
mov edi, 0x10 ; |
|
||||
jmp .write ; |
|
||||
.dot_4: ; |
|
||||
mov edi,0x1c;0x20; |
|
||||
xor edi, edi ; |
|
||||
jmp .write ; |
|
||||
.dot_3: ; <-|
|
||||
mov edi,0x14;0x18
|
||||
mov edi, 8
|
||||
.write:
|
||||
mov ecx,edx
|
||||
pop edx
|
||||
push ecx
|
||||
pop edx ; edx = koord
|
||||
push ecx ;save mask string
|
||||
|
||||
mov ecx,eax
|
||||
mov ebx,0x80030000
|
||||
shl edi, 16
|
||||
push edx ; save koord
|
||||
add edx, edi
|
||||
mov ecx,eax ;ecx = value/1000
|
||||
mov ebx,0x80030000 ; ebx = mask sysfn47
|
||||
mov eax,SF_DRAW_NUMBER
|
||||
mov esi,0x10000000
|
||||
add esi,[.color_text]
|
||||
mcall
|
||||
shl edi,16
|
||||
mov eax,SF_DRAW_TEXT
|
||||
add edx,edi
|
||||
mov ebx,edx
|
||||
|
||||
pop ebx ; ebx = koord
|
||||
add ebx, 0x00180000 ; x + x_size_char*3
|
||||
mov eax,SF_DRAW_TEXT
|
||||
mov ecx,0x90000000
|
||||
add ecx,[.color_text]
|
||||
mov edx,_dot
|
||||
mcall
|
||||
|
||||
mov eax,SF_DRAW_NUMBER
|
||||
mov edx,ebx
|
||||
mov esi,0x10000000
|
||||
@ -385,42 +546,24 @@ write_data:
|
||||
;; end proc
|
||||
|
||||
error_drv:
|
||||
mcall SF_FILE,run_notify
|
||||
send_notify Error_text
|
||||
exit:
|
||||
mov byte[futex_cmd], 2
|
||||
mcall SF_FUTEX, SSF_WAKE, [futex_handle], 1
|
||||
mcall 68, 1 ; ïåðåêëþ÷àåì ïîòîêè, äëÿ òîãî, ÷òîáû ñîîáùåíèå ïðèøëî ïîòîêó ñ òàéìåðîì
|
||||
; destroy futex
|
||||
mcall SF_FUTEX, SSF_DESTROY, [futex_handle]
|
||||
mcall 68, 13, [log_ptr] ; free page
|
||||
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
err_load_lib:
|
||||
send_notify Error_text.load_lib
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
align 4
|
||||
add_file:
|
||||
mcall SF_FILE, graph_temp
|
||||
mov dword[graph_temp], 3
|
||||
mov dword[graph_temp.size], 10
|
||||
mov dword[graph_temp.str], graph_start.new_data
|
||||
mov eax,[drv_data.Tmax]
|
||||
mov dword[graph_temp.index], 9
|
||||
mov ebx, graph_start.new_data
|
||||
call int_to_str
|
||||
mcall SF_FILE, graph_temp
|
||||
|
||||
mov dword[graph_temp.index], 19
|
||||
mov dword[graph_temp.size], 20
|
||||
ret
|
||||
align 4
|
||||
index_item:
|
||||
dd 1
|
||||
add_new_item:
|
||||
mov eax,[index_item]
|
||||
imul eax,1000
|
||||
mov ebx, graph_start.new_data
|
||||
call int_to_str
|
||||
mcall SF_FILE, graph_koord_x2 ;save x2=index_item
|
||||
inc dword[index_item]
|
||||
|
||||
mov eax,[drv_data.Tctl]
|
||||
mov ebx, graph_start.new_data_2
|
||||
call int_to_str
|
||||
mcall SF_FILE, graph_temp
|
||||
add dword[graph_temp.index], 20
|
||||
ret
|
||||
|
||||
;eax = int value / 1000
|
||||
;ebx = *str
|
||||
@ -431,7 +574,7 @@ int_to_str:
|
||||
push ecx edx esi
|
||||
mov ecx, '0000'
|
||||
mov [ebx], ecx
|
||||
mov [ebx+5], ecx
|
||||
mov [ebx + 5], ecx
|
||||
|
||||
xor edx, edx
|
||||
mov esi, 1000
|
||||
@ -465,10 +608,83 @@ int_to_str:
|
||||
@@:
|
||||
pop esi edx ecx
|
||||
ret
|
||||
|
||||
thread_timer:
|
||||
mcall 40, 0x00 ; î÷èùàåì ìàñêó ñîáûòèé
|
||||
@@:
|
||||
mov byte[futex_cmd], 0x00
|
||||
mcall SF_FUTEX, SSF_WAIT, [futex_handle],[futex_cmd], 100*60 ; 1 min
|
||||
test eax, eax
|
||||
jz .check_cmd
|
||||
cmp eax, -2
|
||||
je .exit ; error
|
||||
; realloc log
|
||||
mov ecx, [log_size]
|
||||
mov edx, [log_ptr]
|
||||
add ecx, 20 ; size item data
|
||||
mov ebx, SSF_MEM_REALLOC ; 20
|
||||
mcall 68
|
||||
test eax, eax
|
||||
jz .err_alloc_2
|
||||
mov [log_ptr], eax
|
||||
add eax, [log_size]
|
||||
mov [log_size], ecx;edx
|
||||
mov edi, eax
|
||||
; get new data temp
|
||||
push edi
|
||||
mov eax,[index_item]
|
||||
imul eax,1000
|
||||
mov ebx, graph_start.new_data
|
||||
call int_to_str
|
||||
|
||||
mov ebx, [log_ptr]
|
||||
mov eax, [graph_start.new_data]
|
||||
mov [ebx + 2], eax ; rewrite index x koord
|
||||
|
||||
inc dword[index_item]
|
||||
mov eax,[drv_data.Tctl]
|
||||
mov ebx, graph_start.new_data_2
|
||||
call int_to_str
|
||||
pop edi
|
||||
mov esi, graph_start.new_data
|
||||
; save data
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
|
||||
; cmp dword[save_file], 0
|
||||
; jnz .no_save_mode
|
||||
; push dword[log_path]
|
||||
; mov eax, [save_ptr]
|
||||
; mov [log_path], eax
|
||||
; mcall 70, file_log
|
||||
; pop dword[log_path]
|
||||
;.no_save_mode:
|
||||
jmp @b
|
||||
.err_alloc_2:
|
||||
send_notify Error_text.alloc_2
|
||||
jmp @b
|
||||
.check_cmd:
|
||||
test byte[futex_cmd], 0x02 ; 1- stop 2 - save in file
|
||||
jz .exit
|
||||
mcall 70, file_log
|
||||
test byte[futex_cmd], 1
|
||||
jz @b
|
||||
.exit:
|
||||
mov byte[futex_cmd], 0x00
|
||||
mcall -1
|
||||
;Data_program;
|
||||
title db 'AMDtemp',0
|
||||
path_drv db '/kolibrios/drivers/sensors/k10temp.sys',0
|
||||
Error_text db '"Error load driver\nk10temp.sys was not found or is faulty " -tdE ',0
|
||||
.save_log: db '"Error save log\nThe log has not been created" -tdE',0
|
||||
.save_log_1:db '"Error save log\nThe log file is already saving" -tdE',0
|
||||
.alloc_1: db '"Error alloc memory for log" -tdE',0
|
||||
.alloc_2: db '"Error alloc memory for new koord" -tdE',0
|
||||
.load_lib: db '"Error load library" -tdE',0
|
||||
|
||||
_NA db 'N/A',0
|
||||
_dot db '.',0
|
||||
_t db 0x1d,0x00
|
||||
@ -479,7 +695,9 @@ _up db 0x1e,0x00
|
||||
|
||||
_Tctl db 'Tctl: ',0
|
||||
_Tmax db 'Tmax: ',0
|
||||
_Tcrit_hyst db 'Thyst:',0;'Tcrit hyst:',0
|
||||
_Tcrit db 'Tcrit:',0
|
||||
_Tdie db 'Tdie: ',0
|
||||
_Tccd1 db 'Tccd1:',0
|
||||
_Tccd2 db 'Tccd2:',0
|
||||
_Tccd3 db 'Tccd3:',0
|
||||
@ -488,8 +706,62 @@ _Tccd5 db 'Tccd5:',0
|
||||
_Tccd6 db 'Tccd6:',0
|
||||
_Tccd7 db 'Tccd7:',0
|
||||
_Tccd8 db 'Tccd8:',0
|
||||
_Tdie db 'Tdie: ',0
|
||||
_Tcrit_hyst db 'Tcrit hyst:',0
|
||||
|
||||
_start_log: db 'start loging',0
|
||||
_stop_log: db 'stop loging ',0
|
||||
_save_log: db ' save log ',0
|
||||
text_log_butt: dd _start_log
|
||||
|
||||
align 4
|
||||
file_log:
|
||||
dd 2
|
||||
dd 0
|
||||
dd 0
|
||||
log_size: dd 0
|
||||
log_ptr: dd 0
|
||||
db 0
|
||||
log_path: dd openfile_path
|
||||
|
||||
futex_handle: dd 0
|
||||
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
|
||||
|
||||
frame_text_1: db 'General info',0
|
||||
frame_text_2: db 'Extended info',0
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
|
||||
library box_lib , 'box_lib.obj', \
|
||||
proc_lib , 'proc_lib.obj'
|
||||
|
||||
import proc_lib, \
|
||||
OpenDialog_Init , 'OpenDialog_init',\
|
||||
OpenDialog_Start , 'OpenDialog_start'
|
||||
|
||||
import box_lib,\
|
||||
frame_draw , 'frame_draw'
|
||||
|
||||
frame_struct:
|
||||
dd 0;FR_STYLE â êîäå ëèáû íå èñïîëüçóåòñÿ
|
||||
.FR_WIDTH dw 0x8a;FR_WIDTH
|
||||
dw 0x0f;FR_LEFT start x
|
||||
.FR_HEIGHT dw 0x75;FR_HEIGHT
|
||||
dw 0x28;FR_TOP start y
|
||||
.FR_OUTER_COLOR dd 0xff;FR_OUTER_COLOR âíåøíèé îêðàñ ëèíèè ïðè ôëàãå x000z
|
||||
.FR_INNER_COLOR dd 0xff00;FR_INNER_COLOR âíóòðåíèé îêðàñ ëèíèè ïðè ôëàãå x000z
|
||||
dd 00001b;FR_FLAGS
|
||||
;FR_CAPTION equ 00001b ïîêàçûâàòü çàãîëîâîê èëè íåò
|
||||
;FR_FILLED equ 10000b çàêðàøèâàåò âíóòðåíèþ îáëàñòü öâåòîì ôîíà òåêñòà
|
||||
.FR_TEXT dd 0;FR_TEXT òóò è òàê ïîíÿòíî
|
||||
dd 0;FR_TEXT_POSITION 0 - ñâåðõó òåêñò 1 - ñíèçó òåêñò
|
||||
dd 1;FR_FONT
|
||||
dd 0x0c;FR_FONT_HEIGHT ñìåùåíèå êîîðäèíàòû y âûâîäèìîãî òåêñòà
|
||||
.FR_FORE_COLOR dd 0xff;FR_FORE_COLOR öâåò òåêñòà
|
||||
.FR_BACK_COLOR dd 0xffffff;FR_BACK_COLOR ôîí ñèìâîëîâ òåêñòà
|
||||
|
||||
;;flag mode input data
|
||||
flag_micro_info db 1
|
||||
@ -522,35 +794,58 @@ align 4
|
||||
run_notify:
|
||||
dd 7
|
||||
dd 0
|
||||
dd Error_text
|
||||
.message: dd Error_text
|
||||
dd 0
|
||||
dd 0
|
||||
db '/sys/@notify',0 ,0,0,0 ;âûðàâíèâàíèå
|
||||
|
||||
db '/sys/@notify',0
|
||||
align 4
|
||||
update_flag: dd 30 ;1 minut
|
||||
graph_start: 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_temp:
|
||||
dd 2
|
||||
.index: dd 0
|
||||
dd 0
|
||||
.size: dd 19 ;size 4 first value for Graph
|
||||
.str: dd graph_start ; çàìåíèòü
|
||||
db 0
|
||||
dd PATH
|
||||
align 4
|
||||
graph_koord_x2:
|
||||
dd 3
|
||||
dd 2 ;index for rewrite 2 value
|
||||
dd 0
|
||||
dd 4
|
||||
dd graph_start.new_data ; çàìåíèòü
|
||||
db 0
|
||||
dd PATH
|
||||
OpenDialog_data:
|
||||
.type dd 1 ;0 - îòêðûòü, 1 - ñîõðàíèòü, 2 - âûáðàòü äèðåêòîðèþ
|
||||
.procinfo dd procinfo ;+4 ýòî äëÿ ïîëó÷åíèÿ äàííûõ ïîòîêà
|
||||
.com_area_name dd communication_area_name ;+8
|
||||
.com_area dd 0 ;+12 êàê ÿ ïîíÿë, ñþäà áóäåò çàïèñàí óêàçàòåëü íà ðàñøàðåíóþ ïàìÿòü
|
||||
.opendir_path dd 0 ;+16 ïóòü ê ïàïêå, êîòîðàÿ áóäåò ïðè îòêðûòèè êîìïîíåíòà
|
||||
.dir_default_path dd default_dir ;+20 ïóòü ê ïàïêå, åñëè opendir_path=0
|
||||
.start_path dd opendialog_path ;+24 ïóòü ê opendialog
|
||||
.draw_window dd draw ;+28 ôóíêöèÿ ïåðåðèñîâêè îêíà, âûçâàâøåãî opendialog
|
||||
.status dd 0 ;+32 0, 2 - âûõîä èëè îøèáêà 1 - þçåð íàæàë OK
|
||||
.openfile_path dd openfile_path ;+36 óêàçàòåëü íà áóôåð äëÿ ïóòü ê îòêðûâàåìîìó ôàéëó
|
||||
.filename_area dd filename_area ;+40 óêàçàòåëü íà áóôåð äëÿ íàçâàíèÿ ôàéëà
|
||||
.filter_area dd 0;Filter óêàçàòåëü íà ìàññèâ ôèëüòîðîâ ïîèñêà
|
||||
.x:
|
||||
.x_size dw 420 ;+48 ; Window X size
|
||||
.x_start dw 10 ;+50 ; Window X position
|
||||
.y:
|
||||
.y_size dw 320 ;+52 ; Window y size
|
||||
.y_start dw 10 ;+54 ; Window Y position
|
||||
|
||||
;ôîðìàò ôèëüòðîâ
|
||||
;Filter:
|
||||
;dd Filter.end - Filter.1
|
||||
;.1:
|
||||
;db 'ASM',0
|
||||
;db 'INC',0
|
||||
;db 'TXT',0
|
||||
;.end:
|
||||
;db 0
|
||||
|
||||
|
||||
default_dir db '/sys',0 ;äèðåêòîðèÿ ïî óìîë÷àíèþ
|
||||
|
||||
communication_area_name:
|
||||
db 'FFFFFFFF_open_dialog',0
|
||||
opendialog_path:
|
||||
db '/sys/File managers/opendial',0
|
||||
filename_area:
|
||||
db 'temp1.grf',0
|
||||
rb 256
|
||||
|
||||
align 4
|
||||
PATH:
|
||||
rb 512 ; buffer for command line. string for save log.
|
||||
@ -558,4 +853,11 @@ sc system_colors
|
||||
I_END:
|
||||
rd 256
|
||||
STACKTOP:
|
||||
|
||||
rb 512 ; 512 byte for stack
|
||||
thread_timer.stack:
|
||||
;rb 1024
|
||||
procinfo process_information
|
||||
openfile_path:
|
||||
rb 4096
|
||||
MEM:
|
63
programs/system/amd_temp_view/parser.inc
Normal file
63
programs/system/amd_temp_view/parser.inc
Normal file
@ -0,0 +1,63 @@
|
||||
pars_cmd:
|
||||
mov edi, PATH
|
||||
mov ecx, 512
|
||||
.still:
|
||||
mov al, ' '
|
||||
repz scasb
|
||||
|
||||
test ecx, ecx
|
||||
jz .end_parser
|
||||
|
||||
dec edi
|
||||
mov ebx, edi ;save edi
|
||||
cmp byte[edi],'"'
|
||||
jnz @f ;.skip_string
|
||||
mov eax, [save_file]
|
||||
cmp eax, [.flag_drv]
|
||||
jae .str_save
|
||||
|
||||
cmp dword[drv_ptr], 0
|
||||
jnz .err
|
||||
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
|
||||
@@:
|
||||
cmp edi, ebx
|
||||
jz .err
|
||||
jmp .still
|
||||
|
||||
.skip_string:
|
||||
inc edi
|
||||
mov al, '"'
|
||||
rep scasb
|
||||
test ecx, ecx
|
||||
jz .err
|
||||
mov byte[edi-1], 0x00
|
||||
jmp .still
|
||||
.err:
|
||||
or eax, -1
|
||||
ret
|
||||
.end_parser:
|
||||
xor eax, eax
|
||||
ret
|
||||
.flag_drv: dd 0;don`t using in other code
|
Loading…
Reference in New Issue
Block a user