Вот example.c :
Code: Select all
#asm
use32
org 0x0
db 'MENUET01'
dd 0x01
dd _main
dd I_END
dd 0x100000
dd 0x7fff0
dd 0x0,0x0
include 'INTRINS.ASM'
#endasm
/********* C library *********/
s_get_event()
{
#asm
mov eax,10
int 0x40
#endasm
}
s_get_key()
{
#asm
mov eax,2
int 0x40
and eax,0x0000ff00
shr eax,8
#endasm
}
s_get_button()
{
#asm
mov eax,17
int 0x40
shr eax,8
#endasm
}
s_begin_draw()
{
#asm
mov ebx,1
mov eax,12
int 0x40
#endasm
}
s_end_draw()
{
#asm
mov ebx,2
mov eax,12
int 0x40
#endasm
}
s_draw_window(x1,y1,w,h,c_area,c_grab,c_fram)
int x1,y1,w,h; /* esp +32 +28 +24 +20 */
int c_area,c_grab,c_fram; /* esp +16 +12 +8 */
{
#asm
; color of frames
mov edi,[esp+8]
; color of grab bar bit 8->color gl
mov esi,[esp+12]
; color of work area bit 8-> color gl
mov edx,[esp+16]
;left / width
mov ebx,[esp+32]
shl ebx,16
mov bx,[esp+24]
;top / height
mov ecx,[esp+28]
shl ecx,16
mov cx,[esp+20]
;execute
mov eax,0
int 0x40
#endasm
}
s_print_text(x,y,color,p_string)
int x,y,color; /* esp +20 +16 +12 */
char *p_string; /* esp +8 */
{
#asm
mov ebx,[esp+20]
shl ebx,16
mov bx,[esp+16]
mov ecx,[esp+12]
mov edx,[esp+8]
;find text lenght
xor esi,esi
.next:
cmp byte [edx+esi],0
jz .good
inc esi
jmp .next
.good:
mov eax,4
int 0x40
#endasm
}
s_draw_button(x1,y1,w,h,color,id)
int x1,y1,w,h; /* esp +28 +24 +20 +16 */
int color,id; /* esp +12 +8 */
{
#asm
;left / width
mov ebx,[esp+28]
shl ebx,16
mov bx,[esp+20]
;top / height
mov ecx,[esp+24]
shl ecx,16
mov cx,[esp+16]
mov edx,[esp+8]
mov esi,[esp+12]
mov eax,8
int 0x40
#endasm
}
s_quit()
{
#asm
mov eax,-1
int 0x40
#endasm
}
/*
s_get_event()
s_get_key()
s_get_button()
s_begin_draw()
s_end_draw()
s_draw_window(x1,y1,w,h,c_area,c_grab,c_fram)
s_print_text(x,y,color,p_string)
s_draw_button(x1,y1,w,h,color,id)
s_quit()
*/
/*****************************/
void main()
{int event;
int button_id;
draw_window();
while(1)
{event=s_get_event();
switch(event)
{case 1: draw_window(); break;
case 2: s_get_button(); break;
case 3: button_id=s_get_button();
if(button_id==1) s_quit();
break;
}
}
}
char text1[50]="THIS IS AN EXAMPLE PROGRAM YOU COULD";
char text2[50]="SYSTEM FUNCTIONS ARE IN FILE SYSFUNCS.TXT";
char text3[50]="";
char text4[50]="SUCCESS";
int p_text[4];
draw_window()
{int i; /* for index */
int y;y=25;
p_text[0]=&text1[0];
p_text[1]=&text2[0];
p_text[2]=&text3[0];
p_text[3]=&text4[0];
s_begin_draw();
s_draw_window(100,100,300,120,0x02ffffff,0x805080d0,0x005080d0);
s_print_text(8,8,0x10ddeeff,"Example application");
s_draw_button(300-19,5,12,12,0x6688dd,1);
for(i=0;i<4;i++)
s_print_text(20,y+=10,0x000000,p_text[i]);
s_end_draw();
}
#asm
I_END:
#endasm
к нему нужен INTRINS.ASM и всё нормально компилимруется.
Я собрался переписать все сисколы Kolibri (благо доки есть) в kolibri.h, но Ccomp не работает с #include пишет open error