remove trash created in previous revisions

git-svn-id: svn://kolibrios.org@1143 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2009-08-26 11:23:22 +00:00
parent f639a59238
commit d7d25fb0e8
8 changed files with 125 additions and 85 deletions

View File

@ -28,6 +28,8 @@ CODE
redraw: ; redraw event handler redraw: ; redraw event handler
call draw_window ; at first create and draw the window call draw_window ; at first create and draw the window
mcall 9, procinfo, -1
wait_event: ; main cycle wait_event: ; main cycle
mov eax, 10 mov eax, 10
mcall mcall
@ -88,5 +90,7 @@ end if
UDATA UDATA
sc system_colors sc system_colors
procinfo rb 1024
MEOS_APP_END MEOS_APP_END
; <--- end of MenuetOS application ---> ; <--- end of MenuetOS application --->

View File

@ -12,15 +12,15 @@ class CKosFile
{ {
public: public:
CKosFile(char *fileName); CKosFile(char *fileName);
virtual ~CKosFile(void); ~CKosFile(void);
virtual int Read(Byte *targetPtr, int readCount); int Read(Byte *targetPtr, int readCount);
virtual int Write(Byte *sourcePtr, int writeCount); int Write(Byte *sourcePtr, int writeCount);
virtual int Seek(int seekFrom, int seekStep); int Seek(int seekFrom, int seekStep);
protected: protected:
int filePointer; int filePointer;
int bufferPointer; int bufferPointer;
bool validBuffer; bool validBuffer;
kosFileInfo fileInfo; kosFileInfo fileInfo;
virtual void ValidateBuffer(void); void ValidateBuffer(void);
virtual void UpdateBuffer(void); void UpdateBuffer(void);
}; };

View File

@ -1,5 +1,3 @@
cl /c /O2 /nologo kosilka.cpp kosFile.cpp kosSyst.cpp mcsmemm.cpp cl /c /O2 /Ox /Os /GL /Gr /Oi /nologo /GS- /GR- kosilka.cpp kosFile.cpp kosSyst.cpp mcsmemm.cpp
link /nologo /entry:crtStartUp /subsystem:native /base:0 /fixed /align:16 /nodefaultlib kosilka.obj kosFile.obj kosSyst.obj mcsmemm.obj link /section:.bss,E /nologo /ltcg /map /entry:crtStartUp /subsystem:native /base:0 /fixed:no /nodefaultlib /merge:.data=.text /merge:.rdata=.text kosilka.obj kosFile.obj kosSyst.obj mcsmemm.obj
pe2kos kosilka.exe kosilka fasm doexe2.asm kosilka
del kosilka.exe
pause

View File

@ -1,13 +1,41 @@
#include "kosSyst.h" #include "kosSyst.h"
#include <stdarg.h> #include <stdarg.h>
#define atexitBufferSize 32 char stack[16384];
char kosExePath[257];
struct __MENUET_header_t
{
char signature[8];
unsigned version;
void* entry;
unsigned init_size;
unsigned memsize;
void* stackptr;
void* command_line_ptr;
void* app_path_ptr;
};
__MENUET_header_t __MENUET_header =
{
{'M','E','N','U','E','T','0','1'},
1,
&crtStartUp,
-1,
-1,
stack + sizeof(stack),
NULL,
&kosExePath
};
#if 0
#define atexitBufferSize 32
#endif
char pureCallMessage[] = "PURE function call!"; char pureCallMessage[] = "PURE function call!";
char *kosExePath = NULL; //char *kosExePath = NULL;
#if 0
// //
void (__cdecl *atExitList[atexitBufferSize])(); void (__cdecl *atExitList[atexitBufferSize])();
int atExitFnNum = 0; int atExitFnNum = 0;
@ -26,7 +54,7 @@ int __cdecl atexit( void (__cdecl *func )( void ))
return 1; return 1;
} }
} }
#endif
// //
Dword RandomSeed = 1; Dword RandomSeed = 1;
@ -341,8 +369,9 @@ void sprintf( char *Str, char* Format, ... )
// ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà // ôóíêöèÿ -1 çàâåðøåíèÿ ïðîöåññà
void kos_ExitApp() void __declspec(noreturn) kos_ExitApp()
{ {
#if 0
int i; int i;
// //
@ -352,6 +381,7 @@ void kos_ExitApp()
atExitList[i](); atExitList[i]();
} }
// //
#endif
__asm{ __asm{
mov eax, -1 mov eax, -1
int 0x40 int 0x40
@ -433,9 +463,8 @@ getkeyii:
return ( result & 0xFF ) == 0; return ( result & 0xFF ) == 0;
} }
// ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ // ôóíêöèÿ 3 ïîëó÷èòü âðåìÿ
Dword kos_GetSystemClock() Dword __cdecl kos_GetSystemClock()
{ {
// Dword result; // Dword result;
@ -449,7 +478,7 @@ Dword kos_GetSystemClock()
// return result; // return result;
} }
#if 0
// ôóíêöèÿ 4 // ôóíêöèÿ 4
void kos_WriteTextToWindow( void kos_WriteTextToWindow(
Word x, Word x,
@ -475,10 +504,29 @@ void kos_WriteTextToWindow(
int 0x40 int 0x40
} }
} }
#else
// ôóíêöèÿ 4
void kos_WriteTextToWindow_internal(
Dword pos,
Dword font,
const char *textPtr,
Dword textLen
)
{
__asm{
mov eax, 4
mov ebx, pos
mov ecx, font
mov edx, textPtr
mov esi, textLen
int 0x40
}
}
#endif
// ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû // ôóíêöèÿ 5 ïàóçà, â ñîòûõ äîëÿõ ñåêóíäû
void kos_Pause( Dword value ) void __cdecl kos_Pause( Dword value )
{ {
// //
__asm{ __asm{
@ -548,7 +596,7 @@ Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID )
// ôóíêöèÿ 10 // ôóíêöèÿ 10
Dword kos_WaitForEvent() Dword __cdecl kos_WaitForEvent()
{ {
// Dword result; // Dword result;
@ -578,7 +626,7 @@ Dword kos_CheckForEvent()
// ôóíêöèÿ 12 // ôóíêöèÿ 12
void kos_WindowRedrawStatus( Dword status ) void __cdecl kos_WindowRedrawStatus( Dword status )
{ {
__asm{ __asm{
mov eax, 12 mov eax, 12
@ -606,7 +654,6 @@ void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour )
} }
} }
// ôóíêöèÿ 17 // ôóíêöèÿ 17
bool kos_GetButtonID( Dword &buttonID ) bool kos_GetButtonID( Dword &buttonID )
{ {
@ -626,7 +673,7 @@ bool kos_GetButtonID( Dword &buttonID )
// ôóíêöèÿ 23 // ôóíêöèÿ 23
Dword kos_WaitForEvent( Dword timeOut ) Dword __cdecl kos_WaitForEvent( Dword timeOut )
{ {
// Dword result; // Dword result;
@ -724,14 +771,14 @@ Dword kos_GetSkinWidth()
// ôóíêöèÿ 70 äîñòóï ê ôàéëîâîé ñèñòåìå // ôóíêöèÿ 70 äîñòóï ê ôàéëîâîé ñèñòåìå
Dword kos_FileSystemAccess( kosFileInfo *fileInfo ) Dword __fastcall kos_FileSystemAccess( kosFileInfo *fileInfo )
{ {
// Dword result; // Dword result;
// //
__asm{ __asm{
mov eax, 70 mov eax, 70
mov ebx, fileInfo mov ebx, ecx //fileInfo
int 0x40 int 0x40
// mov result, eax // mov result, eax
} }
@ -741,13 +788,13 @@ Dword kos_FileSystemAccess( kosFileInfo *fileInfo )
// ôóíêöèÿ 63 âûâîä ñèìâîëÿ â îêíî îòëàäêè // ôóíêöèÿ 63 âûâîä ñèìâîëÿ â îêíî îòëàäêè
void kos_DebugOutChar( char ccc ) void __fastcall kos_DebugOutChar( char ccc )
{ {
// //
__asm{ __asm{
mov eax, 63 mov eax, 63
mov ebx, 1 mov ebx, 1
mov cl, ccc //mov cl, ccc
int 0x40 int 0x40
} }
} }
@ -827,27 +874,13 @@ int __cdecl _purecall()
// çàîäíî èíèöèàëèçàöèÿ ãåíåðàòîðà ñëó÷àéíûõ ÷èñåë // çàîäíî èíèöèàëèçàöèÿ ãåíåðàòîðà ñëó÷àéíûõ ÷èñåë
//#pragma section(".CRT$XCA",long,read,write) //#pragma section(".CRT$XCA",long,read,write)
//#pragma section(".CRT$XCZ",long,read,write) //#pragma section(".CRT$XCZ",long,read,write)
#pragma data_seg(".CRT$XCA")
#pragma data_seg(".CRT$XCZ")
typedef void (__cdecl *_PVFV)(void);
__declspec(allocate(".CRT$XCA")) _PVFV __xc_a[1] = { NULL };
__declspec(allocate(".CRT$XCZ")) _PVFV __xc_z[1] = { NULL };
//
#pragma comment(linker, "/merge:.CRT=.rdata")
//
void crtStartUp() void crtStartUp()
{ {
// âûçûâàåì èíèöèàëèçàòîðû ïî ñïèñêó, NULL'û èãíîðèðóåì __MENUET_header.app_path_ptr;
for ( _PVFV *pbegin = __xc_a; pbegin < __xc_z; pbegin++ )
{
//
if ( *pbegin != NULL )
(**pbegin)();
}
// èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë // èíèöèàëèçèðóåì ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
rtlSrand( kos_GetSystemClock() ); rtlSrand( kos_GetSystemClock() );
// ïóòü ê ôàéëó ïðîöåññà // ïóòü ê ôàéëó ïðîöåññà
kosExePath = *((char **)0x20); //kosExePath = *((char **)0x20);
// âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ // âûçîâ ãëàâíîé ôóíêöèè ïðèëîæåíèÿ
kos_Main(); kos_Main();
// âûõîä // âûõîä

View File

@ -99,7 +99,7 @@ union sProcessInfo
}; };
// //
extern char *kosExePath; extern char kosExePath[];
// //
void crtStartUp(); void crtStartUp();
@ -128,7 +128,7 @@ void sprintf( char *Str, char* Format, ... );
// //
Dword rtlInterlockedExchange( Dword *target, Dword value ); Dword rtlInterlockedExchange( Dword *target, Dword value );
// функция -1 завершения процесса // функция -1 завершения процесса
void kos_ExitApp(); void __declspec(noreturn) kos_ExitApp();
// функция 0 // функция 0
void kos_DefineAndDrawWindow( void kos_DefineAndDrawWindow(
Word x, Word y, Word x, Word y,
@ -142,7 +142,8 @@ void kos_PutPixel( Dword x, Dword y, Dword colour );
// функция 2 получить код нажатой клавиши // функция 2 получить код нажатой клавиши
bool kos_GetKey( Byte &keyCode ); bool kos_GetKey( Byte &keyCode );
// функция 3 получить время // функция 3 получить время
Dword kos_GetSystemClock(); Dword __cdecl kos_GetSystemClock();
#if 0
// функция 4 // функция 4
void kos_WriteTextToWindow( void kos_WriteTextToWindow(
Word x, Word y, Word x, Word y,
@ -151,26 +152,31 @@ void kos_WriteTextToWindow(
char *textPtr, char *textPtr,
Dword textLen Dword textLen
); );
#else
void kos_WriteTextToWindow_internal(Dword pos, Dword font, const char* textPtr, Dword textLen);
#define kos_WriteTextToWindow(x, y, fontType, textColour, textPtr, textLen) \
kos_WriteTextToWindow_internal(((x)<<16)|(y), ((fontType)<<24)|(textColour), textPtr, textLen)
#endif
// функция 7 нарисовать изображение // функция 7 нарисовать изображение
void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y ); void kos_PutImage( RGB * imagePtr, Word sizeX, Word sizeY, Word x, Word y );
// функция 8 определить кнопку // функция 8 определить кнопку
void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour ); void kos_DefineButton( Word x, Word y, Word sizeX, Word sizeY, Dword buttonID, Dword colour );
// функция 5 пауза, в сотых долях секунды // функция 5 пауза, в сотых долях секунды
void kos_Pause( Dword value ); void __cdecl kos_Pause( Dword value );
// функция 9 - информация о процессе // функция 9 - информация о процессе
Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF ); Dword kos_ProcessInfo( sProcessInfo *targetPtr, Dword processID = PROCESS_ID_SELF );
// функция 10 // функция 10
Dword kos_WaitForEvent(); Dword __cdecl kos_WaitForEvent();
// функция 11 // функция 11
Dword kos_CheckForEvent(); Dword kos_CheckForEvent();
// функция 12 // функция 12
void kos_WindowRedrawStatus( Dword status ); void __cdecl kos_WindowRedrawStatus( Dword status );
// функция 13 нарисовать полосу // функция 13 нарисовать полосу
void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour ); void kos_DrawBar( Word x, Word y, Word sizeX, Word sizeY, Dword colour );
// функция 17 // функция 17
bool kos_GetButtonID( Dword &buttonID ); bool kos_GetButtonID( Dword &buttonID );
// функция 23 // функция 23
Dword kos_WaitForEvent( Dword timeOut ); Dword __cdecl kos_WaitForEvent( Dword timeOut );
// //
enum eNumberBase enum eNumberBase
{ {
@ -195,9 +201,9 @@ void kos_DisplayNumberToWindow(
// функция 48.4 получить высоту скина // функция 48.4 получить высоту скина
Dword kos_GetSkinWidth(); Dword kos_GetSkinWidth();
// функция 58 доступ к файловой системе // функция 58 доступ к файловой системе
Dword kos_FileSystemAccess( kosFileInfo *fileInfo ); Dword __fastcall kos_FileSystemAccess( kosFileInfo *fileInfo );
// функция 63 // функция 63
void kos_DebugOutChar( char ccc ); void __fastcall kos_DebugOutChar( char ccc );
// //
void rtlDebugOutString( char *str ); void rtlDebugOutString( char *str );
// функция 64 изменить параметры окна, параметр == -1 не меняется // функция 64 изменить параметры окна, параметр == -1 не меняется

View File

@ -323,29 +323,29 @@ char * getLevelsPathName(){
void decode_graphics(Byte * source, RGB * target){ void decode_graphics(Byte * source, RGB * target){
static RGB palette[] = { static const char palette[] = {
0x978A31,0x8B7F2E,0x867B2B,0x82762B,0x7F7428,0x79702B,0x766C26,0x90832E, 0x31,0x8A,0x97,0x2E,0x7F,0x8B,0x2B,0x7B,0x86,0x2B,0x76,0x82,0x28,0x74,0x7F,0x2B,0x70,0x79,0x26,0x6C,0x76,0x2E,0x83,0x90,
0x978A2F,0x9A8C31,0x9B8D32,0x998C31,0x9C8E33,0x9D8F34,0x988B30,0x928531, 0x2F,0x8A,0x97,0x31,0x8C,0x9A,0x32,0x8D,0x9B,0x31,0x8C,0x99,0x33,0x8E,0x9C,0x34,0x8F,0x9D,0x30,0x8B,0x98,0x31,0x85,0x92,
0x887532,0xBAA454,0xA18C3D,0xC6B26A,0xA08E46,0x6B5F26,0xAF9844,0x9C873B, 0x32,0x75,0x88,0x54,0xA4,0xBA,0x3D,0x8C,0xA1,0x6A,0xB2,0xC6,0x46,0x8E,0xA0,0x26,0x5F,0x6B,0x44,0x98,0xAF,0x3B,0x87,0x9C,
0xAB964D,0x988338,0xA89140,0xB49D4C,0xC1AC5C,0x94872F,0x303030,0x343435, 0x4D,0x96,0xAB,0x38,0x83,0x98,0x40,0x91,0xA8,0x4C,0x9D,0xB4,0x5C,0xAC,0xC1,0x2F,0x87,0x94,0x30,0x30,0x30,0x35,0x34,0x34,
0x827933,0x806E2F,0x8B8134,0x938632,0x96892F,0x988C33,0x8F873B,0x7E9F39, 0x33,0x79,0x82,0x2F,0x6E,0x80,0x34,0x81,0x8B,0x32,0x86,0x93,0x2F,0x89,0x96,0x33,0x8C,0x98,0x3B,0x87,0x8F,0x39,0x9F,0x7E,
0x8E812D,0x92803F,0x75715C,0x676462,0x6D6A68,0x666260,0x6B6866,0x6A6664, 0x2D,0x81,0x8E,0x3F,0x80,0x92,0x5C,0x71,0x75,0x62,0x64,0x67,0x68,0x6A,0x6D,0x60,0x62,0x66,0x66,0x68,0x6B,0x64,0x66,0x6A,
0x8E7B35,0x626161,0x797641,0x9B8E33,0x7F7954,0x776A67,0xB29E55,0xBCA75E, 0x35,0x7B,0x8E,0x61,0x61,0x62,0x41,0x76,0x79,0x33,0x8E,0x9B,0x54,0x79,0x7F,0x67,0x6A,0x77,0x55,0x9E,0xB2,0x5E,0xA7,0xBC,
0x978C3E,0x3E3E3D,0x434245,0x373938,0x3C9737,0x209437,0xB97934,0xE6863E, 0x3E,0x8C,0x97,0x3D,0x3E,0x3E,0x45,0x42,0x43,0x38,0x39,0x37,0x37,0x97,0x3C,0x37,0x94,0x20,0x34,0x79,0xB9,0x3E,0x86,0xE6,
0xF28C41,0xE2833D,0xDD803B,0xD77C3A,0xD17938,0xEA883F,0x605D5B,0x686563, 0x41,0x8C,0xF2,0x3D,0x83,0xE2,0x3B,0x80,0xDD,0x3A,0x7C,0xD7,0x38,0x79,0xD1,0x3F,0x88,0xEA,0x5B,0x5D,0x60,0x63,0x65,0x68,
0x706D6B,0x5F5F5E,0x656566,0xB56931,0xAC663B,0xC17D36,0xC88338,0x997246, 0x6B,0x6D,0x70,0x5E,0x5F,0x5F,0x66,0x65,0x65,0x31,0x69,0xB5,0x3B,0x66,0xAC,0x36,0x7D,0xC1,0x38,0x83,0xC8,0x46,0x72,0x99,
0x737271,0xA89546,0x4D4D4E,0x515152,0x565656,0x5A5A59,0x687B41,0x098933, 0x71,0x72,0x73,0x46,0x95,0xA8,0x4E,0x4D,0x4D,0x52,0x51,0x51,0x56,0x56,0x56,0x59,0x5A,0x5A,0x41,0x7B,0x68,0x33,0x89,0x09,
0x5B9B38,0x009036,0x069136,0xF18B41,0xC27034,0xCD7737,0xEE8A40,0xA0774B, 0x38,0x9B,0x5B,0x36,0x90,0x00,0x36,0x91,0x06,0x41,0x8B,0xF1,0x34,0x70,0xC2,0x37,0x77,0xCD,0x40,0x8A,0xEE,0x4B,0x77,0xA0,
0xF18C41,0x948037,0x988B34,0x49484A,0x5D5D5D,0x039036,0x0E9236,0xB06B7B, 0x41,0x8C,0xF1,0x37,0x80,0x94,0x34,0x8B,0x98,0x4A,0x48,0x49,0x5D,0x5D,0x5D,0x36,0x90,0x03,0x36,0x92,0x0E,0x7B,0x6B,0xB0,
0x949CF8,0x7C85F6,0x6A74F5,0x5A66F4,0x4653F1,0x5F53B6,0x726462,0x9C7449, 0xF8,0x9C,0x94,0xF6,0x85,0x7C,0xF5,0x74,0x6A,0xF4,0x66,0x5A,0xF1,0x53,0x46,0xB6,0x53,0x5F,0x62,0x64,0x72,0x49,0x74,0x9C,
0xD0C472,0x696969,0x998B32,0x9D6676,0x3B47DD,0x5349A0,0xD8CD77,0x343EC1, 0x72,0xC4,0xD0,0x69,0x69,0x69,0x32,0x8B,0x99,0x76,0x66,0x9D,0xDD,0x47,0x3B,0xA0,0x49,0x53,0x77,0xCD,0xD8,0xC1,0x3E,0x34,
0x4F438C,0x8E5538,0xC37341,0x895D71,0x483B74,0x433359,0x9C8D34,0x2A329A, 0x8C,0x43,0x4F,0x38,0x55,0x8E,0x41,0x73,0xC3,0x71,0x5D,0x89,0x74,0x3B,0x48,0x59,0x33,0x43,0x34,0x8D,0x9C,0x9A,0x32,0x2A,
0x995F49,0x1D236D,0x756E37,0x524819,0x8D8848,0x9B8D34,0x157F2F,0x2D6C28, 0x49,0x5F,0x99,0x6D,0x23,0x1D,0x37,0x6E,0x75,0x19,0x48,0x52,0x48,0x88,0x8D,0x34,0x8D,0x9B,0x2F,0x7F,0x15,0x28,0x6C,0x2D,
0xAA778B,0x663C15,0x4E5924,0x9D8F31,0xBCAD48 0x8B,0x77,0xAA,0x15,0x3C,0x66,0x24,0x59,0x4E,0x31,0x8F,0x9D,0x48,0xAD,0xBC
}; };
for (int lc=0;lc<576;lc++) for (int lc=0;lc<576;lc++)
target[lc] = palette[source[lc]]; target[lc] = ((RGB*)palette)[source[lc]];
} }

View File

@ -25,7 +25,7 @@ START:
or eax, eax or eax, eax
jnz exit jnz exit
invoke sort.START, 1 ; invoke sort.START, 1
mov ecx, 1 ; for 15.4: 1 = tile mov ecx, 1 ; for 15.4: 1 = tile
cmp word [@PARAMS], '\T' cmp word [@PARAMS], '\T'
@ -540,20 +540,20 @@ load_directory:
mov [eax+4], ebx mov [eax+4], ebx
test ebx, ebx test ebx, ebx
jz free_directory jz free_directory
push 0 ; sort mode ; push 0 ; sort mode
push ebx ; push ebx
add eax, 32 ; add eax, 32
push eax ; push eax
call [SortDir] ; call [SortDir]
xor eax, eax xor eax, eax
mov edi, [directory_ptr] mov edi, [directory_ptr]
add edi, 32 + 40 add edi, 32 + 40
.scan: .scan:
mov esi, [last_name_component] mov esi, [last_name_component]
inc esi inc esi
push edi ; push edi
invoke strcmpi ; invoke strcmpi
pop edi ; pop edi
jz .found jz .found
inc eax inc eax
add edi, 304 add edi, 304
@ -995,8 +995,8 @@ align 4
library \ library \
libio , 'libio.obj' , \ libio , 'libio.obj' , \
libgfx , 'libgfx.obj' , \ libgfx , 'libgfx.obj' , \
libimg , 'libimg.obj' , \ libimg , 'libimg.obj' ;, \
sort , 'sort.obj' ; sort , 'sort.obj'
import libio , \ import libio , \
libio.init , 'lib_init' , \ libio.init , 'lib_init' , \
@ -1022,7 +1022,7 @@ import libimg , \
img.destroy , 'img_destroy', \ img.destroy , 'img_destroy', \
img.draw , 'img_draw' img.draw , 'img_draw'
import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi' ;import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
bFirstDraw db 0 bFirstDraw db 0
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------

View File

@ -1 +0,0 @@
qwe4