.386
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
AsmAdd proto,:dword,:dword,:dword,:dword
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
var1 byte "123456"
var2 byte "654321"
sum byte (sizeof var1+1) dup (?),0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AsmAdd proc lpsum,lpvar1,lpvar2,lengths
pushad
mov ecx,lengths
mov edi,lpsum
add edi,ecx
dec ecx
mov esi,lpvar1
mov ebx,lpvar2
add esi,ecx
add ebx,ecx
mov ecx,lengths
mov bh,0
L1: mov ah,0
mov al,byte ptr [esi]
add al,bh
mov bh,ah
or bh,30h
add al,byte ptr [ebx]
aaa
or bh,ah
or bh,30h
or al,30h
mov byte ptr [edi],al
dec esi
dec edi
dec ebx
dec lpvar1
dec lpvar2
dec lpsum
loop L1
mov byte ptr [edi],bh
pushad
ret
AsmAdd endp
start:
mov eax,sizeof var1
invoke AsmAdd,addr sum,addr var1,addr var2,eax
invoke MessageBox,NULL,addr sum,addr sum,0
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
AsmAdd proto,:dword,:dword,:dword,:dword
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
var1 byte "123456"
var2 byte "654321"
sum byte (sizeof var1+1) dup (?),0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AsmAdd proc lpsum,lpvar1,lpvar2,lengths
pushad
mov ecx,lengths
mov edi,lpsum
add edi,ecx
dec ecx
mov esi,lpvar1
mov ebx,lpvar2
add esi,ecx
add ebx,ecx
mov ecx,lengths
mov bh,0
L1: mov ah,0
mov al,byte ptr [esi]
add al,bh
mov bh,ah
or bh,30h
add al,byte ptr [ebx]
aaa
or bh,ah
or bh,30h
or al,30h
mov byte ptr [edi],al
dec esi
dec edi
dec ebx
dec lpvar1
dec lpvar2
dec lpsum
loop L1
mov byte ptr [edi],bh
pushad
ret
AsmAdd endp
start:
mov eax,sizeof var1
invoke AsmAdd,addr sum,addr var1,addr var2,eax
invoke MessageBox,NULL,addr sum,addr sum,0
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start