Subversion Repositories Kolibri OS

Rev

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

Rev 109 Rev 485
Line 4... Line 4...
4
;    Compile with FASM for Menuet
4
;    Compile with FASM for Menuet
5
;
5
;
Line 6... Line 6...
6
   
6
   
7
   
-
 
8
use32
7
   
9
   
-
 
10
                org     0x0
8
use32
11
   
9
 org	0x0
12
                db      'MENUET00'              ; 8 byte id
10
 db	'MENUET01'    ; header
13
                dd      38                      ; required os
11
 dd	0x01	      ; header version
14
                dd      START                   ; program start
12
 dd	START	      ; entry point
-
 
13
 dd	I_END	      ; image size
15
                dd      I_END                   ; program image size
14
 dd	I_END+0x10000 ; required memory
Line 16... Line 15...
16
                dd      0x100000                ; required amount of memory
15
 dd	I_END+0x10000 ; esp
17
                dd      0x00000000              ; reserved=no extended header
16
 dd	0x0 , 0x0     ; I_Param , I_Path
18
   
17
   
Line 19... Line 18...
19
include 'lang.inc'
18
include 'lang.inc'
Line 20... Line 19...
20
include 'macros.inc'
19
include '..\..\..\macros.inc'
21
remote_ip  db  192,168,1,26
20
remote_ip  db  192,168,1,26
22
   
21
   
23
   
22
   
24
START:                      ; start of execution
23
START:                      ; start of execution
25
   
24
   
26
    mov  eax, 53                  ; open receiver socket
25
    mov  eax, 53                  ; open receiver socket
27
    mov  ebx, 0
26
    mov  ebx, 0
Line -... Line 27...
-
 
27
    mov  ecx, 0x3000              ; local port
28
    mov  ecx, 0x3000              ; local port
28
    mov  edx, 0xffff              ; remote port
Line 29... Line 29...
29
    mov  edx, 0xffff              ; remote port
29
    mov  esi, dword [remote_ip]   ; remote IP
Line 30... Line 30...
30
    mov  esi, dword [remote_ip]   ; remote IP
30
    mcall
31
    int  0x40
31
    mov  [socketNum],eax
32
    mov  [socketNum],eax
32
    mov  [0],eax                  ; save for remote code
Line 33... Line 33...
33
    mov  [0],eax                  ; save for remote code
33
 
34
   
34
red:   
35
    call draw_window            ; at first, draw the window
35
    call draw_window            ; at first, draw the window
36
   
36
   
Line 48... Line 48...
48
    jz   button
48
    jz   button
Line 49... Line 49...
49
   
49
   
50
    mov  eax,53                 ; data from cluster terminal ?
50
    mov  eax,53                 ; data from cluster terminal ?
51
    mov  ebx,2
51
    mov  ebx,2
52
    mov  ecx,[socketNum]
52
    mov  ecx,[socketNum]
Line 53... Line 53...
53
    int  0x40
53
    mcall
54
   
54
   
Line 55... Line 55...
55
    cmp  eax,0
55
    cmp  eax,0
Line 56... Line -...
56
    jne  data_arrived
-
 
57
   
-
 
58
    jmp  still
-
 
59
   
-
 
60
red:
56
    jne  data_arrived
61
    call draw_window
57
   
62
    jmp  still
58
    jmp  still
63
   
59
   
Line 64... Line 60...
64
key:
60
key:
Line 65... Line 61...
65
    mov  eax,2
61
    mov  eax,2
66
    int  0x40
62
    mcall
67
    jmp  still
63
    jmp  still
68
   
64
   
69
button:
65
button:
70
   
66
   
Line 71... Line 67...
71
    mov  eax,53
67
    mov  eax,53
Line 72... Line 68...
72
    mov  ebx,1
68
    mov  ebx,1
73
    mov  ecx,[socketNum]
69
    mov  ecx,[socketNum]
74
    int  0x40
70
    mcall
Line 75... Line 71...
75
    mov  eax,-1
71
    or  eax,-1
Line 76... Line 72...
76
    int  0x40
72
    mcall
Line 77... Line 73...
77
   
73
   
78
   
74
   
79
data_arrived:
75
data_arrived:
80
   
76
   
Line 81... Line 77...
81
    mov  eax,5                 ; wait a second for everything to arrive
77
    mov  eax,5                 ; wait a second for everything to arrive
82
    mov  ebx,10
78
    mov  ebx,10
Line 83... Line 79...
83
    int  0x40
79
    mcall
84
   
80
   
85
    mov  edi,I_END
81
    mov  edi,I_END
86
   
82
   
Line 87... Line 83...
87
  get_data:
83
  get_data:
88
   
84
   
Line 89... Line 85...
89
    mov  eax,53
