Subversion Repositories Kolibri OS

Rev

Rev 145 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. format ELF
  2. section '.text' executable
  3.  
  4. public _msys_draw_window
  5. _msys_draw_window:
  6. ;arg1 - xcoord
  7. ;arg2 - ycoord
  8. ;arg3 - xsize
  9. ;arg4 - ysize
  10. ;arg5 - workcolor
  11. ;arg6 - type
  12. ;arg7 - captioncolor
  13. ;arg8 - windowtype
  14. ;arg9 - bordercolor
  15.   push ebp
  16.   mov  ebp,esp
  17.   push ebx esi edi
  18.   mov  ebx,[ebp+8]
  19.   shl  ebx,16
  20.   mov  bx,[ebp+16]
  21.   mov  ecx,[ebp+12]
  22.   shl  ecx,16
  23.   mov  cx,[ebp+20]
  24.   mov  edx,[ebp+28]
  25.   shl  edx,24
  26.   add  edx,[ebp+24]
  27.   mov  esi,[ebp+36]
  28.   shl  esi,24
  29.   add  esi,[ebp+32]
  30.   mov  edi,[ebp+40]
  31.   xor  eax,eax
  32.   int  0x40
  33.   pop  edi esi ebx
  34.   pop  ebp
  35.   ret
  36.  
  37. public _msys_read_file
  38. _msys_read_file:
  39. ;arg1 - file name
  40. ;arg2 - file offset
  41. ;arg3 - size to read
  42. ;arg4 - data
  43. ;arg5 - temp buffer
  44. ;arg6 - file size
  45.   push  ebp
  46.   mov   ebp,esp
  47.   xor   eax,eax
  48.   mov   [file_struct.operation],eax
  49.   mov   eax,[ebp+12]
  50.   mov   [file_struct.offset],eax
  51.   mov   eax,[ebp+16]
  52.   mov   [file_struct.offset],eax
  53.   mov   eax,[ebp+20]
  54.   mov   [file_struct.offset],eax
  55.   mov   [file_struct.temp_buffer],temp_buffer
  56.   mov   edx,[ebp+8]
  57.   call  copy_file_name
  58.   push  ebx
  59.   mov   ebx,file_struct
  60.   mov   eax,58
  61.   int   0x40
  62.   mov   ecx,[ebp+28]
  63.   test  ecx,ecx
  64.   jz    .no_file_size
  65.   mov   [ecx],ebx
  66. .no_file_size:
  67.   pop   ebx
  68.   pop   ebp
  69.   ret
  70.  
  71. copy_file_name:
  72.   push  esi edi
  73.   cld
  74.   mov   edi,edx
  75.   xor   eax,eax
  76.   xor   ecx,ecx
  77.   dec   ecx
  78.   repnz scasb
  79.   not   ecx
  80.   mov   edi,file_struct.path
  81.   mov   esi,edx
  82.   rep   movsb
  83.   pop   edi esi
  84.   ret
  85.  
  86. public _msys_write_file
  87. _msys_write_file:
  88. ;arg1 - file name
  89. ;arg2 - size
  90. ;arg3 - data
  91.   push  ebp
  92.   mov   ebp,esp
  93.   xor   eax,eax
  94.   mov   [file_struct.offset],eax
  95.   inc   eax
  96.   mov   [file_struct.operation],eax
  97.   mov   eax,[ebp+12]
  98.   mov   [file_struct.size],eax
  99.   mov   eax,[ebp+16]
  100.   mov   [file_struct.data],eax
  101.   mov   [file_struct.temp_buffer],temp_buffer
  102.   mov   edx,[ebp+8]
  103.   call  copy_file_name
  104.   push  ebx
  105.   mov   eax,58
  106.   mov   ebx,file_struct
  107.   int   0x40
  108.   pop   ebx
  109.   pop   ebp
  110.   ret
  111.  
  112. public _msys_run_program
  113. _msys_run_program:
  114. ;arg1 - program name
  115. ;arg2 - parameters
  116.   push  ebp
  117.   mov   ebp,esp
  118.   mov   [file_struct.operation],16
  119.   xor   eax,eax
  120.   mov   [file_struct.offset],eax
  121.   mov   [file_struct.data],eax
  122.   mov   eax,[ebp+12]
  123.   mov   [file_struct.param],eax
  124.   mov   [file_struct.temp_buffer],temp_buffer;
  125.   mov   edx,[ebp+8]
  126.   call  copy_file_name
  127.   push  ebx
  128.   mov   eax,58
  129.   mov   ebx,file_struct
  130.   int   0x40
  131.   pop   ebx
  132.   pop   ebp
  133.   ret
  134.  
  135. public _msys_debug_out
  136. _msys_debug_out:
  137. ;arg1 - char to out
  138.   push  ebx
  139.   mov   ecx,[esp+8]
  140.   mov   ebx,1
  141.   mov   eax,63
  142.   int   0x40
  143.   pop   ebx
  144.   ret
  145. section '.data' writeable
  146. section '.bss' writeable
  147. file_struct:
  148. .operation   rd 1
  149. .offset      rd 1
  150. .param:
  151. .size        rd 1
  152. .data        rd 1
  153. .temp_buffer rd 1
  154. .path        rb 1024
  155.   temp_buffer rb 4096
  156.