Subversion Repositories Kolibri OS

Rev

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

Rev 153 Rev 485
Line 24... Line 24...
24
		db	'MENUET01'		; 8 byte id
24
		db	'MENUET01'		; 8 byte id
25
		dd	0x01			; required os
25
		dd	0x01			; required os
26
		dd	START			; program start
26
		dd	START			; program start
27
		dd	I_END			; program image size
27
		dd	I_END			; program image size
28
		dd	0x400000		; required amount of memory
28
		dd	0x400000		; required amount of memory
29
		dd	0x20000
29
		dd	0x400000
30
		dd	0,0			; reserved=no extended header
30
		dd	0,0			; reserved=no extended header
Line 31... Line 31...
31
 
31
 
Line 32... Line 32...
32
include "MACROS.INC"
32
include "..\..\..\MACROS.INC"
33
 
33
 
34
; 0x0+       - program image
34
; 0x0+       - program image
35
; 0x1ffff    - stack
35
; 0x1ffff    - stack
Line 55... Line 55...
55
 
55
 
Line 56... Line 56...
56
START:				; start of execution
56
START:				; start of execution
57
 
57
 
58
    mov  eax,70
58
    mov  eax,70
59
    mov  ebx,filel
59
    mov  ebx,filel
60
    int  0x40
60
    mcall
61
    mov  [board_size],ebx
61
    mov  [board_size],ebx
Line 62... Line 62...
62
    cmp  eax,0
62
    cmp  eax,0
Line 73... Line 73...
73
 
73
 
74
    mov  eax,70
74
    mov  eax,70
75
    mov  ebx,files
75
    mov  ebx,files
76
    mov  ecx,[board_size]
76
    mov  ecx,[board_size]
77
    mov  [files+12],ecx
77
    mov  [files+12],ecx
Line 78... Line 78...
78
    int  0x40
78
    mcall
79
 
79
 
80
    mov  [status],-1
80
    mov  [status],-1
81
    mov  [last_status],-2
81
    mov  [last_status],-2
Line 96... Line 96...
96
    call ops
96
    call ops
97
   nnn:
97
   nnn:
Line 98... Line 98...
98
 
98
 
99
    mov  eax,5
99
    mov  eax,5
100
    mov  ebx,1
100
    mov  ebx,1
Line 101... Line 101...
101
    int  0x40
101
    mcall
102
 
102
 
103
    mov  eax,11
103
    mov  eax,11
Line 104... Line 104...
104
    int  0x40
104
    mcall
Line 105... Line 105...
105
    call check_events
105
    call check_events
Line 119... Line 119...
119
 
119
 
Line 120... Line 120...
120
    ret
120
    ret
121
 
121
 
122
key:			       ; Keys are not valid at this part of the
122
key:			       ; Keys are not valid at this part of the
123
    mov  al,2		       ; loop. Just read it and ignore
123
    mov  al,2		       ; loop. Just read it and ignore
Line 124... Line 124...
124
    int  0x40
124
    mcall
Line 125... Line 125...
125
    ret
125
    ret
126
 
126
 
Line 127... Line 127...
127
button: 			; button
127
button: 			; button
128
 
128
 
129
    mov  al,17 		; get id
129
    mov  al,17 		; get id
130
    int  0x40
130
    mcall
131
 
131
 
132
    cmp  ah,1		; close
132
    cmp  ah,1		; close
133
    jnz  tst2
133
    jnz  tst2
134
    mov  eax,53
134
    mov  eax,53
135
    mov  ebx,8
135
    mov  ebx,8
Line 136... Line 136...
136
    mov  ecx,[socket]
136
    mov  ecx,[socket]
137
    int  0x40
137
    mcall
138
    mov  eax,-1
138
    mov  eax,-1
Line 147... Line 147...
147
    mov  ebx,5
147
    mov  ebx,5
148
    mov  ecx,80       ; local port # - http
148
    mov  ecx,80       ; local port # - http
149
    mov  edx,0	    ; no remote port specified
149
    mov  edx,0	    ; no remote port specified
150
    mov  esi,0	    ; no remote ip specified
150
    mov  esi,0	    ; no remote ip specified
151
    mov  edi,0	    ; PASSIVE open
151
    mov  edi,0	    ; PASSIVE open
152
    int  0x40
152
    mcall
153
    mov  [socket], eax
153
    mov  [socket], eax
154
    mov  [posy],1
154
    mov  [posy],1
155
    mov  [posx],0
155
    mov  [posx],0
156
    call check_for_incoming_data
156
    call check_for_incoming_data
157
    call clear_input
157
    call clear_input
Line 165... Line 165...
165
    mov  [server_active],0
165
    mov  [server_active],0
166
  close_socket:
166
  close_socket:
167
    mov  eax,53
167
    mov  eax,53
168
    mov  ebx,8
168
    mov  ebx,8
169
    mov  ecx,[socket]
169
    mov  ecx,[socket]
170
    int  0x40
170
    mcall
171
    mov  eax,5
171
    mov  eax,5
172
    mov  ebx,2
172
    mov  ebx,2
173
    int  0x40
173
    mcall
174
    mov  eax,53
174
    mov  eax,53
175
    mov  ebx,8
175
    mov  ebx,8
176
    mov  ecx,[socket]
176
    mov  ecx,[socket]
177
    int  0x40
177
    mcall
Line 178... Line 178...
178
 
178
 
179
    cmp  [server_active],1
179
    cmp  [server_active],1
180
    jne  no_re_open
180
    jne  no_re_open
181
    mov  eax,53
181
    mov  eax,53
182
    mov  ebx,5
182
    mov  ebx,5
183
    mov  ecx,80     ; local port # - http
183
    mov  ecx,80     ; local port # - http
184
    mov  edx,0	    ; no remote port specified
184
    mov  edx,0	    ; no remote port specified
185
    mov  esi,0	    ; no remote ip specified
185
    mov  esi,0	    ; no remote ip specified
186
    mov  edi,0	    ; PASSIVE open
186
    mov  edi,0	    ; PASSIVE open
187
    int  0x40
187
    mcall
188
    mov  [socket], eax
188
    mov  [socket], eax
Line 189... Line 189...
189
  no_re_open:
189
  no_re_open:
190
 
190
 
Line 243... Line 243...
243
    je	 data_received
243
    je	 data_received
244
    cmp  [input_text+256+1],dword 'POST'
244
    cmp  [input_text+256+1],dword 'POST'
245
    je	 data_received
245
    je	 data_received
246
    mov  eax,5
246
    mov  eax,5
247
    mov  ebx,1
247
    mov  ebx,1
248
    int  0x40
248
    mcall
249
    dec  [retries]
249
    dec  [retries]
250
    jnz  wait_for_data
250
    jnz  wait_for_data
251
    jmp  no_http_request
251
    jmp  no_http_request
252
  data_received:
252
  data_received:
Line 278... Line 278...
278
    ; write to socket
278
    ; write to socket
279
    mov  eax,53
279
    mov  eax,53
280
    mov  ebx,7
280
    mov  ebx,7
281
    mov  ecx,[socket]
281
    mov  ecx,[socket]
282
    mov  esi,[filepos]
282
    mov  esi,[filepos]
283
    int  0x40
283
    mcall
Line 284... Line 284...
284
 
284
 
285
    mov  eax,esi
285
    mov  eax,esi
286
    add  eax,edx
286
    add  eax,edx
287
    sub  eax,0x100000
287
    sub  eax,0x100000
Line 310... Line 310...
310
 
310
 
Line 311... Line 311...
311
  wait_more:
311
  wait_more:
312
 
312
 
313
    mov  eax,5
313
    mov  eax,5
Line 314... Line 314...
314
    mov  ebx,1
314
    mov  ebx,1
315
    int  0x40
315
    mcall
316
 
316
 
Line 317... Line 317...
317
    mov  eax,11
317
    mov  eax,11
318
    int  0x40
318
    mcall
319
    call check_events
319
    call check_events
320
 
320
 
Line 321... Line 321...
321
    mov  eax,53
321
    mov  eax,53
322
    mov  ebx,255
322
    mov  ebx,255
Line 323... Line 323...
323
    mov  ecx,103
323
    mov  ecx,103
Line 344... Line 344...
344
 
344
 
345
  mov  eax,13
345
  mov  eax,13
346
  mov  ebx,115*65536+8*6
346
  mov  ebx,115*65536+8*6
347
  mov  ecx,178*65536+10
347
  mov  ecx,178*65536+10
348
  mov  edx,0xffffff
348
  mov  edx,0xffffff
Line 349... Line 349...
349
  int  0x40
349
  mcall
350
 
350
 
351
  mov  eax,47
351
  mov  eax,47
352
  mov  ebx,8*65536
352
  mov  ebx,8*65536
353
  mov  ecx,edi
353
  mov  ecx,edi
354
  mov  edx,115*65536+178
354
  mov  edx,115*65536+178
Line 355... Line 355...
355
  mov  esi,0x000000
355
  mov  esi,0x000000
356
  int  0x40
356
  mcall
Line 366... Line 366...
366
    mov   eax,53		  ; send response and file length
366
    mov   eax,53		  ; send response and file length
367
    mov   ebx,7
367
    mov   ebx,7
368
    mov   ecx,[socket]
368
    mov   ecx,[socket]
369
    mov   edx,h_len-html_header
369
    mov   edx,h_len-html_header
370
    mov   esi,html_header
370
    mov   esi,html_header
371
    int   0x40
371
    mcall
Line 372... Line 372...
372
 
372
 
373
    mov   eax,53		  ; send file type
373
    mov   eax,53		  ; send file type
374
    mov   ebx,7
374
    mov   ebx,7
375
    mov   ecx,[socket]
375
    mov   ecx,[socket]
376
    mov   edx,[type_len]
376
    mov   edx,[type_len]
377
    mov   esi,[file_type]
377
    mov   esi,[file_type]
Line 378... Line 378...
378
    int   0x40
378
    mcall
379
 
379
 
Line 380... Line 380...
380
    popa
380
    popa
Line 435... Line 435...
435
 
435
 
Line 436... Line 436...
436
  yes_new_message:
436
  yes_new_message:
437
 
437
 
438
    mov  eax,70
438
    mov  eax,70
439
    mov  ebx,filel
439
    mov  ebx,filel
Line 440... Line 440...
440
    int  0x40
440
    mcall
441
    mov  [board_size],ebx
441
    mov  [board_size],ebx
Line 597... Line 597...
597
    mov  eax,[board_size]
597
    mov  eax,[board_size]
598
    mov  [files+12],eax
598
    mov  [files+12],eax
Line 599... Line 599...
599
 
599
 
600
    mov  eax,70
600
    mov  eax,70
601
    mov  ebx,files
601
    mov  ebx,files
Line 602... Line 602...
602
    int  0x40
602
    mcall
603
 
603
 
604
  no_new_message:
604
  no_new_message:
605
    mov  esi,0x20000
605
    mov  esi,0x20000
Line 767... Line 767...
767
    rep  movsb
767
    rep  movsb
Line 768... Line 768...
768
 
768
 
769
    mov  [fileinfo+12],dword 1	 ; file exists ?
769
    mov  [fileinfo+12],dword 1	 ; file exists ?
770
    mov  eax,70
770
    mov  eax,70
771
    mov  ebx,fileinfo
771
    mov  ebx,fileinfo
Line 772... Line 772...
772
    int  0x40
772
    mcall
773
 
773
 
774
    cmp  eax,0	       ; file not found - message
774
    cmp  eax,0	       ; file not found - message
775
    je	 file_found
775
    je	 file_found
Line 793... Line 793...
793
   file_found:
793
   file_found:
Line 794... Line 794...
794
 
794
 
795
    mov  [fileinfo+12],dword 0x2f0000 ; read all of file
795
    mov  [fileinfo+12],dword 0x2f0000 ; read all of file
796
    mov  eax,70
796
    mov  eax,70
797
    mov  ebx,fileinfo
797
    mov  ebx,fileinfo
Line 798... Line 798...
798
    int  0x40
798
    mcall
799
 
799
 
Line 800... Line 800...
800
   file_not_found:
800
   file_not_found:
Line 853... Line 853...
853
set_time:
853
set_time:
Line 854... Line 854...
854
 
854
 
Line 855... Line 855...
855
    pusha
855
    pusha
856
 
856
 
Line 857... Line 857...
857
    mov  eax,3
857
    mov  eax,3
858
    int  0x40
858
    mcall
859
 
859
 
860
    mov  ecx,3
860
    mov  ecx,3
Line 878... Line 878...
878
set_date:
878
set_date:
Line 879... Line 879...
879
 
879
 
Line 880... Line 880...
880
    pusha
880
    pusha
881
 
881
 
Line 882... Line 882...
882
    mov  eax,29
882
    mov  eax,29
883
    int  0x40
883
    mcall
884
 
884
 
885
    mov  ecx,3
885
    mov  ecx,3
Line 908... Line 908...
908
   check:
908
   check:
Line 909... Line 909...
909
 
909
 
910
    mov  eax, 53
910
    mov  eax, 53
911
    mov  ebx, 2
911
    mov  ebx, 2
912
    mov  ecx, [socket]
912
    mov  ecx, [socket]
Line 913... Line 913...
913
    int  0x40
913
    mcall
914
 
914
 
Line 915... Line 915...
915
    cmp  eax,0
915
    cmp  eax,0
Line 916... Line 916...
916
    je   _ret_now
916
    je   _ret_now
917
 
917
 
918
  new_data:
918
  new_data:
919
 
919
 
Line 920... Line 920...
920
    mov  eax,53
920
    mov  eax,53
921
    mov  ebx,2
921
    mov  ebx,2
Line 922... Line 922...
922
    mov  ecx,[socket]
922
    mov  ecx,[socket]
923
    int  0x40
923
    mcall
924
 
924
 
925
    cmp  eax,0
925
    cmp  eax,0
Line 926... Line 926...
926
    je   _ret
926
    je   _ret
927
 
927
 
928
    mov  eax,53
928
    mov  eax,53
929
    mov  ebx,3
929
    mov  ebx,3
Line 962... Line 962...
962
     mov  ebx,1
962
     mov  ebx,1
963
     cmp  [input_text+256+1],dword 'POST'
963
     cmp  [input_text+256+1],dword 'POST'
964
     jne  no_ld
964
     jne  no_ld
965
     mov  ebx,50
965
     mov  ebx,50
966
   no_ld:
966
   no_ld:
967
     int  0x40
967
     mcall
Line 968... Line 968...
968
 
968
 
Line 969... Line 969...
969
     jmp  check
969
     jmp  check
Line 983... Line 983...
983
    pusha
983
    pusha
Line 984... Line 984...
984
 
984
 
985
    mov  eax,53
985
    mov  eax,53
986
    mov  ebx,6
986
    mov  ebx,6
987
    mov  ecx,[socket]
987
    mov  ecx,[socket]
Line 988... Line 988...
988
    int  0x40
988
    mcall
989
 
989
 
990
    cmp  eax,[status]
990
    cmp  eax,[status]
991
    je	 c_ret
991
    je	 c_ret
Line 1019... Line 1019...
1019
 
1019
 
Line 1020... Line 1020...
1020
    mov  edi,[addr]
1020
    mov  edi,[addr]
1021
 
1021
 
1022
  f11:
1022
  f11:
1023
    mov  eax,10
1023
    mov  eax,10
1024
    int  0x40
1024
    mcall
1025
    cmp  eax,2
1025
    cmp  eax,2
1026
    jne  read_done
1026
    jne  read_done
1027
    mov  eax,2
1027
    mov  eax,2
1028
    int  0x40
1028
    mcall
1029
    shr  eax,8
1029
    shr  eax,8
1030
    cmp  eax,13
1030
    cmp  eax,13
1031
    je	 read_done
1031
    je	 read_done
Line 1081... Line 1081...
1081
    mov  ebx,97*65536
1081
    mov  ebx,97*65536
1082
    add  ebx,[ya]
1082
    add  ebx,[ya]
1083
    mov  ecx,0x40000000
1083
    mov  ecx,0x40000000
1084
    mov  esi,23
1084
    mov  esi,23
1085
    mov  edi,0xffffff
1085
    mov  edi,0xffffff
1086
    int  0x40
1086
    mcall
Line 1087... Line 1087...
1087
 
1087
 
1088
    popa
1088
    popa
Line 1096... Line 1096...
1096
 
1096
 
Line 1097... Line 1097...
1097
draw_window:
1097
draw_window:
1098
 
1098
 
1099
    mov  eax,12 		   ; function 12:tell os about windowdraw
1099
    mov  eax,12 		   ; function 12:tell os about windowdraw
Line 1100... Line 1100...
1100
    mov  ebx,1			   ; 1, start of draw
1100
    mov  ebx,1			   ; 1, start of draw
1101
    int  0x40
1101
    mcall
1102
 
1102
 
1103
				   ; DRAW WINDOW
1103
				   ; DRAW WINDOW
1104
    mov  eax,0			   ; function 0 : define and draw window
1104
    mov  eax,0			   ; function 0 : define and draw window
1105
    mov  ebx,100*65536+480	   ; [x start] *65536 + [x size]
1105
    mov  ebx,100*65536+480	   ; [x start] *65536 + [x size]
1106
    mov  ecx,100*65536+215	   ; [y start] *65536 + [y size]
1106
    mov  ecx,100*65536+215	   ; [y start] *65536 + [y size]
Line 1107... Line 1107...
1107
    mov  edx,0x13ffffff 	   ; color of work area RRGGBB
1107
    mov  edx,0x13ffffff 	   ; color of work area RRGGBB
1108
    mov  edi,header		   ; WINDOW LABEL
1108
    mov  edi,title		   ; WINDOW LABEL
1109
    int  0x40
1109
    mcall
1110
 
1110
 
1111
    mov  eax,8			   ; function 8 : define and draw button
1111
    mov  eax,8			   ; function 8 : define and draw button
1112
    mov  ebx,(40)*65536+20	   ; [x start] *65536 + [x size]
1112
    mov  ebx,(40)*65536+20	   ; [x start] *65536 + [x size]
Line 1113... Line 1113...
1113
    mov  ecx,59*65536+9 	   ; [y start] *65536 + [y size]
1113
    mov  ecx,59*65536+9 	   ; [y start] *65536 + [y size]
1114
    mov  edx,2			   ; button id
1114
    mov  edx,2			   ; button id
1115
    mov  esi,0x66aa66		   ; button color RRGGBB
1115
    mov  esi,0x66aa66		   ; button color RRGGBB
1116
    int  0x40
1116
    mcall
1117
 
1117
 
1118
			   ; function 8 : define and draw button
1118
			   ; function 8 : define and draw button
Line 1119... Line 1119...
1119
    mov  ebx,(40)*65536+20	   ; [x start] *65536 + [x size]
1119
    mov  ebx,(40)*65536+20	   ; [x start] *65536 + [x size]
1120
    mov  ecx,72*65536+9          ; [y start] *65536 + [y size]
1120
    mov  ecx,72*65536+9          ; [y start] *65536 + [y size]
1121
    mov  edx,4			   ; button id
1121
    mov  edx,4			   ; button id
1122
    mov  esi,0xaa6666		   ; button color RRGGBB
1122
    mov  esi,0xaa6666		   ; button color RRGGBB
1123
    int  0x40
1123
    mcall
1124
 
1124
 
Line 1125... Line 1125...
1125
			   ; Enter directory
1125
			   ; Enter directory
1126
    mov  ebx,(25)*65536+66
1126
    mov  ebx,(25)*65536+66
1127
    mov  ecx,135*65536+15
1127
    mov  ecx,135*65536+15
1128
    mov  edx,6
1128
    mov  edx,6
1129
    mov  esi,0x3388dd
1129
    mov  esi,0x3388dd
Line 1130... Line 1130...
1130
    int  0x40
1130
    mcall
1131
 
1131
 
1132
    mov  eax,38
1132
    mov  eax,38
1133
    mov  ebx,240*65536+240
1133
    mov  ebx,240*65536+240
Line 1134... Line 1134...
1134
    mov  ecx,22*65536+210
1134
    mov  ecx,22*65536+210
Line 1135... Line 1135...
1135
    mov  edx,0x6699cc ; 002288
1135
    mov  edx,0x6699cc ; 002288
1136
    int  0x40
1136
    mcall
1137
 
1137
 
Line 1138... Line 1138...
1138
 
1138
 
Line 1139... Line 1139...
1139
    mov  ebx,241*65536+241
1139
    mov  ebx,241*65536+241
Line 1156... Line 1156...
1156
 
1156
 
1157
    mov  ebx,25*65536+35	   ; draw info text with function 4
1157
    mov  ebx,25*65536+35	   ; draw info text with function 4
1158
    mov  ecx,0x000000
1158
    mov  ecx,0x000000
1159
    mov  edx,text
1159
    mov  edx,text
-
 
1160
    mov  esi,35
1160
    mov  esi,35
1161
    mov  eax,13
1161
  newline:
1162
  newline:
1162
    pusha
1163
    pusha
1163
    cmp  ebx,25*65536+61
1164
    cmp  ebx,25*65536+61
1164
    je   now
1165
    je   now
Line 1168... Line 1169...
1168
    je   now
1169
    je   now
1169
    mov  ecx,ebx
1170
    mov  ecx,ebx
1170
    mov  bx,35*6
1171
    mov  bx,35*6
1171
    shl  ecx,16
1172
    shl  ecx,16
1172
    mov  cx,9
1173
    mov  cx,9
1173
    mov  eax,13
-
 
1174
    mov  edx,0xffffff
1174
    mov  edx,0xffffff
1175
    int  0x40
1175
    mcall
1176
   now:
1176
   now:
1177
    popa
1177
    popa
1178
    mov  eax,4
1178
    mov  eax,4
1179
    int  0x40
1179
    mcall
1180
    add  ebx,13
1180
    add  ebx,13
1181
    add  edx,40
1181
    add  edx,40
1182
    cmp  [edx],byte 'x'
1182
    cmp  [edx],byte 'x'
1183
    jnz  newline
1183
    jnz  newline
Line 1197... Line 1197...
1197
    mov  bx,35*6
1197
    mov  bx,35*6
1198
    shl  ecx,16
1198
    shl  ecx,16
1199
    mov  cx,9
1199
    mov  cx,9
1200
    mov  eax,13
1200
    mov  eax,13
1201
    mov  edx,0xffffff
1201
    mov  edx,0xffffff
1202
    int  0x40
1202
    mcall
1203
    popa
1203
    popa
1204
    mov  eax,4
1204
    mov  eax,4
1205
    int  0x40
1205
    mcall
1206
    add  ebx,10
1206
    add  ebx,10
1207
    add  edx,256
1207
    add  edx,256
1208
    dec  edi
1208
    dec  edi
1209
    jnz  newline2
1209
    jnz  newline2
Line 1292... Line 1292...
1292
jpgl:
1292
jpgl:
1293
unk:   db  'Content-Type: unknown/unknown',13,10,13,10
1293
unk:   db  'Content-Type: unknown/unknown',13,10,13,10
1294
unkl:
1294
unkl:
Line 1295... Line 1295...
1295
 
1295
 
Line 1296... Line 1296...
1296
 
1296
 
1297
header db   appname,version,0
1297
title db   appname,version,0
Line 1298... Line 1298...
1298
 
1298