Subversion Repositories Kolibri OS

Rev

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

  1. key_codes db 27,182,109,115,114,122,98,118,108,120,99,13,8,32,0,    0, 0,0
  2.    db 180,181,93,91
  3. ; bottom actions
  4.    db  0, 0, 0, 0, 0,185,0, 0, 0, 0,0,0,92
  5. btn_codes db  1,  0,  0,  9, 10,  3, 7,  6,  8,  4, 5, 0,0, 0,101,100,11,2
  6.    db   0,  0, 0, 0
  7. ; bottom actions
  8.    db 35,49,48,37,31,32,41,42,40,36,103,104,0
  9. jmps dw  _close, kDel,kMute, bList.shuf, bList.repe, bList.prev, bList.next
  10.    dw  bList.stop, kLoad, Xpress, Rewind.space, auto_load,Rewind, Rewind.space
  11.    dw  bReverse, bShade, bList, bBar, bOctU, bOctD, bSelTrack, bSelChannel
  12. ; bottom actions
  13.    dw kDel,bLsave,bLload,bRemAll,bAdd,bAddDir,bSelZero,bInvSel,bSelAll,bRemCrop
  14.    dw  bMinimize,bAbout,bResetTrk
  15. ;------------------------------------------------------------------------
  16. jmps_end:
  17.  
  18. key:
  19.     mov  eax,2
  20.     mcall
  21.     mov  edi,key_codes
  22.     cmp  ah,48
  23.     jb   .jump
  24.     cmp  ah,57
  25.     ja   .jump
  26.     sub  ah,48
  27.     mov  byte[channel],ah
  28.     jmp  midi_kill
  29.   .jump:
  30.     mov  ecx,(jmps_end-jmps)/2
  31.     mov  ebx,edi
  32.     shr  eax,8
  33.     repne scasb
  34.     jne  play_.noplsel
  35.     sub  edi,ebx
  36.     jmp  word[jmps+edi*2-2]
  37.   kDel:
  38.     call PL_del
  39.     call PL_show
  40.     jmp  still
  41.   kMute:
  42.     xor  [flag],FL_MUTE
  43.     jmp  still
  44.   kLoad:
  45. ;    dps  'Load'
  46.     cmp  [list_count],LISTITEMS
  47.     jbe  noparam
  48.     jmp  still
  49.   Xpress:
  50.     mov  eax,IPC_PLAY
  51.     call ipc_send
  52.     jmp  still;Rewind.space
  53.  auto_load:
  54.     call PL_get1stsel
  55.     mov  eax,ebx
  56.   play_:
  57.     mov  [play_num],eax
  58.     call PL_getbyindex
  59.     mov  edi,filename;fnbuf
  60.     rep  movsb
  61.     xor  eax,eax
  62.     mov  byte[edi],al
  63.     and  [flag],not FL_ADD
  64.     or   [flag],FL_PLAY
  65.     jmp  open_file
  66.   .noplsel:
  67.     call PL_get1stsel
  68.     test ebx,ebx
  69.     jz   .noupward
  70.     cmp  al,178
  71.     jne  .noupa
  72.   .seldec:
  73.     dec  ebx;[listsel]
  74.   .listdraw:
  75.     call PL_clearsel
  76.     mov  eax,ebx
  77.     call PL_getbyindex
  78.     or   word[esi-2],FL_MULSEL
  79.     call PL_show
  80.     jmp  still
  81.   .noupa:
  82.     cmp  al,184
  83.     jne  .noupward
  84.     dec  [listsel]
  85.   .swap:
  86.     dec  ebx
  87.     call PL_swap
  88.     jmp  .listdraw
  89.   .noupward:
  90.     inc  ebx
  91.     cmp  bl,[list_count]
  92.     jae  still
  93.     cmp  al,177
  94.     je  .listdraw
  95.   .nodowna:
  96.     cmp  al,183
  97.     jne  still
  98.     inc  [listsel]
  99.     jmp  .swap
  100.   Rewind:
  101.     push [midi_limit]
  102.     pop  [cur_ptr]
  103.     and  [cur_tick],0
  104.     jmp  red
  105.   .space:
  106.     cmp  [tick_count],0
  107.     jz   still
  108.     mov  eax,IPC_TRIG
  109.     call ipc_send
  110.     jmp  red
  111. ;------------------------------------------------------------------------
  112.   button:
  113.     mov  eax,17
  114.     mcall
  115.     cmp  ah,20
  116.     jb   .nobott
  117.     cmp  ah,25
  118.     ja   .nobott
  119.     sub  ah,20
  120.     mov  [popup],ah
  121.   .sh:
  122.     or   [flag],FL_BOTTRED
  123.     call PL_show
  124.     jmp  still
  125.   .nobott:
  126.     cmp  ah,31
  127.     jb   .nopop
  128.     cmp  ah,50
  129.     ja   .nopop
  130.     mov  [popup],-1
  131.     or   [flag],FL_BOTTRED
  132.     call PL_show
  133.  
  134. SH_POPUP equ 10
  135.   if SH_POPUP eq 1
  136.     mov  ebx,eax
  137.     shr  ebx,8
  138.     dps  'Popup#='
  139.     dpd  ebx
  140.     jmp  .sh
  141.   end if
  142.   .nopop:
  143.     mov  edi,btn_codes
  144.     jmp  key.jump
  145.   bReverse:
  146.     xor  [flag],FL_REVERSE
  147.     call draw_bar
  148.     jmp  still
  149.   _close:
  150.     call kill
  151.     or   eax,-1
  152.     mcall
  153.  
  154.   bShade:
  155.     call Shade
  156.     jmp  still
  157.   Shade:
  158.     xor  [flag],FL_HIDDEN
  159.     test [flag],FL_HIDDEN
  160.     jz  .open
  161.     mov  esi,14
  162.     mov  [coo],main_coo2
  163.     jmp  .op
  164.   .open:
  165.     mov  esi,WND_HEIGHT
  166.     mov  [coo],main_coo
  167.   .op:
  168.     mov  ebx,-1
  169.     mov  ecx,ebx
  170.     mov  edx,ebx
  171.     mov  eax,67
  172.     mcall
  173.     ret
  174. ;------------------------------------------------------------------------
  175.   bMinimize:
  176. ;    mcall 18,10
  177.     jmp  still
  178. ;------------------------------------------------------------------------
  179.   bList:
  180.     mov  [popup],-1
  181.     mov  edx,[listsel]
  182.     call PL_getitemclick
  183.     mov  [listsel],eax
  184.     mcall 66,3
  185.     mov  ebx,eax
  186. ;    dph  ebx
  187.     test ebx,1100b
  188.     jnz  .mul
  189.     call PL_clearsel
  190.     test ebx,11b
  191.     jz   .skipor
  192.     mov  ecx,[listsel]
  193.     mov  [listsel],edx
  194.     cmp  ecx,edx
  195.     je   .skipor
  196.     ja   .above
  197.     xchg ecx,edx
  198.   .above:
  199.     sub  ecx,edx
  200.     inc  ecx
  201.     mov  eax,edx
  202.     push ecx
  203.     call PL_getbyindex
  204.     sub  esi,2
  205.     pop  ecx
  206.     call PL_shiftsel
  207.     jmp  .plsh
  208.   .mul:
  209.     bts  [flag],15
  210.     jc   .skipor
  211.     mov  eax,edx
  212.     call PL_getbyindex
  213.     or  word[esi-2],FL_MULSEL
  214.   .skipor:
  215.     mov  eax,[listsel]
  216.     call PL_getbyindex
  217.     xor  word[esi-2],FL_MULSEL
  218.   .plsh:
  219.     call PL_show
  220.     mcall 40,111b
  221.     mcall 23,30
  222.     push eax
  223.     mcall 40,1000111b
  224.     pop  eax
  225.     cmp  eax,3
  226.     jne  still
  227.     mcall 17
  228.     cmp  ah,11
  229.     jne  still
  230.     call PL_getitemclick
  231.     cmp  eax,[listsel]
  232.     je  auto_load
  233.     mov  [listsel],eax
  234.     call PL_show
  235.     jmp  still
  236.   .repe:
  237.     xor  [flag],FL_REPEAT
  238.     jmp  red
  239.   .stop:
  240.     mov  eax,IPC_PAUS
  241.     call ipc_send
  242.     jmp  Rewind
  243.   .shuf:
  244.     xor  [flag],FL_SHUFFLE
  245.     jmp  red
  246.   .prev:
  247.     mov  eax,[play_num]
  248.     test eax,eax
  249.     jz   still
  250.     dec  eax
  251.     jmp  play_
  252.   .next:
  253.     mov  eax,[play_num]
  254.     inc  eax
  255.     cmp  al,[list_count]
  256.     jae  still
  257.     jmp  play_
  258. ;------------------------------------------------------------------------
  259.   bBar:
  260.     cmp  [tick_count],0
  261.     jz   still
  262.     mov  eax,37
  263.     mov  ebx,1
  264.     mcall
  265.     mov  ebp,[coo]
  266.     sub  eax,[ebp-16]
  267.     shr  eax,16
  268.     mov  ebx,[tick_count]
  269.     mul  ebx
  270.     mov  ebx,[ebp-20]
  271.     div  ebx
  272.     mov  ebx,eax ; ebx - selected tick
  273.     xor  ecx,ecx
  274.     mov  esi,[midi_limit]
  275.   .further:
  276.     lodsw
  277.     and  eax,0x7f
  278.     add  ecx,eax
  279.     cmp  ecx,ebx
  280.     jb   .further
  281.     sub  ecx,eax
  282.     mov  [cur_tick],ecx
  283.     sub  esi,2
  284.     mov  [cur_ptr],esi
  285.   drw:
  286.     jmp  red
  287. ;------------------------------------------------------------------------
  288. OCT_CH equ 3
  289. ;------------------------------------------------------------------------
  290.   bOctU:
  291.     add  [octave],OCT_CH
  292.     jmp  midi_kill
  293.   bOctD:
  294.     sub  [octave],OCT_CH
  295.     jmp  midi_kill
  296.   bSelChannel:
  297.     call get_num
  298.     cmp  eax,-1
  299.     je   still
  300.     dps  <13,10,'Channel#'>
  301.     dpd  eax
  302.     mov  [channel],eax
  303.     jmp  midi_kill
  304.   bSelTrack:
  305.     call get_num
  306.     cmp  eax,-1
  307.     je   still
  308.     dps  <13,10,'Track#'>
  309.     dpd  eax
  310.     mov  [sel_track],al
  311.     jmp  midi_kill
  312.   bResetTrk:
  313.     xor  eax,eax
  314.     mov  [sel_track],al
  315.     mov  [channel],eax
  316.     dps  <13,10,'Both track & channel are 0',13,10>
  317.     jmp  midi_kill
  318.   bLsave:
  319.     call PL_save
  320.   bLload:
  321.     call PL_load
  322.     jmp  red
  323.   bRemAll:
  324.     and  [list_count],0
  325.     mov  [play_limit],playlist-2
  326.     jmp  red
  327. ;------------------------------------------------------------------------
  328. bAdd:
  329.         movzx eax,[list_count]
  330.         dpd  eax
  331.         mov     [OpenDialog_data.type],0        ; Open
  332.         or      [flag],FL_LOCK 
  333.         push    dword OpenDialog_data
  334.         call    [OpenDialog_Start]
  335.         and     [flag],not FL_LOCK
  336.         cmp     [OpenDialog_data.status],1
  337.         jne     still
  338.  
  339.         mov  edi,filename
  340.         cmp  byte[edi],0
  341.         jz   still
  342.         call str_len
  343.         xchg eax,ecx
  344.         mov  esi,edi
  345.         jmp  add_song
  346. ;------------------------------------------------------------------------
  347. bAddDir:
  348.         mov     [OpenDialog_data.type],2        ; Dir
  349.         or      [flag],FL_LOCK 
  350.         push    dword OpenDialog_data
  351.         call    [OpenDialog_Start]
  352.         and     [flag],not FL_LOCK
  353.         cmp     [OpenDialog_data.status],1
  354.         jne     still
  355.  
  356.         mov  esi,filename
  357.         mov  edi,fnbuf
  358.         xor     eax,eax
  359. @@:
  360.         cld
  361.         lodsb
  362.         stosb
  363.         test    eax,eax
  364.         jnz     @r
  365.         mov     [edi-1],byte '/'
  366.         mov     edx,edi
  367.  
  368.         and     dword [dir_info+4], 0
  369. .nxt2:
  370.         mcall   70, dir_info
  371.         test    eax,eax
  372.         jnz     red
  373.  
  374.         test    byte [dir_table+32], 11000b     ; exclude directories & vol label
  375.         jnz     .no
  376.         mov     edi, dir_table+32+40
  377.         mov     esi, edi
  378.         xor     eax, eax
  379.         or      ecx, -1
  380.         repnz   scasb
  381.         mov     eax, [edi-5]
  382.         or      eax, 0x20202000
  383.         cmp     eax, '.mid'
  384.         jz      .ok
  385.         cmp     eax, '.kar'
  386.         jnz     .no
  387. .ok:
  388.         lea     ecx, [edi-dir_table-32-40-1]
  389.         mov     edi, edx
  390.         rep     movsb
  391.         mov     ecx, edi
  392.         mov     esi, fnbuf
  393.         sub     ecx, esi
  394.         call    PL_add
  395. .no:
  396.         mov     eax,[dir_info+4]
  397.         cmp     eax,[dir_table+8]
  398.         je      red
  399.         inc     dword [dir_info+4]
  400.         jmp     .nxt2
  401. ;------------------------------------------------------------------------
  402.   bSelZero:
  403.     call PL_clearsel
  404.     jmp  red
  405.   bInvSel:
  406.     call PL_invsel
  407.     jmp  red
  408.   bSelAll:
  409.     call PL_clearsel
  410.     call PL_invsel
  411.     jmp  red
  412.   bRemCrop:
  413.     call PL_invsel
  414.     call PL_del
  415.     jmp  bSelAll
  416.   bAbout:
  417.     mov  edx,about1
  418.     call debug_outstr
  419.     jmp  still
  420. ;------------------------------------------------------------------------
  421. get_num:  ; out: eax-number entered
  422.     or   [flag],FL_LOCK
  423.     mcall 10
  424.     dpd  eax
  425.     cmp  eax,1
  426.     jne  .nored
  427.     call draw_window
  428.     jmp  get_num
  429.   .nored:
  430.     cmp  eax,2
  431.     jne  .nokey
  432.     mcall 2
  433.     movzx eax,ah
  434.     sub  eax,'0'
  435.     jl   .none
  436.     cmp  eax,9
  437.     jbe  .ok
  438.   .none:
  439.     mov  eax,-1
  440.   .ok:
  441.     and  [flag],not FL_LOCK
  442.     ret
  443.   .nokey:
  444.     cmp  eax,3
  445.     jne  get_num
  446.     mcall 17
  447.     jmp  get_num
  448. ;------------------------------------------------------------------------
  449. find_slash:
  450. ; in: edi-filename, out: edi-slash ptr-1
  451.     push eax ecx
  452.     call str_len
  453.     mov  ecx,eax
  454.     std
  455.     add  edi,eax
  456.     mov  al,'/'
  457.     repne scasb
  458.     cld
  459.     add  edi,2
  460.     pop  ecx eax
  461.     ret
  462. ;------------------------------------------------------------------------