Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. SECTION .text
  3.  
  4. global go.os.Sleep
  5. global go.os.Event
  6. global go.os.GetButtonID
  7. global go.os.CreateButton
  8. global go.os.Exit
  9. global go.os.Redraw
  10. global go.os.Window
  11. global go.os.WriteText
  12. global go.os.GetTime
  13. global go.os.DrawLine
  14. global go.os.DrawBar
  15. global go.os.DebugOutHex
  16. global go.os.DebugOutChar
  17. global go.os.DebugOutStr
  18. global go.os.WriteText2
  19.  
  20. go.os.Sleep:
  21.     push ebp
  22.     mov ebp,esp
  23.         mov eax, 5
  24.         mov ebx, [ebp+8]
  25.         int 0x40
  26.     mov esp,ebp
  27.     pop ebp
  28.     ret
  29.  
  30.  
  31. go.os.Event:
  32.         mov eax, 10
  33.         int 0x40
  34.         ret
  35.  
  36. go.os.GetButtonID:
  37.   mov   eax,17
  38.   int   0x40
  39.   test  al,al
  40.   jnz   .no_button
  41.   shr   eax,8
  42.   ret
  43. .no_button:
  44.   xor   eax,eax
  45.   dec   eax
  46.   ret
  47.  
  48. go.os.Exit:
  49.         mov eax, -1
  50.         int 0x40
  51.     ret
  52.  
  53. go.os.Redraw:
  54.     push ebp
  55.     mov ebp,esp
  56.         mov eax, 12
  57.         mov ebx, [ebp+8]
  58.         int 0x40
  59.     mov esp,ebp
  60.     pop ebp
  61.     ret
  62.  
  63. go.os.Window:
  64.     push ebp
  65.     mov ebp,esp
  66.         mov ebx, [ebp+8]
  67.         shl ebx, 16
  68.         or ebx, [ebp+16]
  69.         mov ecx, [ebp+12]
  70.         shl ecx, 16
  71.         or ecx, [ebp+20]
  72.         mov edx, 0x14
  73.         shl edx, 24
  74.         or edx, 0xFFFFFF
  75.         mov esi, 0x808899ff
  76.         mov edi, [ebp+24]
  77.         xor eax, eax
  78.         int 0x40
  79.     mov esp,ebp
  80.     pop ebp
  81.     ret
  82.  
  83. go.os.WriteText:
  84.     push ebp
  85.     mov ebp,esp
  86.     mov eax,4
  87.     mov ebx,[ebp+8]
  88.     shl ebx,16
  89.     mov bx,[ebp+12]
  90.     mov ecx,[ebp+16]
  91.     mov edx,[ebp+20]
  92.     mov esi,[ebp+24]
  93.     int 0x40
  94.     mov esp,ebp
  95.     pop ebp
  96.     ret
  97.  
  98. go.os.WriteText2:
  99.     push ebp
  100.     mov ebp,esp
  101.     mov eax,47
  102.     mov ebx,[ebp+8]
  103.     shl ebx,16
  104.     mov ecx,[ebp+12]
  105.     mov edx,[ebp+20]
  106.     shl edx,16
  107.     add edx, [ebp+24]
  108.     mov esi,[ebp+28]
  109.     int 0x40
  110.     mov esp,ebp
  111.     pop ebp
  112.     ret
  113.  
  114. go.os.DrawLine:
  115.     push ebp
  116.     mov ebp,esp
  117.     mov ebx,[ebp+8]
  118.     shl ebx,16
  119.     mov bx,[ebp+16]
  120.     mov ecx,[ebp+12]
  121.     shl ecx,16
  122.     mov cx,[ebp+20]
  123.     mov edx,[ebp+24]
  124.     mov eax,38
  125.     int 0x40
  126.     mov esp,ebp
  127.     pop ebp
  128.     ret
  129.  
  130. go.os.DrawBar:
  131.     push ebp
  132.     mov ebp,esp
  133.     mov   eax,13
  134.     mov   ebx,[ebp+8]
  135.     shl   ebx,16
  136.     mov   bx,[ebp+16]
  137.     mov   ecx,[ebp+12]
  138.     shl   ecx,16
  139.     mov   cx,[ebp+20]
  140.     mov   edx,[ebp+24]
  141.     int   0x40
  142.     mov esp,ebp
  143.     pop ebp
  144.     ret
  145.  
  146. go.os.GetTime:
  147.     mov eax, 3
  148.     int 0x40
  149.     ret
  150.  
  151. go.os.DebugOutHex:
  152.     mov eax, [esp+4]
  153.     mov   edx, 8
  154.     .new_char:
  155.     rol   eax, 4
  156.     movzx ecx, al
  157.     and   cl,  0x0f
  158.     mov   cl,  [__hexdigits + ecx]
  159.     pushad
  160.     mov eax, 63
  161.     mov ebx, 1
  162.     int 0x40
  163.     popad
  164.     dec   edx
  165.     jnz   .new_char
  166.     ret
  167.  
  168. go.os.DebugOutChar:
  169.    mov al, [esp+4]
  170.    pushf
  171.    pushad
  172.    mov  cl,al
  173.    mov  eax,63
  174.    mov  ebx,1
  175.    int  0x40
  176.    popad
  177.    popf
  178.    ret
  179.  
  180. go.os.DebugOutStr:
  181.    mov  edx,[esp+4]
  182.    mov  eax,63
  183.    mov  ebx,1
  184.  m2:
  185.    mov  cl, [edx]
  186.    test cl,cl
  187.    jz   m1
  188.    int  40h
  189.    inc  edx
  190.    jmp  m2
  191.  m1:
  192.    ret
  193.  
  194. go.os.CreateButton:
  195.   push  ebp
  196.   mov   ebp,esp
  197.   mov   eax, 8
  198.   mov ebx, [ebp+8]
  199.   shl ebx, 16
  200.   mov bx, [ebp+16]
  201.   mov ecx, [ebp+12]
  202.   shl ecx, 16
  203.   mov cx, [ebp+20]
  204.   mov edx, [ebp+24]
  205.   mov esi, [ebp+28]
  206.   int   0x40
  207.   mov   esp,ebp
  208.   pop   ebp
  209.   ret
  210.  
  211. SECTION .data
  212. __hexdigits:
  213.   db '0123456789ABCDEF'
  214.