/programs/develop/ktcc/trunk/libc/mesys/draw_bar.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/event.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/pixel.asm |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mesys/midi.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/draw_window.asm |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mesys/line.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/sound.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/backgr.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/irq.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/clock.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/dga.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/debug_board.asm |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mesys/delay.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/debug_board_.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mesys/write_text.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/draw_image.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/keyboard.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/cofflib.asm |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mesys/thread.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/_ksys_files_acces.asm |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mesys/exit.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/pci.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/button.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/ipc.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/window_redraw.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/date.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/process.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys/screen.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/mesys |
---|
Property changes: |
Deleted: svn:ignore |
-*.o |
-*.s |
/programs/develop/ktcc/trunk/libc/file/ungetc.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/file/fflush.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/rewind.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fgetc.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fseek.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fscanf.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/file/fwrite.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/ftell.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fopen.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/file/fgetpos.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fprintf.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/file/fclose.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/feof.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fputc.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/file/fread.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file/fsetpos.c |
---|
File deleted |
\ No newline at end of file |
/programs/develop/ktcc/trunk/libc/file |
---|
Property changes: |
Deleted: svn:ignore |
-*.o |
-*.s |
/programs/develop/ktcc/trunk/libc/mem/memalloc.asm |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/mem |
---|
Property changes: |
Deleted: svn:ignore |
-*.o |
-*.s |
/programs/develop/ktcc/trunk/libc/build.bat |
---|
4,13 → 4,13 |
echo # usage: build [clean] # |
echo #################################################### |
rem #### CONFIG SECTION #### |
set LIBNAME=melibc.a |
set LIBNAME=libck.a |
set INCLUDE=include |
set CC=gcc |
set CC= |
set CFLAGS=-c -nostdinc -DGNUC -I"%cd%\%INCLUDE%" |
set AR=ar |
set ASM=fasm |
set dirs=file mem mesys string |
set AR= |
set ASM= |
set dirs=stdio memory kolibrisys string stdlib |
rem #### END OF CONFIG SECTION #### |
set objs= |
/programs/develop/ktcc/trunk/libc/include/mesys.h |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/include/ctype.h |
---|
29,3 → 29,7 |
#define isspace(c)(_is[c] & BLANK ) /* HT, LF, VT, FF, CR, ' ' */ |
#define isupper(c)(_is[c] & UPPER ) /* 'A'-'Z' */ |
#define isxdigit(c)(_is[c] & XDIGIT) /* '0'-'9', 'a'-'f', 'A'-'F' */ |
#define isascii(c) (!((c)&(~0x7f))) |
#define toascii(c) ((c)&0x7f) |
/programs/develop/ktcc/trunk/libc/include/kolibrisys.h |
---|
0,0 → 1,195 |
#ifndef kolibrisys_h |
#define kolibrisys_h |
/* |
#ifdef GNUC |
#define stdcall __stdcall |
#define cdecl __cdecl |
#else |
#define stdcall ((__stdcall)) |
#define cdecl ((__cdecl)) |
#endif |
*/ |
//#ifdef GNUC |
//#define stdcall __stdcall |
//#else |
#define cdecl __attribute__ ((cdecl)) |
#define stdcall __attribute__ ((stdcall)) |
//#endif |
typedef unsigned int dword; |
typedef unsigned char byte; |
typedef unsigned short word; |
typedef unsigned int fpos_t; |
typedef unsigned int size_t; |
typedef struct process_table_entry{ |
int cpu_usage; //+0 |
int window_pos_info; //+4 |
short int reserved1; //+8 |
char name[12]; //+10 |
int memstart; //+22 |
int memused; //+26 |
int pid; //+30 |
int winx_start; //+34 |
int winy_start; //+38 |
int winx_size; //+42 |
int winy_size; //+46 |
short int slot_info; //+50 |
short int reserved2; //+52 |
int clientx; //+54 |
int clienty; //+58 |
int clientwidth; //+62 |
int clientheight; //+66 |
unsigned char window_state;//+70 |
char reserved3[1024-71]; //+71 |
}__attribute__((packed)); |
//----------------------------------------------------------------------------------- |
//------------------------KolibriOS system acces to files---------------------------- |
//----------------------------------------------------------------------------------- |
extern dword stdcall _ksys_get_filesize(char *filename); |
extern dword stdcall _ksys_readfile(char *filename,dword pos,dword blocksize,void *data); |
extern dword stdcall _ksys_rewritefile(char *filename,dword blocksize,void *data); |
extern dword stdcall _ksys_appendtofile(char *filename,dword pos,dword blocksize,void *data); |
//----------------------------------------------------------------------------------- |
//----------------------Run program--------------------------------------------------- |
extern void stdcall _ksys_run_program(char* filename,char* parameters); |
//------------------------------------------------------------------------------------ |
//--------------------Debug output--------------------------------------------------- |
extern void stdcall _ksys_debug_out(int c); |
extern void stdcall debug_out_str(char* str); |
//----------------------------------------------------------------------------------- |
//--------------------------Mouse state---------------------------------------------- |
extern int stdcall _ksys_GetMouseXY(void); |
extern int stdcall _ksys_GetMouseButtonsState(void); |
//----------------------------------------------------------------------------------- |
//--------------------------get skin height------------------------------------------ |
extern int stdcall _ksys_get_skin_height(void); |
//----------------------------------------------------------------------------------- |
//----------------------------background--------------------------------------------- |
extern void stdcall _ksys_set_background_size(int xsize,int ysize); |
extern void stdcall _ksys_write_background_mem(int pos,int color); |
extern void stdcall _ksys_draw_background(void); |
extern void stdcall _ksys_set_background_draw_type(int type); |
extern void stdcall _ksys_background_blockmove(void* src,int bgr_pos, int count); |
//----------------------------------------------------------------------------------- |
//----------------------------functionf for draw window,lines.bar,etc.--------------- |
extern void stdcall _ksys_draw_window(int xcoord,int ycoord, int xsize, |
int ysize,int workcolor,int type, |
int captioncolor,int windowtype,int bordercolor); |
extern void stdcall _ksys_window_redraw(int status); |
extern int stdcall _ksys_putpixel(int x,int y,int color); |
extern void stdcall _ksys_draw_bar(int x, int y, int xsize, int ysize, int color); |
extern void stdcall _ksys_line(int x1,int y1,int x2,int y2,int color); |
extern void stdcall _ksys_putimage(int x, int y, int xsize, int ysize, void* image); |
//----------------------------------------------------------------------------------- |
//--------------------------write text(system fonts 6x9)----------------------------- |
extern void stdcall _ksys_write_text(int x,int y,int color,char* text,int len); |
//----------------------------------------------------------------------------------- |
//------------------ get screen size and bytes per pixel--------------------------- |
extern int stdcall _ksys_get_screen_size(int* x,int* y); |
extern void stdcall _ksys_dga_get_resolution(int* xres, int* yres, int* bpp, int* bpscan); |
//----------------------------------------------------------------------------------- |
//-------------------------------craete thread--------------------------------------- |
extern void* stdcall _ksys_start_thread(void (* func_ptr)(void),int stack_size,int* pid); |
//----------------------------------------------------------------------------------- |
//------------------system button(Old function. Better use libGUI functions.)-------- |
extern void stdcall _ksys_make_button(int x, int y, int xsize, int ysize, int id, int color); |
extern int stdcall _ksys_get_button_id(void); //get state of system button |
//------------------------------------------------------------------------------------ |
//----------------------system clock(in 1/100 sec.) and date-------------------------- |
extern int stdcall _ksys_get_system_clock(void); |
extern int stdcall _ksys_get_date(void); |
//------------------------------------------------------------------------------------ |
//-------------------------system delay(in 1/100 sec.)------------------------------- |
extern void stdcall _ksys_delay(int m); |
//----------------------------------------------------------------------------------- |
//------------------------system events---------------------------------------------- |
extern int stdcall _ksys_wait_for_event_infinite(void); |
extern int stdcall _ksys_check_for_event(void); |
extern int stdcall _ksys_wait_for_event(int time); |
extern void stdcall _ksys_set_wanted_events(int ev); |
//----------------------------------------------------------------------------------- |
//----------------------------system exit program------------------------------------ |
extern void stdcall _ksys_exit(void); |
//----------------------------------------------------------------------------------- |
//-----------------------------system IPC send message------------------------------- |
extern void stdcall _ksys_send_message(int pid, void* msg, int size); |
//----------------------------------------------------------------------------------- |
//---------------------------system work with IRQ from user mode--------------------- |
extern void stdcall _ksys_define_receive_area(void* area, int size); |
extern int stdcall _ksys_get_irq_owner(int irq); |
extern int stdcall _ksys_get_data_read_by_irq(int irq, int* size, void* data); |
extern int stdcall _ksys_send_data_to_device(int port, unsigned char val); |
extern int stdcall _ksys_receive_data_from_device(int port,unsigned char* data); |
extern void stdcall _ksys_program_irq(void* intrtable, int irq); |
extern void stdcall _ksys_reserve_irq(int irq); |
extern void stdcall _ksys_free_irq(int irq); |
//---------------------------------------------------------------------------------- |
//----------------------------system reserve diapason of ports---------------------- |
extern int stdcall _ksys_reserve_port_area(int start,int end); |
extern int stdcall _ksys_free_port_area(int start,int end); |
//---------------------------------------------------------------------------------- |
//-------------functions get key and set keyboard mode------------------------------ |
extern int stdcall _ksys_get_key(void); |
extern void stdcall _ksys_set_keyboard_mode(int mode); |
//---------------------------------------------------------------------------------- |
//--------------simple work with MPU401 sound device--------------------------------- |
extern void stdcall _ksys_midi_reset(void); |
extern void stdcall _ksys_midi_send(int data); |
//----------------------------------------------------------------------------------- |
//--------------------------acces to PCI BUS from user mode--------------------------- |
extern int stdcall _ksys_get_pci_version(void); |
extern int stdcall _ksys_get_last_pci_bus(void); |
extern int stdcall _ksys_get_pci_access_mechanism(void); |
extern int stdcall _ksys_pci_read_config_byte(int bus,int dev,int fn,int reg); |
extern int stdcall _ksys_pci_read_config_word(int bus,int dev,int fn,int reg); |
extern int stdcall _ksys_pci_read_config_dword(int bus,int dev,int fn,int reg); |
extern int stdcall _ksys_pci_write_config_byte(int bus,int dev,int fn,int reg,int value); |
extern int stdcall _ksys_pci_write_config_word(int bus,int dev,int fn,int reg,int value); |
extern int stdcall _ksys_pci_write_config_value(int bus,int dev,int fn,int reg,int value); |
//-------------------------------------------------------------------------------------- |
//------------------------Process information-------------------------------------- |
extern int stdcall _ksys_get_process_table(struct process_table_entry *proctab,int pid); //if pid=-1 than get info about him. |
//--------------------------------------------------------------------------------- |
//-----------------Old functions for work with sound(Sound Blaster only).--------- |
extern void stdcall _ksys_sound_load_block(void* blockptr); |
extern void stdcall _ksys_sound_play_block(void); |
extern void stdcall _ksys_sound_set_channels(int channels); |
extern void stdcall _ksys_sound_set_data_size(int size); |
extern void stdcall _ksys_sound_set_frequency(int frequency); |
//-------------------------------------------------------------------------------- |
//------------------------------system speaker(integrated speaker)---------------- |
extern void stdcall _ksys_sound_speaker_play(void* data); |
//-------------------------------------------------------------------------------- |
//------------------function for work with Dinamic Link Librarys(DLL)-------------- |
extern dword* stdcall _ksys_cofflib_load(char* name); |
extern char* stdcall _ksys_cofflib_getproc(void* exp,char* sz_name); |
//--------------------------------------------------------------------------------- |
#endif |
/programs/develop/ktcc/trunk/libc/include/math.h |
---|
0,0 → 1,179 |
/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ |
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ |
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ |
extern int stdcall integer(float number); |
extern double acos(double _x); |
extern double asin(double _x); |
extern double atan(double _x); |
extern double atan2(double _y, double _x); |
extern double ceil(double _x); |
extern double cos(double _x); |
extern double cosh(double _x); |
extern double exp(double _x); |
extern double fabs(double _x); |
extern double floor(double _x); |
extern double fmod(double _x, double _y); |
extern double frexp(double _x, int *_pexp); |
extern double ldexp(double _x, int _exp); |
extern double log(double _y); |
extern double log10(double _x); |
extern double modf(double _x, double *_pint); |
extern double pow(double _x, double _y); |
extern double sin(double _x); |
extern double sinh(double _x); |
extern double sqrt(double _x); |
extern double tan(double _x); |
extern double tanh(double _x); |
//#ifndef __STRICT_ANSI__ |
//#ifndef _POSIX_SOURCE |
#define M_E 2.7182818284590452354 |
#define M_LOG2E 1.4426950408889634074 |
#define M_LOG10E 0.43429448190325182765 |
#define M_LN2 0.69314718055994530942 |
#define M_LN10 2.30258509299404568402 |
#define M_PI 3.14159265358979323846 |
#define M_PI_2 1.57079632679489661923 |
#define M_PI_4 0.78539816339744830962 |
#define M_1_PI 0.31830988618379067154 |
#define M_2_PI 0.63661977236758134308 |
#define M_2_SQRTPI 1.12837916709551257390 |
#define M_SQRT2 1.41421356237309504880 |
#define M_SQRT1_2 0.70710678118654752440 |
#define PI M_PI |
#define PI2 M_PI_2 |
extern double acosh(double); |
extern double asinh(double); |
extern double atanh(double); |
extern double cbrt(double); |
extern double exp10(double _x); |
extern double exp2(double _x); |
extern double expm1(double); |
extern double hypot(double, double); |
extern double log1p(double); |
extern double log2(double _x); |
extern long double modfl(long double _x, long double *_pint); |
extern double pow10(double _x); |
extern double pow2(double _x); |
extern double powi(double, int); |
extern void sincos(double *, double *, double); |
/* These are in libm.a (Cygnus). You must link -lm to get these */ |
/* See libm/math.h for comments */ |
/* |
#ifndef __cplusplus |
struct exception { |
int type; |
const char *name; |
double arg1; |
double arg2; |
double retval; |
int err; |
}; |
#endif |
*/ |
extern double erf(double); |
extern double erfc(double); |
extern double gamma(double); |
extern int isinf(double); |
extern int isnan(double); |
extern int finite(double); |
extern double j0(double); |
extern double j1(double); |
extern double jn(int, double); |
extern double lgamma(double); |
extern double nan(void); |
extern double y0(double); |
extern double y1(double); |
extern double yn(int, double); |
extern double logb(double); |
extern double nextafter(double, double); |
extern double remainder(double, double); |
extern double scalb(double, double); |
//#ifndef __cplusplus |
//extern int matherr(struct exception *); |
//#endif |
extern double significand(double); |
extern double copysign(double, double); |
extern int ilogb(double); |
extern double rint(double); |
extern double scalbn(double, int); |
extern double drem(double, double); |
extern double gamma_r(double, int *); |
extern double lgamma_r(double, int *); |
extern float acosf(float); |
extern float asinf(float); |
extern float atanf(float); |
extern float atan2f(float, float); |
extern float cosf(float); |
extern float sinf(float); |
extern float tanf(float); |
extern float coshf(float); |
extern float sinhf(float); |
extern float tanhf(float); |
extern float expf(float); |
extern float frexpf(float, int *); |
extern float ldexpf(float, int); |
extern float logf(float); |
extern float log10f(float); |
extern float modff(float, float *); |
extern float powf(float, float); |
extern float sqrtf(float); |
extern float ceilf(float); |
extern float fabsf(float); |
extern float floorf(float); |
extern float fmodf(float, float); |
extern float erff(float); |
extern float erfcf(float); |
extern float gammaf(float); |
extern float hypotf(float, float); |
extern int isinff(float); |
extern int isnanf(float); |
extern int finitef(float); |
extern float j0f(float); |
extern float j1f(float); |
extern float jnf(int, float); |
extern float lgammaf(float); |
extern float nanf(void); |
extern float y0f(float); |
extern float y1f(float); |
extern float ynf(int, float); |
extern float acoshf(float); |
extern float asinhf(float); |
extern float atanhf(float); |
extern float cbrtf(float); |
extern float logbf(float); |
extern float nextafterf(float, float); |
extern float remainderf(float, float); |
extern float scalbf(float, float); |
extern float significandf(float); |
extern float copysignf(float, float); |
extern int ilogbf(float); |
extern float rintf(float); |
extern float scalbnf(float, int); |
extern float dremf(float, float); |
extern float expm1f(float); |
extern float log1pf(float); |
extern float gammaf_r(float, int *); |
extern float lgammaf_r(float, int *); |
//#endif /* !_POSIX_SOURCE */ |
//#endif /* !__STRICT_ANSI__ */ |
//#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ |
//#ifndef __dj_ENFORCE_FUNCTION_CALLS |
//#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ |
//#ifdef __cplusplus |
//} |
//#endif |
//#endif /* _USE_LIBM_MATH_H */ |
//#endif /* !__dj_include_math_h_ */ |
/programs/develop/ktcc/trunk/libc/include/stdio.h |
---|
1,7 → 1,17 |
#ifndef stdio_h |
#define stdio_h |
#include "mesys.h" |
#include "kolibrisys.h" |
typedef char *va_list; |
#define _roundsize(n) ( (sizeof(n) + 3) & ~3 ) |
#define va_start(ap,v) (ap = (va_list)&v+_roundsize(v)) |
#define va_arg(ap,t) ( *(t *)((ap += _roundsize(t)) - _roundsize(t)) ) |
#define va_end(ap) (ap = (va_list)0) |
#define NULL ((void*)0) |
//extern int stdcall format_print(char *dest, size_t maxlen, const char *fmt0, va_list argp); |
typedef struct { |
char* buffer; |
dword buffersize; |
10,6 → 20,7 |
char* filename; |
int mode; |
} FILE; |
#define FILE_OPEN_READ 0 |
#define FILE_OPEN_WRITE 1 |
#define FILE_OPEN_APPEND 2 |
16,12 → 27,12 |
#define FILE_OPEN_TEXT 4 |
#define FILE_OPEN_PLUS 8 |
#define EOF -1 |
extern FILE* fopen(const char* filename, const char *mode); |
extern void fclose(FILE* file); |
extern int feof(FILE* file); |
extern int fflush(FILE* file); |
extern int fgetc(FILE* file); |
typedef int fpos_t; |
extern int fgetpos(FILE* file,fpos_t* pos); |
extern int fsetpos(FILE* file,const fpos_t* pos); |
extern int fputc(int c,FILE* file); |
33,7 → 44,14 |
#define SEEK_SET 2 |
extern int fseek(FILE* file,long offset,int origin); |
extern void rewind(FILE* file); |
extern int fprintf(FILE* file, const char* format, ...); |
extern int cdecl fprintf(FILE* file, const char* format,...); |
extern int fscanf(FILE* file,const char* format, ...); |
extern int ungetc(int c,FILE* file); |
extern int cdecl printf(const char *format,...); |
extern int vsnprintf(char *dest, size_t size,const char *format,va_list ap); |
extern int cdecl snprintf(char *dest, size_t size, const char *format,...); |
extern int cdecl sprintf(char *dest,const char *format,...); |
#endif |
/programs/develop/ktcc/trunk/libc/include/stdlib.h |
---|
1,14 → 1,18 |
#include <mesys.h> |
#ifndef stdlib_h |
#define stdlib_h |
#include "kolibrisys.h" |
//#define isspace(c) ((c)==' ') |
#define abs(i) (((i)<0)?(-(i)):(i)) |
extern int atoib(char *s,int b); |
extern int atoi(char *s); |
extern char tolower(char c); |
extern char toupper(char c); |
extern unsigned char tolower(unsigned char c); |
extern unsigned char toupper(unsigned char c); |
extern void itoab(int n,char* s,int b); |
extern void itoa(int n,char* s); |
extern void* malloc(dword size); |
extern void free(void *pointer); |
extern void* realloc(void* pointer,dword size); |
extern void* stdcall malloc(dword size); |
extern void stdcall free(void *pointer); |
extern void* stdcall realloc(void* pointer,dword size); |
#endif |
/programs/develop/ktcc/trunk/libc/kolibrisys/_ksys_files_acces.asm |
---|
0,0 → 1,119 |
format ELF |
section '.text' executable |
include 'proc32.inc' |
public _ksys_get_filesize |
public _ksys_readfile |
public _ksys_rewritefile |
public _ksys_appendtofile |
align 4 |
proc _ksys_get_filesize stdcall, filename:dword |
xor eax,eax |
mov ebx,[filename] |
mov [fileinfo.subproc],dword 5 |
mov [fileinfo.offset_l],eax |
mov [fileinfo.offset_h],eax |
mov [fileinfo.size],eax |
mov [fileinfo.data],dword buffer_for_info |
mov [fileinfo.letter],al |
mov [fileinfo.filename],ebx |
mov eax,70 |
mov ebx,fileinfo |
int 0x40 |
test eax,eax |
jnz error_for_file_size |
mov eax,[buffer_for_info+32] ;file size |
error_for_file_size: |
ret |
endp |
align 4 |
proc _ksys_readfile stdcall,filename:dword,position:dword,sizeblock:dword,buffer:dword |
xor eax,eax |
mov ebx,[position] |
mov ecx,[sizeblock] |
mov edx,[buffer] |
mov esi,[filename] |
mov [fileinfo.subproc],eax |
mov [fileinfo.offset_l],ebx |
mov [fileinfo.offset_h],eax |
mov [fileinfo.size],ecx |
mov [fileinfo.data],edx |
mov [fileinfo.letter],al |
mov [fileinfo.filename],esi |
mov eax,70 |
mov ebx,fileinfo |
int 0x40 |
ret |
endp |
align 4 |
proc _ksys_rewritefile stdcall,filename:dword,sizeblock:dword,data_write:dword |
xor eax,eax |
mov ebx,[sizeblock] |
mov ecx,[data_write] |
mov edx,[filename] |
mov [fileinfo.subproc],dword 2 |
mov [fileinfo.offset_l],eax |
mov [fileinfo.offset_h],eax |
mov [fileinfo.size],ebx |
mov [fileinfo.data],ecx |
mov [fileinfo.letter],al |
mov [fileinfo.filename],edx |
mov eax,70 |
mov ebx,fileinfo |
int 0x40 |
ret |
endp |
align 4 |
proc _ksys_appendtofile stdcall,filename:dword,pos:dword,sizeblock:dword,data_append:dword |
xor eax,eax |
mov ebx,[pos] |
mov ecx,[sizeblock] |
mov edx,[data_append] |
mov esi,[filename] |
mov [fileinfo.subproc],dword 3 |
mov [fileinfo.offset_l],ebx |
mov [fileinfo.offset_h],eax |
mov [fileinfo.size],ecx |
mov [fileinfo.data],edx |
mov [fileinfo.letter],al |
mov [fileinfo.filename],esi |
mov eax,70 |
mov ebx,fileinfo |
int 0x40 |
ret |
endp |
struc FILEIO |
{ |
.subproc rd 1 |
.offset_l rd 1 |
.offset_h rd 1 |
.size rd 1 |
.data rd 1 |
.letter rb 1 |
.filename rd 1 |
} |
fileinfo FILEIO |
buffer_for_info rd 11 |
/programs/develop/ktcc/trunk/libc/kolibrisys/backgr.asm |
---|
0,0 → 1,54 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_set_background_size,8 |
;arg1 - xsize |
;arg2 - ysize |
push ebx |
mov ecx,[esp+8] |
mov edx,[esp+12] |
mov eax,15 |
mov ebx,1 |
int 0x40 |
pop ebx |
ret 8 |
public_stdcall _ksys_write_background_mem,8 |
;arg1 - pos |
;arg2 - color |
push ebx |
mov eax,15 |
mov ebx,2 |
mov ecx,[esp+8] |
mov edx,[esp+12] |
int 0x40 |
pop ebx |
ret 8 |
public_stdcall _ksys_draw_background,0 |
mov edx,ebx |
mov eax,15 |
mov ebx,3 |
int 0x40 |
mov ebx,edx |
ret |
public_stdcall _ksys_set_background_draw_type,4 |
;arg1 - type |
mov edx,ebx |
mov eax,15 |
mov ebx,4 |
mov ecx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
public_stdcall _ksys_background_blockmove,12 |
;arg1 - source |
;arg2 - position in dest |
;arg3 - size |
push ebx esi |
mov eax,15 |
mov ebx,5 |
mov ecx,[esp+12] |
mov edx,[esp+16] |
mov esi,[esp+20] |
int 0x40 |
pop esi ebx |
ret 12 |
/programs/develop/ktcc/trunk/libc/kolibrisys/button.asm |
---|
0,0 → 1,35 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_make_button,24 |
;arg1 - x |
;arg2 - y |
;arg3 - xsize |
;arg4 - ysize |
;arg5 - id |
;arg6 - color |
push ebx esi |
mov ebx,[esp+12] |
shl ebx,16 |
mov bx,[esp+20] |
mov ecx,[esp+16] |
shl ecx,16 |
mov cx,[esp+24] |
mov edx,[esp+28] |
mov esi,[esp+32] |
mov eax,8 |
int 0x40 |
pop esi ebx |
ret 24 |
public_stdcall _ksys_get_button_id,0 |
mov eax,17 |
int 0x40 |
test al,al |
jnz .no_button |
shr eax,8 |
ret |
.no_button: |
xor eax,eax |
dec eax |
ret |
/programs/develop/ktcc/trunk/libc/kolibrisys/clock.asm |
---|
0,0 → 1,15 |
format ELF |
include "proc32.inc" |
section '.text' executable |
public _ksys_get_system_clock |
align 4 |
proc _ksys_get_system_clock stdcall |
mov eax,3 |
int 0x40 |
ret |
endp |
/programs/develop/ktcc/trunk/libc/kolibrisys/cofflib.asm |
---|
0,0 → 1,73 |
format ELF |
include 'proc32.inc' |
section '.text' executable |
public _ksys_cofflib_load |
public _ksys_cofflib_getproc |
proc _ksys_cofflib_load stdcall, name:dword |
mov eax, 68 |
mov ebx, 19 |
mov ecx, [name] |
int 0x40 |
ret |
endp |
proc _ksys_cofflib_getproc stdcall, export:dword,name:dword |
mov ebx,[export] |
next_name_check: |
mov ecx,[ebx] |
test ecx,ecx |
jz end_export |
;cmp export string with name |
mov esi,[name] |
xor edi,edi |
next_simbol_check: |
xor eax,eax |
mov al,[ecx] |
test al,al |
jz exit_check_simbol |
xor edx,edx |
mov dl,[esi] |
cmp al,dl |
je simbols_equvalent |
add edi,1 |
jmp exit_check_simbol |
simbols_equvalent: |
;pushad |
;mov cl,al |
;mov ebx,1 |
;mov eax,63 |
;int 0x40 |
;popad |
add ecx,1 |
add esi,1 |
jmp next_simbol_check |
exit_check_simbol: |
test edi,edi |
jnz function_not_finded |
mov eax,[ebx+4] |
jmp end_export |
function_not_finded: |
add ebx,8 |
jmp next_name_check |
end_export: |
ret |
endp |
/programs/develop/ktcc/trunk/libc/kolibrisys/date.asm |
---|
0,0 → 1,7 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_get_date,0 |
mov eax,29 |
int 0x40 |
ret |
/programs/develop/ktcc/trunk/libc/kolibrisys/debug_board.asm |
---|
0,0 → 1,56 |
format ELF |
include "proc32.inc" |
section '.text' executable |
public _ksys_debug_out |
public debug_out_str |
align 4 |
proc _ksys_debug_out stdcall, c:dword |
pushad |
xor ecx,ecx |
mov cl,byte[c] |
mov ebx,1 |
mov eax,63 |
int 0x40 |
popad |
ret |
endp |
align 4 |
proc debug_out_str stdcall, s:dword |
pushad |
mov eax,[s] ;eax=pointer to string |
next_simbol_print: |
xor ebx,ebx |
mov bl,[eax] |
test bl,bl |
jz exit_print_str |
cmp bl,10 |
jne no_new_line |
mov ecx,13 |
stdcall _ksys_debug_out, ecx |
no_new_line: |
stdcall _ksys_debug_out, ebx |
add eax,1 |
jmp next_simbol_print |
exit_print_str: |
popad |
ret |
endp |
/programs/develop/ktcc/trunk/libc/kolibrisys/delay.asm |
---|
0,0 → 1,11 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_delay,4 |
;arg1 - time |
mov edx,ebx |
mov eax,5 |
mov ebx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
/programs/develop/ktcc/trunk/libc/kolibrisys/dga.asm |
---|
0,0 → 1,34 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_dga_get_resolution,16 |
;arg1 - *xres |
;arg2 - *yres |
;arg3 - *bpp |
;arg4 - *bpscan |
mov edx,ebx |
mov eax,61 |
mov ebx,1 |
int 0x40 |
mov ebx,[esp+8] |
mov [ebx],ax |
mov word [ebx+2],0 |
shr eax,16 |
mov ebx,[esp+4] |
mov [ebx],eax |
mov eax,61 |
mov ebx,2 |
int 0x40 |
mov ebx,[esp+12] |
mov [ebx],eax |
mov eax,61 |
mov ebx,3 |
int 0x40 |
mov ebx,[esp+16] |
mov [ebx],eax |
mov ebx,edx |
ret 16 |
/programs/develop/ktcc/trunk/libc/kolibrisys/draw_bar.asm |
---|
0,0 → 1,21 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_draw_bar,20 |
;arg1 - x |
;arg2 - y |
;arg3 - xsize |
;arg4 - ysize |
;arg5 - color |
push ebx |
mov eax,13 |
mov ebx,[esp+8] |
shl ebx,16 |
mov bx,[esp+16] |
mov ecx,[esp+12] |
shl ecx,16 |
mov cx,[esp+20] |
mov edx,[esp+24] |
int 0x40 |
pop ebx |
ret 20 |
/programs/develop/ktcc/trunk/libc/kolibrisys/draw_image.asm |
---|
0,0 → 1,21 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_putimage,20 |
;arg1 - x |
;arg2 - y |
;arg3 - xsize |
;arg4 - ysize |
;arg5 - image |
push ebx |
mov ebx,[esp+24] |
mov ecx,[esp+16] |
shl ecx,16 |
mov ecx,[esp+20] |
mov ebx,[esp+8] |
shl ebx,16 |
mov ebx,[esp+12] |
mov eax,7 |
int 0x40 |
pop ebx |
ret 20 |
/programs/develop/ktcc/trunk/libc/kolibrisys/draw_window.asm |
---|
0,0 → 1,34 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_draw_window,36 |
;arg1 - xcoord |
;arg2 - ycoord |
;arg3 - xsize |
;arg4 - ysize |
;arg5 - workcolor |
;arg6 - type |
;arg7 - captioncolor |
;arg8 - windowtype |
;arg9 - bordercolor |
push ebp |
mov ebp,esp |
push ebx esi edi |
mov ebx,[ebp+8] |
shl ebx,16 |
mov bx,[ebp+16] |
mov ecx,[ebp+12] |
shl ecx,16 |
mov cx,[ebp+20] |
mov edx,[ebp+28] |
shl edx,24 |
add edx,[ebp+24] |
mov esi,[ebp+36] |
shl esi,24 |
add esi,[ebp+32] |
mov edi,[ebp+40] |
xor eax,eax |
int 0x40 |
pop edi esi ebx |
pop ebp |
ret 36 |
/programs/develop/ktcc/trunk/libc/kolibrisys/event.asm |
---|
0,0 → 1,40 |
format ELF |
section '.text' executable |
public _ksys_wait_for_event_infinite |
public _ksys_check_for_event |
public _ksys_wait_for_event |
public _ksys_set_wanted_events |
_ksys_wait_for_event_infinite: |
mov eax,10 |
int 0x40 |
ret |
_ksys_check_for_event: |
mov eax,11 |
int 0x40 |
ret |
_ksys_wait_for_event: |
;arg1 - time |
mov eax,23 |
mov ebx,[esp+4] |
int 0x40 |
ret 4 |
_ksys_set_wanted_events: |
;arg1 - flags |
mov eax,40 |
mov ebx,[esp+4] |
int 0x40 |
ret 4 |
/programs/develop/ktcc/trunk/libc/kolibrisys/exit.asm |
---|
0,0 → 1,8 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_exit,0 |
xor eax,eax |
dec eax |
int 0x40 |
; ret |
/programs/develop/ktcc/trunk/libc/kolibrisys/ipc.asm |
---|
0,0 → 1,28 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_send_message,12 |
;arg1 - pid |
;arg2 - msg |
;arg3 - size |
push ebx esi |
mov eax,60 |
mov ebx,2 |
mov ecx,[esp+12] |
mov edx,[esp+16] |
mov esi,[esp+20] |
int 0x40 |
pop esi ebx |
ret 12 |
public_stdcall _ksys_define_receive_area,8 |
;arg1 - area |
;arg2 - size |
push ebx |
mov eax,60 |
mov ebx,1 |
mov ecx,[esp+8] |
mov edx,[esp+12] |
int 0x40 |
pop ebx |
ret 8 |
/programs/develop/ktcc/trunk/libc/kolibrisys/irq.asm |
---|
0,0 → 1,119 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_get_irq_owner,4 |
;arg1 - irq |
mov edx,ebx |
mov eax,41 |
mov ebx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
public_stdcall _ksys_get_data_read_by_irq,12 |
;arg1 - irq |
;arg2 - *size |
;arg3 - data |
mov edx,ebx |
mov eax,42 |
mov ebx,[esp+4] |
int 0x40 |
cmp ecx,2 |
jz .not_an_owner |
push ecx |
mov ecx,[esp+16] |
test ecx,ecx |
jz .ignore_data |
mov [ecx],bl |
.ignore_data: |
mov ecx,[esp+12] |
mov [ecx],eax |
pop eax |
mov ebx,edx |
ret 12 |
.not_an_owner: |
mov eax,2 |
mov ebx,edx |
ret |
public_stdcall _ksys_send_data_to_device,8 |
;arg1 - port |
;arg2 - data |
mov edx,ebx |
mov eax,63 |
mov ebx,[esp+8] |
mov ecx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 8 |
public_stdcall _ksys_receive_data_from_device,8 |
;arg1 - port |
;arg2 - data |
mov edx,ebx |
mov eax,43 |
mov ecx,[esp+4] |
add ecx,0x80000000 |
int 0x40 |
mov ecx,[esp+8] |
mov [ecx],bl |
mov ebx,edx |
ret 8 |
public_stdcall _ksys_program_irq,8 |
;arg1 - intrtable |
;arg2 - irq |
mov edx,ebx |
mov eax,44 |
mov ebx,[esp+4] |
mov ecx,[esp+8] |
int 0x40 |
mov ebx,edx |
ret 8 |
public_stdcall _ksys_reserve_irq,4 |
;arg1 - irq |
mov edx,ebx |
mov eax,45 |
xor ebx,ebx |
mov ecx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
public_stdcall _ksys_free_irq,4 |
;arg1 - irq |
mov edx,ebx |
mov eax,45 |
xor ebx,ebx |
inc ebx |
mov ecx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
public_stdcall _ksys_reserve_port_area,8 |
;arg1 - start |
;arg2 - end |
push ebx |
mov eax,46 |
xor ebx,ebx |
mov ecx,[esp+8] |
mov edx,[esp+12] |
int 0x40 |
pop ebx |
ret 8 |
public_stdcall _ksys_free_port_area,8 |
;arg1 - start |
;arg2 - end |
push ebx |
mov eax,46 |
xor ebx,ebx |
inc ebx |
mov ecx,[esp+8] |
mov edx,[esp+12] |
int 0x40 |
pop ebx |
ret 8 |
/programs/develop/ktcc/trunk/libc/kolibrisys/keyboard.asm |
---|
0,0 → 1,29 |
format ELF |
include "proc32.inc" |
section '.text' executable |
public _ksys_get_key |
public _ksys_set_keyboard_mode |
align 4 |
proc _ksys_get_key stdcall |
mov eax,2 |
int 0x40 |
ret |
endp |
align 4 |
proc _ksys_set_keyboard_mode stdcall, mode:dword |
mov edx,ebx |
mov eax,66 |
xor ebx,ebx |
inc ebx |
mov ecx,[mode] |
mov ebx,edx |
ret |
endp |
/programs/develop/ktcc/trunk/libc/kolibrisys/line.asm |
---|
0,0 → 1,21 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_line,20 |
;arg1 - x1 |
;arg2 - y1 |
;arg3 - x2 |
;arg4 - y2 |
;arg5 - color |
push ebx |
mov ebx,[esp+8] |
shl ebx,16 |
mov bx,[esp+16] |
mov ecx,[esp+12] |
shl ecx,16 |
mov cx,[esp+20] |
mov edx,[esp+24] |
mov eax,38 |
int 0x40 |
pop ebx |
ret 20 |
/programs/develop/ktcc/trunk/libc/kolibrisys/midi.asm |
---|
0,0 → 1,21 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_midi_reset,0 |
mov edx,ebx |
mov eax,20 |
xor ebx,ebx |
inc ebx |
int 0x40 |
mov ebx,edx |
ret |
public_stdcall _ksys_midi_send,4 |
;arg1 - data |
mov edx,ebx |
mov eax,20 |
mov ebx,2 |
xor ecx,ecx |
mov cl,[esp+4] |
mov ebx,edx |
ret 4 |
/programs/develop/ktcc/trunk/libc/kolibrisys/mouse.asm |
---|
0,0 → 1,25 |
format ELF |
section '.text' executable |
public _ksys_GetMouseXY |
public _ksys_GetMouseButtonsState |
align 4 |
_ksys_GetMouseXY: |
mov eax,37 |
mov ebx,1 |
int 0x40 |
ret |
align 4 |
_ksys_GetMouseButtonsState: |
mov eax,37 |
mov ebx,2 |
int 0x40 |
ret |
/programs/develop/ktcc/trunk/libc/kolibrisys/pci.asm |
---|
0,0 → 1,138 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_get_pci_version,0 |
mov edx,ebx |
mov eax,62 |
xor ebx,ebx |
int 0x40 |
movzx eax,ax |
mov ebx,edx |
ret |
public_stdcall _ksys_get_last_pci_bus,0 |
mov edx,ebx |
mov eax,62 |
xor ebx,ebx |
inc ebx |
int 0x40 |
movzx eax,al |
mov ebx,edx |
ret |
public_stdcall _ksys_get_pci_access_mechanism,0 |
mov edx,ebx |
mov eax,62 |
mov ebx,2 |
int 0x40 |
movzx eax,al |
mov ebx,edx |
ret |
public_stdcall _ksys_pci_read_config_byte,16 |
;arg1 - bus |
;arg2 - dev |
;arg3 - fn |
;arg4 - reg |
mov edx,ebx |
mov eax,62 |
mov bl,4 |
mov bh,[esp+4] |
mov ch,[esp+8] |
shl ch,3 |
add ch,[esp+12] |
mov cl,[esp+16] |
int 0x40 |
mov ebx,edx |
ret 16 |
public_stdcall _ksys_pci_read_config_word,16 |
;arg1 - bus |
;arg2 - dev |
;arg3 - fn |
;arg4 - reg |
mov edx,ebx |
mov eax,62 |
mov bl,5 |
mov bh,[esp+4] |
mov ch,[esp+8] |
shl ch,3 |
add ch,[esp+12] |
mov cl,[esp+16] |
int 0x40 |
mov ebx,edx |
ret 16 |
public_stdcall _ksys_pci_read_config_dword,16 |
;arg1 - bus |
;arg2 - dev |
;arg3 - fn |
;arg4 - reg |
mov edx,ebx |
mov eax,62 |
mov bl,6 |
mov bh,[esp+4] |
mov ch,[esp+8] |
shl ch,3 |
add ch,[esp+12] |
mov cl,[esp+16] |
int 0x40 |
mov ebx,edx |
ret 16 |
public_stdcall _ksys_pci_write_config_byte,20 |
;arg1 - bus |
;arg2 - dev |
;arg3 - fn |
;arg4 - reg |
;arg5 - value |
push ebx |
mov eax,62 |
mov bl,8 |
mov bh,[esp+8] |
mov ch,[esp+12] |
shl ch,3 |
mov ch,[esp+16] |
mov cl,[esp+20] |
movzx edx,byte [esp+24] |
int 0x40 |
pop ebx |
ret 20 |
public_stdcall _ksys_pci_write_config_word,20 |
;arg1 - bus |
;arg2 - dev |
;arg3 - fn |
;arg4 - reg |
;arg5 - value |
push ebx |
mov eax,62 |
mov bl,9 |
mov bh,[esp+8] |
mov ch,[esp+12] |
shl ch,3 |
mov ch,[esp+16] |
mov cl,[esp+20] |
movzx edx,word [esp+24] |
int 0x40 |
pop ebx |
ret 20 |
public_stdcall _ksys_pci_write_config_dword,20 |
;arg1 - bus |
;arg2 - dev |
;arg3 - fn |
;arg4 - reg |
;arg5 - value |
push ebx |
mov eax,62 |
mov bl,10 |
mov bh,[esp+8] |
mov ch,[esp+12] |
shl ch,3 |
mov ch,[esp+16] |
mov cl,[esp+20] |
mov edx,[esp+24] |
int 0x40 |
pop ebx |
ret 20 |
/programs/develop/ktcc/trunk/libc/kolibrisys/pixel.asm |
---|
0,0 → 1,16 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_putpixel,12 |
;arg1 - x |
;arg2 - y |
;arg3 - color |
push ebx |
xor eax,eax |
mov ebx,[esp+8] |
inc eax |
mov ecx,[esp+12] |
mov edx,[esp+16] |
int 0x40 |
pop ebx |
ret 12 |
/programs/develop/ktcc/trunk/libc/kolibrisys/process.asm |
---|
0,0 → 1,16 |
format ELF |
;include "public_stdcall.inc" |
public _ksys_get_process_table |
section '.text' executable |
_ksys_get_process_table: |
;arg1 - pointer to information |
;arg2 - pid |
mov eax,9 |
mov ebx,[esp+4] |
mov ecx,[esp+8] |
int 0x40 |
ret 8 |
/programs/develop/ktcc/trunk/libc/kolibrisys/screen.asm |
---|
0,0 → 1,15 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_get_screen_size,8 |
;arg1 - x |
;arg2 - y |
mov eax,14 |
int 0x40 |
mov ecx,[esp+8] |
mov [ecx],ax |
mov word [ecx+2],0 |
shr eax,16 |
mov ecx,[esp+4] |
mov [ecx],eax |
ret 8 |
/programs/develop/ktcc/trunk/libc/kolibrisys/skin.asm |
---|
0,0 → 1,13 |
format ELF |
section '.text' executable |
public _ksys_get_skin_height |
_ksys_get_skin_height: |
mov eax,48 |
mov ebx,4 |
int 0x40 |
ret |
/programs/develop/ktcc/trunk/libc/kolibrisys/sound.asm |
---|
0,0 → 1,65 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksy_sound_load_block,4 |
;arg1 - blockptr |
mov edx,ebx |
mov eax,55 |
xor ebx,ebx |
mov ecx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
public_stdcall _ksy_sound_play_block,0 |
mov edx,ebx |
mov eax,55 |
xor ebx,ebx |
inc ebx |
int 0x40 |
mov ebx,edx |
ret |
public_stdcall _ksy_sound_set_channels,4 |
;arg1 - channels |
push ebx |
mov eax,55 |
mov ebx,2 |
xor ecx,ecx |
mov edx,[esp+8] |
int 0x40 |
pop ebx |
ret 4 |
public_stdcall _ksy_sound_set_data_size,4 |
;arg1 - data size |
push ebx |
mov eax,55 |
mov ebx,2 |
xor ecx,ecx |
inc ecx |
mov edx,[esp+8] |
int 0x40 |
pop ebx |
ret 4 |
public_stdcall _ksy_sound_set_frequency,4 |
;arg1 - frequency |
push ebx |
mov eax,55 |
mov ebx,2 |
mov ecx,2 |
mov edx,[esp+8] |
int 0x40 |
pop ebx |
ret 4 |
public_stdcall _ksy_sound_speaker_play,4 |
;arg1 - data |
mov edx,ebx |
mov eax,55 |
mov ebx,55 |
mov ecx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
/programs/develop/ktcc/trunk/libc/kolibrisys/thread.asm |
---|
0,0 → 1,33 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
extrn malloc |
public_stdcall _ksys_start_thread,12 |
;arg1 - proc |
;arg2 - stacksize |
;arg3 - pid |
push dword [esp+8] |
call malloc |
test eax,eax |
jz .no_mem |
push ebx |
mov edx,eax |
add edx,[esp+12] |
mov [edx-4],dword 0 |
mov ecx,[esp+8] |
mov ebx,1 |
mov eax,51 |
int 0x40 |
mov ebx,[esp+16] |
test ebx,ebx |
jz .no_val |
mov [ebx],eax |
.no_val: |
mov eax,edx |
sub eax,[esp+12] |
pop ebx |
ret 12 |
.no_mem: |
mov ecx,[esp+12] |
mov [ecx],eax |
ret 12 |
/programs/develop/ktcc/trunk/libc/kolibrisys/window_redraw.asm |
---|
0,0 → 1,11 |
format ELF |
include "public_stdcall.inc" |
section '.text' executable |
public_stdcall _ksys_window_redraw,4 |
;arg1 - status |
mov edx,ebx |
mov eax,12 |
mov ebx,[esp+4] |
int 0x40 |
mov ebx,edx |
ret 4 |
/programs/develop/ktcc/trunk/libc/kolibrisys/write_text.asm |
---|
0,0 → 1,21 |
format ELF |
section '.text' executable |
public _ksys_write_text |
_ksys_write_text: |
;arg1 - x |
;arg2 - y |
;arg3 - color |
;arg4 - text |
;arg5 - len |
mov eax,4 |
mov ebx,[esp+4] |
shl ebx,16 |
mov bx,[esp+8] |
mov ecx,[esp+12] |
mov edx,[esp+16] |
mov esi,[esp+20] |
int 0x40 |
ret 20 |
/programs/develop/ktcc/trunk/libc/makefile |
---|
1,8 → 1,9 |
INCLUDE = include |
LIBNAME = melibc.a |
LIBSFORBUILD = math |
LIBNAME = libck.a |
CC = gcc |
CFLAGS = -I$(INCLUDE) -nostdinc -DGNUC |
DIRS := file mesys string mem |
CFLAGS = -I$(INCLUDE) -nostdinc -DGNUC -L./ -lm |
DIRS := stdio kolibrisys string stdlib memory math |
############################################################## |
#files := $(foreach dir,$(DIRS),$(dir)/$(wildcard $(dir)/*)) |
/programs/develop/ktcc/trunk/libc/memory/memalloc.asm |
---|
0,0 → 1,38 |
format ELF |
;include "proc32.inc" |
section '.text' executable |
public malloc |
public free |
public realloc |
align 4 |
malloc: |
mov eax,68 |
mov ebx,12 |
mov ecx,[esp+4] ;size |
int 0x40 |
ret 4 |
align 4 |
free: |
mov eax,68 |
mov ebx,13 |
mov ecx,[esp+4] |
int 0x40 |
ret 4 |
align 4 |
realloc: |
mov ebx,20 |
mov eax,68 |
mov ecx,[esp+4] |
mov edx,[esp+8] |
int 0x40 |
ret 8 |
/programs/develop/ktcc/trunk/libc/stdio/fclose.c |
---|
0,0 → 1,9 |
#include <stdio.h> |
#include <string.h> |
#include <stdlib.h> |
void fclose(FILE* file) |
{ |
free(file->buffer); |
free(file); |
} |
/programs/develop/ktcc/trunk/libc/stdio/feof.c |
---|
0,0 → 1,5 |
#include <stdio.h> |
int feof(FILE* file) |
{ |
return file->filepos>=file->filesize; |
} |
/programs/develop/ktcc/trunk/libc/stdio/fflush.c |
---|
0,0 → 1,7 |
#include <stdio.h> |
int fflush(FILE* file) |
{ |
if ((file->mode & 3)==FILE_OPEN_READ) |
return 0; |
return(EOF); |
} |
/programs/develop/ktcc/trunk/libc/stdio/fgetc.c |
---|
0,0 → 1,22 |
#include <stdio.h> |
int fgetc(FILE* file) |
{ |
dword res; |
if ((file->mode & 3!=FILE_OPEN_READ) && (file->mode & FILE_OPEN_PLUS==0)) return EOF; |
if (file->filepos>=file->filesize) |
{ |
return EOF; |
} |
else |
{ |
res=_ksys_readfile(file->filename,file->filepos,1,file->buffer); |
if (res==0) |
{ |
file->filepos++; |
return (int)file->buffer[0]; |
} |
else return(res); |
} |
} |
/programs/develop/ktcc/trunk/libc/stdio/fgetpos.c |
---|
0,0 → 1,6 |
#include <stdio.h> |
int fgetpos(FILE* file,fpos_t* pos) |
{ |
*pos=file->filepos; |
return 0; |
} |
/programs/develop/ktcc/trunk/libc/stdio/fopen.c |
---|
0,0 → 1,138 |
#include <stdio.h> |
#include <string.h> |
#include <stdlib.h> |
extern char __argv; |
extern char __path; |
const char* getfullpath(const char *path){ |
int i,j,relpath_pos,localpath_size; |
int filename_size; |
char local_path; |
char *programpath; |
char *newpath; |
i=0; |
local_path=1; //enable local path |
while((*(path+i)!='\0') || (*(path+i)!=0)) |
{ |
if (*(path+i)=='.') |
{ |
if (*(path+i+1)=='/') |
{ //detected relative path |
relpath_pos=i+2; |
local_path=0; |
break; |
} |
} |
if (*(path+i)=='/') |
{ //disabple local path |
local_path=0; |
return(path); |
} |
i++; |
} |
filename_size=i; |
programpath=&__path; |
if (local_path==1) |
{ |
i=0x400; |
//find local path of program |
while(*(programpath+i)!='/') |
{ |
i--; |
} |
localpath_size=i; |
newpath=malloc(0x400); |
//copy local path to the new path |
for(i=0;i<=localpath_size;i++) |
{ |
*(newpath+i)=*(programpath+i); |
} |
//copy filename to the new path |
for(i=0;i<filename_size;i++) |
{ |
*(newpath+localpath_size+1+i)=*(path+i); |
} |
return(newpath); |
} |
//if we here than path is a relative |
i=0x400; |
//find local path of program |
while(*(programpath+i)!='/') |
{ |
i--; |
} |
localpath_size=i; |
i=0; |
//find file name size |
while((*(path+relpath_pos+i)!='\0') || (*(path+relpath_pos+i)!=0)) |
{ |
i++; |
} |
filename_size=i; |
newpath=malloc(0x400); |
//copy local path to the new path |
for(i=0;i<=localpath_size;i++) |
{ |
*(newpath+i)=*(programpath+i); |
} |
//copy filename to the new path |
for(i=0;i<filename_size;i++) |
{ |
*(newpath+localpath_size+1+i)=*(path+relpath_pos+i); |
} |
return(newpath); |
} |
FILE* fopen(const char* filename, const char *mode) |
{ |
FILE* res; |
int imode; |
imode=0; |
if (*mode=='r') |
{ |
imode=FILE_OPEN_READ; |
mode++; |
}else if (*mode=='w') |
{ |
imode=FILE_OPEN_WRITE; |
mode++; |
}else if (*mode=='a') |
{ |
imode=FILE_OPEN_APPEND; |
mode++; |
}else |
return 0; |
if (*mode=='t') |
{ |
imode|=FILE_OPEN_TEXT; |
mode++; |
}else if (*mode=='b') |
mode++; |
if (*mode=='+') |
{ |
imode|=FILE_OPEN_PLUS; |
mode++; |
} |
if (*mode!=0) |
return 0; |
res=malloc(sizeof(FILE)); |
res->buffer=malloc(256); |
res->buffersize=256; |
res->filesize=0; |
res->filepos=0; |
res->mode=imode; |
res->filename=getfullpath(filename); |
if ((imode==FILE_OPEN_READ) || (imode==FILE_OPEN_APPEND)) |
{ |
res->filesize=_ksys_get_filesize(res->filename); |
} |
return res; |
} |
/programs/develop/ktcc/trunk/libc/stdio/format_print.c |
---|
0,0 → 1,729 |
/* |
function for format output to the string |
*/ |
#include <kolibrisys.h> |
#include <string.h> |
#include <stdio.h> |
//#include <ctype.h> |
#include <math.h> |
int formatted_double_to_string(long double number,int format1,int format2,char *s) |
{ |
double n; |
double nbefor; |
double nafter; |
double v,v2; |
long intdigit; |
long beforpointdigit; |
long div; |
int i; |
int pos; |
int size; |
int fmt1; |
int fmt2; |
long mul; |
char buf[200]; |
size=(int)s; |
n=(double)number; |
if (n<0) {*s='-';s++;n=-n;} |
fmt1=format1; |
fmt2=format2; |
if (fmt2>18) {fmt2=18;} //maximum of size long long type |
//clear array befor output |
for(i=0;i<=200;i++) {buf[i]=0;} |
if ((fmt1>=0) && (n<1)) |
{ //formatted output if 0<=n<1 |
mul=1; |
for(i=0;i<fmt2;i++) |
{n=n*10;mul=mul*10;} |
n=n*10; |
n=ceil(n); |
intdigit=floor(n); |
//intdigit=n; |
intdigit=(intdigit/10); |
pos=0; |
mul=mul/10; |
for(i=0;i<fmt2-1;i++) |
{ |
div=intdigit/mul; |
buf[pos]=(char)div; |
pos++; |
intdigit=intdigit-div*mul; |
mul=mul/10; |
if (mul==1) break; |
} |
buf[pos]=(char)intdigit; |
*s='0';s++; |
*s='.';s++; |
for(i=0;i<format2;i++) |
{ |
if ((buf[i]>=0) && (buf[i]<=9)) {*s='0'+buf[i];} |
else {*s='0';} |
s++; |
} |
} |
else |
{ //if n>=1 |
//v=floorf(n+0.00000000000001); |
beforpointdigit=floor(n+0.00000000000001); |
//beforpointdigit=n; |
nbefor=beforpointdigit; |
nafter=n-nbefor; |
//print part of number befor point |
mul=1; |
for(i=0;i<200-2;i++) |
{ |
mul=mul*10; |
if ((beforpointdigit/mul)==0) {fmt1=i+1;break;} |
} |
pos=0; |
mul=mul/10; |
for(i=0;i<fmt1-1;i++) |
{ |
div=beforpointdigit/mul; |
buf[pos]=(char)div; |
pos++; |
beforpointdigit=beforpointdigit-div*mul; |
mul=mul/10; |
if (mul==1) break; |
} |
buf[pos]=(char)beforpointdigit; |
for(i=0;i<fmt1;i++) |
{ |
if ((buf[i]>=0) && (buf[i]<=9)) {*s='0'+buf[i];} |
s++; |
} |
//print part of number after point |
mul=1; |
for(i=0;i<fmt2;i++) |
{nafter=nafter*10;mul=mul*10;} |
nafter=nafter*10; |
nafter=ceil(nafter); |
intdigit=floor(nafter); |
//intdigit=nafter; |
intdigit=intdigit/10; |
pos=0; |
mul=mul/10; |
for(i=0;i<fmt2-1;i++) |
{ |
div=intdigit/mul; |
buf[pos]=(char)div; |
pos++; |
intdigit=intdigit-div*mul; |
mul=mul/10; |
if (mul==1) break; |
} |
buf[pos]=(char)intdigit; |
*s='.';s++; |
for(i=0;i<format2;i++) |
{ |
if ((buf[i]>=0) && (buf[i]<=9)) {*s='0'+buf[i];} |
else {*s='0';} |
s++; |
} |
} |
size=(int)s-size; |
return(size); |
} |
int formatted_long_to_string(long long number,int fmt1,char *s) |
{ |
int i; |
int pos; |
int fmt; |
int size; |
int difference_pos; |
long digit; |
long mul; |
long div; |
char buf[200]; |
//clear array befor output |
for(i=0;i<200;i++) {buf[i]=0;} |
digit=number; |
size=(int)s; |
if (digit<0) {*s='-';s++;digit=-digit;} |
if (digit==0) {*s='0';s++;goto end;} |
mul=1; |
for(i=0;i<200-2;i++) |
{ |
mul=mul*10; |
if ((digit/mul)==0) {fmt=i+1;break;} |
} |
difference_pos=i+1; |
pos=0; |
mul=mul/10; |
for(i=0;i<fmt-1;i++) |
{ |
div=digit/mul; |
buf[pos]=(char)div; |
pos++; |
digit=digit-div*mul; |
mul=mul/10; |
if (mul==1) break; |
} |
buf[pos]=(char)digit; |
if (fmt1>=difference_pos) fmt=fmt1; |
else |
fmt=difference_pos; |
for(i=0;i<fmt;i++) |
{ |
if (i<difference_pos) |
{ |
if ((buf[i]>=0) && (buf[i]<=9)) {*s='0'+buf[i];} |
} |
else |
{ |
*s=' '; |
} |
s++; |
} |
end: |
size=(int)s-size; |
return(size); |
} |
int formatted_hex_to_string(long long number,int fmt1,char flag_register,char *s) |
{ |
long n; |
int i,pos; |
int fmt; |
long size; |
int difference_pos; |
char xdigs_lower[16]="0123456789abcdef"; |
char xdigs_upper[16]="0123456789ABCDEF"; |
char buf[200]; |
n=(long)number; |
size=(int)s; |
if (n<0) {*s='-';s++;n=-n;} |
if (n==0) {*s='0';s++;goto end;} |
for(i=0;i<200;i++) {buf[i]=0;} |
i=0; |
if (flag_register==0) |
{ |
while (n>0) |
{ |
buf[i]=xdigs_lower[n & 15]; |
n=n>>4; |
i++; |
} |
} |
else |
{ |
while (n>0) |
{ |
buf[i]=xdigs_upper[n & 15]; |
n=n>>4; |
i++; |
} |
} |
pos=i; |
difference_pos=i; |
for(i=pos-1;i>=0;i--) |
{ |
*s=buf[i]; |
s++; |
} |
if (fmt1-difference_pos>0) |
{ |
for(i=difference_pos+1;i<=fmt1;i++) |
{ |
*s=' '; |
s++; |
} |
} |
end:size=(int)s-size; |
return(size); |
} |
int formatted_octa_to_string(long long number,int fmt1,char flag_register,char *s) |
{ |
long n; |
int i,pos; |
int fmt; |
long size; |
int difference_pos; |
char xdigs_lower[16]="012345678"; |
char buf[200]; |
n=number; |
size=(int)s; |
if (n<0) {*s='-';s++;n=-n;} |
if (n==0) {*s='0';s++;goto end;} |
for(i=0;i<200;i++) {buf[i]=0;} |
i=0; |
if (flag_register==0) |
{ |
while (n>0) |
{ |
buf[i]=xdigs_lower[n & 7]; |
n=n>>3; |
i++; |
} |
} |
pos=i; |
difference_pos=i; |
for(i=pos-1;i>=0;i--) |
{ |
*s=buf[i]; |
s++; |
} |
if (fmt1-difference_pos>0) |
{ |
for(i=difference_pos+1;i<=fmt1;i++) |
{ |
*s=' '; |
s++; |
} |
} |
end:size=(int)s-size; |
return(size); |
} |
int format_print(char *dest, size_t maxlen,const char *fmt0, va_list argp) |
{ |
int i,j,k; |
int length; |
int fmt1,fmt2,stepen; |
size_t pos,posc; |
long long intdigit; |
long double doubledigit; |
float floatdigit; |
const char *fmt,*fmtc; |
char *s; |
char *str; |
char buffmt1[30]; |
char buffmt2[30]; |
char buf[1024]; |
char format_flag; |
char flag_point; |
char flag_noformat; |
char flag_long; |
char flag_unsigned; |
char flag_register; |
char flag_plus; |
fmt=fmt0; |
s=dest; |
pos=0; |
while(pos<maxlen) |
{ |
if (*fmt=='%') |
{ |
if (*(fmt+1)=='%') |
{ |
*s='%'; |
s++; |
fmt=fmt+2; |
pos++; |
goto exit_check; |
} |
//checking to containg format in the string |
fmtc=fmt; |
posc=pos; |
format_flag=0; |
flag_long=0; |
flag_unsigned=0; |
flag_register=0; |
flag_plus=0; |
while((*fmtc!='\0') || (*fmtc!=0)) |
{ |
fmtc++; |
posc++; |
switch(*fmtc) |
{ |
case 'c': |
case 'C': |
format_flag=1; |
break; |
case 'd': |
case 'D': |
case 'i': |
case 'I': |
format_flag=1; |
break; |
case 'e': |
format_flag=1; |
break; |
case 'E': |
format_flag=1; |
flag_long=1; |
break; |
case 'f': |
format_flag=1; |
break; |
case 'F': |
format_flag=1; |
flag_long=1; |
break; |
case 'g': |
format_flag=1; |
break; |
case 'G': |
format_flag=1; |
flag_long=1; |
break; |
case 'l': |
flag_long=1; |
break; |
case 'L': |
flag_long=2; |
break; |
case 'o': |
format_flag=1; |
break; |
case 's': |
case 'S': |
format_flag=1; |
break; |
case 'u': |
case 'U': |
format_flag=1; |
flag_unsigned=1; |
break; |
case 'x': |
format_flag=1; |
break; |
case 'X': |
flag_register=1; |
format_flag=1; |
break; |
case 'z': |
case 'Z': |
format_flag=1; |
flag_unsigned=1; |
break; |
case '+': |
flag_plus=1; |
break; |
default:; |
} |
if ((*fmtc=='%') || (*fmtc==' ')) break; |
if (format_flag==1) break; |
} |
if (format_flag==0) |
{ |
*s=*fmt; |
fmt++; |
s++; |
pos++; |
} |
else |
{ |
if ((posc-pos)==1) |
{//simbols % and format simbol near tothere(for example %c ) |
fmt=fmtc+1; |
switch(*fmtc) |
{ |
case 'c': |
case 'C': |
if ((pos+1)<maxlen) |
{ |
//*s=(int)va_arg(argp,char*); |
*s=*((char *)argp); |
argp=argp+4; |
*s++;pos++; |
} |
break; |
case 's': |
case 'S': |
str=va_arg(argp,char*); |
length=strlen(str); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,str,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'd': |
case 'D': |
case 'i': |
case 'I': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
//intdigit=*((long*)argp); |
//argp=argp+4; |
if ((intdigit>0) && (flag_plus==1) && (pos+1<maxlen)) |
{ |
*s='+'; |
s++; |
pos++; |
} |
length=formatted_long_to_string(intdigit,0,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'o': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
//intdigit=*((long int *)argp); |
//argp=argp+4; |
length=formatted_octa_to_string(intdigit,0,flag_register,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'u': |
case 'U': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long int);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
if (flag_unsigned==1) { |
if (intdigit<0) {intdigit=-intdigit;} |
} |
length=formatted_long_to_string(intdigit,0,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'x': |
case 'X': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
//intdigit=*((long int *)argp); |
//argp=argp+4; |
length=formatted_hex_to_string(intdigit,0,flag_register,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'z': |
case 'Z': |
intdigit=va_arg(argp,size_t); |
if (flag_unsigned==1) { |
if (intdigit<0) {intdigit=-intdigit;} |
} |
length=formatted_long_to_string(intdigit,0,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
default:; |
} |
} |
else |
{ |
fmt++; |
flag_point=0; |
flag_noformat=0; |
fmt1=0; |
fmt2=0; |
j=0; |
k=0; |
for(i=pos+1;i<posc;i++) |
{ |
switch(*fmt) |
{ |
case '0': |
case '1': |
case '2': |
case '3': |
case '4': |
case '5': |
case '6': |
case '7': |
case '8': |
case '9': |
if (flag_point==0) |
{ |
buffmt1[j]=*fmt-'0'; |
j++; |
} |
else |
{ |
buffmt2[k]=*fmt-'0'; |
k++; |
} |
break; |
case '.': |
flag_point=1; |
break; |
case 'l': |
case 'L': |
break; |
case '+': |
break; |
default:flag_noformat=1; |
} |
if (flag_noformat==1) break; |
fmt++; |
} |
if (flag_noformat==0) |
{ |
stepen=1; |
for(i=j-1;i>=0;i--) |
{ |
fmt1=fmt1+buffmt1[i]*stepen; |
stepen=stepen*10; |
} |
stepen=1; |
for(i=k-1;i>=0;i--) |
{ |
fmt2=fmt2+buffmt2[i]*stepen; |
stepen=stepen*10; |
} |
switch(*fmtc) |
{ |
case 'f': |
case 'F': |
if (flag_long==0) {doubledigit=va_arg(argp,double);} |
if (flag_long>=1) {doubledigit=va_arg(argp,long double);} |
//doubledigit=*((double *)argp); |
//sargp=argp+8; |
length=formatted_double_to_string(doubledigit,fmt1,fmt2,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'd': |
case 'D': |
case 'i': |
case 'I': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
if ((intdigit>0) && (flag_plus==1) && (pos+1<maxlen)) |
{ |
*s='+'; |
s++; |
pos++; |
} |
length=formatted_long_to_string(intdigit,fmt1,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'o': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
length=formatted_octa_to_string(intdigit,fmt1,flag_register,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'u': |
case 'U': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long int);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
if (flag_unsigned==1) { |
if (intdigit<0) {intdigit=-intdigit;} |
} |
length=formatted_long_to_string(intdigit,fmt1,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'x': |
case 'X': |
if (flag_long==0) {intdigit=va_arg(argp,int);} |
if (flag_long==1) {intdigit=va_arg(argp,long int);} |
if (flag_long==2) {intdigit=va_arg(argp,long long);} |
length=formatted_hex_to_string(intdigit,fmt1,flag_register,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
case 'z': |
case 'Z': |
intdigit=va_arg(argp,size_t); |
if (flag_unsigned==1) { |
if (intdigit<0) {intdigit=-intdigit;} |
} |
length=formatted_long_to_string(intdigit,fmt1,buf); |
if ((pos+length)<maxlen) |
{ |
memcpy(s,buf,length); |
s=s+length;pos=pos+length; |
} |
break; |
default:; |
} |
} |
fmt=fmtc+1; |
} |
} |
} |
else |
{ |
if (*fmt=='\0') {break;} |
*s=*fmt; |
fmt++; |
s++; |
pos++; |
} |
exit_check:; |
} |
return(pos); |
} |
/programs/develop/ktcc/trunk/libc/stdio/fprintf.c |
---|
0,0 → 1,21 |
#include <stdio.h> |
int format_print(char *dest, size_t maxlen, const char *fmt,va_list argp); |
int fprintf(FILE* file, const char* format, ...) |
{ |
va_list arg; |
char *buf; |
int printed; |
//int data[4]; |
va_start (arg, format); |
buf=malloc(4096*2); //8kb max |
//data[0]=(int)&arg-(int)&format; |
printed=format_print(buf,8191, format,arg); |
fwrite(buf,printed,1,file); |
free(buf); |
return(printed); |
} |
/programs/develop/ktcc/trunk/libc/stdio/fputc.c |
---|
0,0 → 1,35 |
#include <stdio.h> |
int fputc(int c,FILE* file) |
{ |
dword res; |
if ((file->mode & 3)==FILE_OPEN_READ) return EOF; |
file->buffer[0]=c; |
if ((file->mode & 3)==FILE_OPEN_APPEND) |
{ |
file->filepos=file->filesize; |
file->filesize++; |
res=_ksys_appendtofile(file->filename,file->filepos,1,file->buffer); |
if (res!=0) return(res); |
file->filepos++; |
return(0); |
} |
if ((file->mode & 3)==FILE_OPEN_WRITE) |
{ |
if (file->filepos==0) |
{ //file not craeted |
res=_ksys_rewritefile(file->filename,1,file->buffer); |
if (res!=0) return(res); |
file->filepos++; |
return 0; |
} |
else |
{ //file craeted and need append one byte |
res=_ksys_appendtofile(file->filename,file->filepos,1,file->buffer); |
if (res!=0) return(res); |
file->filepos++; |
return 0; |
} |
} |
} |
/programs/develop/ktcc/trunk/libc/stdio/fread.c |
---|
0,0 → 1,26 |
#include <stdio.h> |
#include <kolibrisys.h> |
int fread(void *buffer,int size,int count,FILE* file) |
{ |
dword res; |
dword fullsize; |
if ((file->mode!=FILE_OPEN_READ) || (file->mode==FILE_OPEN_PLUS)) return 0; |
fullsize=count*size; |
if ((fullsize+file->filepos)>(file->filesize)) |
{ |
fullsize=file->filesize-file->filepos; |
if (fullsize<=0) return(0); |
} |
res=_ksys_readfile(file->filename,file->filepos,fullsize,buffer); |
if (res==0) |
{ |
file->filepos=file->filepos+fullsize; |
fullsize=fullsize/size; |
return(fullsize); |
} |
else return 0; |
} |
/programs/develop/ktcc/trunk/libc/stdio/fscanf.c |
---|
0,0 → 1,188 |
#include <stdio.h> |
void skipspaces(FILE* file) |
{ |
int c; |
while(1) |
{ |
c=getc(file); |
if (c!=' ' && c!='\r' && c!='\n') |
{ |
ungetc(c,file); |
return; |
} |
} |
} |
int fscanf(FILE* file,const char* format, ...) |
{ |
int res; |
void* arg; |
int i; |
int c; |
int contflag; |
int longflag; |
int sign; |
long long number; |
long double rnumber; |
char* str; |
res=0; |
arg=&format; |
arg+=sizeof(const char*); |
while (*format!='\0') |
{ |
if (*format!='%') |
{ |
c=fgetc(file); |
if (c!=*format) |
{ |
fungetc(c,file); |
return -1; |
} |
format++; |
continue; |
} |
contflag=1; |
longflag=0; |
while (*format && contflag) |
{ |
switch(*format) |
{ |
case '.': |
case '0': |
case '1': |
case '2': |
case '3': |
case '4': |
case '5': |
case '6': |
case '7': |
case '8': |
case '9': |
format++; |
continue; |
break; |
case 'l': |
if (longflag==0) |
longflag=1; |
else |
longflag=2; |
format++; |
break; |
case 'L': |
longflag=2; |
format++; |
break; |
case 'f': |
case 'd': |
case 'c': |
case 's': |
case '%': |
contflag=0; |
break; |
default: |
contflag=0; |
} |
} |
if (contflag) |
break; |
switch(*format) |
{ |
case '%': |
c=fgetc(file); |
if (c!='%') |
{ |
ungetc(c,file); |
return -1; |
} |
res--; |
break; |
case 'd': |
number=0; |
sign=1; |
skipspaces(file); |
c=fgetc(file); |
if (c=='-') |
{ |
sign=-1; |
}else if (c!='+') |
ungetc(c,file); |
contflag=0; |
while(1) |
{ |
c=fgetc(file); |
if (c>='0' && c<='9') |
{ |
contflag++; |
number=number*10+(c-'0'); |
}else |
break; |
} |
ungetc(c,file); |
if (!contflag) |
return res; |
if (longflag<=1) |
{ |
*((int*)arg)=number; |
arg+=sizeof(int); |
}else |
{ |
*((long long*)arg)=number; |
arg+=sizeof(long long); |
} |
break; |
case 'c': |
c=fgetc(file); |
if (c==EOF) |
return res; |
*((char*)arg)=c; |
arg+=sizeof(char); |
break; |
case 's': |
skipspaces(file); |
contflag=0; |
str=*((char**)arg); |
arg+=sizeof(char*); |
while(1) |
{ |
c=fgetc(file); |
if (c==EOF || c==' ' || c=='\n' || c=='\r') |
{ |
ungetc(c,file); |
break; |
} |
*str=c; |
str++; |
contflag++; |
} |
if (!contflag) |
return res; |
break; |
case 'f': |
skipspaces(file); |
// TODO: read real numbers |
rnumber=0; |
switch (longflag) |
{ |
case 0: |
*((float*)arg)=rnumber; |
arg+=sizeof(float); |
break; |
case 1: |
*((double*)arg)=rnumber; |
arg+=sizeof(double); |
break; |
case 2: |
*((long double*)arg)=rnumber; |
arg+=sizeof(long double); |
break; |
default: |
return res; |
} |
break; |
default: |
break; |
} |
format++; |
res++; |
} |
return res; |
} |
/programs/develop/ktcc/trunk/libc/stdio/fseek.c |
---|
0,0 → 1,11 |
#include <stdio.h> |
int fseek(FILE* file,long offset,int origin) |
{ |
if (origin==SEEK_CUR) |
offset+=file->filepos; |
else if (origin==SEEK_END) |
offset+=file->filesize; |
else if (origin!=SEEK_SET) |
return EOF; |
return fsetpos(file,offset); |
} |
/programs/develop/ktcc/trunk/libc/stdio/fsetpos.c |
---|
0,0 → 1,11 |
#include <stdio.h> |
int fsetpos(FILE* file,const fpos_t * pos) |
{ |
if (*pos>=0) |
{ |
file->filepos=*pos; |
return 0; |
} |
else |
return EOF; |
} |
/programs/develop/ktcc/trunk/libc/stdio/ftell.c |
---|
0,0 → 1,5 |
#include <stdio.h> |
long ftell(FILE* file) |
{ |
return file->filepos; |
} |
/programs/develop/ktcc/trunk/libc/stdio/fwrite.c |
---|
0,0 → 1,58 |
#include <stdio.h> |
#include <kolibrisys.h> |
int fwrite(void *buffer,int size,int count,FILE* file) |
{ |
dword res; |
dword fullsize; |
if (file->mode==FILE_OPEN_READ) return 0; |
if (file->mode==FILE_OPEN_APPEND) |
file->filepos=file->filesize; |
fullsize=count*size; |
if ((file->filesize)<(file->filepos+fullsize)) file->filesize=file->filepos+fullsize; |
/* |
if (file->mode==FILE_OPEN_APPEND) |
{ |
file->filepos==file->filesize; |
res=_ksys_appendtofile(file->filename,file->filepos,fullsize,buffer); |
if (res==0) |
{ |
file->filepos+=fullsize; |
fullsize=fullsize/size; |
return(fullsize); |
} |
else return(0); |
} |
*/ |
if ((file->mode==FILE_OPEN_WRITE) || (file->mode==FILE_OPEN_APPEND)) |
{ |
if (file->filepos==0) |
{ //file mot craeted yet |
res=_ksys_rewritefile(file->filename,fullsize,buffer); |
if (res==0) |
{ |
file->filepos+=fullsize; |
fullsize=fullsize/count; |
return(fullsize); |
} |
else return(0); |
} |
else |
{ |
res=_ksys_appendtofile(file->filename,file->filepos,fullsize,buffer); |
if (res==0) |
{ |
file->filepos+=fullsize; |
fullsize=fullsize/count; |
return(fullsize); |
} |
else return(0); |
} |
} |
else return(0); |
} |
/programs/develop/ktcc/trunk/libc/stdio/printf.c |
---|
0,0 → 1,75 |
#include <stdio.h> |
#include <string.h> |
#include <kolibrisys.h> |
char* dllname="/sys/lib/console.obj"; |
int console_init_status; |
char* imports[] = {"START","version","con_init","con_write_asciiz","con_printf","con_exit",NULL}; |
char* caption = "Console test - colors"; |
dword* dll_ver; |
void stdcall (* con_init)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title); |
void stdcall (* con_write_asciiz)(const char* string); |
void cdecl (* con_printf)(const char* format,...); |
void stdcall (* con_exit)(dword bCloseWindow); |
struct import{ |
char *name; |
void *data; |
}; |
void printf_link(struct import *exp, char** imports){ |
dll_ver = (dword*) |
_ksys_cofflib_getproc(exp, imports[1]); |
con_init = (void stdcall (*)(dword , dword, dword, dword, const char*)) |
_ksys_cofflib_getproc(exp, imports[2]); |
con_printf = (void cdecl (*)(const char*,...)) |
_ksys_cofflib_getproc(exp, imports[4]); |
con_exit = (void stdcall (*)(dword)) |
_ksys_cofflib_getproc(exp, imports[5]); |
} |
int init_console(void) |
{ |
struct import * hDll; |
if((hDll = (struct import *)_ksys_cofflib_load(dllname)) == 0){ |
debug_out_str("can't load lib\n"); |
return 1; |
} |
printf_link(hDll, imports); |
debug_out_str("dll loaded\n"); |
con_init(-1, -1, -1, -1, caption); |
return(0); |
} |
int printf(const char *format,...) |
{ |
int i; |
int printed_simbols; |
va_list arg; |
char simbol[]={"%s"}; |
char *s; |
va_start(arg,format); |
if (console_init_status==0) |
{ |
i=init_console(); |
console_init_status=1; |
} |
if (i==0) |
{ |
s=malloc(4096); |
printed_simbols=format_print(s,4096,format,arg); |
con_printf(simbol,s); |
free(s); |
} |
return(printed_simbols); |
} |
/programs/develop/ktcc/trunk/libc/stdio/rewind.c |
---|
0,0 → 1,5 |
#include <stdio.h> |
void rewind(FILE* file) |
{ |
file->filepos=0; |
} |
/programs/develop/ktcc/trunk/libc/stdio/snprintf.c |
---|
0,0 → 1,15 |
#include <kolibrisys.h> |
#include <stdlib.h> |
#include <stdio.h> |
int format_print(char *dest, size_t maxlen, const char *fmt,va_list argp); |
int snprintf(char *dest, size_t size,const char *format,...) |
{ |
va_list arg; |
va_start (arg, format); |
return format_print(dest,size, format, arg); |
} |
/programs/develop/ktcc/trunk/libc/stdio/sprintf.c |
---|
0,0 → 1,15 |
#include <kolibrisys.h> |
#include <stdlib.h> |
#include <stdio.h> |
int format_print(char *dest, size_t maxlen, const char *fmt,va_list argp); |
int sprintf(char *dest,const char *format,...) |
{ |
va_list arg; |
va_start (arg, format); |
return format_print(dest,4096, format, arg); |
} |
/programs/develop/ktcc/trunk/libc/stdio/vsnprintf.c |
---|
0,0 → 1,15 |
#include <kolibrisys.h> |
#include <stdlib.h> |
#include <stdio.h> |
int format_print(char *dest, size_t maxlen, const char *fmt, |
va_list argp); |
int vsnprintf(char *dest, size_t size,const char *format,va_list ap) |
{ |
return format_print(dest,size, format, ap); |
} |
/programs/develop/ktcc/trunk/libc/stdlib/atoi.c |
---|
0,0 → 1,21 |
#include "stdio.h" |
#include "stdlib.h" |
#include "ctype.h" |
/* |
** atoi(s) - convert s to integer. |
*/ |
int atoi(char *s) |
{ |
int sign, n; |
while(isspace(*s)) ++s; |
sign = 1; |
switch(*s) { |
case '-': sign = -1; |
case '+': ++s; |
} |
n = 0; |
while(isdigit(*s)) n = 10 * n + *s++ - '0'; |
return (sign * n); |
} |
/programs/develop/ktcc/trunk/libc/stdlib/atoib.cpp |
---|
0,0 → 1,22 |
#include "stdio.h" |
#include "stdlib.h" |
#include "ctype.h" |
/* |
** atoib(s,b) - Convert s to "unsigned" integer in base b. |
** NOTE: This is a non-standard function. |
*/ |
int atoib(char *s,int b) |
{ |
int n, digit; |
n = 0; |
while(isspace(*s)) ++s; |
while((digit = (127 & *s++)) >= '0') { |
if(digit >= 'a') digit -= 87; |
else if(digit >= 'A') digit -= 55; |
else digit -= '0'; |
if(digit >= b) break; |
n = b * n + digit; |
} |
return (n); |
} |
/programs/develop/ktcc/trunk/libc/stdlib/itoa.c |
---|
0,0 → 1,21 |
#include "stdio.h" |
#include "stdlib.h" |
#include "ctype.h" |
/* |
** itoa(n,s) - Convert n to characters in s |
*/ |
void itoa(int n,char* s) |
{ |
int sign; |
char *ptr; |
ptr = s; |
if ((sign = n) < 0) n = -n; |
do { |
*ptr++ = n % 10 + '0'; |
} while ((n = n / 10) > 0); |
if (sign < 0) *ptr++ = '-'; |
*ptr = '\0'; |
reverse(s); |
} |
/programs/develop/ktcc/trunk/libc/stdlib/itoab.c |
---|
0,0 → 1,24 |
#include "stdio.h" |
#include "stdlib.h" |
#include "ctype.h" |
/* |
** itoab(n,s,b) - Convert "unsigned" n to characters in s using base b. |
** NOTE: This is a non-standard function. |
*/ |
void itoab(int n,char* s,int b) |
{ |
char *ptr; |
int lowbit; |
ptr = s; |
b >>= 1; |
do { |
lowbit = n & 1; |
n = (n >> 1) & 32767; |
*ptr = ((n % b) << 1) + lowbit; |
if(*ptr < 10) *ptr += '0'; else *ptr += 55; |
++ptr; |
} while(n /= b); |
*ptr = 0; |
reverse (s); |
} |
/programs/develop/ktcc/trunk/libc/stdlib/tolower.c |
---|
0,0 → 1,8 |
/* |
** return lower-case of c if upper-case, else c |
*/ |
unsigned char tolower(unsigned char c) |
{ |
if(c<='Z' && c>='A') return (c+32); |
return (c); |
} |
/programs/develop/ktcc/trunk/libc/stdlib/toupper.c |
---|
0,0 → 1,8 |
/* |
** return upper-case of c if it is lower-case, else c |
*/ |
unsigned char toupper(unsigned char c) |
{ |
if(c<='z' && c>='a') return (c-32); |
return (c); |
} |
/programs/develop/ktcc/trunk/libc/string/atoi.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/string/itoa.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/string/itoab.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/string/toupper.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/string/atoib.cpp |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/string/tolower.c |
---|
File deleted |
/programs/develop/ktcc/trunk/libc/string/memmove.asm |
---|
1,16 → 1,35 |
format ELF |
section '.text' executable |
include 'proc32.inc' |
public memcpy |
public memmove |
memcpy: |
memmove: |
push esi edi |
mov edi,[esp+12] |
mov esi,[esp+16] |
mov ecx,[esp+20] |
jecxz .no_copy |
cld |
proc memcpy stdcall, to:dword,from:dword,count:dword |
mov ecx,[count] |
test ecx,ecx |
jz no_copy_block |
mov esi,[from] |
mov edi,[to] |
rep movsb |
.no_copy: |
pop edi esi |
ret |
no_copy_block: |
ret |
endp |
proc memmove stdcall, to:dword,from:dword,count:dword |
mov ecx,[count] |
test ecx,ecx |
jz no_copy_block_ |
mov esi,[from] |
mov edi,[to] |
rep movsb |
no_copy_block_: |
ret |
endp |
/programs/develop/ktcc/trunk/samples/console/console.c |
---|
1,11 → 1,11 |
// Console dynamic link library. Sample by Ghost |
#include "stdio.h" |
#include "string.h" |
#include "mesys.h" |
#include <stdio.h> |
#include <string.h> |
#include <kolibrisys.h> |
char* dllname="/sys/console.obj"; |
char* dllname="/sys/lib/console.obj"; |
int i; |
char* imports[] = {"START","version","con_init","con_write_asciiz","con_printf","con_exit",NULL}; |
14,8 → 14,8 |
dword (* dll_start)(dword res); |
dword* dll_ver; |
void stdcall (* con_init)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title); |
void stdcall (* con_write_asciiz)(dword flags, const char* string); |
void cdecl (* con_printf)(dword flags, const char* format, ...); |
void stdcall (* con_write_asciiz)(const char* string); |
void cdecl (* con_printf)(const char* format,...); |
void stdcall (* con_exit)(dword bCloseWindow); |
struct import{ |
23,52 → 23,48 |
void *data; |
}; |
// â áèáëèîòåêå åñòü àíàëîãè÷íàÿ ôóíêöèÿ _msys_cofflib_getproc, íî ïîêà îíà ðàáîòàåò íå êîððåêòíî |
void* __msys_cofflib_getproc(struct import *lib, char *name){ |
int i; |
for(i = 0; lib[i].name && strcmp(name, lib[i].name); i++); |
if(lib[i].name)return lib[i].data; |
else return NULL; |
} |
void link(struct import *exp, char** imports){ |
dll_start = (dword (*)(dword)) |
__msys_cofflib_getproc(exp, imports[0]); |
_ksys_cofflib_getproc(exp, imports[0]); |
dll_ver = (dword*) |
__msys_cofflib_getproc(exp, imports[1]); |
_ksys_cofflib_getproc(exp, imports[1]); |
con_init = (void stdcall (*)(dword , dword, dword, dword, const char*)) |
__msys_cofflib_getproc(exp, imports[2]); |
con_write_asciiz = (void stdcall (*)(dword, const char*)) |
__msys_cofflib_getproc(exp, imports[3]); |
con_printf = (void cdecl (*)(dword, const char*, ...)) |
__msys_cofflib_getproc(exp, imports[4]); |
_ksys_cofflib_getproc(exp, imports[2]); |
con_write_asciiz = (void stdcall (*)(const char*)) |
_ksys_cofflib_getproc(exp, imports[3]); |
con_printf = (void cdecl (*)(const char*,...)) |
_ksys_cofflib_getproc(exp, imports[4]); |
con_exit = (void stdcall (*)(dword)) |
__msys_cofflib_getproc(exp, imports[5]); |
_ksys_cofflib_getproc(exp, imports[5]); |
} |
int main(int argc, char **argv){ |
struct import * hDll; |
int a,b,c,d; |
if((hDll = (struct import *)_msys_cofflib_load(dllname)) == 0){ |
debug_out_str("can't load lib\n\r"); |
if((hDll = (struct import *)_ksys_cofflib_load(dllname)) == 0){ |
debug_out_str("can't load lib\n"); |
return 1; |
} |
link(hDll, imports); |
debug_out_str("dll loaded\n\r"); |
debug_out_str("dll loaded\n"); |
if(dll_start(1) == 0){ |
debug_out_str("dll_start failed\n\r"); |
debug_out_str("dll_start failed\n"); |
return 1; |
} |
con_init(-1, -1, -1, -1, caption); |
for(i = 0; i < 256; i++){ |
con_printf(7, "Color 0x%02X: ", i); |
con_write_asciiz(i, "Text sample."); |
con_printf("Color 0x%02X: ", i); |
con_write_asciiz("Text sample."); |
con_printf(i, " printf %s test %d\n", "small", i); |
con_printf(" printf %s test %d\n", "small", i); |
} |
con_exit(0); |
debug_out_str("all right's ;)\n\r"); |
debug_out_str("all right's ;)\n"); |
} |
/programs/develop/ktcc/trunk/samples/simple/simple.c |
---|
1,9 → 1,9 |
// simple sample by Ghost |
#include "stdio.h" |
#include "string.h" |
#include "mesys.h" |
#include <stdio.h> |
#include <string.h> |
#include <kolibrisys.h> |
#define FONT0 0 |
#define FONT1 0x10000000 |
13,7 → 13,7 |
#define BT_HIDE 0x40000000 |
#define BT_NOFRAME 0x20000000 |
char header[]={" -= C demo programm. Compiled whith meTCC halyavin port =- "}; |
char header[]={" -= C demo programm. Compiled whith KTCC halyavin and andrew_programmer port =- "}; |
void rotate_str(char *str){ |
char tmp; |
28,13 → 28,13 |
static int fcolor = 0; |
static int col = 0; |
_msys_window_redraw(1); |
_msys_draw_window(100, 100, 300, 120, 0xaabbcc, 2, 0x5080d0, 0, 0x5080d0); |
_msys_write_text(6 - offs, 8, fcolor | FONT0, header, strlen(header)); |
_msys_draw_bar(1, 6, 5, 13, 0x05080d0); |
_msys_draw_bar(274, 6, 26, 13, 0x05080d0); |
_msys_make_button(300 - 19, 5, 12, 12, 1 | BT_NORMAL, 0x6688dd); |
_msys_window_redraw(2); |
_ksys_window_redraw(1); |
_ksys_draw_window(100, 100, 300, 120, 0xaabbcc, 2, 0x5080d0, 0, 0x5080d0); |
_ksys_write_text(6 - offs, 8, fcolor | FONT0, header, strlen(header)); |
_ksys_draw_bar(1, 6, 5, 13, 0x05080d0); |
_ksys_draw_bar(274, 6, 26, 13, 0x05080d0); |
_ksys_make_button(300 - 19, 5, 12, 12, 1 | BT_NORMAL, 0x6688dd); |
_ksys_window_redraw(2); |
offs = (offs + 1) % 6; |
if(!offs)rotate_str(header); |
46,11 → 46,11 |
int main(int argc, char **argv){ |
while(!0){ |
switch(_msys_wait_for_event(10)){ |
switch(_ksys_wait_for_event(10)){ |
case 2:return 0; |
case 3: |
if(_msys_get_button_id() == 1)return 0; |
if(_ksys_get_button_id() == 1)return 0; |
break; |
default: |