diff --git a/contrib/other/8086tiny/8086tiny.c b/contrib/other/8086tiny/8086tiny.c index 1e709e8525..3fd70a46e0 100644 --- a/contrib/other/8086tiny/8086tiny.c +++ b/contrib/other/8086tiny/8086tiny.c @@ -24,16 +24,16 @@ static int ftime(struct timeb* tp) return 0; } - +/* #include - +*/ #ifndef _WIN32 #include #include #endif #ifndef NO_GRAPHICS -#include +#include #endif // Emulator system constants @@ -276,15 +276,15 @@ void audio_callback(void *data, unsigned char *stream, int len) } #endif -#define printf con_printf -#define gets con_gets -#undef main -#include "console.c" +#include +#define kbhit con_kbhit +#define getch con_getch // Emulator entry point int main(int argc, char **argv) { - CONSOLE_INIT("8086"); + load_console(); + con_set_title("8086tiny"); //freopen("OUT", "w" ,stdout); #ifndef NO_GRAPHICS @@ -695,7 +695,7 @@ int main(int argc, char **argv) { OPCODE_CHAIN 0: // PUTCHAR_AL write(1, regs8, 1); - printf("%c", regs8[0]); + // printf("%c", regs8[0]); OPCODE 1: // GET_RTC time(&clock_buf); ftime(&ms_clock); diff --git a/contrib/other/8086tiny/Tupfile.lua b/contrib/other/8086tiny/Tupfile.lua index 2ef85fee15..69db789abc 100644 --- a/contrib/other/8086tiny/Tupfile.lua +++ b/contrib/other/8086tiny/Tupfile.lua @@ -5,8 +5,8 @@ then HELPERDIR = "../../../programs" end tup.include(HELPERDIR .. "/use_gcc.lua") -tup.include(HELPERDIR .. "/use_menuetlibc.lua") -tup.include(HELPERDIR .. "/use_sdl.lua") +tup.include(HELPERDIR .. "/use_newlib.lua") +tup.include(HELPERDIR .. "/use_sdl_newlib.lua") CFLAGS = CFLAGS_OPTIMIZE_SPEED .. " -std=c99 -U_WIN32 -fwhole-program" compile_gcc{"8086tiny.c"} link_gcc("8086tiny") diff --git a/contrib/other/8086tiny/console.c b/contrib/other/8086tiny/console.c deleted file mode 100644 index 2ece619ba5..0000000000 --- a/contrib/other/8086tiny/console.c +++ /dev/null @@ -1,150 +0,0 @@ -#include - - -///=========================== - -#define CON_COLOR_BLUE 1 -#define CON_COLOR_GREEN 2 -#define CON_COLOR_RED 4 -#define CON_COLOR_BRIGHT 8 -/* цвет фона */ -#define CON_BGR_BLUE 0x10 -#define CON_BGR_GREEN 0x20 -#define CON_BGR_RED 0x40 -#define CON_BGR_BRIGHT 0x80 - -///=========================== -#define _stdcall __attribute__((stdcall)) -#define __stdcall __attribute__((stdcall)) -#define _cdecl __attribute__((cdecl)) -#define __cdecl __attribute__((cdecl)) - - - - - -void (* _stdcall con_init)(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t); -void (* _cdecl printf)(const char* format,...); -void (* _stdcall _exit2)(char bCloseWindow); -void (* __stdcall gets)(char* str, int n); - int (* __stdcall getch)(void); - int (* __stdcall kbhit)(void); - int (* __stdcall con_get_font_height)(void); - int (* __stdcall con_set_cursor_height)(int new_height); -unsigned (*__stdcall con_get_flags)(void); -unsigned (*__stdcall con_set_flags)(unsigned new_flags); -void (*__stdcall con_cls)(void); - -typedef struct -{ -unsigned p00 __attribute__((packed)); -unsigned p04 __attribute__((packed)); -unsigned p08 __attribute__((packed)); -unsigned p12 __attribute__((packed)); -unsigned p16 __attribute__((packed)); -char p20 __attribute__((packed)); -char *p21 __attribute__((packed)); -} kol_struct70 __attribute__((packed)); - -typedef struct -{ -char *name __attribute__((packed)); -void *data __attribute__((packed)); -} kol_struct_import __attribute__((packed)); - -///=========================== - -void kol_exit() -{ -__asm ("int $0x40"::"a"(-1)); -} - -int kol_file_70(kol_struct70 *k) -{ -__asm ("int $0x40"::"a"(70), "b"(k)); -} - - - -void* kol_cofflib_procload (kol_struct_import *imp, char *name) -{ -int i; -for (i=0;;i++) - if ( NULL == ((imp+i) -> name)) - break; - else - if ( 0 == strcmp(name, (imp+i)->name) ) - return (imp+i)->data; -return NULL; -} - - - - -void CONSOLE_INIT(char title[]) -{ -kol_struct_import *imp; - -__menuet__debug_out ("console init"); -imp = __kolibri__cofflib_load("/sys/lib/console.obj"); -if (imp == NULL) - {__menuet__debug_out ("imp NULL"); kol_exit();} - -con_init = ( _stdcall void (*)(unsigned, unsigned, unsigned, unsigned, const char*)) - kol_cofflib_procload (imp, "con_init"); -if (con_init == NULL) - {__menuet__debug_out ("con init failed"); kol_exit();} - -printf = ( _cdecl void (*)(const char*,...)) - kol_cofflib_procload (imp, "con_printf"); -if (printf == NULL) - kol_exit(); - -_exit2 = ( _stdcall void (*)(char)) - kol_cofflib_procload (imp, "con_exit"); -if (_exit2 == NULL) - kol_exit(); - -gets = ( _stdcall void (*)(char*, int)) - kol_cofflib_procload (imp, "con_gets"); -if (gets == NULL) - kol_exit(); - -getch = ( _stdcall int (*)(void)) - kol_cofflib_procload (imp, "con_getch2"); -if (getch == NULL) - kol_exit(); - -kbhit = ( _stdcall int (*)(void)) - kol_cofflib_procload (imp, "con_kbhit"); -if (getch == NULL) - kol_exit(); - -con_get_font_height = ( _stdcall int (*)(void)) - kol_cofflib_procload (imp, "con_get_font_height"); -if (con_get_font_height == NULL) - kol_exit(); - -con_set_cursor_height = ( _stdcall int (*)(int)) - kol_cofflib_procload (imp, "con_set_cursor_height"); -if (con_set_cursor_height == NULL) - kol_exit(); - -con_get_flags = ( _stdcall unsigned (*)(void)) - kol_cofflib_procload (imp, "con_get_flags"); -if (con_get_flags == NULL) - kol_exit(); - -con_set_flags = ( _stdcall unsigned (*)(unsigned)) - kol_cofflib_procload (imp, "con_set_flags"); -if (con_set_flags == NULL) - kol_exit(); - -con_cls = ( _stdcall void (*)(void)) - kol_cofflib_procload (imp, "con_cls"); -if (con_cls == NULL) - kol_exit(); - -__menuet__debug_out ("success"); -con_init(-1, -1, -1, -1, title); -}