-

15:32 03.04.2014
: 1
14:41 05.09.2012
: 14
     -
-
00:46 02.04.2012
: 8

 -

 -

  • .. (1)
  • (1)
  • (351)
  •     (42)
  •     (12)
  •     (5)
  •     (4)
  •     (4)
  •     (3)
  •     (1)
  • (176)
  •     (7)
  •    , , (5)
  •     (4)
  •     (2)
  •     (1)
  •     (1)
  •     (1)
  •     (1)
  • - (125)
  •    , , (20)
  •     (20)
  •    , , (16)
  •     (13)
  •     - , , (13)
  •     (2)
  •     (1)
  • (26)
  •     (3)
  •     .. (1)
  •     (1)
  • - (33)
  •    - (4)
  •     (2)
  •     (2)
  •     (2)
  • (1)
  • (12)
  •     (2)
  • (9)
  • , , (17)
  • (201)
  •     (36)
  •     (9)
  •     (7)
  •     (2)
  • (178)
  • (139)
  • (249)
  • (75)
  • (28)
  •     (2)
  • (42)
  • (24)
  • (19)
  • "" (17)
  • ! (19)
  • , ! (5)
  • playcast (5)

 -

   langrig

 - e-mail

 

 -

 LiveInternet.ru:
: 17.02.2007
: 1770
: 6889
: 15994

:


, 23 2009 . 00:11 +
, , "" , Print Screen !
!

( ) :
;-----------------------------------------
; Scramble.asm -- "Scrambles the screen"
; is based on Charles Petzold's Scramble.C
;
; Ron Thomas 23/6/99
;
; Ron_Thom@Compuserve.com
;-----------------------------------------

.386 ; 32 bit when .386 appears before .MODEL
.MODEL FLAT,STDCALL

include windows.inc

include user32.inc
include kernel32.inc
include gdi32.inc

includelib user32.lib
includelib kernel32.lib
includelib gdi32.lib

.data

NUM EQU 300

WinMain PROTO :DWORD, :DWORD, :DWORD, :SDWORD


random_init DD 1010111000110111101010011011b ; Seed for random number

.data?

iKeep DD NUM*4 DUP (?) ; NUM sets of rectangle coordinates
hInstance HINSTANCE ?
CommandLine LPSTR ?

Scramble_Coord MACRO multiplier, coordID, offval ;; offval is an offset value

mov al,16 ;; Get random number 16 bits big (in eax)
call random
mov ecx,10
mov edx,0
div ecx ;; modulus 10 divide
mov eax,edx ;; put remainder into eax
mov edx,0
mul multiplier ;; Multiply by cxx or cy
mov coordID,eax ;; set x1,y1,x2 or y2 coord for rectangle
mov iKeep[ebx+offval],eax ;; also store in Keep array

ENDM
;---------------------------------------------------------------------------
.code
start:
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
invoke ExitProcess,eax

WinMain proc uses ebx esi edi ,hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:SDWORD

LOCAL hwnd:HWND, hBitmap:HBITMAP, hdcScr:HDC
LOCAL hdcMem:HDC, cxx:DWORD, cy:DWORD, x1:DWORD, y1:DWORD, x2:DWORD, y2:DWORD

invoke GetDesktopWindow ; Get handle
mov hwnd,eax
invoke LockWindowUpdate, eax

.IF eax

invoke GetDCEx, hwnd, NULL, DCX_CACHE or DCX_LOCKWINDOWUPDATE
mov hdcScr,eax

invoke CreateCompatibleDC, eax
mov hdcMem,eax

invoke GetSystemMetrics, SM_CXSCREEN
mov ecx,10
mov edx,0
div ecx ; div by 10
mov cxx,eax

invoke GetSystemMetrics, SM_CYSCREEN
mov ecx,10
mov edx,0
div ecx
mov cy,eax

invoke CreateCompatibleBitmap, hdcScr, cxx, cy
mov hBitmap,eax

invoke SelectObject, hdcMem, hBitmap

mov esi,0
; Loop twice; once to scramble, then
.WHILE esi < 2 ; once more unscramble the mess

mov ebx,0 ; Index to coordinates

.WHILE ebx < NUM*4*4 ; NUM sets of 4 DWORD coords

.IF esi==0 ; Scramble screen

Scramble_Coord cxx, x1, 0 ; Get scrambled x1 coordinate
Scramble_Coord cy, y1, 4 ; y1
Scramble_Coord cxx, x2, 8 ; x2
Scramble_Coord cy, y2, 12 ; y2

.ELSE ; Restore original screen in reverse order

mov edi,NUM*16 ; Start with last coordinates in array
sub edi,16 ; Point at start of coord set
sub edi,ebx ; and work back to the begining

mov eax,iKeep[edi]
mov x1,eax

mov eax,iKeep[edi+4]
mov y1,eax

mov eax,iKeep[edi+8]
mov x2,eax

mov eax,iKeep[edi+12]
mov y2,eax

.ENDIF

invoke BitBlt, hdcMem, 0, 0, cxx, cy, hdcScr, x1, y1, SRCCOPY
invoke BitBlt, hdcScr, x1, y1, cxx, cy, hdcScr, x2, y2, SRCCOPY
invoke BitBlt, hdcScr, x2, y2, cxx, cy, hdcMem, 0, 0, SRCCOPY

invoke Sleep, 10

add ebx,4*4 ; Increment to next set of rectangle coordinates

.ENDW

inc esi
.ENDW

invoke DeleteDC, hdcMem
invoke ReleaseDC, hwnd, hdcScr
invoke DeleteObject, hBitmap

invoke LockWindowUpdate, NULL

.ENDIF

mov eax, FALSE

ret
WinMain endp

random proc uses ebx
;-----------------------------------------------;
; Generate Pseudo Random number (Fast) ;
; ;
; Entry: al = size of random number ;
; ;
; Return: eax = random number, cl bits in size ;
;-----------------------------------------------;
mov cl,al
xor eax,eax
mov bl,byte ptr random_init
and bl,1
EVEN
Gen_bit: ; make n bit numbers
shl eax,1

mov edx,random_init ; Copy seed

shr edx,9
xor bl,dl

shr edx,5
xor bl,dl

bt ebx,1 ; Copy bit 1 to carry flag
rcr random_init,1 ; Rotate seed right 1 bit

setc bl ; Set bl TRUE if carry is set
or al,bl

dec cl
jnz Gen_bit

ret
random endp

end start

------------------------------------------------------------------------------


: .

!

: [1] []
 

:
: 

: ( )

:

  URL