Subversion Repositories Kolibri OS

Rev

Rev 109 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 109 Rev 331
Line 6... Line 6...
6
;
6
;
7
;    12.7.2002 - Audio system calls by VT
7
;    12.7.2002 - Audio system calls by VT
8
;
8
;
Line 9... Line 9...
9
   
9
   
10
use32
-
 
11
   
10
use32
12
                org     0x0
-
 
13
   
11
 org	0x0
14
                db      'MENUET00'              ; 8 byte id
12
 db	'MENUET01'    ; header
15
                dd      38                      ; required os
13
 dd	0x01	      ; header version
16
                dd      START                   ; program start
14
 dd	START	      ; entry point
17
                dd      I_END                   ; program image size
15
 dd	I_END	      ; image size
-
 
16
 dd	I_END+0x10000 ; required memory
18
                dd      0x100000                ; required amount of memory
17
 dd	I_END+0x10000 ; esp
Line 19... Line 18...
19
                dd      0x00000000              ; reserved=no extended header
18
 dd	0x0 , 0x0     ; I_Param , I_Path
20
 
19
 
Line 21... Line 20...
21
include 'lang.inc'
20
include 'lang.inc'
22
include 'macros.inc'
21
include 'macros.inc'
Line 23... Line 22...
23
   
22
   
Line 24... Line 23...
24
delay      dd  145
23
delay	   dd  145
25
wait_for   dd  0x0
24
wait_for   dd  0x0
Line 26... Line 25...
26
   
25
   
Line 27... Line 26...
27
START:                          ; start of execution
26
START:				; start of execution
Line 28... Line 27...
28
   
27
   
29
    mov  dword [prompt], p9
28
    mov  dword [prompt], p9
Line 30... Line 29...
30
    mov  dword [promptlen], p9len - p9
29
    mov  dword [promptlen], p9len - p9
31
   
30
   
32
    call draw_window            ; at first, draw the window
31
    call draw_window		; at first, draw the window
33
   
32
   
34
still:
33
still:
35
   
34
   
Line 36... Line 35...
36
    mov  eax,10                 ; wait here for event
35
    mov  eax,10 		; wait here for event
Line 37... Line 36...
37
    int  0x40
36
    int  0x40
38
   
37
   
39
    cmp  eax,1                  ; redraw request ?
38
    cmp  eax,1			; redraw request ?
Line 40... Line 39...
40
    jz   red
39
    jz	 red
41
    cmp  eax,2                  ; key in buffer ?
40
    cmp  eax,2			; key in buffer ?
42
    jz   key
41
    jz	 key
43
    cmp  eax,3                  ; button in buffer ?
42
    cmp  eax,3			; button in buffer ?
Line 44... Line 43...
44
    jz   button
43
    jz	 button
45
   
44
   
46
    jmp  still
45
    jmp  still
Line 47... Line 46...
47
   
46
   
48
red:                           ; redraw
47
red:			       ; redraw
Line 49... Line 48...
49
    call draw_window
48
    call draw_window
50
    jmp  still
49
    jmp  still
Line 69... Line 68...
69
    int   0x40
68
    int   0x40
Line 70... Line 69...
70
   
69
   
Line 71... Line 70...
71
 mov  [socketNum], dword 0
70
 mov  [socketNum], dword 0
72
   
71
   
Line 73... Line 72...
73
   
72
   
74
    mov  eax,0xffffffff         ; close this program
73
    mov  eax,0xffffffff 	; close this program
75
    int  0x40
74
    int  0x40
Line 76... Line 75...
76
   
75
   
77
noclose:
76
noclose:
78
    cmp  ah,2                   ; copy file to local machine?
77
    cmp  ah,2			; copy file to local machine?
Line 79... Line 78...
79
    jnz  nocopyl
78
    jnz  nocopyl
80
   
79
   
81
    mov   dword [prompt], p5
80
    mov   dword [prompt], p5
82
    mov  dword [promptlen], p5len - p5
81
    mov  dword [promptlen], p5len - p5
83
    call  draw_window            ;
82
    call  draw_window		 ;
Line 84... Line 83...
84
   
83
   
Line 85... Line 84...
85
    ; Copy File from Remote Host to this machine
84
    ; Copy File from Remote Host to this machine
Line 86... Line 85...
86
    call translateData  ; Convert Filename & IP address
85
    call translateData	; Convert Filename & IP address
87
    mov  edi, tftp_filename + 1
86
    mov  edi, tftp_filename + 1
88
    mov  [edi], byte 0x01 ; setup tftp msg
87
    mov  [edi], byte 0x01 ; setup tftp msg
89
    call copyFromRemote
88
    call copyFromRemote
90
   
89
   
Line 91... Line 90...
91
    jmp  still
90
    jmp  still
92
   
91
   
93
nocopyl:
92
nocopyl:
Line 120... Line 119...
120
   
119
   
121
  f11:
120
  f11:
122
    mov  eax,10
121
    mov  eax,10
123
    int  0x40
122
    int  0x40
124
    cmp  eax,2
123
    cmp  eax,2
125
    jz   fbu
124
    jz	 fbu
126
    jmp  still
125
    jmp  still
127
  fbu:
126
  fbu:
128
    mov  eax,2
127
    mov  eax,2
129
    int  0x40  ; get key
128
    int  0x40  ; get key
130
    shr  eax,8
129
    shr  eax,8
131
    cmp  eax,8
130
    cmp  eax,8
132
    jnz  nobs
131
    jnz  nobs
133
    cmp  edi,[addr]
132
    cmp  edi,[addr]
134
    jz   f11
133
    jz	 f11
135
    sub  edi,1
134
    sub  edi,1
136
    mov  [edi],byte ' '
135
    mov  [edi],byte ' '
137
    call print_text
136
    call print_text
138
    jmp  f11
137
    jmp  f11
139
  nobs:
138
  nobs:
140
    cmp  eax,dword 31
139
    cmp  eax,dword 31
141
    jbe  f11
140
    jbe  f11
142
    cmp  eax,dword 95
141
    cmp  eax,dword 95
143
    jb   keyok
142
    jb	 keyok
144
    sub  eax,32
143
    sub  eax,32
145
  keyok:
144
  keyok:
Line 146... Line 145...
146
    mov  [edi],al
145
    mov  [edi],al
Line 310... Line 309...
310
   
309
   
311
 ; Get a random # for the local socket port #
310
 ; Get a random # for the local socket port #
312
 mov  eax, 3
311
 mov  eax, 3
313
 int  0x40
312
 int  0x40
314
 mov  ecx, eax
313
 mov  ecx, eax
Line 315... Line 314...
315
 shr  ecx, 8    ; Set up the local port # with a random #
314
 shr  ecx, 8	; Set up the local port # with a random #
316
   
315
   
317
   ; open socket
316
   ; open socket
318
 mov  eax, 53
317
 mov  eax, 53
319
 mov  ebx, 0
318
 mov  ebx, 0
320
 mov  edx, 69    ; remote port
319
 mov  edx, 69	 ; remote port
Line 321... Line 320...
321
 mov  esi, [tftp_IP]  ; remote IP ( in intenet format )
320
 mov  esi, [tftp_IP]  ; remote IP ( in intenet format )
Line 335... Line 334...
335
 mov  ebx, 2
334
 mov  ebx, 2
336
 mov  ecx, [socketNum]
335
 mov  ecx, [socketNum]
337
 int  0x40    ; any more data?
336
 int  0x40    ; any more data?
Line 338... Line 337...
338
   
337
   
339
 cmp  eax, 0
338
 cmp  eax, 0
Line 340... Line 339...
340
 jne  cfr001    ; yes, so get it
339
 jne  cfr001	; yes, so get it
341
   
340
   
342
 ; Now, request the file
341
 ; Now, request the file
343
 mov  eax, 53
342
 mov  eax, 53
Line 347... Line 346...
347
 mov  esi, tftp_filename
346
 mov  esi, tftp_filename
348
 int  0x40
347
 int  0x40
Line 349... Line 348...
349
   
348
   
Line 350... Line 349...
350
cfr002:
349
cfr002:
351
   
350
   
352
    mov  eax,23                 ; wait here for event
351
    mov  eax,23 		; wait here for event
Line 353... Line 352...
353
    mov  ebx,1                  ; Time out after 10ms
352
    mov  ebx,1			; Time out after 10ms
354
    int  0x40
353
    int  0x40
355
   
354
   
356
    cmp  eax,1                  ; redraw request ?
355
    cmp  eax,1			; redraw request ?
357
    je   cfr003
356
    je	 cfr003
358
    cmp  eax,2                  ; key in buffer ?
357
    cmp  eax,2			; key in buffer ?
Line 359... Line 358...
359
    je   cfr004
358
    je	 cfr004
360
    cmp  eax,3                  ; button in buffer ?
359
    cmp  eax,3			; button in buffer ?
361
    je   cfr005
360
    je	 cfr005
362
   
361
   
Line 375... Line 374...
375
 mov  eax, [prompt]
374
 mov  eax, [prompt]
