New noisy background mode.

git-svn-id: svn://kolibrios.org@4962 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
eAndrew 2014-05-29 17:33:40 +00:00
parent 2a2173154c
commit c0d55c2dac
2 changed files with 215 additions and 178 deletions

View File

@ -6,7 +6,7 @@
;.....................................................................................................
;; compiler: FASM 1.69.31 |
;; version: 0.3.0 |
;; last update: 07/11/2013 |
;; last update: 08/11/2012 |
;; e-mail: dr.steshin@gmail.com |
;.....................................................................................................
;; History: |
@ -34,8 +34,7 @@
;; 0.7.0 - „®¡ ¢«¥­  ¯¨¯¥âª  - ¢ë¡®à ­  á।­îî ª­®¯ªã ¬ëè¨ |
;; 0.7.5 - <20> ¦ â¨¥ ¯à ¢®© ª« ¢¨è¥© ¬ëè¨ ­  ï祩ªã á 梥⮬ ãáâ ­ ¢«¨¢ ¥â ­¥ ®á­®¢®©,   ¤®¯®«­. 梥â |
;; - “¬¥­ì襭® ¬¥àæ ­¨¥ ¯à¨ à ¡®â¥ ¯¨¯¥âª¨ |
;; 0.7.6 - <20>¥à¥à ¡®â ­ ०¨¬ H (hidden): ⥯¥àì æ¢¥â  § £à㦠îâáï ¨§ wallpaper.dat (eAndrew) |
;; - <20>ਠãáâ ­®¢ª¨ ä®­  ª­®¯ª®©, 梥â ä®­  á®åà ­ï¥âáï ¢ wallpaper.dat (eAndrew) |
;; 0.7.6 - „®¡ ¢«¥­ ०¨¬ B, ª®â®àë© ¯à®¨§¢®¤¨â § ¬¥­ã ä®­  à ¡®ç¥£® á⮫  è㬭®© § «¨¢ª®© (e-andrew)|
;.....................................................................................................
;; All rights reserved. |
;; |
@ -71,12 +70,13 @@
dd 0x01
dd START
dd I_END
dd I_RDATA+4096
dd I_RDATA+4096
dd I_MEM
dd I_MEM
dd params
dd 0x0
include '../../../macros.inc'
include '../../../proc32.inc'
WIN_W equ 295 ; è¨à¨­  ®ª­ 
WIN_H equ 195 ; ¢ëá®â  ®ª­ 
@ -160,9 +160,14 @@ button:
jmp still ; “室¨¬ ­  ®¦¨¤ ­¨¥ ¤à㣮£® ᮡëâ¨ï
next_bg:
cmp ah, 14 ; Š­®¯ª  BACKGROUND
jne circle_bg ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
jne next_bg2 ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
call set_background ; ¨­ ç¥ ãáâ ­ ¢«¨¢ ¥¬ ä®­
jmp still ; ¨ ­  ®¦¨¤ ­¨¥ ᮡëâ¨ï
next_bg2:
cmp ah, 16 ; Š­®¯ª  BACKGROUND
jne circle_bg ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
call set_background2 ; ¨­ ç¥ ãáâ ­ ¢«¨¢ ¥¬ ä®­
jmp still ; ¨ ­  ®¦¨¤ ­¨¥ ᮡëâ¨ï
circle_bg:
cmp ah, 15 ; Š­®¯ª  Šà㣮¢ ï ¯ «¨âà 
jne next_end ; ¥á«¨ ­¥ ­ ¦ â  â® ¢ë室¨¬
@ -369,17 +374,34 @@ draw_main:
draw_bottom_panel: ; Žâà¨á®¢ª  ­¨¦­¥© ¯ ­¥«¨
;.................................................................................................
mov eax,8 ; draw button
mov ebx,92 shl 16+100 ; [x] + [size]
mov ebx,(92) shl 16+90 ; [x] + [size]
mov ecx,169 shl 16+16 ; [y] + [size]
mov edx,14 ; ID = 14
mov esi,[sc.work_button] ; RGB
int 0x40 ; call
add ebx, 100 shl 16
add edx, 2
int 0x40
mov eax,4 ; Write string
mov ebx,113 shl 16+174 ; [x] + [y]
mov ecx,[sc.work_button_text] ; RGB
mov ebx,(113 - 104) shl 16+174 ; [x] + [y]
mov ecx,[sc.work_text] ; RGB
or ecx, 1 shl 31
mov edx,bground ; string pointer
mov esi,10 ; count symbol
int 0x40 ; call
mov ecx, [sc.work_button_text]
or ecx, 1 shl 31
add ebx, 106 shl 16
mov edx, bground1
int 0x40
add ebx, 107 shl 16
mov edx, bground2
int 0x40
mov eax,38 ; draw line
mov ebx,4 shl 16+282 ; [start x] + [end x]
mov ecx,163 shl 16+163 ; [start y] + [end y]
@ -468,29 +490,6 @@ set_background:
mov ebx,3 ; <20>®¤äã­ªæ¨ï 3 - ¯¥à¥à¨á®¢ âì ä®­.
int 0x40 ; ‚ë§ë¢ ¥¬
mov eax, [color]
mov [fi.file+0], al
shr eax, 8
mov [fi.file+1], al
shr eax, 8
mov [fi.file+2], al
mov eax, [color2]
mov [fi.file+3], al
shr eax, 8
mov [fi.file+4], al
shr eax, 8
mov [fi.file+5], al
mov [fi.p00], dword 2
mov [fi.p04], dword 0
mov [fi.p08], dword 0
mov [fi.p12], dword 6
mov [fi.p16], dword fi.file
mov [fi.p20], dword 0
mov [fi.p21], dword dat_file
mcall 70, fi
ret
;end_set_background
@ -938,12 +937,12 @@ draw_result:
mov ecx,0x0 ; 0xX0RRGGBB (RR, GG, BB § ¤ îâ 梥â ⥪áâ )
mov edx,cname ; 㪠§ â¥«ì ­  ­ ç «® áâப¨
mov esi,1 ; ¢ë¢®¤¨âì esi ᨬ¢®«®¢
newline_s: ; 横«
newline: ; 横«
int 0x40 ; <20>à¥à뢠­¨¥
add ebx,23 shl 16 ; „®¡ ¢«ï¥¬
add edx,1 ; „®¡ ¢«ï¥¬
cmp [edx],byte 'x' ; ‘à ¢­¥­¨¥ á ¡ ©â®¬ å
jne newline_s ; …᫨ ­¥ ­ã«ì ¨«¨ ­¥ à ¢­®
jne newline ; …᫨ ­¥ ­ã«ì ¨«¨ ­¥ à ¢­®
;.................................................................................................
; Žâà¨á®¢ª  á« ©¤¥à®¢
@ -1041,88 +1040,64 @@ draw_value:
;end_draw_value
_read_params:
mov [fi.p00], dword 0
mov [fi.p04], dword 0
mov [fi.p08], dword 0
mov [fi.p12], dword 6
mov [fi.p16], dword fi.file
mov [fi.p20], dword 0
mov [fi.p21], dword dat_file
mcall 70, fi
xor eax, eax
mov al, [fi.file+2]
shl eax, 8
mov al, [fi.file+1]
shl eax, 8
mov al, [fi.file+0]
mov [color], eax
mov al,[params+2]
mov [params_c+0],al
xor eax, eax
mov al, [fi.file+5]
shl eax, 8
mov al, [fi.file+4]
shl eax, 8
mov al, [fi.file+3]
mov [color2], eax
mov al,[params+3]
mov [params_c+1],al
; mov al,[params+2]
; mov [params_c+0],al
;
; mov al,[params+3]
; mov [params_c+1],al
;
; mov al,[params+4]
; mov [params_c+2],al
;
; mov al,[params+5]
; mov [params_c+3],al
;
; mov al,[params+6]
; mov [params_c+4],al
;
; mov al,[params+7]
; mov [params_c+5],al
;
; mov al,[params+8]
; mov [params_c+6],al
;
; mov al,[params+9]
; mov [params_c+7],al
;
; mov esi,params_c
; mov ecx,16
; call ascii2int
; mov [color],eax
;
; mov al,[params+11]
; mov [params_c+0],al
;
; mov al,[params+12]
; mov [params_c+1],al
;
; mov al,[params+13]
; mov [params_c+2],al
;
; mov al,[params+14]
; mov [params_c+3],al
;
; mov al,[params+15]
; mov [params_c+4],al
;
; mov al,[params+16]
; mov [params_c+5],al
;
; mov al,[params+17]
; mov [params_c+6],al
;
; mov al,[params+18]
; mov [params_c+7],al
;
; mov esi,params_c
; mov ecx,16
; call ascii2int
; mov [color2],eax
mov al,[params+4]
mov [params_c+2],al
mov al,[params+5]
mov [params_c+3],al
mov al,[params+6]
mov [params_c+4],al
mov al,[params+7]
mov [params_c+5],al
mov al,[params+8]
mov [params_c+6],al
mov al,[params+9]
mov [params_c+7],al
mov esi,params_c
mov ecx,16
call ascii2int
mov [color],eax
mov al,[params+11]
mov [params_c+0],al
mov al,[params+12]
mov [params_c+1],al
mov al,[params+13]
mov [params_c+2],al
mov al,[params+14]
mov [params_c+3],al
mov al,[params+15]
mov [params_c+4],al
mov al,[params+16]
mov [params_c+5],al
mov al,[params+17]
mov [params_c+6],al
mov al,[params+18]
mov [params_c+7],al
mov esi,params_c
mov ecx,16
call ascii2int
mov [color2],eax
ret
@ -1273,58 +1248,114 @@ str_len:
;end_str_len
;-------------------------------
proc random uses ebx ecx edx, max_value
mov ebx, 0
mov eax, ebx
or eax, eax
jnz @f
rdtsc
xor eax, edx
mov ebx, eax
@@:
xor edx, edx
mov ecx, 127773
div ecx
mov ecx, eax
mov eax, 16807
mul edx
mov edx, ecx
mov ecx, eax
mov eax, 2836
mul edx
sub ecx, eax
xor edx, edx
mov eax, ecx
mov ebx, ecx
mov ecx, 100000
div ecx
mov eax, edx
xor edx, edx
mov ebx, [max_value]
div ebx
mov eax, edx
ret
endp
set_background2:
mcall 68, 11
mcall 68, 12, 256 * 256 * 3
mov [image], eax
mov edx, eax
mov ecx, 256 * 256
@@:
stdcall random, 15 + 1
sub al, 15 / 2
mov bh, byte [color + 0]
add bh, al
mov [edx + 0], bh
mov bh, byte [color + 1]
add bh, al
mov [edx + 1], bh
mov bh, byte [color + 2]
add bh, al
mov [edx + 2], bh
add edx, 3
loop @b
mcall 15, 1, 256, 256
mcall 15, 4, 1
mcall 15, 5, [image], 0, 256 * 256 * 3
mcall 15, 3
mcall 68, 13, [image]
ret
;#___________________________________________________________________________________________________
;****************************************************************************************************|
; <20>ŽŠ <20><EFBFBD>…Œ…<C592><E280A6>ˆ ŠŽ<C5A0><E28099> |
;----------------------------------------------------------------------------------------------------/
circle:
dat_file db '/sys/settings/wallpaper.dat', 0
cm db 12 dup(0)
color dd 00000000h ; åà ­¨â §­ ç¥­¨¥ ¢ë¡à ­­®£® 梥â 
color2 dd 00FFFFFFh ; åà ­¨â §­ ç¥­¨¥ ¢â®à®£® ¢ë¡à ­­®£® 梥â 
mouse_x dd 0 ; åà ­¨â £«®¡ «ì­ãî å ª®®à¤¨­ âã ¬ëè¨
mouse_y dd 0 ; åà ­¨â £«®¡ «ì­ãî ã ª®®à¤¨­ âã ¬ëè¨
mouse_f dd 0 ; åà ­¨â ¤ ­­ë¥ ® ⮬ ª ª ï ª­®¯ª  ¬ëè¨ ¡ë«  ­ ¦ â 
desctop_w dd 0 ; åà ­¨â è¨à¨­ã íªà ­ 
desctop_h dd 0 ; åà ­¨â ¢ëá®âã íªà ­ 
sc system_colors ; åà ­¨â áâàãªâãàã á¨á⥬­ëå 梥⮢ ᪨­ 
title db 'Palitra v0.75',0 ; åà ­¨â ¨¬ï ¯à®£à ¬¬ë
title db 'Palitra v0.76',0 ; åà ­¨â ¨¬ï ¯à®£à ¬¬ë
hidden db 'Hidden',0
hex db '#',0 ; ¤«ï ¢ë¢®¤  à¥èñ⪨ ª ª ⥪áâ 
cname db 'RGBAx' ; åà ­¨â à §àï¤ë 梥⮢ (red,green,blue) x-¬¥âª  ª®­æ 
cred db 0 ; åà ­¨¬ ªà á­ë© ᯥªàâ
cgreen db 0 ; åà ­¨¬ §¥«¥­ë© ᯥªâà
cblue db 0 ; åà ­¨¬ ᨭ¨© ᯥªâà
calpha db 0 ; åà ­¨¬ ¯à®§à ç­®áâì
larrow db 0x1A,0
buff db '000',0
bground db 'BACKGROUND',0 ; ¨¬ï ª­®¯ª¨ - 14
pnext dd 0 ; áç¥â稪 ¯¥à¥ª«î祭¨ï ¯ «¨âàë
renmode dd 0 ; ०¨¬ ®âà¨á®¢ª¨ (1-梥⮢ ï á奬 ,2-¯¨¯¥âª ,3-ªà㣮¢ ï)
bground1 db 'Gradient',0 ; ¨¬ï ª­®¯ª¨ - 14
bground2 db 'Noisy',0 ; ¨¬ï ª­®¯ª¨ - 14
runmode dd 1 ; ०¨¬ § ¯ã᪠ (1-normal, 2-hidden, 3-colordialog)
params db 20 dup(0) ; ¯à¨ñ¬ ¯ à ¬¥â஢
; params_c db 9 dup(0) ; ¯à¨ñ¬­¨ª ¤«ï 梥â 
color2 dd 00FFFFFFh ; åà ­¨â §­ ç¥­¨¥ ¢â®à®£® ¢ë¡à ­­®£® 梥â 
I_END:
cm rb 12
color rd 1 ; åà ­¨â §­ ç¥­¨¥ ¢ë¡à ­­®£® 梥â 
mouse_x rd 1 ; åà ­¨â £«®¡ «ì­ãî å ª®®à¤¨­ âã ¬ëè¨
mouse_y rd 1 ; åà ­¨â £«®¡ «ì­ãî ã ª®®à¤¨­ âã ¬ëè¨
mouse_f rd 1 ; åà ­¨â ¤ ­­ë¥ ® ⮬ ª ª ï ª­®¯ª  ¬ëè¨ ¡ë«  ­ ¦ â 
desctop_w rd 1 ; åà ­¨â è¨à¨­ã íªà ­ 
desctop_h rd 1 ; åà ­¨â ¢ëá®âã íªà ­ 
sc system_colors ; åà ­¨â áâàãªâãàã á¨á⥬­ëå 梥⮢ ᪨­ 
cred rb 1 ; åà ­¨¬ ªà á­ë© ᯥªàâ
cgreen rb 1 ; åà ­¨¬ §¥«¥­ë© ᯥªâà
cblue rb 1 ; åà ­¨¬ ᨭ¨© ᯥªâà
calpha rb 1 ; åà ­¨¬ ¯à®§à ç­®áâì
pnext rd 1 ; áç¥â稪 ¯¥à¥ª«î祭¨ï ¯ «¨âàë
renmode rd 1 ; ०¨¬ ®âà¨á®¢ª¨ (1-梥⮢ ï á奬 ,2-¯¨¯¥âª ,3-ªà㣮¢ ï)
params rb 20 ; ¯à¨ñ¬ ¯ à ¬¥â஢
params_c rb 9 ; ¯à¨ñ¬­¨ª ¤«ï 梥â 
image rd 1
fi:
.p00:
rd 1
.p04:
rd 1
.p08:
rd 1
.p12:
rd 1
.p16:
rd 1
.p20:
rb 1
.p21:
rd 1
.file:
rb 32
I_RDATA:
rd 1024
I_MEM:

