Subversion Repositories Kolibri OS

Rev

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

  1. format PE console 0.8
  2. include 'proc32.inc'
  3. include '../../../../import.inc'
  4.  
  5. start:
  6.         invoke  con_set_title, caption
  7. ; C-equivalent of the following code:
  8. ; for (ebx=0;ebx<0x100;ebx++)
  9. ; {
  10. ;   con_printf(t1,ebx);
  11. ;   eax = con_set_flags(ebx);
  12. ;   con_write_asciiz(text);
  13. ;   con_set_flags(eax);
  14. ; }
  15. ; N.B. For efficiency result of first con_set_flags is not saved
  16. ;      in register, but is pushed beforehand to the stack
  17. ;      for second con_set_flags.
  18. ;      Note that such code cannot be generated by stdcall macros.
  19.         xor     ebx, ebx
  20. @@:
  21.         push    ebx
  22.         push    t1
  23.         call    [con_printf]
  24.         add     esp, 8
  25.         push    ebx
  26.         call    [con_set_flags]
  27.         push    eax
  28.         push    text
  29.         call    [con_write_asciiz]
  30.         call    [con_set_flags]
  31.         inc     bl
  32.         jnz     @b
  33.         push    text2
  34.         call    [con_write_asciiz]
  35.         push    0
  36.         call    [con_exit]
  37. exit:
  38.         xor     eax, eax
  39.         ret
  40.  
  41. align 4
  42. data import
  43. library console, 'console.dll'
  44. import console, \
  45.     con_set_title, 'con_set_title', \
  46.     con_write_asciiz, 'con_write_asciiz', \
  47.     con_printf, 'con_printf', \
  48.     con_set_flags, 'con_set_flags', \
  49.     con_exit, 'con_exit'
  50. end data
  51.  
  52. caption            db 'Console test - colors',0
  53. t1                 db 'Цвет 0x%02X: ',0
  54. text               db 'Вот пример текста.',10,0
  55. text2           db      27,'[7mА это пример использования '
  56.                 db      27,'[1;36;41mEsc'
  57.                 db      27,'[7m-последовательностей.',10,0
  58.