Subversion Repositories Kolibri OS

Rev

Rev 139 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
134 diamond 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
    int  0x40
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
    int  0x40
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
    int  0x40
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
    int  0x40
173
    ret
174
  bMinimize:
175
;    mcall 18,10
176
    jmp  still
177
  bList:
178
    mov  [popup],-1
179
    mov  edx,[listsel]
180
    call PL_getitemclick
181
    mov  [listsel],eax
182
    mcall 66,3
183
    mov  ebx,eax
184
;    dph  ebx
185
    test ebx,1100b
186
    jnz  .mul
187
    call PL_clearsel
188
    test ebx,11b
189
    jz   .skipor
190
    mov  ecx,[listsel]
191
    mov  [listsel],edx
192
    cmp  ecx,edx
193
    je   .skipor
194
    ja   .above
195
    xchg ecx,edx
196
  .above:
197
    sub  ecx,edx
198
    inc  ecx
199
    mov  eax,edx
200
    push ecx
201
    call PL_getbyindex
202
    sub  esi,2
203
    pop  ecx
204
    call PL_shiftsel
205
    jmp  .plsh
206
  .mul:
207
    bts  [flag],15
208
    jc   .skipor
209
    mov  eax,edx
210
    call PL_getbyindex
211
    or  word[esi-2],FL_MULSEL
212
  .skipor:
213
    mov  eax,[listsel]
214
    call PL_getbyindex
215
    xor  word[esi-2],FL_MULSEL
216
  .plsh:
217
    call PL_show
218
    mcall 40,111b
219
    mcall 23,30
220
    push eax
221
    mcall 40,1000111b
222
    pop  eax
223
    cmp  eax,3
224
    jne  still
225
    mcall 17
226
    cmp  ah,11
227
    jne  still
228
    call PL_getitemclick
229
    cmp  eax,[listsel]
230
    je  auto_load
231
    mov  [listsel],eax
232
    call PL_show
233
    jmp  still
234
  .repe:
235
    xor  [flag],FL_REPEAT
236
    jmp  red
237
  .stop:
238
    mov  eax,IPC_PAUS
239
    call ipc_send
240
    jmp  Rewind
241
  .shuf:
242
    xor  [flag],FL_SHUFFLE
243
    jmp  red
244
  .prev:
245
    mov  eax,[play_num]
246
    test eax,eax
247
    jz   still
248
    dec  eax
249
    jmp  play_
250
  .next:
251
    mov  eax,[play_num]
252
    inc  eax
253
    cmp  al,[list_count]
254
    jae  still
255
    jmp  play_
256
  bBar:
257
    cmp  [tick_count],0
258
    jz   still
259
    mov  eax,37
260
    mov  ebx,1
261
    int  0x40
262
    mov  ebp,[coo]
263
    sub  eax,[ebp-16]
264
    shr  eax,16
265
    mov  ebx,[tick_count]
266
    mul  ebx
267
    mov  ebx,[ebp-20]
268
    div  ebx
269
    mov  ebx,eax ; ebx - selected tick
270
    xor  ecx,ecx
271
    mov  esi,[midi_limit]
272
  .further:
273
    lodsw
274
    and  eax,0x7f
275
    add  ecx,eax
276
    cmp  ecx,ebx
277
    jb   .further
278
    sub  ecx,eax
279
    mov  [cur_tick],ecx
280
    sub  esi,2
281
    mov  [cur_ptr],esi
282
  drw:
283
    jmp  red
284
 
285
OCT_CH equ 3
286
  bOctU:
287
    add  [octave],OCT_CH
288
    jmp  midi_kill
289
  bOctD:
290
    sub  [octave],OCT_CH
291
    jmp  midi_kill
292
  bSelChannel:
293
    call get_num
294
    cmp  eax,-1
295
    je   still
296
    dps  <13,10,'Channel#'>
297
    dpd  eax
298
    mov  [channel],eax
299
    jmp  midi_kill
300
  bSelTrack:
301
    call get_num
302
    cmp  eax,-1
303
    je   still
304
    dps  <13,10,'Track#'>
305
    dpd  eax
306
    mov  [sel_track],al
