Added Slovarik sources (author - DoomEd Archangel)

git-svn-id: svn://kolibrios.org@1146 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maximYCH 2009-08-29 08:52:18 +00:00
parent 0dc8dae83d
commit 84932d86ad
9 changed files with 3505 additions and 0 deletions

View File

@ -0,0 +1,933 @@
lang equ ru ; ru en fr ge fi
;
; Assembler
; SMALL
; CODE
; Libary
;
; Ver 0.14 By Pavlushin Evgeni (RUSSIA)
; www.waptap@mail.ru
;Please compile aplications on FASM ver1.54 or higer!!!
;InfoList
;0.01 scank,putpix,puttxt
;0.02 label,random,colors
;0.03 window,startwd,endwd,attributes
;0.04 close,delay,scevent ~30.04.2004
;0.05 small random, ~04.05.2004
;0.06 wtevent ~09.05.2004
;0.07 timeevent ~23.05.2004
;0.08 txtput ~14.06.2004
;0.09 opendialog,savedialog ~20.06.2004
;0.10 wordstoreg by halyavin, add at ~30.08.2004
; random bug deleted eax is use.
;0.11 loadfile from me +puttxt bug del ~07.09.2004
;0.12 open/save dialog ~13.09.2004
;0.13 dialogs bugs deleted
;0.14 drawlbut ~03.10.2004
;0.15 extendet label!
; LOADFILE
; (SYNTAX) LOADFILE 'full_path_to_file',file_load_area,file_temp_area
; (SAMPLE) LOADFILE '/rd/1/clock.bmp',load_area,temp_area
macro loadfile file_name,file_load_area,file_temp_area
{
local open,fileinfo,string
jmp open
fileinfo:
dd 0
dd 0
dd 1
dd file_load_area
dd file_temp_area
string:
db file_name,0
open:
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[file_load_area+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
}
;***********************************************************
macro savefile file_name,file_save_area,file_temp_area,fsize
{
local save,fileinfo,string ;,counter00
jmp save
;counter00 dd 0
fileinfo:
dd 1
dd 0
dd fsize ;counter00
dd file_save_area
dd file_temp_area
string:
db file_name,0
save:
;xor edi,edi
; sub edi,file_save_area ; calculate dump size
; mov edx,edi
;mov [counter00],edi
; mov dword [fileinfo+8],1 ; how many blocks to write (1)
; mov eax,58
; mov ebx,fileinfo
; int 0x40
; mov eax,[file_load_area+2]
; shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
; inc eax
; mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
}
;***********************************************************
;macro wordstoreg reg,hiword,loword
;{
;if hiword eqtype 0 & loword eqtype 0
; mov reg,dword hiword*65536+loword
;else if hiword eqtype 12 & loword eqtype eax
; mov reg,dword hiword*65536
; add reg,dword loword
;else if hiword eqtype 12 & loword eqtype [123]
; mov reg,dword hiword*65536
; add reg,dword loword
;else
; mov reg,dword hiword
; shl reg,16
; add reg,dword loword
;end if
;}
macro dword2reg reg,doubleword
{
if doubleword eq
; not changes
else
mov reg,dword doubleword
end if
}
macro words2reg reg,hiword,lowword
{
if hiword eq
if lowword eq
; not changes
else
if lowword eqtype 12
and reg,dword 0xffff0000
add reg,dword lowword
else
and reg,dword 0xffff0000
add reg,dword lowword
end if
end if
else
if lowword eq
if hiword eqtype 12
and reg,dword 0x0000ffff
add reg,dword hiword*65536
else
shl reg,16
add reg,dword hiword
ror reg,16
end if
else
if lowword eqtype 12 & hiword eqtype 12
if lowword eq 0 & hiword eq 0
xor reg,reg
else
mov reg,dword hiword*65536+lowword
end if
else
mov reg,dword hiword
shl reg,16
add reg,dword lowword
end if
end if
end if
}
; DRAW BUTTON with label
macro drawlbut x,y,xs,ys,text,id,bcolor,tcolor
{
local asd,lab
jmp asd
lab db text ;arg label
asd:
words2reg ebx,x,xs
words2reg ecx,y,ys
mov edx,id
mov esi,bcolor
mov eax,8
int 0x40
mov eax,asd-lab ;calc size
mov ebx,6
mul ebx
mov esi,eax
mov eax,xs
sub eax,esi
shr eax,1
add eax,x
mov edx,ys
sub edx,7
shr edx,1
add edx,y
mov ebx,eax
shl ebx,16
add ebx,edx
mov ecx,tcolor ;arg4 color
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
macro opendialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
;mov [get_loops],0
mov [dlg_pid_get],0
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
; 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
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
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)
;
; 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,150 ; size 150 bytes
int 0x40
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
;
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov ebx,run_fileinfo
int 0x40
call redproc
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
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:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
; 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
call redproc ;show DLG_PID
jmp getmesloop
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
jmp openoff
; DATA AREA
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 16
dd 0
dd param
dd 0
dd procinfo ; 0x10000
;run_filepath
db '/RD/1/SYSXTREE',0
procinfo:
times 1024 db 0
}
macro savedialog redproc,openoff,erroff,path
{
local new_d, get_loops, dlg_pid_get, DLGPID, num_of_proc
local run_fileinfo, run_filepath, param
local getmesloop, loox, mred, mkey, mbutton, mgetmes
local dlg_is_work, ready, procinfo
;
; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec,
; 1 byte space, 1 byte type of dialog (O - Open ,S - Save)
;
cld
;; mov esi,path
mov edi,path
mov eax,0
mov ecx,200
rep stosb
;mov [get_loops],0
mov [dlg_pid_get],0
; Get my PID in dec format 4 bytes
mov eax,9
mov ebx,procinfo
mov ecx,-1
int 0x40
; 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
cld
new_d:
xor edx,edx
div ebx
add dl,'0'
mov [edi],dl
dec edi
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 'S' ;Get Open dialog (Use 'S' for Save dialog)
;
; 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,150 ; size 150 bytes
int 0x40
; change wanted events list 7-bit IPC event
mov eax,40
mov ebx,01000111b
int 0x40
;
; STEP 3 run SYSTEM XTREE with parameters
;
mov eax,58
mov ebx,run_fileinfo
int 0x40
call redproc
mov [get_loops],0
getmesloop:
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
; Get number of procces
mov ebx,procinfo
mov ecx,-1
mov eax,9
int 0x40
mov ebp,eax
loox:
mov eax,9
mov ebx,procinfo
mov ecx,ebp
int 0x40
mov eax,[DLGPID]
cmp [procinfo+30],eax ;IF Dialog find
je dlg_is_work ;jmp to dlg_is_work
dec ebp
jnz loox
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:
call redproc
jmp getmesloop
mkey:
mov eax,2
int 0x40 ; read (eax=2)
jmp getmesloop
mbutton:
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
jne getmesloop
mov eax,-1 ; close this program
int 0x40
mgetmes:
; 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
call redproc ;show DLG_PID
jmp getmesloop
ready:
;
; The second message get
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,200
rep movsb
mov [edi],byte 0
jmp openoff
; DATA AREA
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 16
dd 0
dd param
dd 0
dd procinfo
;run_filepath:
db '/RD/1/SYSXTREE',0
procinfo:
times 1024 db 0
}
; RANDOM - generate random count (small)
; (SYNTAX) RANDOM MaxCount,OutArgument
; (SAMPLE) RANDOM 10000,eax
; ( NOTE ) Maxint<65536 ; use random 65536,eax for more combinations
randomuse = 0
macro random arg1,arg2
{
local rxproc
randomuse = randomuse + 1
jmp rxproc
if defined randomuse & randomuse = 1
randomproc:
jmp rnj
rsx1 dw 0x4321
rsx2 dw 0x1234
rnj:
; mov eax,arg1
push bx
push cx
push dx
push si
push di
mov cx,ax
mov ax,word ptr rsx1
mov bx,word ptr rsx2
mov si,ax
mov di,bx
mov dl,ah
mov ah,al
mov al,bh
mov bh,bl
xor bl,bl
rcr dl,1
rcr ax,1
rcr bx,1
add bx,di
adc ax,si
add bx,0x62e9
adc ax,0x3619
mov word ptr rsx1,bx
mov word ptr rsx2,ax
xor dx,dx
cmp ax,0
je nodiv
cmp cx,0
je nodiv
div cx
nodiv:
mov ax,dx
pop di
pop si
pop dx
pop cx
pop bx
and eax,0000ffffh
; mov arg2,0
; mov arg2,eax
ret
end if
rxproc:
mov eax,arg1
call randomproc
mov arg2,eax
}
macro scank
{
mov eax,10
int 0x40
}
macro putpix x,y,color
{
mov ebx,x
mov ecx,y
mov edx,color
mov eax,1
int 0x40
}
macro puttxt x,y,offs,size,color
{
; mov ebx,x
; shl ebx,16
; add ebx,y
words2reg ebx,x,y
dword2reg ecx,color
dword2reg edx,offs
dword2reg esi,size
; mov ecx,color
; mov edx,offs
; mov esi,size
mov eax,4
int 0x40
}
macro outcount data, x, y, color, numtype
{
mov ecx,data
mov ebx,numtype
mov bl,0
; mov edx,x*65536+y
words2reg edx,x,y
mov esi,color
mov eax,47
int 0x40
}
; SCEVENT - Scan event
macro scevent red,key,but
{
mov eax,11
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
; WTEVENT - Wait event
macro wtevent red,key,but
{
mov eax,10
int 0x40
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
; TIMEEVENT - Wite for event with timeout
macro timeevent xfps,noevent,red,key,but
{
mov eax,23
mov ebx,xfps
int 0x40
cmp eax,0
je noevent
dec eax
jz red
dec eax
jz key
dec eax
jz but
}
; CLOSE - Close program
macro close
{
mov eax,-1
int 0x40
}
; DELAY - Create delay 1/100 sec
; (SYNTAX) Delay time
; (SAMPLE) Delay 100 ;delay 2 sec 1/100*200=2 sec
macro delay arg1
{
mov eax,5
mov ebx,arg1
int 0x40
}
; WINDOW - Draw window
; (SYNTAX) WINDOW Xstart,Ystart,'Text',Color
; (SAMPLE) WINDOW 10,10,640+8,480+24,window_Skinned
macro window arg1,arg2,arg3,arg4,arg5
{
; mov ebx,arg1*65536+arg3
; mov ecx,arg2*65536+arg4
words2reg ebx,arg1,arg3
words2reg ecx,arg2,arg4
mov edx,arg5
mov eax,0
int 0x40
}
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
{
; mov ebx,arg1*65536+arg3
; mov ecx,arg2*65536+arg4
words2reg ebx,arg1,arg3
words2reg ecx,arg2,arg4
mov edx,arg5
mov esi,arg6
mov edi,arg7
mov eax,0
int 0x40
}
; STARTWD - Start of window draw
macro startwd
{
mov eax,12
mov ebx,1
int 0x40
}
; ENDWD - End window draw
macro endwd
{
mov eax,12
mov ebx,2
int 0x40
}
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,'Text',Color
; (SAMPLE) LABEL 10,12,'Hello World!',cl_Green+font_Big
macro putlabel arg1,arg2,arg3,arg4
{
local asd,lab
jmp asd
lab db arg3 ;arg label
asd:
; mov ebx,arg1 ;arg1=y arg2=x
; shl ebx,16
; add ebx,arg2
words2reg ebx,arg1,arg2
dword2reg ecx,arg4
mov edx,lab
mov esi,asd-lab ;calc size
mov eax,4
int 0x40
}
;Key's
key_Up equ 178
key_Down equ 177
key_Right equ 179
key_Left equ 176
key_Esc equ 27
key_Space equ 32
key_Enter equ 13
key_Bspace equ 8
key_F1 equ 50
key_F2 equ 51
key_F3 equ 52
key_F4 equ 53
key_F5 equ 54
key_F6 equ 55
key_F7 equ 56
key_F8 equ 57
key_F9 equ 48
key_F10 equ 49
key_F11 equ 68
key_F12 equ 255
key_Home equ 180
key_End equ 181
key_PgUp equ 184
key_PgDown equ 183
;Attributes
;Window Attributes
window_Skinned equ 0x03000000
window_Type2 equ 0x02000000
window_Type1 equ 0x00000000
window_Reserve equ 0x01000000
;Font Attributes
font_Big equ 0x10000000
;Colors
cl_White equ 0x00ffffff
cl_Black equ 0x00000000
cl_Grey equ 0x00888888
cl_Red equ 0x00ff0000
cl_Lime equ 0x0000ff00
cl_Green equ 0x0000af00
cl_Blue equ 0x000000ff
cl_Purple equ 0x008080ff
cl_Violet equ 0x008040ff
cl_Cyan equ 0x0040e0ff

Binary file not shown.

View File

@ -0,0 +1,840 @@
;
; Slovarik 0.3.1 (10 August 2005)
; DoomEd Archangel
;
;*********HEADER************
use32
org 0x0
db 'MENUET01'
dd 0x01
dd lblSTART
dd lblIMG_END
dd lblMEMORY
dd lblSTACK
dd 0x0,0x0
;****************************
include 'ascl.inc'
lblSTART:
call load_ini ;Load ini file (path to last opened dictionary
call load_dict ;Load dictionary
;----if no errors then continue
win_redraw:
call draw_window
still:
mov eax,10
int 0x40
cmp eax,1
je win_redraw
cmp eax,2
je key_pressed
cmp eax,3
je button_pressed
jmp still
key_pressed:
;mov eax,2
int 0x40
cmp ah,27
je clear_all_2
cmp ah,13
je translate_now
cmp [inputboxpressed],1
jne not_print
cmp ah,8
jne not_backspace
mov bl,[inputboxlen]
cmp bl,1
jb not_print
dec [inputboxcurchar]
dec [inputboxlen]
xor ebx,ebx
mov bl,[inputboxcurchar]
mov byte [inputbox+ebx],0
sub [xcursor],6
call draw_inputbox
call draw_cursor
jmp still
not_backspace:
cmp [inputboxlen],52
je not_print
xor ebx,ebx
mov bl,[inputboxcurchar]
mov [inputbox+ebx],ah
inc [inputboxcurchar]
inc [inputboxlen]
call draw_inputbox
add [xcursor],6
call draw_cursor
not_print:
jmp still
button_pressed:
mov eax,17
int 0x40
cmp ah,1
je lbl_close_now
cmp ah,2
je inputbox_pressed
cmp ah,3
je translate_now
cmp ah,4
je change_dict
jmp still
draw_window:
pusha
mov eax,12
mov ebx,1
int 0x40
mov eax,0
mov ebx,30*65536+400
mov ecx,30*65536+170
mov edx,0x03cccccc
mov edi,0x00777777
int 0x40
mov eax,4
mov ebx,8*65536+8
mov ecx,0xf0ffffff
mov edx,win_header
mov esi,win_header_l-win_header;8
int 0x40
mov eax,4
mov ebx,10*65536+41
mov ecx,0x00000000
mov edx,txtWord
mov esi,txtWord_l-txtWord ; 6
int 0x40
mov eax,4
mov ebx,10*65536+67
mov ecx,0x00000000
mov edx,txtVariants
mov esi,txtVariants_l-txtVariants ;9
int 0x40
mov eax,4
mov ebx,10*65536+91
mov ecx,0x00000000
mov edx,txtTranslate
mov esi,txtTranslate_l-txtTranslate ;8
int 0x40
mov eax,4
mov ebx,10*65536+115
mov ecx,0x00000000
mov edx,txtTranscript
mov esi,txtTranscript_l-txtTranscript ;9
int 0x40
mov eax,8
mov ebx,125*65536+150
mov ecx,135*65536+20
mov edx,3
mov esi,0x00dddddd
int 0x40
mov eax,4
mov ebx,168*65536+142
mov ecx,0x00000000
mov edx,txtTranslatenow
mov esi,txtTranslatenow_l-txtTranslatenow ;9
int 0x40
mov eax,8
mov ebx,10*65536+50
mov ecx,135*65536+20
mov edx,4
mov esi,0x00dddddd
int 0x40
mov eax,4
mov ebx,14*65536+142
mov ecx,0x00000000
mov edx,txtChangeDict
mov esi,txtChangeDict_l-txtChangeDict ;7
int 0x40
;-------------------------------
call draw_inputbox
call print_variants
call print_trans_word
call print_transcript
;--------------------------------
mov eax,12
mov ebx,2
int 0x40
popa
ret
draw_inputbox:
mov eax,8
mov ebx,68*65536+320
mov ecx,38*65536+14
mov edx,2
int 0x40
mov eax,13
mov ebx,68*65536+320
mov ecx,38*65536+14
mov edx,0x00ffffff
int 0x40
call draw_inputbox_text
ret
draw_inputbox_text:
mov eax,4
mov ebx,70*65536+40
mov ecx,0x00000000
mov edx,inputbox
mov esi,52
int 0x40
ret
draw_cursor:
mov eax,13
mov bx,[xcursor]
shl ebx,16
mov bx,1
; mov ebx,68*65536+1
mov ecx,40*65536+10
mov edx,0x000000ff
int 0x40
ret
; END DRAW WINDOW
;-------------------PROGRAM-------------------
lbl_close_now:
call save_ini
mov eax,-1
int 0x40
inputbox_pressed:
mov [inputboxpressed],1
jmp still
print_variants:
mov eax,13
mov ebx,68*65536+320
mov ecx,65*65536+14
mov edx,0x00eeeeee
int 0x40
mov eax,4
mov ebx,70*65536+67
mov ecx,0x00000000
mov edx,variants
mov esi,52
int 0x40
ret
translate_now:
mov [inputboxpressed],0
mov edi,inputbox ;®¯à¥¤¥«ï¥¬ ¤«¨­ã ¢¢¥¤ñ­­®© áâப¨
mov ecx,52 ;50
xor eax,eax
repne scasb
sub edi,inputbox
dec edi
mov [search_len],edi
inc [search_len] ;------------increase
cmp [search_len],1
je nothing_in_inputbox
call count_dict_size
cmp [dict_size],0
je still
call clear_tr_word
call clear_variants
call clear_transcript
jmp search
count_dict_size:
pusha
mov edi,dictionary ;®¯à¥¤¥«ï¥¬ ¤«¨­ã á«®¢ àï
mov ecx,0x7FFFF
xor eax,eax
repne scasb
sub edi,dictionary
dec edi
mov [dict_size],edi
popa
ret
nothing_in_inputbox:
call clear_tr_word
call clear_variants
call clear_transcript
cld
mov esi,errNothingEntered
mov edi,tr_word
mov ecx,14
rep movsb
jmp win_redraw
clear_inputbox:
cld
mov edi,inputbox
mov ecx,13 ;52/4
xor eax,eax
rep stosd
mov [inputboxcurchar],0
mov [xcursor],69
ret
clear_tr_word:
cld
mov edi,tr_word
mov ecx,13 ;52/4
xor eax,eax
rep stosd
ret
clear_variants:
cld
mov edi,variants
mov ecx,13 ;52/4
xor eax,eax
rep stosd
ret
clear_transcript:
cld
mov edi,trscript_word
mov ecx,13 ;52/4
xor eax,eax
rep stosd
ret
clear_all_in_1:
cld
mov edi,inputbox ; 52*4 = 208 / 4 = 52
mov ecx,52
xor eax,eax
rep stosd
mov [inputboxpressed],1
mov [inputboxcurchar],0
mov [xcursor],69
ret
clear_all_2:
call clear_all_in_1
call draw_window
jmp still
print_trans_word:
mov eax,13
mov ebx,68*65536+320
mov ecx,89*65536+14
mov edx,0x00eeeeee
int 0x40
mov eax,4
mov ebx,70*65536+91
mov ecx,0x00000000
mov edx,tr_word
mov esi,52
int 0x40
ret
trans_not_found:
cld
mov esi,tr_not_found_text
mov edi,tr_word
mov ecx,18 ;200
rep movsb
call clear_transcript
call clear_variants
call draw_window
ret
print_transcript:
mov eax,13
mov ebx,68*65536+320
mov ecx,113*65536+14
mov edx,0x00eeeeee
int 0x40
mov eax,4
mov ebx,70*65536+115
mov ecx,0x00000000
mov edx,trscript_word
mov esi,52
int 0x40
ret
;-----------------------------------------------------
; <20>ŽˆŠ <20>Ž ”€‰‹“ <><E28098>Ž—<C5BD>ˆŠ€
search:
xor esi,esi
mov edi,dictionary ;<3B>€—€Ž …„ˆ
mov ecx,[dict_size] ;<3B>€‡Œ…<C592> …‘•
news:
push edi
news2:
; 1) LOAD BYTES
mov al,[esi+inputboxplus] ; [esi+inputbox]
mov bl,[edi]
; 2) COMPARE BYTES
cmp al,bl
je yes_char
; 3) LETTER?
cmp al,'A'
jb notequal
cmp al,'ñ'
ja notequal
;----------
cmp al,'z' ;122 ;z=122
jbe cpLAT
;cpCYR
;---------------------TEST
cmp al,' ' ;cyr A
jb .bigletter ;if letter<128
;--------
cmp al,'à'
jae .more_175 ;if letter>175
sub al,32
jmp compare_bytes
.more_175:
sub al,80
jmp compare_bytes
.bigletter:
cmp al,'<27>'
jae .more_175_2
add al,32
jmp compare_bytes
.more_175_2:
add al,80
jmp compare_bytes
;---------------TEST
;cpLAT
cpLAT:
; 4) A->a OR a->A
cmp al,'a'
jb @f
add al,-32
jmp compare_bytes
@@:
cmp al,'Z'
ja notequal
add al,32
;-----
compare_bytes:
cmp al,bl
jne notequal
yes_char:
inc edi
inc esi
cmp esi,[search_len]
jge sfound
jmp news2
notequal:
pop edi
xor esi,esi
inc edi
loop news
call trans_not_found
jmp still
sfound:
mov [total_smesh],edi ;ᬥ饭¨¥ ¯® ä ©«ã á«®¢ àï
;-------------------
;-------search for transcription
mov esi,[total_smesh]
cld
again0:
lodsb
cmp al,'|'
jne again0
mov [starting_transcrtiontion],esi
cld
again00:
lodsb
cmp al,'|' ;13
jne again00
mov [ending_transcrtiontion],esi
mov eax,[starting_transcrtiontion]
sub [ending_transcrtiontion],eax
dec [ending_transcrtiontion]
cld ;‚›‚Ž„ ‘‹Ž‚€
mov esi,[starting_transcrtiontion]
mov edi,trscript_word
mov ecx,[ending_transcrtiontion]
rep movsb
;-------search for translation
mov esi,[starting_transcrtiontion]
add esi,[ending_transcrtiontion]
cld
again:
lodsb
cmp al,'|'
jne again
mov [starting_kav],esi
cld
again2:
lodsb
cmp al,10 ;13
jne again2
mov [ending_kav],esi
mov eax,[starting_kav]
sub [ending_kav],eax
dec [ending_kav]
;-----------------------------------------------
cld ;‚›‚Ž„ ‘‹Ž‚€
mov esi,[starting_kav]
mov edi,tr_word
mov ecx,[ending_kav]
rep movsb
;--------
;search backward
mov esi,[total_smesh]
cld
again3:
lodsb
cmp al,'|'
jne again3
mov [endingword],esi
dec [endingword]
again4:
dec esi
dec esi
cld
lodsb
cmp al,10 ;13;' '
jne again4
mov [startingword],esi
mov eax,[startingword]
sub [endingword],eax
cld ;‚›‚Ž„ ‘‹Ž‚€
mov esi,[startingword]
mov edi,variants
mov ecx,[endingword]
rep movsb
;-----------------------------------------------
call draw_window
jmp still
;-----------------------------------------------------
;---clear dictionary
clear_dict:
mov edi,dictionary
mov ecx,131072 ; 0x80000 / 4
xor eax,eax
rep stosd
ret
;---- change dictionary
change_dict:
opendialog draw_window,open_ok,open_err,fileinfo.path
open_ok:
call clear_dict
call clear_all_in_1
call load_dict
jmp still
open_err:
call load_dict.call_error
jmp still
;---- load dictionary
load_dict:
;-open from ASCL 9
mov dword [fileinfo+8],1
mov eax,58
mov ebx,fileinfo
int 0x40
mov eax,[dictionary+2]
shr eax,9
inc eax
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
;--------
cmp eax,0 ;0- open ok
je .return ; win_redraw
cmp eax,5 ;5- open ok
je .return
cmp eax,6 ;6- open ok???????????
je .return
; if we can't open the dictionary
.call_error:
cld
mov esi,errDictNotFound
mov edi,tr_word
mov ecx,errDictNotFound_l-errDictNotFound ;23
rep movsb
call draw_window
mov eax,5 ;delay
mov ebx,100 ;1 sec
int 0x40
.return:
call check_header
ret
;--- copy path to dictionary
copy_path:
call count_dict_size ;int [dict_size] will be size of path to dictionary
mov esi,dictionary
mov edi,fileinfo.path ;40
mov ecx,[dict_size]
cld
rep movsb
ret
;----------load config file
load_ini:
cld
mov esi,fileinfo_ini.inipath
mov edi,fileinfo.path
mov ecx,19
rep movsb
mov eax,58
mov ebx,fileinfo
int 0x40
call copy_path
mov [dict_size],0
call clear_dict
ret
;----------------------------
clear_fileinfo_path:
mov edi,fileinfo.path
mov ecx,256/4
xor eax,eax
rep stosd
ret
;-------save config file
save_ini:
cmp dword [dictionary],0
jne .save
call clear_fileinfo_path
cld
mov esi,default_dict_path
mov edi,fileinfo.path
mov ecx,14
rep movsb
.save:
mov edi,fileinfo.path ;®¯à¥¤¥«ï¥¬ ¤«¨­ã á«®¢ àï
mov ecx,256
xor eax,eax
repne scasb
sub edi,fileinfo.path
dec edi
mov [fileinfo_ini.size],edi
mov eax,58
mov ebx,fileinfo_ini
int 0x40
ret
;------ check dictionary header
check_header:
mov eax,'DICT'
cmp dword [dictionary],eax
je .return
call clear_tr_word
cld
mov esi,errDictHeader
mov edi,tr_word
mov ecx,errDictHeader_l-errDictHeader ;23
rep movsb
.return:
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;data;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
win_header:
db '‘«®¢ à¨ª'
win_header_l:
tr_not_found_text:
db '<27><EFBFBD>Ž„ <20><20>€‰„…<E2809E>!'
tr_not_found_text_l:
txtWord:
db '‘«®¢®:'
txtWord_l:
txtTranslate:
db '<27>¥à¥¢®¤:'
txtTranslate_l:
txtVariants:
db '‚ à¨ ­âë:'
txtVariants_l:
errDictNotFound:
db 'Žè¨¡ª  ®âªàëâ¨ï ä ©«  ¨«¨ ®âªàë⨥ ®â¬¥­¥­®!'
errDictNotFound_l:
txtTranslatenow:
db '<27>¥à¥¢¥áâ¨'
txtTranslatenow_l:
errNothingEntered:
db '‚¢¥¤¨â¥ á«®¢®!'
errNothingEntered_l:
txtTranscript:
db '’à ­áªà.:'
txtTranscript_l:
txtChangeDict:
db '‘«®¢ àì'
txtChangeDict_l:
errDictHeader:
db '<27>â®â ä ©« ­¥ ï¥âáï á«®¢ à¥¬!'
errDictHeader_l:
xcursor dw 69
default_dict_path db '/RD/1/DICT.TXT'
fileinfo_ini:
.oper:
dd 1
dd 0x0
.size:
dd 256
dd fileinfo.path
dd os_work_mem
.inipath:
db '/rd/1/slovarik.ini',0
fileinfo:
dd 0 ; 0 = —<E28099>ˆ… ”€‰‹€
dd 0x0 ; ­®¬¥à ¡«®ª  ä ©«  (512 ¡ ©â, ­ã¬¥à æ¨ï ­ ç¨­ ¥âáï á ­ã«ï)
dd 0x1 ; ᪮«ìª® ¡«®ª®¢ áç¨â뢠âì
dd dictionary ; ªã¤  áç¨â뢠âì
dd os_work_mem ; 0x10000 ; ¯ ¬ïâì ¤«ï à ¡®âë Ž‘ - 4096 ¡ ©â
.path:
db '',0 ;'/RD/1/DICT.TXT',0
lblIMG_END:
rb 257 ;times 257 db 0 ;for path
starting_kav dd 0
ending_kav dd 0
starting_transcrtiontion dd 0
ending_transcrtiontion dd 0
total_smesh dd 0
inputboxpressed db 0
search_len dd 0
inputboxcurchar db 0
inputboxlen db 0
inputboxplus:
;db ' '
db 10 ;for search
inputbox:
rb 52 ;times 52 db 0
tr_word:
rb 52 ;times 52 db 0
trscript_word:
rb 52 ;times 52 db 0
variants:
rb 52 ;times 52 db 0
startingword dd 0
endingword dd 0
dict_size dd 0
dictionary:
rb 0x80000;~524 kb for dictionary
;0x100000 ;1 mb for future BIG dictionary :)
os_work_mem:
rb 0x10000
rb 4096
lblMEMORY:
lblSTACK:

View File

@ -0,0 +1 @@
/RD/1/DICT_ENG.TXT

View File

@ -0,0 +1,2 @@
fasm SLOVARIK.asm SLOVARIK
pause

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
DICT ¯à¨¬¥à ¯à®á⮣® á«®¢ àï ¤«ï â¥áâ  ¯®¨áª  ¢ ª¨à¨««¨æ¥
€‡<EFBFBD>“Š€||ABC
§¤®à®¢ì¥|zdorovye|health
ï|ya| I, me

View File

@ -0,0 +1,31 @@
Словарик
[v 0.3.1] [10.08.2005]
-Исправлено несколько ошибок при смене словарей
-баг с пустым ini файлом
-Чуть-чуть почистил код
[v 0.3] [27.07.2005]
Добавлено:
-Смена словарей (исп. диалоговые окна sysxtree)
-За знак разделителя взят "|"
-Сохранение пути к последнему использованному словарю
-Возможность искать в русско-иностранных словарях.
[v 0.2] [25.07.2005]
-Нашёл словарик на 1700 слов. Немного отформатировав понял что так дальше нельзя.
-Изменил систему заполнения словаря.
-Добавил транскрипцию
-Поля ввода и вывода расширены до 52х символов. Этого должно хватить даже для небольших выражений.
-Т.к. файл словаря ещё пока не большой, я ограничил место выделяемое ему до 500 кб..
В планах:
-добавления механизма сжатия и разжатия ;) словарей.
-возможности смены словаря "на лету"
-динамического выделения памяти под открываемый словарь (Колибри 5 :) )
-чистка "грязного" кода
[v 0.1] [22.07.2005]
Вроде работает без ошибок. В архив включен словарь с всего несколькими словами, который надо срочно заполнять.

