Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2234 → Rev 2233

/programs/system/board/trunk/board.asm
23,10 → 23,10
purge newline
MAXSTRINGS = 16
TMP = 80*(MAXSTRINGS+1)
;------------------------------------------------------------------------------
 
START: ; start of execution
mov edi,filename
cmp [edi],byte 0
cmp byte [edi], 0
jnz param
mov esi,default_filename
@@:
39,7 → 39,9
; allow user to see messages written before start
; mov ecx,4096
;flush:
; mcall 63,2
; mov eax,63
; mov ebx,2
; mcall
; loop flush
mov ecx,TMP
50,32 → 52,43
mov [tmp1],'x'
mov [tmp2],'x'
mcall 14
mov eax,14
mcall
and eax,0xffff0000
sub eax,399 shl 16
add eax,399
mov [xstart],eax
mcall 48,3,sc,sizeof.system_colors
 
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
mcall
if WRITE_LOG
mov esi,filename
call CreateFile
end if
;------------------------------------------------------------------------------
 
red:
call draw_window
;------------------------------------------------------------------------------
 
still:
mcall 23,1 ; wait here for event
 
mov eax,23 ; wait here for event
mov ebx,1
mcall
 
cmp eax,1 ; redraw request ?
je red
 
cmp eax,2 ; key in buffer ?
je key
 
cmp eax,3 ; button in buffer ?
je button
 
mcall 63,2
mov eax,63
mov ebx,2
mcall
 
cmp ebx,1
jne still
 
98,21 → 111,21
inc [filepos]
popa
end if
 
mov ebp,[targ]
.no4:
cmp al,13
jne no13
and [ebp-8],dword 0
and dword[ebp-8],0
jmp new_check
;------------------------------------------
no13:
cmp al,10
jne no10
and [ebp-8],dword 0
and dword[ebp-8],0
inc dword [ebp-4]
cmp [ebp-4],dword MAXSTRINGS
cmp dword[ebp-4],MAXSTRINGS
jbe .noypos
mov [ebp-4],dword MAXSTRINGS
mov dword[ebp-4],MAXSTRINGS
lea esi,[ebp+80]
mov edi,ebp
mov ecx,80*(MAXSTRINGS)
130,7 → 143,6
mov [targ],text2
and [krnl_cnt],0
jmp new_check
;------------------------------------------
no10:
cmp ebp,text1
je add2
157,28 → 169,38
call add_char
 
new_check:
mcall 63,2
 
mov eax,63
mov ebx,2
mcall
 
cmp ebx,1
je new_data
call draw_text
 
call draw_window
 
jmp still
;------------------------------------------------------------------------------
key:
mcall 2
 
key: ; key
mov al,2 ; just read it and ignore
mcall
cmp ah,' '
je button.noclose
jmp still
;------------------------------------------------------------------------------
button:
mcall 17 ; get id
 
button: ; button
mov al,17 ; get id
mcall
 
cmp ah,1 ; button id=1 ?
jne .noclose
 
or eax,-1 ; close this program
mcall
.noclose:
xor [vmode],1
jmp red
;------------------------------------------------------------------------------
 
add_char:
push esi
mov esi,[ebp-4]
192,54 → 214,45
.ok:
pop esi
ret
;------------------------------------------------------------------------------
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
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
; mov ebx,50*65536+400 ; [x start] *65536 + [x size]
mov ebx,[xstart]
mov ecx,MAXSTRINGS*10+45 ; [y start] *65536 + [y size]
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
or edx,0x13000000
xor esi,esi
mcall ,[xstart],,,,title
mov edi,title ; WINDOW LABEL
mcall
 
mov ecx,4
mov esi,[sc.work]
mov ebx,296 shl 16+5*6
mcall 8,,<5,12>,3,[sc.work]
mov edx,3;+1 shl 30
mcall 8,,<5,12>
mov edx,[vmode]
lea edx,[edx*4+duk]
mcall 4,<300,8>,,,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 ebx,15*65536+33 ; draw info text with function 4
mov ecx,[sc.work_text]
or ecx,0x40000000
mov edi,[sc.work]
mov edx,text1
cmp [vmode],0
je .kern
mov edx,text2
.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
cmp eax,esi
ja @f
mov esi,eax
@@:
cmp esi,5
ja @f
mov esi,5
@@:
sub esi,4
mov eax,4
newline:
mcall
247,8 → 260,13
add edx,80
cmp [edx],byte 'x'
jne newline
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret
;------------------------------------------------------------------------------
 
 
if WRITE_LOG
;********************************************
;* input: esi = pointer to the file name *
270,7 → 288,7
.out:
popa
ret
;------------------------------------------------
 
;********************************************
;* input: esi = pointer to the file name *
;* edx = pointer to data buffer *
295,7 → 313,8
.out:
pop ebx
ret
;--------------------------------------------------
 
 
InfoStructure:
dd 0x0 ; subfunction number
dd 0x0 ; position in the file in bytes
309,7 → 328,10
default_filename db '/sys/boardlog.txt',0
tmp db 0
end if
;------------------------------------------------------------------------------
 
 
 
 
krnl_msg db 'K : '
duk db 'KernUser'
 
327,9 → 349,7
krnl_cnt dd 0
vmode dd 1
targ dd text2
;------------------------------------------------------------------------------
I_END:
;------------------------------------------------------------------------------
offs dd ?
flag rb 1
rd 2
343,18 → 363,10
text2 rb 80*(MAXSTRINGS+1)
tmp2 db ?
xstart dd ?
 
sc system_colors
 
i_end:
 
filename rb 256
;------------------------------------------------------------------------------
align 4
procinfo:
rb 1024
;------------------------------------------------------------------------------
align 4
stackbuf rb 2000h
;------------------------------------------------------------------------------
mem:
/programs/system/board/trunk/build_en.bat
1,6 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm board.asm board
@kpack board
@erase lang.inc
@pause
/programs/system/board/trunk/build_ge.bat
1,6 → 1,5
@erase lang.inc
@echo lang fix ge >lang.inc
@fasm board.asm board
@kpack board
@erase lang.inc
@pause
/programs/system/board/trunk/build_ru.bat
1,6 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm board.asm board
@kpack board
@erase lang.inc
@pause