Subversion Repositories Kolibri OS

Rev

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

Rev 131 Rev 485
Line 10... Line 10...
10
;    Compile with FASM for Menuet
10
;    Compile with FASM for Menuet
11
;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
11
;    Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
12
;
12
;
Line 13... Line 13...
13
   
13
   
14
use32
-
 
15
   
14
use32
16
                org     0x0
-
 
17
   
15
 org	0x0
18
                db      'MENUET00'              ; 8 byte id
16
 db	'MENUET01'    ; header
19
                dd      38                      ; required os
17
 dd	0x01	      ; header version
20
                dd      START                   ; program start
18
 dd	START	      ; entry point
21
                dd      I_END                   ; program image size
19
 dd	I_END	      ; image size
-
 
20
 dd	I_END+0x10000 ; required memory
22
                dd      0x100000                ; required amount of memory
21
 dd	I_END+0x10000 ; esp
Line 23... Line 22...
23
                dd      0x00000000              ; reserved=no extended header
22
 dd	0x0 , 0x0     ; I_Param , I_Path
24
   
23
   
25
include 'lang.inc'
24
include 'lang.inc'
Line 26... Line 25...
26
include 'macros.inc'
25
include '..\..\..\macros.inc'
Line 27... Line 26...
27
remote_ip  db  192,168,0,1
26
remote_ip  db  192,168,0,1
28
   
27
   
29
   
28
   
30
START:                      ; start of execution
29
START:                      ; start of execution
31
   
30
   
32
    mov  eax, 53                  ; open receiver socket
31
    mov  eax, 53                  ; open receiver socket
33
    mov  ebx, 0
32
    mov  ebx, 0
34
    mov  ecx, 0x5000              ; local port
33
    mov  ecx, 0x5000              ; local port
Line -... Line 34...
-
 
34
    mov  edx, 0xffff              ; remote port
35
    mov  edx, 0xffff              ; remote port
35
    mov  esi, dword [remote_ip]   ; remote IP
Line 36... Line 36...
36
    mov  esi, dword [remote_ip]   ; remote IP
36
    mcall
Line 37... Line 37...
37
    int  0x40
37
    mov  [socketNum],eax
38
    mov  [socketNum],eax
38
    mov  [0],eax                  ; save for remote code
39
    mov  [0],eax                  ; save for remote code
39
 
Line 40... Line 40...
40
   
40
red:   
41
    call draw_window            ; at first, draw the window
41
    call draw_window            ; at first, draw the window
42
   
42
   
43
still:
43
still:
Line 54... Line 54...
54
    jz   button
54
    jz   button
Line 55... Line 55...
55
   
55
   
56
    mov  eax,53                 ; data from cluster terminal ?
56
    mov  eax,53                 ; data from cluster terminal ?
57
    mov  ebx,2
57
    mov  ebx,2
58
    mov  ecx,[socketNum]
58
    mov  ecx,[socketNum]
Line 59... Line 59...
59
    int  0x40
59
    mcall
60
   
60
   
Line 61... Line 61...
61
    cmp  eax,0
61
    cmp  eax,0
Line 62... Line -...
62
    jne  data_arrived
-
 
63
   
-
 
64
    jmp  still
-
 
65
   
-
 
66
red:
62
    jne  data_arrived
67
    call draw_window
63
   
68
    jmp  still
64
    jmp  still
69
   
65
   
Line 70... Line 66...
70
key:
66
key:
Line 71... Line 67...
71
    mov  eax,2
67
    mov  eax,2
72
    int  0x40
68
    mcall
73
    jmp  still
69
    jmp  still
74
   
70
   
75
button:
71
button:
76
   
72
   
Line 77... Line 73...
77
    mov  eax,53
73
    mov  eax,53
Line 78... Line 74...
78
    mov  ebx,1
74
    mov  ebx,1
79
    mov  ecx,[socketNum]
75
    mov  ecx,[socketNum]
80
    int  0x40
76
    mcall
Line 81... Line 77...
81
    mov  eax,-1
77
    or  eax,-1
Line 82... Line 78...
82
    int  0x40
78
    mcall
Line 83... Line 79...
83
   
79
   
84
   
80
   
85
data_arrived:
81
data_arrived:
86
   
82
   
Line 87... Line 83...
87
    mov  eax,5                 ; wait a second for everything to arrive
83
    mov  eax,5                 ; wait a second for everything to arrive