View File

@ -1,25 +1,31 @@
mov edi,params ; указатель на строку
call str_len ; получаем длину строки
cmp eax,0 ; стравниваем длину с нулём
je red ; если параметров нет то уходим
call _read_params ; иначе читаем параметры цвета (очень криво)
xor eax,eax ; зануляем регистр
mov al,byte [params] ; читаем параметр мода
cmp al,'N' ; сравниваем с normal mode
jne _no_normalmode ; если нет то уходим на проверку дальше
mov [runmode],1 ; если да то устанавливаем его
jmp red ; идём на отрисовку
_no_normalmode: ; если не normal mode то
cmp al,'H' ; возможно hidden mode
jne _no_hiddenmode ; если не он то уходим дальше
mov [runmode],2 ; если он то устанавливаем что это он (нах?)
call set_background ; меняем фон
jmp bexit ; и закрываем прогу
_no_hiddenmode: ; если не hidden mode
cmp al,'D' ; возможно это color dialog mode
jne _no_dialogmode ; если всё таки не он то уходим
mov [runmode],3 ; иначе указываем что это таки он
jmp red ; и уходим на выполнение
_no_dialogmode: ; если это ни один из заявленых модов
mov [runmode],1 ; то сбрасываем на дефолт
jmp red ; и рисуем
mov edi,params ; 㪠§ â¥«ì ­  áâபã
call str_len ; ¯®«ãç ¥¬ ¤«¨­ã áâப¨
cmp eax,0 ; áâà ¢­¨¢ ¥¬ ¤«¨­ã á ­ã«ñ¬
je red ; ¥á«¨ ¯ à ¬¥â஢ ­¥â â® ã室¨¬
call _read_params ; ¨­ ç¥ ç¨â ¥¬ ¯ à ¬¥âàë æ¢¥â  (®ç¥­ì ªà¨¢®)
xor eax,eax ; § ­ã«ï¥¬ ॣ¨áâà
mov al,byte [params] ; ç¨â ¥¬ ¯ à ¬¥âà ¬®¤ 
cmp al,'N' ; áà ¢­¨¢ ¥¬ á normal mode
jne _no_normalmode ; ¥á«¨ ­¥â â® ã室¨¬ ­  ¯à®¢¥àªã ¤ «ìè¥
mov [runmode],1 ; ¥á«¨ ¤  â® ãáâ ­ ¢«¨¢ ¥¬ ¥£®
jmp red ; ¨¤ñ¬ ­  ®âà¨á®¢ªã
_no_normalmode: ; ¥á«¨ ­¥ normal mode â®
cmp al,'H' ; ¢®§¬®¦­® hidden mode
jne _no_hiddenmode ; ¥á«¨ ­¥ ®­ â® ã室¨¬ ¤ «ìè¥
mov [runmode],2 ; ¥á«¨ ®­ â® ãáâ ­ ¢«¨¢ ¥¬ çâ® íâ® ®­ (­ å?)
call set_background ; ¬¥­ï¥¬ ä®­
jmp bexit ; ¨ § ªà뢠¥¬ ¯à®£ã
_no_hiddenmode: ; ¥á«¨ ­¥ hidden mode
cmp al,'B' ; ¢®§¬®¦­® noise mode
jne _no_noisemode ; ¥á«¨ ­¥ ®­ â® ã室¨¬ ¤ «ìè¥
mov [runmode],2 ; ¥á«¨ ®­ â® ãáâ ­ ¢«¨¢ ¥¬ çâ® íâ® ®­ (­ å?)
call set_background2 ; ¬¥­ï¥¬ ä®­
jmp bexit ; ¨ § ªà뢠¥¬ ¯à®£ã
_no_noisemode: ; ¥á«¨ ­¥ noise mode
cmp al,'D' ; ¢®§¬®¦­® íâ® color dialog mode
jne _no_dialogmode ; ¥á«¨ ¢áñ â ª¨ ­¥ ®­ â® ã室¨¬
mov [runmode],3 ; ¨­ ç¥ 㪠§ë¢ ¥¬ çâ® íâ® â ª¨ ®­
jmp red ; ¨ ã室¨¬ ­  ¢ë¯®«­¥­¨¥
_no_dialogmode: ; ¥á«¨ íâ® ­¨ ®¤¨­ ¨§ § ï¢«¥­ëå ¬®¤®¢
mov [runmode],1 ; â® á¡à á뢠¥¬ ­  ¤¥ä®«â
jmp red ; ¨ à¨á㥬