376
 cmp  eax, p3
375
 cmp  eax, p3
377
 je  cfr008
376
 je  cfr008
378
 mov   dword [prompt], p3
377
 mov   dword [prompt], p3
379
 mov  dword [promptlen], p3len - p3
378
 mov  dword [promptlen], p3len - p3
380
 call  draw_window            ;
379
 call  draw_window	      ;
Line 381... Line 380...
381
   
380
   
382
cfr008:
381
cfr008:
Line 383... Line 382...
383
 ; we have data - this will be a tftp frame
382
 ; we have data - this will be a tftp frame
Line 439... Line 438...
439
 jb   get_more_stream
438
 jb   get_more_stream
Line 440... Line 439...
440
   
439
   
Line 441... Line 440...
441
wait_more:
440
wait_more:
442
   
441
   
443
 mov  eax,5    ; wait for correct timer position
442
 mov  eax,5    ; wait for correct timer position
444
               ; to trigger new play block
443
	       ; to trigger new play block
Line 445... Line 444...
445
 mov  ebx,1
444
 mov  ebx,1
446
 int  0x40
445
 int  0x40
Line 508... Line 507...
508
cfrerr:
507
cfrerr:
509
 ; simple implementation on error - just read all data, and return
508
 ; simple implementation on error - just read all data, and return
510
 mov  eax, 53
509
 mov  eax, 53
511
 mov  ebx, 3
510
 mov  ebx, 3
512
 mov  ecx, [socketNum]
511
 mov  ecx, [socketNum]
513
    int   0x40    ; read byte
512
    int   0x40	  ; read byte
Line 514... Line 513...
514
   
513
   
515
 mov  eax, 53
514
 mov  eax, 53
516
 mov  ebx, 2
515
 mov  ebx, 2
517
 mov  ecx, [socketNum]
516
 mov  ecx, [socketNum]
Line 518... Line 517...
518
    int   0x40    ; any more data?
517
    int   0x40	  ; any more data?
519
   
518
   
Line 520... Line 519...
520
 cmp  eax, 0
519
 cmp  eax, 0
Line 521... Line 520...
521
 jne  cfrerr    ; yes, so get it
520
 jne  cfrerr	; yes, so get it
522
   
521
   
523
 jmp  cfr006    ; close socket and close app
522
 jmp  cfr006	; close socket and close app
Line 524... Line 523...
524
   
523
   
525
cfr003:                         ; redraw request
524
cfr003: 			; redraw request
526
    call draw_window
525
    call draw_window
527
    jmp  cfr002
526
    jmp  cfr002
Line 528... Line 527...
528
   
527
   
529
cfr004:                         ; key pressed
528
cfr004: 			; key pressed
530
    mov  eax,2                  ; just read it and ignore
529
    mov  eax,2			; just read it and ignore
Line 531... Line 530...
531
    int  0x40
530
    int  0x40
532
    jmp  cfr002
531
    jmp  cfr002
Line 533... Line 532...
533
   
532
   
534
cfr005:                        ; button
533
cfr005: 		       ; button
535
    mov  eax,17                 ; get id
534
    mov  eax,17 		; get id
Line 545... Line 544...
545
 mov  ecx, [socketNum]
544
 mov  ecx, [socketNum]
546
    int   0x40
545
    int   0x40
Line 547... Line 546...
547
   
546
   
Line 548... Line 547...
548
 mov  [socketNum], dword 0
547
 mov  [socketNum], dword 0
549
   
548
   
Line 550... Line 549...
550
    mov  eax,-1                 ; close this program
549
    mov  eax,-1 		; close this program
Line 551... Line 550...
551
    int  0x40
550
    int  0x40
Line 561... Line 560...
561
   
560
   
Line 562... Line 561...
562
 mov  [socketNum], dword 0
561
 mov  [socketNum], dword 0
563
   
562
   
564
    mov   dword [prompt], p4
563
    mov   dword [prompt], p4
Line 565... Line 564...
565
    mov  dword [promptlen], p4len - p4
564
    mov  dword [promptlen], p4len - p4
Line 575... Line 574...
575
;   *********************************************
574
;   *********************************************
Line 576... Line 575...
576
   
575
   
Line 577... Line 576...
577
   
576
   
578
draw_window:
577
draw_window:
579
   
-
 
580
    mov  eax,12                    ; function 12:tell os about windowdraw
-
 
581
    mov  ebx,1                     ; 1, start of draw
-
 
582
    int  0x40
-
 
583
   
-
 
584
                                   ; DRAW WINDOW
-
 
585
    mov  eax,0                     ; function 0 : define and draw window
-
 
586
    mov  ebx,100*65536+230         ; [x start] *65536 + [x size]
-
 
587
    mov  ecx,100*65536+170         ; [y start] *65536 + [y size]
-
 
588
    mov  edx,0x03224466            ; color of work area RRGGBB
578
   
Line 589... Line 579...
589
    mov  esi,0x00334455            ; color of grab bar  RRGGBB,8->color gl
579
    mov  eax,12 		   ; function 12:tell os about windowdraw
590
    mov  edi,0x00ddeeff            ; color of frames    RRGGBB
580
    mov  ebx,1			   ; 1, start of draw
591
    int  0x40
581
    int  0x40
592
   
582
   
593
                                   ; WINDOW LABEL
583
				   ; DRAW WINDOW
594
    mov  eax,4                     ; function 4 : write text to window
584
    mov  eax,0			   ; function 0 : define and draw window
595
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
585
    mov  ebx,100*65536+230	   ; [x start] *65536 + [x size]
Line 596... Line 586...
596
    mov  ecx,0x00ffffff            ; color of text RRGGBB
586
    mov  ecx,100*65536+170	   ; [y start] *65536 + [y size]
597
    mov  edx,labelt                ; pointer to text beginning
587
    mov  edx,0x13224466 	   ; color of work area RRGGBB
598
    mov  esi,labellen-labelt       ; text length
588
    mov  edi,labelt
599
    int  0x40
589
    int  0x40
600
   
590
   
601
   
591
 
602
    mov  eax,8              ; COPY BUTTON
592
    mov  eax,8		    ; COPY BUTTON
Line 603... Line 593...
603
    mov  ebx,20*65536+190
593
    mov  ebx,20*65536+190
604
    mov  ecx,79*65536+15
594
    mov  ecx,79*65536+15
605
    mov  edx,3
595
    mov  edx,3
606
    mov  esi,0x557799
596
    mov  esi,0x557799
607
;    int  0x40
597
;    int  0x40
608
   
598
   
Line 650... Line 640...
650
    mov  ecx,[promptlen]
640
    mov  ecx,[promptlen]
651
    rep  movsb
641
    rep  movsb
Line 652... Line 642...
652
   
642
   
653
    ; Re-draw the screen text
643
    ; Re-draw the screen text
654
    cld
644
    cld
655
    mov  ebx,25*65536+35           ; draw info text with function 4
645
    mov  ebx,25*65536+35	   ; draw info text with function 4
656
    mov  ecx,0xffffff
646
    mov  ecx,0xffffff
657
    mov  edx,text
647
    mov  edx,text
658
    mov  esi,40
648
    mov  esi,40
659
  newline:
649
  newline:
Line 663... Line 653...
663
    add  edx,40
653
    add  edx,40
664
    cmp  [edx],byte 'x'
654
    cmp  [edx],byte 'x'
665
    jnz  newline
655
    jnz  newline
Line 666... Line 656...
666
   
656
   
667
   
657
   
668
    mov  eax,12                    ; function 12:tell os about windowdraw
658
    mov  eax,12 		   ; function 12:tell os about windowdraw
Line 669... Line 659...
669
    mov  ebx,2                     ; 2, end of draw
659
    mov  ebx,2			   ; 2, end of draw
Line 670... Line 660...
670
    int  0x40
660
    int  0x40
Line 671... Line 661...
671
   
661
   
672
    ret
662
    ret
Line 673... Line 663...
673
   
663
   
674
   
664
   
675
; DATA AREA
665
; DATA AREA
Line 676... Line 666...
676
   
666
   
677
source       db  'HEAT8M22.WAV   '
667
source	     db  'HEAT8M22.WAV   '
Line 696... Line 686...
696
    db 'WAVE FORMAT: 8 BIT,MONO,22050HZ         '
686
    db 'WAVE FORMAT: 8 BIT,MONO,22050HZ         '
697
    db '                                        '
687
    db '                                        '
698
    db '     SERVER -> PLAY FILE                '
688
    db '     SERVER -> PLAY FILE                '
699
    db '                                        '
689
    db '                                        '
700
    db '                                        '
690
    db '                                        '
701
    db 'x <- END MARKER, DONT DELETE            '
691
    db 'x' ; <- END MARKER, DONT DELETE
702
   
-
 
Line 703... Line -...
703
   
-
 
704
labelt:
-
 
705
    db   'TFTP Wave Player'
-
 
Line -... Line 692...
-
 
692
   
Line 706... Line 693...
706
labellen:
693
   
707
   
694
labelt	db   'TFTP Wave Player',0