Created
April 14, 2012 15:26
-
-
Save spellancer/2385207 to your computer and use it in GitHub Desktop.
laba5 result asm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Template for console application | |
.586 | |
.MODEL flat ;, stdcall | |
OPTION CASEMAP:NONE | |
;Include kernel32.inc | |
;Include masm32.inc | |
;IncludeLib kernel32.lib | |
;IncludeLib masm32.lib | |
.CONST | |
MsgExit DB 13,10,"Press Enter to Exit",0AH,0DH,0 | |
;Çàäàíèå | |
;Âàðèàíò 11. | |
;Äàíà ïîñëåäîâàòåëüíîñòü 37 ñèìâîëîâ. Îïðåäåëèòü ÷àñòîòó ïîâòîðåíèÿ êàæäîãî ñèìâîëà. | |
.DATA | |
;aa byte 'The original string:',13,10,0 | |
;a byte 'IUEATLIGPSGOTFCKSKQOLYSQJHXYFCXCRHBBF',13,10,0 | |
; ytlwermoglfovmagaegofjdkfdjfsdlgserlm | |
b byte ' ',0 | |
bb byte '=',0 | |
d byte ' ',0 | |
d1 byte '/10;',0 | |
n dword 0 | |
nn dword 0 | |
nnn dword 0 | |
result byte 13,10,'Result:',13,10,0 | |
.DATA? | |
inbuf DB 100 DUP (?) | |
Buffer DB 10 DUP (?) | |
x byte 37 dup (?) | |
a2 byte 40 dup (?) | |
k byte ? | |
.CODE | |
public _ADD1 | |
_ADD1 proc | |
push EBP | |
mov EBP,ESP | |
cld | |
mov esi,[ebp+12] | |
lea edi, a2 | |
mov eax,0 | |
mov edx,0 | |
mov k,0 | |
mov ecx,[ebp+8] | |
cycle1: | |
push ecx | |
push esi | |
mov al, [esi] | |
lea edi,a2 | |
mov bl , [edi] | |
mov ecx,[ebp+8] | |
repne scasb | |
je ravno | |
push esi | |
push edi | |
cld | |
;add k,48 | |
;mov al,k | |
;mov b,al | |
mov b,al | |
push ecx | |
mov ecx,1 | |
lea esi,b | |
lea edi,x | |
add edi,nnn | |
rep movsb | |
add nnn,1 | |
mov ecx,1 | |
lea esi,bb | |
lea edi,x | |
add edi,nnn | |
rep movsb | |
add nnn,1 | |
pop ecx | |
pop esi | |
pop edi | |
mov a2[edx], al | |
lea edi,a2 | |
mov ecx,[ebp+8] | |
mov esi,[ebp+12] | |
cycle2: | |
cmp [esi],al | |
je yes | |
jmp next | |
yes: | |
inc k | |
next: | |
inc esi; | |
loop cycle2 | |
; ââîä â ñòðîêó | |
push esi | |
push edi | |
cld | |
add k,48 | |
mov al,k | |
mov b,al | |
push ecx | |
mov ecx,1 | |
lea esi,b | |
lea edi,x | |
add edi,nnn | |
rep movsb | |
mov k,0 | |
add nnn,1 | |
mov ecx,4 | |
lea esi,d1 | |
lea edi,x | |
add edi,nnn | |
rep movsb | |
add nnn,4 | |
pop ecx | |
pop esi | |
pop edi | |
pop esi | |
pop ecx | |
inc esi | |
inc edx | |
inc edi | |
jmp quit | |
;inc edi | |
ravno: | |
pop esi | |
pop ecx | |
inc esi | |
quit: | |
mov nn, edx | |
cmp ECX,0 | |
sub ecx,1 | |
je exit | |
jmp cycle1 | |
exit: | |
lea eax,x | |
pop EBP | |
ret | |
_ADD1 endp | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment