Add example
git-svn-id: svn://kolibrios.org@8144 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
22c8fa4272
commit
d45967888e
18
programs/bcc32/examples/window/Makefile
Executable file
18
programs/bcc32/examples/window/Makefile
Executable file
@ -0,0 +1,18 @@
|
||||
SVN_BCC32:=../..
|
||||
T2FASM:=$(SVN_BCC32)/t2fasm
|
||||
INCLUDE:=$(SVN_BCC32)/include
|
||||
|
||||
# Path to Bin folder
|
||||
KOS32_BCC:=/home/autobuild/borlandcpp/bin
|
||||
|
||||
# Filename
|
||||
FN:=hello
|
||||
|
||||
hello_world:
|
||||
wine $(KOS32_BCC)/kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I$(INCLUDE) $(FN).cpp
|
||||
echo 'include "kos_make.inc"' > f_$(FN).asm
|
||||
$(T2FASM)/t2fasm < $(FN).asm >> f_$(FN).asm
|
||||
fasm f_$(FN).asm $(FN).kex
|
||||
|
||||
rm f_$(FN).asm
|
||||
rm $(FN).asm
|
38
programs/bcc32/examples/window/hello.cpp
Executable file
38
programs/bcc32/examples/window/hello.cpp
Executable file
@ -0,0 +1,38 @@
|
||||
#include <kolibri.h>
|
||||
#include <kos_heap.h>
|
||||
#include <kos_file.h>
|
||||
|
||||
using namespace Kolibri;
|
||||
|
||||
const char header[] = "Title";
|
||||
const char string[] = "Text";
|
||||
|
||||
bool KolibriOnStart(TStartData &kos_start, TThreadData th)
|
||||
{
|
||||
kos_start.Left = 10;
|
||||
kos_start.Top = 40;
|
||||
kos_start.Width = 150;
|
||||
kos_start.Height = 80;
|
||||
kos_start.WinData.WindowColor = 0xFFFFFF;
|
||||
kos_start.WinData.Title = header;
|
||||
return true;
|
||||
}
|
||||
|
||||
void KolibriOnPaint(void)
|
||||
{
|
||||
DrawText(10, 10, 0, string);
|
||||
}
|
||||
bool KolibriOnClose(TThreadData th)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int KolibriOnIdle(TThreadData th)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
void KolibriOnSize(int window_rect[], TThreadData th) {}
|
||||
void KolibriOnKeyPress(TThreadData th)
|
||||
{
|
||||
GetKey();
|
||||
}
|
||||
void KolibriOnMouse(TThreadData th) {}
|
6
programs/bcc32/examples/window/hello_cpp.bat
Executable file
6
programs/bcc32/examples/window/hello_cpp.bat
Executable file
@ -0,0 +1,6 @@
|
||||
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -Iinclude hello.cpp
|
||||
echo include "kos_make.inc" > f_hello.asm
|
||||
t2fasm < hello.asm >> f_hello.asm
|
||||
fasm f_hello.asm hello.kex
|
||||
kpack hello.kex
|
||||
pause
|
7
programs/bcc32/examples/window/kos_make.inc
Executable file
7
programs/bcc32/examples/window/kos_make.inc
Executable file
@ -0,0 +1,7 @@
|
||||
STACKSIZE equ 102400
|
||||
HEAPSIZE equ 102400
|
||||
|
||||
include "..\..\..\proc32.inc"
|
||||
include "..\..\include\kos_start.inc"
|
||||
include "..\..\include\kos_func.inc"
|
||||
include "..\..\include\kos_heap.inc"
|
4
programs/bcc32/patch/Makefile
Executable file
4
programs/bcc32/patch/Makefile
Executable file
@ -0,0 +1,4 @@
|
||||
# For success compiling, you should put bcc32.exe here
|
||||
kos32-bcc:
|
||||
fasm kos32-bcc.asm kos32-bcc.exe
|
||||
# Move to BCC 5.5.1 folder
|
8
programs/bcc32/patch/compile.txt
Executable file
8
programs/bcc32/patch/compile.txt
Executable file
@ -0,0 +1,8 @@
|
||||
В файле kos32-bcc.asm находится патч для компилятора Borland C++ 5.5.1.
|
||||
После применения данного патча компилятор в режиме компиляции с опцией '-S'
|
||||
выдает *.asm файлы с синтаксисом более похожим на ассемблер fasm.
|
||||
|
||||
Применение:
|
||||
fasm kos32-bcc.asm kos32-bcc.exe
|
||||
|
||||
bcc32.exe должен лежать рядом с kos32-bcc.asm
|
27
programs/bcc32/patch/kos32-bcc.asm
Executable file
27
programs/bcc32/patch/kos32-bcc.asm
Executable file
@ -0,0 +1,27 @@
|
||||
; patch for new fasm
|
||||
use32
|
||||
|
||||
file 'bcc32.exe':0,0x4a8f
|
||||
dd 0x90909090,0x90909090 ;fix end proc
|
||||
db 0xb8
|
||||
dd 0x4a626b
|
||||
|
||||
file 'bcc32.exe':0x4a9c,0x5753-0x4a9c
|
||||
dd 0x4b2472 ;fix label byte
|
||||
file 'bcc32.exe':0x5757,0x575a-0x5757
|
||||
dd 0x4b2472 ;fix proc near
|
||||
file 'bcc32.exe':0x575e,0x5761-0x575e
|
||||
dd 0x4b2472 ;fix label word
|
||||
file 'bcc32.exe':0x5765,0x5768-0x5765
|
||||
dd 0x4b2472 ;fix label dword
|
||||
file 'bcc32.exe':0x576c,0x576f-0x576c
|
||||
dd 0x4b2472 ;fix label qword
|
||||
file 'bcc32.exe':0x5773,0x5776-0x5773
|
||||
dd 0x4b2472 ;fix label tbyte
|
||||
|
||||
file 'bcc32.exe':0x577a,0x56216-0x577a
|
||||
db '_' ;fix '$' to '_'
|
||||
file 'bcc32.exe':0x56217,0xd4400-0x56217
|
||||
|
||||
;0x4b2472 - ':',13,10,0
|
||||
;0x4a626b - 13,10,0
|
Loading…
Reference in New Issue
Block a user