Subversion Repositories Kolibri OS

Rev

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

Rev 8133 Rev 8170
Line 1... Line 1...
1
;const int
1
;const int
2
MENUET_BORDER_SIZE = 4;
2
KOLIBRI_BORDER_SIZE = 4;
3
;const int
3
;const int
4
MENUET_HEADER_SIZE = 20;
4
KOLIBRI_HEADER_SIZE = 20;
Line 5... Line 5...
5
 
5
 
6
;const int
6
;const int
7
KOLIBRI_THREAD_DATA_USER     = 0; // Thread data begin from the user dword
7
KOLIBRI_THREAD_DATA_USER     = 0; // Thread data begin from the user dword
8
;const int
8
;const int
Line 37... Line 37...
37
KOLIBRI_THREAD_DATA_LAST_SY  = 15;
37
KOLIBRI_THREAD_DATA_LAST_SY  = 15;
38
;const int
38
;const int
39
KOLIBRI_THREAD_DATA_LEN	    = 16;
39
KOLIBRI_THREAD_DATA_LEN	    = 16;
Line 40... Line 40...
40
 
40
 
41
;const int
41
;const int
Line 42... Line 42...
42
MENUET_MUTEX_MAX_TIME_WAIT  = 20;
42
KOLIBRI_MUTEX_MAX_TIME_WAIT  = 20;
43
 
43
 
Line 44... Line 44...
44
;const int
44
;const int
Line 51... Line 51...
51
 
51
 
52
macro segment name
52
macro segment name
53
{
53
{
54
  segment name
54
  segment name
55
  if name eq _init_ | name eq _INIT_
55
  if name eq _init_ | name eq _INIT_
56
Menuet_SegmentInit:
56
Kolibri_SegmentInit:
57
  else if name eq _exit_ | name eq _EXIT_
57
  else if name eq _exit_ | name eq _EXIT_
58
Menuet_SegmentExit:
58
Kolibri_SegmentExit:
59
  end if
59
  end if
Line 60... Line 60...
60
}
60
}
61
 
61
 
62
macro endseg  name
62
macro endseg  name
63
{
63
{
64
  if name eq _init_ | name eq _INIT_
64
  if name eq _init_ | name eq _INIT_
65
Menuet_SegmentInitEnd:
65
Kolibri_SegmentInitEnd:
66
  else if name eq _exit_ | name eq _EXIT_
66
  else if name eq _exit_ | name eq _EXIT_
67
Menuet_SegmentExitEnd:
67
Kolibri_SegmentExitEnd:
68
  end if
68
  end if
Line 69... Line 69...
69
  endseg  name
69
  endseg  name
70
}
70
}
71
 
71
 
72
macro Menuet_Put_MovEaxVal_Ret	address,val
72
macro Kolibri_Put_MovEaxVal_Ret	address,val
73
{
73
{
74
  mov  byte [address],0xB8
74
  mov  byte [address],0xB8
Line 75... Line 75...
75
  mov  dword [address+4],0xC089C300
75
  mov  dword [address+4],0xC089C300
76
  mov  dword [address+1],val
76
  mov  dword [address+1],val
77
}
77
}
78
 
78
 
79
proc @Kolibri@Main$qv
79
proc @Kolibri@Main$qv
80
  and  esp,not 3
80
  and  esp,not 3
81
  sub  esp,1024
81
  sub  esp,1024
82
  mov  eax,9
82
  mov  eax,SF_THREAD_INFO
83
  mov  ebx,esp
83
  mov  ebx,esp
Line 95... Line 95...
95
end if
95
end if
96
  xor  eax,eax
96
  xor  eax,eax
97
  cld
97
  cld
98
  mov  edi,@Kolibri@_ThreadTable
98
  mov  edi,@Kolibri@_ThreadTable
99
  mov  ecx,256
99
  mov  ecx,256
100
  rep stos dword [edi]
100
  rep stosd
101
  mov  esi,@Kolibri@GetPid$qv
101
  mov  esi,@Kolibri@GetPid$qv
102
  mov  edi,@Kolibri@_ThreadSavedBegProc
102
  mov  edi,@Kolibri@_ThreadSavedBegProc
103
  movs dword [edi],[esi]
103
  movsd
104
  movs dword [edi],[esi]
104
  movsd
105
  mov  esi,@Kolibri@GetThreadData$qv
105
  mov  esi,@Kolibri@GetThreadData$qv
106
  movs dword [edi],[esi]
106
  movsd
107
  movs dword [edi],[esi]
107
  movsd
108
  Menuet_Put_MovEaxVal_Ret  @Kolibri@GetPid$qv,edx
108
  Kolibri_Put_MovEaxVal_Ret  @Kolibri@GetPid$qv,edx
109
if defined MenuetHeapInit
109
if defined KolibriHeapInit
110
  mov  ecx,esp
110
  mov  ecx,esp
111
  push ebx
111
  push ebx
112
  push ecx
112
  push ecx
113
  push U_END
113
  push U_END
114
  call MenuetHeapInit	; Initialize a dynamic heap and create new memory in its begin.
114
  call KolibriHeapInit	; Initialize a dynamic heap and create new memory in its begin.
115
  pop  ecx		; Parameters: begin of a new heap, end of data to create in
115
  pop  ecx		; Parameters: begin of a new heap, end of data to create in
116
  mov  [esp+4],eax	; the begin of a heap. Return address of the created data.
116
  mov  [esp+4],eax	; the begin of a heap. Return address of the created data.
117
  mov  dword [esp],0
117
  mov  dword [esp],0
118
else
118
else
119
  xor  eax,eax
119
  xor  eax,eax
Line 121... Line 121...
121
  push eax
121
  push eax
122
end if
122
end if
123
  call @Kolibri@ThreadMain$qpvt1
123
  call @Kolibri@ThreadMain$qpvt1
124
.ThreadFinish:
124
.ThreadFinish:
125
  add  esp,8
125
  add  esp,8
126
if defined MenuetHeapFreeAndThreadFinish
126
if defined KolibriHeapFreeAndThreadFinish
127
  test eax,eax
127
  test eax,eax
128
  jz   .ThreadFinish_end
128
  jz   .ThreadFinish_end
129
  push dword @Kolibri@_ExitProcessNow
129
  push dword @Kolibri@_ExitProcessNow
130
  push eax
130
  push eax
131
  call MenuetHeapFreeAndThreadFinish   ; Free the given memory and finish the thread,
131
  call KolibriHeapFreeAndThreadFinish   ; Free the given memory and finish the thread,
132
end if				       ; should exit process if second argument points to not zero.
132
end if				       ; should exit process if second argument points to not zero.
133
.ThreadFinish_end:
133
.ThreadFinish_end:
134
  or   eax,-1
134
  or   eax,-1
135
  int  0x40
135
  int  0x40
136
endp
136
endp
Line 140... Line 140...
140
  xchg ebp,[esp+8]
140
  xchg ebp,[esp+8]
141
  push esi edi
141
  push esi edi
142
  sub  esp,KOLIBRI_THREAD_DATA_LEN*4
142
  sub  esp,KOLIBRI_THREAD_DATA_LEN*4
143
  mov  [esp],ebx
143
  mov  [esp],ebx
144
  mov  [esp+4],ebp
144
  mov  [esp+4],ebp
145
  mov  eax,40
145
  mov  eax,SF_SET_EVENTS_MASK
146
  mov  ebx,0x27
146
  mov  ebx,0x27
147
  int  0x40
147
  int  0x40
148
  mov  ebx,esp
148
  mov  ebx,esp
149
  cmp  byte [@Kolibri@_ThreadSavedBegProc],0x90
149
  cmp  byte [@Kolibri@_ThreadSavedBegProc],0x90
150
  jz   .main_else_first_check
150
  jz   .main_else_first_check
151
  Menuet_Put_MovEaxVal_Ret  @Kolibri@GetThreadData$qv,esp
151
  Kolibri_Put_MovEaxVal_Ret  @Kolibri@GetThreadData$qv,esp
152
if defined Menuet_SegmentInit & defined Menuet_SegmentInitEnd
152
if defined Kolibri_SegmentInit & defined Kolibri_SegmentInitEnd
153
  push Menuet_SegmentInitEnd
153
  push Kolibri_SegmentInitEnd
154
  push Menuet_SegmentInit
154
  push Kolibri_SegmentInit
155
  jmp  .main_after_first_check
155
  jmp  .main_after_first_check
156
end if
156
end if
157
.main_else_first_check:
157
.main_else_first_check:
158
  xor  eax,eax
158
  xor  eax,eax
159
  push eax eax
159
  push eax eax
Line 164... Line 164...
164
  test al,al
164
  test al,al
165
  jnz  .main_test_close_first
165
  jnz  .main_test_close_first
166
  jmp  .main_end
166
  jmp  .main_end
167
.main_close_first:
167
.main_close_first:
168
  btr  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],31
168
  btr  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],31
-
 
169
if defined @@KolibriOnClose$qppv
169
  push esp
170
  push esp
170
  call @@KolibriOnClose$qppv
171
  call @@KolibriOnClose$qppv
171
  pop  ecx
172
  pop  ecx
172
  test al,al
173
  test al,al
173
  jnz  .main_end
174
  jnz  .main_end
-
 
175
end if
174
.main_test_close_first:
176
.main_test_close_first:
175
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
177
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
176
  jl   .main_close_first
178
  jl   .main_close_first
177
  push esp
179
  push esp
178
  push dword 1
180
  push dword 1
179
  call @Kolibri@Redraw$qippv
181
  call @Kolibri@Redraw$qippv
180
  add  esp,8
182
  add  esp,8
181
.main_paint_msg:
183
.main_paint_msg:
182
  or   dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],3
184
  or   dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],3
183
  sub  esp,1024
185
  sub  esp,1024
184
  mov  eax,9
186
  mov  eax,SF_THREAD_INFO
185
  mov  ebx,esp
187
  mov  ebx,esp
186
  mov  ecx,-1
188
  mov  ecx,-1
187
  int  0x40
189
  int  0x40
188
  mov  eax,[esp+34]
190
  mov  eax,[esp+34]
189
  mov  ebx,[esp+38]
191
  mov  ebx,[esp+38]
Line 195... Line 197...
195
  cmp  edx,[esp+KOLIBRI_THREAD_DATA_LAST_SY*4]
197
  cmp  edx,[esp+KOLIBRI_THREAD_DATA_LAST_SY*4]
196
  jz   .main_paint
198
  jz   .main_paint
197
.main_size:
199
.main_size:
198
  mov  [esp+KOLIBRI_THREAD_DATA_LAST_SX*4],ecx
200
  mov  [esp+KOLIBRI_THREAD_DATA_LAST_SX*4],ecx
199
  mov  [esp+KOLIBRI_THREAD_DATA_LAST_SY*4],edx
201
  mov  [esp+KOLIBRI_THREAD_DATA_LAST_SY*4],edx
-
 
202
if defined @@KolibriOnSize$qpippv
200
  push edx
203
  push edx
201
  push ecx
204
  push ecx
202
  push ebx
205
  push ebx
203
  push eax
206
  push eax
204
  lea  ecx,[esp+16]
207
  lea  ecx,[esp+16]
205
  mov  edx,esp
208
  mov  edx,esp
206
  push ecx
209
  push ecx
207
  push edx
210
  push edx
208
  call @@KolibriOnSize$qpippv
211
  call @@KolibriOnSize$qpippv
209
  add  esp,24
212
  add  esp,24
-
 
213
end if
210
  test dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],3
214
  test dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],3
211
  jz   .main_cycle
215
  jz   .main_cycle
212
.main_paint:
216
.main_paint:
213
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
217
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
214
  jl   .main_close
218
  jl   .main_close
215
  push esp
219
  push esp
216
  push dword 0
220
  push dword 0
217
  call @Kolibri@Redraw$qippv
221
  call @Kolibri@Redraw$qippv
218
  add  esp,8
222
  add  esp,8
219
.main_cycle:
223
.main_cycle:
220
  mov  eax,11
224
  mov  eax,SF_CHECK_EVENT
221
.main_message:
225
.main_message:
222
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
226
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
223
  jl   .main_close
227
  jl   .main_close
224
  int  0x40
228
  int  0x40
225
  test eax,eax
229
  test eax,eax
226
  jnz  .main_on_message
230
  jnz  .main_on_message
227
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
231
  cmp  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],0
228
  jne  .main_paint
232
  jne  .main_paint
-
 
233
if defined @@KolibriOnIdle$qppv
229
  push esp
234
  push esp
230
  call @@KolibriOnIdle$qppv
235
  call @@KolibriOnIdle$qppv
231
  pop  ecx
236
  pop  ecx
-
 
237
else
-
 
238
  or eax,-1
-
 
239
end if
232
  test eax,eax
240
  test eax,eax
233
  jz   .main_cycle
241
  jz   .main_cycle
234
  jl   .main_wait_message
242
  jl   .main_wait_message
235
  mov  ebx,eax
243
  mov  ebx,eax
236
  mov  eax,23
244
  mov  eax,SF_WAIT_EVENT_TIMEOUT
237
  jmp  .main_message
245
  jmp  .main_message
238
.main_wait_message:
246
.main_wait_message:
239
  mov  eax,10
247
  mov  eax,SF_WAIT_EVENT
240
  jmp  .main_message
248
  jmp  .main_message
-
 
249
if defined @@KolibriOnKeyPress$qppv
241
.main_key_press:
250
.main_key_press:
242
  push esp
251
  push esp
243
  call @@KolibriOnKeyPress$qppv
252
  call @@KolibriOnKeyPress$qppv
244
  pop  ecx
253
  pop  ecx
245
  jmp  .main_cycle
254
  jmp  .main_cycle
-
 
255
end if
-
 
256
if defined @@KolibriOnMouse$qppv
246
.main_mouse:
257
.main_mouse:
247
  push esp
258
  push esp
248
  call @@KolibriOnMouse$qppv
259
  call @@KolibriOnMouse$qppv
249
  pop  ecx
260
  pop  ecx
250
  jmp  .main_cycle
261
  jmp  .main_cycle
-
 
262
end if
-
 
263
 
-
 
264
align 4
251
.main_on_message:
265
.main_on_message:
252
  dec  eax
266
  dec  eax
253
  jz   .main_paint_msg
267
  jz   .main_paint_msg
254
  dec  eax
268
  dec  eax
-
 
269
if defined @@KolibriOnKeyPress$qppv
255
  jz   .main_key_press
270
  jz   .main_key_press
-
 
271
else
-
 
272
  jz   .main_cycle
-
 
273
end if
256
  cmp  eax,4
274
  cmp  eax,4
-
 
275
if defined @@KolibriOnMouse$qppv
257
  jz   .main_mouse
276
  jz   .main_mouse
-
 
277
else
-
 
278
  jz   .main_cycle
-
 
279
end if
258
  dec  eax
280
  dec  eax
259
  jnz  .main_cycle
281
  jnz  .main_cycle
-
 
282
 
-
 
283
align 4
260
.main_button:
284
.main_button:
261
  mov  eax,17
285
  mov  eax,SF_GET_BUTTON
262
  int  0x40
286
  int  0x40
-
 
287
  shr  eax,8
-
 
288
  cmp  eax,1
-
 
289
  je   .main_close
-
 
290
if defined @@KolibriOnButton$qlppv
-
 
291
  push esp
263
  test al,al
292
  push eax
-
 
293
  call @@KolibriOnButton$qlppv
-
 
294
  add  esp,8
-
 
295
end if
264
  jnz  .main_cycle
296
  jmp  .main_cycle
265
.main_close:
297
.main_close:
266
  btr  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],31
298
  btr  dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],31
-
 
299
if defined @@KolibriOnClose$qppv
267
  push esp
300
  push esp
268
  call @@KolibriOnClose$qppv
301
  call @@KolibriOnClose$qppv
269
  pop  ecx
302
  pop  ecx
270
  test al,al
303
  test al,al
271
  jz   .main_button
304
  jz   .main_button
-
 
305
end if
272
.main_end:
306
.main_end:
273
  mov  ebx,esp
307
  mov  ebx,esp
274
  lock dec dword [@Kolibri@_ThreadNumber]
308
  lock dec dword [@Kolibri@_ThreadNumber]
275
if defined Menuet_SegmentExit & defined Menuet_SegmentExitEnd
309
if defined Kolibri_SegmentExit & defined Kolibri_SegmentExitEnd
276
  jnz  .main_else_last_check
310
  jnz  .main_else_last_check
277
  push Menuet_SegmentExitEnd
311
  push Kolibri_SegmentExitEnd
278
  push Menuet_SegmentExit
312
  push Kolibri_SegmentExit
279
  jmp  .main_after_last_check
313
  jmp  .main_after_last_check
280
end if
314
end if
281
.main_else_last_check:
315
.main_else_last_check:
282
  xor  eax,eax
316
  xor  eax,eax
283
  push eax
317
  push eax
Line 288... Line 322...
288
  add  esp,12
322
  add  esp,12
289
  lock inc dword [@Kolibri@_ThreadScanCount+4]
323
  lock inc dword [@Kolibri@_ThreadScanCount+4]
290
  mov  ebx,1
324
  mov  ebx,1
291
  jmp  .main_end_wait
325
  jmp  .main_end_wait
292
.main_end_wait_loop:
326
.main_end_wait_loop:
293
  mov  eax,5
327
  mov  eax,SF_SLEEP
294
  int  0x40
328
  int  0x40
295
  shl  ebx,1
329
  shl  ebx,1
296
  cmp  ebx,MENUET_MUTEX_MAX_TIME_WAIT
330
  cmp  ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT
297
  jna  .main_end_wait
331
  jna  .main_end_wait
298
  mov  ebx,MENUET_MUTEX_MAX_TIME_WAIT
332
  mov  ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT
299
.main_end_wait:
333
.main_end_wait:
300
  cmp  dword [@Kolibri@_ExitProcessNow],0
334
  cmp  dword [@Kolibri@_ExitProcessNow],0
301
  jnz  @Kolibri@ExitProcess$qv
335
  jnz  @Kolibri@ExitProcess$qv
302
  cmp  dword [@Kolibri@_ThreadScanCount],0
336
  cmp  dword [@Kolibri@_ThreadScanCount],0
303
  jnz  .main_end_wait_loop
337
  jnz  .main_end_wait_loop
Line 344... Line 378...
344
.redraw_begin:
378
.redraw_begin:
345
  push ebx esi edi
379
  push ebx esi edi
346
  and  dword [ebp+KOLIBRI_THREAD_DATA_FLAG*4],0xFFFFFFFC
380
  and  dword [ebp+KOLIBRI_THREAD_DATA_FLAG*4],0xFFFFFFFC
347
  test dl,2
381
  test dl,2
348
  jz   .redraw_picture
382
  jz   .redraw_picture
349
  mov  eax,12
383
  mov  eax,SF_REDRAW
350
  mov  ebx,1
384
  mov  ebx,SSF_BEGIN_DRAW
351
  int  0x40
385
  int  0x40
352
  xor  eax,eax
386
  xor  eax,eax
353
  mov  ebx,[ebp+KOLIBRI_THREAD_DATA_X*4]
387
  mov  ebx,[ebp+KOLIBRI_THREAD_DATA_X*4]
354
  mov  ecx,[ebp+KOLIBRI_THREAD_DATA_Y*4]
388
  mov  ecx,[ebp+KOLIBRI_THREAD_DATA_Y*4]
355
  mov  edx,[ebp+KOLIBRI_THREAD_DATA_C_WINDOW*4]
389
  mov  edx,[ebp+KOLIBRI_THREAD_DATA_C_WINDOW*4]
Line 366... Line 400...
366
  repnz scas byte [edi]
400
  repnz scas byte [edi]
367
  not  ecx
401
  not  ecx
368
  mov  esi,ecx
402
  mov  esi,ecx
369
  dec  esi
403
  dec  esi
370
  jz   .window_defined
404
  jz   .window_defined
371
  mov  eax,4
405
  mov  eax,SF_DRAW_TEXT
372
  mov  ebx,0x00070007
406
  mov  ebx,0x00070007
373
  mov  ecx,[ebp+KOLIBRI_THREAD_DATA_C_TITLE*4]
407
  mov  ecx,[ebp+KOLIBRI_THREAD_DATA_C_TITLE*4]
374
  int  0x40
408
  int  0x40
375
.window_defined:
409
.window_defined:
376
  mov  eax,12
-
 
377
  mov  ebx,2
-
 
378
  int  0x40
-
 
379
.redraw_picture:
410
.redraw_picture:
380
  mov  eax,12
411
  mov  eax,SF_REDRAW
381
  mov  ebx,2
412
  mov  ebx,SSF_END_DRAW
382
  int  0x40
413
  int  0x40
383
  mov  esi,[ebp+KOLIBRI_THREAD_DATA_PICTURE*4]
414
  mov  esi,[ebp+KOLIBRI_THREAD_DATA_PICTURE*4]
384
  test esi,esi
415
  test esi,esi
385
  jz   .redraw_end_draw
416
  jz   .redraw_end_draw
386
  mov  ecx,[ebp+KOLIBRI_THREAD_DATA_SZ_PICT*4]
417
  mov  ecx,[ebp+KOLIBRI_THREAD_DATA_SZ_PICT*4]
387
  jecxz .redraw_end_draw
418
  jecxz .redraw_end_draw
388
  mov  al,byte [ebp+KOLIBRI_THREAD_DATA_C_WINDOW*4+3]
419
  mov  al,byte [ebp+KOLIBRI_THREAD_DATA_C_WINDOW*4+3]
389
  and  al,15
420
  and  al,15
390
  mov  edx,MENUET_BORDER_SIZE*65536+MENUET_HEADER_SIZE
421
  mov  edx,KOLIBRI_BORDER_SIZE*65536+KOLIBRI_HEADER_SIZE
391
  cmp  al,3
422
  cmp  al,3
392
  jnz  .redraw_no_skin
423
  jnz  .redraw_no_skin
393
  mov  eax,48
424
  mov  eax,SF_STYLE_SETTINGS
394
  mov  ebx,4
425
  mov  ebx,SSF_GET_SKIN_HEIGHT
395
  int  0x40
426
  int  0x40
396
  mov  dx,ax
427
  mov  dx,ax
397
.redraw_no_skin:
428
.redraw_no_skin:
398
  mov  eax,7
429
  mov  eax,SF_PUT_IMAGE
399
  mov  ebx,esi
430
  mov  ebx,esi
400
  int  0x40
431
  int  0x40
401
.redraw_end_draw:
432
.redraw_end_draw:
402
  pop  edi esi ebx ebp
433
  pop  edi esi ebx ebp
403
  ret
434
  ret
Line 407... Line 438...
407
  mov  eax,[esp+12]
438
  mov  eax,[esp+12]
408
  mov  ebx,[eax]
439
  mov  ebx,[eax]
409
  mov  ecx,[eax+4]
440
  mov  ecx,[eax+4]
410
  mov  edx,[eax+8]
441
  mov  edx,[eax+8]
411
  mov  esi,[eax+12]
442
  mov  esi,[eax+12]
412
  mov  eax,67
443
  mov  eax,SF_CHANGE_WINDOW
413
  int  0x40
444
  int  0x40
414
  ret
445
  ret
415
endp
446
endp
Line 416... Line 447...
416
 
447
 
417
;proc @Kolibri@Abort$qv
448
proc @Kolibri@ExitDebug$qv
418
;  push dword [@Kolibri@DebugPrefix]
449
  push dword [@Kolibri@DebugPrefix]
419
;  call @Kolibri@DebugPutString$qpxc
450
  call @Kolibri@DebugPutString$qpxc
420
;  mov	dword [esp],Menuet_abort_string
451
  mov	dword [esp],Kolibri_debug_string
421
;  call @Kolibri@DebugPutString$qpxc
452
  call @Kolibri@DebugPutString$qpxc
-
 
453
  pop	ecx
-
 
454
  jmp  @Kolibri@ExitProcess$qv
-
 
455
endp
422
;  pop	ecx
456
 
423
proc @Kolibri@ExitProcess$qv
457
proc @Kolibri@ExitProcess$qv
424
  lock bts dword [@Kolibri@_ExitProcessNow],0
458
  lock bts dword [@Kolibri@_ExitProcessNow],0
425
  jc   .exit_process_wait
459
  jc   .exit_process_wait
426
  sub  esp,1024
460
  sub  esp,1024
427
  mov  eax,9
461
  mov  eax,SF_THREAD_INFO
428
  mov  ebx,esp
462
  mov  ebx,esp
429
  mov  ecx,-1
463
  mov  ecx,-1
430
  int  0x40
464
  int  0x40
431
  mov  esi,eax
465
  mov  esi,eax
432
  mov  edi,[esp+30]
466
  mov  edi,[esp+30]
433
.exit_process_loop:
467
.exit_process_loop:
434
  mov  eax,9
468
  mov  eax,SF_THREAD_INFO
435
  mov  ebx,esp
469
  mov  ebx,esp
436
  mov  ecx,esi
470
  mov  ecx,esi
437
  int  0x40
471
  int  0x40
438
  mov  eax,[esp+30]
472
  mov  eax,[esp+30]
Line 441... Line 475...
441
  mov  ebx,eax
475
  mov  ebx,eax
442
  or   bl,15
476
  or   bl,15
443
  inc  ebx
477
  inc  ebx
444
  jz   .exit_process_continue
478
  jz   .exit_process_continue
445
  mov  ebx,eax
479
  mov  ebx,eax
446
  call Menuet_HashInt
480
  call Kolibri_HashInt
447
  movzx eax,al
481
  movzx eax,al
448
  mov  eax,dword [@Kolibri@_ThreadTable+eax*4]
482
  mov  eax,dword [@Kolibri@_ThreadTable+eax*4]
449
  jmp  .exit_process_test
483
  jmp  .exit_process_test
450
.exit_process_next:
484
.exit_process_next:
451
  mov  eax,dword [eax+KOLIBRI_THREAD_DATA_NEXT*4]
485
  mov  eax,dword [eax+KOLIBRI_THREAD_DATA_NEXT*4]
452
.exit_process_test:
486
.exit_process_test:
453
  test eax,eax
487
  test eax,eax
454
  jz   .exit_process_continue
488
  jz   .exit_process_continue
455
  cmp  ebx,[eax+KOLIBRI_THREAD_DATA_PID*4]
489
  cmp  ebx,[eax+KOLIBRI_THREAD_DATA_PID*4]
456
  jnz  .exit_process_next
490
  jnz  .exit_process_next
457
  mov  eax,18
491
  mov  eax,SF_SYSTEM
458
  mov  ebx,2
492
  mov  ebx,SSF_TERMINATE_THREAD
459
  mov  ecx,esi
493
  mov  ecx,esi
460
  int  0x40
494
  int  0x40
461
.exit_process_continue:
495
.exit_process_continue:
462
  dec  esi
496
  dec  esi
463
  jnl  .exit_process_loop
497
  jnl  .exit_process_loop
Line 470... Line 504...
470
.exit_process_end:
504
.exit_process_end:
471
  mov  dword [@Kolibri@_ThreadMutex],0
505
  mov  dword [@Kolibri@_ThreadMutex],0
472
  or   eax,-1
506
  or   eax,-1
473
  int  0x40
507
  int  0x40
474
.exit_process_wait:
508
.exit_process_wait:
475
  mov  eax,5
509
  mov  eax,SF_SLEEP
476
  mov  ebx,1
510
  mov  ebx,1
477
.exit_process_wait_loop:
511
.exit_process_wait_loop:
478
  cmp  dword [@Kolibri@_ExitProcessNow],0
512
  cmp  dword [@Kolibri@_ExitProcessNow],0
479
  jl   .exit_process_end
513
  jl   .exit_process_end
480
  int  0x40
514
  int  0x40
481
  shl  ebx,1
515
  shl  ebx,1
482
  cmp  ebx,MENUET_MUTEX_MAX_TIME_WAIT
516
  cmp  ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT
483
  jna  .exit_process_wait_loop
517
  jna  .exit_process_wait_loop
484
  mov  ebx,MENUET_MUTEX_MAX_TIME_WAIT
518
  mov  ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT
485
  jmp  .exit_process_wait_loop
519
  jmp  .exit_process_wait_loop
486
endp
520
endp
Line 487... Line 521...
487
 
521
 
488
proc @Kolibri@ExitThread$qppv,@Kolibri@ThreadMain$qpvt1
522
proc @Kolibri@ExitThread$qppv,@Kolibri@ThreadMain$qpvt1
489
  mov  esp,[esp+4]
523
  mov  esp,[esp+4]
490
  jmp  Menuet_main_end
524
  jmp  Kolibri_main_end
Line 491... Line 525...
491
endp
525
endp
492
 
526
 
493
proc @Kolibri@ReturnMessageLoop$qppv,@Kolibri@ThreadMain$qpvt1
527
proc @Kolibri@ReturnMessageLoop$qppv,@Kolibri@ThreadMain$qpvt1
494
  mov  esp,[esp+4]
528
  mov  esp,[esp+4]
495
  bt   dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],30
529
  bt   dword [esp+KOLIBRI_THREAD_DATA_FLAG*4],30
496
  jc   Menuet_main_end
530
  jc   Kolibri_main_end
Line 497... Line 531...
497
  jmp  Menuet_main_cycle
531
  jmp  Kolibri_main_cycle
498
endp
532
endp
499
 
533
 
500
proc @Kolibri@Delay$qui uses ebx
534
proc @Kolibri@Delay$qui uses ebx
501
  mov  eax,5
535
  mov  eax,SF_SLEEP
502
  mov  ebx,[esp+8]
536
  mov  ebx,[esp+8]
Line 503... Line 537...
503
  int  0x40
537
  int  0x40
-
 
538
  ret
-
 
539
endp
504
  ret
540
 
-
 
541
proc @Kolibri@Clock$qv uses ebx
-
 
542
  mov  eax,SF_SYSTEM_GET
-
 
543
  mov  ebx,SSF_TIME_COUNT
-
 
544
  int  0x40
-
 
545
  ret
-
 
546
endp
-
 
547
 
-
 
548
proc @Kolibri@DrawButton$qllllll uses ebx esi
-
 
549
  mov  eax,SF_DEFINE_BUTTON
505
endp
550
  mov  ebx,[esp+12-2+8]
-
 
551
  mov  bx,[esp+20+8]
506
 
552
  mov  ecx,[esp+16-2+8]
507
proc @Kolibri@Clock$qv uses ebx
553
  mov  cx,[esp+24+8]
508
  mov  eax,26
554
  mov  edx,[esp+4+8]
Line 509... Line 555...
509
  mov  ebx,9
555
  mov  esi,[esp+8+8]
510
  int  0x40
556
  int  0x40
511
  ret
557
  ret 
512
endp
558
endp
513
 
559
 
Line 514... Line 560...
514
proc @Kolibri@GetPackedTime$qv
560
proc @Kolibri@GetPackedTime$qv
515
  mov  eax,3
561
  mov  eax,SF_GET_SYS_TIME
516
  int  0x40
562
  int  0x40
517
  ret
563
  ret
518
endp
564
endp
519
 
565
 
520
proc @Kolibri@GetTime$qpi
566
proc @Kolibri@GetTime$qpi
Line 542... Line 588...
542
  mov  dword [edx],ecx
588
  mov  dword [edx],ecx
543
  ret
589
  ret
544
endp
590
endp
Line 545... Line 591...
545
 
591
 
546
proc @Kolibri@GetPackedDate$qv
592
proc @Kolibri@GetPackedDate$qv
547
  mov  eax,29
593
  mov  eax,SF_GET_SYS_DATE
548
  int  0x40
594
  int  0x40
549
  ret
595
  ret
Line 550... Line 596...
550
endp
596
endp
551
 
597
 
552
proc @Kolibri@GetDate$qpi
598
proc @Kolibri@GetDate$qpi
553
  mov  eax,29
599
  mov  eax,SF_GET_SYS_DATE
554
  int  0x40
600
  int  0x40
555
  mov  edx,[esp+4]
601
  mov  edx,[esp+4]
556
  movzx ecx,al
602
  movzx ecx,al
Line 574... Line 620...
574
  mov  dword [edx+8],ecx
620
  mov  dword [edx+8],ecx
575
  ret
621
  ret
576
endp
622
endp
Line 577... Line 623...
577
 
623
 
578
proc @Kolibri@ReadCommonColors$qpui uses ebx
624
proc @Kolibri@ReadCommonColors$qpui uses ebx
579
  mov  eax,48
625
  mov  eax,SF_STYLE_SETTINGS
580
  mov  ebx,3
626
  mov  ebx,SSF_GET_COLORS
581
  mov  ecx,[esp+8]
627
  mov  ecx,[esp+8]
582
  mov  edx,40
628
  mov  edx,40
583
  int  0x40
629
  int  0x40
584
  ret
630
  ret
Line 585... Line 631...
585
endp
631
endp
586
 
632
 
587
proc @Kolibri@DrawText$qssipxc uses ebx
633
proc @Kolibri@DrawText$qssipxc uses ebx
588
  mov  eax,4
634
  mov  eax,SF_DRAW_TEXT
589
  mov  ebx,[esp+8-2]
635
  mov  ebx,[esp+8-2]
590
  mov  bx,[esp+12]
636
  mov  bx,[esp+12]
591
  mov  ecx,[esp+16]
637
  mov  ecx,[esp+16]
592
  or   ecx,0x80000000
638
  or   ecx,0x80000000
593
  mov  edx,[esp+20]
639
  mov  edx,[esp+20]
594
  int  0x40
640
  int  0x40
Line -... Line 641...
-
 
641
  ret
-
 
642
endp
-
 
643
 
-
 
644
proc @Kolibri@SetWindowCaption$qpxc uses ebx
-
 
645
  mov  eax,SF_SET_CAPTION
-
 
646
  mov  ebx,2
-
 
647
  mov  ecx,[esp+8]
-
 
648
  int  0x40
595
  ret
649
  ret
596
endp
650
endp
597
 
651
 
598
proc @Kolibri@GetProcessInfo$qpuipct1t1piui uses ebx esi edi
652
proc @Kolibri@GetProcessInfo$qpuipct1t1piui uses ebx esi edi
599
  sub  esp,1024
653
  sub  esp,1024
600
  mov  eax,9
654
  mov  eax,SF_THREAD_INFO
601
  mov  ebx,esp
655
  mov  ebx,esp
602
  mov  ecx,[1024+12+24+esp]
656
  mov  ecx,[1024+12+24+esp]
Line 610... Line 664...
610
.get_proc_info_no_usecpu:
664
.get_proc_info_no_usecpu:
611
  or   edi,[1024+12+8+esp]
665
  or   edi,[1024+12+8+esp]
612
  jz   .get_proc_info_no_name
666
  jz   .get_proc_info_no_name
613
  lea  esi,[esp+10]
667
  lea  esi,[esp+10]
614
  cld
668
  cld
615
  movs dword [edi],[esi]
669
  movsd
616
  movs dword [edi],[esi]
670
  movsd
617
  movs dword [edi],[esi]
671
  movsd
618
  mov  byte [edi],0
672
  mov  byte [edi],0
619
  xor  edi,edi
673
  xor  edi,edi
620
.get_proc_info_no_name:
674
.get_proc_info_no_name:
621
  or   edi,[1024+12+12+esp]
675
  or   edi,[1024+12+12+esp]
622
  jz   .get_proc_info_no_mem
676
  jz   .get_proc_info_no_mem
Line 632... Line 686...
632
.get_proc_info_no_pid:
686
.get_proc_info_no_pid:
633
  or   edi,[1024+12+20+esp]
687
  or   edi,[1024+12+20+esp]
634
  jz   .get_proc_info_no_rect
688
  jz   .get_proc_info_no_rect
635
  lea  esi,[esp+34]
689
  lea  esi,[esp+34]
636
  cld
690
  cld
637
  movs dword [edi],[esi]
691
  movsd
638
  movs dword [edi],[esi]
692
  movsd
639
  movs dword [edi],[esi]
693
  movsd
640
  movs dword [edi],[esi]
694
  movsd
641
  xor  edi,edi
695
  xor  edi,edi
642
.get_proc_info_no_rect:
696
.get_proc_info_no_rect:
643
  add  esp,1024
697
  add  esp,1024
644
  ret
698
  ret
645
endp
699
endp
Line 646... Line 700...
646
 
700
 
647
proc @Kolibri@GetPid$qv uses ebx
701
proc @Kolibri@GetPid$qv uses ebx
648
  sub  esp,1024
702
  sub  esp,1024
649
  mov  eax,9
703
  mov  eax,SF_THREAD_INFO
650
  mov  ebx,esp
704
  mov  ebx,esp
651
  mov  ecx,-1
705
  mov  ecx,-1
652
  int  0x40
706
  int  0x40
653
  mov  eax,[esp+30]
707
  mov  eax,[esp+30]
Line 663... Line 717...
663
 
717
 
664
proc @Kolibri@_HashByte$qui
718
proc @Kolibri@_HashByte$qui
665
@Kolibri@_HashWord$qui:
719
@Kolibri@_HashWord$qui:
666
@Kolibri@_HashDword$qui:
720
@Kolibri@_HashDword$qui:
667
  mov  eax,[esp+4]
721
  mov  eax,[esp+4]
668
Menuet_HashInt:
722
Kolibri_HashInt:
669
  mul  dword [Menuet_hash_int_val0]
723
  mul  dword [Kolibri_hash_int_val0]
670
  xor  eax,edx
724
  xor  eax,edx
671
  bswap eax
725
  bswap eax
672
  mul  dword [Menuet_hash_int_val1]
726
  mul  dword [Kolibri_hash_int_val1]
673
  shrd eax,edx,14
727
  shrd eax,edx,14
674
  bswap eax
728
  bswap eax
675
  lea  eax,[eax+4*eax]
729
  lea  eax,[eax+4*eax]
676
  ror  eax,9
730
  ror  eax,9
677
  ret
731
  ret
Line -... Line 732...
-
 
732
endp
678
endp
733
 
679
 
734
if defined @Kolibri@_HashByte$qui | defined @Kolibri@_HashWord$qui | defined @Kolibri@_HashDword$qui
680
Menuet_hash_int_val0:
735
Kolibri_hash_int_val0:
681
  dd   0xA82F94C5
736
  dd   0xA82F94C5
-
 
737
Kolibri_hash_int_val1:
Line 682... Line 738...
682
Menuet_hash_int_val1:
738
  dd   0x9193780B
683
  dd   0x9193780B
739
end if
684
 
740
 
685
proc @Kolibri@GetThreadData$qv
741
proc @Kolibri@GetThreadData$qv
Line 690... Line 746...
690
  ret
746
  ret
691
endp
747
endp
Line 692... Line 748...
692
 
748
 
693
proc @Kolibri@GetThreadData$qui
749
proc @Kolibri@GetThreadData$qui
694
  mov  eax,[esp+4]
750
  mov  eax,[esp+4]
695
  call Menuet_HashInt
751
  call Kolibri_HashInt
696
  movzx eax,al
752
  movzx eax,al
697
  cmp  dword [@Kolibri@_ThreadScanCount+4],0
753
  cmp  dword [@Kolibri@_ThreadScanCount+4],0
698
  jnz  .get_thread_data_wait
754
  jnz  .get_thread_data_wait
699
.get_thread_data_nowait:
755
.get_thread_data_nowait:
Line 711... Line 767...
711
.get_thread_data_end:
767
.get_thread_data_end:
712
  lock dec dword [@Kolibri@_ThreadScanCount]
768
  lock dec dword [@Kolibri@_ThreadScanCount]
713
  ret
769
  ret
714
.get_thread_data_wait:
770
.get_thread_data_wait:
715
  push eax ebx
771
  push eax ebx
716
  mov  eax,5
772
  mov  eax,SF_SLEEP
717
  mov  ebx,1
773
  mov  ebx,1
718
.get_thread_data_wait_loop:
774
.get_thread_data_wait_loop:
719
  int  0x40
775
  int  0x40
720
  cmp  dword [@Kolibri@_ThreadScanCount+4],0
776
  cmp  dword [@Kolibri@_ThreadScanCount+4],0
721
  jz   .get_thread_data_wait_end
777
  jz   .get_thread_data_wait_end
722
  shl  ebx,1
778
  shl  ebx,1
723
  cmp  ebx,MENUET_MUTEX_MAX_TIME_WAIT
779
  cmp  ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT
724
  jna  .get_thread_data_wait_loop
780
  jna  .get_thread_data_wait_loop
725
  mov  ebx,MENUET_MUTEX_MAX_TIME_WAIT
781
  mov  ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT
726
  jmp  .get_thread_data_wait_loop
782
  jmp  .get_thread_data_wait_loop
727
.get_thread_data_wait_end:
783
.get_thread_data_wait_end:
728
  pop  ebx eax
784
  pop  ebx eax
729
  jmp .get_thread_data_nowait
785
  jmp .get_thread_data_nowait
730
endp
786
endp
Line 731... Line 787...
731
 
787
 
732
proc @Kolibri@_GetSkinHeader$qv uses ebx
788
proc @Kolibri@_GetSkinHeader$qv uses ebx
733
  mov  eax,48
789
  mov  eax,SF_STYLE_SETTINGS
734
  mov  ebx,4
790
  mov  ebx,SSF_GET_SKIN_HEIGHT
735
  int  0x40
791
  int  0x40
736
  ret
792
  ret
Line 737... Line 793...
737
endp
793
endp
738
 
794
 
739
proc @Kolibri@GetScreenSize$qrust1
795
proc @Kolibri@GetScreenSize$qrust1
740
  mov  eax,14
796
  mov  eax,SF_GET_SCREEN_SIZE
741
  int  0x40
797
  int  0x40
742
  mov  ecx,[esp+8]
798
  mov  ecx,[esp+8]
743
  mov  word [ecx],ax
799
  mov  word [ecx],ax
744
  mov  ecx,[esp+4]
800
  mov  ecx,[esp+4]
745
  shr  eax,16
801
  shr  eax,16
746
  mov  word [ecx],ax
802
  mov  word [ecx],ax
Line 747... Line 803...
747
  ret
803
  ret
748
endp
804
endp
749
 
805
 
750
proc Menuet_MutexLockNoWait
806
proc Kolibri_MutexLockNoWait
751
  pop  eax
807
  pop  eax
Line 752... Line 808...
752
  xor  al,al
808
  xor  al,al
753
  ret
809
  ret
754
endp
810
endp
755
 
811
 
756
proc Menuet_MutexLockWait uses ebx
812
proc Kolibri_MutexLockWait uses ebx
757
  mov  eax,5
813
  mov  eax,SF_SLEEP
758
  xor  ebx,ebx
814
  xor  ebx,ebx
759
.lock_wait_cycle:
815
.lock_wait_cycle:
760
  int  0x40
816
  int  0x40
761
  shl  byte [ecx],1
817
  shl  byte [ecx],1
Line 762... Line 818...
762
  jz   .lock_wait_cycle
818
  jz   .lock_wait_cycle
763
  mov  al,1
819
  mov  al,1
764
  ret
820
  ret
765
endp
821
endp
766
 
822
 
767
proc Menuet_MutexLockWaitTime
823
proc Kolibri_MutexLockWaitTime
768
  cmp  dword [esp+12],0
824
  cmp  dword [esp+12],0
769
  jng  .MutexLockWait
825
  jng  .MutexLockWait
770
  push ebx edx
826
  push ebx edx
771
  mov  edx,[esp+20]
827
  mov  edx,[esp+20]
772
  mov  eax,26
828
  mov  eax,SF_SYSTEM_GET
773
  mov  ebx,9
829
  mov  ebx,SSF_TIME_COUNT
774
  int  0x40
830
  int  0x40
775
  add  edx,eax
831
  add  edx,eax
776
.lock_wait_time_cycle:
832
.lock_wait_time_cycle:
777
  mov  eax,5
833
  mov  eax,SF_SLEEP
778
  xor  ebx,ebx
834
  xor  ebx,ebx
779
  int  0x40
835
  int  0x40
780
  shl  byte [ecx],1
836
  shl  byte [ecx],1
781
  jnz  .lock_wait_time_ret_true
837
  jnz  .lock_wait_time_ret_true
782
  mov  eax,26
838
  mov  eax,SF_SYSTEM_GET
783
  mov  ebx,9
839
  mov  ebx,SSF_TIME_COUNT
Line 791... Line 847...
791
  pop  edx ebx
847
  pop  edx ebx
792
  mov  al,1
848
  mov  al,1
793
  ret
849
  ret
794
endp
850
endp
Line 795... Line 851...
795
 
851
 
796
proc Menuet_MutexLock
852
proc Kolibri_MutexLock
797
  shl  byte [ecx],1
853
  shl  byte [ecx],1
798
  jnz  .lock_first
854
  jnz  .lock_first
799
  call eax
855
  call eax
800
.lock_first:
856
.lock_first:
801
  mov  al,1
857
  mov  al,1
802
  ret
858
  ret
Line 803... Line 859...
803
endp
859
endp
804
 
860
 
805
proc @Kolibri@TryLock$qp14Kolibri@TMutex
861
proc @Kolibri@TryLock$qp14Kolibri@TMutex
806
  mov  eax,Menuet_MutexLockNoWait
862
  mov  eax,Kolibri_MutexLockNoWait
807
  mov  ecx,[esp+4]
863
  mov  ecx,[esp+4]
Line 808... Line 864...
808
  jmp  Menuet_MutexLock
864
  jmp  Kolibri_MutexLock
809
endp
865
endp
810
 
866
 
811
proc @Kolibri@Lock$qp14Kolibri@TMutex
867
proc @Kolibri@Lock$qp14Kolibri@TMutex
812
  mov  eax,Menuet_MutexLockWait
868
  mov  eax,Kolibri_MutexLockWait
Line 813... Line 869...
813
  mov  ecx,[esp+4]
869
  mov  ecx,[esp+4]
814
  jmp  Menuet_MutexLock
870
  jmp  Kolibri_MutexLock
815
endp
871
endp
816
 
872
 
817
proc @Kolibri@LockTime$qp14Kolibri@TMutexi
873
proc @Kolibri@LockTime$qp14Kolibri@TMutexi
Line 818... Line 874...
818
  mov  eax,Menuet_MutexLockWaitTime
874
  mov  eax,Kolibri_MutexLockWaitTime
819
  mov  ecx,[esp+4]
875
  mov  ecx,[esp+4]
820
  jmp  Menuet_MutexLock
876
  jmp  Kolibri_MutexLock
821
endp
877
endp
822
 
878
 
823
proc @Kolibri@UnLock$qp14Kolibri@TMutex
879
proc @Kolibri@UnLock$qp14Kolibri@TMutex
824
  mov  ecx,[esp+4]
880
  mov  ecx,[esp+4]
825
  shr  byte [ecx],1
881
  shr  byte [ecx],1
826
  jz   .unlock_pause
882
  jz   .unlock_pause
827
  ret
883
  ret
828
.unlock_pause:
884
.unlock_pause:
829
  mov  byte [ecx],0x40
885
  mov  byte [ecx],0x40
830
  push ebx
886
  push ebx
831
  mov  eax,5
887
  mov  eax,SF_SLEEP
Line 832... Line 888...
832
  xor  ebx,ebx
888
  xor  ebx,ebx
833
  int  0x40
889
  int  0x40
834
  pop  ebx
890
  pop  ebx
835
  ret
891
  ret
836
endp
892
endp
837
 
893
 
Line 851... Line 907...
851
  jc   .lock_rec_overflow
907
  jc   .lock_rec_overflow
852
  ret
908
  ret
853
.lock_rec_overflow:
909
.lock_rec_overflow:
854
  push dword [@Kolibri@DebugPrefix]
910
  push dword [@Kolibri@DebugPrefix]
855
  call @Kolibri@DebugPutString$qpxc
911
  call @Kolibri@DebugPutString$qpxc
856
  mov  dword [esp],Menuet_try_lock_rec_overflow_string
912
  mov  dword [esp],Kolibri_try_lock_rec_overflow_string
857
  call @Kolibri@DebugPutString$qpxc
913
  call @Kolibri@DebugPutString$qpxc
858
  pop  ecx
914
  pop  ecx
859
  jmp  @Kolibri@Abort$qv
915
  jmp  @Kolibri@ExitDebug$qv
860
endp
916
endp
Line 861... Line 917...
861
 
917
 
862
proc @Kolibri@TryLock$qp16Kolibri@TRecMutexui
918
proc @Kolibri@TryLock$qp16Kolibri@TRecMutexui
863
  mov  eax,Menuet_MutexLockNoWait
919
  mov  eax,Kolibri_MutexLockNoWait
864
  mov  ecx,[esp+4]
920
  mov  ecx,[esp+4]
865
  mov  edx,[esp+8]
921
  mov  edx,[esp+8]
866
  jmp  Menuet_MutexLockRec
922
  jmp  Kolibri_MutexLockRec
Line 867... Line 923...
867
endp
923
endp
868
 
924
 
869
proc @Kolibri@Lock$qp16Kolibri@TRecMutexui
925
proc @Kolibri@Lock$qp16Kolibri@TRecMutexui
870
  mov  eax,Menuet_MutexLockWait
926
  mov  eax,Kolibri_MutexLockWait
871
  mov  ecx,[esp+4]
927
  mov  ecx,[esp+4]
872
  mov  edx,[esp+8]
928
  mov  edx,[esp+8]
Line 873... Line 929...
873
  jmp  Menuet_MutexLockRec
929
  jmp  Kolibri_MutexLockRec
874
endp
930
endp
875
 
931
 
876
proc @Kolibri@LockTime$qp16Kolibri@TRecMutexiui
932
proc @Kolibri@LockTime$qp16Kolibri@TRecMutexiui
877
  mov  eax,Menuet_MutexLockWaitTime
933
  mov  eax,Kolibri_MutexLockWaitTime
878
  mov  ecx,[esp+4]
934
  mov  ecx,[esp+4]
Line 879... Line 935...
879
  mov  edx,[esp+12]
935
  mov  edx,[esp+12]
880
  jmp  Menuet_MutexLockRec
936
  jmp  Kolibri_MutexLockRec
881
endp
937
endp
Line 894... Line 950...
894
.unlock_rec_end:
950
.unlock_rec_end:
895
  ret
951
  ret
896
.unlock_rec_pause:
952
.unlock_rec_pause:
897
  mov  byte [ecx],0x20
953
  mov  byte [ecx],0x20
898
  push ebx
954
  push ebx
899
  mov  eax,5
955
  mov  eax,SF_SLEEP
900
  xor  ebx,ebx
956
  xor  ebx,ebx
901
  int  0x40
957
  int  0x40
902
  pop  ebx
958
  pop  ebx
903
  ret
959
  ret
904
.unlock_rec_notlocked:
960
.unlock_rec_notlocked:
905
  push dword [@Kolibri@DebugPrefix]
961
  push dword [@Kolibri@DebugPrefix]
906
  call @Kolibri@DebugPutString$qpxc
962
  call @Kolibri@DebugPutString$qpxc
907
  mov  dword [esp],Menuet_unlock_rec_notlocked_string
963
  mov  dword [esp],Kolibri_unlock_rec_notlocked_string
908
  call @Kolibri@DebugPutString$qpxc
964
  call @Kolibri@DebugPutString$qpxc
909
  pop  ecx
965
  pop  ecx
910
  jmp  @Kolibri@Abort$qv
966
  jmp  @Kolibri@ExitDebug$qv
911
endp
967
endp
Line 912... Line 968...
912
 
968
 
913
proc @Kolibri@DebugPutChar$qc
969
proc @Kolibri@DebugPutChar$qc
914
  mov  cl,byte [esp+4]
970
  mov  cl,byte [esp+4]
915
  cmp  cl,13
971
  cmp  cl,13
916
  jz   .debug_put_char_ret
972
  jz   .debug_put_char_ret
917
  push ebx
973
  push ebx
918
  cmp  cl,10
974
  cmp  cl,10
919
  jz   .debug_put_char_enter
975
  jz   .debug_put_char_enter
920
.debug_put_char_after_cmp:
976
.debug_put_char_after_cmp:
921
  mov  eax,63
977
  mov  eax,SF_BOARD
922
  mov  ebx,1
978
  mov  ebx,SSF_DEBUG_WRITE
923
  int  0x40
979
  int  0x40
924
  pop  ebx
980
  pop  ebx
925
.debug_put_char_ret:
981
.debug_put_char_ret:
926
  ret
982
  ret
927
.debug_put_char_enter:
983
.debug_put_char_enter:
928
  mov  cl,13
984
  mov  cl,13
929
  mov  eax,63
985
  mov  eax,SF_BOARD
930
  mov  ebx,1
986
  mov  ebx,SSF_DEBUG_WRITE
931
  int  0x40
987
  int  0x40
932
  mov  cl,10
988
  mov  cl,10
933
  jmp  .debug_put_char_after_cmp
989
  jmp  .debug_put_char_after_cmp
Line 934... Line 990...
934
endp
990
endp
935
 
-
 
936
proc @Kolibri@DebugPutString$qpxc
991
 
937
  push esi
992
proc @Kolibri@DebugPutString$qpxc uses esi
938
  push dword 0
993
  push dword 0
939
  mov  esi,dword [esp+12]
994
  mov  esi,dword [esp+12]
940
  jmp  .debug_put_string_test
995
  jmp  .debug_put_string_test
Line 945... Line 1000...
945
.debug_put_string_test:
1000
.debug_put_string_test:
946
  xor  eax,eax
1001
  xor  eax,eax
947
  or   al,[esi]
1002
  or   al,[esi]
948
  test al,al
1003
  test al,al
949
  jnz  .debug_put_string_loop
1004
  jnz  .debug_put_string_loop
950
  pop  ecx esi
1005
  pop  ecx
951
  ret
1006
  ret
952
endp
1007
endp
Line 953... Line 1008...
953
 
1008
 
954
proc @Kolibri@GetKey$qv
1009
proc @Kolibri@GetKey$qv
955
  mov  eax,2
1010
  mov  eax,SF_GET_KEY
956
  int  0x40
1011
  int  0x40
957
  test al,al
1012
  test al,al
958
  jnz  .get_key_eof
1013
  jnz  .get_key_eof
959
  movzx eax,ah
1014
  movzx eax,ah
960
  ret
1015
  ret
961
.get_key_eof:
1016
.get_key_eof:
962
  mov  eax,-1
1017
  mov  eax,SF_TERMINATE_PROCESS
963
  ret
1018
  ret
Line 964... Line 1019...
964
endp
1019
endp
965
 
1020
 
966
proc @Kolibri@GetMouseButton$qv uses ebx
1021
proc @Kolibri@GetMouseButton$qv uses ebx
967
  mov  eax,37
1022
  mov  eax,SF_MOUSE_GET
968
  mov  ebx,2
1023
  mov  ebx,SSF_BUTTON
969
  int  0x40
1024
  int  0x40
Line 970... Line 1025...
970
  ret
1025
  ret
971
endp
1026
endp
972
 
1027
 
973
proc @Kolibri@GetMousePosition$qrst1o uses ebx
1028
proc @Kolibri@GetMousePosition$qrst1o uses ebx
974
  mov  eax,37
1029
  mov  eax,SF_MOUSE_GET
975
  xor  ebx,ebx
1030
  xor  ebx,ebx ;SSF_SCREEN_POSITION
976
  cmp  byte [esp+16],0
1031
  cmp  byte [esp+16],0
977
  jnz  .get_mouse_pos_absolute
1032
  jnz  .get_mouse_pos_absolute
Line 996... Line 1051...
996
  push ebx
1051
  push ebx
997
  mov  edx,[esp+16]
1052
  mov  edx,[esp+16]
998
  mov  ebx,[esp+12]
1053
  mov  ebx,[esp+12]
999
  test edx,edx
1054
  test edx,edx
1000
  jnz  .create_thread_after_new
1055
  jnz  .create_thread_after_new
1001
if defined MenuetHeapAlloc
1056
if defined KolibriHeapAlloc
1002
  cmp  ebx,4096
1057
  cmp  ebx,4096
1003
  jnb  .create_thread_alloc
1058
  jnb  .create_thread_alloc
1004
  mov  ebx,STACKSIZE
1059
  mov  ebx,STACKSIZE
1005
.create_thread_alloc:
1060
.create_thread_alloc:
1006
  push ebx
1061
  push ebx
1007
  call MenuetHeapAlloc	 ; Create new dynamic memory of the given size
1062
  call KolibriHeapAlloc	 ; Create new dynamic memory of the given size
1008
  pop  ecx
1063
  pop  ecx
1009
  test eax,eax
1064
  test eax,eax
1010
  jnz  .create_thread_mem_created
1065
  jnz  .create_thread_mem_created
1011
end if
1066
end if
1012
  or   eax,-1
1067
  or   eax,-1
Line 1025... Line 1080...
1025
  and  edx,not 3
1080
  and  edx,not 3
1026
  sub  edx,12
1081
  sub  edx,12
1027
  mov  ecx,[esp+8]
1082
  mov  ecx,[esp+8]
1028
  mov  dword [edx+8],ebx
1083
  mov  dword [edx+8],ebx
1029
  mov  dword [edx+4],ecx
1084
  mov  dword [edx+4],ecx
1030
  mov  dword [edx],Menuet_ThreadFinish
1085
  mov  dword [edx],Kolibri_ThreadFinish
1031
  mov  eax,51
1086
  mov  eax,SF_CREATE_THREAD
1032
  mov  ebx,1
1087
  mov  ebx,1
1033
  mov  ecx,@Kolibri@ThreadMain$qpvt1
1088
  mov  ecx,@Kolibri@ThreadMain$qpvt1
1034
  int  0x40
1089
  int  0x40
1035
  mov  ebx,eax
1090
  mov  ebx,eax
1036
  or   bl,15
1091
  or   bl,15
1037
  inc  ebx
1092
  inc  ebx
1038
  jnz  .create_thread_end
1093
  jnz  .create_thread_end
1039
  lock dec dword [@Kolibri@_ThreadNumber]
1094
  lock dec dword [@Kolibri@_ThreadNumber]
1040
if defined MenuetHeapFree
1095
if defined KolibriHeapFree
1041
  or   ebx,[edx+8]
1096
  or   ebx,[edx+8]
1042
  jz   .create_thread_end
1097
  jz   .create_thread_end
1043
  push ebx
1098
  push ebx
1044
  call MenuetHeapFree	; Delete the given dynamic memory
1099
  call KolibriHeapFree	; Delete the given dynamic memory
1045
  pop  ecx
1100
  pop  ecx
1046
end if
1101
end if
1047
.create_thread_end:
1102
.create_thread_end:
1048
  pop  ebx
1103
  pop  ebx
1049
  ret
1104
  ret
1050
.create_thread_init:
1105
.create_thread_init:
1051
  push esi edi
1106
  push esi edi
1052
  cld
1107
  cld
1053
  mov  esi,@Kolibri@_ThreadSavedBegProc
1108
  mov  esi,@Kolibri@_ThreadSavedBegProc
1054
  mov  edi,@Kolibri@GetPid$qv
1109
  mov  edi,@Kolibri@GetPid$qv
1055
  movs dword [edi],[esi]
1110
  movsd
1056
  movs dword [edi],[esi]
1111
  movsd
1057
  mov  edi,@Kolibri@GetThreadData$qv
1112
  mov  edi,@Kolibri@GetThreadData$qv
1058
  movs dword [edi],[esi]
1113
  movsd
1059
  movs dword [edi],[esi]
1114
  movsd
1060
  mov  eax,0x90909090
1115
  mov  eax,0x90909090
1061
  mov  edi,@Kolibri@_ThreadSavedBegProc
1116
  mov  edi,@Kolibri@_ThreadSavedBegProc
1062
  stos dword [edi]
1117
  stosd
1063
  stos dword [edi]
1118
  stosd
1064
  stos dword [edi]
1119
  stosd
1065
  stos dword [edi]
1120
  stosd
1066
  pop  edi esi
1121
  pop  edi esi
1067
  jmp  .create_thread_fill_stack
1122
  jmp  .create_thread_fill_stack
1068
endp
1123
endp
Line 1069... Line 1124...
1069
 
1124
 
1070
proc @Kolibri@_FileAccess$qpv uses ebx
1125
proc @Kolibri@_FileAccess$qpv uses ebx
1071
  mov  eax,70
1126
  mov  eax,SF_FILE
1072
  mov  ebx,[esp+8]
1127
  mov  ebx,[esp+8]
1073
  int  0x40
1128
  int  0x40
1074
  mov  ecx,[esp+8]
1129
  mov  ecx,[esp+8]
1075
  mov  [ecx],ebx
1130
  mov  [ecx],ebx
1076
  ret
1131
  ret
Line -... Line 1132...
-
 
1132
endp
1077
endp
1133
 
1078
 
1134
if defined Kolibri_debug_string
-
 
1135
Kolibri_debug_string:
-
 
1136
  db 'Abnormal program termination.',10,0
-
 
1137
end if
1079
Menuet_abort_string:
1138
 
1080
  db 'Abnormal program termination.',10,0
1139
if defined Kolibri_MutexLockRec
-
 
1140
Kolibri_try_lock_rec_overflow_string:
-
 
1141
  db 'Recursive mutex lock count overflow.',10,0
-
 
1142
end if
1081
Menuet_try_lock_rec_overflow_string:
1143
 
1082
  db 'Recursive mutex lock count overflow.',10,0
1144
if defined @Kolibri@UnLock$qp16Kolibri@TRecMutexui
-
 
1145
Kolibri_unlock_rec_notlocked_string:
Line 1083... Line 1146...
1083
Menuet_unlock_rec_notlocked_string:
1146
  db 'Recursive mutex unlock error.',10,0
Line 1084... Line 1147...
1084
  db 'Recursive mutex unlock error.',10,0
1147
end if