BOARD - less write cycles and therefore less CPU usage.

git-svn-id: svn://kolibrios.org@4480 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2014-01-18 20:41:33 +00:00
parent dcbe9c8b69
commit 52b2744028

View File

@ -56,16 +56,19 @@ param:
add eax,399 add eax,399
mov [xstart],eax mov [xstart],eax
mcall 48,3,sc,sizeof.system_colors mcall 48,3,sc,sizeof.system_colors
if WRITE_LOG
mov esi,filename mov esi,filename
call CreateFile call CreateFile
end if
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
red: red:
call draw_window call draw_window
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
still: still:
mcall 23,1 ; wait here for event cmp [buffer_length],0
je @f
call write_buffer
@@:
mcall 23,50 ; wait here for event
cmp eax,1 ; redraw request ? cmp eax,1 ; redraw request ?
je red je red
@ -80,11 +83,25 @@ still:
jne still jne still
new_data: new_data:
if WRITE_LOG cmp [buffer_length],255
jne @f
call write_buffer
@@:
movzx ebx,byte[buffer_length]
mov [ebx+tmp],al
inc [buffer_length]
mov ebp,[targ]
.no4:
cmp al,13
jne no13
and [ebp-8],dword 0
jmp new_check
;------------------------------------------
write_buffer:
pusha pusha
mov [tmp],al
mov edx,tmp mov edx,tmp
mov ecx,1 movzx ecx,byte[buffer_length] ;1
mov esi,filename mov esi,filename
.write_to_logfile: .write_to_logfile:
call WriteToFile call WriteToFile
@ -95,15 +112,12 @@ if WRITE_LOG
call CreateFile call CreateFile
jnc .write_to_logfile jnc .write_to_logfile
@@: @@:
inc [filepos] movzx eax,byte[buffer_length]
add [filepos],eax
xor eax,eax
mov [buffer_length],al
popa popa
end if ret
mov ebp,[targ]
.no4:
cmp al,13
jne no13
and [ebp-8],dword 0
jmp new_check
;------------------------------------------ ;------------------------------------------
no13: no13:
cmp al,10 cmp al,10
@ -252,7 +266,6 @@ newline:
jne newline jne newline
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
if WRITE_LOG
;******************************************** ;********************************************
;* input: esi = pointer to the file name * ;* input: esi = pointer to the file name *
;******************************************** ;********************************************
@ -310,8 +323,6 @@ InfoStructure:
filepos dd 0 filepos dd 0
default_filename db '/sys/boardlog.txt',0 default_filename db '/sys/boardlog.txt',0
tmp db 0
end if
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
krnl_msg db 'K : ' krnl_msg db 'K : '
duk db 'KernUser' duk db 'KernUser'
@ -352,7 +363,10 @@ xstart dd ?
sc system_colors sc system_colors
i_end: i_end:
buffer_length rb 1
;------------------------------------------------------------------------------
tmp rb 256
;------------------------------------------------------------------------------
filename rb 256 filename rb 256
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4