Update headers programs : delete MENUET00 header on 2 programs.

Fixed mario2 game : delete using sysfn 6 and added constants 
Update macro.inc : Added new fields in process_information 

git-svn-id: svn://kolibrios.org@9971 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2024-01-21 11:23:12 +00:00
parent ef78b78d1c
commit 7f7718f532
10 changed files with 1754 additions and 1733 deletions

View File

@ -8,19 +8,12 @@
use32
org 0x0
;db 'MENUET00' ; 8 byte id
;dd 38 ; required os
;dd STARTAPP ; program start
;dd I_END ; program image size
;dd 0x100000 ; required amount of memory
;dd 0x00000000 ; reserved=no extended header
db 'MENUET01'
dd 1
dd STARTAPP
dd I_END
dd MEM
dd STACKTOP
db 'MENUET01' ; header
dd 1 ; version
dd STARTAPP ; program start
dd I_END ; program image size
dd MEM ; size memory for program
dd STACKTOP ; pointer of stack
dd 0
dd 0

View File

@ -7,30 +7,45 @@
use32
org 0x0
db 'MENUET01' ; header
dd 1 ; version
dd START ; program start
dd I_END ; image size
dd MEM ; size memory program
dd STACKTOP ; pointer to begin stack pos
dd 0
dd 0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; image size
dd 0x100000 ; reguired amount of memory
dd 0x00000000 ; reserved=no extended header
empty equ 0x80000 + 0*3*40*40
build_1 equ 0x80000 + 1*3*40*40
build_2 equ 0x80000 + 2*3*40*40
build_3 equ 0x80000 + 3*3*40*40
mario_1 equ 0x90000 + 0*3*70*51
mario_2 equ 0x90000 + 1*3*70*51
mario_3 equ 0x90000 + 2*3*70*51
mario_4 equ 0x90000 + 3*3*70*51
mario_5 equ 0x90000 + 4*3*70*51
mario_6 equ 0x90000 + 5*3*70*51
mario_green equ 0x90000 + 6*3*70*51
loadp equ 0x90000 + 7*3*70*51
res_base = loadp + 0x36 ; offset on array pixel in BMP file
res_width_px = 150
res_height_px = 35
res_line_size = (res_width_px*3 + 11b) and not 11b ; 150*3 + 2
block_width = 40
block_height = 40
block_line_size = block_width * 3
block_img_size = block_width * block_height * 3
block_draw_size = (block_width shl 16) + block_height ; for sysfn 7
block_count_pixel = block_width * block_height
mario_width = 50
mario_height = 70
mario_line_size = mario_width * 3
mario_img_size = mario_width * mario_height * 3
mario_draw_size = (mario_width shl 16) + mario_height
mario_count_pixel = mario_width * mario_height
wnd_pos_x = 80
wnd_pos_y = 20
wnd_header_size = 0x16
wnd_height = 9*block_height + wnd_header_size
wnd_width = 12*block_width + 1
START:
@ -46,55 +61,51 @@ START:
sta:
mov eax,field
mov edx,1*65526+30
mov [xxyy],dword 1*65536+22
mov dword[xxyy], 1*65536 + wnd_header_size
stl:
cmp [eax],byte ' '
jnz noempty
cmp byte[eax], ' '
jnz @f
mov ebx,empty
noempty:
@@:
cmp [eax],byte '1'
jnz no1
cmp byte[eax], '1'
jnz @f
mov ebx,build_1
no1:
@@:
cmp [eax],byte '2'
jnz no2
cmp byte[eax], '2'
jnz @f
mov ebx,build_2
no2:
@@:
cmp [eax],byte '3'
jnz no3
cmp byte[eax], '3'
jnz @f
mov ebx,build_3
no3:
@@:
pusha
mov edx,[xxyy]
mov eax,7 ; display image
mov ecx,40*65536+40
mov ecx, block_draw_size
int 0x40
popa
add word [xxyy+2],word 40
cmp word [xxyy+2],word 40*12+1
jnz nonewline
mov word [xxyy+2],word 1
add word [xxyy+0],word 40
nonewline:
add word [xxyy+2], block_width
cmp word [xxyy+2], block_width*12+1
jnz .nonewline
mov word [xxyy+2], 1
add word [xxyy+0], block_height
.nonewline:
add eax,1
cmp eax,field+12*9
jz nodraw
jmp stl
nodraw:
cmp eax, field.end
jnz stl
; ********* MAIN LOOP ***********
@ -105,15 +116,17 @@ wait_for_event:
mov eax,11 ; check for event
int 0x40
cmp eax,1
jz red
cmp eax,2
jz key
cmp eax,3
cmp eax,3 ; check pressed button
jnz wait_for_event
jmp button
mov eax, -1 ; close this program
int 0x40
red:
mov [mariomem],dword 0x0
@ -128,17 +141,17 @@ wait_for_event:
mov eax,2 ; ah <- key
int 0x40
cmp ah,176
cmp ah,176 ; 'left'
jnz key1
mov byte [leftright],byte 1
key1:
cmp ah,179
cmp ah,179 ; 'right'
jnz key2
mov byte [leftright],byte 4
key2:
cmp ah,177
cmp ah,177 ; 'down'
jnz key3
mov al,byte [leftright]
mov bl,al
@ -153,57 +166,42 @@ wait_for_event:
mov byte [leftright],bl
key3:
cmp ah,178
cmp ah,178 ; 'up'
jnz key4
cmp [velocity],dword 0xff
jnz key4
mov [velocity],dword 0x110
key4:
mov eax,71 ;draw caption
mov ebx,1
mov ecx,title
int 0x40
jmp sta ;draw field
; this code using for fix defects drawing(draw in caption area)
mov eax,71 ;draw caption
mov ebx,1
mov ecx,title
int 0x40
jmp sta ;draw field
;jmp wait_for_event
button:
mov eax,0xffffffff ; close this program
int 0x40
load_graph:
pusha
mov eax,6 ; 6 = open file
mov ebx,filename
mov ecx,0
mov edx,0xFFFFFF
mov esi,loadp
mov edi,0 ; floppy
int 0x40
; empty
; empty block init - set in 0x00500f color
mov edi,empty
mov ecx,40*40
mov ecx, block_count_pixel
mov eax,0x00500f
cld
emptyl:
@@:
mov [edi],eax
add edi,3
loop emptyl
add edi, 3
loop @b
mov [width],40*3
mov [width_move],20
mov [sub_esi],150*3+2
mov [add_edi],40*3*2
mov [width], block_line_size
mov [width_move], block_width/2
mov [height_move], block_height/2
mov [imul_esi],20*3
mov [base],loadp+18*3+3*150*34+3*98-1
mov [base], res_base + 3*res_width_px * 34 +3*98-1
mov esi,0
mov edi,build_1
@ -216,26 +214,24 @@ load_graph:
; build_3
mov edi,build_3
mov esi,loadp+18*3+230*3+3*300*69
mov ecx,40
mov esi, res_base + 230*3+3*300*69
mov ecx, block_height
build_3l:
pusha
mov ecx,3*40
mov ecx, block_line_size
cld
rep movsb
popa
sub esi,300*3
add edi,40*3
add edi, block_line_size
loop build_3l
mov [width],50*3
mov [width_move],25
mov [sub_esi],150*3+2
mov [add_edi],50*3*2
mov [width], mario_line_size
mov [width_move], mario_width/2
mov [height_move], mario_height/2
mov [imul_esi],25*3
mov [base],loadp+18*3+3*150*34+68
mov [base], res_base + 3*res_width_px*34 + 68
mov esi,0
mov edi,mario_1
@ -252,16 +248,21 @@ load_graph:
jmp mario_mirror
; copy in [edi], image x2
convert:
imul esi,[imul_esi]
add esi,[base] ; loadp+18*3+3*150*34+68
mov ecx,70
mario_1l:
mov eax, [width]
shl eax, 1 ; *2
mov ecx, [height_move] ;?
.new_line:
pusha
mov ecx,[width_move]
putpix:
.putpix: ; set 4 pixel: edi, edi+3, edi+width, edi+width+3
mov eax,[esi]
mov [edi+00],ax
mov [edi+03],ax
@ -278,45 +279,41 @@ convert:
mov [edi+ebx],al
add esi,3
add edi,6
loop putpix
loop .putpix
popa
sub esi,[sub_esi]
add edi,[add_edi]
loop mario_1l
sub esi,res_line_size
add edi, eax
loop .new_line
ret
sub_esi dd 0x0
add_edi dd 0x0
imul_esi dd 0x0
base dd 0x0
width dd 0x0
width_move dd 0x0
imul_esi dd 0
base dd 0
width dd 0
width_move dd 0
height_move dd 0
mario_mirror:
; mario_green
mov edi,mario_green
mov ecx,70*50
mario_greenl:
mov ecx, mario_count_pixel
@@:
mov [edi],dword 0x00500f
add edi,3
loop mario_greenl
add edi, 3
loop @b
; mario_4 - reverse mario_1
; mario_4
mov edi,mario_4
mov esi,mario_1+49*3
mov ecx,70
mov edi, mario_4
mov esi, mario_1 + (mario_width - 1)*3
mov ecx, mario_height
m4l1:
pusha
mov ecx,50
mov ecx, mario_width
m4l2:
mov eax,[esi]
mov [edi],ax
@ -326,19 +323,20 @@ mario_mirror:
sub esi,3
loop m4l2
popa
add esi,50*3
add edi,50*3
add esi, mario_width*3
add edi, mario_width*3
loop m4l1
; mario_5
; mario_5 - reverse mario_2
mov edi,mario_5
mov esi,mario_2+49*3
mov ecx,70
mov edi, mario_5
mov esi, mario_2 + (mario_width - 1)*3
mov ecx, mario_height
m5l1:
pusha
mov ecx,50
mov ecx, mario_width
m5l2:
mov eax,[esi]
mov [edi],ax
@ -348,19 +346,20 @@ mario_mirror:
sub esi,3
loop m5l2
popa
add esi,50*3
add edi,50*3
add esi, mario_width*3
add edi, mario_width*3
loop m5l1
; mario_6
; mario_6 - reverse mario_3
mov edi,mario_6
mov esi,mario_3+49*3
mov ecx,70
mov edi, mario_6
mov esi, mario_3 + (mario_width - 1)*3
mov ecx, mario_height
m6l1:
pusha
mov ecx,50
mov ecx, mario_width
m6l2:
mov eax,[esi]
mov [edi],ax
@ -370,13 +369,13 @@ mario_mirror:
sub esi,3
loop m6l2
popa
add esi,50*3
add edi,50*3
add esi, mario_width*3
add edi, mario_width*3
loop m6l1
popa
ret
@ -532,7 +531,7 @@ mario_delay:
pusha
mov eax,5 ;pause
mov eax,5 ;pause
mov ebx,2
int 0x40
@ -547,129 +546,132 @@ draw_mario:
mov eax,[mariomem]
cmp eax,[marioxy]
jnz dm1
jnz @f
call mario_delay
popa
ret
dm1:
@@:
mov eax,[marioxy]
mov [mariomem],eax
cmp byte [leftright],byte 1 ; go left
jnz no_m_left
jmp m_left
no_m_left:
cmp byte [leftright], 1 ; go left
jz m_left
cmp byte [leftright],byte 4 ; go right
jnz no_m_right
jmp m_right
no_m_right:
cmp byte [leftright], 4 ; go right
jz m_right
cmp byte [leftright],byte 2 ; stand left
cmp byte [leftright], 2 ; stand left
jnz no_r_still
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_1
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
popa
ret
no_r_still:
cmp byte [leftright],byte 3 ; stand right
jnz no_l_still
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_4
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
popa
ret
no_l_still:
popa
ret
m_left:
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_1
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_2
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_3
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_2
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
popa
ret
m_right:
@ -677,64 +679,67 @@ draw_mario:
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_4
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_5
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_6
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
mov eax,7
mov ebx,mario_green
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call advance_mario
mov eax,7
mov ebx,mario_5
mov ecx,50*65536+70
mov ecx, mario_draw_size
mov edx,[marioxy]
int 0x40
call mario_delay
popa
ret
draw_window:
pusha
@ -744,9 +749,9 @@ draw_window:
int 0x40
mov eax,0 ; define and draw window
mov ebx,80*65536+480+1
mov ecx,20*65536+382
mov edx,0x5466AA88
mov ebx, (wnd_pos_x shl 16) + wnd_width ;80*65536+480+1
mov ecx, (wnd_pos_y shl 16) + wnd_height ;20*65536+382
mov edx,0x5466AA88 ; 4 type window + title + no draw work space
mov edi,title
int 0x40
@ -761,9 +766,6 @@ draw_window:
; DATA SECTION
filename:
db 'MARIOALLBMP'
title:
db 'SUPER MARIO - USE ARROW KEYS', 0
@ -778,6 +780,7 @@ field:
db '1 1'
db '1 1'
db '222222222222'
.end:
xxyy dd 0x0
@ -789,9 +792,33 @@ leftright dd 0x0
velocity dd 0x0
align 16
loadp:
file 'MARIOALL.BMP'
I_END:
align 0x1000
empty: rb block_img_size
build_1: rb block_img_size
build_2: rb block_img_size
build_3: rb block_img_size
align 0x1000
mario_1: rb mario_img_size
mario_2: rb mario_img_size
mario_3: rb mario_img_size
mario_4: rb mario_img_size
mario_5: rb mario_img_size
mario_6: rb mario_img_size
mario_green: rb mario_img_size
rb 4096
STACKTOP:
MEM:

