2006-01-03 10:43:31 +01:00
|
|
|
|
;******************************************************************************
|
|
|
|
|
; MAIN MENU by lisovin@26.ru
|
|
|
|
|
; Some parts of code rewritten by Ivan Poddubny <ivan-yar@bk.ru>
|
|
|
|
|
;
|
|
|
|
|
; Compile with FASM for Menuet
|
|
|
|
|
;******************************************************************************
|
|
|
|
|
include "lang.inc"
|
|
|
|
|
include "macros.inc"
|
|
|
|
|
|
|
|
|
|
BTN_HEIGHT = 22
|
|
|
|
|
TXT_Y = (BTN_HEIGHT)/2-5
|
|
|
|
|
|
|
|
|
|
use32
|
2006-07-10 22:26:50 +02:00
|
|
|
|
org 0x0
|
|
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
|
dd 0x01 ; header version
|
|
|
|
|
dd START ; start of code
|
|
|
|
|
dd I_END ; size of image
|
|
|
|
|
dd 0x20000 ; memory for app
|
|
|
|
|
dd 0x20000-1 ; esp
|
|
|
|
|
dd 0x0 , 0x0 ; I_Param , I_Icon
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;******************************************************************************
|
|
|
|
|
;include "DEBUG.INC" ; debug macros
|
2006-07-10 22:26:50 +02:00
|
|
|
|
START: ; start of execution
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov eax, 48 ; load system colors
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx, 3
|
|
|
|
|
mov ecx, sc
|
|
|
|
|
mov edx, sizeof.system_colors
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov eax, 70 ; load MENU.DAT
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx, fileinfo
|
|
|
|
|
int 0x40
|
2006-07-10 22:26:50 +02:00
|
|
|
|
test eax, eax ; error ?
|
|
|
|
|
jz @f
|
|
|
|
|
cmp eax,6
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jnz close
|
2006-07-10 22:26:50 +02:00
|
|
|
|
@@:
|
|
|
|
|
test ebx, ebx ; length = 0 ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jz close
|
|
|
|
|
mov ecx, ebx
|
|
|
|
|
mov edi, mem_end
|
|
|
|
|
newsearch:
|
|
|
|
|
mov al, '#'
|
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
2006-07-10 22:26:50 +02:00
|
|
|
|
test ecx, ecx ; if not found
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jz close
|
|
|
|
|
call get_number
|
|
|
|
|
test ebx, ebx
|
|
|
|
|
jnz .number
|
|
|
|
|
cmp al, '#'
|
|
|
|
|
je search_end
|
|
|
|
|
.number:
|
|
|
|
|
shl ebx, 4
|
2006-07-10 22:26:50 +02:00
|
|
|
|
add ebx, menu_data ; pointer to process table
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov [ebx], edi
|
|
|
|
|
inc [processes]
|
|
|
|
|
jmp newsearch
|
|
|
|
|
search_end:
|
|
|
|
|
mov [end_pointer], edi
|
|
|
|
|
mov ebx, [processes]
|
|
|
|
|
dec ebx
|
|
|
|
|
shl ebx, 4
|
|
|
|
|
add ebx, menu_data
|
|
|
|
|
newprocess:
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ecx, edi
|
|
|
|
|
sub ecx, [ebx]
|
|
|
|
|
mov al, 10
|
|
|
|
|
newsearch1:
|
|
|
|
|
std
|
|
|
|
|
repne scasb
|
|
|
|
|
test ecx, ecx
|
|
|
|
|
je endprocess
|
|
|
|
|
cmp [edi], byte 13
|
|
|
|
|
jne newsearch1
|
|
|
|
|
inc edx
|
|
|
|
|
jmp newsearch1
|
|
|
|
|
endprocess:
|
|
|
|
|
mov esi, ebx
|
|
|
|
|
add esi, 4
|
|
|
|
|
dec edx
|
|
|
|
|
mov [esi], dl
|
|
|
|
|
cmp ebx, menu_data
|
|
|
|
|
jbe search_end1
|
|
|
|
|
sub ebx, 16
|
|
|
|
|
jmp newprocess
|
|
|
|
|
search_end1:
|
|
|
|
|
mov eax, 14
|
|
|
|
|
int 0x40
|
|
|
|
|
sub ax, 20
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov [menu_data + y_end], ax
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov [menu_data + x_start], 5
|
|
|
|
|
mov al, [menu_data + rows]
|
|
|
|
|
mov [menu_data + cur_sel], al ; clear selection
|
|
|
|
|
mov [menu_data + prev_sel], al
|
|
|
|
|
|
|
|
|
|
mov [buffer], 0
|
|
|
|
|
thread:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov eax, [buffer] ; identifier
|
2006-01-03 10:43:31 +01:00
|
|
|
|
shl eax, 4
|
|
|
|
|
add eax, menu_data
|
|
|
|
|
mov edi, eax
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov eax, 40 ; set event mask
|
|
|
|
|
mov ebx, 100111b ; mouse + button + key + redraw
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
still:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov eax, 23 ; wait here for event
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx, 5
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
test [close_now], 1 ; is close flag set?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jnz close
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
cmp eax, 1 ; redraw request ?
|
|
|
|
|
je red
|
|
|
|
|
cmp eax, 2 ; key pressed ?
|
|
|
|
|
je key
|
|
|
|
|
cmp eax, 3 ; button in buffer ?
|
|
|
|
|
je button
|
|
|
|
|
cmp eax, 6 ; mouse event ?
|
|
|
|
|
je mouse
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
cmp edi, menu_data
|
2006-07-10 22:26:50 +02:00
|
|
|
|
je still ; if main process-ignored
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
movzx ebx, [edi + parent] ; parent id
|
|
|
|
|
shl ebx, 4
|
2006-07-10 22:26:50 +02:00
|
|
|
|
add ebx, menu_data ; ebx = base of parent info
|
|
|
|
|
call backconvert ; get my id in al
|
|
|
|
|
cmp al, [ebx + child] ; if I'm not child of my parent, I shall die :)
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne close
|
|
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
red: ; redraw
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call draw_window
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
key:
|
|
|
|
|
; mov eax, 2
|
|
|
|
|
int 0x40
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov al, [edi + rows] ; number of buttons
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
cmp ah, 178 ; KEY_UP
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne .noup
|
|
|
|
|
|
|
|
|
|
mov ah, [edi+cur_sel]
|
|
|
|
|
mov [edi+prev_sel], ah
|
|
|
|
|
dec byte [edi+cur_sel]
|
|
|
|
|
jnz redrawbut
|
|
|
|
|
mov [edi+cur_sel], al
|
|
|
|
|
jmp redrawbut
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.noup:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
cmp ah, 177 ; KEY_DOWN
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne .nodn
|
|
|
|
|
|
|
|
|
|
mov ah, [edi + cur_sel]
|
|
|
|
|
mov [edi + prev_sel], ah
|
|
|
|
|
inc [edi + cur_sel]
|
|
|
|
|
cmp [edi + cur_sel], al
|
|
|
|
|
jna redrawbut
|
|
|
|
|
mov [edi + cur_sel], 1
|
|
|
|
|
jmp redrawbut
|
|
|
|
|
|
|
|
|
|
.nodn:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
cmp ah, 13 ; ENTER
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne .noenter
|
|
|
|
|
mov ah, [edi + cur_sel]
|
|
|
|
|
jmp button1
|
|
|
|
|
|
|
|
|
|
.noenter:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
cmp ah, 27 ; ESC
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jne still
|
|
|
|
|
jmp close
|
|
|
|
|
|
|
|
|
|
; include "DEBUG.INC"
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
button: ; BUTTON HANDLER
|
|
|
|
|
mov eax, 17 ; get id
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
button1:
|
|
|
|
|
mov esi, edi
|
|
|
|
|
push edi
|
|
|
|
|
mov edi, [edi + pointer]
|
|
|
|
|
|
|
|
|
|
; print "hello"
|
|
|
|
|
mov al, [esi + cur_sel]
|
|
|
|
|
mov [esi + prev_sel], al
|
|
|
|
|
mov [esi + cur_sel], ah
|
|
|
|
|
pushad
|
|
|
|
|
mov edi, esi
|
|
|
|
|
; dph eax
|
|
|
|
|
call draw_only_needed_buttons
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
; look for the next line <ah> times; <ah> = button_id
|
|
|
|
|
push eax
|
|
|
|
|
.next_string:
|
|
|
|
|
call searchstartstring
|
|
|
|
|
dec ah
|
|
|
|
|
jnz .next_string
|
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
|
|
mov ecx, 40
|
|
|
|
|
mov al, '/'
|
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
2006-07-10 22:26:50 +02:00
|
|
|
|
test ecx, ecx ; if '/' not found
|
|
|
|
|
je searchexit
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
cmp [edi], byte '@' ; check for submenu
|
2006-07-10 22:26:50 +02:00
|
|
|
|
je runthread
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
dec edi
|
2006-07-10 22:26:50 +02:00
|
|
|
|
push edi ; pointer to start of filename
|
2006-01-03 10:43:31 +01:00
|
|
|
|
call searchstartstring ; search for next string
|
2006-07-10 22:26:50 +02:00
|
|
|
|
sub edi, 2 ; to last byte of string
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov ecx, edi
|
|
|
|
|
pop esi
|
|
|
|
|
sub ecx, esi
|
2006-07-10 22:26:50 +02:00
|
|
|
|
inc ecx ; length of filename
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edi, fileinfo_start.name
|
2006-07-10 22:26:50 +02:00
|
|
|
|
rep movsb ; copy string
|
|
|
|
|
mov byte [edi], 0 ; store terminator
|
|
|
|
|
mov eax, 70 ; start program
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx, fileinfo_start
|
|
|
|
|
int 0x40
|
2006-07-10 22:26:50 +02:00
|
|
|
|
; mcall 5,100
|
|
|
|
|
or [close_now], 1 ; set close flag
|
2006-01-03 10:43:31 +01:00
|
|
|
|
pop edi
|
|
|
|
|
mov [mousemask], 0
|
|
|
|
|
jmp close
|
|
|
|
|
|
|
|
|
|
searchexit:
|
|
|
|
|
pop edi
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
runthread:
|
|
|
|
|
inc edi
|
|
|
|
|
|
|
|
|
|
push eax
|
2006-07-10 22:26:50 +02:00
|
|
|
|
call get_number ; get number of this process
|
2006-01-03 10:43:31 +01:00
|
|
|
|
pop eax
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
test ebx, ebx ; returned zero - main menu or not number
|
|
|
|
|
jz searchexit
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov al, bl
|
|
|
|
|
|
|
|
|
|
mov ebx, [processes]
|
|
|
|
|
dec bl
|
|
|
|
|
cmp al, bl
|
2006-07-10 22:26:50 +02:00
|
|
|
|
ja searchexit ; such process doesnt exist
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp al, [esi + child]
|
2006-07-10 22:26:50 +02:00
|
|
|
|
je searchexit ; such process already exists
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov [esi + child], al ; this is my child
|
|
|
|
|
mov cx, [esi + x_start]
|
2006-07-10 22:26:50 +02:00
|
|
|
|
add cx, 141 ; new x_start in cx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
movzx edx, al
|
|
|
|
|
shl edx, 4
|
|
|
|
|
add edx, menu_data ; edx points to child's base address
|
|
|
|
|
mov [edx + x_start], cx ; xstart for new thread
|
|
|
|
|
mov cx, [esi + y_end] ; y_end in cx
|
|
|
|
|
mov bl, [esi + rows] ; number of buttons in bl
|
2006-07-10 22:26:50 +02:00
|
|
|
|
sub bl, ah ; number of btn from bottom
|
2006-01-03 10:43:31 +01:00
|
|
|
|
movzx eax, al
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov [buffer], eax ; thread id in buffer
|
2006-01-03 10:43:31 +01:00
|
|
|
|
movzx ebx, bl
|
|
|
|
|
push edx
|
|
|
|
|
mov eax, BTN_HEIGHT
|
|
|
|
|
mul ebx
|
2006-07-10 22:26:50 +02:00
|
|
|
|
sub cx, ax ; new y_end for new thread
|
2006-01-03 10:43:31 +01:00
|
|
|
|
pop edx
|
|
|
|
|
mov [edx + y_end], cx ; store y_end
|
|
|
|
|
mov edi, esi
|
|
|
|
|
call backconvert ; get number of this process (al)
|
|
|
|
|
mov [edx + parent], al ; store number of parent process
|
|
|
|
|
mov al, [edx + rows]
|
|
|
|
|
mov [edx + cur_sel], al ; clear current selected element
|
|
|
|
|
mov [edx + prev_sel], al ; clear previous selected element
|
|
|
|
|
mov [edx + child], 0
|
|
|
|
|
|
|
|
|
|
cmp [thread_stack], 0x1e000
|
|
|
|
|
jne thread_stack_not_full
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov [thread_stack], 0xE000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
thread_stack_not_full:
|
|
|
|
|
add [thread_stack], 0x2000 ; start new thread
|
|
|
|
|
mov eax, 51
|
|
|
|
|
mov ebx, 1
|
|
|
|
|
mov ecx, thread
|
|
|
|
|
mov edx, [thread_stack]
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
jmp searchexit
|
|
|
|
|
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mouse: ; MOUSE EVENT HANDLER
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax, 37
|
|
|
|
|
mov ebx, 2
|
|
|
|
|
int 0x40
|
2006-07-10 22:26:50 +02:00
|
|
|
|
test eax, eax ; check buttons state
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jnz click
|
|
|
|
|
mov eax, 37
|
|
|
|
|
mov ebx, 1
|
|
|
|
|
int 0x40
|
2006-07-10 22:26:50 +02:00
|
|
|
|
ror eax, 16 ; eax = [ Y | X ] relative to window
|
|
|
|
|
cmp ax, 140 ; pointer in window?
|
|
|
|
|
ja noinwindow
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; in window
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
shr eax, 16 ; eax = [ 0 | Y ]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ebx, BTN_HEIGHT
|
|
|
|
|
div ebx
|
2006-07-10 22:26:50 +02:00
|
|
|
|
inc eax ; number of "button" in eax
|
2006-01-03 10:43:31 +01:00
|
|
|
|
movzx ebx, [edi + rows] ; total strings in ebx
|
|
|
|
|
cmp eax, ebx
|
2006-07-10 22:26:50 +02:00
|
|
|
|
ja noinwindow
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edi + cur_sel], al
|
2006-07-10 22:26:50 +02:00
|
|
|
|
je noredrawbut
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov bl, [edi + cur_sel]
|
|
|
|
|
|
|
|
|
|
;;;;;;
|
|
|
|
|
cmp [edi + child], 0
|
|
|
|
|
jne noredrawbut
|
|
|
|
|
;;;;;;
|
|
|
|
|
|
|
|
|
|
mov [edi + cur_sel], al
|
|
|
|
|
mov [edi + prev_sel], bl
|
|
|
|
|
redrawbut:
|
|
|
|
|
call draw_only_needed_buttons
|
|
|
|
|
noredrawbut:
|
|
|
|
|
call backconvert
|
|
|
|
|
bts [mousemask], eax
|
|
|
|
|
jmp still
|
|
|
|
|
noinwindow:
|
|
|
|
|
call backconvert
|
|
|
|
|
btr [mousemask], eax
|
|
|
|
|
jmp still
|
|
|
|
|
click:
|
|
|
|
|
cmp [mousemask], 0 ; not in a window (i.e. menu)
|
2006-07-10 22:26:50 +02:00
|
|
|
|
je close
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
or eax, -1 ; close this thread
|
|
|
|
|
mov [edi + child], al ; my child is not mine
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
backconvert: ; convert from pointer to process id
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax, edi
|
|
|
|
|
sub eax, menu_data
|
|
|
|
|
shr eax, 4
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;==================================
|
|
|
|
|
; get_number
|
|
|
|
|
; load number from [edi] to ebx
|
|
|
|
|
;==================================
|
|
|
|
|
get_number:
|
|
|
|
|
push edi
|
|
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
xor ebx, ebx
|
|
|
|
|
|
|
|
|
|
.get_next_char:
|
|
|
|
|
mov al, [edi]
|
|
|
|
|
inc edi
|
|
|
|
|
cmp al, '0'
|
2006-07-10 22:26:50 +02:00
|
|
|
|
jb .finish
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp al, '9'
|
2006-07-10 22:26:50 +02:00
|
|
|
|
ja .finish
|
2006-01-03 10:43:31 +01:00
|
|
|
|
sub al, '0'
|
|
|
|
|
imul ebx, 10
|
|
|
|
|
add ebx, eax
|
|
|
|
|
jmp .get_next_char
|
|
|
|
|
|
|
|
|
|
.finish:
|
|
|
|
|
pop edi
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov eax, 12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx, 1 ; 1, start of draw
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
movzx ebx, [edi + rows]
|
2006-07-10 22:26:50 +02:00
|
|
|
|
imul eax, ebx, BTN_HEIGHT ; eax = height of window
|
2006-01-03 10:43:31 +01:00
|
|
|
|
movzx ecx, [edi + y_end]
|
2006-07-10 22:26:50 +02:00
|
|
|
|
sub ecx, eax ; ecx = Y_START
|
2006-01-03 10:43:31 +01:00
|
|
|
|
shl ecx, 16
|
2006-07-10 22:26:50 +02:00
|
|
|
|
add ecx, eax ; ecx = [ Y_START | Y_SIZE ]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
dec ecx
|
|
|
|
|
movzx ebx, [edi + x_start]
|
|
|
|
|
shl ebx, 16
|
2006-07-10 22:26:50 +02:00
|
|
|
|
mov bx, 140 ; ebx = [ X_START | X_SIZE ]
|
|
|
|
|
xor eax, eax ; function 0 : define and draw window
|
|
|
|
|
mov edx, 0x01000000 ; color of work area RRGGBB,8->color gl
|
|
|
|
|
mov esi, edx ; unmovable window
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
call draw_all_buttons
|
|
|
|
|
|
|
|
|
|
mov eax,12
|
|
|
|
|
mov ebx,2
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_all_buttons:
|
|
|
|
|
xor edx, edx
|
|
|
|
|
.new_button:
|
|
|
|
|
call draw_one_button
|
|
|
|
|
inc edx
|
|
|
|
|
cmp dl, [edi + rows]
|
2006-07-10 22:26:50 +02:00
|
|
|
|
jb .new_button
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_only_needed_buttons:
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov dl, [edi + cur_sel]
|
|
|
|
|
dec dl
|
|
|
|
|
call draw_one_button
|
|
|
|
|
mov dl, [edi + prev_sel]
|
|
|
|
|
dec dl
|
|
|
|
|
call draw_one_button
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_one_button:
|
|
|
|
|
; receives number of button in dl
|
|
|
|
|
push edx;ad
|
|
|
|
|
|
|
|
|
|
mov eax, 8
|
|
|
|
|
mov ebx, 140
|
|
|
|
|
movzx ecx, dl
|
|
|
|
|
imul ecx, BTN_HEIGHT
|
|
|
|
|
shl ecx, 16
|
|
|
|
|
add ecx, BTN_HEIGHT-1
|
|
|
|
|
; edx = button identifier
|
|
|
|
|
mov esi, [sc.work_button]
|
|
|
|
|
inc dl
|
|
|
|
|
cmp [edi + cur_sel], dl
|
|
|
|
|
jne .nohighlight
|
|
|
|
|
add esi, 0x202020
|
|
|
|
|
.nohighlight:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
or edx, 0x20000000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
int 0x40
|
|
|
|
|
movzx edx, dl
|
|
|
|
|
|
|
|
|
|
dec dl
|
|
|
|
|
imul ebx, edx, BTN_HEIGHT
|
|
|
|
|
add ebx, (4 shl 16) + TXT_Y
|
|
|
|
|
|
|
|
|
|
movzx ecx, dl
|
|
|
|
|
inc ecx
|
|
|
|
|
mov edx, [edi + pointer]
|
|
|
|
|
.findline:
|
|
|
|
|
cmp byte [edx], 13
|
2006-07-10 22:26:50 +02:00
|
|
|
|
je .linefound
|
2006-01-03 10:43:31 +01:00
|
|
|
|
inc edx
|
|
|
|
|
jmp .findline
|
|
|
|
|
.linefound:
|
|
|
|
|
inc edx
|
|
|
|
|
cmp byte [edx], 10
|
|
|
|
|
jne .findline
|
|
|
|
|
dec ecx
|
|
|
|
|
jnz .findline
|
|
|
|
|
|
|
|
|
|
mov ecx, [sc.work_button_text]
|
|
|
|
|
mov eax, 4
|
|
|
|
|
mov esi, 21
|
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
|
|
pop edx;ad
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
searchstartstring:
|
|
|
|
|
mov ecx, 40
|
|
|
|
|
mov al, 13
|
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
cmp byte [edi], 10
|
|
|
|
|
jne searchstartstring
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;*** DATA AREA ****************************************************************
|
|
|
|
|
|
2006-07-10 22:26:50 +02:00
|
|
|
|
thread_stack dd 0xE000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
processes dd 0
|
|
|
|
|
|
|
|
|
|
fileinfo:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
.subfunction dd 0 ; 0=READ
|
|
|
|
|
.start dd 0 ; start byte
|
|
|
|
|
.size_high dd 0 ; rezerved
|
|
|
|
|
.size dd 0x10000-mem_end ; blocks to read
|
|
|
|
|
.return dd mem_end ; return data pointer
|
2006-01-03 10:43:31 +01:00
|
|
|
|
.name:
|
|
|
|
|
db '/RD/1/MENU.DAT',0 ; ASCIIZ dir & filename
|
|
|
|
|
|
|
|
|
|
fileinfo_start:
|
2006-07-10 22:26:50 +02:00
|
|
|
|
.subfunction dd 7 ; 7=START APPLICATION
|
|
|
|
|
.flags dd 0 ; flags
|
|
|
|
|
.params dd 0x0 ; nop
|
|
|
|
|
.rezerved dd 0x0 ; nop
|
|
|
|
|
.rezerved_1 dd 0x0 ; nop
|
2006-01-03 10:43:31 +01:00
|
|
|
|
.name:
|
|
|
|
|
times 50 db ' '
|
|
|
|
|
|
|
|
|
|
I_END:
|
|
|
|
|
|
|
|
|
|
close_now dd ? ; close all processes immediately
|
|
|
|
|
end_pointer dd ?
|
2006-07-10 22:26:50 +02:00
|
|
|
|
buffer dd ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mousemask dd ? ; mask for mouse pointer location
|
|
|
|
|
|
|
|
|
|
sc system_colors
|
|
|
|
|
|
|
|
|
|
menu_data:
|
|
|
|
|
rb 0x4000 ;x10000
|
|
|
|
|
|
|
|
|
|
virtual at 0 ; PROCESSES TABLE (located at menu_data)
|
|
|
|
|
pointer dd ? ; +0 pointer in file
|
2006-07-10 22:26:50 +02:00
|
|
|
|
rows db ? ; +4 numer of strings
|
2006-01-03 10:43:31 +01:00
|
|
|
|
x_start dw ? ; +5 x start
|
|
|
|
|
y_end dw ? ; +7 y end
|
|
|
|
|
child db ? ; +9 id of child menu
|
|
|
|
|
parent db ? ; +10 id of parent menu
|
|
|
|
|
cur_sel db ? ; +11 current selection
|
|
|
|
|
prev_sel db ? ; +12 previous selection
|
|
|
|
|
rb 16-$+1 ; [16 bytes per element]
|
|
|
|
|
end virtual
|
|
|
|
|
|
|
|
|
|
mem_end:
|