88
    mov  ebx,10
84
    mov  ebx,10
Line 89... Line 85...
89
    int  0x40
85
    mcall
90
   
86
   
91
    mov  edi,I_END
87
    mov  edi,I_END
92
   
88
   
Line 93... Line 89...
93
  get_data:
89
  get_data:
94
   
90
   
Line 95... Line 91...
95
    mov  eax,53
91
    mov  eax,53
96
    mov  ebx,3
92
    mov  ebx,3
97
    mov  ecx,[socketNum]
93
    mov  ecx,[socketNum]
98
    int  0x40
94
    mcall
99
   
95
   
100
    mov  [edi],bl
96
    mov  [edi],bl
101
    inc  edi
97
    inc  edi
Line 102... Line 98...
102
   
98
   
Line 103... Line 99...
103
    mov  eax,53
99
    mov  eax,53
Line 131... Line 127...
131
   
127
   
Line 132... Line 128...
132
draw_window:
128
draw_window:
133
   
129
   
134
    mov  eax,12                    ; function 12:tell os about windowdraw
130
    mov  eax,12                    ; function 12:tell os about windowdraw
Line 135... Line 131...
135
    mov  ebx,1                     ; 1, start of draw
131
    mov  ebx,1                     ; 1, start of draw
136
    int  0x40
132
    mcall
137
   
133
   
138
                                   ; DRAW WINDOW
134
                                   ; DRAW WINDOW
139
    mov  eax,0                     ; function 0 : define and draw window
135
    mov  eax,0                     ; function 0 : define and draw window
140
    mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
-
 
141
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
136
    mov  ebx,100*65536+300         ; [x start] *65536 + [x size]
142
    mov  edx,0x03ffffff            ; color of work area RRGGBB
-
 
143
    mov  esi,0x80aabbcc            ; color of grab bar  RRGGBB,8->color gl
-
 
144
    mov  edi,0x00aabbcc            ; color of frames    RRGGBB
137
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
145
    int  0x40
-
 
146
   
-
 
147
    mov  eax,8
-
 
148
    mov  ebx,(286-19)*65536+12
-
 
149
    mov  ecx,4*65536+12
-
 
150
    mov  edx,1
138
    mov  edx,0x13ffffff            ; color of work area RRGGBB
151
    mov  esi,0xaabbcc
-
 
152
;    int  0x40
-
 
153
   
-
 
154
                                   ; WINDOW LABEL
-
 
155
    mov  eax,4                     ; function 4 : write text to window
-
 
156
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
-
 
157
    mov  ecx,0x00ffffff            ; color of text RRGGBB
-
 
Line 158... Line 139...
158
    mov  edx,labeltext             ; pointer to text beginning
139
    mov  edi,title                 ; WINDOW LABEL
159
    mov  esi,lte-labeltext         ; text length
140
    mcall
-
 
141
   
160
    int  0x40
142
                                   
161
   
143
    ; Re-draw the screen text
162
    ; Re-draw the screen text
144
    cld
163
    cld
145
    mov  eax,4
164
    mov  ebx,10*65536+30           ; draw info text with function 4
146
    mov  ebx,10*65536+30           ; draw info text with function 4
165
    mov  ecx,0x000000
147
    mov  ecx,0x000000
166
    mov  edx,text
-
 
167
    mov  esi,40
148
    mov  edx,text
168
  newline:
149
    mov  esi,40
169
    mov  eax,4
150
  newline:
170
    int  0x40
151
    mcall
Line 171... Line 152...
171
    add  ebx,16
152
    add  ebx,16
172
    add  edx,40
153
    add  edx,40
173
    cmp  [edx],byte 'x'
154
    cmp  [edx],byte 'x'
Line 174... Line 155...
174
    jnz  newline
155
    jnz  newline
Line 175... Line 156...
175
   
156
   
Line 195... Line 176...
195
    db 'Used port        : 0x5000               '
176
    db 'Used port        : 0x5000               '
196
    db 'Received messages:                      '
177
    db 'Received messages:                      '
197
    db 'x' ; <- END MARKER, DONT DELETE
178
    db 'x' ; <- END MARKER, DONT DELETE
198
end if
179
end if
Line 199... Line 180...
199
   
180
   
200
labeltext:  db  'NetSend(Server)'
-
 
Line 201... Line 181...
201
lte:
181
title  db  'NetSend(Server)',0
Line 202... Line 182...
202
   
182