1) changed version of a kernel - 0581
2) menu now uses the function 70
These changes will be in Kolibri 0581 (or beta2)

git-svn-id: svn://kolibrios.org@97 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2006-07-10 20:26:50 +00:00
parent 0727181583
commit 400f8f145d
3 changed files with 113 additions and 122 deletions

View File

@ -73,7 +73,7 @@ drawbar dd __sys_drawbar
putpixel dd __sys_putpixel putpixel dd __sys_putpixel
; } mike.dld ; } mike.dld
version db 'Kolibri OS version 0.5.3.1 ',13,10,13,10,0 version db 'Kolibri OS version 0.5.8.1 ',13,10,13,10,0
;dd endofcode-0x10000 ;dd endofcode-0x10000
;db 'Boot02' ;db 'Boot02'
@ -2324,7 +2324,7 @@ endg
iglobal iglobal
version_inf: version_inf:
db 0,5,3,1 ; version 0.5.3.1 db 0,5,8,1 ; version 0.5.8.1
db UID_KOLIBRI db UID_KOLIBRI
db 'Kolibri',0 db 'Kolibri',0
version_end: version_end:

View File

@ -11,30 +11,33 @@
TXT_Y = (BTN_HEIGHT)/2-5 TXT_Y = (BTN_HEIGHT)/2-5
use32 use32
org 0x0 org 0x0
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
dd 0x01 ; header version dd 0x01 ; header version
dd START ; start of code dd START ; start of code
dd I_END ; size of image dd I_END ; size of image
dd 0x20000 ; memory for app dd 0x20000 ; memory for app
dd 0x20000-1 ; esp dd 0x20000-1 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon dd 0x0 , 0x0 ; I_Param , I_Icon
;****************************************************************************** ;******************************************************************************
;include "DEBUG.INC" ; debug macros ;include "DEBUG.INC" ; debug macros
START: ; start of execution START: ; start of execution
mov eax, 48 ; load system colors mov eax, 48 ; load system colors
mov ebx, 3 mov ebx, 3
mov ecx, sc mov ecx, sc
mov edx, sizeof.system_colors mov edx, sizeof.system_colors
int 0x40 int 0x40
mov eax, 58 ; load MENU.DAT mov eax, 70 ; load MENU.DAT
mov ebx, fileinfo mov ebx, fileinfo
int 0x40 int 0x40
test eax, eax ; error ? test eax, eax ; error ?
jz @f
cmp eax,6
jnz close jnz close
test ebx, ebx ; length = 0 ? @@:
test ebx, ebx ; length = 0 ?
jz close jz close
mov ecx, ebx mov ecx, ebx
mov edi, mem_end mov edi, mem_end
@ -42,7 +45,7 @@ START: ; start of execution
mov al, '#' mov al, '#'
cld cld
repne scasb repne scasb
test ecx, ecx ; if not found test ecx, ecx ; if not found
jz close jz close
call get_number call get_number
test ebx, ebx test ebx, ebx
@ -51,7 +54,7 @@ START: ; start of execution
je search_end je search_end
.number: .number:
shl ebx, 4 shl ebx, 4
add ebx, menu_data ; pointer to process table add ebx, menu_data ; pointer to process table
mov [ebx], edi mov [ebx], edi
inc [processes] inc [processes]
jmp newsearch jmp newsearch
@ -88,7 +91,7 @@ START: ; start of execution
mov eax, 14 mov eax, 14
int 0x40 int 0x40
sub ax, 20 sub ax, 20
mov [menu_data + y_end], ax mov [menu_data + y_end], ax
mov [menu_data + x_start], 5 mov [menu_data + x_start], 5
mov al, [menu_data + rows] mov al, [menu_data + rows]
mov [menu_data + cur_sel], al ; clear selection mov [menu_data + cur_sel], al ; clear selection
@ -96,48 +99,48 @@ START: ; start of execution
mov [buffer], 0 mov [buffer], 0
thread: thread:
mov eax, [buffer] ; identifier mov eax, [buffer] ; identifier
shl eax, 4 shl eax, 4
add eax, menu_data add eax, menu_data
mov edi, eax mov edi, eax
mov eax, 40 ; set event mask mov eax, 40 ; set event mask
mov ebx, 100111b ; mouse + button + key + redraw mov ebx, 100111b ; mouse + button + key + redraw
int 0x40 int 0x40
call draw_window call draw_window
still: still:
mov eax, 23 ; wait here for event mov eax, 23 ; wait here for event
mov ebx, 5 mov ebx, 5
int 0x40 int 0x40
test [close_now], 1 ; is close flag set? test [close_now], 1 ; is close flag set?
jnz close jnz close
cmp eax, 1 ; redraw request ? cmp eax, 1 ; redraw request ?
je red je red
cmp eax, 2 ; key pressed ? cmp eax, 2 ; key pressed ?
je key je key
cmp eax, 3 ; button in buffer ? cmp eax, 3 ; button in buffer ?
je button je button
cmp eax, 6 ; mouse event ? cmp eax, 6 ; mouse event ?
je mouse je mouse
cmp edi, menu_data cmp edi, menu_data
je still ; if main process-ignored je still ; if main process-ignored
movzx ebx, [edi + parent] ; parent id movzx ebx, [edi + parent] ; parent id
shl ebx, 4 shl ebx, 4
add ebx, menu_data ; ebx = base of parent info add ebx, menu_data ; ebx = base of parent info
call backconvert ; get my id in al call backconvert ; get my id in al
cmp al, [ebx + child] ; if I'm not child of my parent, I shall die :) cmp al, [ebx + child] ; if I'm not child of my parent, I shall die :)
jne close jne close
jmp still jmp still
red: ; redraw red: ; redraw
call draw_window call draw_window
jmp still jmp still
@ -146,9 +149,9 @@ still:
; mov eax, 2 ; mov eax, 2
int 0x40 int 0x40
mov al, [edi + rows] ; number of buttons mov al, [edi + rows] ; number of buttons
cmp ah, 178 ; KEY_UP cmp ah, 178 ; KEY_UP
jne .noup jne .noup
mov ah, [edi+cur_sel] mov ah, [edi+cur_sel]
@ -160,7 +163,7 @@ still:
.noup: .noup:
cmp ah, 177 ; KEY_DOWN cmp ah, 177 ; KEY_DOWN
jne .nodn jne .nodn
mov ah, [edi + cur_sel] mov ah, [edi + cur_sel]
@ -172,20 +175,20 @@ still:
jmp redrawbut jmp redrawbut
.nodn: .nodn:
cmp ah, 13 ; ENTER cmp ah, 13 ; ENTER
jne .noenter jne .noenter
mov ah, [edi + cur_sel] mov ah, [edi + cur_sel]
jmp button1 jmp button1
.noenter: .noenter:
cmp ah, 27 ; ESC cmp ah, 27 ; ESC
jne still jne still
jmp close jmp close
; include "DEBUG.INC" ; include "DEBUG.INC"
button: ; BUTTON HANDLER button: ; BUTTON HANDLER
mov eax, 17 ; get id mov eax, 17 ; get id
int 0x40 int 0x40
button1: button1:
@ -215,44 +218,29 @@ still:
mov al, '/' mov al, '/'
cld cld
repne scasb repne scasb
test ecx, ecx ; if '/' not found test ecx, ecx ; if '/' not found
je searchexit je searchexit
cmp [edi], byte '@' ; check for submenu cmp [edi], byte '@' ; check for submenu
je runthread je runthread
dec edi dec edi
push edi ; pointer to start of filename push edi ; pointer to start of filename
call searchstartstring ; search for next string call searchstartstring ; search for next string
sub edi, 2 ; to last byte of string sub edi, 2 ; to last byte of string
mov ecx, edi mov ecx, edi
pop esi pop esi
sub ecx, esi sub ecx, esi
inc ecx ; length of filename inc ecx ; length of filename
mov edi, fileinfo_start.name mov edi, fileinfo_start.name
rep movsb ; copy string rep movsb ; copy string
mov byte [edi], 0 ; store terminator mov byte [edi], 0 ; store terminator
mov eax, 70 ; start program
; mov eax,fileinfo_start.name
; cmp eax,'/rd/'
; jne run_hd
; mov ebx,fileinfo_start.name+6
; mov eax,19
; xor ecx,ecx
; jmp run_for_all
;run_hd:
mov eax, 58 ; start program
mov ebx, fileinfo_start mov ebx, fileinfo_start
;run_for_all:
int 0x40 int 0x40
mcall 5,100 ; mcall 5,100
; mov eax,5 or [close_now], 1 ; set close flag
; mov ebx,100
; int 0x40
or [close_now], 1 ; set close flag
pop edi pop edi
mov [mousemask], 0 mov [mousemask], 0
jmp close jmp close
@ -266,38 +254,38 @@ still:
inc edi inc edi
push eax push eax
call get_number ; get number of this process call get_number ; get number of this process
pop eax pop eax
test ebx, ebx ; returned zero - main menu or not number test ebx, ebx ; returned zero - main menu or not number
jz searchexit jz searchexit
mov al, bl mov al, bl
mov ebx, [processes] mov ebx, [processes]
dec bl dec bl
cmp al, bl cmp al, bl
ja searchexit ; such process doesnt exist ja searchexit ; such process doesnt exist
cmp al, [esi + child] cmp al, [esi + child]
je searchexit ; such process already exists je searchexit ; such process already exists
mov [esi + child], al ; this is my child mov [esi + child], al ; this is my child
mov cx, [esi + x_start] mov cx, [esi + x_start]
add cx, 141 ; new x_start in cx add cx, 141 ; new x_start in cx
movzx edx, al movzx edx, al
shl edx, 4 shl edx, 4
add edx, menu_data ; edx points to child's base address add edx, menu_data ; edx points to child's base address
mov [edx + x_start], cx ; xstart for new thread mov [edx + x_start], cx ; xstart for new thread
mov cx, [esi + y_end] ; y_end in cx mov cx, [esi + y_end] ; y_end in cx
mov bl, [esi + rows] ; number of buttons in bl mov bl, [esi + rows] ; number of buttons in bl
sub bl, ah ; number of btn from bottom sub bl, ah ; number of btn from bottom
movzx eax, al movzx eax, al
mov [buffer], eax ; thread id in buffer mov [buffer], eax ; thread id in buffer
movzx ebx, bl movzx ebx, bl
push edx push edx
mov eax, BTN_HEIGHT mov eax, BTN_HEIGHT
mul ebx mul ebx
sub cx, ax ; new y_end for new thread sub cx, ax ; new y_end for new thread
pop edx pop edx
mov [edx + y_end], cx ; store y_end mov [edx + y_end], cx ; store y_end
mov edi, esi mov edi, esi
@ -310,7 +298,7 @@ still:
cmp [thread_stack], 0x1e000 cmp [thread_stack], 0x1e000
jne thread_stack_not_full jne thread_stack_not_full
mov [thread_stack], 0xc000 mov [thread_stack], 0xE000
thread_stack_not_full: thread_stack_not_full:
add [thread_stack], 0x2000 ; start new thread add [thread_stack], 0x2000 ; start new thread
@ -323,30 +311,30 @@ thread_stack_not_full:
jmp searchexit jmp searchexit
mouse: ; MOUSE EVENT HANDLER mouse: ; MOUSE EVENT HANDLER
mov eax, 37 mov eax, 37
mov ebx, 2 mov ebx, 2
int 0x40 int 0x40
test eax, eax ; check buttons state test eax, eax ; check buttons state
jnz click jnz click
mov eax, 37 mov eax, 37
mov ebx, 1 mov ebx, 1
int 0x40 int 0x40
ror eax, 16 ; eax = [ Y | X ] relative to window ror eax, 16 ; eax = [ Y | X ] relative to window
cmp ax, 140 ; pointer in window? cmp ax, 140 ; pointer in window?
ja noinwindow ja noinwindow
;  in window  ;  in window 
shr eax, 16 ; eax = [ 0 | Y ] shr eax, 16 ; eax = [ 0 | Y ]
xor edx, edx xor edx, edx
mov ebx, BTN_HEIGHT mov ebx, BTN_HEIGHT
div ebx div ebx
inc eax ; number of "button" in eax inc eax ; number of "button" in eax
movzx ebx, [edi + rows] ; total strings in ebx movzx ebx, [edi + rows] ; total strings in ebx
cmp eax, ebx cmp eax, ebx
ja noinwindow ja noinwindow
cmp [edi + cur_sel], al cmp [edi + cur_sel], al
je noredrawbut je noredrawbut
mov bl, [edi + cur_sel] mov bl, [edi + cur_sel]
;;;;;; ;;;;;;
@ -368,17 +356,17 @@ thread_stack_not_full:
jmp still jmp still
click: click:
cmp [mousemask], 0 ; not in a window (i.e. menu) cmp [mousemask], 0 ; not in a window (i.e. menu)
je close je close
jmp still jmp still
close: close:
or eax, -1 ; close this thread or eax, -1 ; close this thread
mov [edi + child], al ; my child is not mine mov [edi + child], al ; my child is not mine
int 0x40 int 0x40
backconvert: ; convert from pointer to process id backconvert: ; convert from pointer to process id
mov eax, edi mov eax, edi
sub eax, menu_data sub eax, menu_data
shr eax, 4 shr eax, 4
@ -399,9 +387,9 @@ thread_stack_not_full:
mov al, [edi] mov al, [edi]
inc edi inc edi
cmp al, '0' cmp al, '0'
jb .finish jb .finish
cmp al, '9' cmp al, '9'
ja .finish ja .finish
sub al, '0' sub al, '0'
imul ebx, 10 imul ebx, 10
add ebx, eax add ebx, eax
@ -419,23 +407,23 @@ thread_stack_not_full:
draw_window: draw_window:
mov eax, 12 ; function 12:tell os about windowdraw mov eax, 12 ; function 12:tell os about windowdraw
mov ebx, 1 ; 1, start of draw mov ebx, 1 ; 1, start of draw
int 0x40 int 0x40
movzx ebx, [edi + rows] movzx ebx, [edi + rows]
imul eax, ebx, BTN_HEIGHT ; eax = height of window imul eax, ebx, BTN_HEIGHT ; eax = height of window
movzx ecx, [edi + y_end] movzx ecx, [edi + y_end]
sub ecx, eax ; ecx = Y_START sub ecx, eax ; ecx = Y_START
shl ecx, 16 shl ecx, 16
add ecx, eax ; ecx = [ Y_START | Y_SIZE ] add ecx, eax ; ecx = [ Y_START | Y_SIZE ]
dec ecx dec ecx
movzx ebx, [edi + x_start] movzx ebx, [edi + x_start]
shl ebx, 16 shl ebx, 16
mov bx, 140 ; ebx = [ X_START | X_SIZE ] mov bx, 140 ; ebx = [ X_START | X_SIZE ]
xor eax, eax ; function 0 : define and draw window xor eax, eax ; function 0 : define and draw window
mov edx, 0x01000000 ; color of work area RRGGBB,8->color gl mov edx, 0x01000000 ; color of work area RRGGBB,8->color gl
mov esi, edx ; unmovable window mov esi, edx ; unmovable window
int 0x40 int 0x40
call draw_all_buttons call draw_all_buttons
@ -453,7 +441,7 @@ draw_window:
call draw_one_button call draw_one_button
inc edx inc edx
cmp dl, [edi + rows] cmp dl, [edi + rows]
jb .new_button jb .new_button
ret ret
@ -486,7 +474,7 @@ draw_window:
jne .nohighlight jne .nohighlight
add esi, 0x202020 add esi, 0x202020
.nohighlight: .nohighlight:
or edx, 0x20000000 or edx, 0x20000000
int 0x40 int 0x40
movzx edx, dl movzx edx, dl
@ -499,7 +487,7 @@ draw_window:
mov edx, [edi + pointer] mov edx, [edi + pointer]
.findline: .findline:
cmp byte [edx], 13 cmp byte [edx], 13
je .linefound je .linefound
inc edx inc edx
jmp .findline jmp .findline
.linefound: .linefound:
@ -530,24 +518,24 @@ draw_window:
;*** DATA AREA **************************************************************** ;*** DATA AREA ****************************************************************
thread_stack dd 0xc000 thread_stack dd 0xE000
processes dd 0 processes dd 0
fileinfo: fileinfo:
.mode dd 0 ; 0=READ .subfunction dd 0 ; 0=READ
.start_block dd 0x0 ; 512 block to read 0+ .start dd 0 ; start byte
.size dd (0x10000-mem_end)/512 ;0x80; blocks to read (0x10000 bytes max) .size_high dd 0 ; rezerved
.return dd mem_end ; return data pointer .size dd 0x10000-mem_end ; blocks to read
.work dd workarea ; work area for os - 16384 bytes .return dd mem_end ; return data pointer
.name: .name:
db '/RD/1/MENU.DAT',0 ; ASCIIZ dir & filename db '/RD/1/MENU.DAT',0 ; ASCIIZ dir & filename
fileinfo_start: fileinfo_start:
.mode dd 16 ; 16=START APPLICATION .subfunction dd 7 ; 7=START APPLICATION
.start_block dd 0x0 ; nop .flags dd 0 ; flags
.size dd 0x0 ; nop .params dd 0x0 ; nop
.return dd 0x0 ; nop .rezerved dd 0x0 ; nop
.work dd workarea ; work area for os - 16384 bytes .rezerved_1 dd 0x0 ; nop
.name: .name:
times 50 db ' ' times 50 db ' '
@ -555,7 +543,7 @@ I_END:
close_now dd ? ; close all processes immediately close_now dd ? ; close all processes immediately
end_pointer dd ? end_pointer dd ?
buffer dd ? buffer dd ?
mousemask dd ? ; mask for mouse pointer location mousemask dd ? ; mask for mouse pointer location
sc system_colors sc system_colors
@ -563,12 +551,9 @@ sc system_colors
menu_data: menu_data:
rb 0x4000 ;x10000 rb 0x4000 ;x10000
workarea:
rb 0x4000 ;0x10000
virtual at 0 ; PROCESSES TABLE (located at menu_data) virtual at 0 ; PROCESSES TABLE (located at menu_data)
pointer dd ? ; +0 pointer in file pointer dd ? ; +0 pointer in file
rows db ? ; +4 numer of strings rows db ? ; +4 numer of strings
x_start dw ? ; +5 x start x_start dw ? ; +5 x start
y_end dw ? ; +7 y end y_end dw ? ; +7 y end
child db ? ; +9 id of child menu child db ? ; +9 id of child menu

View File

@ -0,0 +1,6 @@
Changes:
11.07.06 - Mario79, application used function 70.
Earlier changes were made:
Ivan Poddubny, Mario79 and Halyavin