View File

@ -20,21 +20,14 @@ CK_UP2 equ 72
CK_DOWN2 equ 80
use32
org 0x0
;org 0x0
;
;db 'MENUET00' ; 8 byte id
;dd 38 ; required os
;dd START ; program start
;dd I_END ; program image size
;dd 0x2000 ; required amount of memory
;dd 0x00000000 ; reserved=no extended header
db 'MENUET01'
dd 1
dd START
dd I_END
dd MEM
dd STACKTOP
dd 1 ; version
dd START ; program start
dd I_END ; program image size
dd MEM ; size memory for program
dd STACKTOP ; pointer on stack
dd 0
dd 0

View File

@ -465,7 +465,9 @@ struct process_information
dw ? ; +52
client_box BOX ; +54
wnd_state db ? ; +70
rb (1024-71)
event_mask dd ? ; +71
keyboard_mode db ? ; +75
rb (1024-76)
ends
struct system_colors

File diff suppressed because it is too large Load Diff

View File

@ -1,164 +1,164 @@
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
align 4
context_menu_start:
mcall 40,00100111b
mov ecx, [ctx_menu_PID]
mcall 18,21
mov ecx, eax
mcall 18,3
call draw_ctx_menu
;------------------------------------------------------------------------------
mcall 40, EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE ;00100111b
mov ecx, [ctx_menu_PID]
mcall 18,21
mov ecx, eax
mcall 18,3
call draw_ctx_menu
;------------------------------------------------------------------------------
align 4
ctx_menu_still:
mcall 10
cmp eax, 2
jz ctx_menu_key
mcall 10
cmp eax, EV_KEY
jz ctx_menu_key
cmp eax, 3
jz ctx_menu_button
cmp eax, EV_BUTTON
jz ctx_menu_button
cmp eax, 6
jz ctx_menu_mouse
cmp eax, EV_MOUSE
jz ctx_menu_mouse
call draw_ctx_menu
jmp ctx_menu_still
;------------------------------------------------------------------------------
call draw_ctx_menu
jmp ctx_menu_still
;------------------------------------------------------------------------------
align 4
ctx_menu_mouse:
mcall 37,2
xchg eax,ecx ; …᫨ ­¥ ®¤­  ¨§ ª­®¯®ª ­¥ ­ ¦ â  ¢®§¢à é ¥¬áï
; ¢ £« ¢­ë© 横« ¯®â®ª 
jecxz ctx_menu_still
mcall 37,2
xchg eax,ecx ; …᫨ ­¥ ®¤­  ¨§ ª­®¯®ª ­¥ ­ ¦ â  ¢®§¢à é ¥¬áï
; ¢ £« ¢­ë© 横« ¯®â®ª 
jecxz ctx_menu_still
mcall 37,1
mcall 37,1
cmp ax, 0 ; ’ã⠯஢¥à塞 ¯à®¨§®èñ«-«¨ ª«¨ª §  ¯à¥¤¥« ¬¨ ®ª­  ª®­â¥ªáâ­®£®
jb ctx_menu_exit ; ¬¥­î, ¥á«¨ §  ¯à¥¤¥« ¬¨ â® § ªà뢠¥¬ ª®­â¥ªáâ­®¥ ¬¥­î
cmp ax, 0 ; ’ã⠯஢¥à塞 ¯à®¨§®èñ«-«¨ ª«¨ª §  ¯à¥¤¥« ¬¨ ®ª­  ª®­â¥ªáâ­®£®
jb ctx_menu_exit ; ¬¥­î, ¥á«¨ §  ¯à¥¤¥« ¬¨ â® § ªà뢠¥¬ ª®­â¥ªáâ­®¥ ¬¥­î
cmp ax, 60 ; 41
ja ctx_menu_exit
cmp ax, 60 ; 41
ja ctx_menu_exit
shr eax, 16
cmp ax, 0
jb ctx_menu_exit
shr eax, 16
cmp ax, 0
jb ctx_menu_exit
cmp ax, 133
ja ctx_menu_exit
cmp ax, 133
ja ctx_menu_exit
jmp ctx_menu_still
;------------------------------------------------------------------------------
jmp ctx_menu_still
;------------------------------------------------------------------------------
align 4
ctx_menu_key:
mcall 2
mcall 2
;--------------------------------------
align 4
ctx_menu_button:
mcall 17
cmp ah, 1
jne @f
mcall 17
cmp ah, 1
jne @f
; mov eax, 18
; mov ebx, 2
; mov ecx, [n_slot]
; jmp .lllxxx
mcall 18,3,[n_slot]
mcall 72,1,3,1
mcall 68,1
jmp ctx_menu_exit
; mov eax, 18
; mov ebx, 2
; mov ecx, [n_slot]
; jmp .lllxxx
mcall 18,3,[n_slot]
mcall 72,1,3,1
mcall 68,1
jmp ctx_menu_exit
;--------------------------------------
align 4
@@:
cmp ah, 2
jne ctx_menu_still
mov eax, 18
mov ebx, 22
mov edx, [n_slot]
xor ecx, ecx
cmp ah, 2
jne ctx_menu_still
mov eax, 18
mov ebx, 22
mov edx, [n_slot]
xor ecx, ecx
test [procinfo_for_detect+70],byte 2
setnz cl
add cl, cl
test [procinfo_for_detect.wnd_state],byte 2
setnz cl
add cl, cl
;--------------------------------------
align 4
.lllxxx:
mcall
jmp ctx_menu_exit
mcall
jmp ctx_menu_exit
;--------------------------------------
align 4
ctx_menu_exit:
or eax,-1
mcall
;------------------------------------------------------------------------------
or eax,-1
mcall
;------------------------------------------------------------------------------
align 4
;func draw_ctx_menu
draw_ctx_menu:
mcall 12, 1
mcall 12, 1
xor eax, eax
movzx ebx, [x_coord]
shl ebx, 16
add ebx, 133
movzx ecx, [y_coord]
sub ecx, 60 ; 41
shl ecx, 16
add ecx, 60 ; 41
mov esi, [system_colours + 4] ; sc.grab
or esi, 0x81000000
mcall ,,,[system_colours + 20],,[system_colours+8]
xor eax, eax
movzx ebx, [x_coord]
shl ebx, 16
add ebx, 133
movzx ecx, [y_coord]
sub ecx, 60 ; 41
shl ecx, 16
add ecx, 60 ; 41
mov esi, [system_colours.grab] ; sc.grab
or esi, 0x81000000
mcall ,,,[system_colours.work],,[system_colours.work_dark]
mcall 8,<0,133>,<22,17>,0x40000001
mcall 8,<0,133>,<22,17>,0x40000001
inc edx
mcall ,,<40,17>
mov ecx, [system_colours + 16] ; sc.grab_text
or ecx, 0x10000000
mcall 4,<32,4>,,ctx_menu_title,ctx_menu_title_end - ctx_menu_title
inc edx
mcall ,,<40,17>
mov ecx, [system_colours.grab_text] ; sc.grab_text
or ecx, 0x10000000
mcall 4,<32,4>,,ctx_menu_title,ctx_menu_title_end - ctx_menu_title
add ebx, 1 * 65536
mcall
add ebx, 1 * 65536
mcall
mov ecx, [system_colours + 32] ; sc.work_text
or ecx, 0x80000000
mcall ,<4,28>,,ctx_menu_text
mov ecx, [system_colours.work_text] ; sc.work_text
or ecx, 0x80000000
mcall ,<4,28>,,ctx_menu_text
mov edx, ctx_menu_text2
mov edx, ctx_menu_text2
test byte [procinfo_for_detect+70], 2
jz @f
mov edx, ctx_menu_text3
test byte [procinfo_for_detect.wnd_state], 2
jz @f
mov edx, ctx_menu_text3
;--------------------------------------
align 4
@@:
add bx, 18
mcall
add bx, 18
mcall
mcall 12,2
ret
mcall 12,2
ret
;endf
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
align 4
x_coord rw 1
y_coord rw 1
n_slot rd 1
ctx_menu_PID rd 1
;------------------------------------------------------------------------------
x_coord rw 1
y_coord rw 1
n_slot rd 1
ctx_menu_PID rd 1
;------------------------------------------------------------------------------
lsz ctx_menu_text,\
ru, <"X ‡ ªàëâì Alt + F4",0>,\
en, <"X Close Alt + F4",0>,\
et, <"X Sulge Alt + F4",0>,\
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
lsz ctx_menu_text2,\
ru, <25," ‘¢¥à­ãâì ",0>,\
en, <25," Minimize ",0>,\
et, <25," Minimeeri ",0>,\
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
lsz ctx_menu_text3,\
ru, <24," ‚®ááâ ­®¢¨âì ",0>,\
en, <24," Restore ",0>,\
et, <24," Taasta ",0>
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
ctx_menu_title:
db 'KolibriOS'
db 'KolibriOS'
ctx_menu_title_end:
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------

View File

@ -1,229 +1,229 @@
;------------------------------------------------------------------------------
align 4
draw_running_applications:
pusha
pusha
cmp [run_appl],dword 0
je .exit
cmp [run_appl],dword 0
je .exit
call calculate_applications
call calculate_applications
cmp edi,[running_applications]
jne .noret
popa
ret
cmp edi,[running_applications]
jne .noret
popa
ret
;--------------------------------------
align 4
.noret:
call draw_window
mov [running_applications],edi
call redraw_window_tabs
call draw_window
mov [running_applications],edi
call redraw_window_tabs
;--------------------------------------
align 4
.exit:
popa
ret
popa
ret
;------------------------------------------------------------------------------
align 4
need_window_tab:
; in: ebx->process info
; out: ZF set <=> do not draw
cmp byte [ebx+10], '@'
jz .nodraw
cmp byte [ebx + process_information.process_name], '@'
jz .nodraw
; do not draw undefined (zero-sized) windows
cmp dword [ebx+42], 0
jnz @f
cmp dword [ebx+46], 0
jz .nodraw
cmp dword [ebx + process_information.box.width], 0
jnz @f
cmp dword [ebx + process_information.box.height], 0
jz .nodraw
;--------------------------------------
align 4
@@:
; do not draw OpenDialog windows
push edi
mov edi, dword [ebx+10]
or edi, 0x20202020
cmp edi, 'open'
jne @f
push edi
mov edi, dword [ebx + process_information.process_name]
or edi, 0x20202020
cmp edi, 'open'
jne @f
mov edi, dword [ebx+14]
or edi, 0x20202020
cmp dword [ebx+14], 'dial'
jne @f
mov edi, dword [ebx + process_information.process_name + 4]
or edi, 0x20202020
cmp edi, 'dial'
jne @f
pop edi
jmp .nodraw
pop edi
jmp .nodraw
;--------------------------------------
align 4
@@:
pop edi
cmp dword [ebx+10], 'ICON'
jnz @f
pop edi
cmp dword [ebx + process_information.process_name], 'ICON'
jnz @f
cmp [ebx+42], dword 51
jnz @f
cmp [ebx + process_information.box.width], dword 51
jnz @f
cmp [ebx+46], dword 51
jz .nodraw
cmp [ebx + process_information.box.height], dword 51
jz .nodraw
;--------------------------------------
align 4
@@:
cmp [ebx+10], dword ' '
cmp dword[ebx + process_information.process_name], ' '
;--------------------------------------
align 4
.nodraw:
ret
ret
;------------------------------------------------------------------------------
align 4
calculate_applications:
mov eax,[max_applications]
mul [page_list]
test eax,eax
je @f
mov eax,[max_applications]
mul [page_list]
test eax,eax
je @f
inc eax
inc eax
;--------------------------------------
align 4
@@:
mov [draw_start_position],eax
mov [draw_start_position],eax
mov edi,app_list
mov ecx,20 ; show max 20 application ???!!!
mov eax,-1
cld
rep stosd
mov edi,app_list
mov ecx,20 ; show max 20 application ???!!!
mov eax,-1
cld
rep stosd
mov edi,0
mov ecx,2
mov edi,0
mov ecx,2
;--------------------------------------
align 4
cnewpr:
mcall 9,procinfo_window_tabs
mcall 9,procinfo_window_tabs
call need_window_tab
jz cnorpl
call need_window_tab
jz cnorpl
sub [draw_start_position], 1
jg cnorpl
sub [draw_start_position], 1
jg cnorpl
mov [app_list+edi*4],ecx
inc edi
mov [app_list+edi*4],ecx
inc edi
;--------------------------------------
align 4
cnorpl:
inc ecx
cmp eax,ecx
jge cnewpr
inc ecx
cmp eax,ecx
jge cnewpr
mov [app_tab_count], edi
ret
mov [app_tab_count], edi
ret
;------------------------------------------------------------------------------
align 4
redraw_window_tabs:
xor edi, edi
mov [contrast], 0
xor edi, edi
mov [contrast], 0
push ebp
mcall 18,7
mov ebp,eax
call calculate_offset_X
push ebp
mcall 18,7
mov ebp,eax
call calculate_offset_X
;--------------------------------------
align 4
.loop:
mov ecx,[app_list+edi*4]
cmp ecx,-1
jz .done
mov ecx,[app_list+edi*4]
cmp ecx,-1
jz .done
mov [active_slot_number],ecx
mcall 9,procinfo_window_tabs
mov [active_slot_number],ecx
mcall 9,procinfo_window_tabs
imul ebx, edi, TAB_SIZE
add ebx,[offset_X]
add ebx,2
shl ebx,16
add ebx,TAB_SIZE-2 ;54
imul ebx, edi, TAB_SIZE
add ebx,[offset_X]
add ebx,2
shl ebx,16
add ebx,TAB_SIZE-2 ;54
push edi
mov edx,[system_colours.work_button]
xor edi,edi
push edi
mov edx,[system_colours.work_button]
xor edi,edi
cmp ebp,[active_slot_number] ;ecx ; ecx=active slot number
jnz @f
cmp ebp,[active_slot_number] ;ecx ; ecx=active slot number
jnz @f
mov edx,[wcolor]
inc edi
mov edx,[wcolor]
inc edi
;--------------------------------------
align 4
@@:
mov esi,[current_alt_tab_app]
cmp esi,-1
jz @f
mov esi,[current_alt_tab_app]
cmp esi,-1
jz @f
cmp ecx,[alt_tab_list+esi*8]
jnz @f
cmp ecx,[alt_tab_list+esi*8]
jnz @f
mov edx,[AltTab_color] ;0xFF8000 ; current select for ALT+Tab
mov edx,[AltTab_color] ;0xFF8000 ; current select for ALT+Tab
;--------------------------------------
align 4
@@:
call calculate_button_y_coordinate_and_size
call calculate_button_y_coordinate_and_size
mov esi,[wcolor]
call draw_appl_button
pop edi
mov esi,[wcolor]
call draw_appl_button
pop edi
;------------------------------------------------------------------------------
add ebx,4 shl 16
mov bx,cx ;[height]
shr bx,1
sub bx,4
shr ecx,16
add bx,cx
mov edx, procinfo_window_tabs+10
mcall 4,,[system_colours.work_button_text],,11
add ebx,4 shl 16
mov bx,cx ;[height]
shr bx,1
sub bx,4
shr ecx,16
add bx,cx
mov edx, procinfo_window_tabs.process_name
mcall 4,,[system_colours.work_button_text],, sizeof.process_information.process_name
;--------------------------------------
align 4
.nodraw:
inc edi
cmp edi, [max_applications]
jb .loop
inc edi
cmp edi, [max_applications]
jb .loop
mov ecx,[app_list+edi*4]
cmp ecx,-1
jz .done
mov ecx,[app_list+edi*4]
cmp ecx,-1
jz .done
xor eax,eax
cmp [page_list],eax
jne @f
inc eax
cmp [page_list_enable],eax
je @f
mov [page_list_enable],eax
mov [redraw_window_flag],eax
xor eax,eax
cmp [page_list],eax
jne @f
inc eax
cmp [page_list_enable],eax
je @f
mov [page_list_enable],eax
mov [redraw_window_flag],eax
;--------------------------------------
align 4
@@:
pop ebp
ret
pop ebp
ret
;--------------------------------------
align 4
.done:
xor eax,eax
cmp [page_list],eax
jne @f
xor eax,eax
cmp [page_list],eax
jne @f
cmp [page_list_enable],eax
je @f
cmp [page_list_enable],eax
je @f
mov [page_list_enable],eax
inc eax
mov [redraw_window_flag],eax
mov [page_list_enable],eax
inc eax
mov [redraw_window_flag],eax
;--------------------------------------
align 4
@@:
pop ebp
ret
pop ebp
ret
;------------------------------------------------------------------------------

View File

@ -4,439 +4,439 @@
; ***************************************************
align 4
draw_window:
pusha
mov [running_applications],-1
mcall 12,1
pusha
mov [running_applications],-1
mcall 12,1
mcall 48,3,system_colours,10*4
mcall 48,3,system_colours, sizeof.system_colors
mov eax, [system_colours+4*6]
mov edx,[system_colours+4*6]
mov eax,COLOR_CHANGE_MAGNITUDE
call subtract_color_change_magnitude
mov [wcolor], edx
mov eax, [system_colours.work_button]
mov edx,[system_colours.work_button]
mov eax,COLOR_CHANGE_MAGNITUDE
call subtract_color_change_magnitude
mov [wcolor], edx
mcall 14 ; get screen max x & max y
mcall 14 ; get screen max x & max y
cmp [width],dword 0
je no_def_width
cmp [width],dword 0
je no_def_width
and eax,0xffff
mov ebx,[width]
shl ebx,16
add eax,ebx
and eax,0xffff
mov ebx,[width]
shl ebx,16
add eax,ebx
;--------------------------------------
align 4
no_def_width:
mov ebx,eax
mov [screenxy],ebx
shr ebx,16
mov ecx,eax
mov ebx,eax
mov [screenxy],ebx
shr ebx,16
mov ecx,eax
cmp [place_attachment],1
je @f
xor ecx,ecx
mov cx,[height]
dec cx
jmp .attachment_selected
cmp [place_attachment],1
je @f
xor ecx,ecx
mov cx,[height]
dec cx
jmp .attachment_selected
;--------------------------------------
align 4
@@:
sub ecx,[height]
inc ecx
shl ecx,16
mov cx,[height]
dec cx
sub ecx,[height]
inc ecx
shl ecx,16
mov cx,[height]
dec cx
;--------------------------------------
align 4
.attachment_selected:
xor eax,eax ; DEFINE AND DRAW WINDOW
mov edx, [wcolor]
or edx, 0x01000000 ; do not draw the window
mov esi, [wcolor]
or esi, 0x01000000 ; unmovable window
mov edi, [wcolor]
mov [panel_x_pos], ebx
mov [panel_y_pos], ecx ; Ïîêà ÷òî òàê.
mcall
xor eax,eax ; DEFINE AND DRAW WINDOW
mov edx, [wcolor]
or edx, 0x01000000 ; do not draw the window
mov esi, [wcolor]
or esi, 0x01000000 ; unmovable window
mov edi, [wcolor]
mov [panel_x_pos], ebx
mov [panel_y_pos], ecx ; Ïîêà ÷òî òàê.
mcall
movzx eax,word [screenxy+2]
mov [max_x],eax
call fill_window
call minimize_left_button
call minimize_right_button
call draw_menu_and_clean_desktop
mov [ptime],0
call draw_tray
call draw_application_buttons
movzx eax,word [screenxy+2]
mov [max_x],eax
call fill_window
call minimize_left_button
call minimize_right_button
call draw_menu_and_clean_desktop
mov [ptime],0
call draw_tray
call draw_application_buttons
mov [redraw_window_flag],0
mcall 12,2
popa
ret
mov [redraw_window_flag],0
mcall 12,2
popa
ret
;------------------------------------------------------------------------------
align 4
fill_window:
movzx ebx,word [screenxy+2]
xor ecx,ecx
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_0
imul eax,dword [soften_height]
call subtract_color_change_magnitude
cmp [soften_up],dword 0
je no_su
fill_window:
movzx ebx,word [screenxy+2]
xor ecx,ecx
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_0
imul eax,dword [soften_height]
call subtract_color_change_magnitude
cmp [soften_up],dword 0
je no_su
;--------------------------------------
align 4
@@:
mov eax,COLOR_CHANGE_MAGNITUDE_0
call add_color_change_magnitude
mov eax,COLOR_CHANGE_MAGNITUDE_0
call add_color_change_magnitude
; draw soften_up - the width of 5 pixels
and edx,0x00FFFFFF
mcall 38
and edx,0x00FFFFFF
mcall 38
add ecx,1*65536+1
cmp cx,[soften_height] ;5
jb @r
add ecx,1*65536+1
cmp cx,[soften_height] ;5
jb @r
;--------------------------------------
align 4
no_su:
cmp [soften_down],dword 0
je no_sd
cmp [soften_down],dword 0
je no_sd
; draw soften_down - the width of 5 pixels
pusha
mov esi,[soften_height]
mov ecx,[height]
dec ecx
shl ecx,16
add ecx,[height]
dec ecx
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_0
imul eax,dword [soften_height]
call subtract_color_change_magnitude
pusha
mov esi,[soften_height]
mov ecx,[height]
dec ecx
shl ecx,16
add ecx,[height]
dec ecx
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_0
imul eax,dword [soften_height]
call subtract_color_change_magnitude
;--------------------------------------
align 4
@@:
mov eax,COLOR_CHANGE_MAGNITUDE_0
call add_color_change_magnitude
and edx,0x00FFFFFF
mcall 38
sub ecx,1*65536+1
dec esi
jnz @r
popa
mov eax,COLOR_CHANGE_MAGNITUDE_0
call add_color_change_magnitude
and edx,0x00FFFFFF
mcall 38
sub ecx,1*65536+1
dec esi
jnz @r
popa
;--------------------------------------
align 4
no_sd:
movzx ebx,word [screenxy+2]
xor ecx,ecx
cmp [soften_up],dword 0
je @f
movzx ebx,word [screenxy+2]
xor ecx,ecx
cmp [soften_up],dword 0
je @f
add ecx,[soften_height]
rol ecx,16
add ecx,[soften_height]
add ecx,[soften_height]
rol ecx,16
add ecx,[soften_height]
;--------------------------------------
align 4
@@:
mov edx,[wcolor]
mov edx,[wcolor]
;--------------------------------------
align 4
newline3:
and edx,0x00FFFFFF
mov eax,[height]
cmp [soften_up],dword 0
je @f
and edx,0x00FFFFFF
mov eax,[height]
cmp [soften_up],dword 0
je @f
sub eax,[soften_height]
sub eax,[soften_height]
;--------------------------------------
align 4
@@:
cmp [soften_down],dword 0
je @f
cmp [soften_down],dword 0
je @f
sub eax,[soften_height]
sub eax,[soften_height]
;--------------------------------------
align 4
@@:
mov cx,ax
inc ebx
mcall 13
ret
mov cx,ax
inc ebx
mcall 13
ret
;------------------------------------------------------------------------------
align 4
minimize_left_button:
cmp [minimize_left],dword 0
je .exit
cmp [minimize_left],dword 0
je .exit
mov ecx,1 *65536
add ecx,[height]
dec ecx
mov edx,101
or edx,0x40000000
mcall 8,<0,9>,,,[wcolor] ; ABS LEFT
mov ecx,1 *65536
add ecx,[height]
dec ecx
mov edx,101
or edx,0x40000000
mcall 8,<0,9>,,,[wcolor] ; ABS LEFT
mov ebx,2*65536 ;+6
mov bx,[height]
shr bx,1
sub bx,3
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_2
call add_color_change_magnitude
mov ecx,edx
mcall 4,,,hidetext,1 ; HIDE TEXT
mov ebx,2*65536 ;+6
mov bx,[height]
shr bx,1
sub bx,3
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_2
call add_color_change_magnitude
mov ecx,edx
mcall 4,,,hidetext,1 ; HIDE TEXT
;--------------------------------------
align 4
.exit:
ret
ret
;------------------------------------------------------------------------------
align 4
align 4
minimize_right_button:
cmp [minimize_right],dword 0
je .exit
mov eax,[max_x]
sub eax,77
shl eax,16
mov ebx,eax
add ebx,67
cmp [minimize_right],dword 0
je .exit
mov eax,[max_x]
sub eax,77
shl eax,16
mov ebx,eax
add ebx,67
mov ecx,1 *65536
add ecx,[height]
dec ecx
add ebx,68*65536
mov bx,10 ;9
mov edx,102
or edx,0x40000000
mcall 8,,,,[wcolor] ; ABS RIGHT
mov ecx,1 *65536
add ecx,[height]
dec ecx
add ebx,68*65536
mov bx,10 ;9
mov edx,102
or edx,0x40000000
mcall 8,,,,[wcolor] ; ABS RIGHT
mov ebx,[max_x]
sub ebx,6
shl ebx,16
mov bx,[height]
shr bx,1
sub bx,3
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_2
call add_color_change_magnitude
mov ecx,edx
mov esi,1
mcall 4,,,hidetext+1
mov ebx,[max_x]
sub ebx,6
shl ebx,16
mov bx,[height]
shr bx,1
sub bx,3
mov edx,[wcolor]
mov eax,COLOR_CHANGE_MAGNITUDE_2
call add_color_change_magnitude
mov ecx,edx
mov esi,1
mcall 4,,,hidetext+1
;--------------------------------------
align 4
.exit:
ret
ret
;------------------------------------------------------------------------------
align 4
draw_menu_and_clean_desktop:
pusha
pusha
; check draw for menu
cmp [menu_enable],dword 0
je no_menu
cmp [menu_enable],dword 0
je no_menu
; calculate and draw menu
mov ebx, (0 shl 16) + MENU_SIZE-3
mov ebx, (0 shl 16) + MENU_SIZE-3
; check for left minimize button enabled
cmp [minimize_left],dword 0
je @f
cmp [minimize_left],dword 0
je @f
add ebx, ML_SIZE shl 16
add ebx, ML_SIZE shl 16
;--------------------------------------
align 4
@@:
mov ecx, [height]
mov edx, 0x60d1ff01
mcall 8,,,,[wcolor] ; MENU BUTTON
mov eax,ebx
shr eax,16
mov [menu_button_x.start],eax
mov eax,ebx
and eax,0xffff
mov [menu_button_x.size],eax
mov eax,ecx
shr eax,16
mov [menu_button_y.start],eax
mov eax,ecx
and eax,0xffff
mov [menu_button_y.size],eax
mov edx, 0x60d1ff01
mcall 8,,,,[wcolor] ; MENU BUTTON
mov eax,ebx
shr eax,16
mov [menu_button_x.start],eax
mov eax,ebx
and eax,0xffff
mov [menu_button_x.size],eax
mov eax,ecx
shr eax,16
mov [menu_button_y.start],eax
mov eax,ecx
and eax,0xffff
mov [menu_button_y.size],eax
call calculate_button_y_coordinate_and_size
mov edx,[MenuButton_color] ;0x44aa44
mov esi,[wcolor]
call calculate_button_y_coordinate_and_size
mov edx,[MenuButton_color] ;0x44aa44
mov esi,[wcolor]
add ebx,3 shl 16 - 5
call draw_appl_button
call draw_appl_button
add ebx, 4*65536
mov bx,[height]
shr bx,1
sub bx,7
mov ecx,[PanelText_color]
or ecx,0x10000000
if lang eq et
mcall 4,,,m_text,5
else
mcall 4,,,m_text,4
end if
add ebx, 4*65536
mov bx,[height]
shr bx,1
sub bx,7
mov ecx,[PanelText_color]
or ecx,0x10000000
if lang eq et
mcall 4,,,m_text,5
else
mcall 4,,,m_text,4
end if
;--------------------------------------
align 4
no_menu:
; check draw for clean desktop button
cmp [clean_desktop_enable],dword 0
je .exit
cmp [clean_desktop_enable],dword 0
je .exit
; calculate and draw clean desktop button
mov ebx, (0 shl 16) + CLD_SIZE-5
; check for left minimize button enabled
cmp [minimize_left],dword 0
je @f
mov ebx, (0 shl 16) + CLD_SIZE-5
; check for left minimize button enabled
cmp [minimize_left],dword 0
je @f
add ebx, ML_SIZE shl 16
add ebx, ML_SIZE shl 16
;--------------------------------------
align 4
@@:
; check for menu button enabled
cmp [menu_enable],dword 0
je @f
add ebx, MENU_SIZE shl 16
cmp [menu_enable],dword 0
je @f
add ebx, MENU_SIZE shl 16
;--------------------------------------
align 4
@@:
; Inserted code for drawing buttons 103, 104, 105 (Clean, Restore, Exchange windows)
mov esi, dword [system_colours+24] ; drawing buttons
and esi, 0x00ffffff
mov edx, 0x60000000 + 103
mov esi, dword [system_colours.work_button] ; drawing buttons
and esi, 0x00ffffff
mov edx, 0x60000000 + 103
mov ecx, [height]
mcall 8 ;,,<3,13>
call calculate_button_y_coordinate_and_size
mov edx,[CleanDesktopButton_color] ;time_bgr_color
mov esi,[wcolor]
call draw_appl_button
mcall 8 ;,,<3,13>
call calculate_button_y_coordinate_and_size
mov edx,[CleanDesktopButton_color] ;time_bgr_color
mov esi,[wcolor]
call draw_appl_button
mov ecx,[PanelText_color]
add ebx,5 shl 16
mov bx,[height]
shr bx,1
sub bx,2
mcall 4,,,page_clean_but,1
sub bx,2
mcall ,,,page_clean_but+1
mov ecx,[PanelText_color]
add ebx,5 shl 16
mov bx,[height]
shr bx,1
sub bx,2
mcall 4,,,page_clean_but,1
sub bx,2
mcall ,,,page_clean_but+1
;--------------------------------------
align 4
.exit:
popa
ret
popa
ret
;------------------------------------------------------------------------------
align 4
draw_application_buttons:
pusha
pusha
cmp [run_appl],dword 0 ; do not draw application buttons
je .exit
cmp [run_appl],dword 0 ; do not draw application buttons
je .exit
call calculate_offset_X
call calculate_offset_X
mov eax,[screenxy]
shr eax,16
mov eax,[screenxy]
shr eax,16
sub eax,[offset_X]
sub eax,[offset_X]
; check for left minimize button enabled
cmp [minimize_right],dword 0
je @f
cmp [minimize_right],dword 0
je @f
sub eax, MR_SIZE
sub eax, MR_SIZE
;--------------------------------------
align 4
@@:
cmp [clock_enable],dword 0
je @f
sub eax,CLOCK_SIZE
cmp [clock_enable],dword 0
je @f
sub eax,CLOCK_SIZE
;--------------------------------------
align 4
align 4
@@:
cmp [cpu_usage_enable],dword 0
je @f
sub eax,CPU_USAGE_SIZE
cmp [cpu_usage_enable],dword 0
je @f
sub eax,CPU_USAGE_SIZE
;--------------------------------------
align 4
align 4
@@:
cmp [chlang_enable],dword 0
je @f
sub eax,CHLANG_SIZE
cmp [chlang_enable],dword 0
je @f
sub eax,CHLANG_SIZE
;--------------------------------------
align 4
align 4
@@:
cmp [page_list_enable],dword 0
je @f
sub eax,PAGE_LIST_SIZE
cmp [page_list_enable],dword 0
je @f
sub eax,PAGE_LIST_SIZE
;--------------------------------------
align 4
align 4
@@:
mov ebx, TAB_SIZE
xor edx,edx
div ebx
mov [max_applications], eax
xor edi,edi
mov ebx, TAB_SIZE
xor edx,edx
div ebx
mov [max_applications], eax
xor edi,edi
;--------------------------------------
align 4
.nb:
mov ebx,edi
imul ebx,TAB_SIZE
add ebx,[offset_X]
shl ebx,16
mov bx, TAB_SIZE-1
mov edx,edi
add edx,52
or edx,0x60000000
mov ecx, [height]
mcall 8,,,,[wcolor]
mov ebx,edi
imul ebx,TAB_SIZE
add ebx,[offset_X]
shl ebx,16
mov bx, TAB_SIZE-1
mov edx,edi
add edx,52
or edx,0x60000000
mov ecx, [height]
mcall 8,,,,[wcolor]
inc edi
cmp edi,[max_applications]
jb .nb
inc edi
cmp edi,[max_applications]
jb .nb
;--------------------------------------
align 4
.exit:
popa
ret
popa
ret
;------------------------------------------------------------------------------
align 4
calculate_offset_X:
push eax
xor eax,eax
push eax
xor eax,eax
; check for left minimize button enabled
cmp [minimize_left],dword 0
je @f
cmp [minimize_left],dword 0
je @f
add eax, ML_SIZE
add eax, ML_SIZE
;--------------------------------------
align 4
@@:
@@:
; check for menu button enabled
cmp [menu_enable],dword 0
je @f
add eax, MENU_SIZE
cmp [menu_enable],dword 0
je @f
add eax, MENU_SIZE
;--------------------------------------
align 4
@@:
; check for clean desktop button enabled
cmp [clean_desktop_enable],dword 0
je @f
cmp [clean_desktop_enable],dword 0
je @f
add eax, CLD_SIZE
add eax, CLD_SIZE
;--------------------------------------
align 4
@@:
mov [offset_X],eax
pop eax
ret
mov [offset_X],eax
pop eax
ret
;------------------------------------------------------------------------------

View File

@ -1,109 +1,106 @@
;------------------------------------------------------------------------------
align 4
last_active_window rd 1
prev_active_window rd 1
active_window_changed rd 1
app_tab_count rd 1
last_active_window rd 1
prev_active_window rd 1
active_window_changed rd 1
app_tab_count rd 1
alt_tab_list_size rd 1
alt_tab_list_size rd 1
panel_x_pos rd 1
panel_y_pos rd 1
panel_x_pos rd 1
panel_y_pos rd 1
offset_X rd 1
offset_x_tray rd 1
offset_X rd 1
offset_x_tray rd 1
pos_x_clock rd 1
pos_x_cpu_usage rd 1
pos_x_cpu_chlang rd 1
pos_x_page_list rd 1
pos_x_clock rd 1
pos_x_cpu_usage rd 1
pos_x_cpu_chlang rd 1
pos_x_page_list rd 1
active_slot_number rd 1
active_slot_number rd 1
my_active_slot rd 1
current_active_slot rd 1
my_active_slot rd 1
current_active_slot rd 1
screen_size:
.height rw 1
.width rw 1
.height rw 1
.width rw 1
draw_flag_certainly rb 1
draw_flag_certainly rb 1
start_menu_flag rb 1
win_key_flag rb 1
start_menu_flag rb 1
win_key_flag rb 1
;------------------------------------------------------------------------------
align 4
system_colours system_colors ; rd 10
system_colours system_colors
;------------------------------------------------------------------------------
align 4
app_list rd 50
app_list rd 50
;------------------------------------------------------------------------------
align 4
alt_tab_list rd 256*2
alt_tab_list rd 256*2
;------------------------------------------------------------------------------
align 4
path:
rb 1024
rb 1024
;-----------------------------------------------------------------------------
align 4
library_path:
process_info_buffer:
rb 1024
process_info_buffer process_information
;------------------------------------------------------------------------------
align 4
procinfo_for_detect:
rb 1024
procinfo_for_detect process_information
;------------------------------------------------------------------------------
align 4
procinfo_window_tabs:
rb 1024
procinfo_window_tabs process_information
;-----------------------------------------------------------------------------
align 4
bootparam:
rb 256
rb 256
;------------------------------------------------------------------------------
align 4
tictable:
rd 256
rd 256
;------------------------------------------------------------------------------
align 4
end_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
menu_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
run_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
printscreen_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
calendar_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
sysmeter_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
mousemul_name:
rb 64
rb 64
;------------------------------------------------------------------------------
align 4
rb 256
rb 256
detect_stack:
;------------------------------------------------------------------------------
align 4
rb 256
rb 256
ctx_menu_stack:
;------------------------------------------------------------------------------
align 4
rb 1024
rb 1024
stack_top:
;------------------------------------------------------------------------------

View File

@ -9,15 +9,18 @@
;
use32
org 0x0
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd STARTAPP ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
dd 0x00000000 ; reserved=no extended header
db 'MENUET01'
dd 1 ; version
dd STARTAPP ; program start
dd I_END ; program image size
dd MEM ; size memory for program
dd STACKTOP ; base stack pointer
dd 0
dd 0
include '../../../macros.inc'
include "ASPAPI.INC"
N_KEYCOLOR equ 0x00677889 ; Normal button color
@ -26,30 +29,28 @@ L_KEYCOLOR equ 0x00258778 ; Lock button color
TEXTCOLOR equ 0x00FFFFFF ; Button caption color
ASCII_KEYMAP_SIZE equ 128
PROCINFO_SIZE equ 1024
PROCINFO_BUFF equ ascii_keymap + ASCII_KEYMAP_SIZE
STARTAPP:
mov ecx, 1 ; to send scancodes.
call set_keyboard_mode
mov ecx, 1 ; to send scancodes.
call set_keyboard_mode
call reload_ascii_keymap
call draw_window
jmp get_zkey_window_slot_number
call reload_ascii_keymap
call draw_window
jmp get_zkey_window_slot_number
draw_window:
test byte [red_type], 1
jnz @f
test byte [red_type], 2
jnz .draw_switch_button
test byte [red_type], 1
jnz @f
test byte [red_type], 2
jnz .draw_switch_button
start_draw_window 100,370,600,210,0x14224466,labelt
stdcall draw_button, 15,50,23,20,2,N_KEYCOLOR,keyText,3,TEXTCOLOR ; Esc
stdcall draw_button, 15,50,23,20,2,N_KEYCOLOR,keyText,3,TEXTCOLOR ; Esc
stdcall draw_button, 70,50,23,20,3,N_KEYCOLOR,keyText+3,2,TEXTCOLOR ; F1
stdcall draw_button, 95,50,23,20,4,N_KEYCOLOR,keyText+5,2,TEXTCOLOR ; F2
stdcall draw_button, 120,50,23,20,5,N_KEYCOLOR,keyText+7,2,TEXTCOLOR ; F3
stdcall draw_button, 145,50,23,20,6,N_KEYCOLOR,keyText+9,2,TEXTCOLOR ; F4
stdcall draw_button, 70,50,23,20,3,N_KEYCOLOR,keyText+3,2,TEXTCOLOR ; F1
stdcall draw_button, 95,50,23,20,4,N_KEYCOLOR,keyText+5,2,TEXTCOLOR ; F2
stdcall draw_button, 120,50,23,20,5,N_KEYCOLOR,keyText+7,2,TEXTCOLOR ; F3
stdcall draw_button, 145,50,23,20,6,N_KEYCOLOR,keyText+9,2,TEXTCOLOR ; F4
stdcall draw_button, 183,50,23,20,7,N_KEYCOLOR,keyText+11,2,TEXTCOLOR ; F5
stdcall draw_button, 208,50,23,20,8,N_KEYCOLOR,keyText+13,2,TEXTCOLOR ; F6
@ -77,7 +78,7 @@ draw_window:
stdcall draw_button, 340,80,23,20,28,N_KEYCOLOR,ascii_keymap+43,1,TEXTCOLOR ;keyText+56,2,TEXTCOLOR ; \|
stdcall draw_button, 365,80,30,20,29,N_KEYCOLOR,keyText+58,4,TEXTCOLOR ; bksp
stdcall draw_button, 15 ,103,33,20,30,N_KEYCOLOR,keyText+62,3,TEXTCOLOR ; Tab
stdcall draw_button, 15 ,103,33,20,30,N_KEYCOLOR,keyText+62,3,TEXTCOLOR ; Tab
stdcall draw_button, 50 ,103,23,20,31,N_KEYCOLOR,ascii_keymap+16,1,TEXTCOLOR ;keyText+65,2,TEXTCOLOR ; Q‰
stdcall draw_button, 75 ,103,23,20,32,N_KEYCOLOR,ascii_keymap+17,1,TEXTCOLOR ;keyText+67,2,TEXTCOLOR ; W
stdcall draw_button, 100,103,23,20,33,N_KEYCOLOR,ascii_keymap+18,1,TEXTCOLOR ;keyText+69,2,TEXTCOLOR ; E“
@ -90,9 +91,9 @@ draw_window:
stdcall draw_button, 275,103,23,20,40,N_KEYCOLOR,ascii_keymap+25,1,TEXTCOLOR ;keyText+83,2,TEXTCOLOR ; P‡
stdcall draw_button, 300,103,23,20,41,N_KEYCOLOR,ascii_keymap+26,1,TEXTCOLOR ;keyText+85,3,TEXTCOLOR ; [{•
stdcall draw_button, 325,103,23,20,42,N_KEYCOLOR,ascii_keymap+27,1,TEXTCOLOR ;keyText+88,3,TEXTCOLOR ; ]}š
stdcall draw_button, 350,103,45,43,43,N_KEYCOLOR,keyText+91,5,TEXTCOLOR ; Enter
stdcall draw_button, 350,103,45,43,43,N_KEYCOLOR,keyText+91,5,TEXTCOLOR ; Enter
stdcall draw_button, 15 ,126,43,20,44,L_KEYCOLOR,keyText+96 ,4,TEXTCOLOR ; lock
stdcall draw_button, 15 ,126,43,20,44,L_KEYCOLOR,keyText+96 ,4,TEXTCOLOR ; lock
stdcall draw_button, 60 ,126,23,20,45,N_KEYCOLOR,ascii_keymap+30,1,TEXTCOLOR ;keyText+100,2,TEXTCOLOR ; A”
stdcall draw_button, 85 ,126,23,20,46,N_KEYCOLOR,ascii_keymap+31,1,TEXTCOLOR ;keyText+102,2,TEXTCOLOR ; S
stdcall draw_button, 110,126,23,20,47,N_KEYCOLOR,ascii_keymap+32,1,TEXTCOLOR ;keyText+104,2,TEXTCOLOR ; D
@ -105,7 +106,7 @@ draw_window:
stdcall draw_button, 285,126,23,20,54,N_KEYCOLOR,ascii_keymap+39,1,TEXTCOLOR ;keyText+118,3,TEXTCOLOR ; ;:†
stdcall draw_button, 310,126,23,20,55,N_KEYCOLOR,ascii_keymap+40,1,TEXTCOLOR ;keyText+121,3,TEXTCOLOR ; '"<22>
stdcall draw_button, 15 ,149,53,20,56,C_KEYCOLOR,keyText+124,5,TEXTCOLOR ; Shift
stdcall draw_button, 15 ,149,53,20,56,C_KEYCOLOR,keyText+124,5,TEXTCOLOR ; Shift
stdcall draw_button, 70 ,149,23,20,57,N_KEYCOLOR,ascii_keymap+44,1,TEXTCOLOR ;keyText+129,2,TEXTCOLOR ; ZŸ
stdcall draw_button, 95 ,149,23,20,58,N_KEYCOLOR,ascii_keymap+45,1,TEXTCOLOR ;keyText+131,2,TEXTCOLOR ; X—
stdcall draw_button, 120,149,23,20,59,N_KEYCOLOR,ascii_keymap+46,1,TEXTCOLOR ;keyText+133,2,TEXTCOLOR ; C
@ -117,61 +118,61 @@ draw_window:
stdcall draw_button, 270,149,23,20,65,N_KEYCOLOR,ascii_keymap+52,1,TEXTCOLOR ;keyText+146,3,TEXTCOLOR ; .>ž
stdcall draw_button, 295,149,23,20,66,N_KEYCOLOR,ascii_keymap+53,1,TEXTCOLOR ;keyText+149,2,TEXTCOLOR ; /?
test byte [red_type], 1
jnz @f
stdcall draw_button, 320,149,75,20,67,C_KEYCOLOR,keyText+151,5,TEXTCOLOR ; Shift
test byte [red_type], 1
jnz @f
stdcall draw_button, 320,149,75,20,67,C_KEYCOLOR,keyText+151,5,TEXTCOLOR ; Shift
stdcall draw_button, 15 ,172,30,20,68,C_KEYCOLOR,keyText+156,4,TEXTCOLOR ; Ctrl
stdcall draw_button, 47 ,172,30,20,69,C_KEYCOLOR,keyText+160,3,TEXTCOLOR ; Win
stdcall draw_button, 79 ,172,30,20,70,C_KEYCOLOR,keyText+163,3,TEXTCOLOR ; Alt
stdcall draw_button, 111,172,156,20,71,N_KEYCOLOR,keyText+166,1,TEXTCOLOR ; Space
stdcall draw_button, 269,172,30,20,72,C_KEYCOLOR,keyText+167,3,TEXTCOLOR ; Alt
stdcall draw_button, 301,172,30,20,73,C_KEYCOLOR,keyText+170,3,TEXTCOLOR ; Win
stdcall draw_button, 333,172,30,20,74,C_KEYCOLOR,keyText+173,3,TEXTCOLOR ; [=]
stdcall draw_button, 365,172,30,20,75,C_KEYCOLOR,keyText+176,4,TEXTCOLOR ; Ctrl
stdcall draw_button, 15 ,172,30,20,68,C_KEYCOLOR,keyText+156,4,TEXTCOLOR ; Ctrl
stdcall draw_button, 47 ,172,30,20,69,C_KEYCOLOR,keyText+160,3,TEXTCOLOR ; Win
stdcall draw_button, 79 ,172,30,20,70,C_KEYCOLOR,keyText+163,3,TEXTCOLOR ; Alt
stdcall draw_button, 111,172,156,20,71,N_KEYCOLOR,keyText+166,1,TEXTCOLOR ; Space
stdcall draw_button, 269,172,30,20,72,C_KEYCOLOR,keyText+167,3,TEXTCOLOR ; Alt
stdcall draw_button, 301,172,30,20,73,C_KEYCOLOR,keyText+170,3,TEXTCOLOR ; Win
stdcall draw_button, 333,172,30,20,74,C_KEYCOLOR,keyText+173,3,TEXTCOLOR ; [=]
stdcall draw_button, 365,172,30,20,75,C_KEYCOLOR,keyText+176,4,TEXTCOLOR ; Ctrl
stdcall draw_button, 405,50 ,23,20,76,N_KEYCOLOR,keyText+180,3,TEXTCOLOR ; psc
stdcall draw_button, 430,50 ,23,20,77,L_KEYCOLOR,keyText+183,3,TEXTCOLOR ; slk
stdcall draw_button, 455,50 ,23,20,78,N_KEYCOLOR,keyText+186,3,TEXTCOLOR ; brk
stdcall draw_button, 405,80 ,23,20,79,N_KEYCOLOR,keyText+189,3,TEXTCOLOR ; Ins
stdcall draw_button, 430,80 ,23,20,80,N_KEYCOLOR,keyText+192,2,TEXTCOLOR ; Hm
stdcall draw_button, 455,80 ,23,20,81,N_KEYCOLOR,keyText+194,3,TEXTCOLOR ; Pup
stdcall draw_button, 405,103 ,23,20,82,N_KEYCOLOR,keyText+197,3,TEXTCOLOR ; Del
stdcall draw_button, 430,103 ,23,20,83,N_KEYCOLOR,keyText+200,3,TEXTCOLOR ; End
stdcall draw_button, 455,103 ,23,20,84,N_KEYCOLOR,keyText+203,3,TEXTCOLOR ; Pdn
stdcall draw_button, 430,149,23,20,85,C_KEYCOLOR,keyText+206,1,TEXTCOLOR ; ^
stdcall draw_button, 405,172,23,20,86,C_KEYCOLOR,keyText+207,1,TEXTCOLOR ; v
stdcall draw_button, 430,172,23,20,87,C_KEYCOLOR,keyText+208,1,TEXTCOLOR ; <
stdcall draw_button, 455,172,23,20,88,C_KEYCOLOR,keyText+209,2,TEXTCOLOR ; >
stdcall draw_button, 405,50 ,23,20,76,N_KEYCOLOR,keyText+180,3,TEXTCOLOR ; psc
stdcall draw_button, 430,50 ,23,20,77,L_KEYCOLOR,keyText+183,3,TEXTCOLOR ; slk
stdcall draw_button, 455,50 ,23,20,78,N_KEYCOLOR,keyText+186,3,TEXTCOLOR ; brk
stdcall draw_button, 405,80 ,23,20,79,N_KEYCOLOR,keyText+189,3,TEXTCOLOR ; Ins
stdcall draw_button, 430,80 ,23,20,80,N_KEYCOLOR,keyText+192,2,TEXTCOLOR ; Hm
stdcall draw_button, 455,80 ,23,20,81,N_KEYCOLOR,keyText+194,3,TEXTCOLOR ; Pup
stdcall draw_button, 405,103 ,23,20,82,N_KEYCOLOR,keyText+197,3,TEXTCOLOR ; Del
stdcall draw_button, 430,103 ,23,20,83,N_KEYCOLOR,keyText+200,3,TEXTCOLOR ; End
stdcall draw_button, 455,103 ,23,20,84,N_KEYCOLOR,keyText+203,3,TEXTCOLOR ; Pdn
stdcall draw_button, 430,149,23,20,85,C_KEYCOLOR,keyText+206,1,TEXTCOLOR ; ^
stdcall draw_button, 405,172,23,20,86,C_KEYCOLOR,keyText+207,1,TEXTCOLOR ; v
stdcall draw_button, 430,172,23,20,87,C_KEYCOLOR,keyText+208,1,TEXTCOLOR ; <
stdcall draw_button, 455,172,23,20,88,C_KEYCOLOR,keyText+209,2,TEXTCOLOR ; >
stdcall draw_button, 488,80 ,23,20,89,L_KEYCOLOR,keyText+211,3,TEXTCOLOR ; nlk
stdcall draw_button, 513,80 ,23,20,90,N_KEYCOLOR,keyText+214,1,TEXTCOLOR ; /
stdcall draw_button, 538,80 ,23,20,91,N_KEYCOLOR,keyText+215,1,TEXTCOLOR ; *
stdcall draw_button, 563,80 ,23,20,92,N_KEYCOLOR,keyText+216,1,TEXTCOLOR ; -
stdcall draw_button, 488,103 ,23,20,93,N_KEYCOLOR,keyText+217,1,TEXTCOLOR ; 7
stdcall draw_button, 513,103 ,23,20,94,N_KEYCOLOR,keyText+218,1,TEXTCOLOR ; 8
stdcall draw_button, 538,103 ,23,20,95,N_KEYCOLOR,keyText+219,1,TEXTCOLOR ; 9
stdcall draw_button, 488,126,23,20,96,N_KEYCOLOR,keyText+220,1,TEXTCOLOR ; 4
stdcall draw_button, 513,126,23,20,97,N_KEYCOLOR,keyText+221,1,TEXTCOLOR ; 5
stdcall draw_button, 538,126,23,20,98,N_KEYCOLOR,keyText+222,1,TEXTCOLOR ; 6
stdcall draw_button, 488,149,23,20,99,N_KEYCOLOR,keyText+223,1,TEXTCOLOR ; 1
stdcall draw_button, 513,149,23,20,100,N_KEYCOLOR,keyText+224,1,TEXTCOLOR ; 2
stdcall draw_button, 538,149,23,20,101,N_KEYCOLOR,keyText+225,1,TEXTCOLOR ; 3
stdcall draw_button, 488,172,48,20,102,N_KEYCOLOR,keyText+226,1,TEXTCOLOR ; 0
stdcall draw_button, 538,172,23,20,103,N_KEYCOLOR,keyText+227,1,TEXTCOLOR ; .
stdcall draw_button, 563,103 ,23,43,104,N_KEYCOLOR,keyText+228,1,TEXTCOLOR ; +
stdcall draw_button, 563,149,23,43,105,N_KEYCOLOR,keyText+229,3,TEXTCOLOR ; Ent
stdcall draw_button, 488,80 ,23,20,89,L_KEYCOLOR,keyText+211,3,TEXTCOLOR ; nlk
stdcall draw_button, 513,80 ,23,20,90,N_KEYCOLOR,keyText+214,1,TEXTCOLOR ; /
stdcall draw_button, 538,80 ,23,20,91,N_KEYCOLOR,keyText+215,1,TEXTCOLOR ; *
stdcall draw_button, 563,80 ,23,20,92,N_KEYCOLOR,keyText+216,1,TEXTCOLOR ; -
stdcall draw_button, 488,103 ,23,20,93,N_KEYCOLOR,keyText+217,1,TEXTCOLOR ; 7
stdcall draw_button, 513,103 ,23,20,94,N_KEYCOLOR,keyText+218,1,TEXTCOLOR ; 8
stdcall draw_button, 538,103 ,23,20,95,N_KEYCOLOR,keyText+219,1,TEXTCOLOR ; 9
stdcall draw_button, 488,126,23,20,96,N_KEYCOLOR,keyText+220,1,TEXTCOLOR ; 4
stdcall draw_button, 513,126,23,20,97,N_KEYCOLOR,keyText+221,1,TEXTCOLOR ; 5
stdcall draw_button, 538,126,23,20,98,N_KEYCOLOR,keyText+222,1,TEXTCOLOR ; 6
stdcall draw_button, 488,149,23,20,99,N_KEYCOLOR,keyText+223,1,TEXTCOLOR ; 1
stdcall draw_button, 513,149,23,20,100,N_KEYCOLOR,keyText+224,1,TEXTCOLOR ; 2
stdcall draw_button, 538,149,23,20,101,N_KEYCOLOR,keyText+225,1,TEXTCOLOR ; 3
stdcall draw_button, 488,172,48,20,102,N_KEYCOLOR,keyText+226,1,TEXTCOLOR ; 0
stdcall draw_button, 538,172,23,20,103,N_KEYCOLOR,keyText+227,1,TEXTCOLOR ; .
stdcall draw_button, 563,103 ,23,43,104,N_KEYCOLOR,keyText+228,1,TEXTCOLOR ; +
stdcall draw_button, 563,149,23,43,105,N_KEYCOLOR,keyText+229,3,TEXTCOLOR ; Ent
.draw_switch_button:
mov eax, 6
mul byte [keyboard_mode]
add eax, SwitchText
stdcall draw_button, 513,28,46,20,106,0x00700000,eax,6,TEXTCOLOR ; Scan/ASCII switch
mov eax, 6
mul byte [keyboard_mode]
add eax, SwitchText
stdcall draw_button, 513,28,46,20,106,0x00700000,eax,6,TEXTCOLOR ; Scan/ASCII switch
xor al, al
xchg al, [red_type]
test al, 2
jnz .skip_end_draw_window ; if we draw switch button without redraw window then end_draw_window not need
xor al, al
xchg al, [red_type]
test al, 2
jnz .skip_end_draw_window ; if we draw switch button without redraw window then end_draw_window not need
@@:
.draw_indicators_area:
@ -183,124 +184,125 @@ draw_window:
ret
get_zkey_window_slot_number:
mov eax, 18
mov ebx, 7
int 0x40
mov [zkey_window], eax
mov eax, 18
mov ebx, 7
int 0x40
mov [zkey_window], eax
set_event_mask:
mov eax, 40
mov ebx, 39
int 0x40
mov eax, 40
mov ebx, EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE ; 39 ; 100111b
int 0x40
still:
call get_receiver_window_slot_number
call get_receiver_window_keyboard_mode ; return in ecx keyboard_mode for set_keyboard_mode
call set_keyboard_mode
call get_receiver_window_slot_number
call get_receiver_window_keyboard_mode ; return in ecx keyboard_mode for set_keyboard_mode
call set_keyboard_mode
; delete_switch_button
mov eax, 8
mov edx, 0x80700000
int 0x40
mov byte [red_type], 2
call draw_window.draw_switch_button
mov eax, 8
mov edx, BT_DEL + 0x00700000
int 0x40
mov byte [red_type], 2
call draw_window.draw_switch_button
mov eax, 10 ; Wait for an event in the queue.
int 0x40
mov eax, 10 ; Wait for an event in the queue.
int 0x40
cmp al,1 ; redraw request ?
jz red
cmp al,2 ; key in buffer ?
jz key
cmp al,3 ; button in buffer ?
jz button
cmp al, EV_REDRAW ; redraw request ?
jz red
cmp al, EV_KEY ; key in buffer ?
jz key
cmp al, EV_BUTTON ; button in buffer ?
jz button
jmp still
jmp still
red:
call draw_window
jmp still
call draw_window
jmp still
key:
mov eax, 2
int 0x40
mov eax, 2
int 0x40
; push ax
call get_control_keys_state
cmp [locks], ax
je @f
call get_control_keys_state
cmp [locks], ax
je @f
.reload:
call reload_ascii_keymap
mov byte [red_type], 1
call draw_window
call reload_ascii_keymap
mov byte [red_type], 1
call draw_window
@@:
; pop dx
; jmp button.select_key_code
jmp still
jmp still
button:
mov eax, 17 ; Get pressed button code
int 0x40
cmp ah, 1 ; Test x button
je close_app
mov eax, 17 ; Get pressed button code
int 0x40
cmp ah, 1 ; Test x button
je close_app
cmp ah, 106 ; Test Scan/ASCII switch button
jne .keyboard_keys
mov cl, 1
sub cl, byte [keyboard_mode]
call set_keyboard_mode
mov byte [red_type], 2
jmp red
cmp ah, 106 ; Test Scan/ASCII switch button
jne .keyboard_keys
mov cl, 1
sub cl, byte [keyboard_mode]
call set_keyboard_mode
mov byte [red_type], 2
jmp red
.keyboard_keys:
cmp ah, 2 ; Test if pressed buttons
jb still ; is a ZKEY keyboard key...
cmp ah, 106
jnb still ; ...so, if not then still,
mov [butt], ah ; if yes then save pressed button ID
cmp ah, 2 ; Test if pressed buttons
jb still ; is a ZKEY keyboard key...
cmp ah, 106
jnb still ; ...so, if not then still,
mov [butt], ah ; if yes then save pressed button ID
.test_slot:
mov eax, [zkey_window] ; Test is receiver ZKEY window
mov ecx, [receiver_window]
cmp eax, ecx
je still ; if yes still.
mov eax, [zkey_window] ; Test is receiver ZKEY window
mov ecx, [receiver_window]
cmp eax, ecx
je still ; if yes still.
.activate_receiver_window:
mov eax, 18
mov ebx, 3
int 0x40
mov eax, 18
mov ebx, 3
int 0x40
call reload_ascii_keymap
.read_key_scancode:
xor edx, edx
movzx si, byte [butt] ; Read scan code of the key from the table.
sub si, 2
mov dl, [keyCodes+si] ; Set dl = scancode of the key corresponding to the pressed button.
cmp dl, 0xA0
jb .select_key_code ; If not extended key then select ascii or scan to send and then send it to the receiver.
xor edx, edx
movzx si, byte [butt] ; Read scan code of the key from the table.
sub si, 2
mov dl, [keyCodes+si] ; Set dl = scancode of the key corresponding to the pressed button.
cmp dl, 0xA0
jb .select_key_code ; If not extended key then select ascii or scan to send and then send it to the receiver.
cmp dl, 0xA6 ; Test if it's extended2 key
jne .read_ext_key ; if not go to prepare to send simply extended key.
mov dl, 0xE1 ; Send extended2 scancode...
call send_key
mov dl, 0x1D ; ...and extended scancode,
call send_key ;
mov dl, [keyCodes.ext2] ; (There is only one ext2 key - 'Break')
jmp .send_key_code ; so... send it's normal scan code.
cmp dl, 0xA6 ; Test if it's extended2 key
jne .read_ext_key ; if not go to prepare to send simply extended key.
mov dl, 0xE1 ; Send extended2 scancode...
call send_key
mov dl, 0x1D ; ...and extended scancode,
call send_key ;
mov dl, [keyCodes.ext2] ; (There is only one ext2 key - 'Break')
jmp .send_key_code ; so... send it's normal scan code.
.read_ext_key:
sub dl, 0xA0 ; Read extended key scan code from the table.
movzx si, dl
mov dl, [keyCodes.ext+si]
sub dl, 0xA0 ; Read extended key scan code from the table.
movzx si, dl
mov dl, [keyCodes.ext+si]
.send_ext:
push dx ; Send extended scancode to the receiver's window.
mov dl, 0xE0
call send_key
pop dx
push dx ; Send extended scancode to the receiver's window.
mov dl, 0xE0
call send_key
pop dx
; jmp .send_key_code
.select_key_code: ; Select what to send ASCII or scan.
cmp [keyboard_mode], 0 ; Test if ZKEY must send ASCII.
jne .send_key_code
.select_key_code: ; Select what to send ASCII or scan.
cmp [keyboard_mode], 0 ; Test if ZKEY must send ASCII.
jne .send_key_code
; mov esi, ext0 ; Set esi to the beginning of the ext0 table.
and edx, 0x7F
and edx, 0x7F
; @@:
; cmp dl, byte [esi]
; je .send_key_code
@ -308,24 +310,24 @@ button:
; cmp esi, ext0end
; jng @b
.read_ascii:
mov dl, byte [ascii_keymap+edx] ; Read ASCII from the keymap table.
mov dl, byte [ascii_keymap+edx] ; Read ASCII from the keymap table.
.send_key_code:
call send_key ; Finally send the key to the receiver's window.
call send_key ; Finally send the key to the receiver's window.
.wait:
mov eax, 5
mov ebx, 1 ; Wait 0.01 second.
int 0x40
mov eax, 5
mov ebx, 1 ; Wait 0.01 second.
int 0x40
.activate_zkey_window:
mov eax, 18
mov ebx, 3
mov ecx, [zkey_window]
int 0x40
mov eax, 18
mov ebx, 3
mov ecx, [zkey_window]
int 0x40
jmp still
jmp still
close_app:
mov eax,-1 ; close this program
mov eax,-1 ; close this program
int 0x40
@ -334,16 +336,16 @@ close_app:
;**********************************
set_keyboard_mode:
mov eax, 66
mov ebx, 1 ; Set keyboard mode
int 0x40
mov [keyboard_mode], cl
mov eax, 66
mov ebx, 1 ; Set keyboard mode
int 0x40
mov [keyboard_mode], cl
ret
get_control_keys_state: ; This routine works only in Scan keyboard mode.
mov eax, 66
mov ebx, 3
int 0x40
mov eax, 66
mov ebx, 3
int 0x40
ret
@ -352,65 +354,65 @@ ret
;**********************************
get_keyboard_map:
mov eax, 26
mov ebx, 2
mov edx, ascii_keymap
int 0x40
mov eax, 26
mov ebx, 2
mov edx, ascii_keymap
int 0x40
ret
reload_ascii_keymap:
call get_control_keys_state
mov ecx, 1
call get_control_keys_state
mov ecx, 1
test ax, 3 ; Shift pressed ?
jnz @f
test ax, 0x40 ; Caps Lock on ?
jz .load_ascii_keymap
test ax, 3 ; Shift pressed ?
jnz @f
test ax, 0x40 ; Caps Lock on ?
jz .load_ascii_keymap
@@:
mov ecx, 2
mov ecx, 2
.load_ascii_keymap:
call get_keyboard_map
call get_keyboard_map
ret
get_receiver_window_slot_number:
mov eax, 18
mov ebx, 7
int 0x40
mov ebx, [zkey_window]
cmp eax, ebx
je @f
mov [receiver_window], eax
mov eax, 18
mov ebx, 7
int 0x40
mov ebx, [zkey_window]
cmp eax, ebx
je @f
mov [receiver_window], eax
@@:
ret
get_receiver_window_keyboard_mode:
mov eax, 9
mov ebx, PROCINFO_BUFF
mov ecx, [receiver_window]
int 0x40
movzx ecx, byte [ebx + 75]
ret
mov eax, 9
mov ebx, PROCINFO_BUFF
mov ecx, [receiver_window]
int 0x40
movzx ecx, byte [ebx + process_information.keyboard_mode]
ret
;************************************
;* input: edx = code of the key *
;************************************
send_key:
mov eax, 72
mov ebx, 1
mov ecx, 2
int 0x40
mov eax, 72
mov ebx, 1
mov ecx, 2
int 0x40
ret
lights_on:
bar 491,51,95,15,0 ; indicators area
bar 491,51,95,15,0 ; indicators area
rectangle 490,50,96,16,TEXTCOLOR
call get_control_keys_state
mov [locks], ax
mov [locks], ax
test ax, 0x40
jz @f
;stdcall bar, 532, 53, 10, 11, 0x0000FF00
@ -437,29 +439,29 @@ SwitchText db ' ASCII SCAN '
;Button names
keyText db 'EscF1F2F3F4F5F6F7F8F9F10F11F12'
db '~ð1!2@3#4$5%6^7&8*9(0)-_=+\|bksp'
db 'TabQ‰WE“RŠT…Y<E280A6>UƒI˜O™P‡{[•}]šEnter'
db 'lockA”SDF€G<E282AC>H<EFBFBD>JŽKL„;:†''"<22>'
db 'ShiftZŸX—CVŒBˆNMœ,<<3C>.>ž/?Shift'
db 'CtrlWinAlt AltWin[=]Ctrl'
db 'pscslkbrkInsHmPupDelEndPdn^<v >'
db 'nlk/*-7894561230.+Ent'
db '~ð1!2@3#4$5%6^7&8*9(0)-_=+\|bksp'
db 'TabQ‰WE“RŠT…Y<E280A6>UƒI˜O™P‡{[•}]šEnter'
db 'lockA”SDF€G<E282AC>H<EFBFBD>JŽKL„;:†''"<22>'
db 'ShiftZŸX—CVŒBˆNMœ,<<3C>.>ž/?Shift'
db 'CtrlWinAlt AltWin[=]Ctrl'
db 'pscslkbrkInsHmPupDelEndPdn^<v >'
db 'nlk/*-7894561230.+Ent'
;Key scan codes
keyCodes:
db 0x01, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x57, 0x58
db 0x29, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x2B, 0x0E
db 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C
db 0x3A, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28
db 0x2A, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36
db 0x1D, 0xA0, 0x38, 0x39, 0xA1, 0xA2, 0xA3, 0xA4
db 0xA5, 0x46, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0
db 0x45, 0xB1, 0x37, 0x4A, 0x47, 0x48, 0x49, 0x4B, 0x4C, 0x4D, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x4E, 0xB2
db 0x01, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x57, 0x58
db 0x29, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x2B, 0x0E
db 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C
db 0x3A, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28
db 0x2A, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36
db 0x1D, 0xA0, 0x38, 0x39, 0xA1, 0xA2, 0xA3, 0xA4
db 0xA5, 0x46, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0
db 0x45, 0xB1, 0x37, 0x4A, 0x47, 0x48, 0x49, 0x4B, 0x4C, 0x4D, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x4E, 0xB2
.ext:
db 0x5B, 0x38, 0x5C, 0x5D, 0x1D
db 0x37, 0x00, 0x52, 0x47, 0x49, 0x53, 0x4F, 0x51, 0x48, 0x4B, 0x50, 0x4D
db 0x35, 0x1C
.ext2 db 0x45 ; Just Break :)
db 0x5B, 0x38, 0x5C, 0x5D, 0x1D
db 0x37, 0x00, 0x52, 0x47, 0x49, 0x53, 0x4F, 0x51, 0x48, 0x4B, 0x50, 0x4D
db 0x35, 0x1C
.ext2 db 0x45 ; Just Break :)
;ext0:
; db 0x1D, 0x29, 0x2A, 0x36, 0x37, 0x38, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40
@ -467,14 +469,21 @@ keyCodes:
; db 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x57, 0x58
;ext0end:
receiver_window dd 0 ; Slot number of the receiver
zkey_window dd 0 ; Slot number of ZKEY
butt db 0 ; Pressed button ID
locks dw 0 ; NumLock, CapsLock, ScrollLock lights mask
receiver_window dd 0 ; Slot number of the receiver
zkey_window dd 0 ; Slot number of ZKEY
butt db 0 ; Pressed button ID
locks dw 0 ; NumLock, CapsLock, ScrollLock lights mask
keyboard_mode db 0 ; Scan or ASCII keys to send ? 0 - ASCII , 1 - Scan
red_type db 0 ; Type of window redraw. 0 - default , 1 - on ASCII_keymap change , 2 - Switch button pressed.
keyboard_mode db 0 ; Scan or ASCII keys to send ? 0 - ASCII , 1 - Scan
red_type db 0 ; Type of window redraw. 0 - default , 1 - on ASCII_keymap change , 2 - Switch button pressed.
I_END: ; End of application code and data marker
I_END: ; End of application code and data marker
ascii_keymap: rb ASCII_KEYMAP_SIZE
PROCINFO_BUFF process_information
rb 4096
STACKTOP:
MEM:
ascii_keymap: