diff --git a/data/Tupfile.lua b/data/Tupfile.lua index d8ac7c73af..169b614e67 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -38,7 +38,6 @@ img_files = { {"File Managers/FNAV/FNAV_CUR.PNG", "common/File Managers/fNav/fnav_cur.png"}, {"File Managers/FNAV/FNAV_FNT.PNG", "common/File Managers/fNav/fnav_fnt.png"}, {"File Managers/FNAV/FNAV_ICN.PNG", "common/File Managers/fNav/fnav_icn.png"}, - {"FONTS/LITT.CHR", PROGS .. "/demos/bgitest/trunk/FONTS/LITT.CHR"}, {"FONTS/TAHOMA.KF", "common/fonts/tahoma.kf"}, {"LIB/ICONV.OBJ", "common/lib/iconv.obj"}, {"LIB/KMENU.OBJ", "common/lib/kmenu.obj"}, diff --git a/programs/cmm/examples/Tupfile.lua b/programs/cmm/examples/Tupfile.lua index 65b13ccf1c..877ec702f4 100644 --- a/programs/cmm/examples/Tupfile.lua +++ b/programs/cmm/examples/Tupfile.lua @@ -8,3 +8,5 @@ tup.rule("collections.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("K tup.rule("menu.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "menu.com") tup.rule("rgb.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "rgb.com") tup.rule("console.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "console.com") +tup.rule("info.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "info.com") +tup.rule("pig.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "pig.com") diff --git a/programs/cmm/examples/info.c b/programs/cmm/examples/info.c new file mode 100644 index 0000000000..2919f5e72e --- /dev/null +++ b/programs/cmm/examples/info.c @@ -0,0 +1,52 @@ +/* + * Template C-- program. +*/ + +#define MEMSIZE 4096*15 + +#include "../lib/io.h" +#include "../lib/gui.h" + +#define WIN_W 12*10+30 +#define WIN_H 80 + +void main() +{ + word btn; + loop() switch(WaitEvent()) + { + case evButton: + btn = GetButtonID(); + if (btn == 1) ExitProcess(); + break; + + case evKey: + GetKeys(); + if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + break; + + case evReDraw: + draw_window(); + break; + } +} + + +inline GetRevisionNumber() +{ + char buf[32]; + EAX = 18; + EBX = 13; + ECX = #buf; + return ESDWORD[#buf+5]; +} + +void draw_window() +{ + system.color.get(); + DefineUnDragableWindow(screen.width-WIN_W-15, GetClientHeight()-WIN_H-15, WIN_W-1, WIN_H-1); + DrawBar(0,0,WIN_W,WIN_H,0x414155); + DrawWideRectangle(0,0,WIN_W,WIN_H, 3, 0x5555FF); + WriteText(15, 20, 0x81, 0xFFFF55, " REV 7321 "); + WriteText(15, 20+25, 0x81, 0xFFFF55, "17.09.2018"); +} diff --git a/programs/cmm/examples/pig.c b/programs/cmm/examples/pig.c new file mode 100644 index 0000000000..24c616d1c0 --- /dev/null +++ b/programs/cmm/examples/pig.c @@ -0,0 +1,25 @@ +/* + * Template C-- program. +*/ + +#define MEMSIZE 4096*5 + +#include "../lib/kolibri.h" +#include "../lib/fs.h" +#include "../lib/patterns/restart_process.h" + +proc_info Form; + +void main() +{ + int i; + CreateDir("/tmp0/1/pig"); + RunProgram("/sys/UNZ", "-o /tmp0/1/pig -h /kolibrios/games/pig.zip"); + for (i = 0; i < 200; i++) + { + if (CheckProcessExists("UNZ")==false) break; + pause(3); + } + RunProgram("/tmp0/1/pig/pig", NULL); +} + diff --git a/programs/cmm/lib/patterns/restart_process.h b/programs/cmm/lib/patterns/restart_process.h index ded1a94c94..76720886a2 100644 --- a/programs/cmm/lib/patterns/restart_process.h +++ b/programs/cmm/lib/patterns/restart_process.h @@ -12,7 +12,7 @@ enum { #define MAX_PROCESS_COUNT 256 -:int CheckProcessExists(dword proc_name) { +:bool CheckProcessExists(dword proc_name) { int i; proc_info Process; for (i=0; i _FI structure -; edi-> where to load - push edi -if BGI_LEVEL eq KERNEL - mov edi,0x40000 -end if - .nfont: - mov edx,[esi] -if BGI_LEVEL eq KERNEL - movzx ebx,word[esi+4] - mov [BGIfont_Prepare.okflag],'N' -end if - call _BGIfont_Prepare -if ~ BGI_LEVEL eq KERNEL - add esi,4 -else - push esi - test eax,eax - jz .fail - mov [BGIfont_Prepare.okflag],'*' - .fail: - mov esi,BGIfont_Prepare.font - call boot_log - pop esi - add esi,6 -end if - loop .nfont - dph2 _BGI_BOLD,300,550 -; movzx edi,byte[0x40000] - pop edi -} - BGIfont_get2head: shr ecx,28 ; font # sub ecx,4 @@ -146,30 +83,11 @@ BGIfont_get2head: .ex: ret -BGIfont_GetName: -; in: ecx-fontID; -; out: edx-font name. - call BGIfont_get2head - xor edx,edx - test edi,edi - jz .ex - mov edx,[edi] - .ex: - ret - macro dps2 _str { -if ~ BGI_LEVEL eq KERNEL - if LOAD_MSG eq 1 - dps _str - end if -else - pusha - mov esi,BGIfont_Prepare.okflag - mov byte[esi], _str - call boot_log - popa -end if + if LOAD_MSG eq 1 + dps _str + end if } macro dph2 num,x,y @@ -236,32 +154,21 @@ _BGIfont_Prepare: mov dword[.font],edx ; filename mov esi,edi ; esi->FontName mov [.dest],edi ; ptr to load font -if ~ BGI_LEVEL eq KERNEL mov eax, 70 mov ebx, .fontattr mcall test eax, eax - jnz .fail + ;jnz .fail dps2 '1' mov eax, [.fileattr+32] - mov [.fsize], eax + mov [.fsize], litt_end-litt_file mov ebx,.fontinfo mov eax,70 mcall ; ebx - file size -else - push edi esi edx - mov eax,.font - xor ebx,ebx - mov esi,12 - mov ecx,ebx - mov edx,edi - call fileread - pop edx esi edi - mov ebp,edi - add ebp,ebx - cmp ebp,0x50000 - ja .fail -end if + ;mov ebx, litt_end-litt_file + ;mov edi, litt_file + ;mov [.dest],litt_file ; ptr to load font + cmp dword[edi],0x08084b50 ; 'PK',8,8 jne .fail dps2 '2' @@ -334,7 +241,6 @@ end if popa ret -if ~ BGI_LEVEL eq KERNEL .fontinfo: dd 0 dd 0 @@ -343,7 +249,7 @@ if ~ BGI_LEVEL eq KERNEL .dest dd 0 .fontfullname: db BGIFONT_PATH -.font db 'FONT.CHR',0 +.font db 'LITT.CHR',0 .fontattr: dd 5 @@ -354,11 +260,7 @@ if ~ BGI_LEVEL eq KERNEL db 0 dd .fontfullname .fileattr rd 40/4 -else - .dest dd 0 - .font db 'FONT CHR' - .okflag db ' ',0 -end if + BGIfont_Coo: ; y->word[txt.y1], x->word[txt.x1] diff --git a/programs/other/rtfread/trunk/litt.chr b/programs/other/rtfread/trunk/litt.chr new file mode 100644 index 0000000000..347f65d2ae Binary files /dev/null and b/programs/other/rtfread/trunk/litt.chr differ diff --git a/programs/other/rtfread/trunk/rtfread.asm b/programs/other/rtfread/trunk/rtfread.asm index 66f16d6105..0c640b2631 100644 --- a/programs/other/rtfread/trunk/rtfread.asm +++ b/programs/other/rtfread/trunk/rtfread.asm @@ -15,8 +15,6 @@ WINW equ 600 WINH equ 450 WIN_COLOR equ 0x73f0f0f0 DEFCOLOR equ 0x303030 -;RENDER equ PIX -;RENDER equ BGI RENDER equ FREE BGIFONT_PATH equ '/sys/fonts/' @@ -56,34 +54,24 @@ AR_OFFSET equ 10 dd I_END0 ; размер программы dd esp_end ; количество памяти dd sys_mem ; адрес вершины стэка - dd fname_buf ; адрес буфера для параметров (не используется) - dd cur_dir_path ; зарезервировано + dd fname_buf ; адрес буфера для параметров + dd cur_dir_path ; путь к программе -include '../../../config.inc' ;for nightbuild +include '../../../config.inc' ;for nightbuild include '../../../macros.inc' ; макросы облегчают жизнь ассемблерщиков! include '../../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac' -;include 'MACROS.INC' -;include 'load_lib.mac' - @use_library -;include '../../../debug.inc' +; include '../../../debug.inc' -if ~ RENDER eq PIX - TOP=TOP+4 - include 'bgifont.inc' -end if +TOP=TOP+4 +include 'bgifont.inc' include 'rtf_lite.inc' -;include 'ascl.inc' ;--------------------------------------------------------------------- ;--- НАЧАЛО ПРОГРАММЫ ---------------------------------------------- ;--------------------------------------------------------------------- -help_file: - file 'reader.rtf' -help_end: - START: mcall 68, 11 mcall 40, 0x80000027 @@ -95,11 +83,9 @@ load_libraries l_libs_start,end_l_libs call [OpenDialog_Init] mov [pitch],2 - if ~ RENDER eq PIX mov edx,FONT_NAME mov edi,save_limit BGIfont_Prepare - end if start2: cmp byte[fname_buf],0 je load_file;top_red @@ -321,7 +307,6 @@ key: ; ; je still jmp red .noarup: - if RENDER eq FREE cmp ah,56 ;zoom+ jne .noplus .zplus: @@ -338,7 +323,6 @@ key: ; fdiv [Zoomscale] jmp .zoom .nominus: - end if cmp ah,0xB5 ; end jne .pre_file_open .end: @@ -672,14 +656,7 @@ end if mov ecx,16 .l1: push ecx - if RENDER eq BGI - mov edx,char - mov ecx,0x48000000 - mov esi,1 - BGIfont_Outtext - else mcall 4,,0x10000000,char,1 - end if pop ecx inc [char] add ebx,(CHARW+3) shl 16 @@ -1072,18 +1049,13 @@ scroll_bar_data_vertical: ;--------------------------------------------------------------------- ;blind db ? -if RENDER eq PIX -; rd 2 - Free rd 9 -else -if RENDER eq BGI - FreeFontscale dd 0.07 -else + Zoomscale dd 1.15 FreeFontscale dd 0.04 -end if + Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0 -end if + + I_END0: fname_buf: rb 1024+16 @@ -1141,6 +1113,14 @@ szKeyword rb 31 szParameter rb 21 block_end dd ? +help_file: + file 'reader.rtf' +help_end: + +litt_file: + file 'litt.chr' +litt_end: + ;--------------------------------------------------------------------- I_END: ; метка конца программы rb RTFSIZE