forked from KolibriOS/kolibrios
Board
1) Optimize redrawing 2) Clearing of source code git-svn-id: svn://kolibrios.org@2234 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
132b516d92
commit
63531bfca1
@ -23,109 +23,96 @@ include 'debug.inc'
|
|||||||
purge newline
|
purge newline
|
||||||
MAXSTRINGS = 16
|
MAXSTRINGS = 16
|
||||||
TMP = 80*(MAXSTRINGS+1)
|
TMP = 80*(MAXSTRINGS+1)
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
START: ; start of execution
|
START: ; start of execution
|
||||||
mov edi, filename
|
mov edi,filename
|
||||||
cmp byte [edi], 0
|
cmp [edi],byte 0
|
||||||
jnz param
|
jnz param
|
||||||
mov esi, default_filename
|
mov esi,default_filename
|
||||||
@@:
|
@@:
|
||||||
lodsb
|
lodsb
|
||||||
stosb
|
stosb
|
||||||
test al, al
|
test al,al
|
||||||
jnz @b
|
jnz @b
|
||||||
param:
|
param:
|
||||||
|
|
||||||
; allow user to see messages written before start
|
; allow user to see messages written before start
|
||||||
; mov ecx,4096
|
; mov ecx,4096
|
||||||
; flush:
|
;flush:
|
||||||
; mov eax,63
|
; mcall 63,2
|
||||||
; mov ebx,2
|
|
||||||
; mcall
|
|
||||||
; loop flush
|
; loop flush
|
||||||
|
|
||||||
mov ecx, TMP
|
mov ecx,TMP
|
||||||
xor eax, eax
|
xor eax,eax
|
||||||
mov edi, [targ]
|
mov edi,[targ]
|
||||||
rep stosb
|
rep stosb
|
||||||
|
|
||||||
mov [tmp1],'x'
|
mov [tmp1],'x'
|
||||||
mov [tmp2],'x'
|
mov [tmp2],'x'
|
||||||
|
|
||||||
mov eax,14
|
mcall 14
|
||||||
mcall
|
|
||||||
and eax,0xffff0000
|
and eax,0xffff0000
|
||||||
sub eax,399 shl 16
|
sub eax,399 shl 16
|
||||||
add eax,399
|
add eax,399
|
||||||
mov [xstart],eax
|
mov [xstart],eax
|
||||||
|
mcall 48,3,sc,sizeof.system_colors
|
||||||
mov eax,48
|
if WRITE_LOG
|
||||||
mov ebx,3
|
mov esi,filename
|
||||||
mov ecx,sc
|
|
||||||
mov edx,sizeof.system_colors
|
|
||||||
mcall
|
|
||||||
if WRITE_LOG
|
|
||||||
mov esi, filename
|
|
||||||
call CreateFile
|
call CreateFile
|
||||||
end if
|
end if
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
red:
|
red:
|
||||||
call draw_window
|
call draw_window
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
still:
|
still:
|
||||||
|
mcall 23,1 ; wait here for event
|
||||||
mov eax,23 ; wait here for event
|
|
||||||
mov ebx,1
|
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp eax,1 ; redraw request ?
|
cmp eax,1 ; redraw request ?
|
||||||
je red
|
je red
|
||||||
|
|
||||||
cmp eax,2 ; key in buffer ?
|
cmp eax,2 ; key in buffer ?
|
||||||
je key
|
je key
|
||||||
|
|
||||||
cmp eax,3 ; button in buffer ?
|
cmp eax,3 ; button in buffer ?
|
||||||
je button
|
je button
|
||||||
|
|
||||||
mov eax,63
|
mcall 63,2
|
||||||
mov ebx,2
|
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp ebx,1
|
cmp ebx,1
|
||||||
jne still
|
jne still
|
||||||
|
|
||||||
new_data:
|
new_data:
|
||||||
if WRITE_LOG
|
if WRITE_LOG
|
||||||
pusha
|
pusha
|
||||||
mov [tmp], al
|
mov [tmp],al
|
||||||
mov edx, tmp
|
mov edx,tmp
|
||||||
mov ecx, 1
|
mov ecx,1
|
||||||
mov esi, filename
|
mov esi,filename
|
||||||
.write_to_logfile:
|
.write_to_logfile:
|
||||||
call WriteToFile
|
call WriteToFile
|
||||||
cmp eax, 5
|
cmp eax,5
|
||||||
jne @f
|
jne @f
|
||||||
mov esi, filename
|
mov esi,filename
|
||||||
mov [filepos], 0
|
mov [filepos],0
|
||||||
call CreateFile
|
call CreateFile
|
||||||
jnc .write_to_logfile
|
jnc .write_to_logfile
|
||||||
@@:
|
@@:
|
||||||
inc [filepos]
|
inc [filepos]
|
||||||
popa
|
popa
|
||||||
end if
|
end if
|
||||||
|
|
||||||
mov ebp,[targ]
|
mov ebp,[targ]
|
||||||
.no4:
|
.no4:
|
||||||
cmp al,13
|
cmp al,13
|
||||||
jne no13
|
jne no13
|
||||||
and dword[ebp-8],0
|
and [ebp-8],dword 0
|
||||||
jmp new_check
|
jmp new_check
|
||||||
no13:
|
;------------------------------------------
|
||||||
|
no13:
|
||||||
cmp al,10
|
cmp al,10
|
||||||
jne no10
|
jne no10
|
||||||
and dword[ebp-8],0
|
and [ebp-8],dword 0
|
||||||
inc dword[ebp-4]
|
inc dword [ebp-4]
|
||||||
cmp dword[ebp-4],MAXSTRINGS
|
cmp [ebp-4],dword MAXSTRINGS
|
||||||
jbe .noypos
|
jbe .noypos
|
||||||
mov dword[ebp-4],MAXSTRINGS
|
mov [ebp-4],dword MAXSTRINGS
|
||||||
lea esi,[ebp+80]
|
lea esi,[ebp+80]
|
||||||
mov edi,ebp
|
mov edi,ebp
|
||||||
mov ecx,80*(MAXSTRINGS)
|
mov ecx,80*(MAXSTRINGS)
|
||||||
@ -139,11 +126,12 @@ still:
|
|||||||
mov ecx,80
|
mov ecx,80
|
||||||
xor al,al
|
xor al,al
|
||||||
rep stosb
|
rep stosb
|
||||||
.noypos:
|
.noypos:
|
||||||
mov [targ],text2
|
mov [targ],text2
|
||||||
and [krnl_cnt],0
|
and [krnl_cnt],0
|
||||||
jmp new_check
|
jmp new_check
|
||||||
no10:
|
;------------------------------------------
|
||||||
|
no10:
|
||||||
cmp ebp,text1
|
cmp ebp,text1
|
||||||
je add2
|
je add2
|
||||||
mov ecx,[krnl_cnt]
|
mov ecx,[krnl_cnt]
|
||||||
@ -153,54 +141,44 @@ still:
|
|||||||
cmp [krnl_cnt],4
|
cmp [krnl_cnt],4
|
||||||
jne new_check
|
jne new_check
|
||||||
mov [targ],text1
|
mov [targ],text1
|
||||||
.noknl:
|
.noknl:
|
||||||
mov ebp,[targ]
|
mov ebp,[targ]
|
||||||
jecxz .add
|
jecxz .add
|
||||||
push eax
|
push eax
|
||||||
mov esi,krnl_msg
|
mov esi,krnl_msg
|
||||||
.l1:
|
.l1:
|
||||||
lodsb
|
lodsb
|
||||||
call add_char
|
call add_char
|
||||||
loop .l1
|
loop .l1
|
||||||
pop eax
|
pop eax
|
||||||
.add:
|
.add:
|
||||||
and [krnl_cnt],0
|
and [krnl_cnt],0
|
||||||
add2:
|
add2:
|
||||||
call add_char
|
call add_char
|
||||||
|
|
||||||
new_check:
|
new_check:
|
||||||
|
mcall 63,2
|
||||||
mov eax,63
|
|
||||||
mov ebx,2
|
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp ebx,1
|
cmp ebx,1
|
||||||
je new_data
|
je new_data
|
||||||
|
call draw_text
|
||||||
call draw_window
|
|
||||||
|
|
||||||
jmp still
|
jmp still
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
key: ; key
|
key:
|
||||||
mov al,2 ; just read it and ignore
|
mcall 2
|
||||||
mcall
|
|
||||||
cmp ah,' '
|
cmp ah,' '
|
||||||
je button.noclose
|
je button.noclose
|
||||||
jmp still
|
jmp still
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
button: ; button
|
button:
|
||||||
mov al,17 ; get id
|
mcall 17 ; get id
|
||||||
mcall
|
|
||||||
|
|
||||||
cmp ah,1 ; button id=1 ?
|
cmp ah,1 ; button id=1 ?
|
||||||
jne .noclose
|
jne .noclose
|
||||||
|
|
||||||
or eax,-1 ; close this program
|
or eax,-1 ; close this program
|
||||||
mcall
|
mcall
|
||||||
.noclose:
|
.noclose:
|
||||||
xor [vmode],1
|
xor [vmode],1
|
||||||
jmp red
|
jmp red
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
add_char:
|
add_char:
|
||||||
push esi
|
push esi
|
||||||
mov esi,[ebp-4]
|
mov esi,[ebp-4]
|
||||||
@ -211,62 +189,66 @@ add_char:
|
|||||||
cmp dword[ebp-8],80
|
cmp dword[ebp-8],80
|
||||||
jb .ok
|
jb .ok
|
||||||
mov dword[ebp-8],79
|
mov dword[ebp-8],79
|
||||||
.ok:
|
.ok:
|
||||||
pop esi
|
pop esi
|
||||||
ret
|
ret
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
; *********************************************
|
; *********************************************
|
||||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||||
; *********************************************
|
; *********************************************
|
||||||
|
|
||||||
|
|
||||||
draw_window:
|
draw_window:
|
||||||
|
mcall 12,1 ; 1, start of draw
|
||||||
mov eax,12 ; function 12:tell os about windowdraw
|
|
||||||
mov ebx,1 ; 1, start of draw
|
|
||||||
mcall
|
|
||||||
|
|
||||||
; DRAW WINDOW
|
|
||||||
xor eax,eax ; function 0 : define and draw window
|
xor eax,eax ; function 0 : define and draw window
|
||||||
; mov ebx,50*65536+400 ; [x start] *65536 + [x size]
|
|
||||||
mov ebx,[xstart]
|
|
||||||
mov ecx,MAXSTRINGS*10+45 ; [y start] *65536 + [y size]
|
mov ecx,MAXSTRINGS*10+45 ; [y start] *65536 + [y size]
|
||||||
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
||||||
or edx,0x13000000
|
or edx,0x13000000
|
||||||
mov edi,title ; WINDOW LABEL
|
xor esi,esi
|
||||||
mcall
|
mcall ,[xstart],,,,title
|
||||||
|
|
||||||
mov ecx,4
|
|
||||||
mov esi,[sc.work]
|
|
||||||
mov ebx,296 shl 16+5*6
|
mov ebx,296 shl 16+5*6
|
||||||
mov edx,3;+1 shl 30
|
mcall 8,,<5,12>,3,[sc.work]
|
||||||
mcall 8,,<5,12>
|
|
||||||
mov edx,[vmode]
|
mov edx,[vmode]
|
||||||
lea edx,[edx*4+duk]
|
lea edx,[edx*4+duk]
|
||||||
mcall 4,<300,8>,,,4
|
mcall 4,<300,8>,,,4
|
||||||
|
call draw_text
|
||||||
mov ebx,15*65536+33 ; draw info text with function 4
|
mcall 12,2 ; 2, end of draw
|
||||||
|
ret
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
draw_text:
|
||||||
|
mov ebx,15*65536+30 ; draw info text with function 4
|
||||||
mov ecx,[sc.work_text]
|
mov ecx,[sc.work_text]
|
||||||
|
or ecx,0x40000000
|
||||||
|
mov edi,[sc.work]
|
||||||
mov edx,text1
|
mov edx,text1
|
||||||
cmp [vmode],0
|
cmp [vmode],0
|
||||||
je .kern
|
je .kern
|
||||||
mov edx,text2
|
mov edx,text2
|
||||||
.kern:
|
.kern:
|
||||||
|
push ebx ecx edx
|
||||||
|
mcall 9,procinfo,-1
|
||||||
|
mov eax,[ebx+42]
|
||||||
|
xor edx,edx
|
||||||
|
mov ebx,6
|
||||||
|
div ebx
|
||||||
|
pop edx ecx ebx
|
||||||
mov esi,80
|
mov esi,80
|
||||||
|
cmp eax,esi
|
||||||
|
ja @f
|
||||||
|
mov esi,eax
|
||||||
|
@@:
|
||||||
|
cmp esi,5
|
||||||
|
ja @f
|
||||||
|
mov esi,5
|
||||||
|
@@:
|
||||||
|
sub esi,4
|
||||||
mov eax,4
|
mov eax,4
|
||||||
newline:
|
newline:
|
||||||
mcall
|
mcall
|
||||||
add ebx,10
|
add ebx,10
|
||||||
add edx,80
|
add edx,80
|
||||||
cmp [edx],byte 'x'
|
cmp [edx],byte 'x'
|
||||||
jne newline
|
jne newline
|
||||||
mov eax,12 ; function 12:tell os about windowdraw
|
|
||||||
mov ebx,2 ; 2, end of draw
|
|
||||||
mcall
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
if WRITE_LOG
|
if WRITE_LOG
|
||||||
;********************************************
|
;********************************************
|
||||||
;* input: esi = pointer to the file name *
|
;* input: esi = pointer to the file name *
|
||||||
@ -274,21 +256,21 @@ if WRITE_LOG
|
|||||||
|
|
||||||
CreateFile:
|
CreateFile:
|
||||||
pusha
|
pusha
|
||||||
mov dword [InfoStructure], 2 ; create file
|
mov dword [InfoStructure],2 ; create file
|
||||||
mov dword [InfoStructure+4], 0 ; reserved
|
mov dword [InfoStructure+4],0 ; reserved
|
||||||
mov dword [InfoStructure+8], 0 ; reserved
|
mov dword [InfoStructure+8],0 ; reserved
|
||||||
mov dword [InfoStructure+12], 0 ; 0 bytes to write (just create)
|
mov dword [InfoStructure+12],0 ; 0 bytes to write (just create)
|
||||||
mov dword [InfoStructure+16], 0 ; NULL data pointer (no data)
|
mov dword [InfoStructure+16],0 ; NULL data pointer (no data)
|
||||||
mov dword [InfoStructure+20], 0 ; reserved
|
mov dword [InfoStructure+20],0 ; reserved
|
||||||
mov dword [InfoStructure+21], esi ; pointer to the file name
|
mov dword [InfoStructure+21],esi ; pointer to the file name
|
||||||
mcall 70, InfoStructure
|
mcall 70, InfoStructure
|
||||||
test eax, eax
|
test eax,eax
|
||||||
jz .out
|
jz .out
|
||||||
stc
|
stc
|
||||||
.out:
|
.out:
|
||||||
popa
|
popa
|
||||||
ret
|
ret
|
||||||
|
;------------------------------------------------
|
||||||
;********************************************
|
;********************************************
|
||||||
;* input: esi = pointer to the file name *
|
;* input: esi = pointer to the file name *
|
||||||
;* edx = pointer to data buffer *
|
;* edx = pointer to data buffer *
|
||||||
@ -297,24 +279,23 @@ CreateFile:
|
|||||||
|
|
||||||
WriteToFile:
|
WriteToFile:
|
||||||
push ebx
|
push ebx
|
||||||
mov dword [InfoStructure], 3 ; write to file
|
mov dword [InfoStructure],3 ; write to file
|
||||||
mov eax, [filepos]
|
mov eax, [filepos]
|
||||||
mov dword [InfoStructure+4], eax ; lower position addr
|
mov dword [InfoStructure+4],eax ; lower position addr
|
||||||
mov dword [InfoStructure+8], 0 ; upper position addr (0 for FAT)
|
mov dword [InfoStructure+8],0 ; upper position addr (0 for FAT)
|
||||||
mov dword [InfoStructure+12], ecx ; number of bytes to write
|
mov dword [InfoStructure+12],ecx ; number of bytes to write
|
||||||
mov dword [InfoStructure+16], edx ; pointer to data buffer
|
mov dword [InfoStructure+16],edx ; pointer to data buffer
|
||||||
mov dword [InfoStructure+20], 0 ; reserved
|
mov dword [InfoStructure+20],0 ; reserved
|
||||||
mov dword [InfoStructure+21], esi ; pointer to the file name
|
mov dword [InfoStructure+21],esi ; pointer to the file name
|
||||||
mcall 70, InfoStructure
|
mcall 70, InfoStructure
|
||||||
clc
|
clc
|
||||||
test eax, eax
|
test eax,eax
|
||||||
jz .out
|
jz .out
|
||||||
stc
|
stc
|
||||||
.out:
|
.out:
|
||||||
pop ebx
|
pop ebx
|
||||||
ret
|
ret
|
||||||
|
;--------------------------------------------------
|
||||||
|
|
||||||
InfoStructure:
|
InfoStructure:
|
||||||
dd 0x0 ; subfunction number
|
dd 0x0 ; subfunction number
|
||||||
dd 0x0 ; position in the file in bytes
|
dd 0x0 ; position in the file in bytes
|
||||||
@ -328,10 +309,7 @@ filepos dd 0
|
|||||||
default_filename db '/sys/boardlog.txt',0
|
default_filename db '/sys/boardlog.txt',0
|
||||||
tmp db 0
|
tmp db 0
|
||||||
end if
|
end if
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
krnl_msg db 'K : '
|
krnl_msg db 'K : '
|
||||||
duk db 'KernUser'
|
duk db 'KernUser'
|
||||||
|
|
||||||
@ -346,27 +324,37 @@ else if lang eq en
|
|||||||
else
|
else
|
||||||
title db 'Allgemeines debug- & nachrichtenboard',0
|
title db 'Allgemeines debug- & nachrichtenboard',0
|
||||||
end if
|
end if
|
||||||
krnl_cnt dd 0
|
krnl_cnt dd 0
|
||||||
vmode dd 1
|
vmode dd 1
|
||||||
targ dd text2
|
targ dd text2
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
I_END:
|
I_END:
|
||||||
offs dd ?
|
;------------------------------------------------------------------------------
|
||||||
flag rb 1
|
offs dd ?
|
||||||
|
flag rb 1
|
||||||
rd 2
|
rd 2
|
||||||
; x1pos dd ?
|
;x1pos dd ?
|
||||||
; y1pos dd ?
|
;y1pos dd ?
|
||||||
text1 rb 80*(MAXSTRINGS+1)
|
text1 rb 80*(MAXSTRINGS+1)
|
||||||
tmp1 db ?
|
tmp1 db ?
|
||||||
rd 2
|
rd 2
|
||||||
; x2pos dd ?
|
;x2pos dd ?
|
||||||
; y2pos dd ?
|
;y2pos dd ?
|
||||||
text2 rb 80*(MAXSTRINGS+1)
|
text2 rb 80*(MAXSTRINGS+1)
|
||||||
tmp2 db ?
|
tmp2 db ?
|
||||||
xstart dd ?
|
xstart dd ?
|
||||||
sc system_colors
|
|
||||||
|
sc system_colors
|
||||||
|
|
||||||
i_end:
|
i_end:
|
||||||
|
|
||||||
filename rb 256
|
filename rb 256
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
|
align 4
|
||||||
|
procinfo:
|
||||||
|
rb 1024
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
align 4
|
align 4
|
||||||
stackbuf rb 2000h
|
stackbuf rb 2000h
|
||||||
|
;------------------------------------------------------------------------------
|
||||||
mem:
|
mem:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix en >lang.inc
|
@echo lang fix en >lang.inc
|
||||||
@fasm board.asm board
|
@fasm board.asm board
|
||||||
|
@kpack board
|
||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
@ -1,5 +1,6 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix ge >lang.inc
|
@echo lang fix ge >lang.inc
|
||||||
@fasm board.asm board
|
@fasm board.asm board
|
||||||
|
@kpack board
|
||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
@ -1,5 +1,6 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix ru >lang.inc
|
@echo lang fix ru >lang.inc
|
||||||
@fasm board.asm board
|
@fasm board.asm board
|
||||||
|
@kpack board
|
||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
Loading…
Reference in New Issue
Block a user