From 7481a0ec95fc820139f58ca165ee5f1b7dadef7d Mon Sep 17 00:00:00 2001 From: maxcodehack Date: Sat, 9 Jan 2021 09:20:28 +0000 Subject: [PATCH] TinyGL: newlib Gears: newlib git-svn-id: svn://kolibrios.org@8528 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/demos/cubeline/trunk/Tupfile.lua | 7 --- programs/demos/cubetext/trunk/Tupfile.lua | 7 --- programs/demos/gears/trunk/Makefile | 15 ------- programs/demos/gears/trunk/ProcessTab.h | 24 ---------- programs/demos/gears/trunk/Tupfile.lua | 6 ++- programs/demos/gears/trunk/main.cpp | 44 +++++++++++++------ .../develop/libraries/TinyGL/src/Tupfile.lua | 2 +- 7 files changed, 36 insertions(+), 69 deletions(-) delete mode 100644 programs/demos/cubeline/trunk/Tupfile.lua delete mode 100644 programs/demos/cubetext/trunk/Tupfile.lua delete mode 100644 programs/demos/gears/trunk/Makefile diff --git a/programs/demos/cubeline/trunk/Tupfile.lua b/programs/demos/cubeline/trunk/Tupfile.lua deleted file mode 100644 index ed7c0f993c..0000000000 --- a/programs/demos/cubeline/trunk/Tupfile.lua +++ /dev/null @@ -1,7 +0,0 @@ -if tup.getconfig("NO_GCC") ~= "" then return end -HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") -tup.include(HELPERDIR .. "/use_gcc.lua") -tup.include(HELPERDIR .. "/use_menuetlibc.lua") -tup.include(HELPERDIR .. "/use_tinygl.lua") -compile_gcc{"main.cpp", "fps.cpp"} -link_gcc("cubeline") diff --git a/programs/demos/cubetext/trunk/Tupfile.lua b/programs/demos/cubetext/trunk/Tupfile.lua deleted file mode 100644 index b4de324565..0000000000 --- a/programs/demos/cubetext/trunk/Tupfile.lua +++ /dev/null @@ -1,7 +0,0 @@ -if tup.getconfig("NO_GCC") ~= "" then return end -HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") -tup.include(HELPERDIR .. "/use_gcc.lua") -tup.include(HELPERDIR .. "/use_menuetlibc.lua") -tup.include(HELPERDIR .. "/use_tinygl.lua") -compile_gcc{"*.cpp"} -link_gcc("cubetext") diff --git a/programs/demos/gears/trunk/Makefile b/programs/demos/gears/trunk/Makefile deleted file mode 100644 index 24ff09664f..0000000000 --- a/programs/demos/gears/trunk/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -OUTFILE = gears - -SRCS = main.cpp fps.cpp - -OBJS = $(SRCS:.cpp=.o) - -CPPFLAGS = -I$(TINYGL)\include -O2 - -LIBR = TinyGL m -LIBS = $(addprefix -l,$(LIBR)) -L$(TINYGL)\lib - -all: $(OUTFILE) - objcopy $(OUTFILE) -O binary - -include $(MENUETDEV)/makefiles/Makefile_for_cpp_program diff --git a/programs/demos/gears/trunk/ProcessTab.h b/programs/demos/gears/trunk/ProcessTab.h index 104e607f92..dd5e94f433 100644 --- a/programs/demos/gears/trunk/ProcessTab.h +++ b/programs/demos/gears/trunk/ProcessTab.h @@ -1,26 +1,2 @@ - -#pragma pack(push, 1) -struct process_table_entry_ -{ - __u32 cpu_usage; - __u16 pos_in_windowing_stack; - __u16 win_stack_val_at_ecx; - __u16 rez1; - char name[11]; - __u8 rez2; - __u32 memstart; - __u32 memused; - __u32 pid; - __u32 winx_start,winy_start; - __u32 winx_size,winy_size; - __u8 slot; - __u8 rez3; - __u32 clarx_start,clary_start; - __u32 clarx_size,clary_size; - __u8 win_condition; - __u8 buf[955]; -}; -#pragma pack(pop) - #define TYPEWIN(D,C,B,A,Y,RR,GG,BB) (D<<31)|(C<<30)|(B<<29)|(A<<28)|(Y<<24)|\ (RR<<16)|(GG<<8)|BB diff --git a/programs/demos/gears/trunk/Tupfile.lua b/programs/demos/gears/trunk/Tupfile.lua index 9113f3762c..992055a01a 100644 --- a/programs/demos/gears/trunk/Tupfile.lua +++ b/programs/demos/gears/trunk/Tupfile.lua @@ -1,7 +1,11 @@ if tup.getconfig("NO_GCC") ~= "" then return end HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR") tup.include(HELPERDIR .. "/use_gcc.lua") -tup.include(HELPERDIR .. "/use_menuetlibc.lua") +tup.include(HELPERDIR .. "/use_newlib.lua") tup.include(HELPERDIR .. "/use_tinygl.lua") + +LIBS = "-lstdc++ -lsupc++ " .. LIBS +LDFLAGS = LDFLAGS .. " --subsystem native" + compile_gcc{"fps.cpp", "main.cpp"} link_gcc("gears") diff --git a/programs/demos/gears/trunk/main.cpp b/programs/demos/gears/trunk/main.cpp index 093e2d23a0..499aed12dc 100644 --- a/programs/demos/gears/trunk/main.cpp +++ b/programs/demos/gears/trunk/main.cpp @@ -12,7 +12,7 @@ iadn@bk.ru * Brian Paul */ -#include +#include #include //TinyGL #include #include @@ -41,7 +41,7 @@ char *fps = "FPS:"; unsigned char FullScreen = 0; unsigned char skin = 3; -process_table_entry_* pri; +proc_info* pri; KOSGLContext cgl; static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0; @@ -219,11 +219,11 @@ void init( void ) void reshape() { - __menuet__get_process_table((process_table_entry*)pri,-1); - glViewport(0, 0, pri->winx_size, pri->winy_size-20); + get_proc_info((char*)pri); + glViewport(0, 0, pri->width, pri->height-20); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(45.0, (GLfloat)pri->winx_size/pri->winy_size, 1.0, 60.0); + gluPerspective(45.0, (GLfloat)pri->width/pri->height, 1.0, 60.0); glTranslatef( 0.0, 0.0, 20.0 ); glMatrixMode(GL_MODELVIEW); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); @@ -235,26 +235,42 @@ void disabletgl() delete pri; } +void kos_text(int x, int y, int color, const char* text, int len) +{ + asm volatile ("int $0x40"::"a"(4),"b"((x<<16) | y),"c"(color),"d"((unsigned long)text),"S"(len)); +}; + void Title() { - __menuet__write_text(300,8,0x10ffffff,fps,strlen(fps)); - __menuet__write_text(8,8,0x10ffffff,title1,strlen(title1)); - __menuet__write_text(180,8,0x00ffffff,title2,strlen(title2)); - __menuet__write_text(600,8,0x00ffffff,title3,strlen(title3)); + kos_text(300,8,0x10ffffff,fps,strlen(fps)); + kos_text(180,8,0x00ffffff,title2,strlen(title2)); + kos_text(600,8,0x00ffffff,title3,strlen(title3)); +} + +void kol_wnd_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned cs, unsigned b, char *t) +{ +asm volatile ("int $0x40"::"a"(0), "b"(x*65536+w), "c"(y*65536+h), "d"(cs), "D"(t), "S"(b) ); } void draw_window(void) { // start redraw - __menuet__window_redraw(1); + begin_draw(); // define&draw window - __menuet__define_window(win.x,win.y,win.dx,win.dy,TYPEWIN(0,0,0,1,skin,0,0,0),0,0); + kol_wnd_define(win.x,win.y,win.dx,win.dy,TYPEWIN(0,0,0,1,skin,0,0,0),0,title1); // end redraw - __menuet__window_redraw(2); + end_draw(); // display string Title(); } +int kos_get_key() +{ + unsigned short __ret; + asm volatile("int $0x40":"=a"(__ret):"0"(2)); + if(!(__ret & 0xFF)) return (__ret>>8)&0xFF; else return 0; +} + int main(void) { @@ -270,7 +286,7 @@ int main(void) init(); - pri=new process_table_entry_; + pri = new proc_info; SysCall(66,1,1); reshape(); @@ -315,7 +331,7 @@ do{ break; case 2: - switch(__menuet__getkey()){ + switch(kos_get_key()){ case KEY_F: if(!FullScreen){ diff --git a/programs/develop/libraries/TinyGL/src/Tupfile.lua b/programs/develop/libraries/TinyGL/src/Tupfile.lua index 3e2f3a032a..790bc9418b 100644 --- a/programs/develop/libraries/TinyGL/src/Tupfile.lua +++ b/programs/develop/libraries/TinyGL/src/Tupfile.lua @@ -1,7 +1,7 @@ if tup.getconfig("NO_GCC") ~= "" then return end HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR") tup.include(HELPERDIR .. "/use_gcc.lua") -tup.include(HELPERDIR .. "/use_menuetlibc.lua") +tup.include(HELPERDIR .. "/use_newlib.lua") INCLUDES = INCLUDES .. " -I../include" compile_gcc("*.c") tup.rule(OBJS, "kos32-ar rcs %o %f", {"../lib/libTinyGL.a", "../<>"})