85
    mov  eax,53
Line 108... Line 104...
108
    mov  ebx,10*65536+50
104
    mov  ebx,10*65536+50
109
    add  ebx,[y]
105
    add  ebx,[y]
110
    mov  ecx,0x000000
106
    mov  ecx,0x000000
111
    mov  edx,I_END
107
    mov  edx,I_END
112
    mov  esi,23
108
    mov  esi,23
113
    int  0x40
109
    mcall
Line 114... Line 110...
114
   
110
   
Line 115... Line 111...
115
    add  [y],10
111
    add  [y],10
116
   
112
   
Line 144... Line 140...
144
   
140
   
Line 145... Line 141...
145
draw_window:
141
draw_window:
146
   
142
   
147
    mov  eax,12                    ; function 12:tell os about windowdraw
143
    mov  eax,12                    ; function 12:tell os about windowdraw
Line 148... Line 144...
148
    mov  ebx,1                     ; 1, start of draw
144
    mov  ebx,1                     ; 1, start of draw
149
    int  0x40
145
    mcall
150
   
146
   
151
                                   ; DRAW WINDOW
147
                                   ; DRAW WINDOW
152
    mov  eax,0                     ; function 0 : define and draw window
148
    mov  eax,0                     ; function 0 : define and draw window
153
    mov  ebx,100*65536+286         ; [x start] *65536 + [x size]
-
 
154
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
149
    mov  ebx,100*65536+286         ; [x start] *65536 + [x size]
155
    mov  edx,0x03ffffff            ; color of work area RRGGBB
-
 
156
    mov  esi,0x80aabbcc            ; color of grab bar  RRGGBB,8->color gl
-
 
157
    mov  edi,0x00aabbcc            ; color of frames    RRGGBB
150
    mov  ecx,100*65536+330         ; [y start] *65536 + [y size]
158
    int  0x40
-
 
159
   
-
 
160
    mov  eax,8
-
 
161
    mov  ebx,(286-19)*65536+12
-
 
162
    mov  ecx,4*65536+12
-
 
163
    mov  edx,1
151
    mov  edx,0x13ffffff            ; color of work area RRGGBB
164
    mov  esi,0xaabbcc
-
 
165
;    int  0x40
-
 
166
   
-
 
167
                                   ; WINDOW LABEL
-
 
168
    mov  eax,4                     ; function 4 : write text to window
-
 
169
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
-
 
170
    mov  ecx,0x00ffffff            ; color of text RRGGBB
-
 
Line 171... Line 152...
171
    mov  edx,labeltext             ; pointer to text beginning
152
    mov  edi,title                 ; WINDOW LABEL
172
    mov  esi,lte-labeltext         ; text length
153
    mcall
-
 
154
   
173
    int  0x40
155
   
174
   
156
    ; Re-draw the screen text
175
    ; Re-draw the screen text
157
    cld
176
    cld
158
    mov  eax,4
177
    mov  ebx,10*65536+30           ; draw info text with function 4
159
    mov  ebx,10*65536+30           ; draw info text with function 4
178
    mov  ecx,0x000000
160
    mov  ecx,0x000000
179
    mov  edx,text
-
 
180
    mov  esi,40
161
    mov  edx,text
181
  newline:
162
    mov  esi,40
182
    mov  eax,4
163
  newline:
183
    int  0x40
164
    mcall
Line 184... Line 165...
184
    add  ebx,16
165
    add  ebx,16
185
    add  edx,40
166
    add  edx,40
186
    cmp  [edx],byte 'x'
167
    cmp  [edx],byte 'x'
Line 187... Line 168...
187
    jnz  newline
168
    jnz  newline
Line 188... Line 169...
188
   
169
   
Line 189... Line 170...
189
   
170
   
190
    mov  eax,12                    ; function 12:tell os about windowdraw
171
    mov  eax,12                    ; function 12:tell os about windowdraw
191
    mov  ebx,2                     ; 2, end of draw
172
    mov  ebx,2                     ; 2, end of draw
192
    int  0x40
173
    mcall
Line 193... Line 174...
193
   
174
   
194
    ret
-
 
Line 195... Line 175...
195
   
175
    ret
Line 196... Line 176...
196
   
176
   
197
; DATA AREA
177
   
Line 216... Line 196...
216
   
196
   
217
execute     db  'MenuetRemote00'  ; 00  header      ; -> remote port 0x3000
197
execute     db  'MenuetRemote00'  ; 00  header      ; -> remote port 0x3000
218
            db  2                 ; 14  execute
198
            db  2                 ; 14  execute
219
            dd  0x0               ; 15  position
199
            dd  0x0               ; 15  position
220
                                  ; 19
-
 
221
   
200
                                  ; 19