Small corrections

git-svn-id: svn://kolibrios.org@3683 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
GerdtR 2013-06-18 14:40:40 +00:00
parent 97b8aba9e2
commit ced1aca361

View File

@ -1,29 +1,28 @@
use32 ; âà ­á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §à來ëå ª®¬ ­¤ë
org 0x0 ; ¡ §®¢ë©  ¤à¥á ª®¤ , ¢á¥£¤  0x0
db 'MENUET01' ; ¨¤¥­â¨ä¨ª â®à ¨á¯®«­ï¥¬®£® ä ©«  (8 ¡ ©â)
dd 0x1 ; ¢¥àá¨ï ä®à¬ â  § £®«®¢ª  ¨á¯®«­ï¥¬®£® ä ©« 
dd start ;  ¤à¥á, ­  ª®â®àë© á¨á⥬  ¯¥à¥¤ ñâ ã¯à ¢«¥­¨¥
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥­¨ï ¢ ¯ ¬ïâì
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
dd mem ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
dd 0x0 ; 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
dd 0;pathprog ;¯ãâì ¨ ¨¬ï ¯à®£¨
include "../../macros.inc" include "../../macros.inc"
include "../../proc32.inc" include "../../proc32.inc"
include "API.inc"
include "../../dll.inc" include "../../dll.inc"
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include "API.inc"
use32 ; òðàíñëÿòîð, èñïîëüçóþùèé 32 ðàçðÿäíûõ êîìàíäû
org 0x0 ; áàçîâûé àäðåñ êîäà, âñåãäà 0x0
db 'MENUET01' ; èäåíòèôèêàòîð èñïîëíÿåìîãî ôàéëà (8 áàéò)
dd 0x1 ; âåðñèÿ ôîðìàòà çàãîëîâêà èñïîëíÿåìîãî ôàéëà
dd start ; àäðåñ, íà êîòîðûé ñèñòåìà ïåðåäà¸ò óïðàâëåíèå
; ïîñëå çàãðóçêè ïðèëîæåíèÿ â ïàìÿòü
dd i_end ; ðàçìåð ïðèëîæåíèÿ
dd mem ; Îáúåì èñïîëüçóåìîé ïàìÿòè, äëÿ ñòåêà îòâåäåì 0õ100 áàéò è âûðîâíèì íà ãðíèöó 4 áàéòà
dd mem ; ðàñïîëîæèì ïîçèöèþ ñòåêà â îáëàñòè ïàìÿòè, ñðàçó çà òåëîì ïðîãðàììû. Âåðøèíà ñòåêà â äèàïàçîíå ïàìÿòè, óêàçàííîì âûøå
dd 0x0 ; óêàçàòåëü íà ñòðîêó ñ ïàðàìåòðàìè.
dd 0;pathprog ;ïóòü è èìÿ ïðîãè
start: start:
mcall 68,11 ;èíèöèàëèçèðóåì êó÷ó mcall 68,11 ;¨­¨æ¨ «¨§¨à㥬 ªãçã
test eax,eax test eax,eax
jz Win1.Exit jz Win1.Exit
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
; mov ecx,1024 ; mov ecx,1024
@ -40,18 +39,18 @@ start:
; test al,al ; test al,al
; jne @b ; jne @b
;GetFileInfo fStruc,pathprog,fInfo ;ïðîâåðêà íà íàëè÷èå ôàéëà ;GetFileInfo fStruc,pathprog,fInfo ;¯à®¢¥àª  ­  ­ «¨ç¨¥ ä ©« 
;test eax,eax ;çàîäíî è ïîëó÷ó ðàçìåð ôàéëà ;test eax,eax ;§ ®¤­® ¨ ¯®«ãçã à §¬¥à ä ©« 
;je WordFileOK ;je WordFileOK
;stdcall [mb_create],msgNotFound,mbThread ;stdcall [mb_create],msgNotFound,mbThread
;jmp Win1.Redraw ;jmp Win1.Redraw
;WordFileOK: ;WordFileOK:
; stdcall mem.Alloc,dword [fInfo+32] ; stdcall mem.Alloc,dword [fInfo+32]
; mov ebx,dword [fInfo+32] ; mov ebx,dword [fInfo+32]
; mov [filBuffer],eax ; mov [filBuffer],eax
; add dword[fInfo+32],eax ;çäåñü õðàíèòñÿ óêàçàòåëü íà êîíåö áóôåðà ; add dword[fInfo+32],eax ;§¤¥áì åà ­¨âáï 㪠§ â¥«ì ­  ª®­¥æ ¡ãä¥à 
; ReadFile fStruc,pathprog,ebx,eax,0 ; ReadFile fStruc,pathprog,ebx,eax,0
; test eax,eax ; test eax,eax
; jz Win1.Redraw ; jz Win1.Redraw
@ -64,270 +63,270 @@ start:
align 4 align 4
Win1.Redraw: Win1.Redraw:
RedrawWinBeg RedrawWinBeg
xor eax,eax xor eax,eax
mov ebx,(524*10000h+500) mov ebx,(524*10000h+500)
mov ecx,(548*10000h+200) mov ecx,(548*10000h+200)
mov edx,73FFFFFFh mov edx,73FFFFFFh
mov edi,Win1.Caption mov edi,Win1.Caption
int 40h ;îêíî ñ ïðîçðà÷íûì ôîíoì int 40h ;®ª­® á ¯à®§à ç­ë¬ ä®­
mcall 9,ThreadInfo,-1 mcall 9,ThreadInfo,-1
mov eax,13 mov eax,13
mov ebx,[ThreadInfo+3Eh] mov ebx,[ThreadInfo+3Eh]
inc ebx inc ebx
mov ecx,[ThreadInfo+42h] mov ecx,[ThreadInfo+42h]
inc ecx inc ecx
mov edx,clWhite mov edx,clWhite
int 40h ;à òåïåðü íå ïðîçðà÷íûì:) int 40h ;  ⥯¥àì ­¥ ¯à®§à ç­ë¬:)
call Perevod ; â ïåðåðèñîâêå ñðàçó ïåðåâîäèì ââåä¸ííîå ñëîâî call Perevod ; ¢ ¯¥à¥à¨á®¢ª¥ áࠧ㠯¥à¥¢®¤¨¬ ¢¢¥¤ñ­­®¥ á«®¢®
call NextPerev call NextPerev
stdcall [edit_box_draw],EditIN stdcall [edit_box_draw],EditIN
RedrawWinEnd RedrawWinEnd
align 4 align 4
Win1.Events: Win1.Events:
WaitMessage WaitMessage
dec eax dec eax
jz Win1.Redraw jz Win1.Redraw
dec eax dec eax
jz Win1.Key jz Win1.Key
dec eax dec eax
jz Win1.ButtonPress jz Win1.ButtonPress
;stdcall [edit_box_mouse],EditIN ;stdcall [edit_box_mouse],EditIN
jmp Win1.Events jmp Win1.Events
Win1.ButtonPress: Win1.ButtonPress:
GetButtonPressed GetButtonPressed
cmp ah,idbExit cmp ah,idbExit
je Win1.Exit je Win1.Exit
jmp Win1.Events jmp Win1.Events
Win1.Key: Win1.Key:
GetKeyPressed GetKeyPressed
stdcall [edit_box_key],EditIN stdcall [edit_box_key],EditIN
jmp Win1.FonRedraw jmp Win1.FonRedraw
Win1.Exit: Win1.Exit:
ExitProcess ExitProcess
Win1.FonRedraw: ;ïåðåðèñîâêà îáëàñòè âûâîäà Win1.FonRedraw: ;¯¥à¥à¨á®¢ª  ®¡« á⨠¢ë¢®¤ 
mcall 9,ThreadInfo,-1 mcall 9,ThreadInfo,-1
mov eax,13 mov eax,13
mov ebx,[ThreadInfo+3Eh] mov ebx,[ThreadInfo+3Eh]
inc ebx inc ebx
mov ecx,20 mov ecx,20
shl ecx,16 shl ecx,16
add ecx,[ThreadInfo+42h] add ecx,[ThreadInfo+42h]
sub ecx,19 sub ecx,19
mov edx,clWhite mov edx,clWhite
int 40h int 40h
call Perevod call Perevod
call NextPerev call NextPerev
jmp Win1.Events jmp Win1.Events
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
Perevod: ;ñàì ïåðåâîä Perevod: ;á ¬ ¯¥à¥¢®¤
mov edi,dict;[filBuffer] mov edi,dict;[filBuffer]
Perev: Perev:
xor ebx,ebx xor ebx,ebx
@@: ;ñðàâíèåì èñõ. ñëîâî ñî ñëîâîì ïîä esi @@: ;áà ¢­¨¥¬ ¨áå. á«®¢® á® á«®¢®¬ ¯®¤ esi
mov al,[text+ebx] mov al,[text+ebx]
test al,al test al,al
je endWord je endWord
cmp [ebx+edi],al cmp [ebx+edi],al
jne WordNotFound jne WordNotFound
inc ebx inc ebx
jmp @b jmp @b
endWord: endWord:
cmp byte[ebx+edi],20h cmp byte[ebx+edi],20h
jne WordNotFound jne WordNotFound
add edi,ebx add edi,ebx
dec edi ;ïðîïóñêàåì ïðîáåëû ïîñëå àíãëèéñêîãî ñëîâà dec edi ;¯à®¯ã᪠¥¬ ¯à®¡¥«ë ¯®á«¥  ­£«¨©áª®£® á«®¢ 
@@: @@:
inc edi inc edi
cmp byte[edi],20h cmp byte[edi],20h
je @b je @b
xor ebx,ebx xor ebx,ebx
CopyWord: ;êîïèðóåì ïåðåâîä â ñòðîêó äëÿ âûâîäà CopyWord: ;ª®¯¨à㥬 ¯¥à¥¢®¤ ¢ áâப㠤«ï ¢ë¢®¤ 
mov al,[edi+ebx] mov al,[edi+ebx]
cmp al,0Dh cmp al,0Dh
je @f je @f
mov [perevText+ebx],al mov [perevText+ebx],al
inc ebx inc ebx
jmp CopyWord jmp CopyWord
@@: @@:
mov byte[perevText+ebx],0 mov byte[perevText+ebx],0
OutText 7,25,perevText OutText 7,25,perevText
ret ret
WordNotFound: ;åñëè ñëîâî íå ïîäîøëî WordNotFound: ;¥á«¨ á«®¢® ­¥ ¯®¤®è«®
add edi,ebx add edi,ebx
@@: @@:
cmp byte[edi],0Dh cmp byte[edi],0Dh
je NextWord je NextWord
inc edi inc edi
cmp edi,SizeDict;dword [fInfo+32] cmp edi,SizeDict;dword [fInfo+32]
jae endPerev jae endPerev
jmp @b jmp @b
NextWord: NextWord:
add edi,2 add edi,2
cmp edi,SizeDict;dword [fInfo+32] cmp edi,SizeDict;dword [fInfo+32]
jae endPerev jae endPerev
jmp Perev jmp Perev
endPerev: endPerev:
ret ret
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
NextPerev: NextPerev:
mov ecx,Lines mov ecx,Lines
mov edi,dict;[filBuffer] mov edi,dict;[filBuffer]
LinePerev: ;öèêë ðèñîâàíèÿ ñòðîêè LinePerev: ;横« à¨á®¢ ­¨ï áâப¨
xor ebx,ebx xor ebx,ebx
@@: ;ñðàâíèåì èñõ. ñëîâî ñî ñëîâîì ïîä esi @@: ;áà ¢­¨¥¬ ¨áå. á«®¢® á® á«®¢®¬ ¯®¤ esi
mov al,[text+ebx] mov al,[text+ebx]
test al,al test al,al
je N_endWord je N_endWord
cmp [ebx+edi],al cmp [ebx+edi],al
jne N_WordNotFound jne N_WordNotFound
inc ebx inc ebx
jmp @b jmp @b
N_endWord: N_endWord:
cmp ebx,0 cmp ebx,0
jne N_Ppoisk jne N_Ppoisk
ret ret
N_Ppoisk: ;ïîèñê íà÷àëà ñòðîêè N_Ppoisk: ;¯®¨áª ­ ç «  áâப¨
add edi,ebx add edi,ebx
@@: @@:
dec edi dec edi
cmp byte[edi],0Ah cmp byte[edi],0Ah
jne @b jne @b
inc edi inc edi
;########ïðîïóñêàåì óæå ïåðåâåä¸ííîå ñëîâî######## ;########¯à®¯ã᪠¥¬ 㦥 ¯¥à¥¢¥¤ñ­­®¥ á«®¢®########
xor ebx,ebx xor ebx,ebx
N_NoDouble: N_NoDouble:
mov al,[text+ebx] mov al,[text+ebx]
test al,al test al,al
je N_Double je N_Double
cmp [ebx+edi],al cmp [ebx+edi],al
jne N_NoDblOk jne N_NoDblOk
inc ebx inc ebx
jmp N_NoDouble jmp N_NoDouble
N_Double: N_Double:
cmp byte[ebx+edi],20h cmp byte[ebx+edi],20h
jne N_NoDblOk jne N_NoDblOk
add edi,ebx add edi,ebx
@@: @@:
inc edi inc edi
cmp byte[edi],0Ah cmp byte[edi],0Ah
jne @b jne @b
add edi,2 add edi,2
jmp LinePerev jmp LinePerev
N_NoDblOk: ;############âûâîä ðåçóëüòàòîâ#################### N_NoDblOk: ;############¢ë¢®¤ १ã«ìâ â®¢####################
xor ebx,ebx ;êîïèðóåì ðåçóëüòàò xor ebx,ebx ;ª®¯¨à㥬 १ã«ìâ â
N_CopyWord: N_CopyWord:
mov al,[edi+ebx] mov al,[edi+ebx]
cmp al,20h cmp al,20h
je @f je @f
mov [perevText+ebx],al mov [perevText+ebx],al
inc ebx inc ebx
jmp N_CopyWord jmp N_CopyWord
@@: @@:
mov byte[perevText+ebx],0 mov byte[perevText+ebx],0
add edi,ebx add edi,ebx
mov eax,Lines mov eax,Lines
sub eax,ecx sub eax,ecx
dec eax dec eax
shl eax,3 shl eax,3
add eax,45 add eax,45
push ecx push ecx
push edi push edi
OutText 7,ax,perevText OutText 7,ax,perevText
pop edi pop edi
pop ecx pop ecx
@@: @@:
inc edi inc edi
cmp byte[edi],20h cmp byte[edi],20h
je @b je @b
xor ebx,ebx xor ebx,ebx
N_CopyPerev: N_CopyPerev:
mov al,[edi+ebx] mov al,[edi+ebx]
cmp al,0Dh cmp al,0Dh
je @f je @f
mov [perevText+ebx],al mov [perevText+ebx],al
inc ebx inc ebx
jmp N_CopyPerev jmp N_CopyPerev
@@: @@:
mov byte[perevText+ebx],0 mov byte[perevText+ebx],0
mov eax,Lines mov eax,Lines
sub eax,ecx sub eax,ecx
dec eax dec eax
shl eax,3 shl eax,3
add eax,45 add eax,45
push ecx push ecx
push edi push edi
OutText 127,ax,perevText OutText 127,ax,perevText
pop edi pop edi
pop ecx pop ecx
@@: @@:
inc edi inc edi
cmp byte[edi],0Ah cmp byte[edi],0Ah
jne @b jne @b
inc edi inc edi
loop @f ;íåäîòÿãèâàåòñÿ äî LinePerev loop @f ;­¥¤®â¢ ¥âáï ¤® LinePerev
ret ret
@@: @@:
jmp LinePerev jmp LinePerev
N_WordNotFound: N_WordNotFound:
add edi,ebx add edi,ebx
@@: @@:
cmp byte[edi],0Dh cmp byte[edi],0Dh
je N_NextWord je N_NextWord
inc edi inc edi
cmp edi,SizeDict;dword [fInfo+32] cmp edi,SizeDict;dword [fInfo+32]
jae N_endPerev jae N_endPerev
jmp @b jmp @b
N_NextWord: N_NextWord:
add edi,2 add edi,2
cmp edi,SizeDict;dword [fInfo+32] cmp edi,SizeDict;dword [fInfo+32]
jae N_endPerev jae N_endPerev
jmp LinePerev jmp LinePerev
N_endPerev: N_endPerev:
ret ret
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@ -335,42 +334,42 @@ NextPerev:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
idbExit = 1 idbExit = 1
Lines = 16 ;êîëè÷åñòâ ñòðîê Lines = 16 ;ª®«¨ç¥á⢠áâப
clTheme = 080B0FFh clTheme = 080B0FFh
Win1.Caption db 'Dictionary RUS -> ENG',0 Win1.Caption db 'Dictionary ENG -> RUS',0
Win1X = 524 Win1X = 524
Win1Y = 548 Win1Y = 548
Win1W = 500 Win1W = 500
Win1H = 200 Win1H = 200
Memo.X = 5 Memo.X = 5
Memo.Y = 20 Memo.Y = 20
Memo.W = 400 Memo.W = 400
Memo.H = 370 Memo.H = 370
EditIN edit_box 350,5,5,0FFFFFFh,06F9480h,0,00h,0,40,\ EditIN edit_box 350,5,5,0FFFFFFh,06F9480h,0,00h,0,40,\
text,mouse_dd,ed_focus,0,0 text,mouse_dd,ed_focus,0,0
; msgNotFound: ; msgNotFound:
; dw 0 ; dw 0
; db 'Îøèáêà',0 ; db 'Žè¨¡ª ',0
; db 'Ôàéë dictionary.wrd íå íàéäåí',0 ; db '” ©« dictionary.wrd ­¥ ­ ©¤¥­',0
; db 'ßñíî',0 ; db 'Ÿá­®',0
; db 0 ; db 0
; ;
; msgNotFound1: ; msgNotFound1:
; dw 0 ; dw 0
; db '!!!',0 ; db '!!!',0
; db 'Îøèáêà ÷òåíèÿ ' ; db 'Žè¨¡ª  ç⥭¨ï '
; NumErr: db 0 ; NumErr: db 0
; db 0 ; db 0
; db 'ßñíî',0 ; db 'Ÿá­®',0
; db 0 ; db 0
; ;
; WordFile db '.wrd',0 ; WordFile db '.wrd',0
@ -379,12 +378,12 @@ NextPerev:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
@IMPORT: @IMPORT:
library box_lib,'box_lib.obj',msgbox,'msgbox.obj' library box_lib,'box_lib.obj',msgbox,'msgbox.obj'
import box_lib,\ import box_lib,\
edit_box_draw,'edit_box',\ edit_box_draw,'edit_box',\
edit_box_key,'edit_box_key';,\ edit_box_key,'edit_box_key';,\
;edit_box_mouse,'edit_box_mouse' ;edit_box_mouse,'edit_box_mouse'
import msgbox,\ import msgbox,\
mb_create,'mb_create' mb_create,'mb_create'
dict: dict:
include 'dictionary.wrd' include 'dictionary.wrd'
@ -395,21 +394,21 @@ SizeDict = $;-dict
i_end: i_end:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
;WordFP rb 1024 ;WordFP rb 1024
; m1 dd 0 ; m1 dd 0
;filBuffer rd 1 ;filBuffer rd 1
ThreadInfo: rb 1024 ThreadInfo: rb 1024
;pathprog ;pathprog
mouse_dd rd 1 mouse_dd rd 1
text rb 40 text rb 40
perevText rb 300 perevText rb 300
;fStruc rb 30 ;fStruc rb 30
;fInfo rb 40 ;fInfo rb 40
mbThread rb 1024 mbThread rb 1024
rb 4096 rb 4096
mem: mem: