Subversion Repositories Kolibri OS

Rev

Rev 1805 | Rev 7481 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1805 yogev_ezra 1
#include "kosSyst.h"
2
#include 
3
 
4
#define atexitBufferSize	32
5
 
5114 clevermous 6
// Autobuild uses FASM method for exe->kos,
7
// MENUET01 header should be present in EXE.
8
#ifdef AUTOBUILD
9
char kosExePath[1024];
10
char exeStack[16384];
11
// must be alphabetically first in the image
12
#pragma data_seg(".1seg")
13
extern "C" struct
14
{
15
	char header[8];
16
	int headerver;
17
	void* entry;
18
	void* i_end;
19
	void* memsize;
20
	void* stack;
21
	void* params;
22
	void* icon;
23
} header = {
24
	{'M', 'E', 'N', 'U', 'E', 'T', '0', '1'},
25
	1,
26
	&crtStartUp,
27
	0,	// filled by doexe2.asm
28
	0,	// filled by doexe2.asm
29
	exeStack + sizeof(exeStack),
30
	NULL,
31
	kosExePath
32
};
33
#pragma data_seg()
34
#else
35
char *kosExePath = NULL;
36
#endif
1805 yogev_ezra 37
 
38
char pureCallMessage[] = "PURE function call!";
39
 
40
//
41
void (__cdecl *atExitList[atexitBufferSize])();
42
int atExitFnNum = 0;
43
//
44
int __cdecl atexit( void (__cdecl *func )( void ))
45
{
46
	//
47
	if ( atExitFnNum < atexitBufferSize )
48
	{
49
		//
50
		atExitList[atExitFnNum++] = func;
51
		return 0;
52
	}
53
	else
54
	{
55
		return 1;
56
	}
57
}
58
 
59
 
60
//
61
Dword RandomSeed = 1;
62
//
63
void rtlSrand( Dword seed )
64
{
65
	RandomSeed = seed;
66
}
67
//
68
Dword rtlRand( void )
69
{
70
  //маска 0x80000776
71
 
72
  Dword dwi, i;
73
 
74
  for ( i = 0; i < 32; i++ )
75
  {
76
 
77
    dwi = RandomSeed & 0x80000776;
78
 
79
      __asm{
80
            mov   eax, dwi
81
            mov   edx, eax
82
            bswap eax
83
            xor   eax, edx
84
            xor   al, ah
85
            setpo al
86
            movzx eax, al
87
            mov   dwi, eax
88
    }
89
 
90
    RandomSeed = ( RandomSeed << 1 ) | ( dwi & 1 );
91
  }
92
 
93
 return RandomSeed;
94
}
95
 
96
//
97
void * __cdecl memcpy( void *dst, const void *src, size_t bytesCount )
98
{
99
	__asm{
100
		mov edi, dst
101
		mov eax, dst
102
		mov esi, src
103
		mov ecx, bytesCount
104
		rep movsb
105
	}
106
}
107
 
108
//
109
void memset( Byte *dst, Byte filler, Dword count )
110
{
111
	//
112
	__asm{
113
		mov edi, dst
114
		mov al, filler
115
		mov ecx, count
116
		rep stosb
117
	}
118
}
119
 
120
//
121
Dword rtlInterlockedExchange( Dword *target, Dword value )
122
{
123
//	Dword result;
124
 
125
	//
126
	__asm{
127
		mov eax, value
128
		mov ebx, target
129
		xchg eax, [ebx]
130
//		mov result, eax
131
	}
132
	//
133
//	return result;
134
}
135
 
136
 
137
//////////////////////////////////////////////////////////////////////
138
//
139
// копирование строки
140
//
141
 
142
char * __cdecl strcpy( char *target, const char *source )
143
{
144
	char *result = target;
145
 
146
	while( target[0] = source[0] )
147
	{
148
		target++;
149
		source++;
150
	}
151
 
152
	return result;
153
}
154
 
155
 
156
//////////////////////////////////////////////////////////////////////
157
//
158
// реверсивный поиск символа
159
//
160
 
161
char * __cdecl strrchr( const char * string, int c )
162
{
163
	char *cPtr;
164
 
165
	//
166
	for ( cPtr = (char *)string + strlen( string ); cPtr >= string; cPtr-- )
167
	{
168
		//
169
		if ( *cPtr == c ) return cPtr;
170
	}
171
	//
172
	return NULL;
173
}
174
 
175
 
176
//////////////////////////////////////////////////////////////////////
177
//
178
// определение длины строки
179
//
180
 
181
int __cdecl strlen( const char *line )
182
{
183
  int i;
184
 
185
  for( i=0; line[i] != 0; i++ );
186
  return i;
187
}
188
 
189
 
190
 
191
//////////////////////////////////////////////////////////////////////
192
//
193
// перевод шестнадцатиричного числа в символ
194
//
195
 
196
unsigned int num2hex( unsigned int num )
197
{
198
  if( num < 10 )
199
    return num + '0';
200
  return num - 10 + 'A';
201
}
202
 
203
 
204
//////////////////////////////////////////////////////////////////////
205
//
206
// вывод строки на печать
207
//
208
 
209
Dword dectab[] = { 1000000000, 100000000, 10000000, 1000000, 100000,
210
                   10000, 1000, 100, 10, 0 };
211
 
212
//
213
void sprintf( char *Str, char* Format, ... )
214
{
215
	int i, fmtlinesize, j, k, flag;
216
	Dword head, tail;
217
	char c;
218
	va_list arglist;
219
	//
220
	va_start(arglist, Format);
221
 
222
	//
223
	fmtlinesize = strlen( Format );
224
	//
225
	if( fmtlinesize == 0 ) return;
226
 
227
	//
228
	for( i = 0, j = 0; i < fmtlinesize; i++ )
229
	{
230
		//
231
		c = Format[i];
232
		//
233
		if( c != '%' )
234
		{
235
			Str[j++] = c;
236
			continue;
237
		}
238
		//
239
		i++;
240
		//
241
		if( i >= fmtlinesize ) break;
242
 
243
		//
244
		flag = 0;
245
		//
246
		c = Format[i];
247
		//
248
		switch( c )
249
		{
250
		//
251
		case '%':
252
			Str[j++] = c;
253
			break;
254
		// вывод строки
255
		case 'S':
256
			Byte* str;
257
			str = va_arg(arglist, Byte*);
258
			for( k = 0; ( c = str[k] ) != 0; k++ )
259
			{
260
				Str[j++] = c;
261
			}
262
			break;
263
		// вывод байта
264
		case 'B':
265
			k = va_arg(arglist, int) & 0xFF;
266
			Str[j++] = num2hex( ( k >> 4 ) & 0xF );
267
			Str[j++] = num2hex( k & 0xF );
268
			break;
269
		// вывод символа
270
		case 'C':
271
			Str[j++] = va_arg(arglist, int) & 0xFF;
272
			break;
273
		// вывод двойного слова в шестнадцатиричном виде
274
		case 'X':
275
			Dword val;
276
			val = va_arg(arglist, Dword);
277
			for( k = 7; k >= 0; k-- )
278
			{
279
				//
280
				c = num2hex ( ( val >> (k * 4) ) & 0xF );
281
				//
282
				if( c == '0' )
283
				{
284
					if( flag ) Str[j++] = c;
285
				}
286
				else
287
				{
288
					flag++;
289
					Str[j++] = c;
290
				}
291
			}
292
			//
293
			if( flag == 0 ) Str[j++] = '0';
294
			break;
295
		// вывод двойного слова в десятичном виде
296
		case 'U':
297
			head = va_arg(arglist, Dword);
298
			tail = 0;
299
			for( k = 0; dectab[k] != 0; k++ )
300
			{
301
				tail = head % dectab[k];
302
				head /= dectab[k];
303
				c = head + '0';
304
				if( c == '0' )
305
				{
306
					if( flag ) Str[j++] = c;
307
				}
308
				else
309
				{
310
					flag++;
311
					Str[j++] = c;
312
				}
313
				//
314
				head = tail;
315
			}
316
			//
317
			c = head + '0';
318
			Str[j++] = c;
319
			break;
320
		// вывод 64-битного слова в шестнадцатиричном виде
321
		case 'Q':
322
			unsigned int low_dword, high_dword;
323
			low_dword = va_arg(arglist, unsigned int);
324
			high_dword = va_arg(arglist, unsigned int);
325
			for( k = 7; k >= 0; k-- )
326
			{
327
				//
328
				c = num2hex ( ( ( high_dword + 1) >> (k * 4) ) & 0xF );
329
				//
330
				if( c == '0' )
331
				{
332
					if( flag ) Str[j++] = c;
333
				}
334
				else
335
				{
336
					flag++;
337
					Str[j++] = c;
338
				}
339
			}
340
			//
341
			for( k=7; k >= 0; k-- )
342
			{
343
				//
344
				c = num2hex ( ( low_dword >> (k * 4) ) & 0xF );
345
				//
346
				if( c == '0' )
347
				{
348
					if( flag ) Str[j++] = c;
349
				}
350
				else
351
				{
352
					flag++;
353
					Str[j++] = c;
354
				}
355
			}
356
			//
357
			if( flag == 0 ) Str[j++] = '0';
358
			//
359
			break;
360
		//
361
		default:
362
			break;
363
		}
364
	}
365
	//
366
	Str[j] = 0;
367
}
368
 
369
 
370
// функция -1 завершения процесса
371
void kos_ExitApp()
372
{
373
	int i;
374
 
375
	//
376
	for ( i = atExitFnNum - 1; i >= 0; i-- )
377
	{
378
		//
379
		atExitList[i]();
380
	}
381
	//
382
	__asm{
383
		mov eax, -1
384
		int 0x40
385
	}
386
}
387
 
388
 
389
// функция 0
390
void kos_DefineAndDrawWindow(
391
	Word x, Word y,
392
	Word sizeX, Word sizeY,
393
	Byte mainAreaType,
394
	Dword mainAreaColour,
395
	Byte headerType,
396
	Dword headerColour,
397
	Dword borderColour
398
	)
399
{
400
	Dword arg1, arg2, arg3, arg4;
401
 
402
	//
403
	arg1 = ( x << 16 ) + sizeX;
404
	arg2 = ( y << 16 ) + sizeY;
405
	arg3 = ( mainAreaType << 24 ) | mainAreaColour;
406
	arg4 = ( headerType << 24 ) | headerColour;
407
	//
408
	__asm{
409
		mov eax, 0
410
		mov ebx, arg1
411
		mov ecx, arg2
412
		mov edx, arg3
413
		mov esi, arg4
414
		mov edi, borderColour
415
		int 0x40
416
	}
417
}
418
 
419
 
420
// функция 1 поставить точку
421
void kos_PutPixel( Dword x, Dword y, Dword colour )
422
{
423
	//
424
	__asm{
425
		mov eax, 1
426
		mov ebx, x
427
		mov ecx, y
428
		mov edx, colour
429
		int 0x40
430
	}
431
}
432
 
433
 
434
// функция 2 получить код нажатой клавиши
435
bool kos_GetKey( Byte &keyCode )
436
{
437
	Dword result;
438
 
439
	//
440
	__asm{
441
		mov eax, 2
442
		int 0x40
443
		mov result, eax
444
	}
445
	//
446
	keyCode = result >> 8;
447
	//
448
	return ( result & 0xFF ) == 0;
449
}
450
 
451
 
452
// функция 3 получить время
453
Dword kos_GetSystemClock()
454
{
455
//	Dword result;
456
 
457
	//
458
	__asm{
459
		mov eax, 3
460
		int 0x40
461
//		mov result, eax
462
	}
463
	//
464
//	return result;
465
}
466
 
467
 
468
// функция 4
469
void kos_WriteTextToWindow(
470
	Word x,
471
	Word y,
472
	Byte fontType,
473
	Dword textColour,
474
	char *textPtr,
475
	Dword textLen
476
	)
477
{
478
	Dword arg1, arg2;
479
 
480
	//
481
	arg1 = ( x << 16 ) | y;
482
	arg2 = ( fontType << 24 ) | textColour;
483
	//
484
	__asm{
485
		mov eax, 4
486
		mov ebx, arg1
487
		mov ecx, arg2
488
		mov edx, textPtr
489
		mov esi, textLen
490
		int 0x40
491
	}
492
}
493
 
494
 
495
// функция 5 пауза, в сотых долях секунды
496
void kos_Pause( Dword value )
497
{
498
	//
499
	__asm{
500
		mov eax, 5
501
		mov ebx, value
502
		int 0x40
503
	}
504
}
505
 
506
 
507
// функция 7 нарисовать изображение
508
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y )
509
{
510
	Dword arg1, arg2;
511
 
512
	//
513
	arg1 = ( sizeX << 16 ) | sizeY;
514
	arg2 = ( x << 16 ) | y;
515
	//
516
	__asm{
517
		mov eax, 7
518
		mov ebx, imagePtr
519
		mov ecx, arg1
520
		mov edx, arg2
521
		int 0x40
522
	}
523
}
524
 
525
 
526
 
527
// функция 8 определить кнопку
528
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour )
529
{
530
	Dword arg1, arg2;
531
 
532
	//
533
	arg1 = ( x << 16 ) | sizeX;
534
	arg2 = ( y << 16 ) | sizeY;
535
	//
536
	__asm{
537
		mov eax, 8
538
		mov ebx, arg1
539
		mov ecx, arg2
540
		mov edx, buttonID
541
		mov esi, colour
542
		int 0x40
543
	}
544
}
545
 
546
 
547
// функция 9 - информация о процессе
548
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID )
549
{
550
//	Dword result;
551
 
552
	//
553
	__asm{
554
		mov eax, 9
555
		mov ebx, targetPtr
556
		mov ecx, processID
557
		int 0x40
558
//		mov result, eax
559
	}
560
	//
561
//	return result;
562
}
563
 
564
 
565
// функция 10
566
Dword kos_WaitForEvent()
567
{
568
//	Dword result;
569
 
570
	__asm{
571
		mov eax, 10
572
		int 0x40
573
//		mov result, eax
574
	}
575
 
576
//	return result;
577
}
578
 
579
 
580
// функция 11
581
Dword kos_CheckForEvent()
582
{
583
//	Dword result;
584
 
585
	__asm{
586
		mov eax, 11
587
		int 0x40
588
//		mov result, eax
589
	}
590
 
591
//	return result;
592
}
593
 
594
 
595
// функция 12
596
void kos_WindowRedrawStatus( Dword status )
597
{
598
	__asm{
599
		mov eax, 12
600
		mov ebx, status
601
		int 0x40
602
	}
603
}
604
 
605
 
606
// функция 13 нарисовать полосу
607
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour )
608
{
609
	Dword arg1, arg2;
610
 
611
	//
612
	arg1 = ( x << 16 ) | sizeX;
613
	arg2 = ( y << 16 ) | sizeY;
614
	//
615
	__asm{
616
		mov eax, 13
617
		mov ebx, arg1
618
		mov ecx, arg2
619
		mov edx, colour
620
		int 0x40
621
	}
622
}
623
 
624
 
625
// функция 17
626
bool kos_GetButtonID( Dword &buttonID )
627
{
628
	Dword result;
629
 
630
	//
631
	__asm{
632
		mov eax, 17
633
		int 0x40
634
		mov result, eax
635
	}
636
	//
637
	buttonID = result >> 8;
638
	//
639
	return (result & 0xFF) == 0;
640
}
641
 
642
 
643
// функция 23
644
Dword kos_WaitForEvent( Dword timeOut )
645
{
646
//	Dword result;
647
 
648
	__asm{
649
		mov eax, 23
650
		mov ebx, timeOut
651
		int 0x40
652
//		mov result, eax
653
	}
654
 
655
//	return result;
656
}
657
 
658
// функция 26.9 получить значение счётчика времени
659
Dword kos_GetTime()
660
{
661
	__asm{
662
		mov eax, 26
663
		mov ebx, 9
664
		int 0x40
665
	}
666
}
667
 
668
// функция 37 получение информации о состоянии "мыши"
669
void kos_GetMouseState( Dword & buttons, int & cursorX, int & cursorY )
670
{
671
	Dword mB;
672
	Word curX;
673
	Word curY;
674
	sProcessInfo sPI;
675
 
676
	//
677
	__asm{
678
		mov		eax, 37
679
		mov		ebx, 0
680
		int		0x40
681
		mov		curY, ax
682
		shr		eax, 16
683
		mov		curX, ax
684
		mov		eax, 37
685
		mov		ebx, 2
686
		int		0x40
687
		mov		mB, eax
688
	}
689
	//
690
	kos_ProcessInfo( &sPI );
691
	//
692
	buttons = mB;
693
	cursorX = curX - sPI.processInfo.x_start;
694
	cursorY = curY - sPI.processInfo.y_start;
695
}
696
 
697
// функция 37.1 получение координат "мыши" относительно окна
698
void kos_GetMouseWindowXY( int & cursorX, int & cursorY )
699
{
700
	Word curX;
701
	Word curY;
702
 
703
	__asm{
704
		mov eax, 37
705
		mov ebx, 1
706
		int 0x40
707
 
708
		mov ebx, eax
709
		shr eax, 16
710
		and ebx, 0xffff
711
 
712
		mov curX, ax
713
		mov curY, bx
714
	}
715
 
716
	cursorX = curX;
717
	cursorY = curY;
718
}
719
 
720
// функция 37.2 получение информации о нажатых кнопки "мыши"
721
void kos_GetMouseButtonsState( Dword & buttons )
722
{
723
	Dword mB;
724
 
725
	__asm{
726
		mov		eax, 37
727
		mov		ebx, 2
728
		int		0x40
729
		mov		mB, eax
730
	}
731
 
732
	buttons = mB;
733
}
734
 
735
// функция 37.4 загрузка курсора "мыши"
736
Dword * kos_LoadMouseCursor( Dword * cursor, Dword loadstate )
737
{
738
	//Dword handle;
739
	__asm{
740
		mov		eax, 37
741
		mov		ebx, 4
742
		mov		edx, loadstate
743
		mov		ecx, cursor
744
		int		0x40
745
		//mov		handle, eax
746
	}
747
	//return handle;
748
}
749
 
750
// функция 37.5 установка курсора "мыши"
751
Dword * kos_SetMouseCursor( Dword * handle )
752
{
753
	//Dword handle;
754
	__asm{
755
		mov		eax, 37
756
		mov		ebx, 5
757
		mov		ecx, handle
758
		int		0x40
759
		//mov		handle, eax
760
	}
761
	//return handle;
762
}
763
 
764
// функция 37.6 удаление курсора "мыши"
765
void kos_DeleteMouseCursor( Dword * handle )
766
{
767
	__asm{
768
		mov		eax, 37
769
		mov		ebx, 6
770
		mov		ecx, handle
771
		int		0x40
772
	}
773
}
774
 
775
// функция 38 нарисовать полосу
776
void kos_DrawLine( Word x1, Word y1, Word x2, Word y2, Dword colour )
777
{
778
	Dword arg1, arg2;
779
 
780
	//
781
	arg1 = ( x1 << 16 ) | x2;
782
	arg2 = ( y1 << 16 ) | y2;
783
	//
784
	__asm{
785
		mov eax, 38
786
		mov ebx, arg1
787
		mov ecx, arg2
788
		mov edx, colour
789
		int 0x40
790
	}
791
}
792
 
793
 
794
// функция 40 установить маску событий
795
void kos_SetMaskForEvents( Dword mask )
796
{
797
	//
798
	__asm{
799
		mov eax, 40
800
		mov ebx, mask
801
		int 0x40
802
	}
803
}
804
 
805
 
806
// функция 47 вывести в окно приложения число
807
void kos_DisplayNumberToWindow(
808
   Dword value,
809
   Dword digitsNum,
810
   Word x,
811
   Word y,
812
   Dword colour,
813
   eNumberBase nBase,
814
   bool valueIsPointer
815
   )
816
{
817
	Dword arg1, arg2;
818
 
819
	//
820
	arg1 = ( valueIsPointer ? 1 : 0 ) |
821
		( ((Byte)nBase) << 8 ) |
822
		( ( digitsNum & 0x1F ) << 16 );
823
	arg2 = ( x << 16 ) | y;
824
	//
825
	__asm{
826
		mov eax, 47
827
		mov ebx, arg1
828
		mov ecx, value
829
		mov edx, arg2
830
		mov esi, colour
831
		int 0x40
832
	}
833
}
834
 
835
// функция 47 вывести в окно приложения число c фоном
836
void kos_DisplayNumberToWindowBg(
837
   Dword value,
838
   Dword digitsNum,
839
   Word x,
840
   Word y,
841
   Dword colour,
842
   Dword bgcolour,
843
   eNumberBase nBase,
844
   bool valueIsPointer
845
   )
846
{
847
	Dword arg1, arg2;
848
 
849
	//
850
	arg1 = ( valueIsPointer ? 1 : 0 ) |
851
		( ((Byte)nBase) << 8 ) |
852
		( ( digitsNum & 0x1F ) << 16 );
853
	arg2 = ( x << 16 ) | y;
854
	//
855
	__asm{
856
		mov eax, 47
857
		mov ebx, arg1
858
		mov ecx, value
859
		mov edx, arg2
860
		mov esi, colour
861
		or	esi, 0x40000000
862
		mov edi, bgcolour
863
		int 0x40
864
	}
865
}
866
 
867
 
868
// функция 70 доступ к файловой системе
869
Dword kos_FileSystemAccess( kosFileInfo *fileInfo )
870
{
871
//	Dword result;
872
 
873
	//
874
	__asm{
875
		mov eax, 70
876
		mov ebx, fileInfo
877
		int 0x40
878
//		mov result, eax
879
	}
880
	//
881
//	return result;
882
}
883
 
884
 
885
// функция 63 вывод символя в окно отладки
886
void kos_DebugOutChar( char ccc )
887
{
888
	//
889
	__asm{
890
		mov eax, 63
891
		mov ebx, 1
892
		mov cl, ccc
893
		int 0x40
894
	}
895
}
896
 
897
 
898
// функция 66 режим получения данных от клавиатуры
899
void kos_SetKeyboardDataMode( Dword mode )
900
{
901
	//
902
	__asm{
903
		mov eax, 66
904
		mov ebx, 1
905
		mov ecx, mode
906
		int 0x40
907
	}
908
}
909
 
910
 
911
// вывод строки в окно отладки
912
void rtlDebugOutString( char *str )
913
{
914
	//
915
	for ( ; str[0] != 0; str++ )
916
	{
917
		kos_DebugOutChar( str[0] );
918
	}
919
	//
920
	kos_DebugOutChar( 13 );
921
	kos_DebugOutChar( 10 );
922
}
923
 
924
 
925
// функция 64 изменение количества памяти, выделенной для программы
926
bool kos_ApplicationMemoryResize( Dword targetSize )
927
{
928
	Dword result;
929
 
930
	//
931
	__asm{
932
		mov eax, 64
933
		mov ebx, 1
934
		mov ecx, targetSize
935
		int 0x40
936
		mov result, eax
937
	}
938
	//
939
	return result == 0;
940
}
941
 
942
 
943
// функция 67 изменить параметры окна, параметр == -1 не меняется
944
void kos_ChangeWindow( Dword x, Dword y, Dword sizeX, Dword sizeY )
945
{
946
	//
947
	__asm{
948
		mov eax, 67
949
		mov ebx, x
950
		mov ecx, y
951
		mov edx, sizeX
952
		mov esi, sizeY
953
		int 0x40
954
	}
955
}
956
 
957
 
958
 
959
// вызов абстрактного метода
960
int __cdecl _purecall()
961
{
962
	rtlDebugOutString( pureCallMessage );
963
	kos_ExitApp();
964
	return 0;
965
}
966
 
967
 
968
// вызов статических инициализаторов
969
// заодно инициализация генератора случайных чисел
970
//#pragma section(".CRT$XCA",long,read,write)
971
//#pragma section(".CRT$XCZ",long,read,write)
972
#pragma data_seg(".CRT$XCA")
973
#pragma data_seg(".CRT$XCZ")
974
typedef void (__cdecl *_PVFV)(void);
975
__declspec(allocate(".CRT$XCA"))  _PVFV __xc_a[1] = { NULL };
976
__declspec(allocate(".CRT$XCZ"))  _PVFV __xc_z[1] = { NULL };
977
//
978
#pragma comment(linker, "/merge:.CRT=.rdata")
979
//
980
void crtStartUp()
981
{
5114 clevermous 982
#ifdef AUTOBUILD
983
// linker will try to remove unused variables; force header to be included
984
	header.header;
985
#endif
1805 yogev_ezra 986
	// вызываем инициализаторы по списку, NULL'ы игнорируем
987
	for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
988
	{
989
		//
990
		if ( *pbegin != NULL )
991
			(**pbegin)();
992
	}
993
	// инициализируем генератор случайных чисел
994
	rtlSrand( kos_GetSystemClock() );
5114 clevermous 995
#ifndef AUTOBUILD
1805 yogev_ezra 996
	// путь к файлу процесса
997
	kosExePath = *((char **)0x20);
5114 clevermous 998
#endif
1805 yogev_ezra 999
	// вызов главной функции приложения
1000
	kos_Main();
1001
	// выход
1002
	kos_ExitApp();
1003
}
1004