Advertisement
dllbridge

MS COFF (FASM)

Nov 22nd, 2022
1,338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. include    'win32a.inc'
  3.  
  4.  
  5. format      MS COFF
  6.  
  7.  
  8. public     _RGB                     as '__RGB@12'
  9. public     _decomposition_RGB       as '__decomposition_RGB@4'
  10.  
  11.  
  12.  
  13. section   '.text' code readable executable
  14. ;/////////////////////////////////////////////////////////////
  15. proc   _RGB   red, green, blue                             ;//
  16.  
  17.         mov  eax , [green]
  18.         mov  ebx , [blue]
  19.  
  20.         shl  eax  ,  8
  21.         shl  ebx  , 16
  22.         add  eax  , ebx
  23.         add  eax  ,[red]
  24.         ret
  25. endp
  26.  
  27.  
  28.  
  29. ;/////////////////////////////////////////////////////////////
  30. proc   _decomposition_RGB   color                           ;//
  31.  
  32.  
  33.         mov   ebx, [color]
  34.         mov   eax, 0
  35.         mov   al, bl
  36.         mov  [arr +  4], eax   ; Red
  37.         shr   ebx, 8
  38.         mov   al, bl
  39.         mov  [arr +  8], eax   ; Green
  40.         shr   ebx, 8
  41.         mov   al, bl
  42.         mov  [arr + 12], eax   ; Blue
  43.  
  44.         shr   ebx, 8
  45.         mov  [arr], ebx        ; То, что хранится в неиспользуемом байте
  46.         mov   eax , arr
  47.         ret
  48. endp
  49.  
  50.  
  51. section '.data' data readable writeable
  52. ;-------------------------------------------------------------     Создание переменных:
  53.    arr   dd   4 dup(333)
  54.  
  55.      
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement