Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 1428 → Rev 1429

/programs/develop/heed/trunk/build.sh
0,0 → 1,14
#!/bin/bash
# This script does for linux the same as build.bat for DOS,
# it compiles the KoOS kernel, hopefully ;-)
 
echo "lang fix en"
echo "lang fix en" > lang.inc
mkdir bin
fasm -m 16384 heed.asm ./bin/heed
rm -f lang.inc
exit 0
 
 
 
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/programs/develop/heed/trunk/cp1251-8x16
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/heed/trunk/cp866-8x16
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/develop/heed/trunk/heed.asm
1,1409 → 1,3500
;constants
;for keys
KEY_ESC equ 27
KEY_PGDN equ 183
KEY_PGUP equ 184
KEY_LNDN equ 177
KEY_LNUP equ 178
KEY_RIGHT equ 179
KEY_LEFT equ 176
KEY_HOME equ 180
KEY_END equ 181
KEY_HOMETOP equ 251 ;Ctrl + '['
KEY_ENDBOTTOM equ 253 ;Ctrl + ']'
;************************************************************************
; v.015 08.03.2010
; Support for OpenDialog - Open and Save
; Some optimization
;************************************************************************
; v.014 05.02.2010
;
; PageUp, PageDown - áâà ­¨æ  ¢¢¥àå/¢­¨§
; Ctrl+UP, Ctrl+Down - ¯à®ªàã⪠ áâà ­¨æë ­  áâப㠢¢¥àå/¢­¨§ ¡¥§ ᬥ饭¨ï ªãàá®à 
; Home,End - ¢ ­ ç «®/ª®­¥æ áâப¨
; Ctrl+Home, Ctrl+End - ª ¯¥à¢®¬ã/¯®á«¥¤­¥¬ã ¡ ©âã ä ©« 
; Left, Right - ªãàá®à ¢«¥¢®/¢¯à ¢®
; Ctrl+O - ®âªàëâì ä ©«
; Ctrl+S - á®åà ­¨âì
; Ctrl+F - ¯®¨áª (+Tab ¤«ï OptionBox)
; Ctrl+G - ¯¥à¥å®¤ ­  ᬥ饭¨¥ (+Tab ¤«ï OptionBox)
; Ctrl+B - ¢ë¤¥«¨âì ¡«®ª
; ESC - á­ïâì ¢ë¤¥«¥­¨¥
; Ctrl+C - ª®¯¨à®¢ âì ¡«®ª
; Ctrl+V - ¢áâ ¢¨âì ¢ ¢ë¤¥«¥­­ãî ®¡« áâì
; Ctrl+X - ¢ë१ âì ¢ë¤¥«¥­­ãî ®¡« áâì (¢ ¡ãä¥à)
; n - ¨­¢¥àâ¨à®¢ âì ¡ ©â ¯®¤ ªãàá®à®¬
; Ins - ०¨¬ § ¬¥­ë/¢áâ ¢ª¨ (¯® 㬮«ç ­¨î)
; Del - ¢ ०¨¬¥ ¢áâ ¢ª¨ - 㤠«¨âì ¡ ©â ¯®¤ ªãàá®à®¬
; BackSpace - ¢ ०¨¬¥ ¢áâ ¢ª¨ - 㤠«¨âì ¡ ©â ¯¥à¥¤ ªãàá®à®¬
; ~ - ᬥ­  ª®¤¨à®¢ª¨ (cp866,cp1251)
; Shift+~ - ᬥ­  ª®¤¨à®¢ª¨ (cp866 ¨«¨ cp1251,koi8-r)
 
;  ¬ïâì ¯¥à¥à á¯à¥¤¥«ï¥âáï ­  㢥«¨ç¥­¨¥ i umen'shenie.
; ” ©« § £à㦠¥âáï 楫¨ª®¬.
 
; Œ ªà®áë load_lib.mac, editbox_ex ¨ ¡¨¡«¨®â¥ªã box_lib.obj ᮧ¤ «¨:
; <Lrz> - Alexey Teplov / €«¥ªá¥© ’¥¯«®¢
; Mario79, Mario - Marat Zakiyanov / Œ à â ‡ ª¨ï­®¢
; Diamondz - Evgeny Grechnikov / …¢£¥­¨© ƒà¥ç­¨ª®¢ ¨ ¤à.
;
; staper@inbox.ru
; babalbes@yandex.ru
 
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x80000 ; memory for app
dd 0x80000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
db 'MENUET01'
dd 0x1
dd START ;program start
dd I_END ;program image size
dd (D_END+0x600) and not 3 ;required amount of memory
dd (D_END+0x600) and not 3 ;stack
dd 0x0 ;buf_cmd_lin
dd cur_dir_path
 
_title equ 'HeEd 0.15'
 
include 'lang.inc'
include '..\..\..\macros.inc'
include '../../../macros.inc'
include '../../libraries/box_lib/trunk/box_lib.mac'
include '../../libraries/box_lib/load_lib.mac'
include '../../libraries/box_lib/asm/trunk/opendial.mac'
 
@use_library
use_OpenDialog
 
START: ; start of execution
times 16 dd 0
 
mov eax,40
mov ebx,100111b ;event mouse
mcall
mov dword [process_info+42],540
mov dword [process_info+46],414
frgrd_color equ 0xfefefe
bkgrd_color equ 0x000000
kursred_color equ 0x0039ff
kurstxt_color equ 0x708090
text_color equ 0xaaaaaa
 
red:
call draw_window
panel_clr1 equ 0xe9e9e2
panel_clr2 equ 0x8b8b89
panel_clr3 equ 0x777777;eaeae3
 
still:
mov eax,10 ; wait here for event
mcall
dec al ; redraw request ?
je red
dec al ; key in buffer ?
je key
dec al ; button in buffer ?
je button
; mouse event received
mouse:
mov eax,37
mov ebx,2
mcall
or eax,eax
jz still
cmp [menu_opened],1
jne still
mov [menu_opened],0
 
palitra:
.1 dd frgrd_color,bkgrd_color ;梥⠭¥¢ë¤¥«¥­­®£® ᨬ¢®« 
.2 dd frgrd_color,text_color ;«¥¢ë©,¯à ¢ë© á⮫¡æë,ç áâì ­¨¦­¥© áâப¨
.3 dd kursred_color,frgrd_color ;ªãàá®à 
.4 dd kurstxt_color,bkgrd_color ;ªãàá®à  ¢ ⥪á⮢®© ®¡« áâ¨
.5 dd panel_clr1,not text_color ;­¨¦­ïï ¯ ­¥«ì
 
key: ; key
mov eax,2
mcall
; test al,al
; jnz still
cmp ah,KEY_ESC
jz close
mov al,[o_s_flag]
and al,8 ;set bit 3?
jz edit_keys ;not - no output to filename area
cmp ah,8 ;BACKSPACE
jnz no_backspace
dec [name_l]
cmp [name_l],0
mov edx,filename
je A1
jg @f
mov [name_l],0
jmp A1
FIRST_HEX equ 0*65536+24
scroll_width_size equ 15
 
struct f70
func_n rd 1
param1 rd 1
param2 rd 1
param3 rd 1
param4 rd 1
rezerv rb 1
name rd 1
ends
 
START:
mcall 68,11
;OpenDialog initialisation
init_OpenDialog OpenDialog_data
 
load_library boxlib_name,cur_dir_path,buf_cmd_lin,system_path,\
err_message_found_lib,head_f_l,myimport,err_message_import,head_f_i
 
mcall 40,0x27
 
mcall 68,12,32*1024 ;áâà ­¨ç­ë© ¡ãä¥à
mov [screen_table],eax
mcall 68,12,4*1024
; mov [blocks_table],eax
mov [file_buffer],eax
; mov esi,eax
; mcall 68,12,4*1024
; mov [esi],eax
; mov [blocks_counter],1
 
; mcall 68,12,1024 ;Procinfo area for function 9 in MenuBar
; mov [menu_data_1.procinfo],eax
; mov [menu_data_2.procinfo],eax
mcall 68,12,1024
mov [copy_buf],eax
 
 
;à §¬¥à ⥪ã饣® ¯ãâ¨
mov esi,cur_dir_path
@@:
add dl,[name_l]
A1:
sub [x_cursor],0x60000
mov [edx],byte 0
cmp [x_cursor],0xb0005
jge @f
mov [x_cursor],0xb0005
cmp byte [esi],0
je @f
inc esi
jmp @b
@@:
call redraw_window
jmp still ;END BACKSPACE
sub esi,cur_dir_path
mov [edit1.pos],esi
mov [edit1.size],esi
 
no_backspace:
cmp ah,0x30 ;'0'
jl A2
cmp ah,0x39 ;'9'
jle bigsym
cmp ah,65 ;'A'
jbe bigsym
cmp ah,90 ;'Z'
jle bigsym
cmp ah,97 ;'a'
jbe smsym
cmp ah,122;'z'
jle smsym
;®¡é¥á¨á⥬­ë¥ ª« ¢¨è¨ ¤«ï Shift+ªãàá®àë
; mcall 66,4,75,1
; mcall 66,,77
; mcall 66,,72
; mcall 66,,80
 
call ready_screen_buffer
; jmp open_file
 
redraw_all:
call draw_window_1
still:
mcall 10
 
cmp eax,6
je mouse
dec al
jz redraw_all
dec al
jz key
dec al
jz button
jmp still
A2:
cmp ah,46 ;'.'
jz bigsym
cmp ah,0x20
jz bigsym
 
red: call ready_screen_buffer
call main_area
jmp still
smsym:
sub ah,32
bigsym:
cmp [name_l],13 ;yes. filename length <13
jl @f
sub [o_s_flag],8 ;not - disable output to filename area
mov [x_cursor],0x680005; - set x-base & x-size
jmp _end_keys
 
draw_window_1:
call start_draw
call draw_window
call show_file_size
call show_codepage
call show_insert
call ready_screen_buffer
call main_area
ret
 
key:
mcall 2
dec al
jz still
dec al
jz key.syst
cmp ah,2
je Ctrl_B ;¢ë¤¥«¨âì ¡«®ª
cmp ah,3
je Ctrl_C ;copy
cmp ah,6
je Ctrl_F ;find
cmp ah,7
je Ctrl_G ;go to
cmp ah,8
je BackSpace
cmp ah,15
je open_dialog ;open_file ;Ctrl+O
cmp ah,19
je save_file ;Ctrl+S
cmp ah,22
je Ctrl_V ;paste
cmp ah,24
je Ctrl_X ;cut
cmp ah,27
je ESC
cmp ah,48
jb still
cmp ah,57
jbe input_from_keyboard ;0-9
cmp ah,65
jb still
cmp ah,70
jbe input_from_keyboard ;A-F
cmp ah,81
jne @f
call Ctrl_DOWN
jmp red
@@:
mov edx,filename ;
add dl,[name_l]
mov [edx],ah
inc [name_l]
add [x_cursor],0x60000
_end_keys:
call redraw_window
jmp still
edit_keys:
cmp ah,KEY_PGDN
jnz @f
call PgDn
jmp still
cmp ah,82
jne @f
call Ctrl_UP
jmp red
@@:
cmp ah,KEY_PGUP
jnz @f
call PgUp
jmp still
cmp ah,84
jne @f
call Ctrl_HOME
jmp red
@@:
cmp ah,KEY_HOME ;Home
jnz @f
call Home
jmp still
cmp ah,85
je Ctrl_END
cmp ah,96
je change_codepage ;⨫줠, cp866 - cp1251
cmp ah,97
jb still
cmp ah,102
jbe input_from_keyboard ;a-f
cmp ah,126
jne @f
xor ah,ah
jmp change_codepage ;Shift+~, koi8-r
@@:
cmp ah,KEY_END ;Home
jnz @f
call _End
jmp still
cmp ah,110
je invert_byte ;n
cmp ah,176
jne @f
call LEFT
jmp red
@@:
cmp ah,KEY_HOMETOP
jnz @f
call CtrlHome
jmp still
cmp ah,177
jne @f
call DOWN
jmp red
@@:
cmp ah,KEY_ENDBOTTOM
jnz @f
call CtrlEnd
jmp still
cmp ah,178
je UP
cmp ah,179
je RIGHT
cmp ah,180
jne @f
call HOME
jmp red
@@:
cmp ah,KEY_LNDN
jnz @f
call LnDn
cmp ah,181
je END_
cmp ah,182
je DEL
cmp ah,183
je PGDN
cmp ah,184
je PGUP
cmp ah,185
je Insert
jmp still
@@:
cmp ah,KEY_LNUP
jnz @f
call LnUp
.syst:
cmp ah,72
cmp ah,75
cmp ah,77
cmp ah,80
jmp still
 
button:
mcall 17
dec ah
jnz still
jmp close_prog
 
align 4
mouse:
mcall 37,7
test eax,eax
jz .menu_bar_1;.mouse
bt eax,15
jc @f ;®¡à ¡®âª  ª®«ñᨪ  ¬ëè¨
mov ecx,eax
shl ecx,2
.1:
call Ctrl_DOWN
loop .1
jmp red
@@:
cmp ah,KEY_RIGHT ;Right
jnz @f
call Right
jmp still
xor ecx,ecx
sub cx,ax
shl cx,2
.2:
call Ctrl_UP
loop .2
jmp red
 
.menu_bar_1:
call .set_mouse_flag
@@:
cmp ah,KEY_LEFT ;Left
jnz @f
call Left
@@:
;। ªâ¨à®¢ ­¨¥ áâப¨ ¢ hex-¯à¥¤áâ ¢«¥­¨¨
mov esi,[current]
mov bl,[posx]
add esi,0x10000 ;0x80000
cmp ah,0x30
jl still ;ah<'0'
cmp ah,0x39
jle A23 ;ah='0'...'9' - ¯¥à¥¢®¤ ¨§ ᨬ¢®«®¢ ¢ hex
;¯à®¢¥àª  ­  ª®¤ë áâ àè¨å hex-æ¨äà
cmp ah,0x61 ;ah<'a'
jl A27 ;¬®¦¥â ¡ëâì ¢¢®¤ïâáï ¡®«ì訥 ¡ãª¢ë?
cmp ah,0x66 ;ah>'f'
jg still
sub ah,0x20 ;ª®­¢¥àâ¨à㥬 ¢ ¡®«ì訥 ¡ãª¢ë
jmp A24
A27:
cmp ah,0x41
jl still ;ah<'A'
cmp ah,0x46
jg still ;ah>'F'
A24:
add ah,9
A23:
mov dl,[esi];®à¨£¨­ «ì­ë© ¡ ©â
and bl,1 ;¥á«¨ ­¥ç¥â - । ªâ¨àã¥âáï ¬« ¤è¨© ¯®«ã¡ ©â, ç¥â - áâ à訩
jz hi_half_byte
;¬« ¤è¨© ¯®«ã¡ ©â
and ah,0x0f ;®¡­ã«ï¥¬ áâ à訩 ¯®«ã¡ ©â ¢¢¥¤¥­­®© æ¨äàë
;¥á«¨ ah = 0x30...0x39, â® ¢á¥ ­®à¬ «ì­®
;¥á«¨ ah = 0x41...0x46, â® ­  ¬¥âª¥ €24 ¯®«ã稬
;ah = 0x4A...0x4F ¨ ⮦¥ ¢á¥ ­®à¬ «ì­®
and dl,0xf0 ;®¡­ã«ï¥¬ ¬« ¤è¨© ¯®«ã¡ ©â 㠮ਣ¨­ «ì­®£® ¡ ©â 
jmp patch_byte
hi_half_byte:
;áâ à訩 ¯®«ã¡ ©â
shl ah,4 ;®¤­®¢à¥¬¥­­® ᤢ¨£ ¥¬ ­ã¦­®¥ §­ ç¥­¨¥ ¢ áâ à訩 ¯®«ã¡ ©â
;¨ ®¡­ã«ï¥¬ ¬« ¤è¨©
and dl,0x0f ;®¡­ã«ï¥¬ áâ à訩 ¯®«ã¡ ©â 㠮ਣ¨­ «ì­®£® ¡ ©â 
patch_byte:
or ah,dl ;®¡ê¥¤¨­ï¥¬ ¯®«ã¡ ©âë
mov [esi],ah;¯ â稬 ¢ ¯ ¬ïâ¨
mov ebx,0x20100
movzx ecx,ah ;¤«ï ä㭪樨 ¢ë¢®¤  ç¨á« 
;⥯¥àì ­ ¤® à áç¨â âì ª®®à¤¨­ âë ¢ë¢®¤  ¤«ï ç¨á« 
;edx = x shl 16 + y
mov edx,[x_cursor]
mov edi,[y_cursor]
and edx,0xffff0000
shr edi,0x10
xor esi,esi
or edx,edi
mov eax,47
add edx,8
mcall
call redraw_window
push dword menu_data_1 ;mouse event for Menu 1
call [menu_bar_mouse]
cmp [menu_data_1.click],dword 1
jne .menu_bar_2
cmp [menu_data_1.cursor_out],dword 0
jne .analyse_out_menu_1
jmp .menu_bar_1
.menu_bar_2:
push dword menu_data_2
call [menu_bar_mouse]
cmp [menu_data_2.click],dword 1
jne .menu_bar_3
cmp [menu_data_2.cursor_out],dword 0
jne .analyse_out_menu_2
jmp .menu_bar_1
.menu_bar_3:
push dword menu_data_3
call [menu_bar_mouse]
cmp [menu_data_3.click],dword 1
jne .scroll_bar
cmp [menu_data_3.cursor_out],dword 0
jne .analyse_out_menu_3
jmp .menu_bar_1
 
.set_mouse_flag:
xor eax,eax
inc eax
mov [menu_data_1.get_mouse_flag],eax
mov [menu_data_2.get_mouse_flag],eax
mov [menu_data_3.get_mouse_flag],eax
ret
 
.analyse_out_menu_1:
cmp [menu_data_1.cursor_out],dword 1
je open_dialog
cmp [menu_data_1.cursor_out],dword 2
je open_dialog_save ;save_file
cmp [menu_data_1.cursor_out],dword 3
je close_prog
jmp still
 
button: ; button
mov eax,17 ; get id
mcall
dec ah ;close programm button
.analyse_out_menu_2:
cmp [menu_data_2.cursor_out],dword 1
jne @f
close:
mov eax,-1 ; close this program
mcall
add [bytes_per_line],4
jmp redraw_all
@@:
dec ah
cmp [menu_data_2.cursor_out],dword 2
jne @f
call redraw_window
call menufile
jmp still
add [bytes_per_line],8
jmp redraw_all
@@:
dec ah ;menu 'coding' button
cmp [menu_data_2.cursor_out],dword 3
jne @f
call redraw_window
call menucoding
jmp still
cmp [bytes_per_line],4
je still
sub [bytes_per_line],4
jmp redraw_all
@@:
dec ah ;menu 'Help' button
jne @f
call redraw_window
call menuhelp
cmp [menu_data_2.cursor_out],dword 4
jne still
cmp [bytes_per_line],8
jbe still
sub [bytes_per_line],8
jmp redraw_all
 
.analyse_out_menu_3: ;analyse result of Menu 2
cmp [menu_data_3.cursor_out],dword 1
jne still
call create_help_window
jmp still
@@:
;now processed low_level menu buttons
;id m_open = 5
;id m_save = 6
;id m_exit = 7
;id m_win2dos 8
;id m_win2koi 9
;id m_win2iso 10
;id m_dos2win 11
;id m_dos2koi 12
;id m_dos2iso 13
;id m_help 14
;id m_about 15
dec ah ;open?
jne @f
cmp [o_s_flag],0 ;disable 'Open' if flag !=0
jnz no_open
; call redraw_window
mov [color],0x0072b9fc
call f2 ;set x_cursor & y_cursor for input filename
mov [o_s_flag],8 ;for output to filename area
no_open:
call redraw_window
 
.scroll_bar:
; mcall 37,2
; test eax,eax
; jnz @f
; btr [flags],5
; btr [flags],7
; jmp still
 
.mouse:
.vertical:
mcall 37,2
test eax,eax
jnz @f
btr [flags],5
btr [flags],7
jmp still
@@:
dec ah ;save?
jne @f
cmp [o_s_flag],1 ;enable save if flag = 1
jnz no_save
movzx ecx,[name_l] ;begin clear filename string
mov edi,filename
xor al,al
jecxz no_clear
clear:
mov [edi+ecx],al
loop clear
mov [name_l],al ;set filename length = 0
no_clear: ;ebd clear
call f2 ;set x_cursor & y_cursor for input filename
mov [o_s_flag],9 ;for output to filename area
no_save:
call redraw_window
jmp still
bt [flags],5
jc @f
bt [flags],7
jc .horizontal_0
 
mcall 37,1
shr eax,16
cmp ax,[scroll_bar_data_vertical.start_x]
jb .horizontal
sub ax,[scroll_bar_data_vertical.start_x]
cmp ax,[scroll_bar_data_vertical.size_x]
jge still
 
 
@@:
dec ah ;exit?
jne @f
jmp close
; cmp [scroll_bar_data_vertictal.delta2],0
; jne .horizontal
 
; mov eax,[scroll_bar_data_vertical.max_area]
; cmp eax,[scroll_bar_data_vertical.cur_area]
; jbe .horizontal
 
; mouse event for Vertical ScrollBar
mov edi,[screen_table]
mov edi,[edi]
cmp edi,[file_size]
jae still
push dword scroll_bar_data_vertical ;draw for Vertical ScrollBar
call [scrollbar_ver_mouse]
 
xor edx,edx
mov ebx,[scroll_bar_data_vertical.max_area]
sub ebx,[scroll_bar_data_vertical.cur_area]
mov eax,[file_size]
mov esi,[bytes_per_line]
mov ecx,[scroll_bar_data_vertical.position]
div esi
xor edx,edx
mul ecx
div ebx
mul esi
cmp eax,[file_size]
jng @f
sub eax,esi;[bytes_per_line]
@@:
dec ah ;m_win2dos?
jne @f
push dword WIN_TABLE
push dword DOS_TABLE
call coding
call redraw_window
jmp still
mov ecx,[cursor]
inc ecx
shr ecx,1
add ecx,eax
@@:
dec ah ;m_win2koi?
jne @f
push WIN_TABLE
push KOI_TABLE
call coding
call redraw_window
jmp still
cmp ecx,[file_size]
jle @f
sub ecx,esi;[bytes_per_line]
sub eax,esi;[bytes_per_line]
jmp @b
@@:
dec ah ;m_win2iso?
jne @f
push WIN_TABLE
push ISO_TABLE
call coding
call redraw_window
jmp still
mov [begin_offset],eax
bts [flags],5
 
mov eax,scroll_bar_data_vertical.redraw
xor ebx,ebx
; cmp [eax],ebx
; je @f
mov [eax],ebx
jmp red
;@@:
; cmp [scroll_bar_data_vertical.delta2],0
; jne still
.horizontal:
mov eax,[scroll_bar_data_horizontal.max_area]
cmp eax,[scroll_bar_data_horizontal.cur_area]
jbe .other
 
mcall 37,1
cmp ax,[scroll_bar_data_horizontal.start_y]
jb still
sub ax,[scroll_bar_data_horizontal.start_y]
cmp ax,[scroll_bar_data_horizontal.size_y]
jge still
 
; mouse event for Horizontal ScrollBar
.horizontal_0:
; mcall 37,2
; test eax,eax
; jnz @f
; btr [flags],5
; btr [flags],7
; jmp still
;@@:; bt [flags],7
; jc @f
 
; mcall 37,1
; shr eax,16
; cmp ax,[scroll_bar_data_vertical.start_x]
; jb .horizontal
; sub ax,[scroll_bar_data_vertical.start_x]
; cmp ax,[scroll_bar_data_vertical.size_x]
; jge still
;@@:
; mouse event for Vertical ScrollBar
 
mov eax,[ready_screen_buffer.string_size]
shr eax,1
cmp eax,[len_str_scr]
jle still
push dword scroll_bar_data_horizontal ;draw for Horizontal ScrollBar
call [scrollbar_hor_mouse]
 
xor edx,edx
mov eax,[scroll_bar_data_horizontal.position]
mov ebx,[ready_screen_buffer.string_size]
shr ebx,1
mul ebx
mov ebx,[scroll_bar_data_horizontal.max_area]
sub ebx,[scroll_bar_data_horizontal.cur_area]
div ebx
mov [beg_str_scr],eax
add eax,[len_str_scr]
mov ebx,[ready_screen_buffer.string_size]
shr ebx,1
cmp eax,ebx
jle @f
mov eax,[ready_screen_buffer.string_size]
shr eax,1
sub eax,[len_str_scr]
mov [beg_str_scr],eax
@@:
dec ah ;m_dos2win?
jne @f
push DOS_TABLE
push WIN_TABLE
call coding
call redraw_window
mov eax,scroll_bar_data_horizontal.redraw
xor ebx,ebx
cmp [eax],ebx
je .other
mov [eax],ebx
; call draw_window
call main_area
bts [flags],7
jmp still
@@:
dec ah ;m_dos2koi?
jne @f
push DOS_TABLE
push KOI_TABLE
call coding
call redraw_window
.other:
; cmp [scroll_bar_data_vertical.delta2],0
; jne still
; cmp [scroll_bar_data_horizontal.delta2],0
; jne still
jmp still
 
 
 
;------------------------------------------------
 
;------------------------------------------------
 
 
align 4
ready_screen_buffer:
mov [.fl],0
mov esi,[screen_table]
add esi,4
mov ecx,[number_strings]
mov [.number_strings],cx
push [cursor]
pop [.cursor]
push [file_size]
pop [.length_to_end]
mov edi,[begin_offset]
 
mov [.shblock_end],0
mov [.shblock_beg],0
bt [flags],8
jnc @f
mov eax,[shblock_beg]
add eax,[file_buffer]
mov [.shblock_beg],eax
mov eax,[shblock_end]
add eax,[file_buffer]
mov [.shblock_end],eax
@@:
dec ah ;dos2iso?
jne @f
push DOS_TABLE
push ISO_TABLE
call coding
call redraw_window
jmp still
mov [.offset],edi
sub [.length_to_end],edi
jz .pre_next_string
add edi,[file_buffer]
 
.next_string:
mov word [esi],0x2020
add esi,2
mov eax,0x20302030
mov dword [esi],eax
mov dword [esi+4],eax
mov dword [esi+8],eax
mov dword [esi+12],eax
push edi
mov ecx,8
mov edi,[.offset]
@@:
dec ah ;m_help?
jne @f
;create new thread for output help info
;parameter: address for entry_point thread
push help_thread
call create_process
call redraw_window
jmp still
mov eax,edi
and eax,0xF
cmp al,10
sbb al,69h
das
mov [esi+ecx*2-2],al
shr edi,4
loop @b
mov word [esi+16],0x203a ;¤¢®¥â®ç¨¥
mov eax,[bytes_per_line]
add [.offset],eax
mov [.string_size],2+4*4+4+2
add esi,4*4+4+2
pop edi
mov [.temp],edi
push [.cursor]
pop [.cursor_temp]
 
;hex §­ ç¥­¨ï
mov dword [esi-4],0x20202020
 
mov edx,[bytes_per_line]
.next_group:
mov ecx,[group_bytes]
 
.next_byte:
mov al,[edi]
ror ax,4
cmp al,10
sbb al,69h
das
mov [esi],al
mov byte [esi+1],0x20
cmp edi,[.shblock_end]
ja @f
cmp edi,[.shblock_beg]
jl @f
mov byte [esi+1],(0x20+3*4)
@@:
dec ah ;m_about?
jne @f
;create new thread for output about info
;parameter: address for entry_point thread
push about_thread
call create_process
call redraw_window
jmp still
dec [.cursor]
jnz @f
mov byte [esi+1],(0x20+2*4)
@@:
;button 'Go'
and [o_s_flag],1
jnz _savefile
;open file
mov eax,6
mov ebx,filename
xor ecx,ecx
or edx,-1
mov esi,0x10000
shr ax,16-4
cmp al,10
sbb al,69h
das
mov [esi+2],al
mov byte [esi+3],0x20
cmp edi,[.shblock_end]
ja @f
cmp edi,[.shblock_beg]
jl @f
mov byte [esi+3],(0x20+3*4)
@@:
dec [.cursor]
jnz @f
mov byte [esi+3],(0x20+2*4)
@@:
mov word [esi+4],0x2020
add [.string_size],6
add esi,6
inc edi
dec [.length_to_end]
jz .to_null
dec ecx
jz @f
dec edx
jnz .next_byte
jz .ascii
@@:
mov word [esi],0x2020
add esi,2
add [.string_size],2
dec edx
jnz .next_group;byte
sub esi,2
sub [.string_size],2
jz .ascii
.ascii:
push edi
mov edi,[.temp]
mov word [esi],0x2020
mov ebx,[.cursor_temp]
add esi,2
add [.string_size],2
mov ecx,[bytes_per_line]
@@:
mov al,[edi]
mov [esi],al
mov byte [esi+1],0x20
dec ebx
jnz .s1
mov byte [esi+1],(0x20+3*4)
.s1:
dec ebx
jnz .s2
mov byte [esi+1],(0x20+3*4)
.s2:
inc edi
add esi,2
add [.string_size],2
loop @b
pop edi
mov edx,[bytes_per_line]
dec [.number_strings]
jnz .next_string
ret
 
.fl db 0
.fl_buf dd 0
.to_null:
dec [.fl]
mov [.fl_buf],edi
jmp .pre_next_byte0
 
.pre_next_string:
mov word [esi],0x2020
add esi,2
mov eax,0x20302030
mov dword [esi],eax
mov dword [esi+4],eax
mov dword [esi+8],eax
mov dword [esi+12],eax
mov ecx,8
mov edi,[.offset]
@@:
mov eax,edi
and eax,0xF
cmp al,10
sbb al,69h
das
mov [esi+ecx*2-2],al
shr edi,4
loop @b
mov word [esi+16],0x203a ;¤¢®¥â®ç¨¥
mov eax,[bytes_per_line]
add [.offset],eax
mov [.string_size],2+4*4+4+2
add esi,4*4+4+2
push [.cursor]
pop [.cursor_temp]
 
;hex §­ ç¥­¨ï
mov dword [esi-4],0x20202020
 
mov edx,[bytes_per_line]
.pre_next_group:
mov ecx,[group_bytes]
 
.pre_next_byte:
mov dword [esi],0x20202020
dec [.cursor]
jnz @f
mov byte [esi+1],(0x20+2*4)
@@:
dec [.cursor]
jnz @f
mov byte [esi+3],(0x20+2*4)
@@:
mov word [esi+4],0x2020
add [.string_size],6
add esi,6
.pre_next_byte0:
dec ecx
jz @f
dec edx
jnz .pre_next_byte
jz .pre_ascii
@@:
mov word [esi],0x2020
add esi,2
add [.string_size],2
dec edx
jnz .pre_next_group;byte
sub esi,2
sub [.string_size],2
jz .pre_ascii
 
.pre_ascii:
mov word [esi],0x2020
add esi,2
add [.string_size],2
mov ecx,[bytes_per_line]
cmp [.fl],0 ;¯à®¢¥àª  ä« £ 
jne .last_ascii
mov ebx,[.cursor_temp]
@@:
mov word [esi],0x2020
dec ebx
jnz .ps1
mov byte [esi+1],(0x20+3*4)
.ps1:
dec ebx
jnz .ps2
mov byte [esi+1],(0x20+3*4)
.ps2:
add esi,2
add [.string_size],2
.1:
loop @b
mov edx,[bytes_per_line]
dec [.number_strings]
jnz .pre_next_string
ret
 
;ª®à४⭮ ®¡à ¡ â뢠¥¬ 䨭 «ì­ãî áâபã ä ©« , ¤«¨­  ª®â®à®© ¢ à¨ â¨¢­ 
.last_ascii:
mov ebx,[.fl_buf]
sub ebx,[.temp]
sub ecx,ebx
mov edi,[.temp]
mov [.fl],0
@@:
mov al,[edi]
mov [esi],al
mov byte [esi+1],0x20
dec [.cursor_temp]
jnz .la1
mov byte [esi+1],(0x20+3*4)
.la1:
dec [.cursor_temp]
jnz .la2
mov byte [esi+1],(0x20+3*4)
.la2:
inc edi
add esi,2
add [.string_size],2
dec ebx
jnz @b
inc ecx
jmp .1
 
.string_size dd 16
.number_strings dw 0
.length_to_end dd 0
.temp dd 0
.offset dd 0
.cursor dd 0
.cursor_temp dd 0
.shblock_beg dd 0
.shblock_end dd 0
 
 
align 4
main_area:
mov ecx,[number_strings]
mov [.number_strings],cx
push [len_str_scr]
pop [.len_str_scr]
mov eax,[ready_screen_buffer.string_size]
shr eax,1
mov [.string_size],eax
mov edi,[screen_table]
mov edi,[edi]
cmp [file_size],edi
jbe .4
xor edx,edx ;¯®«§ã­®ª
mov ebx,[scroll_bar_data_vertical.max_area]
sub ebx,[scroll_bar_data_vertical.cur_area]
mov ecx,[file_size]
mov eax,[current_offset]
test eax,eax
jnz .3
inc eax
.3:
mul ebx
test ecx,ecx
jnz .5
inc ecx
.5:
div ecx
mov [scroll_bar_data_vertical.position],eax
 
mcall 37,2 ;ª¯®¯ª  ¬ëè¨ ­ ¦ â  - ­¥â á¬ëá«  ¯¥à¥à¨á®¢ë¢ âì ScrollBar
test eax,eax
jnz .4
push dword scroll_bar_data_vertical
call [scrollbar_ver_mouse]
 
push dword scroll_bar_data_vertical ;draw for Vertical ScrollBar
call [scrollbar_ver_draw]
 
; push dword scroll_bar_data_vertical ;draw for Vertical ScrollBar
; call [scrollbar_ver_draw]
 
; xor eax,eax
; inc eax
; mov [scroll_bar_data_vertical.all_redraw],eax
; push dword scroll_bar_data_vertical ;draw for Vertical ScrollBar
; call [scrollbar_ver_draw]
; xor eax,eax ;reset all_redraw flag
; mov [scroll_bar_data_vertical.all_redraw],eax
 
.4:
mov esi,0x000001 ;梥⠨ ç¨á«® ¡¨â ­  ¯¨ªá¥«ì
mov edx,FIRST_HEX ;ª®®à¤¨­ âë ¯¥à¢®£® hex
call show_current_offset
mov edi,[screen_table]
add edi,4
mov ecx,[beg_str_scr]
sub [.string_size],ecx
shl ecx,1
add edi,ecx
.out:
push edi
movzx ebx,byte [edi]
cmp bl,128 ;¯à®¢¥àª  ­  ¯à¨­ ¤«¥¦­®áâì ᨬ¢®«  ª à áè¨à¥­­®© â ¡«¨æ¥
jb .7
add ebx,[codepage_offset]
.7:
movzx edi,byte [edi+1]
lea edi,[(edi*2-0x40)]
add edi,palitra
shl bx,4
add ebx,font_buffer
mov ecx,8*65536+16
mov ebp,0
mcall 65
pop edi
 
add edi,2
add edx,8*65536
 
dec [.len_str_scr]
jz .loop_str
dec [.string_size]
jz .next_string
 
push edi
movzx ebx,byte [edi]
cmp bl,128
jb .8
add ebx,[codepage_offset]
.8:
movzx edi,byte [edi+1]
lea edi,[(edi*2-0x40)]
add edi,palitra
shl bx,4
add ebx,font_buffer
mcall
inc [o_s_flag]
mov [sizefile],eax
jmp end_Go
_savefile:
;save file
mcall 70,writeinfo
end_Go:
call CtrlHome
jmp still
pop edi
 
Right:
add edi,2
add edx,8*65536
 
dec [.len_str_scr]
jz .loop_str
dec [.string_size]
jnz .out
jz .next_string
 
.string_size dd 0
.number_strings dw 0
.len_str_scr dd 0
 
@@:
pushad
mov al,[posx]
inc al
cmp al,0x20
jl @f
mov [posx],0
mov [x_cursor],0x680005
mov [text_cursor],0x01200000
sub [current],0xf ;because [current] add 0x10 in LnDn
call LnDn
mov ecx,edx
shl ecx,16
mov ebx,edx
shr ebx,16
cmp bx,[scroll_bar_data_vertical.start_x]
jge .ls1
mov ax,[scroll_bar_data_vertical.start_x]
sub ax,bx
shl ebx,16
mov bx,ax
mov cx,16
mcall 13,,,frgrd_color
.ls1:
popad
ret
jmp @f
.loop_str:
bt [flags],6
jc @b
@@:
mov [posx],al
and al,1
jnz @f ;not increment [current]
;increment
add [x_cursor],0xa0000
sub [text_cursor],0x40000
inc [current]
jmp end_r
@@:
add [x_cursor],0x60000
sub [text_cursor],0x60000
end_r:
call redraw_window
dec [.string_size]
jz .next_string
add edi,2
add edx,8*65536
jmp @b
 
@@:;®ç¨á⪠ ä®­®¢ë¬ 梥⮬ ­¥§ ªà è¥­­ëå ®¡« á⥩
pushad
ror edx,16
mov dx,16
mov ecx,edx
mov edx,frgrd_color
movzx ebx,[scroll_bar_data_vertical.start_x]
sub ecx,2*65536
mov cx,2
mcall 13
popad
ret
 
Left:
pushad
mov al,[posx]
dec al
jge @f
mov [posx],0x1f
mov [x_cursor],0x015e0005
mov [text_cursor],0x00840000
add [current],0x0f
call LnUp
mov ecx,edx
shl ecx,16
mov ebx,edx
shr ebx,16
cmp bx,[scroll_bar_data_vertical.start_x]
jge .10
mov ax,[scroll_bar_data_vertical.start_x]
sub ax,bx
shl ebx,16
mov bx,ax
mov cx,16
mcall 13,,,frgrd_color
.10:
popad
ret
jmp @f
.next_string:
bt [flags],6
jc @b
@@:
mov [posx],al
and al,1
jnz @f ;decrement [current]
;not decrement
sub [x_cursor],0x60000
add [text_cursor],0x60000
jmp end_l
push [len_str_scr]
pop [.len_str_scr]
mov eax,[ready_screen_buffer.string_size]
shr eax,1
mov [.string_size],eax ;ª®à४æ¨ï ᬥ饭¨ï ¢å®¤­ëå ¤ ­­ëå
mov ecx,[beg_str_scr]
sub [.string_size],ecx
sub eax,ecx
shl ecx,1
add edi,ecx
 
shl eax,19
sub edx,eax
add edx,18
dec [.number_strings]
jnz .out
btr [flags],6
jmp end_draw
 
 
align 4
show_current_offset:
pushad
push edx ;¢ë¢®¤ ⥪ã饣® ᬥ饭¨ï ¢ ä ©«¥
mov edi,palitra.5
mov eax,[begin_offset]
mov ebx,[cursor]
dec ebx
shr bx,1
add ebx,eax
mov [current_offset],ebx
mov edx,[low_area]
lea eax,[8*8+8+8]
shl eax,16
add edx,eax
mov ecx,8
call hex_output
lea eax,[8*8+14]
shl eax,16
add edx,eax
push edx
;¤¢®¨ç­®¥ §­ ç¥­¨¥ ¡ ©â 
mov edx,[file_buffer]
add edx,ebx;[current_offset]
xor eax,eax
cmp ebx,[file_size]
jae @f
mov al,[edx]
@@:
cmp [current],0
jle end_l
sub [x_cursor],0xa0000
add [text_cursor],0x40000
dec [current]
end_l:
call redraw_window
mov bx,2
mov ebp,8
xor ecx,ecx
xor edx,edx
@@:
div bx
or cl,dl
ror ecx,4
dec ebp
jnz @b
mov ebx,ecx
pop edx
mov ecx,8
call hex_output
 
;¤¥áïâ¨ç­®¥
push edx
mov edx,[file_buffer]
mov ebx,[current_offset]
add edx,ebx
xor eax,eax
inc ebx
cmp ebx,[file_size] ;0 ¥á«¨ §  £à ­¨æ¥© ä ©« 
jb @f
mov edx,D_END
@@:
mov al,[edx]
xor ebx,ebx
; mov ebp,3
mov cl,10
@@:
div cl
mov bl,ah
xor ah,ah
shl ebx,8
test al,al
; dec ebp
jnz @b
shr ebx,8
cmp byte [edx],100
jb .1
mov ebp,3
jmp @f
.1:
mov ebp,1
cmp byte [edx],10
jb @f
mov ebp,2
@@:
mov al,bl
shr ebx,8
cmp al,10
sbb al,69h
das
shl eax,8
; test bx,bx
dec ebp
jnz @b
 
mov ecx,8*65536+16
pop edx
add edx,(8*8+30)*65536;268*65536
mov edi,palitra.5
mov ebp,0
push dword 3
@@:
shr eax,8
xor ebx,ebx
mov bl,al
shl ebx,4
add ebx,font_buffer
push eax
mcall 65
pop eax
sub edx,8*65536
dec dword [esp]
jnz @b
add esp,4
; mov edx,[low_area] ;¢ë¢®¤ esp
; add edx,298*65536
; mov ebx,esp
; mov ecx,8
; call hex_output
pop edx
popad
ret
 
LnDn:
 
align 4
hex_output: ;¢ë¢®¤ hex áâப¨ ¨§ 8 ᨬ¢®«®¢
pushad
add [current],0x10
movzx ecx,[lines]
cmp cl,[posy]
jl @f ;when counter strings >= number strings in window
add [y_cursor],0xa0000
inc [posy]
call redraw_window
mov edi,(hex8_string) ; ¤à¥á ¡ãä¥à 
mov dword [edi],0x30303030
mov dword [edi+4],0x30303030
push ecx
.1:
mov eax,ebx
and eax,0xF
cmp al,10
sbb al,69h
das
mov [edi+ecx-1],al
shr ebx,4
loop .1
mov ecx,8*65536+16
.2:
push edi
xor ebx,ebx
mov al,[edi]
shl eax,4
add eax,font_buffer
xchg eax,ebx
mov edi,palitra.5
mov ebp,0
mcall 65
add edx,8*65536
pop edi
inc edi
dec dword [esp]
jnz .2
add esp,4
popad
ret
;------------------------------------------------------
align 4
input_from_keyboard:
xor al,al
sub ah,48
cmp ah,9
jle .1
sub ah,7
cmp ah,15
jle .1
sub ah,32
.1:
bt [flags],1
jnc .2
mov ebx,[cursor]
and bl,1
jz .2
inc [file_size]
call raspred_mem
mov edi,[current_offset]
add edi,[file_buffer]
mov esi,[file_buffer]
add esi,[file_size]
dec esi
@@:
mov eax,0x10
cmp edi,esi
ja @f
mov bl,[esi]
mov [esi+1],bl
dec esi
jmp @b
@@:
call show_file_size
mov ebx,[current_offset]
add ebx,[file_buffer]
mov byte [ebx],0
.2:
mov ecx,[current_offset]
add ecx,[file_buffer]
;á¬. ¯¥à¢ãî ¢¥àá¨î heed.asm
mov dl,[ecx] ;®à¨£¨­ «ì­ë© ¡ ©â
mov ebx,[cursor]
and bl,1 ;­¥ç¥â - । ªâ¨à㥬 áâ à訩 ¯®«ã¡ ©â
jnz .hi_half_byte ;çñâ - áâ à訩
and dl,0xf0 ;®¡­ã«ï¥¬ ¬«. ¯-¡ ©â ®à¨£¨­ «ì­®£® ¡ ©â 
jmp .patch_byte
.hi_half_byte: ;®¤­®¢à¥¬¥­­® ᤢ¨£ ¥¬ ­ã¦­®¥ §­ ç¥­¨¥ ¢ áâ ¯-â ¨ ®¡­ã«ï¥¬ ¬« ¤è¨©
shl ax,4
and dl,0x0f ;®¡­ã«ï¥¬ áâ à訩 ¯®«ã¡ ©â 㠮ਣ¨­ «ì­®£® ¡ ©â 
.patch_byte:
or ah,dl
mov [ecx],ah
jmp RIGHT
 
raspred_mem:
pushad
xor edx,edx
imul ecx
sub eax,0x10
sub [end_str],eax
; mov eax,[sizefile]
; add eax,0x80000
; cmp eax,[end_str]
; jge @f
; mov [end_str],eax
; @@:
call draw_window
mov ecx,4096
mov eax,[file_size]
inc eax
div ecx
cmp eax,[prev_f_size_bl]
ja @f
je .ret
cmp [file_size],4096
jbe .ret
mov [prev_f_size_bl],eax
xor edx,edx
mul ecx
mov ecx,eax
jmp .1
@@:
mov [prev_f_size_bl],eax
xor edx,edx
mul ecx
add ecx,eax
.1:
mcall 68,20,,[file_buffer]
.ret:
popad
ret
;---------------------------------------
 
LnUp:
pushad
sub [current],0x10
cmp [current],0
align 4
show_file_size:
mov ebx,[file_size]
mov edx,[low_area];
mov esi,1
mov ecx,8
call hex_output
ret
 
 
align 4
draw_window:
mcall 0,100*65536+653,100*65536+360,((0x73 shl 24) + frgrd_color),,title
mcall 9,threath_buf,-1
cmp byte [threath_buf+70],3 ;®ª­® á¢ñà­ãâ® ¢ § £®«®¢®ª?
jnae @f
.@d:
call end_draw
add esp,4
jmp still
@@:
cmp dword [threath_buf+66],(24*4) ;¯à®¢¥àª  ¬¨­¨¬ «ì­®© ¢ëá®âë
jae @f
mov esi,dword [threath_buf+46]
sub esi,dword [threath_buf+66]
add esi,24*4
mcall 67,-1,-1,-1,
jmp .@d
@@:
cmp dword [threath_buf+62],(26*6) ;¯à®¢¥àª  ¬¨­¨¬ «ì­®© è¨à¨­ë
jae @f
mov edx,dword [threath_buf+42]
sub edx,dword [threath_buf+62]
add edx,26*6
mcall 67,-1,-1,,-1
jmp .@d
@@:
mov eax,[file_size]
mov ebx,[bytes_per_line]
xor edx,edx
div ebx
mov [scroll_bar_data_vertical.size_x],0
cmp eax,[number_strings]
jl @f
mov [scroll_bar_data_vertical.size_x],scroll_width_size
@@:
mov eax,dword [threath_buf+62] ;è¨à¨­  ª«¨¥­â᪮© ®¡« áâ¨
sub ax,[scroll_bar_data_vertical.size_x]
mov [scroll_bar_data_vertical.start_x],ax
mov eax,dword [threath_buf+66] ;¢ëá®â  ª«¨¥­â᪮© ®¡« áâ¨
sub eax,24+24-11
mov [scroll_bar_data_vertical.size_y],ax
mov ebx,eax
push eax
add ebx,20
mov [scroll_bar_data_vertical.max_area],ebx
mov ebx,[scroll_bar_data_vertical.btn_high]
shl ebx,1
add ebx,20
mov [scroll_bar_data_vertical.cur_area],ebx
pop eax
sub eax,3
mov ebx,18
xor edx,edx
div bx
mov [number_strings],eax ;ª®«-¢® hex áâப ¢ ®ª­¥
mov ebx,[bytes_per_line]
mul ebx
mov edi,[screen_table] ;ª®«-¢® ¡ ©â®¢ ¤«ï ¢ë¢®¤ 
mov dword [edi],eax
 
push eax
 
mov ebx,dword [threath_buf+62]
inc ebx
mov ecx,(FIRST_HEX-18)
ror ecx,16
mov cx,18
ror ecx,16
mcall 13,,,frgrd_color ;¯®«®á  ᢥàåã
 
mcall ,,18,panel_clr1 ;¢¥àå­ïï ¯ ­¥«ì
 
dec ebx
mcall 38,,<18,18>,panel_clr2
mov ecx,dword [threath_buf+66]
sub cx,18
push cx
shl ecx,16
pop cx
mcall ,,,panel_clr3 ;­¨¦­ïï ¯ ­¥«ì
add ecx,1*65536
mov cx,18
; inc ebx
mcall 13,,,panel_clr1
 
 
mov eax,dword [threath_buf+62]
sub eax,scroll_width_size
shr eax,3 ;div 8
mov [len_str_scr],eax
 
 
mov eax,[len_str_scr]
shl eax,1
cmp eax,[ready_screen_buffer.string_size]
jae @f
 
mov edi,[screen_table]
mov eax,[bytes_per_line]
sub dword [edi],eax
dec [number_strings]
 
@@:
shr ecx,16
mov edx,ecx
mov ecx,(FIRST_HEX)
shr ecx,16
mov eax,[number_strings]
lea ebx,[eax*8];*18
lea ebx,[ebx*2]
lea eax,[eax*2]
add eax,ebx
add cx,ax
add cx,21
sub dx,cx
shl ecx,16
add cx,dx
sub ecx,1*65536
movzx ebx, word [scroll_bar_data_vertical.start_x]
mcall 13,,,frgrd_color
 
pop eax
 
cmp eax,[file_size]
jge @f
mov [current],0
; push dword scroll_bar_data_vertical
; call [scrollbar_ver_mouse]
xor eax,eax
inc eax
mov [scroll_bar_data_vertical.all_redraw],eax
push dword scroll_bar_data_vertical ;draw for Vertical ScrollBar
call [scrollbar_ver_draw]
xor eax,eax ;reset all_redraw flag
mov [scroll_bar_data_vertical.all_redraw],eax
@@:
cmp [posy],3
jle @f ;when counter strings < number top string
sub [y_cursor],0xa0000
dec [posy]
call redraw_window
popad
ret
push dword menu_data_1 ;draw for Menu 1
call [menu_bar_draw]
push dword menu_data_2 ;draw for Menu 2
call [menu_bar_draw]
push dword menu_data_3 ;draw for Menu 3
call [menu_bar_draw]
 
;;;
 
mov eax,dword [threath_buf+66]
add eax,8*65536-15
mov [low_area],eax
 
mov ebx,[beg_str_scr]
mov [beg_str_scr],0
mov eax,[len_str_scr]
shl eax,1
cmp eax,[ready_screen_buffer.string_size]
jae @f
 
mov [beg_str_scr],ebx
movzx eax,word [threath_buf+66]
sub eax,34
mov [scroll_bar_data_horizontal.start_y],ax
 
;cur_area/(size_x-30)=len_str_scr/string_size
 
mov eax,dword [threath_buf+62]
sub ax,[scroll_bar_data_vertical.size_x]
mov [scroll_bar_data_horizontal.size_x],ax
sub eax,[scroll_bar_data_horizontal.btn_high]
sub eax,[scroll_bar_data_horizontal.btn_high]
mov [scroll_bar_data_horizontal.max_area],eax
xor edx,edx
mov ebx,[len_str_scr]
mul ebx
mov ebx,[ready_screen_buffer.string_size]
shr ebx,1
div ebx
mov [scroll_bar_data_horizontal.cur_area],eax
 
push dword scroll_bar_data_horizontal ;draw for Horizontal ScrollBar
call [scrollbar_hor_mouse]
xor eax,eax
inc eax
mov [scroll_bar_data_horizontal.all_redraw],eax
push dword scroll_bar_data_horizontal ;draw for Vertical ScrollBar
call [scrollbar_hor_draw]
xor eax,eax ;reset all_redraw flag
mov [scroll_bar_data_horizontal.all_redraw],eax
@@:
; movzx ecx,[lines]
; mov eax,0x10
; xor edx,edx
; imul ecx
; add eax,0x10
sub [end_str],0x10
cmp [end_str],0x10000
mov eax,[low_area]
mov edi,[screen_table]
mov esi,[bytes_per_line]
mov ecx,esi
shl ecx,1
mov eax,[edi]
mov ebx,[cursor]
inc ebx
shr ebx,1
@@:
cmp eax,ebx
jge @f
mov [end_str],0x10000
add [begin_offset],esi
sub [cursor],ecx
sub ebx,esi
jmp @b
@@:
call redraw_window
popad
bts [flags],6
ret
 
CtrlEnd:
pushad
popad
align 4
start_draw:
mcall 12,1
ret
 
CtrlHome:
pushad
mov [x_cursor],0x00680005 ;ãáâ ­ ¢«¨¢ îâáï §­ ç¥­¨ï, ª ª ¯à¨ ®âªàë⨨
mov [y_cursor],0x00280008
mov [text_cursor],0x01200000
mov [posx],0
mov [posy],3
call b_in_screen
mov [end_str],0x10000
mov [current],0
call redraw_window
popad
end_draw:
mcall 12,2
ret
 
_End:
pushad
mov [x_cursor],0x015e0005
mov [posx],0x1f
mov [text_cursor],0x00840000
or [current],0xf
call b_in_screen
call redraw_window
popad
close_prog:
mcall -1
;-------------------------------------------------------------------------------
change_codepage: ;¬¥­ï¥¬ ¢â®àãî ¯®«®¢¨­ã â ¡«¨æë
test ah,ah
jnz @f
btc [flags],4
jc .1
push [codepage_offset]
pop [codepage_offset_previous]
mov [codepage_offset],2*128
jmp .end
.1:
push [codepage_offset_previous]
pop [codepage_offset]
jmp .end
@@:
cmp [codepage_offset],0
jne @f
add [codepage_offset],128
jmp .end
@@:
mov [codepage_offset],0
.end:
call show_codepage
jmp red
 
show_codepage:
mov ebp,6
mov edx,dword [threath_buf+62]
sub edx,73
shl edx,16
add edx,[low_area]
mov edi,string_cp866
cmp [codepage_offset],0
je @f
add edi,6
cmp [codepage_offset],128
je @f
add edi,6
@@:
mov ecx,8*65536+16
mov esi,1
push ebp
mov ebp,0
@@:
xor ebx,ebx
push edi
mov bl,[edi]
shl bx,4
add ebx,font_buffer
mov edi,palitra.5
mcall 65
add edx,8*65536
pop edi
inc edi
dec dword [esp]
jnz @b
add esp,4
ret
 
Home:
show_insert: ;®â®¡à ¦¥­¨¥ ०¨¬  ¢áâ ¢ª¨/§ ¬¥­ë
mov ebp,3
mov edx,dword [threath_buf+62]
sub edx,120
shl edx,16 ; mov edx,428*65536+335
add edx,[low_area]
mov edi,string_ins
push ebp
mov ecx,8*65536+16
mov esi,1
mov ebp,0
.1:
xor ebx,ebx
push edi
bt [flags],1
jnc .2
mov bl,[edi]
shl bx,4
.2:
add ebx,font_buffer
mov edi,palitra.5
mcall 65
add edx,8*65536
pop edi
inc edi
dec dword [esp]
jnz .1
add esp,4
ret
;-------------------------------------------------------------------------------
;help window
create_help_window:
pushad
mov [x_cursor],0x00680005 ;ãáâ ­ ¢«¨¢ îâáï §­ ç¥­¨ï ¤«ï ­ ç «  áâப¨
mov [posx],0
mov [text_cursor],0x01200000
and [current],0xfffffff0
call b_in_screen
call redraw_window
mcall 51,1,.thread,(.threat_stack+16*4)
popad
ret
.thread:
call .window
.still:
mcall 10
dec al
jz .red
dec al
jz .key
dec al
jz .button
jmp .still
mcall -1
.button:
mcall 17,1
cmp ah,1
jne @f
mcall -1
@@:
cmp ah,2
jne @f
mov edi,(help_end-help_text)/51
movzx eax,[cur_help_string]
sub edi,13
sub edi,eax
jz .still
inc [cur_help_string]
jmp .red
@@:
cmp ah,3
jne .still
cmp [cur_help_string],0
je .still
dec [cur_help_string]
jmp .red
 
PgDn:
.key:
mcall 2
jmp .still
 
.red:
call .window
jmp .still
 
.window:
pushad
mcall 12,1
mcall 0,50*65536+320,0x70*65536+240,0x13000000,,help_but_text
mcall 8,<130,20>,<6,12>,2,0xaaaaaa
mcall ,<150,20>,,3,
mov ebx,8*65536+15
mov ecx,0x00DDDDDD
xor edx,edx
movzx ecx,[lines]
mov eax,0x10
imul ecx
add [current],eax
add [end_str],eax
call redraw_window
movzx eax,byte [cur_help_string]
mov edi,(help_end-help_text)/51
sub edi,eax
mov esi,51
mul si
mov edx,help_text
add edx,eax
mov eax,4
@@:
add ebx,0x10
mcall
add edx,51
dec edi
jnz @b
mcall 12,2
popad
ret
 
PgUp:
pushad
xor edx,edx
movzx ecx,[lines]
mov eax,0x10
imul ecx
sub [current],eax
cmp [current],0
jge @f
mov [current],0
.threat_stack: times 16 dd 0
;-------------------------------------------------
 
open_file:
mov dword [ed_box_data],1
mov dword [ed_box_data+4],edit1
call draw_ed_box ;à¨á㥬 editbox
;à §¬¥à ä ©« ?
.0:
mov [func_70.func_n],5
mov [func_70.param1],0
mov [func_70.param2],0
mov [func_70.param3],0
mov [func_70.param4],bufferfinfo
mov [func_70.rezerv],0
mov [func_70.name],file_name
mcall 70,func_70
 
test al,al ;ä ©« ­ ©¤¥­?
jz @f
mcall 4,400*65536+31,0x80CC0000,error_open_file_string
jmp open_file
@@:
sub [end_str],eax
cmp [end_str],0x10000
jge @f
; call CtrlHome
mov [end_str],0x10000
; mov edx,[blocks_counter]
; mov edi,[blocks_table]
; @@: mov ecx,[edi] ;¢ë᢮¡®¦¤ ¥¬:
; mcall 68,13 ;¡«®ª¨ ä ©« 
; add edi,8
; dec edx
; jnz @b
; mcall 68,13,[blocks_table] ;â ¡«¨æã
 
mov eax, dword [bufferfinfo+32] ;ª®¯¨à㥬 à §¬¥à ä ©« 
mov [file_size],eax
 
; mov ebx,65536 ;64Š ¡«®ª
; xor edx,edx
; div ebx
; push dx ;¤«¨­  ¯®á«¥¤­¥£® ¡«®ª 
; test dx,dx
; jz @f
; inc eax
; @@: test eax,eax
; jnz @f
; inc eax
; @@: mov [blocks_counter],eax
; sal eax,3;*8 ;à §¬¥à â ¡«¨æë á ¨­¤¥ªá ¬¨ ¡«®ª®¢
;; add eax,32 ;à¥è ¥¬ ¯à®¡«¥¬ã á 32Œ ä ©« ¬¨
 
; mov ecx,eax ;¢ë¤¥«ï¥¬ ¯ ¬ïâì:
; mcall 68,12 ;¯®¤ â ¡«¨æã
; mov [blocks_table],eax
; mov edi,eax
; mov ecx,[blocks_counter]
; @@: mov dword [edi+4],65536
; add edi,8
; loop @b
; xor edx,edx
; pop dx ;¤«¨­  ¯®á«¥¤­¥£® ¡«®ª 
; mov dword [edi-4],edx
 
; mov edx,[blocks_counter]
; mov edi,[blocks_table]
;@@: mcall 68,12,[edi+4] ;¯®¤ ¡«®ª
; mov [edi],eax
; add edi,8
; dec edx
; jnz @b
 
mcall 68,13,[file_buffer]
test eax,eax
jnz @f
;§¤¥áì ®è¨¡ª  ­  ­¥ ®á¢®¡®¦¤¥­¨¥ ¡«®ª 
@@:
call redraw_window
popad
mcall 68,12,[file_size]
mov [file_buffer],eax
 
;;¨¬¥¥¬ â ¡«¨æã: [ DWORD 㪠§ â¥«ì ­  ¯¥à¢ë© í«¥¬¥­â ¡«®ª  : DWORD ¤«¨­  ¡«®ª  ]
 
; mov ecx,[blocks_counter] ;®âªà뢠¥¬ ä ©«
; mov edi,[blocks_table]
mov [func_70.func_n],0
mov [func_70.param1],0
mov [func_70.param2],0
mov [func_70.rezerv],0
mov [func_70.name],file_name
;@@:
push dword [file_size];dword [edi+4]
pop dword [func_70.param3]
push dword [file_buffer];dword [edi]
pop dword [func_70.param4]
mcall 70,func_70
; add edi,8
; add dword [func_70.param1],65536
; loop @b
 
test eax,eax
jz @f
;®è¨¡ª  ç⥭¨ï
@@:
call Ctrl_HOME
 
jmp redraw_all
;-------------------------------------------------------------------------------
open_dialog_save:
call get_filter_data
mov [OpenDialog_data.type],1 ; Save
start_OpenDialog OpenDialog_data
cmp [OpenDialog_data.status],2 ; OpenDialog does not start
; je .sysxtree ; some kind of alternative, instead OpenDialog
je save_file
cmp [OpenDialog_data.status],1
jne still
mov esi,fname_buf
mov edi,file_name
cld
@@:
cmp byte [esi],0
je @f
movsb
jmp @b
@@:
mov byte [edi],0
sub esi,path
mov [edit1.size],esi
mov [edit1.pos],esi
jmp save_file.1
;-------------------------------------------------------------------------------
save_file: ;á®å࠭塞 ä ©«
mov dword [ed_box_data],1
mov dword [ed_box_data+4],edit1
call draw_ed_box
.1:
mov [func_70.func_n],2
mov [func_70.param1],0
mov [func_70.param2],0
push [file_size]
pop [func_70.param3]
push [file_buffer]
pop [func_70.param4]
mov [func_70.rezerv],0
mov [func_70.name],file_name
mcall 70,func_70
cmp al,0 ;á®åà ­ñ­ 㤠筮?
je redraw_all
mcall 4,400*65536+31,0x80CC0000,error_save_file_string
jmp save_file
;-------------------------------------------------------------------------------
draw_ed_box: ;à¨á®¢ ­¨¥ edit box' 
.1:
push eax ebx ecx edx
mcall 13,180*65536+220,25*65536+70,0xaaaaaa
bt [flags],9
jnc @f
mcall 4,246*65536+35,0x80ffffff,sel_text
@@:
bt [flags],2
jnc @f
push dword Option_boxs
call [option_box_draw]
@@:
bt [flags],3
jnc @f
push dword Option_boxs2
call [option_box_draw]
@@:
mov eax,ed_box_data
mov ecx,[eax]
@@:
add eax,4
push dword [eax]
call [edit_box_draw]
loop @b
pop edx ecx ebx eax
.2:
mcall 10
cmp al,6
je .mouse
cmp al,3
je .button
cmp al,2
je .keys
cmp al,1
jne .2
call draw_window
call main_area
bt [flags],2
jnc @f
push dword Option_boxs
call [option_box_draw]
@@:
bt [flags],3
jnc @f
push dword Option_boxs2
call [option_box_draw]
@@:
jmp .1
 
.mouse:
bt [flags],2
jnc @f
push dword Option_boxs
call [option_box_mouse]
@@:
bt [flags],3
jnc @f
push dword Option_boxs2
call [option_box_mouse]
@@:
jmp .2
 
.keys:
mcall 2
cmp ah,13
je .4
cmp ah,27
je .3
 
bt [flags],2 ;¯à®¢¥àª  ­  ¯à¨¬¥­¨¬®áâì ᨬ¢®«®¢ 0-9,a-b
jnc .eb2
.eb1:
cmp ah,9
jne .eb1_1
push edx
mov edx,[option_group1]
cmp edx,op1
jne @f
mov edx,op2
jmp .eb1_2
@@:
cmp edx,op2
jne @f
mov edx,op3
jmp .eb1_2
@@:
mov edx,op1
.eb1_2:
mov [option_group1],edx
pop edx
jmp .1
.eb1_1:
cmp ah,48
jb .eb1_3
cmp ah,57
jbe .eb
cmp ah,102
jg .eb1_3
cmp ah,97
jge .eb
.eb1_3:
cmp ah,182
je .eb
cmp ah,8
je .eb
cmp ah,176
je .eb
cmp ah,179
je .eb
dec [edit2.shift]
dec [edit2.shift+4]
 
push dword [ed_box_data+4]; [esp]
call [edit_box_draw]
jmp .2
 
.eb2:
bt [flags],3
jnc .eb3
cmp ah,9
jne .eb2_2
push edx
mov edx,[option_group2]
cmp edx,op11
jne @f
mov edx,op12
jmp .eb2_1
@@:
mov edx,op11
.eb2_1:
mov [option_group2],edx
pop edx
jmp .1
.eb2_2:
cmp ah,182
je .eb
cmp ah,8
je .eb
cmp ah,176
je .eb
cmp ah,179
je .eb
mov edx,[option_group2]
cmp edx,op11
jne .eb
cmp ah,48
jb .eb2_3
cmp ah,57
jbe .eb
cmp ah,102
jg .eb2_3
cmp ah,97
jge .eb
.eb2_3:
dec [edit3.shift]
dec [edit3.shift+4]
push dword [ed_box_data+4];[esp]
call [edit_box_draw]
jmp .2
.eb3:
bt [flags],9
jnc .eb
cmp ah,9
je .eb3_1
cmp ah,182
je .eb3_2
cmp ah,8
je .eb3_2
cmp ah,176
je .eb3_2
cmp ah,179
je .eb3_2
cmp ah,48
jb .eb3_3
cmp ah,57
jbe .eb3_2
cmp ah,102
jg .eb3_3
cmp ah,97
jge .eb3_2
.eb3_3:
push edx
mov edx,[edit4.flags]
and edx,2
jz @f
pop edx
dec [edit4.shift]
dec [edit4.shift+4]
jmp .2
@@:
pop edx
dec [edit5.shift]
dec [edit5.shift+4]
jmp .2
.eb3_1:
push edx
mov edx,[edit4.flags]
and edx,2
jz @f
pop edx
mov [edit5.flags],2
mov [edit4.flags],0
jmp .eb3_2
@@:
pop edx
mov [edit4.flags],2
mov [edit5.flags],0
.eb3_2:
push dword [ed_box_data+4]
call [edit_box_key]
push dword [ed_box_data+8]
call [edit_box_key]
jmp .1
 
.eb:
push dword [ed_box_data+4];[esp]
call [edit_box_key]
jmp .2
 
.button:
mcall 17
cmp ah,1
jne .2
jmp close_prog
.3:
btr [flags],2
btr [flags],3
add esp,4
jmp redraw_all
.4:
mcall 13,180*65536+220,25*65536+70,frgrd_color
ret
 
b_in_screen:
pushad
call get_process_info
mov eax,[process_info+0x2e]
mov ebx,0x0a
sub eax,0x3c
cmp eax,0x10 ;now
jg @f ;now
mov [lines],0 ;now
jmp C1 ;now
 
;-------------------------------------------------
;-------------------------------------------------
;-------------------------------------------------
 
strtohex:
;enter: edi - pointer to string,ebx - pointer to size of string; exit: eax in hex
mov esi,hex8_string
@@:
xor edx,edx
div ebx
mov [lines],al
C1:
popad
mov ah,[edi+ecx-1] ;®¡à ¡®âª  ¢¢¥¤ñ­­ëå ᨬ¢®«®¢
sub ah,48
cmp ah,9
jbe .1
sub ah,7
cmp ah,15
jbe .1
sub ah,32
.1:
mov [esi+ecx-1],ah
dec ecx
jnz @b
mov ecx,[ebx]
xor eax,eax
.2:
shl eax,4
or al,[esi]
inc esi
dec ecx
jnz .2
ret
 
Ctrl_G:
bts [flags],2
mov dword [ed_box_data],1
mov dword [ed_box_data+4],edit2
call draw_ed_box
btr [flags],2
mov ecx,[edit2.size]
test ecx,ecx
jz .end
cmp ecx,8
jg Ctrl_G
 
mov edi,go_to_string
mov ebx,edit2.size
call strtohex
 
output_screen:
pushad
movzx ecx,[lines]
jecxz no_out ;now
cmp [rflag],1
jz _redraw
mov eax,[end_str]
sub eax,0x80001
cmp eax,[sizefile]
jl @f
_redraw:
cmp eax,[file_size] ;¢ë¡®à check_box' 
jg Ctrl_G
mov edx,[option_group1]
cmp edx,op1 ;abs
je .abs
cmp edx,op2
jne .back
add eax,[current_offset] ;forward
cmp eax,[file_size]
jg Ctrl_G
mov edi,[screen_table]
mov edi,[edi]
xor edx,edx
mov eax,0x10
imul ecx
sub [end_str],eax
cmp [end_str],0x10000
jge A3
mov [end_str],0x10000
A3:
mov [rflag],0
@@:
mov eax,0x28
add edx,edi
cmp eax,edx
jg @b
sub edx,edi
mov [begin_offset],edx
sub eax,edx
shl eax,1
inc eax
mov [cursor],eax
jmp .end
 
.back:
cmp eax,[current_offset] ;back
jg Ctrl_G
mov edi,[screen_table]
mov edi,[edi]
mov ebx,[current_offset]
sub ebx,eax
xor edx,edx
@@:
push ecx
push eax
call form_str
mov ebx,0x01880000
add ebx,eax
mov ecx,0x00ffffff
add eax,10
mov edx,[end_str]
push eax
sub edx,0x10
mov esi,0x10
mov eax,4
mcall
add edx,edi
cmp edx,ebx
jb @b
sub edx,edi
mov [begin_offset],edx
sub ebx,edx
mov edx,ebx
shl edx,1
inc edx
mov [cursor],edx
jmp .end
.abs:
mov esi,[screen_table]
mov esi,[esi]
xor ebx,ebx
.3:
add ebx,esi
cmp eax,ebx
jg .3
sub ebx,esi
cmp ebx,[file_size]
jg Ctrl_G
mov [begin_offset],ebx
sub eax,ebx
shl eax,1
inc eax
mov [cursor],eax
.end:
jmp red
 
Ctrl_B:
bts [flags],9
mov dword [ed_box_data],2
mov dword [ed_box_data+4],edit4
mov dword [ed_box_data+8],edit5
call draw_ed_box
btr [flags],9
 
mov ecx,[edit4.size]
test ecx,ecx
jz .end
cmp ecx,8
jg Ctrl_B
 
mov edi,sel1_string
mov ebx,edit4.size
call strtohex
 
cmp eax,[file_size]
jge Ctrl_B
push eax ;from
mov ecx,[edit5.size]
test ecx,ecx
jz .end
cmp ecx,8
jg Ctrl_B
 
mov edi,sel2_string
mov ebx,edit5.size
call strtohex
 
cmp eax,[file_size]
jb @f
pop eax
pop ecx
jmp Ctrl_B
@@:
pop [shblock_beg]
cmp eax,[shblock_beg]
jae @f
xchg eax,[shblock_beg]
@@:
mov [shblock_end],eax
bts [flags],8
.end:
jmp red
 
Ctrl_F:
bts [flags],3
mov dword [ed_box_data],1
mov dword [ed_box_data+4],edit3
call draw_ed_box
btr [flags],3
mov ecx,[edit3.size]
test ecx,ecx
jz .end
cmp ecx,8
jg Ctrl_F
mov edi,find_string
mov edx,[option_group2]
cmp edx,op11
jne .find
mov eax,find_string
push dword [eax]
push dword [eax+4]
bts [flags],0
mov ebx,edit3.size
call strtohex
mov ecx,[edit3.size]
bt cx,0
jnc .3
inc ecx
shl eax,4
.3:
shr ecx,1
.4:
mov [edi+ecx-1],al
shr eax,8
loop .4
.find:
mov esi,[current_offset]
mov ebx,[file_size]
mov eax,ebx
add eax,[file_buffer]
add esi,[file_buffer]
.5:
mov ecx,[edit3.size]
cmp edx,op11
jne .7
bt cx,0
jnc .6
inc ecx
.6:
shr ecx,1
.7:
cld
@@:
cmp esi,eax
jg .end
cmpsb
je .8
mov edi,find_string
jmp .5
.8:
loop @b
no_out:
popad
ret
sub esi,[file_buffer]
mov ecx,[edit3.size]
cmp edx,op11
jne .10
bt cx,0
jnc .9
inc ecx
.9:
shr ecx,1
.10:
sub esi,ecx
xor edx,edx
mov edi,[screen_table]
mov edi,[edi]
@@:
add edx,edi
cmp edx,esi
jb @b
sub edx,edi
mov [begin_offset],edx
sub esi,edx
shl esi,1
inc esi
mov [cursor],esi
.end:
bt [flags],0
jnc @f
mov eax,find_string
pop dword [eax+4]
pop dword [eax]
btr [flags],0
@@:
jmp red
 
invert_byte:
mov ebx,[current_offset]
cmp ebx,[file_size]
jae still
add ebx,[file_buffer]
not byte [ebx]
jmp red
 
 
form_str:
pushad
mov ebp,[end_str] ;¯®á«¥¤­¨© ¢ë¢¥¤¥­­ë© ¡ ©â
xor edi,edi ;áç¥â稪 ¡ ©â <= 16
;¢ë¢¥á⨠ ¤à¥á
mov ecx,ebp
mov ebx,0x80100 ;8 æ¨äà, 16-à¨ç­ë¥, ç¨á«® ¢ ecx
sub ecx,0x10000 ;­®à¬ «¨§ æ¨ï  ¤à¥á 
mov edx,0x80000 ;­ ç «® ¯® •
add edx,[esp+0x24] ;­ ç «® ¯® “
mov esi,0x00ffffff ;梥â
mov eax,47 ;¢ë¢¥á⨠ç¨á«®
mcall
add edx,0x600000 ;0x40 - 8chars + 0x20 - space
mov ebx,0x20100 ;2 æ¨äàë, 16-à¨ç­ë¥, ç¨á«® ¢ ecx
Insert: ;¯¥à¥ª«î祭¨¥ ०¨¬  ¢áâ ¢ª¨/§ ¬¥­ë
btc [flags],1 ;not [insert_mod]
call show_insert
jmp red
 
 
DEL:
bt [flags],1
jnc still
mov edi,[current_offset]
mov esi,[file_buffer]
mov edx,[file_size]
test edx,edx
jz still
dec edx
cmp edi,edx
jbe @f
call LEFT
call LEFT
jmp red
@@:
mov ecx,[ebp+edi] ;ç¨á«® ¢ ecx
jb @f
call LEFT
call LEFT
@@:
cmp edi,edx
je @f
mov al,[edi+esi+1]
mov [edi+esi],al
inc edi
and ecx,0xff
cmp edi,0x11
jz endstr
mcall
add edx,0x100000
jmp @b
endstr:
dec edi
add ebp,edi
mov [end_str],ebp
popad
ret 4
@@:
dec [file_size]
call show_file_size
jmp red
 
 
 
draw_cursor:
pushad
mov ebx,[x_cursor]
mov ecx,[esp+0x24]
mov edx,[color]
mov eax,13
mcall
movzx edi,[o_s_flag]
and edi,8
jnz @f
add ebx,[text_cursor]
mcall
BackSpace:
bt [flags],1 ;cmp [insert_mod],0
jnc still ;je still
mov edi,[current_offset]
mov esi,[file_buffer]
mov edx,[file_size]
test edx,edx
jz still
test edi,edi
jz still
call LEFT
call LEFT
cmp [cursor],2
jne @f
cmp edx,1
jne @f
dec [cursor]
@@:
popad
ret 4
cmp edi,edx
jge @f
mov al,[edi+esi]
mov [edi+esi-1],al
inc edi
jmp @b
@@:
dec [file_size]
call show_file_size
jmp red
 
f2:
mov eax,[process_info+46]
mov [x_cursor],0xb0005
sub eax,0x11
; mov [text_cursor],-1
shl eax,0x10
 
mov [y_filename_area],eax
Ctrl_UP:
cmp [begin_offset],0
je @f
mov eax,[bytes_per_line]
sub [begin_offset],eax
@@:
ret
 
menufile:
mov [menu_opened],1
mov ebx,[xf_menu];x-base+x_size for hi-level menu button
mov edx,5;first id button for this group
mov edi,3;counter buttons
call f1
;output text for menu
shr ecx,0x10 ;y-base button
and ebx,0xffff0000
add ecx,0x6000f ;for y-base text
mov esi,4 ;length text
add ebx,ecx ;full base text
mov edx,m_open
mov ecx,[sc.work_button_text]
or ecx,0x10000000
sub eax,4
mcall
add ebx,0x0c ;next full base text
add edx,4 ;next string
mcall
add ebx,0x0c
add edx,4
mcall
ret
 
menucoding:
mov [menu_opened],1
mov ebx,[xe_menu]
mov edx,8 ;first id
mov edi,6 ;counter
add ebx,0x10 ;add width buttons
push edi
call f1
pop edi
shr ecx,0x10
and ebx,0xffff0000
add ecx,0x8000f
mov esi,8 ;length text
add ebx,ecx
mov edx,m_win2dos
mov ecx,[sc.work_button_text]
or ecx,0x10000000
sub eax,4
Ctrl_DOWN:
mov eax,[cursor]
dec eax
shr eax,1
add eax,[begin_offset]
mov ebx,[bytes_per_line]
add eax,ebx
cmp eax,[file_size]
jge @f
add [begin_offset],ebx
@@:
mcall
add ebx,0x0c
add edx,8 ;next string
dec edi
jnz @b
ret
 
menuhelp:
mov [menu_opened],1
mov ebx,[xh_menu]
mov edx,14 ;first id
add ebx,6 ;add width buttons
mov edi,2 ;counter
call f1
shr ecx,0x10
and ebx,0xffff0000
add ecx,0x8000f
mov esi,4 ;length text
add ebx,ecx
mov edx,m_help
mov ecx,[sc.work_button_text]
or ecx,0x10000000
sub eax,4
mcall
add ebx,0x0c
inc esi ;add lebgth output text
add edx,4
mcall
ret
 
f1:;uses for drawing low-level menu buttons
;counter buttons get into
;menufile,menucoding,menuhelp funcs.
mov ecx,[y_menu] ;y-base+y_size for hi-level menu button
mov esi,[sc.work_button] ;color buttons
mov eax,8
push ecx ;for output text
UP:
mov eax,[current_offset]
cmp eax,[bytes_per_line]
jb still
mov eax,[cursor]
dec ax
shr ax,1
cmp eax,[bytes_per_line]
jge @f
mov eax,[bytes_per_line]
sub [begin_offset],eax
jmp red
@@:
add ecx,0xc0000
mcall
inc edx ;id
dec edi ;counter
jnz @b
pop ecx ;for output text
mov eax,[bytes_per_line]
shl ax,1
sub [cursor],eax
jmp red
 
 
DOWN: ;­  áâப㠢­¨§
mov eax,[current_offset]
add eax,[bytes_per_line]
bt [flags],1
jnc @f
dec eax
@@:
cmp eax,[file_size]
jge still ;¥á«¨ ¬ë ­  ¯®á«¥¤­¥© áâப¥ ä ©« , â® á⮯
mov eax,[screen_table]
mov eax,[eax]
mov edx,[cursor]
dec dx
shr dx,1
add edx,[bytes_per_line]
cmp eax,edx ;­  ¯®á«¥¤­¥© áâப¥?
jbe @f
mov eax,[bytes_per_line]
shl ax,1
add [cursor],eax
ret
@@:
mov eax,[bytes_per_line]
add [begin_offset],eax
ret
 
redraw_window:
call get_process_info
mov [rflag],1
call draw_window
 
LEFT:
cmp [cursor],1
jbe @f
dec [cursor]
jmp .end
@@:
cmp [begin_offset],0 ;ªãàá®à ­  ¯¥à¢®© áâப¥ ᮠᬥ饭¨¥¬ 0?
jne @f ;¨­ ç¥ ᬥ頥¬ á ¯à®ªàã⪮© ¢¢¥àå ¢¢¥àå ¨ ¢ ª®­¥æ áâப¨
; inc [cursor]
jmp .end;still ;⮣¤  á⮯
@@:
mov eax,[bytes_per_line]
sub [begin_offset],eax
shl ax,1
dec eax
add [cursor],eax
.end:
ret
 
;this is debug func
debug:
pushad
mov ecx,[esp+0x24]
mov ebx,0x80100
mov edx,0x10000a0
mov eax,47
mov esi,0x00ffffff
mcall
popad
ret 4
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
RIGHT:
mov ecx,[begin_offset] ;¢ëç¨á«ï¥¬ ᬥ饭¨¥ ªãàá®à 
mov edx,[cursor] ;¤«ï ¯à®¢¥àª¨ áãé¥á⢮¢ ­¨ï
shr edx,1 ;á«¥¤ãî饣® ᨬ¢®« 
add ecx,edx
bt [flags],1
jnc @f
dec ecx ;áà ¢­¨¢ ¥¬ á à §¬¥à®¬ ä ©« 
@@:
cmp ecx,[file_size] ;¯®«®¦¥­¨¥¬ ªãàá®à  - ­¥ ¤ «¥¥ 1 ¡ ©â  ®â ª®­æ  ä ©« 
jge red
cmp [file_size],0
je still
mov eax,[screen_table]
mov eax,[eax]
mov ecx,[begin_offset]
cmp eax,edx ;áà ¢­¥­¨¥ ­  ­¨¦­îî áâபã
jbe @f
inc [cursor] ;ªãàá®à ¢¯à ¢®
jmp red
@@:
mov ecx,[bytes_per_line] ;ᬥ頥¬áï ­  áâà®çªã ¢­¨§
add [begin_offset],ecx ;á ¯à®ªàã⪮©
shl cx,1
dec cx
sub [cursor],ecx
jmp red
 
draw_window:
pushad
mov eax,48
mov ebx,3
mov ecx,sc
mov edx,sizeof.system_colors
mcall
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
; [x start] *65536 + [x size]
mov ebx,[process_info+42]
; [y start] *65536 + [y size]
mov ecx,[process_info+46]
mov edx,0x03000000 ; color of work area RRGGBB,8->color gl
mcall
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,[sc.grab_text]
or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
mcall
;check for only header window output
cmp dword [process_info+46],25
jle minimaze_view
PGDN:
mov edi,[screen_table]
mov eax,[edi]
shl eax,1
add eax,[begin_offset]
cmp eax,[file_size] ;¥áâì «¨ ¢®§¬®¦­®áâì ᬥáâ¨âìáï ­  áâà ­¨æã?
jg Ctrl_END
mov eax,[edi]
add [begin_offset],eax
; mov ebx,[cursor]
; dec ebx
; xor ecx,ecx
; bt ebx,0
; jnc @f
; inc ecx
; @@: shr ebx,1
; add ebx,eax
; @@: cmp ebx,[file_size]
; jbe @f
; sub ebx,[bytes_per_line]
; jmp @b
; @@: sub ebx,eax
; shl ebx,1
; inc ebx
; add ebx,ecx
; mov [cursor],ebx
jmp red
 
;MENU AREA
mov eax,[process_info+42] ;x-size window
mov ecx,[process_info+46] ;y-size window
push ecx ;for using done
mov ebx,0x40000
sub eax,8
mov edi,ecx
add ebx,eax ;x-base + x-size
sub edi,22 ;temporary value for menu area
push ebx ;for drawing buttons area
sub ecx,edi ;y-base menu area
mov edx,[sc.work_graph]
shl ecx,0x10
mov eax,13
add ecx,0x10
mcall
;MENU BUTTONS
;now in hi-half ecx register begin Y-coord. menu area
;in hi-half ebx begin X-coord.
;menu 'File'
mov esi,edx ;color
and ecx,0xffff0000
and ebx,0xffff0000
add ecx,0x1000c
add ebx,0x20028 ;40x12
mov edx,2 ;menu 'File' id = 2
mov [y_menu],ecx ;for low-level menus func.
mov [xf_menu],ebx;for low-level menus func.
mov eax,8
push ebx ;for output buttons texts
mcall
;registers is't change
;menu 'Coding'
add ebx,0x290018 ;80x12
inc edx ;menu 'coding' id = 3
mov [xe_menu],ebx;for low-level menus func.
mcall
;menu 'Help'
add ebx,0x40ffe8 ;+0x280000 - 0x28, 40x12
inc edx ;menu 'Help' id = 4
mov [xh_menu],ebx;for low-level menus func.
mcall
;MENU BUTTONS TEXTS
;'File'
pop ebx
shr ecx,0x10
and ebx,0xffff0000
add ecx,3
mov eax,4 ; function 4 : write text to window
add ebx,0x80000
mov edx,f_menu
add ebx,ecx ; [x start] *65536 + [y start]
mov esi,4
mov ecx,[sc.work_button_text]
or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB )
push esi ;for 'Help' menu text
mcall
;'coding'
;registers is't change
add ebx,0x2d0000
;mov esi,6
add esi,2
; mov edx,e_menu
add edx,4
mcall
;'Help'
add ebx,0x3b0000
; mov esi,4
pop esi
; mov edx,h_menu
add edx,6
mcall
;LOW_LEVEL MENU
;for every hi-level menu exists one procedure
;in begin programm they are not calls,
;but when user click on one item hi-level menu
;or press hot keys, call one func. and after
;end work this func. she is redraw window -
;low-level menu is hide. Functions:
;menufile,menucoding,menuhelp.
;Thay uses global virables, top-left corner every
;hi-level menu buttons: [xf_menu],[xe_menu],[xh_menu],[y_menu]
 
;DRAW BUTTONS AREA
pop ebx ;for push ebx into processed menu area: x-bzse + x-size
; mov ecx,[process_info+46]
pop ecx
push ecx
sub ecx,24
mov edx,[sc.work_graph]
shl ecx,16 ;y start
mov eax,13
add ecx,20
mcall
PGUP:
mov eax,[screen_table]
mov eax,[eax]
mov edx,[begin_offset]
cmp eax,edx
jbe @f
call Ctrl_HOME
jmp red
@@:
sub [begin_offset],eax
jmp red
 
;filename input area
; mov ecx,[process_info+46]
pop ecx
push ecx ;for info strings
mov ebx,0x0008005a
sub ecx,21
 
HOME:
mov eax,[cursor]
dec ax
shr ax,1
mov ecx,[bytes_per_line]
xor edx,edx
shl ecx,16
mov [y_filename_area],ecx
dec edx
add ecx,16
mov eax,13
push ecx ;for button 'Go'
mcall
div ecx
shl dx,1
sub [cursor],edx
bt [cursor],0
jc @f
dec [cursor]
@@:
ret
 
;button 'Go', press in case open/save if filename input complete
;button size = 24x16
mov eax,8
pop ecx ;y-base+y-size
mov ebx,0x00680018;x-base+x-size
dec ecx
mov edx,0xff ;id
mov esi,[sc.work_button]
mcall
shr ecx,0x10
and ebx,0xffff0000
add ecx,0x50004
mov edx,b_go
add ebx,ecx
mov esi,2
mov ecx,[sc.work_button_text]
or ecx,0x10000000
sub eax,4
mcall
 
;where output cursor?
mov al,[o_s_flag]
and al,8
je @f
mov ecx,[y_filename_area]
add ecx,0x40008
jmp cursor
@@: ;o_s_flag<0 - not output cursor into filename area
mov ecx,[y_cursor]
cursor:
push ecx
call draw_cursor
END_:
mov eax,[cursor]
dec ax
shr ax,1
mov ecx,[bytes_per_line]
xor edx,edx
div ecx
mov eax,[current_offset]
sub eax,edx
add eax,[bytes_per_line]
mov edx,[file_size]
cmp eax,edx
jbe @f
sub edx,eax
add eax,edx
@@:
sub eax,[begin_offset]
shl eax,1
test eax,eax
jz red
dec eax
mov [cursor],eax
jmp red
 
mov eax,[y_filename_area]
mov ebx,0xa0000
mov edx,filename
shr eax,0x10
and ebx,0xffff0000
add eax,4
xor ecx,ecx
add ebx,eax
movzx esi,[name_l]
mov eax,4
mcall
 
;info strings
; sizefile text
; mov eax,[process_info+46]
pop eax
mov ebx,0x00840000
sub eax,18
xor ecx,ecx
add ebx,eax
mov edx,sizestr ; pointer to text beginning
mov eax,4
mov esi,5
mcall
add ebx,0x00530000
inc esi
; mov edx,offst
add edx,5
inc esi
mcall
;sizefile
mov ecx,[sizefile]
mov edx,ebx
xor esi,esi
sub edx,0x00350000
mov eax,47
mov ebx,0x80100
mcall
mov ecx,[current]
add edx,0x005f0000
mcall
 
push [text_cursor] ;íâ® ¯®§¨æ¨ï ªãàá®à  ¢ ⥪á⮢®© áâப¥
call draw_cursor
mov ecx,[sizefile]
jecxz minimaze_view
call output_screen
 
minimaze_view:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
popad
Ctrl_HOME:
mov [begin_offset],0
mov [cursor],1
ret
 
 
Ctrl_END:
mov eax,[file_size]
mov ecx,[screen_table]
mov ecx,[ecx]
xor edx,edx
div ecx
test dx,dx
jnz @f
test eax,eax
jz @f
mov edx,ecx
dec eax
@@:
push dx
xor dx,dx
mul ecx
pop dx
shl edx,1
cmp edx,1
jg @f
mov edx,2
@@:
dec edx
mov [begin_offset],eax
mov [cursor],edx
jmp red
 
 
ESC:
btr [flags],8
jmp red
 
get_process_info:
pushad
mov eax,9
mov ebx,process_info
xor ecx,ecx
dec ecx
mcall
popad
copy_to_buf:
bt [flags],8
jnc .1
mov eax,[shblock_end]
sub eax,[shblock_beg]
inc eax
mov ecx,eax
mov [copy_len],eax
mcall 68,20,,[copy_buf]
mov esi,[shblock_beg]
mov edi,[copy_buf]
add esi,[file_buffer]
mov ecx,[copy_len]
cld
@@:
movsb
loop @b
bts [flags],10
xor eax,eax
ret
.1:
or eax,-1
ret
 
coding:
pushad
mov ebp,0x10000 ;0x80000
mov edi,[esp+0x28] ;source table
mov esi,[esp+0x24] ;destination table
xor ecx,ecx ;index in file
new_char:
xor ebx,ebx ;index in tables
not_c:
mov ah,[ebp+ecx] ;load char
cmp ah,[edi+ebx] ;
jz @f
Ctrl_C:
call copy_to_buf
jmp still
 
shblock_sz dd 0
 
Ctrl_V:
bt [flags],10
jnc still
bt [flags],8
jnc .past_kurs
;¢áâ ¢«ï¥¬ ¡«®ª ¢ ¢ë¤¥«¥­­ãî ®¡« áâì
mov ebx,[shblock_end]
sub ebx,[shblock_beg]
inc ebx
cmp ebx,0x40
jge end_table
jmp not_c
mov [shblock_sz],ebx
mov esi,[copy_buf]
mov edi,[file_buffer]
add edi,[shblock_beg]
mov eax,[copy_len]
.1:
cld
@@:
mov al,[esi+ebx]
inc ebx
mov [ebp+ecx],al
end_table:
movsb
dec eax
jz .del
dec ebx
jnz @b
.add:
push esi edi eax
push [file_size]
add [file_size],eax
call raspred_mem
pop ecx
mov edi,[esp+4]
add ecx,[file_buffer]
sub ecx,edi
inc ecx
cmp ecx,[sizefile]
jle new_char
popad
ret 8
 
create_process:
pushad
mov eax,51
xor ebx,ebx
mov ecx,[esp+0x24]
inc ebx
mov edx,0x7E000 ;0x1000
mcall
popad
ret 4
 
help_thread:
call help_window
help_still:
mov eax,10
mcall
mov edi,[file_size]
add edi,[file_buffer]
mov esi,edi
sub esi,eax
std
@@:
movsb
loop @b
pop eax edi esi
cld
@@:
movsb
dec eax
jz help_red
jnz @b
mov eax,[shblock_beg]
add eax,[copy_len]
dec eax
jz help_key
mov [shblock_end],eax
jmp red
.del:
dec ebx
jz red
mov ecx,[file_size]
add ecx,[file_buffer]
sub ecx,edi
mov esi,edi
add esi,ebx
cld
@@: movsb
loop @b
sub [file_size],ebx
call raspred_mem
mov eax,[shblock_beg]
add eax,[copy_len]
dec eax
jz help_button
jmp help_still
help_red:
call help_window
jmp help_still
help_key:
mov [shblock_end],eax
jmp red
 
;¥á«¨ ¡«®ª ­¥ ¢ë¤¥«¥­, â® ¢áâ ¢«ï¥¬ ¡«®ª ¯¥à¥¤ ªãàá®à®¬
.past_kurs:
; bt [flags],1
; jnc still
; mov esi,[file_buffer]
; add esi,[current_offset]
; jmp red
jmp still
 
Ctrl_X:
bt [flags],1
jnc still
call copy_to_buf
test eax,eax
jnz still
 
mov ecx,[file_size]
sub ecx,[copy_len]
sub ecx,[shblock_beg]
inc ecx
mov ebx,[file_size]
mov edi,[shblock_beg]
mov esi,[shblock_end]
inc esi
add esi,[file_buffer]
add edi,[file_buffer]
add ebx,[file_buffer]
cld
@@:
cmp esi,ebx
je .1
movsb
loop @b
.1:
mov eax,[file_size]
sub eax,[copy_len]
mov [file_size],eax
btr [flags],8
 
mov eax,[shblock_beg]
mov esi,[screen_table]
mov esi,[esi]
xor ebx,ebx
.3:
add ebx,esi
cmp eax,ebx
jg .3
sub ebx,esi
; cmp ebx,[file_size]
; jg Ctrl_G
mov [begin_offset],ebx
sub eax,ebx
shl eax,1
inc eax
inc eax
mcall
jmp help_still
help_button:
mov eax,17
mcall
dec ah
jne help_still
shr eax,8
dec eax
mcall
mov [cursor],eax
jmp red
 
help_window:
pushad
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,0x500140 ; [x start] *65536 + [x size]
mov ecx,0x700110 ; [y start] *65536 + [y size]
mov edx,0x03000000 ; color of work area RRGGBB,8->color gl
mcall
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ffffff ; font 1 & color ( 0xF0RRGGBB )
mov edx,help_label ; pointer to text beginning
mov esi,14 ; text length
mcall
; HELP TEXT
add edx,14 ;help_text addr.
add esi,37 ; = 51 - length 1 line
mov ecx,0x00ffffff
mov edi,(help_end-help_text)/51
;---------------------------------------------------------------------
open_dialog:
call get_filter_data
mov [OpenDialog_data.type],0 ; Open
start_OpenDialog OpenDialog_data
cmp [OpenDialog_data.status],2 ; OpenDialog does not start
je .sysxtree ; some kind of alternative, instead OpenDialog
cmp [OpenDialog_data.status],1
jne still
mov esi,fname_buf
jmp .load
.sysxtree:
call opendialog
jc still
mov esi,path
.load:
mov edi,file_name
cld
@@:
add ebx,0x10
cmp byte [esi],0
je @f
movsb
jmp @b
@@:
mov byte [edi],0
sub esi,path
mov [edit1.size],esi
mov [edit1.pos],esi
jmp open_file.0
;---------------------------------------------------------------------
get_filter_data:
mov edi,[OpenDialog_data.com_area]
test edi,edi
jnz @f
add esp,4
jmp still
@@:
add edi,4096+4
mov esi,Filter
mov ecx,[esi]
inc ecx
cld
rep movsb
mov edi,[OpenDialog_data.com_area]
mov [edi+4096],dword 1
ret
;---------------------------------------------------------------------
;##################################
opendialog:
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
mov edi,path
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
 
mov [dlg_pid_get],0
 
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
or ecx,-1
mcall
add edx,51
 
; convert eax bin to param dec
mov eax,dword [procinfo+30] ;offset of myPID
mov edi,param+4-1 ;offset to 4 bytes
mov ecx,4
mov ebx,10
.new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
jnz @b
loop .new_d
 
; wirite 1 byte space to param
mov [param+4],byte 32 ;Space for next parametr
; and 1 byte type of dialog to param
mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog)
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
;
; STEP2 prepare IPC area for get messages
;
 
; prepare IPC area
mov [path],dword 0
mov [path+4],dword 8
 
; define IPC memory
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,1024+16 ; size
mcall
popad
ret
 
about_thread:
call about_window
about_still:
mov eax,10
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
; cmp [image],0
; jnz @f
; mov bl,01000110b
;@@:
mcall
 
;
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,70
mov ebx,run_fileinfo
mcall
bt eax,31
jnc @f
mcall 40,0x27
add esp,4
jmp open_file
@@:
mov [get_loops],0
.getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
mcall
dec eax
jz about_red
jz .mred
dec eax
jz about_key
jz .mkey
dec eax
jz about_button
jmp about_still
about_red:
call about_window
jmp about_still
about_key:
inc eax
inc eax
jz .mbutton
cmp al, 7-3
jz .mgetmes
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
mcall
jmp about_still
about_button:
mov eax,17
mov ebp,eax
 
.loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
mcall
dec ah
jne about_still
shr eax,8
dec eax
mcall
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je .dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz .loox
 
about_window:
pushad
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
jmp .erroff
 
.dlg_is_work:
cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated
je .erroff ;TESTODP2 terminated too
 
cmp [dlg_pid_get],dword 1
je .getmesloop
inc [get_loops]
cmp [get_loops],4 ;2 sec if DLG_PID not get TESTOP2 terminated
jae .erroff
jmp .getmesloop
 
.mred:
; cmp [image], 0
; jz .getmesloop
; call redraw_all
call draw_window_1
jmp .getmesloop
.mkey:
mov eax,2
mcall ; read (eax=2)
jmp .getmesloop
.mbutton:
mov eax,17 ; get id
mcall
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,0x500140 ; [x start] *65536 + [x size]
mov ecx,0x700110 ; [y start] *65536 + [y size]
mov edx,0x03000000 ; color of work area RRGGBB,8->color gl
cmp ah,1 ; button id=1 ?
jne .getmesloop
mov eax,-1 ; close this program
mcall
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,[sc.work_button_text]
or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB )
mov edx,about_label ; pointer to text beginning
mov esi,17 ; text length
mcall
; ABOUT TEXT
add edx,17 ;about_text addr.
add esi,34 ; = 51 - length 1 line
mov ecx,0x00ddeeff
mov edi,15
@@:
add ebx,0x10
mcall
add edx,51
dec edi
jnz @b
.mgetmes:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
popad
; If dlg_pid_get then second message get jmp to still
cmp [dlg_pid_get],dword 1
je .ready
 
; First message is number of PID SYSXTREE dialog
 
; convert PID dec to PID bin
movzx eax,byte [path+16]
sub eax,48
imul eax,10
movzx ebx,byte [path+16+1]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+2]
add eax,ebx
sub eax,48
imul eax,10
movzx ebx,byte [path+16+3]
add eax,ebx
sub eax,48
mov [DLGPID],eax
 
; Claear and prepare IPC area for next message
mov [path],dword 0
mov [path+4],dword 8
mov [path+8],dword 0
mov [path+12],dword 0
mov [path+16],dword 0
 
; Set dlg_pid_get for get next message
mov [dlg_pid_get],dword 1
; cmp [image],0
; jz .getmesloop
; call redraw_all
call draw_window_1
jmp .getmesloop
 
.ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
mov esi,path+16
mov edi,path
mov ecx,1024/4
rep movsd
mov [edi],byte 0
 
.openoff:
mcall 40,0x27
clc
ret
 
.erroff:
mcall 40,0x27
stc
ret
;##################################
 
; DATA AREA
writeinfo:
dd 2
 
 
;---------------------------------------------------------
;----------------------- DATA AREA------------------------
;---------------------------------------------------------
align 4
myimport:
edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key
edit_box_mouse dd aEdit_box_mouse
version_ed dd aVersion_ed
 
option_box_draw dd aOption_box_draw
option_box_mouse dd aOption_box_mouse
version_op dd aVersion_op
 
scrollbar_ver_draw dd aScrollbar_ver_draw
scrollbar_ver_mouse dd aScrollbar_ver_mouse
scrollbar_hor_draw dd aScrollbar_hor_draw
scrollbar_hor_mouse dd aScrollbar_hor_mouse
version_scrollbar dd aVersion_scrollbar
 
menu_bar_draw dd aMenu_bar_draw
menu_bar_mouse dd aMenu_bar_mouse
version_menu_bar dd aVersion_menu_bar
 
dd 0
dd 0
sizefile dd 0
dd 0x10000
 
aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0
aVersion_ed db 'version_ed',0
 
aOption_box_draw db 'option_box_draw',0
aOption_box_mouse db 'option_box_mouse',0
aVersion_op db 'version_op',0
 
aScrollbar_ver_draw db 'scrollbar_v_draw',0
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
aScrollbar_hor_draw db 'scrollbar_h_draw',0
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
aVersion_scrollbar db 'version_scrollbar',0
 
aMenu_bar_draw db 'menu_bar_draw',0
aMenu_bar_mouse db 'menu_bar_mouse',0
aVersion_menu_bar db 'version_menu_bar',0
;---------------------------------------------------------------------
align 4
scroll_bar_data_vertical:
.x:
.size_x dw scroll_width_size;+0
.start_x dw 565 ;+2
.y:
.size_y dw 284 ;+4
.start_y dw 19 ;+6
.btn_high dd scroll_width_size ;+8
.type dd 1 ;+12
.max_area dd 300+20 ;+16
.cur_area dd 50 ;+20
.position dd 0 ;+24
.bckg_col dd 0xAAAAAA ;+28
.frnt_col dd 0xCCCCCC ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80
.ar_offset dd 10 ;+84
;---------------------------------------------------------------------
align 4
scroll_bar_data_horizontal:
.x:
.size_x dw 300 ;0 ;+0
.start_x dw 0 ;0 ;+2
.y:
.size_y dw scroll_width_size ;0 ;+4
.start_y dw 300 ;0 ;+6
.btn_high dd scroll_width_size ;+8
.type dd 1 ;+12
.max_area dd 300 ;+16
.cur_area dd 30 ;+20
.position dd 1 ;+24
.bckg_col dd 0xAAAAAA ;+28
.frnt_col dd 0xCCCCCC ;+32
.line_col dd 0 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
.r_size_x dw 0 ;+48
.r_start_x dw 0 ;+50
.run_y:
.r_size_y dw 0 ;+52
.r_start_y dw 0 ;+54
.m_pos dd 0 ;+56
.m_pos_2 dd 0 ;+60
.m_keys dd 0 ;+64
.run_size dd 0 ;+68
.position2 dd 0 ;+72
.work_size dd 0 ;+76
.all_redraw dd 0 ;+80
.ar_offset dd 10 ;+84
;---------------------------------------------------------------------
align 4
menu_data_1:
.type: dd 0 ;+0
.x:
.size_x dw 40 ;+4
.start_x dw 2 ;+6
.y:
.size_y dw 15 ;+8
.start_y dw 2 ;+10
.text_pointer: dd menu_text_area ;0 ;+12
.pos_pointer: dd menu_text_area.1 ;0 ;+16
.text_end dd menu_text_area.end ;0 ;+20
.mouse_pos dd 0 ;+24
.mouse_keys dd 0 ;+28
.x1:
.size_x1 dw 40 ;+32
.start_x1 dw 2 ;+34
.y1:
.size_y1 dw 100 ;+36
.start_y1 dw 18 ;+38
.bckg_col dd 0xeeeeee ;+40
.frnt_col dd 0xff ;+44
.menu_col dd 0xffffff ;+48
.select dd 0 ;+52
.out_select dd 0 ;+56
.buf_adress dd 0 ;+60
.procinfo dd 0 ;+64
.click dd 0 ;+68
.cursor dd 0 ;+72
.cursor_old dd 0 ;+76
.interval dd 16 ;+80
.cursor_max dd 0 ;+84
.extended_key dd 0 ;+88
.menu_sel_col dd 0x00cc00 ;+92
.bckg_text_col dd 0 ;+96
.frnt_text_col dd 0xffffff ;+100
.mouse_keys_old dd 0 ;+104
.font_height dd 8 ;+108
.cursor_out dd 0 ;+112
.get_mouse_flag dd 0 ;+116
 
menu_text_area:
db 'File',0
.1:
db 'Open',0
db 'Save',0
db 'Exit',0
.end:
db 0
dd filename
;---------------------------------------------------------------------
align 4
menu_data_2:
.type: dd 0 ;+0
.x:
.size_x dw 40 ;+4
.start_x dw 43 ;+6
.y:
.size_y dw 15 ;+8
.start_y dw 2 ;+10
.text_pointer: dd menu_text_area_2 ;0 ;+12
.pos_pointer: dd menu_text_area_2.1 ;0 ;+16
.text_end dd menu_text_area_2.end ;0 ;+20
.mouse_pos dd 0 ;+24
.mouse_keys dd 0 ;+28
.x1:
.size_x1 dw 50 ;+32
.start_x1 dw 43 ;+34
.y1:
.size_y1 dw 100 ;+36
.start_y1 dw 18 ;+38
.bckg_col dd 0xeeeeee ;+40
.frnt_col dd 0xff ;+44
.menu_col dd 0xffffff ;+48
.select dd 0 ;+52
.out_select dd 0 ;+56
.buf_adress dd 0 ;+60
.procinfo dd 0 ;+64
.click dd 0 ;+68
.cursor dd 0 ;+72
.cursor_old dd 0 ;+76
.interval dd 16 ;+80
.cursor_max dd 0 ;+84
.extended_key dd 0 ;+88
.menu_sel_col dd 0x00cc00 ;+92
.bckg_text_col dd 0 ; +96
.frnt_text_col dd 0xffffff ;+100
.mouse_keys_old dd 0 ;+104
.font_height dd 8 ;+108
.cursor_out dd 0 ;+112
.get_mouse_flag dd 0 ;+116
 
current dd 0 ;current offset relative begin file. Uses as offset for patch.
;Coordinates left hi-level menu buttons
;Uses into low-level menu output.
xf_menu dd 0
xe_menu dd 0
xh_menu dd 0
y_menu dd 0 ;top coord. menu
y_filename_area dd 0 ;top coord. filename input area
color dd 0
y_cursor dd 0x280008 ;y coord. shl 16 + y size for cursor
x_cursor dd 0x680005 ;x coord. shl 16 + x size for cursor
name_l db 0 ;counter chars into filename
o_s_flag db 0 ;
rflag dd 0;
posx db 0
posy db 3
lines db 0
end_str dd 0x10000 ;addr. first byte for output
text_cursor dd 0x01200000
menu_text_area_2:
db 'View',0
.1:
db 'Add 4',0
db 'Add 8',0
db 'Sub 4',0
db 'Sub 8',0
.end:
db 0
;---------------------------------------------------------------------
align 4
menu_data_3:
.type: dd 0 ;+0
.x:
.size_x dw 40 ;+4
.start_x dw 84 ;+6
.y:
.size_y dw 15 ;+8
.start_y dw 2 ;+10
.text_pointer: dd menu_text_area_3 ;0 ;+12
.pos_pointer: dd menu_text_area_3.1 ;0 ;+16
.text_end dd menu_text_area_3.end ;0 ;+20
.mouse_pos dd 0 ;+24
.mouse_keys dd 0 ;+28
.x1:
.size_x1 dw 40 ;+32
.start_x1 dw 84 ;+34
.y1:
.size_y1 dw 100 ;+36
.start_y1 dw 18 ;+38
.bckg_col dd 0xeeeeee ;+40
.frnt_col dd 0xff ;+44
.menu_col dd 0xffffff ;+48
.select dd 0 ;+52
.out_select dd 0 ;+56
.buf_adress dd 0 ;+60
.procinfo dd 0 ;+64
.click dd 0 ;+68
.cursor dd 0 ;+72
.cursor_old dd 0 ;+76
.interval dd 16 ;+80
.cursor_max dd 0 ;+84
.extended_key dd 0 ;+88
.menu_sel_col dd 0x00cc00 ;+92
.bckg_text_col dd 0 ; +96
.frnt_text_col dd 0xffffff ;+100
.mouse_keys_old dd 0 ;+104
.font_height dd 8 ;+108
.cursor_out dd 0 ;+112
.get_mouse_flag dd 0 ;+116
 
filename: rb 13
menu_text_area_3:
db 'Help',0
.1:
db 'Help',0
.end:
db 0
;---------------------------------------------------------------------
edit1 edit_box 200,190,27,0xffffff,0x6a9480,0,0xAABBCC,0,134,cur_dir_path,ed_focus,ed_focus,6,6 ;ä ©« ®âªàëâì\á®åà ­¨âì
edit2 edit_box 55,260,29,0xeeeeee,0x6a9480,0,0xAABBCC,4,8,go_to_string,ed_focus,ed_focus,0,0 ;¯¥à¥å®¦¤ ­  ᬥ饭¨¥
edit3 edit_box 55,260,29,0xeeeeee,0x6a9480,0,0xAABBCC,4,8,find_string,ed_focus,ed_focus,0,0 ;¯®¨áª
edit4 edit_box 55,220,49,0xeeeeee,0x6a9480,0,0xAABBCC,4,8,sel1_string,ed_focus,ed_focus,0,0 ;¢ë¤¥«¨âì ¡«®ª ­ ç.ᬥé.
edit5 edit_box 55,300,49,0xeeeeee,0x6a9480,0,0xAABBCC,4,8,sel2_string,ed_focus,0,0,0 ;¢ë¤¥«¨âì ¡«®ª ª®­.ᬥé.
 
b_go: db 'Go'
op1 option_box option_group1,210,50,6,12,0xffffff,0,0,op_text.1,op_text.e1-op_text.1,1
op2 option_box option_group1,310,50,6,12,0xFFFFFF,0,0,op_text.2,op_text.e2-op_text.2
op3 option_box option_group1,210,65,6,12,0xffffff,0,0,op_text.3,op_text.e3-op_text.3
op11 option_box option_group2,210,50,6,12,0xffffff,0,0,op_text2.11,op_text2.e11-op_text2.11
op12 option_box option_group2,310,50,6,12,0xffffff,0,0,op_text2.21,op_text2.e21-op_text2.21
 
sizestr: db 'SIZE:'
option_group1 dd op1 ;㪠§ â¥«¨, ®­¨ ®â®¡à ¦ îâáï ¯® 㬮«ç ­¨î, ª®£¤  ¢ë¢®¤¨âáï
option_group2 dd op11 ;¯à¨«®¦¥­¨¥
Option_boxs dd op1,op2,op3,0
Option_boxs2 dd op11,op12,0
 
offst: db 'OFFSET:'
op_text: ; ‘®¯à®¢®¦¤ î騩 ⥪áâ ¤«ï 祪 ¡®ªá®¢
.1 db 'Absolutely'
.e1:
.2 db 'Forward'
.e2:
.3 db 'Back'
.e3:
 
labelt: db 'HeEd'
labellen:
op_text2:
.11 db 'Hex'
.e11:
.21 db 'ASCII'
.e21:
 
;text for hi-level menu buttons
f_menu: db 'File'
e_menu: db 'Coding'
h_menu: db 'Help'
;text for low-level menu buttons
;menu File
m_open: db 'Open'
m_save: db 'Save'
m_exit: db 'Exit'
;menu coding
m_win2dos: db 'Win->Dos'
m_win2koi: db 'Win->Koi'
m_win2iso: db 'Win->Iso'
m_dos2win: db 'Dos->Win'
m_dos2koi: db 'Dos->Koi'
m_dos2iso: db 'Dos->Iso'
;menu Help
m_help: db 'Help'
m_about: db 'About'
;tables for coding
WIN_TABLE:
db 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9
db 0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3
db 0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD
db 0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7
db 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1
db 0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB
db 0xFC,0xFD,0xFE,0xFF
DOS_TABLE:
db 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89
db 0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93
db 0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D
db 0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7
db 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xE0,0xE1
db 0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB
db 0xEC,0xED,0xEE,0xEF
KOI_TABLE:
db 0xE1,0xE2,0xF7,0xE7,0xE4,0xE5,0xF6,0xFA,0xE9,0xEA
db 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5
db 0xE6,0xE8,0xE3,0xFE,0xFB,0xFD,0xFF,0xF9,0xF8,0xFC
db 0xE0,0xF1,0xC1,0xC2,0xD7,0xC7,0xC4,0xC5,0xD6,0xDA
db 0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD2,0xD3
db 0xD4,0xD5,0xC6,0xC8,0xC3,0xDE,0xDB,0xDD,0xDF,0xD9
db 0xD8,0xDC,0xC0,0xD1
ISO_TABLE:
db 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9
db 0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3
db 0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD
db 0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7
db 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1
db 0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB
db 0xEC,0xED,0xEE,0xEF
 
;text for help_window
help_label: db 'Help for HeEd.'
system_path db '/sys/lib/'
boxlib_name db 'box_lib.obj',0
 
head_f_i:
head_f_l db 'error',0
err_message_found_lib db 'box_lib.obj was not found',0
err_message_import db 'box_lib.obj was not imported',0
 
sel_text db "From to",0
 
help_but_text = menu_text_area_3 ;db 'Help',0
error_open_file_string db "Isn't found!",0
error_save_file_string db "Isn't saved!",0
string_cp866 db ' cp866'
string_cp1251 db 'cp1251'
string_koi8r db 'koi8-r'
string_ins db 'Ins'
 
 
align 4
number_strings dd 16 ;ª®«¨ç¥á⢮ áâப ­  «¨áâ¥
;bytes_per_line dd 16 ;ª®«-¢® á⮫¡æ®¢
 
group_bytes dd 8
bytes_per_line dd 16
 
 
 
;blocks_counter dd 1
;blocks_table dd 0
cursor dd 1
 
flags dw 001000010b
;¡¨â 0: ¢ edit_box - ¢®á¯à¨ï⨥/(­¥) ¢á¥å ¢¢®¤¨¬ëå ᨬ¢®«®¢
;1: 0/1 - ०¨¬ § ¬¥­ë/¢áâ ¢ª¨
;2: ¢ edit_box - ®¡à ¡®âª  Ctrl_G
;3: ¢ edit_box - ®¡à ¡®âª  Ctrl_F
;4: ¢ change_codepage - ¥á«¨ ¯®¤­ïâ, â® ¢®ááâ ­®¢¨âì ¯à¥¤ë¤ãéãî ª®¤¨à®¢ªã
;5: vertical_scroll_bar move
;6: ¯®«­ ï ¯¥à¥à¨á®¢ª  ®ª­ 
;7: horizontal_scroll_bar move
;8: 1 - ¢ë¤¥«¥­ ¡«®ª
;9: ¢ edit_box - ®¡à ¡®âª  Ctrl_B
;10: ¢ ¯ ¬ï⨠"¢¨á¨â" ᪮¯¨à®¢ ­­ë© ¡«®ª
 
help_text:
if lang eq ru
db '1.HeEd ¢ á®áâ®ï­¨¨ ®âªàëâì ä ©« ⮫쪮 ®¤¨­ à § ¨ '
db ' ­ã¦­®¥ ç¨á«® à § á®åà ­¨âì ¥£®. '
db '2.à¨ ®âªàë⨨ ä ©«  ¡¥§ à áè¨à¥­¨ï ­ ¤® íâ® à áè¨-'
db ' è¨à¥­¨¥ ¢á¥ à ¢­® 㪠§ë¢ âì ª ª âਠ¯à®¡¥«  ¯®á«¥'
db ' â®çª¨. '
db '3.‘ ¬® ®âªàë⨥ ä ©«  ¯à®¨á室¨â ¯à¨ ­ ¦ â¨¨ ª­®¯ª¨'
db ' "Go". '
db '4.‘®§¤ ­¨¥ ­®¢ëå ä ©«®¢ ¢ ¬¥­î ­¥ ¯à¥¤ãᬮâ७®, ­®'
db ' ¬®¦­® ¦¥ । ªâ¨à®¢ âì... '
db '5.‚ ä ©« § ¯¨á뢠¥âáï ⮫쪮 ª®«¨ç¥á⢮ ¡ ©â, ª®â®-'
db ' ஥ ¡ë«® à §¬¥à®¬ ä ©«  ¤® ®âªàëâ¨ï. '
db '6.à¨ ­ ¦ â¨¨ "Go" á ¯ãáâë¬ ¯®«¥¬ ¨¬¥­¨ ä ©«  ¢ë¢®-'
db ' ¤¨âáï ¯ ¬ïâì á  ¤à¥á  0å80000, ­® à §¬¥à ä ©«  '
db ' à ¢¥­ 0xFFFFFFFF. '
db ' (á¬. ¨­ä® "About") '
db 'Ctrl+O - ®âªàëâì ä ©« '
db 'Ctrl+S - á®åà ­¨âì '
db 'PageUp, PageDown - áâà ­¨æ  ¢¢¥àå/¢­¨§ '
db 'Ctrl+UP, Ctrl+Down - ¯à®ªàã⪠ áâà ­¨æë ­  áâà®- '
db ' ªã ¢¢¥àå/¢­¨§ ¡¥§ ᬥ饭¨ï ªãàá®à '
db 'Home,End - ¢ ­ ç «®/ª®­¥æ áâப¨ '
db 'Ctrl+Home, Ctrl+End - ¢ ­ ç «®/ª®­¥æ ä ©«  '
db 'Left, Right, UP, DN - ªãàá®à ¢«¥¢®/¢¯à ¢®/¢ëè¥/­¨¦¥'
db 'n - ¨­¢¥àâ¨à®¢ âì ¡ ©â '
db 'Ins - ०¨¬ § ¬¥­ë/¢áâ ¢ª¨ '
db ' Del - 㤠«¨âì ¡ ©â ¯®¤ ªãàá®à®¬ '
db ' BackSpace - 㤠«¨âì ¡ ©â ¯¥à¥¤ ªãàá®à®¬ '
db '~ - ᬥ­  ª®¤¨à®¢®ª cp866,cp1251 '
db 'Shift+~ - cp866/cp1251,koi8r '
db 'Ctrl+F - ¯®¨áª '
db 'Ctrl+G - ¯¥à¥å®¤ ­  ᬥ饭¨¥ '
db 'Ctrl+B - ¢ë¤¥«¨âì ¡«®ª '
db 'ESC - á­ïâì ¢ë¤¥«¥­¨¥ '
db 'Ctrl+C - ª®¯¨à®¢ âì ¡«®ª '
db 'Ctrl+V - ¢áâ ¢¨âì ¢ ¢ë¤¥«¥­­ãî ®¡« áâì'
db 'Ctrl+X - ¢ë१ âì ¢ ¡ãä¥à '
else
db '1.HeEd can once open file and many times save it. '
db '2.To open file without extension it is required to '
db ' specify anyway as three spaces after a dot. '
db '3.File is opened when the button "Go" is pressed. '
db '4.Creation of new files in the menu is not provided'
db ' but you can edit... '
db '5.Only number of bytes which was file size when '
db ' opening is written to file. '
db '6.If you press "Go" with empty filename field, '
db ' memory starting from address 0x80000 is output, '
db ' but file size equals to 0xFFFFFFFF. '
db ' (see info "About") '
db 'Ctrl+O - open file '
db 'Ctrl+S - save file '
db 'PageUp, PageDown - page up/down '
db 'Ctrl+UP, Ctrl+Down - scroll page by one string '
db ' up/down without cursor movement'
db 'Home,End - at the start/end of string '
db 'Ctrl+Home, Ctrl+End - at the start/end of file '
db 'Left, Right, Up, Dn - move cursor to the lft/rght..'
db 'n - invert byte '
db 'Ins - replace/past mode '
db ' Del - delete byte under cursor '
db ' BackSpace - delete byte before cursor '
db '~ - change codepages cp866,cp1251'
db 'Shift+~ - cp866/cp1251,koi8r '
db 'Ctrl+F - find '
db 'Ctrl+G - go to offset '
db 'Ctrl+B - select area '
db 'ESC - deselect area '
db 'Ctrl+C - copy area '
db 'Ctrl+V - past into area from buf '
db 'Ctrl+X - cut area into buffer '
end if
help_end:
;text for about_window
about_label: db 'About this funny.'
about_text:
if lang eq ru
db '¥ª®â®à ï ¨­ä®à¬ æ¨ï ¤«ï â¥å, ªâ® § å®ç¥â ¤®¯¨á âì '
db 'á çâ®-⮠᢮¥: ª®¤ ¯à ªâ¨ç¥áª¨ ­¥ ®¯â¨¬¨§¨à®¢ ­,'
db 'â ª çâ® à §®¡à âìáï ¡ã¤¥â ­¥ â ª 㦠᫮¦­®. ‘âப¨ '
db '¤«ï ª­®¯®ª ¬¥­î ¤®«¦­ë ¨¤â¨ ¯àאַ ¤à㣠§  ¤à㣮¬, '
db 'â. ª. ï ¯à¨ ¢ë¢®¤¥ ¨á¯®«ì§ãî ­¥ mov esi,à §¬¥à ¨ '
db 'mov edx, ¤à¥á   ¯à®áâ® ¯à¨¡ ¢«ïî ᬥ饭¨ï. —â® ª -'
db 'á ¥âáï ª®¤¨à®¢®ª ¨ à §¬¥à®¢ ä ©«  ¤«ï á®åà ­¥­¨ï, '
db 'â® ®áâ ¥âáï ⮫쪮 ¤®¡ ¢¨âì ª­®¯ª¨ ¬¥­î á ⥪á⮬ '
db '(¯à¨ ¤®¡ ¢«¥­¨¨ ­ ¤® ãç¨â뢠âì, çâ® ID ª­®¯ª¨ ®¯®§-'
db '­ îâáï dec ah,   ­¥ ª ª cmp ah,ID). …᫨ ¢á¥ ¦¥ ¡ã-'
db '¤¥â ­¥¯à¨ïâ­® à §¡¨à âìáï, â® ¬®¦¥â¥ ­ ¯¨á âì ¨ '
db 'á¯à®á¨âì. â  ¯à®£à ¬¬  ¡ë«  ­ ¯¨á ­  ¢ 室¥ à §¡®-'
db 'ப á GUI MeOS ¨ ¯®í⮬㠭¥ ¯à¥â¥­¤ã¥â ­  çâ®-â® '
db '¡®«ì襥, 祬 ¯à¨¬¥à. à®áâ® ­ ¤®¥«  íâ  â¥¬ ,   ¢ë-'
db 'ª¨­ãâì ¦ «ª®. mailto:babalbes@yandex.ru '
else
db 'Some information for those who want add to this '
db 'something their own: the code is practically not '
db 'optimized, so investigation is not complicated. '
db 'Strings for menu buttons must rank after each other'
db 'as I use not mov esi,size and mov edx,address when '
db 'output but simply add offsets. For encodins and '
db 'file sizes for save, it remains only add buttons '
db 'with text in menu (at addition one should take into'
db 'account that buttons ID are recognized as dec ah '
db 'rather than cmp ah,ID). Nevertheless if study is '
db 'unpleasant, you can write and ask. This program has'
db 'been written in course of study GUI MeOS and does '
db 'not therefore pretend on some more than example. '
db 'Just this theme bothers, but I regret to delete. '
db ' mailto:babalbes@yandex.ru '
end if
about_end:
 
 
 
 
;align 4096
font_buffer file 'cp866-8x16' ;ASCII+cp866 (+ð,ñ)
cp1251 file 'cp1251-8x16'
koi8_r file 'koi8-r-8x16'
 
 
;########################## open_dial
get_loops dd 0
dlg_pid_get dd 0
DLGPID dd 0
param:
dd 0 ; My dec PID
dd 0,0 ; Type of dialog
run_fileinfo:
dd 7
dd 0
dd param
dd 0
dd 0
;run_filepath
db '/sys/SYSXTREE',0
readdir_fileinfo:
dd 1
dd 0
dd 0
readblocks dd 0
directory_ptr dd 0
 
;##########################
 
 
title db _title
;---------------------------------------------------------------------
OpenDialog_data:
.type dd 0
.procinfo dd procinfo ;+4
.com_area_name dd communication_area_name ;+8
.com_area dd 0 ;+12
.opendir_pach dd temp_dir_pach ;+16
.dir_default_pach dd communication_area_default_pach ;+20
.start_path dd open_dialog_path ;+24
.draw_window dd draw_window_1 ;+28
.status dd 0 ;+32
.openfile_pach dd fname_buf ;+36
 
communication_area_name:
db 'FFFFFFFF_open_dialog',0
open_dialog_path:
db '/sys/File Managers/opendial',0
communication_area_default_pach:
db '/rd/1',0
 
Filter:
dd Filter.end - Filter
db 'BIN',0
db 'DAT',0
.end:
db 0
;---------------------------------------------------------------------
 
I_END:
file_name:
cur_dir_path rb 4096
buf_cmd_lin rb 0
procinfo: ;opendialog
threath_buf rb 0x400
path:
rb 1024+16 ;opendialog
 
sc system_colors
screen_table rd 1
begin_offset rd 1
file_buffer rd 1
 
process_info:
rb 1024
menu_opened db ?
m_text:
copy_buf rd 1
copy_len rd 1
 
current_offset rd 1
; rd 1 ;¯®¤ áâ à訩 dword
codepage_offset rd 1
codepage_offset_previous rd 1
low_area rd 1 ;ª®®à¤¨­ âë ­¨¦­¥© áâப¨
right_table_xy rd 1
 
prev_f_size_bl rd 1
 
len_str_scr rd 1
beg_str_scr rd 1
 
shblock_beg rd 1 ;ᬥ饭¨¥ ­ ç «  ¡«®ª 
shblock_end rd 1 ;ᬥ饭¨¥ ª®­æ  ¡«®ª 
 
;mouse_flag rd 1
file_size rd 1
; rd 1 ;¯®¤ áâ à訩 dword
 
ed_box_data: rd 8 ;¯¥à¢ë© dword -ª®«-¢® í«¥¬¥­â®¢ ¤«ï ®¡à ¡®âª¨, ¤ «¥¥ 㪠§ â¥«¨ ­  editX;
 
bufferfinfo rb 40
hex8_string rb 9 ;¡ãä¥à ¤«ï hex_output
go_to_string rb 9
find_string rb 17
sel1_string rb 9
sel2_string rb 9
cur_help_string rb 1 ;­®¬¥à áâப¨, á ª®â®à®© ¢ë¢®¤¨âáï ⥪áâ ¢ help - ®ª­¥
 
func_70 f70
;---------------------------------------------------------------------
fname_buf:
rb 4096
temp_dir_pach:
rb 4096
;---------------------------------------------------------------------
D_END:
/programs/develop/heed/trunk/koi8-r-8x16
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property