307
    jmp  midi_kill
308
  bResetTrk:
309
    xor  eax,eax
310
    mov  [sel_track],al
311
    mov  [channel],eax
312
    dps  <13,10,'Both track & channel are 0',13,10>
313
    jmp  midi_kill
314
  bLsave:
315
    call PL_save
316
  bLload:
317
    call PL_load
318
    jmp  red
319
  bRemAll:
320
    and  [list_count],0
321
    mov  [play_limit],playlist-2
322
    jmp  red
323
  bAdd:
324
    movzx eax,[list_count]
325
    dpd  eax
326
    call fopen
327
    mov  edi,filename
328
    cmp  byte[edi],0
329
    jz   still
330
    call str_len
331
    xchg eax,ecx
332
    mov  esi,edi
333
    jmp  add_song
334
  bAddDir:
335
    call fopen
336
    mov  edi,filename
337
    cmp  byte[edi],0
338
    jz   still
339
    call find_slash
340
    lea  edx,[edi-filename+fnbuf] ; edx -> '/'
341
    and  byte[edi],0
342
    mov  esi,filename
343
    mov  edi,fnbuf
344
    mov  ecx,64
345
    rep  movsb
346
    mov  dword[file_info+12],dir_table
347
    mov  dword[file_info+8],DIR_SIZE/512
348
  .nxt2:
349
    mcall 58,file_info
350
    mov  ecx,DIR_SIZE/32
351
    mov  esi,dir_table
352
  .nxt:
353
    mov  al,[esi]
354
    cmp  al,0xe5
355
    je   .no
356
    test al,al
357
    jz   .end
358
    test byte[esi+12],11000b
359
    jnz  .no
360
    mov  eax,[esi+7]
361
    mov  al,'.'
362
    cmp  eax,'.MID'
363
    je   .ok
364
    cmp  eax,'.KAR'
365
    jne  .no
366
  .ok:
367
    mov  [esi+8],eax
368
    pusha
369
    mov  edi,edx
370
    mov  ecx,12
371
    rep  movsb
372
    and  byte[edi],0
373
    mov  ecx,edi
374
    sub  ecx,fnbuf
375
    mov  esi,fnbuf
376
    call PL_add
377
    popa
378
  .no:
379
    add  esi,32
380
    loop .nxt
381
    add  dword[file_info+4],DIR_SIZE/512
382
    jmp  .nxt2
383
  .end:
384
    mov  ebx,file_info
385
    and  dword[ebx+4],0
386
    mov  [fsize],1
387
    mov  dword[ebx+12],workarea
388
    jmp  red;still
389
  bSelZero:
390
    call PL_clearsel
391
    jmp  red
392
  bInvSel:
393
    call PL_invsel
394
    jmp  red
395
  bSelAll:
396
    call PL_clearsel
397
    call PL_invsel
398
    jmp  red
399
  bRemCrop:
400
    call PL_invsel
401
    call PL_del
402
    jmp  bSelAll
403
  bAbout:
404
    mov  edx,about1
405
    call debug_outstr
406
    jmp  still
407
 
408
get_num:  ; out: eax-number entered
409
    or   [flag],FL_LOCK
410
    mcall 10
411
    dpd  eax
412
    cmp  eax,1
413
    jne  .nored
414
    call draw_window
415
    jmp  get_num
416
  .nored:
417
    cmp  eax,2
418
    jne  .nokey
419
    mcall 2
420
    movzx eax,ah
421
    sub  eax,'0'
422
    jl   .none
423
    cmp  eax,9
424
    jbe  .ok
425
  .none:
426
    mov  eax,-1
427
  .ok:
428
    and  [flag],not FL_LOCK
429
    ret
430
  .nokey:
431
    cmp  eax,3
432
    jne  get_num
433
    mcall 17
434
    jmp  get_num
435
 
436
find_slash:
437
; in: edi-filename, out: edi-slash ptr-1
438
    push eax ecx
439
    call str_len
440
    mov  ecx,eax
441
    std
442
    add  edi,eax
443
    mov  al,'/'
444
    repne scasb
445
    cld
446
    add  edi,2
447
    pop  ecx eax
448
    ret
449