Für meine Aufgabe möchte ich zwei Zeichenfolge verketten. Das ist bisher mein Code. das Ergebnis sollte Hello World sein, aber es zeigt nur hallo :-(Fehler bei Verkettung zwei Zeichenfolge in Assembly
Wie soll ich Quelle String am Ende von Ziel?
Was mir persönlich fehlt hinzufügen?
;--------------------In main.CPP
extern "C" void __stdcall StrCatAsm(char[], char[]);
;main
char str1[] = {'h','e','l','l','o',0};
char str2[] = {'w','o','r','l','d',0};
StrCatAsm(str1,str2)
string1 = 'h','e','l','l','o','w','o','r','l','d',0
;------------------In main.asm
Concat PROC uses eax edi ecx esi,
destination:DWORD,
source:DWORD
mov al,0 ;looking for zero terminated
mov ecx,100 ;number of possible loop
mov edi, source
repne scasb ;look for end of source
not ecx ;ecx is 6
mov esi, destination
rep movsb ;loop for copy ESI into EDI
ret
Concat ENDP
Vermutlich nicht verwandt, aber: Sind Sie sicher, dass nach "Hallo" genug Platz ist, um etwas zu verketten? Oder solltest du * '' hallo' 'in (unbenutztes) 'destination' kopieren und dann' 'world'' danach einfügen? – usr2564301