diff --git a/programs/demos/life2/bmp2h.cpp b/programs/demos/life2/bmp2h.cpp index 532653439f..0ac0ce45b8 100644 --- a/programs/demos/life2/bmp2h.cpp +++ b/programs/demos/life2/bmp2h.cpp @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/programs/demos/life2/include/menuet.h b/programs/demos/life2/include/kolibri.h similarity index 94% rename from programs/demos/life2/include/menuet.h rename to programs/demos/life2/include/kolibri.h index 75d7f8b584..a6fdfc65a4 100644 --- a/programs/demos/life2/include/menuet.h +++ b/programs/demos/life2/include/kolibri.h @@ -1,11 +1,11 @@ #ifndef __MENUET_H_INCLUDED_ #define __MENUET_H_INCLUDED_ -#include +#include -// Menuet interface. +// Kolibri interface. -namespace Menuet // All menuet functions, types and data are nested in the (Menuet) namespace. +namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace. { const char *DebugPrefix = "User program: "; char CommandLine[257]; @@ -137,17 +137,17 @@ namespace Menuet // All menuet functions, types and data are nested in the (Me // Function, defined outside. -bool MenuetOnStart(Menuet::TStartData &me_start, Menuet::TThreadData thread_data); +bool MenuetOnStart(Kolibri::TStartData &me_start, Kolibri::TThreadData thread_data); // Window will be created iff return value is true. -bool MenuetOnClose(Menuet::TThreadData thread_data); // Window will be closed iff return value is true. -int MenuetOnIdle(Menuet::TThreadData thread_data); // Return the time to wait next message. -void MenuetOnSize(int window_rect[/* 4 */], Menuet::TThreadData thread_data); // When the window is resized. -void MenuetOnKeyPress(Menuet::TThreadData thread_data); // When user press a key. -void MenuetOnMouse(Menuet::TThreadData thread_data); // When user move a mouse. +bool MenuetOnClose(Kolibri::TThreadData thread_data); // Window will be closed iff return value is true. +int MenuetOnIdle(Kolibri::TThreadData thread_data); // Return the time to wait next message. +void MenuetOnSize(int window_rect[/* 4 */], Kolibri::TThreadData thread_data); // When the window is resized. +void MenuetOnKeyPress(Kolibri::TThreadData thread_data); // When user press a key. +void MenuetOnMouse(Kolibri::TThreadData thread_data); // When user move a mouse. #ifdef __MENUET__ -namespace Menuet +namespace Kolibri { // Structures. @@ -248,7 +248,7 @@ namespace Menuet // Constants from fasm. -#include +#include // Functions. @@ -508,7 +508,7 @@ namespace Menuet #else // def __MENUET__ -namespace Menuet +namespace Kolibri { struct TMutex { diff --git a/programs/demos/life2/include/me_file.h b/programs/demos/life2/include/kos_file.h similarity index 93% rename from programs/demos/life2/include/me_file.h rename to programs/demos/life2/include/kos_file.h index ed18207c3e..5f64d44a56 100644 --- a/programs/demos/life2/include/me_file.h +++ b/programs/demos/life2/include/kos_file.h @@ -1,12 +1,12 @@ #ifndef __MENUET_FILE_H_INCLUDED_ #define __MENUET_FILE_H_INCLUDED_ -#include -#include +#include +#include -// Menuet file interface. +// Kolibri file interface. -namespace Menuet // All menuet functions, types and data are nested in the (Menuet) namespace. +namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace. { struct _FileDataStruct; typedef _FileDataStruct *TFileData; @@ -24,7 +24,7 @@ namespace Menuet // All menuet functions, types and data are nested in the (Me #ifdef __MENUET__ -namespace Menuet +namespace Kolibri { // Define the file data structure. @@ -264,7 +264,7 @@ namespace Menuet #else // def __MENUET__ -namespace Menuet +namespace Kolibri { struct _FileDataStruct { diff --git a/programs/demos/life2/include/me_func.inc b/programs/demos/life2/include/kos_func.inc similarity index 51% rename from programs/demos/life2/include/me_func.inc rename to programs/demos/life2/include/kos_func.inc index d9267f36ba..94b4f1b62c 100644 --- a/programs/demos/life2/include/me_func.inc +++ b/programs/demos/life2/include/kos_func.inc @@ -10,13 +10,13 @@ MENUET_THREAD_DATA_ST_BEGIN = 1; // Stack beginning follows after the user dword ;const int MENUET_THREAD_DATA_NEXT = 2; ;const int -MENUET_THREAD_DATA_PID = 3; +MENUET_THREAD_DATA_PID = 3; ;const int MENUET_THREAD_DATA_FLAG = 4; ;const int -MENUET_THREAD_DATA_X = 5; +MENUET_THREAD_DATA_X = 5; ;const int -MENUET_THREAD_DATA_Y = 6; +MENUET_THREAD_DATA_Y = 6; ;const int MENUET_THREAD_DATA_C_WINDOW = 7; ;const int @@ -36,13 +36,13 @@ MENUET_THREAD_DATA_LAST_SX = 14; ;const int MENUET_THREAD_DATA_LAST_SY = 15; ;const int -MENUET_THREAD_DATA_LEN = 16; +MENUET_THREAD_DATA_LEN = 16; ;const int MENUET_MUTEX_MAX_TIME_WAIT = 20; ;const int -MENUET_FILE_BLOCK_SIZE = 512; +MENUET_FILE_BLOCK_SIZE = 512; ;const int MENUET_FILE_MEMORY_OS_NEED = 4096; @@ -69,15 +69,14 @@ Menuet_SegmentExitEnd: endseg name } -macro Menuet_Put_MovEaxVal_Ret address,val +macro Menuet_Put_MovEaxVal_Ret address,val { mov byte [address],0xB8 mov dword [address+4],0xC089C300 mov dword [address+1],val } -define @Menuet@Main$qv -nextdef MenuetEntryPoint +proc @Kolibri@Main$qv and esp,not 3 sub esp,1024 mov eax,9 @@ -91,56 +90,55 @@ nextdef MenuetEntryPoint cmp esp,eax cmova esp,eax and esp,not 3 -if defined @Menuet@CommandLine - mov byte [@Menuet@CommandLine+256], 0 +if defined @Kolibri@CommandLine + mov byte [@Kolibri@CommandLine+256], 0 end if xor eax,eax cld - mov edi,@Menuet@_ThreadTable + mov edi,@Kolibri@_ThreadTable mov ecx,256 rep stos dword [edi] - mov esi,@Menuet@GetPid$qv - mov edi,@Menuet@_ThreadSavedBegProc + mov esi,@Kolibri@GetPid$qv + mov edi,@Kolibri@_ThreadSavedBegProc movs dword [edi],[esi] movs dword [edi],[esi] - mov esi,@Menuet@GetThreadData$qv + mov esi,@Kolibri@GetThreadData$qv movs dword [edi],[esi] movs dword [edi],[esi] - Menuet_Put_MovEaxVal_Ret @Menuet@GetPid$qv,edx + Menuet_Put_MovEaxVal_Ret @Kolibri@GetPid$qv,edx if defined MenuetHeapInit mov ecx,esp push ebx push ecx push U_END - call MenuetHeapInit ; Initialize a dynamic heap and create new memory in its begin. - pop ecx ; Parameters: begin of a new heap, end of data to create in - mov [esp+4],eax ; the begin of a heap. Return address of the created data. + call MenuetHeapInit ; Initialize a dynamic heap and create new memory in its begin. + pop ecx ; Parameters: begin of a new heap, end of data to create in + mov [esp+4],eax ; the begin of a heap. Return address of the created data. mov dword [esp],0 else xor eax,eax push eax push eax end if - call @Menuet@ThreadMain$qpvt1 -nextdef Menuet_ThreadFinish + call @Kolibri@ThreadMain$qpvt1 +.ThreadFinish: add esp,8 if defined MenuetHeapFreeAndThreadFinish test eax,eax - jz Menuet_ThreadFinish_end - push dword @Menuet@_ExitProcessNow + jz .ThreadFinish_end + push dword @Kolibri@_ExitProcessNow push eax call MenuetHeapFreeAndThreadFinish ; Free the given memory and finish the thread, -end if ; should exit process if second argument points to not zero. -Menuet_ThreadFinish_end: +end if ; should exit process if second argument points to not zero. +.ThreadFinish_end: or eax,-1 int 0x40 -enddef +endp -define @Menuet@ThreadMain$qpvt1 +proc @Kolibri@ThreadMain$qpvt1 xchg ebx,[esp+4] xchg ebp,[esp+8] - push esi - push edi + push esi edi sub esp,MENUET_THREAD_DATA_LEN*4 mov [esp],ebx mov [esp+4],ebp @@ -148,40 +146,39 @@ define @Menuet@ThreadMain$qpvt1 mov ebx,0x27 int 0x40 mov ebx,esp - cmp byte [@Menuet@_ThreadSavedBegProc],0x90 - jz Menuet_main_else_first_check - Menuet_Put_MovEaxVal_Ret @Menuet@GetThreadData$qv,esp + cmp byte [@Kolibri@_ThreadSavedBegProc],0x90 + jz .main_else_first_check + Menuet_Put_MovEaxVal_Ret @Kolibri@GetThreadData$qv,esp if defined Menuet_SegmentInit & defined Menuet_SegmentInitEnd push Menuet_SegmentInitEnd push Menuet_SegmentInit - jmp Menuet_main_after_first_check + jmp .main_after_first_check end if -Menuet_main_else_first_check: +.main_else_first_check: xor eax,eax - push eax - push eax -Menuet_main_after_first_check: + push eax eax +.main_after_first_check: push ebx - call @@Menuet@_CallStart$qppvpvt2 + call @@Kolibri@_CallStart$qppvpvt2 add esp,12 test al,al - jnz Menuet_main_test_close_first - jmp Menuet_main_end -Menuet_main_close_first: + jnz .main_test_close_first + jmp .main_end +.main_close_first: btr dword [esp+MENUET_THREAD_DATA_FLAG*4],31 push esp call @@MenuetOnClose$qppv pop ecx test al,al - jnz Menuet_main_end -Menuet_main_test_close_first: + jnz .main_end +.main_test_close_first: cmp dword [esp+MENUET_THREAD_DATA_FLAG*4],0 - jl Menuet_main_close_first + jl .main_close_first push esp push dword 1 - call @Menuet@Redraw$qippv + call @Kolibri@Redraw$qippv add esp,8 -Menuet_main_paint_msg: +.main_paint_msg: or dword [esp+MENUET_THREAD_DATA_FLAG*4],3 sub esp,1024 mov eax,9 @@ -194,10 +191,10 @@ Menuet_main_paint_msg: mov edx,[esp+46] add esp,1024 cmp ecx,[esp+MENUET_THREAD_DATA_LAST_SX*4] - jnz Menuet_main_size + jnz .main_size cmp edx,[esp+MENUET_THREAD_DATA_LAST_SY*4] - jz Menuet_main_paint -Menuet_main_size: + jz .main_paint +.main_size: mov [esp+MENUET_THREAD_DATA_LAST_SX*4],ecx mov [esp+MENUET_THREAD_DATA_LAST_SY*4],edx push edx @@ -211,110 +208,109 @@ Menuet_main_size: call @@MenuetOnSize$qpippv add esp,24 test dword [esp+MENUET_THREAD_DATA_FLAG*4],3 - jz Menuet_main_cycle -Menuet_main_paint: + jz .main_cycle +.main_paint: cmp dword [esp+MENUET_THREAD_DATA_FLAG*4],0 - jl Menuet_main_close + jl .main_close push esp push dword 0 - call @Menuet@Redraw$qippv + call @Kolibri@Redraw$qippv add esp,8 -Menuet_main_cycle: +.main_cycle: mov eax,11 -Menuet_main_message: +.main_message: cmp dword [esp+MENUET_THREAD_DATA_FLAG*4],0 - jl Menuet_main_close + jl .main_close int 0x40 test eax,eax - jnz Menuet_main_on_message + jnz .main_on_message cmp dword [esp+MENUET_THREAD_DATA_FLAG*4],0 - jne Menuet_main_paint + jne .main_paint push esp call @@MenuetOnIdle$qppv pop ecx test eax,eax - jz Menuet_main_cycle - jl Menuet_main_wait_message + jz .main_cycle + jl .main_wait_message mov ebx,eax mov eax,23 - jmp Menuet_main_message -Menuet_main_wait_message: + jmp .main_message +.main_wait_message: mov eax,10 - jmp Menuet_main_message -Menuet_main_key_press: + jmp .main_message +.main_key_press: push esp call @@MenuetOnKeyPress$qppv pop ecx - jmp Menuet_main_cycle -Menuet_main_mouse: + jmp .main_cycle +.main_mouse: push esp call @@MenuetOnMouse$qppv pop ecx - jmp Menuet_main_cycle -Menuet_main_on_message: + jmp .main_cycle +.main_on_message: dec eax - jz Menuet_main_paint_msg + jz .main_paint_msg dec eax - jz Menuet_main_key_press + jz .main_key_press cmp eax,4 - jz Menuet_main_mouse + jz .main_mouse dec eax - jnz Menuet_main_cycle -Menuet_main_button: + jnz .main_cycle +.main_button: mov eax,17 int 0x40 test al,al - jnz Menuet_main_cycle -Menuet_main_close: + jnz .main_cycle +.main_close: btr dword [esp+MENUET_THREAD_DATA_FLAG*4],31 push esp call @@MenuetOnClose$qppv pop ecx test al,al - jz Menuet_main_button -Menuet_main_end: + jz .main_button +.main_end: mov ebx,esp - lock dec dword [@Menuet@_ThreadNumber] + lock dec dword [@Kolibri@_ThreadNumber] if defined Menuet_SegmentExit & defined Menuet_SegmentExitEnd - jnz Menuet_main_else_last_check + jnz .main_else_last_check push Menuet_SegmentExitEnd push Menuet_SegmentExit - jmp Menuet_main_after_last_check + jmp .main_after_last_check end if -Menuet_main_else_last_check: +.main_else_last_check: xor eax,eax push eax push eax -Menuet_main_after_last_check: +.main_after_last_check: push ebx - call @@Menuet@_RemoveThreadData$qppvpvt2 + call @@Kolibri@_RemoveThreadData$qppvpvt2 add esp,12 - lock inc dword [@Menuet@_ThreadScanCount+4] + lock inc dword [@Kolibri@_ThreadScanCount+4] mov ebx,1 - jmp Menuet_main_end_wait -Menuet_main_end_wait_loop: + jmp .main_end_wait +.main_end_wait_loop: mov eax,5 int 0x40 shl ebx,1 cmp ebx,MENUET_MUTEX_MAX_TIME_WAIT - jna Menuet_main_end_wait + jna .main_end_wait mov ebx,MENUET_MUTEX_MAX_TIME_WAIT -Menuet_main_end_wait: - cmp dword [@Menuet@_ExitProcessNow],0 - jnz @Menuet@ExitProcess$qv - cmp dword [@Menuet@_ThreadScanCount],0 - jnz Menuet_main_end_wait_loop - lock dec dword [@Menuet@_ThreadScanCount+4] +.main_end_wait: + cmp dword [@Kolibri@_ExitProcessNow],0 + jnz @Kolibri@ExitProcess$qv + cmp dword [@Kolibri@_ThreadScanCount],0 + jnz .main_end_wait_loop + lock dec dword [@Kolibri@_ThreadScanCount+4] mov ebp,[esp+4] mov ebx,[esp] add esp,MENUET_THREAD_DATA_LEN*4 mov eax,ebp - pop edi - pop esi + pop edi esi xchg ebp,[esp+8] xchg ebx,[esp+4] ret -enddef +endp macro call func { @@ -325,33 +321,31 @@ macro call func end if } -define @Menuet@Redraw$qippv +proc @Kolibri@Redraw$qippv push ebp mov ebp,[esp+12] mov edx,[ebp+MENUET_THREAD_DATA_FLAG*4] cmp dword [esp+8],0 - jl Menuet_redraw_only_inv - jz Menuet_redraw_no_frame + jl .redraw_only_inv + jz .redraw_no_frame or dl,2 -Menuet_redraw_no_frame: +.redraw_no_frame: bt edx,30 - jnc Menuet_redraw_begin + jnc .redraw_begin or dl,1 mov [ebp+MENUET_THREAD_DATA_FLAG*4],edx - jmp Menuet_redraw_end -Menuet_redraw_only_inv: + jmp .redraw_end +.redraw_only_inv: test dl,3 - jnz Menuet_redraw_no_frame -Menuet_redraw_end: + jnz .redraw_no_frame +.redraw_end: pop ebp ret -Menuet_redraw_begin: - push ebx - push esi - push edi +.redraw_begin: + push ebx esi edi and dword [ebp+MENUET_THREAD_DATA_FLAG*4],0xFFFFFFFC test dl,2 - jz Menuet_redraw_picture + jz .redraw_picture mov eax,12 mov ebx,1 int 0x40 @@ -364,7 +358,7 @@ Menuet_redraw_begin: int 0x40 mov edx,[ebp+MENUET_THREAD_DATA_TITLE*4] test edx,edx - jz Menuet_window_defined + jz .window_defined mov edi,edx mov ecx,0xFFFFFFFF xor al,al @@ -373,48 +367,43 @@ Menuet_redraw_begin: not ecx mov esi,ecx dec esi - jz Menuet_window_defined + jz .window_defined mov eax,4 mov ebx,0x00070007 mov ecx,[ebp+MENUET_THREAD_DATA_C_TITLE*4] int 0x40 -Menuet_window_defined: +.window_defined: mov eax,12 mov ebx,2 int 0x40 -Menuet_redraw_picture: +.redraw_picture: mov eax,12 mov ebx,2 int 0x40 mov esi,[ebp+MENUET_THREAD_DATA_PICTURE*4] test esi,esi - jz Menuet_redraw_end_draw + jz .redraw_end_draw mov ecx,[ebp+MENUET_THREAD_DATA_SZ_PICT*4] - jecxz Menuet_redraw_end_draw + jecxz .redraw_end_draw mov al,byte [ebp+MENUET_THREAD_DATA_C_WINDOW*4+3] and al,15 mov edx,MENUET_BORDER_SIZE*65536+MENUET_HEADER_SIZE cmp al,3 - jnz Menuet_redraw_no_skin + jnz .redraw_no_skin mov eax,48 mov ebx,4 int 0x40 mov dx,ax -Menuet_redraw_no_skin: +.redraw_no_skin: mov eax,7 mov ebx,esi int 0x40 -Menuet_redraw_end_draw: - pop edi - pop esi - pop ebx - pop ebp +.redraw_end_draw: + pop edi esi ebx ebp ret -enddef +endp -define @Menuet@MoveWindow$qxpxi - push ebx - push esi +proc @Kolibri@MoveWindow$qxpxi uses ebx esi mov eax,[esp+12] mov ebx,[eax] mov ecx,[eax+4] @@ -422,20 +411,18 @@ define @Menuet@MoveWindow$qxpxi mov esi,[eax+12] mov eax,67 int 0x40 - pop esi - pop ebx ret -enddef +endp -define @Menuet@Abort$qv - push dword [@Menuet@DebugPrefix] - call @Menuet@DebugPutString$qpxc - mov dword [esp],Menuet_abort_string - call @Menuet@DebugPutString$qpxc - pop ecx -nextdef @Menuet@ExitProcess$qv - lock bts dword [@Menuet@_ExitProcessNow],0 - jc Menuet_exit_process_wait +;proc @Kolibri@Abort$qv +; push dword [@Kolibri@DebugPrefix] +; call @Kolibri@DebugPutString$qpxc +; mov dword [esp],Menuet_abort_string +; call @Kolibri@DebugPutString$qpxc +; pop ecx +proc @Kolibri@ExitProcess$qv + lock bts dword [@Kolibri@_ExitProcessNow],0 + jc .exit_process_wait sub esp,1024 mov eax,9 mov ebx,esp @@ -443,98 +430,94 @@ nextdef @Menuet@ExitProcess$qv int 0x40 mov esi,eax mov edi,[esp+30] -Menuet_exit_process_loop: +.exit_process_loop: mov eax,9 mov ebx,esp mov ecx,esi int 0x40 mov eax,[esp+30] cmp eax,edi - jz Menuet_exit_process_continue + jz .exit_process_continue mov ebx,eax or bl,15 inc ebx - jz Menuet_exit_process_continue + jz .exit_process_continue mov ebx,eax call Menuet_HashInt movzx eax,al - mov eax,dword [@Menuet@_ThreadTable+eax*4] - jmp Menuet_exit_process_test -Menuet_exit_process_next: + mov eax,dword [@Kolibri@_ThreadTable+eax*4] + jmp .exit_process_test +.exit_process_next: mov eax,dword [eax+MENUET_THREAD_DATA_NEXT*4] -Menuet_exit_process_test: +.exit_process_test: test eax,eax - jz Menuet_exit_process_continue + jz .exit_process_continue cmp ebx,[eax+MENUET_THREAD_DATA_PID*4] - jnz Menuet_exit_process_next + jnz .exit_process_next mov eax,18 mov ebx,2 mov ecx,esi int 0x40 -Menuet_exit_process_continue: +.exit_process_continue: dec esi - jnl Menuet_exit_process_loop + jnl .exit_process_loop add esp,1024 - mov dword [@Menuet@_ExitProcessNow],-1 + mov dword [@Kolibri@_ExitProcessNow],-1 if defined EMULATOR int3 call 0x76543210 end if -Menuet_exit_process_end: - mov dword [@Menuet@_ThreadMutex],0 +.exit_process_end: + mov dword [@Kolibri@_ThreadMutex],0 or eax,-1 int 0x40 -Menuet_exit_process_wait: +.exit_process_wait: mov eax,5 mov ebx,1 -Menuet_exit_process_wait_loop: - cmp dword [@Menuet@_ExitProcessNow],0 - jl Menuet_exit_process_end +.exit_process_wait_loop: + cmp dword [@Kolibri@_ExitProcessNow],0 + jl .exit_process_end int 0x40 shl ebx,1 cmp ebx,MENUET_MUTEX_MAX_TIME_WAIT - jna Menuet_exit_process_wait_loop + jna .exit_process_wait_loop mov ebx,MENUET_MUTEX_MAX_TIME_WAIT - jmp Menuet_exit_process_wait_loop -enddef + jmp .exit_process_wait_loop +endp -define @Menuet@ExitThread$qppv,@Menuet@ThreadMain$qpvt1 +proc @Kolibri@ExitThread$qppv,@Kolibri@ThreadMain$qpvt1 mov esp,[esp+4] jmp Menuet_main_end -enddef +endp -define @Menuet@ReturnMessageLoop$qppv,@Menuet@ThreadMain$qpvt1 +proc @Kolibri@ReturnMessageLoop$qppv,@Kolibri@ThreadMain$qpvt1 mov esp,[esp+4] bt dword [esp+MENUET_THREAD_DATA_FLAG*4],30 jc Menuet_main_end jmp Menuet_main_cycle -enddef +endp -define @Menuet@Delay$qui - push ebx +proc @Kolibri@Delay$qui uses ebx mov eax,5 mov ebx,[esp+8] int 0x40 - pop ebx ret -enddef +endp -define @Menuet@Clock$qv - push ebx +proc @Kolibri@Clock$qv uses ebx mov eax,26 mov ebx,9 int 0x40 - pop ebx ret -enddef +endp -define @Menuet@GetPackedTime$qv +proc @Kolibri@GetPackedTime$qv mov eax,3 int 0x40 ret -enddef +endp -define @Menuet@GetTime$qpi +proc @Kolibri@GetTime$qpi mov eax,3 int 0x40 mov edx,[esp+4] @@ -558,15 +541,15 @@ define @Menuet@GetTime$qpi add cl,ah mov dword [edx],ecx ret -enddef +endp -define @Menuet@GetPackedDate$qv +proc @Kolibri@GetPackedDate$qv mov eax,29 int 0x40 ret -enddef +endp -define @Menuet@GetDate$qpi +proc @Kolibri@GetDate$qpi mov eax,29 int 0x40 mov edx,[esp+4] @@ -590,23 +573,18 @@ define @Menuet@GetDate$qpi add cl,ah mov dword [edx+8],ecx ret -enddef +endp -define @Menuet@ReadCommonColors$qpui - push ebx +proc @Kolibri@ReadCommonColors$qpui uses ebx mov eax,48 mov ebx,3 mov ecx,[esp+8] mov edx,40 int 0x40 - pop ebx ret -enddef +endp -define @Menuet@GetProcessInfo$qpuipct1t1piui - push ebx - push esi - push edi +proc @Kolibri@GetProcessInfo$qpuipct1t1piui uses ebx esi edi sub esp,1024 mov eax,9 mov ebx,esp @@ -614,13 +592,13 @@ define @Menuet@GetProcessInfo$qpuipct1t1piui int 0x40 xor edi,edi or edi,[1024+12+4+esp] - jz Menuet_get_proc_info_no_usecpu + jz .get_proc_info_no_usecpu mov ecx,[esp] mov [edi],ecx xor edi,edi -Menuet_get_proc_info_no_usecpu: +.get_proc_info_no_usecpu: or edi,[1024+12+8+esp] - jz Menuet_get_proc_info_no_name + jz .get_proc_info_no_name lea esi,[esp+10] cld movs dword [edi],[esi] @@ -628,21 +606,21 @@ Menuet_get_proc_info_no_usecpu: movs dword [edi],[esi] mov byte [edi],0 xor edi,edi -Menuet_get_proc_info_no_name: +.get_proc_info_no_name: or edi,[1024+12+12+esp] - jz Menuet_get_proc_info_no_mem + jz .get_proc_info_no_mem mov ecx,[esp+26] mov [edi],ecx xor edi,edi -Menuet_get_proc_info_no_mem: +.get_proc_info_no_mem: or edi,[1024+12+16+esp] - jz Menuet_get_proc_info_no_pid + jz .get_proc_info_no_pid mov ecx,[esp+30] mov [edi],ecx xor edi,edi -Menuet_get_proc_info_no_pid: +.get_proc_info_no_pid: or edi,[1024+12+20+esp] - jz Menuet_get_proc_info_no_rect + jz .get_proc_info_no_rect lea esi,[esp+34] cld movs dword [edi],[esi] @@ -650,16 +628,12 @@ Menuet_get_proc_info_no_pid: movs dword [edi],[esi] movs dword [edi],[esi] xor edi,edi -Menuet_get_proc_info_no_rect: +.get_proc_info_no_rect: add esp,1024 - pop edi - pop esi - pop ebx ret -enddef +endp -define @Menuet@GetPid$qv - push ebx +proc @Kolibri@GetPid$qv uses ebx sub esp,1024 mov eax,9 mov ebx,esp @@ -667,21 +641,20 @@ define @Menuet@GetPid$qv int 0x40 mov eax,[esp+30] add esp,1024 - pop ebx ret -enddef +endp -define @Menuet@GetPid$qppv +proc @Kolibri@GetPid$qppv mov ecx,[esp+4] mov eax,[ecx+MENUET_THREAD_DATA_PID*4] ret -enddef +endp -define @Menuet@_HashByte$qui -nextdef @Menuet@_HashWord$qui -nextdef @Menuet@_HashDword$qui +proc @Kolibri@_HashByte$qui +@Kolibri@_HashWord$qui: +@Kolibri@_HashDword$qui: mov eax,[esp+4] -nextdef Menuet_HashInt +Menuet_HashInt: mul dword [Menuet_hash_int_val0] xor eax,edx bswap eax @@ -691,71 +664,68 @@ nextdef Menuet_HashInt lea eax,[eax+4*eax] ror eax,9 ret +endp + Menuet_hash_int_val0: dd 0xA82F94C5 Menuet_hash_int_val1: dd 0x9193780B -enddef -define @Menuet@GetThreadData$qv - call @Menuet@GetPid$qv +proc @Kolibri@GetThreadData$qv + call @Kolibri@GetPid$qv push eax - call @Menuet@GetThreadData$qui + call @Kolibri@GetThreadData$qui pop ecx ret -enddef +endp -define @Menuet@GetThreadData$qui +proc @Kolibri@GetThreadData$qui mov eax,[esp+4] call Menuet_HashInt movzx eax,al - cmp dword [@Menuet@_ThreadScanCount+4],0 - jnz Menuet_get_thread_data_wait -Menuet_get_thread_data_nowait: - lock inc dword [@Menuet@_ThreadScanCount] - mov eax,dword [@Menuet@_ThreadTable+eax*4] + cmp dword [@Kolibri@_ThreadScanCount+4],0 + jnz .get_thread_data_wait +.get_thread_data_nowait: + lock inc dword [@Kolibri@_ThreadScanCount] + mov eax,dword [@Kolibri@_ThreadTable+eax*4] mov ecx,[esp+4] - jmp Menuet_get_thread_data_test -Menuet_get_thread_data_loop: + jmp .get_thread_data_test +.get_thread_data_loop: mov eax,dword [eax+MENUET_THREAD_DATA_NEXT*4] -Menuet_get_thread_data_test: +.get_thread_data_test: test eax,eax - jz Menuet_get_thread_data_end + jz .get_thread_data_end cmp ecx,[eax+MENUET_THREAD_DATA_PID*4] - jnz Menuet_get_thread_data_loop -Menuet_get_thread_data_end: - lock dec dword [@Menuet@_ThreadScanCount] + jnz .get_thread_data_loop +.get_thread_data_end: + lock dec dword [@Kolibri@_ThreadScanCount] ret -Menuet_get_thread_data_wait: - push eax - push ebx +.get_thread_data_wait: + push eax ebx mov eax,5 mov ebx,1 -Menuet_get_thread_data_wait_loop: +.get_thread_data_wait_loop: int 0x40 - cmp dword [@Menuet@_ThreadScanCount+4],0 - jz Menuet_get_thread_data_wait_end + cmp dword [@Kolibri@_ThreadScanCount+4],0 + jz .get_thread_data_wait_end shl ebx,1 cmp ebx,MENUET_MUTEX_MAX_TIME_WAIT - jna Menuet_get_thread_data_wait_loop + jna .get_thread_data_wait_loop mov ebx,MENUET_MUTEX_MAX_TIME_WAIT - jmp Menuet_get_thread_data_wait_loop -Menuet_get_thread_data_wait_end: - pop ebx - pop eax - jmp Menuet_get_thread_data_nowait -enddef + jmp .get_thread_data_wait_loop +.get_thread_data_wait_end: + pop ebx eax + jmp .get_thread_data_nowait +endp -define @Menuet@_GetSkinHeader$qv - push ebx +proc @Kolibri@_GetSkinHeader$qv uses ebx mov eax,48 mov ebx,4 int 0x40 - pop ebx ret -enddef +endp -define @Menuet@GetScreenSize$qrust1 +proc @Kolibri@GetScreenSize$qrust1 mov eax,14 int 0x40 mov ecx,[esp+8] @@ -764,93 +734,87 @@ define @Menuet@GetScreenSize$qrust1 shr eax,16 mov word [ecx],ax ret -enddef +endp -define Menuet_MutexLockNoWait +proc Menuet_MutexLockNoWait pop eax xor al,al ret -enddef +endp -define Menuet_MutexLockWait - push ebx +proc Menuet_MutexLockWait uses ebx mov eax,5 xor ebx,ebx -Menuet_lock_wait_cycle: +.lock_wait_cycle: int 0x40 shl byte [ecx],1 - jz Menuet_lock_wait_cycle - pop ebx + jz .lock_wait_cycle mov al,1 ret -enddef +endp -define Menuet_MutexLockWaitTime +proc Menuet_MutexLockWaitTime cmp dword [esp+12],0 - jng Menuet_MutexLockWait - push ebx - push edx + jng .MutexLockWait + push ebx edx mov edx,[esp+20] mov eax,26 mov ebx,9 int 0x40 add edx,eax -Menuet_lock_wait_time_cycle: +.lock_wait_time_cycle: mov eax,5 xor ebx,ebx int 0x40 shl byte [ecx],1 - jnz Menuet_lock_wait_time_ret_true + jnz .lock_wait_time_ret_true mov eax,26 mov ebx,9 int 0x40 cmp eax,edx - js Menuet_lock_wait_time_cycle - pop edx - pop ebx - pop eax + js .lock_wait_time_cycle + pop edx ebx eax xor al,al ret -Menuet_lock_wait_time_ret_true: - pop edx - pop ebx +.lock_wait_time_ret_true: + pop edx ebx mov al,1 ret -enddef +endp -define Menuet_MutexLock +proc Menuet_MutexLock shl byte [ecx],1 - jnz Menuet_lock_first + jnz .lock_first call eax -Menuet_lock_first: +.lock_first: mov al,1 ret -enddef +endp -define @Menuet@TryLock$qp13Menuet@TMutex +proc @Kolibri@TryLock$qp14Kolibri@TMutex mov eax,Menuet_MutexLockNoWait mov ecx,[esp+4] jmp Menuet_MutexLock -enddef +endp -define @Menuet@Lock$qp13Menuet@TMutex +proc @Kolibri@Lock$qp14Kolibri@TMutex mov eax,Menuet_MutexLockWait mov ecx,[esp+4] jmp Menuet_MutexLock -enddef +endp -define @Menuet@LockTime$qp13Menuet@TMutexi +proc @Kolibri@LockTime$qp14Kolibri@TMutexi mov eax,Menuet_MutexLockWaitTime mov ecx,[esp+4] jmp Menuet_MutexLock -enddef +endp -define @Menuet@UnLock$qp13Menuet@TMutex +proc @Kolibri@UnLock$qp14Kolibri@TMutex mov ecx,[esp+4] shr byte [ecx],1 - jz Menuet_unlock_pause + jz .unlock_pause ret -Menuet_unlock_pause: +.unlock_pause: mov byte [ecx],0x40 push ebx mov eax,5 @@ -858,67 +822,67 @@ Menuet_unlock_pause: int 0x40 pop ebx ret -enddef +endp -define Menuet_MutexLockRec +proc Menuet_MutexLockRec shl byte [ecx],1 - jng Menuet_lock_first + jng .lock_first cmp dword [ecx+4],edx - jz Menuet_lock_rec_self + jz .lock_rec_self call eax -Menuet_lock_rec_first: +.lock_rec_first: mov al,1 mov dword [ecx+4],edx ret -Menuet_lock_rec_self: +.lock_rec_self: mov al,1 add dword [ecx],0x100 - jc Menuet_lock_rec_overflow + jc .lock_rec_overflow ret -Menuet_lock_rec_overflow: - push dword [@Menuet@DebugPrefix] - call @Menuet@DebugPutString$qpxc +.lock_rec_overflow: + push dword [@Kolibri@DebugPrefix] + call @Kolibri@DebugPutString$qpxc mov dword [esp],Menuet_try_lock_rec_overflow_string - call @Menuet@DebugPutString$qpxc + call @Kolibri@DebugPutString$qpxc pop ecx - jmp @Menuet@Abort$qv -enddef + jmp @Kolibri@Abort$qv +endp -define @Menuet@TryLock$qp16Menuet@TRecMutexui +proc @Kolibri@TryLock$qp16Kolibri@TRecMutexui mov eax,Menuet_MutexLockNoWait mov ecx,[esp+4] mov edx,[esp+8] jmp Menuet_MutexLockRec -enddef +endp -define @Menuet@Lock$qp16Menuet@TRecMutexui +proc @Kolibri@Lock$qp16Kolibri@TRecMutexui mov eax,Menuet_MutexLockWait mov ecx,[esp+4] mov edx,[esp+8] jmp Menuet_MutexLockRec -enddef +endp -define @Menuet@LockTime$qp16Menuet@TRecMutexiui +proc @Kolibri@LockTime$qp16Kolibri@TRecMutexiui mov eax,Menuet_MutexLockWaitTime mov ecx,[esp+4] mov edx,[esp+12] jmp Menuet_MutexLockRec -enddef +endp -define @Menuet@UnLock$qp16Menuet@TRecMutexui +proc @Kolibri@UnLock$qp16Kolibri@TRecMutexui mov ecx,[esp+4] mov edx,[esp+8] cmp dword [ecx+4],edx - jnz Menuet_unlock_rec_notlocked + jnz .unlock_rec_notlocked sub dword [ecx],0x100 - jnc Menuet_unlock_rec_end + jnc .unlock_rec_end add dword [ecx],0x100 shl byte [ecx],1 shr byte [ecx],2 - jng Menuet_unlock_rec_pause -Menuet_unlock_rec_end: + jng .unlock_rec_pause +.unlock_rec_end: ret -Menuet_unlock_rec_pause: +.unlock_rec_pause: mov byte [ecx],0x20 push ebx mov eax,5 @@ -926,132 +890,127 @@ Menuet_unlock_rec_pause: int 0x40 pop ebx ret -Menuet_unlock_rec_notlocked: - push dword [@Menuet@DebugPrefix] - call @Menuet@DebugPutString$qpxc +.unlock_rec_notlocked: + push dword [@Kolibri@DebugPrefix] + call @Kolibri@DebugPutString$qpxc mov dword [esp],Menuet_unlock_rec_notlocked_string - call @Menuet@DebugPutString$qpxc + call @Kolibri@DebugPutString$qpxc pop ecx - jmp @Menuet@Abort$qv -enddef + jmp @Kolibri@Abort$qv +endp -define @Menuet@DebugPutChar$qc +proc @Kolibri@DebugPutChar$qc mov cl,byte [esp+4] cmp cl,13 - jz Menuet_debug_put_char_ret + jz .debug_put_char_ret push ebx cmp cl,10 - jz Menuet_debug_put_char_enter -Menuet_debug_put_char_after_cmp: + jz .debug_put_char_enter +.debug_put_char_after_cmp: mov eax,63 mov ebx,1 int 0x40 pop ebx -Menuet_debug_put_char_ret: +.debug_put_char_ret: ret -Menuet_debug_put_char_enter: +.debug_put_char_enter: mov cl,13 mov eax,63 mov ebx,1 int 0x40 mov cl,10 - jmp Menuet_debug_put_char_after_cmp -enddef + jmp .debug_put_char_after_cmp +endp -define @Menuet@DebugPutString$qpxc +proc @Kolibri@DebugPutString$qpxc push esi push dword 0 mov esi,dword [esp+12] - jmp Menuet_debug_put_string_test -Menuet_debug_put_string_loop: + jmp .debug_put_string_test +.debug_put_string_loop: mov dword [esp],eax - call @Menuet@DebugPutChar$qc + call @Kolibri@DebugPutChar$qc inc esi -Menuet_debug_put_string_test: +.debug_put_string_test: xor eax,eax or al,[esi] test al,al - jnz Menuet_debug_put_string_loop - pop ecx - pop esi + jnz .debug_put_string_loop + pop ecx esi ret -enddef +endp -define @Menuet@GetKey$qv +proc @Kolibri@GetKey$qv mov eax,2 int 0x40 test al,al - jnz Menuet_get_key_eof + jnz .get_key_eof movzx eax,ah ret -Menuet_get_key_eof: +.get_key_eof: mov eax,-1 ret -enddef +endp -define @Menuet@GetMouseButton$qv - push ebx +proc @Kolibri@GetMouseButton$qv uses ebx mov eax,37 mov ebx,2 int 0x40 - pop ebx ret -enddef +endp -define @Menuet@GetMousePosition$qrst1o - push ebx +proc @Kolibri@GetMousePosition$qrst1o uses ebx mov eax,37 xor ebx,ebx cmp byte [esp+16],0 - jnz Menuet_get_mouse_pos_absolute + jnz .get_mouse_pos_absolute inc ebx -Menuet_get_mouse_pos_absolute: +.get_mouse_pos_absolute: int 0x40 mov ecx,[esp+12] mov word [ecx],ax mov ecx,[esp+8] shr eax,16 mov word [ecx],ax - pop ebx ret -enddef +endp -define @Menuet@WasThreadCreated$qv - cmp byte [@Menuet@_ThreadSavedBegProc],0x90 +proc @Kolibri@WasThreadCreated$qv + cmp byte [@Kolibri@_ThreadSavedBegProc],0x90 setz al ret -enddef +endp -define @Menuet@CreateThread$qpvuit1 +proc @Kolibri@CreateThread$qpvuit1 push ebx mov edx,[esp+16] mov ebx,[esp+12] test edx,edx - jnz Menuet_create_thread_after_new + jnz .create_thread_after_new if defined MenuetHeapAlloc cmp ebx,4096 - jnb Menuet_create_thread_alloc + jnb .create_thread_alloc mov ebx,STACKSIZE -Menuet_create_thread_alloc: +.create_thread_alloc: push ebx - call MenuetHeapAlloc ; Create new dynamic memory of the given size + call MenuetHeapAlloc ; Create new dynamic memory of the given size pop ecx test eax,eax - jnz Menuet_create_thread_mem_created + jnz .create_thread_mem_created end if or eax,-1 - jmp Menuet_create_thread_end -Menuet_create_thread_mem_created: + jmp .create_thread_end +.create_thread_mem_created: lea edx,[eax+ebx] -Menuet_create_thread_after_new: +.create_thread_after_new: neg ebx - jz Menuet_create_thread_test_first + jz .create_thread_test_first add ebx,edx -Menuet_create_thread_test_first: - cmp byte [@Menuet@_ThreadSavedBegProc],0x90 - jnz Menuet_create_thread_init -Menuet_create_thread_fill_stack: - lock inc dword [@Menuet@_ThreadNumber] +.create_thread_test_first: + cmp byte [@Kolibri@_ThreadSavedBegProc],0x90 + jnz .create_thread_init +.create_thread_fill_stack: + lock inc dword [@Kolibri@_ThreadNumber] and edx,not 3 sub edx,12 mov ecx,[esp+8] @@ -1060,65 +1019,60 @@ Menuet_create_thread_fill_stack: mov dword [edx],Menuet_ThreadFinish mov eax,51 mov ebx,1 - mov ecx,@Menuet@ThreadMain$qpvt1 + mov ecx,@Kolibri@ThreadMain$qpvt1 int 0x40 mov ebx,eax or bl,15 inc ebx - jnz Menuet_create_thread_end - lock dec dword [@Menuet@_ThreadNumber] + jnz .create_thread_end + lock dec dword [@Kolibri@_ThreadNumber] if defined MenuetHeapFree or ebx,[edx+8] - jz Menuet_create_thread_end + jz .create_thread_end push ebx - call MenuetHeapFree ; Delete the given dynamic memory + call MenuetHeapFree ; Delete the given dynamic memory pop ecx end if -Menuet_create_thread_end: +.create_thread_end: pop ebx ret -Menuet_create_thread_init: - push esi - push edi +.create_thread_init: + push esi edi cld - mov esi,@Menuet@_ThreadSavedBegProc - mov edi,@Menuet@GetPid$qv + mov esi,@Kolibri@_ThreadSavedBegProc + mov edi,@Kolibri@GetPid$qv movs dword [edi],[esi] movs dword [edi],[esi] - mov edi,@Menuet@GetThreadData$qv + mov edi,@Kolibri@GetThreadData$qv movs dword [edi],[esi] movs dword [edi],[esi] mov eax,0x90909090 - mov edi,@Menuet@_ThreadSavedBegProc + mov edi,@Kolibri@_ThreadSavedBegProc stos dword [edi] stos dword [edi] stos dword [edi] stos dword [edi] - pop edi - pop esi - jmp Menuet_create_thread_fill_stack -enddef + pop edi esi + jmp .create_thread_fill_stack +endp -define @Menuet@_FileAccess$qpv - push ebx +proc @Kolibri@_FileAccess$qpv uses ebx mov eax,70 mov ebx,[esp+8] int 0x40 mov ecx,[esp+8] mov [ecx],ebx - pop ebx ret -enddef +endp -define Menuet_abort_string +Menuet_abort_string: db 'Abnormal program termination.',10,0 -newdef Menuet_try_lock_rec_overflow_string +Menuet_try_lock_rec_overflow_string: db 'Recursive mutex lock count overflow.',10,0 -newdef Menuet_unlock_rec_notlocked_string +Menuet_unlock_rec_notlocked_string: db 'Recursive mutex unlock error.',10,0 -enddef -include "me_lib.inc" +include "kos_lib.inc" ;/**/ diff --git a/programs/demos/life2/include/me_heap.h b/programs/demos/life2/include/kos_heap.h similarity index 88% rename from programs/demos/life2/include/me_heap.h rename to programs/demos/life2/include/kos_heap.h index 5954d8edfc..2bf02d5565 100644 --- a/programs/demos/life2/include/me_heap.h +++ b/programs/demos/life2/include/kos_heap.h @@ -1,12 +1,12 @@ #ifndef __MENUET_HEAP_H_INCLUDED_ #define __MENUET_HEAP_H_INCLUDED_ -#include +#include #include -// Menuet memory heap interface. +// Kolibri memory heap interface. -namespace Menuet // All menuet functions, types and data are nested in the (Menuet) namespace. +namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace. { void *Alloc(unsigned int size); void *ReAlloc(void *mem, unsigned int size); @@ -15,7 +15,7 @@ namespace Menuet // All menuet functions, types and data are nested in the (Me #ifdef __MENUET__ -namespace Menuet +namespace Kolibri { // Global variables diff --git a/programs/demos/life2/include/me_heap.inc b/programs/demos/life2/include/kos_heap.inc similarity index 53% rename from programs/demos/life2/include/me_heap.inc rename to programs/demos/life2/include/kos_heap.inc index 50ed2ab8cf..b12ab5a9db 100644 --- a/programs/demos/life2/include/me_heap.inc +++ b/programs/demos/life2/include/kos_heap.inc @@ -1,16 +1,16 @@ ;/*** -MenuetHeapInit = @@Menuet@_HeapInit$qpvt1t1 +MenuetHeapInit = @@Kolibri@_HeapInit$qpvt1t1 -MenuetHeapAlloc = @@Menuet@Alloc$qui +MenuetHeapAlloc = @@Kolibri@Alloc$qui -MenuetHeapReAlloc = @@Menuet@ReAlloc$qpvui +MenuetHeapReAlloc = @@Kolibri@ReAlloc$qpvui -MenuetHeapFree = @@Menuet@Free$qpv +MenuetHeapFree = @@Kolibri@Free$qpv -MenuetHeapFreeAndThreadFinish = @Menuet@_FreeAndThreadFinish$qpvpi +MenuetHeapFreeAndThreadFinish = @Kolibri@_FreeAndThreadFinish$qpvpi -define @Menuet@_SetUseMemory$qui +proc @Kolibri@_SetUseMemory$qui push ebx mov eax,64 mov ebx,1 @@ -18,23 +18,23 @@ define @Menuet@_SetUseMemory$qui int 0x40 pop ebx test eax,eax - jnz Menuet_set_use_memory_nomem + jnz .set_use_memory_nomem push ecx - push dword [@Menuet@_MenuetMemBlock] + push dword [@Kolibri@_MenuetMemBlock] call @@MemoryHeap@ResizeBlock$q20MemoryHeap@TMemBlockpv add esp,8 mov al,1 ret -Menuet_set_use_memory_nomem: +.set_use_memory_nomem: xor al,al ret -enddef +endp -define @Menuet@_RecalculateUseMemory$qui +proc @Kolibri@_RecalculateUseMemory$qui mov eax,dword [esp+4] mov ecx,(U_END + 3) and not 3 cmp eax,ecx - jna Menuet_recalculate_use_memory_min + jna .recalculate_use_memory_min push ebx sub eax,ecx mov ebx,6 @@ -45,35 +45,35 @@ define @Menuet@_RecalculateUseMemory$qui and eax,not 3 pop ebx ret -Menuet_recalculate_use_memory_min: +.recalculate_use_memory_min: mov eax,ecx ret -enddef +endp -define @Menuet@_FreeAndThreadFinish$qpvpi +proc @Kolibri@_FreeAndThreadFinish$qpvpi mov ebx,1 mov ecx,[esp+8] - jmp Menuet_heap_free_tf_wait -Menuet_heap_free_tf_wait_loop: + jmp .heap_free_tf_wait +.heap_free_tf_wait_loop: mov eax,5 int 0x40 shl ebx,1 cmp ebx,MENUET_MUTEX_MAX_TIME_WAIT - jna Menuet_heap_free_tf_wait + jna .heap_free_tf_wait mov ebx,MENUET_MUTEX_MAX_TIME_WAIT -Menuet_heap_free_tf_wait: +.heap_free_tf_wait: cmp dword [ecx],0 - jnz @Menuet@ExitProcess$qv - lock bts dword [@Menuet@_MemHeapMutex],0 - jc Menuet_heap_free_tf_wait_loop + jnz @Kolibri@ExitProcess$qv + lock bts dword [@Kolibri@_MemHeapMutex],0 + jc .heap_free_tf_wait_loop push dword [esp+4] - push @Menuet@_MenuetFreeSpace + push @Kolibri@_MenuetFreeSpace call @@MemoryHeap@Free$qr21MemoryHeap@TFreeSpacepv add esp,8 - mov byte [@Menuet@_MemHeapMutex],0x40 + mov byte [@Kolibri@_MemHeapMutex],0x40 or eax,-1 int 0x40 -enddef +endp macro call func { diff --git a/programs/demos/life2/include/me_lib.h b/programs/demos/life2/include/kos_lib.h similarity index 70% rename from programs/demos/life2/include/me_lib.h rename to programs/demos/life2/include/kos_lib.h index 48cebb6c7b..eb0bbd0a92 100644 --- a/programs/demos/life2/include/me_lib.h +++ b/programs/demos/life2/include/kos_lib.h @@ -1,9 +1,9 @@ #ifndef __MENUET_LIB_H_INCLUDED_ #define __MENUET_LIB_H_INCLUDED_ -// Menuet interface. +// Kolibri interface. -namespace Menuet // All menuet functions, types and data are nested in the (Menuet) namespace. +namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace. { unsigned int StrLen(const char *str); char *StrCopy(char *dest, const char *src); diff --git a/programs/demos/life2/include/me_lib.inc b/programs/demos/life2/include/kos_lib.inc similarity index 75% rename from programs/demos/life2/include/me_lib.inc rename to programs/demos/life2/include/kos_lib.inc index 7be9ab3fac..601b7b204d 100644 --- a/programs/demos/life2/include/me_lib.inc +++ b/programs/demos/life2/include/kos_lib.inc @@ -1,5 +1,4 @@ -define @Menuet@StrLen$qpxc - push edi +proc @Kolibri@StrLen$qpxc uses edi cld mov edi,[esp+8] mov ecx,-1 @@ -7,13 +6,10 @@ define @Menuet@StrLen$qpxc repnz scas byte [edi] not ecx lea eax,[ecx-1] - pop edi ret -enddef +endp -define @Menuet@StrCopy$qpcpxc - push esi - push edi +proc @Kolibri@StrCopy$qpcpxc uses esi edi cld mov edi,[esp+16] mov ecx,-1 @@ -29,14 +25,10 @@ define @Menuet@StrCopy$qpcpxc mov ecx,edx and ecx,3 rep movs byte [edi],[esi] - pop edi - pop esi ret -enddef +endp -define @Menuet@MemCopy$qpvpxvui - push esi - push edi +proc @Kolibri@MemCopy$qpvpxvui uses esi edi cld mov edi,[esp+12] mov eax,edi @@ -48,13 +40,10 @@ define @Menuet@MemCopy$qpvpxvui mov ecx,edx and ecx,3 rep movs byte [edi],[esi] - pop edi - pop esi ret -enddef +endp -define @Menuet@MemSet$qpvcui - push edi +proc @Kolibri@MemSet$qpvcui uses edi cld mov edi,[esp+8] mov al,[esp+12] @@ -69,12 +58,11 @@ define @Menuet@MemSet$qpvcui mov ecx,edx and ecx,3 rep stos byte [edi] - pop edi mov eax,[esp+4] ret -enddef +endp -define __ftol +proc __ftol sub esp,12 wait fstcw word [esp+8] @@ -89,9 +77,9 @@ define __ftol mov edx,[esp+4] add esp,12 ret -enddef +endp -define @Menuet@Floor$qd +proc @Kolibri@Floor$qd fld qword [esp+4] mov ax,[esp+10] shl ax,1 @@ -114,5 +102,5 @@ define @Menuet@Floor$qd add esp,2 Menuet_floor_end: ret -enddef +endp diff --git a/programs/demos/life2/include/me_start.inc b/programs/demos/life2/include/kos_start.inc similarity index 74% rename from programs/demos/life2/include/me_start.inc rename to programs/demos/life2/include/kos_start.inc index 16a4b63a81..856007c733 100644 --- a/programs/demos/life2/include/me_start.inc +++ b/programs/demos/life2/include/kos_start.inc @@ -1,12 +1,12 @@ use32 -org 0x0 +org 0 db 'MENUET01' - dd 0x1 - dd MenuetEntryPoint + dd 1 + dd @Kolibri@Main$qv dd I_END dd U_END+STACKSIZE+HEAPSIZE dd U_END+STACKSIZE - dd @Menuet@CommandLine,0x0 + dd @Kolibri@CommandLine,0 ptr equ offset equ @@ -78,13 +78,8 @@ macro newdef x,[link] usedef link } -macro nextdef x,[link] +macro nextdef x { - common - usedef x - end if - if x eq - else if used x - x: - usedef link +x: } + diff --git a/programs/demos/life2/include/menuet_win.cpp b/programs/demos/life2/include/menuet_win.cpp index 1653ebc65a..12c50af426 100644 --- a/programs/demos/life2/include/menuet_win.cpp +++ b/programs/demos/life2/include/menuet_win.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -6,11 +5,11 @@ #include #include -#include -#include -#include +#include +#include +#include -using namespace Menuet; +using namespace Kolibri; using namespace std; const char file_prefix[] = ""; @@ -236,7 +235,7 @@ int ThreadMainProc(void *user) return 0; } -namespace Menuet +namespace Kolibri { void Main() {ThreadMain();} diff --git a/programs/demos/life2/me_cdlg.h b/programs/demos/life2/kos_cdlg.h similarity index 87% rename from programs/demos/life2/me_cdlg.h rename to programs/demos/life2/kos_cdlg.h index 3e6f71c1e4..35fccbb7de 100644 --- a/programs/demos/life2/me_cdlg.h +++ b/programs/demos/life2/kos_cdlg.h @@ -1,11 +1,11 @@ #ifndef __MENUET_FILE_OPEN_H_INCLUDED_ #define __MENUET_FILE_OPEN_H_INCLUDED_ -#include +#include -// Menuet interface. +// Kolibri interface. -namespace Menuet // All menuet functions, types and data are nested in the (Menuet) namespace. +namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace. { struct TOpenFileStruct; // Data for a file open dialog. #define MENUET_OPEN_FILE_INIT {} // Initializer of the file open struct, cat be redefined in a realization of the library @@ -21,7 +21,7 @@ namespace Menuet // All menuet functions, types and data are nested in the (Me #ifdef __MENUET__ -namespace Menuet +namespace Kolibri { // Structures. @@ -81,7 +81,7 @@ namespace Menuet #else // else: def __MENUET__ -namespace Menuet +namespace Kolibri { struct TOpenFileStruct { diff --git a/programs/demos/life2/me_cdlg.inc b/programs/demos/life2/kos_cdlg.inc similarity index 50% rename from programs/demos/life2/me_cdlg.inc rename to programs/demos/life2/kos_cdlg.inc index 83bb8da730..62c63a745e 100644 --- a/programs/demos/life2/me_cdlg.inc +++ b/programs/demos/life2/kos_cdlg.inc @@ -1,16 +1,12 @@ -define @Menuet@OpenFileDialog$qr22Menuet@TOpenFileStruct - push ebx - push esi - push edi - push ebp - call @Menuet@GetThreadData$qv +proc @Kolibri@OpenFileDialog$qr23Kolibri@TOpenFileStruct uses ebx esi edi ebp + call @Kolibri@GetThreadData$qv mov ebp,eax mov ebx,[esp+20] cmp dword [ebx+4],0 - jnz Menuet_open_file_dlg_str + jnz .open_file_dlg_str mov esi,7 - jmp Menuet_open_file_dlg_alloc -Menuet_open_file_dlg_str: + jmp .open_file_dlg_alloc +.open_file_dlg_str: cld mov edi,[ebx+4] mov ecx,-1 @@ -18,12 +14,12 @@ Menuet_open_file_dlg_str: repnz scas byte [edi] not ecx mov esi,ecx -Menuet_open_file_dlg_alloc: +.open_file_dlg_alloc: push esi - call @@Menuet@Alloc$qui + call @@Kolibri@Alloc$qui pop ecx test eax,eax - jz Menuet_open_file_dlg_ret + jz .open_file_dlg_ret mov ecx,esi dec ecx push esi @@ -31,17 +27,17 @@ Menuet_open_file_dlg_alloc: push eax mov dword [ebx],-1 cmp dword [ebx+4],0 - jnz Menuet_open_file_dlg_copy + jnz .open_file_dlg_copy mov dword [eax],0x2F64722F mov word [eax+4],0x2F31 - jmp Menuet_open_file_dlg_redraw -Menuet_open_file_dlg_copy: + jmp .open_file_dlg_redraw +.open_file_dlg_copy: cld mov ecx,esi mov esi,[ebx+4] mov edi,eax rep movs byte [edi],[esi] -Menuet_open_file_dlg_redraw: +.open_file_dlg_redraw: mov eax,12 mov ebx,1 int 0x40 @@ -55,8 +51,8 @@ Menuet_open_file_dlg_redraw: mov eax,4 mov ebx,0x00070007 mov ecx,[ebp+MENUET_THREAD_DATA_C_TITLE*4] - mov edx,Menuet_open_file_dlg_name - mov esi,Menuet_open_file_dlg_name_end - Menuet_open_file_dlg_name + mov edx,Kolibri_open_file_dlg_name + mov esi,Kolibri_open_file_dlg_name_end - Kolibri_open_file_dlg_name int 0x40 mov eax,4 mov ebx,0x000C001E @@ -67,78 +63,78 @@ Menuet_open_file_dlg_redraw: mov eax,12 mov ebx,2 int 0x40 -Menuet_open_file_dlg_loop: +.open_file_dlg_loop: mov eax,10 int 0x40 dec eax - jz Menuet_open_file_dlg_redraw + jz .open_file_dlg_redraw dec eax - jz Menuet_open_file_dlg_key + jz .open_file_dlg_key dec eax - jz Menuet_open_file_dlg_end - jmp Menuet_open_file_dlg_loop -Menuet_open_file_dlg_key: + jz .open_file_dlg_end + jmp .open_file_dlg_loop +.open_file_dlg_key: xor edi,edi -Menuet_open_file_dlg_key_loop: +.open_file_dlg_key_loop: mov eax,2 int 0x40 test al,al - jnz Menuet_open_file_dlg_key_end + jnz .open_file_dlg_key_end cmp ah,27 - jz Menuet_open_file_dlg_end + jz .open_file_dlg_end cmp ah,13 - jz Menuet_open_file_dlg_apply + jz .open_file_dlg_apply cmp ah,8 - jz Menuet_open_file_dlg_key_bsp + jz .open_file_dlg_key_bsp cmp ah,32 - jna Menuet_open_file_dlg_key_loop + jna .open_file_dlg_key_loop mov ebx,[esp+4] cmp ebx,[esp+8] - jb Menuet_open_file_dlg_key_any + jb .open_file_dlg_key_any lea esi,[ebx+2*ebx] shr esi,1 inc esi push eax push esi push dword [esp+8] - call @@Menuet@ReAlloc$qpvui + call @@Kolibri@ReAlloc$qpvui add esp,8 mov ecx,eax pop eax test ecx,ecx - jz Menuet_open_file_dlg_key + jz .open_file_dlg_key mov [esp+8],esi mov [esp],ecx -Menuet_open_file_dlg_key_any: +.open_file_dlg_key_any: mov esi,ebx add esi,[esp] mov byte [esi],ah inc ebx mov edi,1 mov [esp+4],ebx - jmp Menuet_open_file_dlg_key_loop -Menuet_open_file_dlg_key_bsp: + jmp .open_file_dlg_key_loop +.open_file_dlg_key_bsp: mov eax,[esp+4] test eax,eax - jz Menuet_open_file_dlg_key_loop + jz .open_file_dlg_key_loop dec eax mov edi,1 mov [esp+4],eax - jmp Menuet_open_file_dlg_key_loop -Menuet_open_file_dlg_key_end: + jmp .open_file_dlg_key_loop +.open_file_dlg_key_end: test edi,edi - jnz Menuet_open_file_dlg_redraw - jmp Menuet_open_file_dlg_loop -Menuet_open_file_dlg_apply: + jnz .open_file_dlg_redraw + jmp .open_file_dlg_loop +.open_file_dlg_apply: mov eax,[esp+4] inc eax mov [esp+8],eax push eax push dword [esp+4] - call @@Menuet@ReAlloc$qpvui + call @@Kolibri@ReAlloc$qpvui add esp,8 test eax,eax - jz Menuet_open_file_dlg_end + jz .open_file_dlg_end mov eax,[esp] mov esi,eax add eax,[esp+4] @@ -147,27 +143,25 @@ Menuet_open_file_dlg_apply: mov ebx,[esp+20] mov dword [ebx],2 push dword [ebx+4] - call @@Menuet@Free$qpv + call @@Kolibri@Free$qpv pop ecx mov [ebx+4],esi - jmp Menuet_open_file_dlg_invalidate -Menuet_open_file_dlg_end: - call @@Menuet@Free$qpv + jmp .open_file_dlg_invalidate +.open_file_dlg_end: + call @@Kolibri@Free$qpv add esp,12 mov ebx,[esp+20] mov dword [ebx],1 -Menuet_open_file_dlg_invalidate: +.open_file_dlg_invalidate: push ebp push dword 1 - call @@Menuet@Invalidate$qippv + call @@Kolibri@Invalidate$qippv add esp,8 -Menuet_open_file_dlg_ret: - pop ebp - pop edi - pop esi - pop ebx +.open_file_dlg_ret: ret -Menuet_open_file_dlg_name: +endp + +Kolibri_open_file_dlg_name: db 'Open file' -Menuet_open_file_dlg_name_end: -enddef +Kolibri_open_file_dlg_name_end: + diff --git a/programs/demos/life2/me_cdlg_win.cpp b/programs/demos/life2/kos_cdlg_win.cpp similarity index 91% rename from programs/demos/life2/me_cdlg_win.cpp rename to programs/demos/life2/kos_cdlg_win.cpp index 0b7d6c6437..c2f17f937a 100644 --- a/programs/demos/life2/me_cdlg_win.cpp +++ b/programs/demos/life2/kos_cdlg_win.cpp @@ -1,11 +1,10 @@ -#include #include -#include -#include -#include "me_cdlg.h" +#include +#include +#include "kos_cdlg.h" -using namespace Menuet; +using namespace Kolibri; extern HINSTANCE hInstance; @@ -31,7 +30,7 @@ struct TOpenFileData char name[1]; }; -namespace Menuet +namespace Kolibri { TOpenFileStruct::TOpenFileStruct() : data(0) {} diff --git a/programs/demos/life2/life2.cpp b/programs/demos/life2/life2.cpp index 3de54e847d..3fa122c75f 100644 --- a/programs/demos/life2/life2.cpp +++ b/programs/demos/life2/life2.cpp @@ -1,11 +1,11 @@ -#include -#include -#include +#include +#include +#include #include "lifegen.h" #include "life_bmp.h" -#include "me_cdlg.h" +#include "kos_cdlg.h" -using namespace Menuet; +using namespace Kolibri; /*** #define StrLen LibbStrLen @@ -20,14 +20,13 @@ void *(*MemCopy)(void *dest, const void *src, unsigned int n) = 0; void *(*MemSet)(void *s, char c, unsigned int n) = 0; double (*Floor)(double x) = 0; -#include void LibbInit() { HINSTANCE hLib = LoadLibrary("Libb.dll"); if (!hLib) { DebugPutString("Can't load the library.\n"); - Menuet::Abort(); + Kolibri::Abort(); } StrLen = (unsigned int(*)(const char *str))GetProcAddress(hLib, "StrLen"); StrCopy = (char *(*)(char *dest, const char *src))GetProcAddress(hLib, "StrCopy"); @@ -1789,7 +1788,7 @@ int MenuetOnIdle(TThreadData th) return res; } -void MenuetOnSize(int window_rect[], Menuet::TThreadData th) +void MenuetOnSize(int window_rect[], Kolibri::TThreadData th) { unsigned short w, h; GetClientSize(w, h, window_rect[2], window_rect[3], th); @@ -1964,13 +1963,13 @@ void DllInit() if (!hLib) { DebugPutString("Can't load the library.\n"); - Menuet::Abort(); + Kolibri::Abort(); } DllOneGeneration = (void(__stdcall*)(int, int, void*, const void*, int))GetProcAddress(hLib, "OneGeneration"); if (!DllOneGeneration) { DebugPutString("Can't get a library function.\n"); - Menuet::Abort(); + Kolibri::Abort(); } } diff --git a/programs/demos/life2/me_make.inc b/programs/demos/life2/me_make.inc index 52b3a98162..83b95976dd 100644 --- a/programs/demos/life2/me_make.inc +++ b/programs/demos/life2/me_make.inc @@ -5,9 +5,10 @@ STACKSIZE equ 102400 HEAPSIZE equ 102400 -include "include\me_start.inc" -include "include\me_func.inc" -include "include\me_heap.inc" -include "me_cdlg.inc" +include "..\..\proc32.inc" +include "include\kos_start.inc" +include "include\kos_func.inc" +include "include\kos_heap.inc" +include "kos_cdlg.inc" include "mmxlife.inc" ;include "sse2life.inc"