fix button [width & height & y pos]

"kernel" style code

git-svn-id: svn://kolibrios.org@4977 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Akyltist 2014-06-17 14:12:56 +00:00
parent 0923c62681
commit dd6485818f

View File

@ -1,33 +1,30 @@
;
;------------------------------------------------------------------------------
; DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT
;
; See f63
;
; Compile with FASM for KolibriOS
;
;------------------------------------------------------------------------------
include 'lang.inc'
WRITE_LOG equ 1
P_LEN equ 11
include 'lang.inc'
;------------------------------------------------------------------------------
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd mem ; memory for app
dd mem ; esp
dd filename , 0x0 ; I_Param , I_Icon
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd mem
dd mem
dd filename, 0x0
;------------------------------------------------------------------------------
include '../../../macros.inc'
include '../../../debug.inc'
purge newline
MAXSTRINGS = 16
TMP = 80*(MAXSTRINGS+1)
;------------------------------------------------------------------------------
START: ; start of execution
START:
call CheckUnique
mov edi, filename
cmp [edi], byte 0
jnz param
@ -38,13 +35,6 @@ START: ; start of execution
test al,al
jnz @b
param:
; allow user to see messages written before start
; mov ecx,4096
;flush:
; mcall 63,2
; loop flush
mov ecx, TMP
xor eax, eax
mov edi, [targ]
@ -58,7 +48,7 @@ param:
sub eax, 399 shl 16
add eax, 399
mov [xstart], eax
mcall 48,3,sc,sizeof.system_colors
mcall 48, 3, sc, sizeof.sys_colors_new
mov esi, filename
call CreateFile
@ -93,7 +83,6 @@ new_data:
movzx ebx, byte[buffer_length]
mov [ebx+tmp], al
inc [buffer_length]
mov ebp, [targ]
.no4:
cmp al, 13
@ -211,9 +200,8 @@ add_char:
ret
;------------------------------------------------------------------------------
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
;************************ WINDOW DEFINITIONS AND DRAW ************************
;------------------------------------------------------------------------------
draw_window:
mcall 12, 1 ; 1, start of draw
mcall 48, 5 ; GetClientTop
@ -222,26 +210,23 @@ draw_window:
shl ecx, 16
add ecx, MAXSTRINGS*10+45 ; [y start] *65536 + [y size]
xor eax, eax ; function 0 : define and draw window
; mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
mov edx, 0xffffff
or edx, 0x14000000
xor esi, esi
mcall ,[xstart],,,,title
mov ebx,296 shl 16+5*6
mcall 8,,<5,12>,3,[sc.work]
mov ebx, 296 shl 16+31
mcall 8,,<4,13>,3,[sc.btn_face]
mov edx, [vmode]
lea edx, [edx*4+duk]
mcall 4,<300,8>,,,4
mcall 4,<300,7>,,,4
call draw_text
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]
xor ecx, ecx
or ecx, 0x40000000
; mov edi,[sc.work]
mov edi, 0xffffff
mov edx, text1
cmp [vmode], 0
@ -273,16 +258,15 @@ newline:
cmp [edx], byte 'x'
jne newline
ret
;------------------------------------------------------------------------------
;********************************************
;* input: esi = pointer to the file name *
;********************************************
;------------------------------------------------------------------------------
;* input: esi = pointer to the file name *
;------------------------------------------------------------------------------
CreateFile:
pusha
mov dword [InfoStructure],2 ; create file
mov dword [InfoStructure+4],0 ; reserved
mov dword [InfoStructure+8],0 ; reserved
mov dword [InfoStructure+00], 2 ; create file
mov dword [InfoStructure+04], 0 ; reserved
mov dword [InfoStructure+08], 0 ; reserved
mov dword [InfoStructure+12], 0 ; 0 bytes to write (just create)
mov dword [InfoStructure+16], 0 ; NULL data pointer (no data)
mov dword [InfoStructure+20], 0 ; reserved
@ -294,19 +278,17 @@ CreateFile:
.out:
popa
ret
;------------------------------------------------
;********************************************
;------------------------------------------------------------------------------
;* input: esi = pointer to the file name *
;* edx = pointer to data buffer *
;* ecx = data length *
;********************************************
;------------------------------------------------------------------------------
WriteToFile:
push ebx
mov dword [InfoStructure],3 ; write to file
mov dword [InfoStructure+00], 3 ; write to file
mov eax, [filepos]
mov dword [InfoStructure+4],eax ; lower position addr
mov dword [InfoStructure+8],0 ; upper position addr (0 for FAT)
mov dword [InfoStructure+04], eax ; lower position addr
mov dword [InfoStructure+08], 0 ; upper position addr (0 for FAT)
mov dword [InfoStructure+12], ecx ; number of bytes to write
mov dword [InfoStructure+16], edx ; pointer to data buffer
mov dword [InfoStructure+20], 0 ; reserved
@ -320,12 +302,11 @@ WriteToFile:
pop ebx
ret
;-------------------------------------------------
;********************************************
;------------------------------------------------------------------------------
;* input: esi = pointer to string *
;* edi = pointer to string *
;* ecx = data length *
;********************************************
;------------------------------------------------------------------------------
StrCmp:
repe cmpsb
ja .a_greater_b
@ -341,11 +322,10 @@ StrCmp:
.end:
ret
;-------------------------------------------------
;********************************************
;------------------------------------------------------------------------------
;* input: edi = pointer to string *
;* ecx = data length *
;********************************************
;------------------------------------------------------------------------------
; 'a' - 'A' = 32 -> 'A'|32 = 'a'
ToLower:
xor eax, eax
@ -356,20 +336,19 @@ ToLower:
.end:
ret
;-------------------------------------------------
;------------------------------------------------------------------------------
;* get info on current thread, save pid/tid
;* look for another process with same name and different pid/tid
;* if found, close self
;* else continue normally
;------------------------------------------------------------------------------
CheckUnique:
;get info on current thread, save pid/tid
;look for another process with same name and different pid/tid
;if found, close self
;else continue normally
.get_thread_info:
mov ebx, procinfo
mov ecx, -1
mcall 9
.get_pid:
; check_buffer
.get_pid: ; check_buffer
mov [process_count], eax
mov eax, [ebx+process_information.PID]
mov [pid_tid], eax
@ -394,15 +373,13 @@ CheckUnique:
lea edi, [ebx+process_information.process_name]
push ecx
mov ecx, my_name_size-1
.lower_case:
call ToLower
lea esi, [my_name]
mov ecx, my_name_size
call StrCmp
pop ecx
cmp eax, 0
je .close_program
@ -411,7 +388,8 @@ CheckUnique:
jmp .check_threads
.close_program:
mcall 18,3 ; restore and active window of previous thread
; restore and active window of previous thread
mcall 18, 3
mov eax, -1
mcall
@ -419,27 +397,21 @@ CheckUnique:
ret
;--------------------------------------------------
;------------------------------------------------------------------------------
;*********************************** DATA ************************************
;------------------------------------------------------------------------------
align 4
InfoStructure:
dd 0x0 ; subfunction number
dd 0x0 ; position in the file in bytes
dd 0x0 ; upper part of the position address
dd 0x0 ; number of bytes to read
dd 0x0 ; pointer to the buffer to write data
db 0
dd 0 ; pointer to the filename
filepos dd 0
db 0x0
dd 0x0 ; pointer to the filename
filepos dd 0x0
default_filename db '/sys/boardlog.txt',0
;------------------------------------------------------------------------------
krnl_msg db 'K : '
duk db 'KernUser'
; DATA AREA
; 11,11 > 0,-1
; 5,11 > 0,-1
if lang eq ru
title db '„®áª  ®â« ¤ª¨ ¨ á®®¡é¥­¨©',0
else if lang eq it
@ -449,10 +421,12 @@ else if lang eq ge
else
title db 'General debug & message board',0
end if
;------------------------------------------------------------------------------
krnl_msg db 'K : '
duk db 'KernUser'
krnl_cnt dd 0
vmode dd 1
targ dd text2
my_name db 'board',0
my_name_size = $-my_name
process_count dd 0x0
@ -463,24 +437,17 @@ I_END:
offs dd ?
flag rb 1
rd 2
;x1pos dd ?
;y1pos dd ?
text1 rb 80*(MAXSTRINGS+1)
tmp1 db ?
rd 2
;x2pos dd ?
;y2pos dd ?
text2 rb 80*(MAXSTRINGS+1)
tmp2 db ?
xstart dd ?
sc system_colors
sc sys_colors_new
i_end:
buffer_length rb 1
;------------------------------------------------------------------------------
tmp rb 256
;------------------------------------------------------------------------------
filename rb 256
;------------------------------------------------------------------------------
align 4