Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Samples

Simple window in KolibriOS

A community discussion post from the original code:zIRON forum.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Simple window in KolibriOS

The latest Ziron linker plugin supports KolibriOS executables. A sample app (code provided by 0CodErr)

program KOLIBRI32 'sample';
 
#include 'kolibrios.zir';
                
const MY_WIN_STYLE = WS_CAPTION or WS_COORD_CLIENT or WS_SKINNED_SIZABLE or WS_FILL_GRADIENT or 0x00C00DEE;                  
const MY_EVENT_MASK = EM_REDRAW or EM_BUTTON;                  

dword Width,Height,Left,Top;
	
SetEventMask(MY_EVENT_MASK);
	
// calculate left, top, width, height:
edx = GetScreenSize();
edx >> 17;
and eax, 0xFFFF;
eax >> 1;
Height = eax;
eax >> 1;
Top  = eax;  
Width  = edx;
edx >> 1;
Left = edx;

repeat {
	RedrawStart();
	DrawWindow(Left, Width, Top, Height, MY_WIN_STYLE, 'Hello from Ziron :)');  
	RedrawFinish();
	
	eax = WaitEvent();
} until (eax != 1);
	
ThreadTerminate();

Replies

0CodErr member
Posts
201
Threads
37
Location
Unknown

Currently in 'kolibrios\\macros.zir' macro "DrawWindow" expects 7 params. But in this example only 6. Need update i think.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Yes, latest release I added the additional parameter you suggested in PM.

update line:

  DrawWindow(Left, Width, Top, Height, MY_WIN_STYLE, 'Hello from Ziron :)'); 

to

  DrawWindow(Left, Width, Top, Height, MY_WIN_STYLE, 'Hello from Ziron :)', CAPTION_MOVABLE); 

The kolibrios include was just a test, I will need to look at the API guide for kolibri to start writing full include files.

Just a quick question, in Kolibri, which registered are treated as volatile? (Which need to be protected on function calls etc)

0CodErr member
Posts
201
Threads
37
Location
Unknown
Just a quick question, in Kolibri, which registered are treated as volatile? (Which need to be protected on function calls etc)

Emm.. did you mean calling convention?

As written in http://websvn.kolibrios.org/filedetails.php?repname=Kolibri+OS&path=%2Fkernel%2Ftrunk%2Fdocs%2Fsysfuncs.txt:

Number of the function is located in the register eax. The call of the system function is executed by "int 0x40" command. All registers except explicitly declared in the returned value,
including eflags, are preserved.