Subversion Repositories Kolibri OS

Rev

Rev 5900 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.     use32
  2.     org     0
  3.     db      'MENUET01'
  4.     dd      1, @entry, @end, @memory, @stack, 0, 0
  5.  
  6.     include "../../macros.inc"
  7.     include "../../proc32.inc"
  8. ;    include "../../debug.inc"
  9.     include "../../notify.inc"
  10.     include "../../string.inc"
  11.  
  12.  @entry:
  13.     mcall   68, 11
  14.  
  15.  ;; RUN NOTIFY
  16.     call    make_param
  17.     mcall   70, fi_launch
  18.  
  19.  ;; CONVERT PID TO STR
  20.     mov     ebx, 10
  21.     mov     ecx, 0
  22.   @@:
  23.     mov     edx, 0
  24.     div     ebx
  25.     push    edx
  26.     inc     ecx
  27.     cmpne   eax, 0, @b
  28.  
  29.     mov     ebx, ctrl.name
  30.   @@:
  31.     pop     eax
  32.     add     al, "0"
  33.     mov     [ebx], al
  34.     inc     ebx
  35.     loop    @b
  36.  
  37.  ;; ADD POSTFIX TO STR
  38.     mov     dword [ebx + 0], "-NOT"
  39.     mov     dword [ebx + 4], "IFY"
  40.  
  41.  ;; OPEN CONTROLLER (0x08 + 0x01 -- CREATE AND READ/WRITE)
  42.     mcall   68, 22, ctrl.name, 2048, 0x09
  43.     mov     [ctrl.addr], eax
  44.  
  45.  ;; WAIT UNTIL CONTROLLER BECOMES READY TO USE
  46.     add     eax, NTCTRL_READY
  47.   @@:
  48.     mcall   5, 1
  49.     cmpe    byte [eax], 0, @b
  50.  
  51.  ;; CONFIG PBAR
  52.     mov     eax, [ctrl.addr]
  53.     add     eax, NTCTRL_PBAR_MAX
  54.     mov     dword [eax], 9
  55.  
  56.     mov     eax, [ctrl.addr]
  57.     add     eax, NTCTRL_PBAR_CUR
  58.     mov     dword [eax], 9
  59.  
  60.     mov     eax, [ctrl.addr]
  61.     add     eax, NTCTRL_APPLY_PBAR
  62.     mov     byte [eax], 1
  63.  
  64.  ;; LOOP OF NOTIFIES CHANGES
  65.   @@:
  66.   ;; SHIFT TEXT
  67.     call    shift
  68.   ;; ADD UNSHIFTABLE TEXT
  69.     mov     byte [params], 0
  70.     call    make_text
  71.  
  72.   ;; SEND TEXT TO NOTIFY
  73.     mov     eax, [ctrl.addr]
  74.     add     eax, NTCTRL_TEXT
  75.     stdcall string.copy, params, eax
  76.  
  77.   ;; APPLY NEW TEXT
  78.     mov     eax, [ctrl.addr]
  79.     add     eax, NTCTRL_APPLY_TEXT
  80.     mov     byte [eax], 1
  81.  
  82.   ;; CLOSE NOTIFY IF TIME IS END
  83.     cmpe    byte [sz_time], "0", .exit
  84.  
  85.   ;; WAIT AND DO NEXT ITERATION
  86.     mcall   5, 20
  87.     jmp     @b
  88.  
  89.  .exit:
  90.   ;; CLOSE NOTIFY
  91.     mov     eax, [ctrl.addr]
  92.     add     eax, NTCTRL_CLOSE
  93.     mov     byte [eax], 1
  94.  
  95.     mcall   -1
  96.  
  97. ;-------------------------------------------------------------------------------
  98.  shift:
  99.  ;; SHIFT TEXT
  100.     mov     eax, sz_text
  101.     mov     dh, [eax]
  102.   @@:
  103.     mov     dl, [eax + 1]
  104.     mov     [eax], dl
  105.     inc     eax
  106.     cmpne   byte [eax + 1], 0, @b
  107.     mov     [eax], dh
  108.  
  109.     inc     byte [timer]
  110.     cmpne   byte [timer], 5, .skip_changes
  111.     sub     byte [timer], 5
  112.  
  113.  ;; CHANGE TIMER TEXT
  114.     dec     byte [sz_time]
  115.  
  116.  ;; CHANGE ICON
  117.     mov     eax, [ctrl.addr]
  118.     add     eax, NTCTRL_ICON
  119.     inc     byte [eax]
  120.     cmpne   byte [eax], 12, @f
  121.     sub     byte [eax], 11
  122.   @@:
  123.  
  124.  ;; APPLY NEW ICON
  125.     mov     eax, [ctrl.addr]
  126.     add     eax, NTCTRL_APPLY_ICON
  127.     mov     byte [eax], 1
  128.  
  129.  ;; CHANGE TITLE
  130.     mov     eax, [ctrl.addr]
  131.     add     eax, NTCTRL_TITLE
  132.     mov     dl, 1
  133.     sub     dl, [eax]
  134.     mov     [eax], dl
  135.  
  136.  ;; APPLY NEW TITLE
  137.     mov     eax, [ctrl.addr]
  138.     add     eax, NTCTRL_APPLY_TITLE
  139.     mov     byte [eax], 1
  140.  
  141.  ;; CHANGE PBAR
  142.     mov     eax, [ctrl.addr]
  143.     add     eax, NTCTRL_PBAR_CUR
  144.     dec     dword [eax]
  145.  
  146.  ;; APPLY PBAR
  147.     mov     eax, [ctrl.addr]
  148.     add     eax, NTCTRL_APPLY_PBAR
  149.     mov     byte [eax], 1
  150.  
  151.  .skip_changes:
  152.  
  153.     ret
  154. ;-------------------------------------------------------------------------------
  155.  make_text:
  156.     stdcall string.concatenate, sz_text, params
  157.     stdcall string.concatenate, sz_sec_line_start, params
  158.     stdcall string.concatenate, sz_time, params
  159.     stdcall string.concatenate, sz_sec_line_end, params
  160.  
  161.     ret
  162. ;-------------------------------------------------------------------------------
  163.  make_param:
  164.     stdcall string.copy, sz_quote, params
  165.     call    make_text
  166.     stdcall string.concatenate, sz_quote, params
  167.     stdcall string.concatenate, sz_flags, params
  168.  
  169.     ret
  170. ;-------------------------------------------------------------------------------
  171.  
  172.  sz_time:
  173.     db "9", 0
  174.  sz_text:
  175.     db "Hello, World!!! It is a marquee!    ", 0
  176.  sz_quote:
  177.     db "'", 0
  178.  sz_sec_line_start:
  179.     db 10, "Will close after ", 0
  180.  sz_sec_line_end:
  181.     db " seconds", 0
  182.  sz_flags:
  183.     db "Idcp", 0
  184.  
  185.  fi_launch:
  186.     dd      7, 0, params, 0, 0
  187.     ;db      "/usbhd0/2/svn/programs/system/notify3/notify", 0
  188.     db      "@notify", 0
  189.  
  190.  @end:
  191. ;=====================================================================
  192.  timer  rb 1
  193.  params rb 256
  194.  ctrl:
  195.   .name rb 32
  196.   .addr rd 1
  197.         rb 2048
  198.  @stack:
  199.  
  200.  @memory:
  201.