Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. ; äëèíà ñòðîêè
  3. macro strlen string
  4. {
  5.   local .bcl,.ebcl
  6.         mov esi,string
  7.         mov ecx,0
  8. .bcl:
  9.         cmp byte [esi+ecx],0
  10.         je .ebcl
  11.         inc ecx
  12.         jmp .bcl
  13. .ebcl:
  14.  
  15. }
  16.  
  17.  
  18. Clstext                 dd      _Clstext
  19. PrintString             dd      _PrintString
  20. WaitForKeyPress         dd      _WaitForKeyPress
  21. SetCursorPos            dd      _SetCursorPos
  22. TextColor               dd      _TextColor
  23. GetUserInput            dd      _GetUserInput
  24. UpperCase               dd      _UpperCase
  25. PrintChar               dd      _PrintChar
  26. PrintCharCursor         dd      _PrintCharCursor
  27.  
  28.  
  29. _Clstext:
  30.         call    [con_cls]
  31.         ret
  32.  
  33. _PrintString:
  34.         pusha
  35.         push    esi
  36.         call    [con_write_asciiz]
  37.         popa
  38.         ret
  39.  
  40. _WaitForKeyPress:
  41.         pusha
  42.         call    [con_getch]
  43.         popa
  44.         ret
  45.  
  46. _SetCursorPos:
  47.         pusha
  48.         mov     ebx, eax
  49.         and     ebx, 0xff
  50.         mov     ecx, eax
  51.         and     ecx, 0xff00
  52.         shr     ecx, 8
  53.         push    ecx
  54.         push    ebx
  55.         call    [con_set_cursor_pos]
  56.         popa
  57.         ret
  58.  
  59. _TextColor:
  60.         ret
  61.  
  62. _GetUserInput:
  63.         pusha
  64.         push    new_line
  65.         call    [con_write_asciiz]
  66.         push    256
  67.         push    buffer
  68.         call    [con_gets]
  69.         popa
  70.         mov     edi, buffer
  71.         strlen  edi
  72.         ret
  73.  
  74. _UpperCase: ; ñêîïèðîâàíî èç èñõîäíèêà DexOS
  75.         pushad
  76.         push  es
  77. ;       mov   ax,sys_data ; <- ëèøíÿÿ äåòàëü :)
  78. ;       mov   es,ax    
  79. UcaseNextChar:
  80.         mov   al,byte[es:edi]
  81.         cmp   al,0
  82.         je    UcaseDone
  83.         cmp   al,0x61
  84.         jb    DontUcaseChar
  85.         cmp   al,0x7a
  86.         ja    DontUcaseChar
  87.         sub   al,0x20
  88.         mov   byte[es:edi],al  
  89. DontUcaseChar:
  90.         inc   edi
  91.         jmp   UcaseNextChar
  92. UcaseDone:
  93.         pop   es
  94.         popad
  95.         ret
  96.  
  97. _PrintChar:
  98.         pusha
  99.         and     eax, 0xff
  100.         push    eax
  101.         push    char_spec
  102.         call    [con_printf]
  103.         add     esp, 8
  104.         popa
  105.         ret
  106.  
  107. _PrintCharCursor:
  108.         pusha
  109.         and     eax, 0xff
  110.         push    eax
  111.         push    char_spec
  112.         call    [con_printf]
  113.         add     esp, 8
  114.         popa
  115.         ret
  116.  
  117.  
  118.  
  119. char_spec       db '%c',0