Subversion Repositories Kolibri OS

Rev

Rev 374 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. format MS COFF
  2.  
  3. include "snd.inc"
  4. include "proc32.inc"
  5.  
  6. section '.text' align 16 code readable executable
  7.  
  8. public _InitSound@4
  9. public _CreateBuffer@12
  10. public _DestroyBuffer@4
  11.  
  12. align 4
  13. _InitSound@4:       ;p_ver:dword
  14.  
  15.            push ebx
  16.            push ecx
  17.  
  18.            mov eax, 68
  19.            mov ebx, 16
  20.            mov ecx, szInfinity
  21.            int 0x40
  22.            mov [hSound], eax
  23.            test eax, eax
  24.            jz .fail
  25.  
  26.            mov eax, 68
  27.            mov ebx, 16
  28.            mov ecx, szSound
  29.            int 0x40
  30.            mov [hrdwSound], eax
  31.  
  32.            lea eax, [esp+12]   ;p_ver
  33.            xor ebx, ebx
  34.  
  35.            push 4              ;.out_size
  36.            push eax            ;.output
  37.            push ebx            ;.inp_size
  38.            push ebx            ;.input
  39.            push SRV_GETVERSION ;.code
  40.            push [hSound]       ;.handle
  41.  
  42.            mov eax, 68
  43.            mov ebx, 17
  44.            mov ecx, esp        ;[handle]
  45.            int 0x40
  46.            add esp, 24
  47.            pop ecx  
  48.            pop ebx
  49.            ret 4
  50. .fail:
  51.            or eax, -1
  52.            pop ecx  
  53.            pop ebx
  54.            ret 4
  55.  
  56.  
  57. align 4
  58. _CreateBuffer@12:   ;format:dword,size:dword,p_str:dword
  59.  
  60.            push ebx
  61.            push ecx
  62.            lea eax, [esp+20]   ;p_str
  63.            lea ebx, [esp+12]   ;format
  64.  
  65.            push 4              ;.out_size
  66.            push eax            ;.output
  67.            push 8              ;.inp_size
  68.            push ebx            ;.input
  69.            push SND_CREATE_BUFF;.code
  70.            push [hSound]       ;.handle
  71.  
  72.            mov eax, 68
  73.            mov ebx, 17
  74.            mov ecx, esp
  75.            int 0x40
  76.            add esp, 24       ;io_cintrol
  77.            pop ecx
  78.            pop ebx
  79.            ret 12
  80.  
  81. align 4
  82. _DestroyBuffer@4:     ;str:dword
  83.  
  84.            push ebx
  85.            push ecx
  86.  
  87.            xor eax, eax
  88.            lea ebx, [esp+12]   ;[stream]
  89.  
  90.            push eax            ;.out_size
  91.            push eax            ;.output
  92.            push 4              ;.inp_size
  93.            push ebx            ;.input
  94.            push SND_DESTROY_BUFF;.code
  95.            push [hSound]       ;.handle
  96.  
  97.            mov eax, 68
  98.            mov ebx, 17
  99.            mov ecx, esp        ;[handle]
  100.            int 0x40
  101.            add esp, 24
  102.            pop ecx
  103.            pop ebx
  104.            ret 4
  105.  
  106.  
  107. section '.data' align 16 data readable writable
  108.  
  109. public hSound
  110. public hrdwSound
  111.  
  112. hSound      dd ?
  113. hrdwSound   dd ?
  114.  
  115. szInfinity  db 'INFINITY',0
  116. szSound     db 'SOUND',0
  117.  
  118.  
  119.