Subversion Repositories Kolibri OS

Rev

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