View File

@ -0,0 +1,28 @@
Словарик ( в архив включен словарь на ~ 1700 слов)
Обычный словарик, который ищет введенное слово в словаре и выводит его перевод, если он найден. Может искать по начальным буквам (возможный, первый найденный вариант будет выведен в поле "варианты"), но поиск по маске ещё не поддерживается.
Словарь находится в файле dict_*.txt, принцип заполнения которого приведён ниже. Как говорится сделать
программу это одно, а заполнить словарь чтобы он был хоть немного пригоден к использованию это уже другое!
Для работы программы просто поместите файлы SLOVARIK, SLOVARIK.INI, DICT_ENG.TXT на рамдиск (или в любую папку на винте, только перекомпилируйте исходник с полным путём к ini файлу и пропишите путь к словарю в ini файле.
Принцип заполнения файла словаря:
Файл словаря начинается с заголовка DICT, пары байт 13,10 (это перевод строки и возврат коретки - делается одним нажатием клавиши [Enter]) и заканчивается ими же, далее идёт слово на иностранном языке, | , транскрипция, | , слово на русском, 13,10.
например
....
whole|хоул|весь, целый
....
Если вы хотите оставить перевод без транскрипции то просто не пишите её.
СЛОВАРЬ ДОЛЖЕН ЗАПОЛНЯТЬСЯ В СЛОВАРНОМ ПОРЯДКЕ, то есть:
a...b...c....d...e...f... и т.д.
Управление клавиатурой:
ESC - очистить все поля и сфокусировать на поле ввода.
ENTER - перевести введенное слово
Изменения смотрите в файле history.
О всех глюках ОБЯЗАТЕЛЬНО писать на форум или на archangel [ at ] mail.kz, в теме писать MenuetOS или Словарик