.686p
.xmm
.model flat,c
.stack 4096
; include C libraries
includelib msvcrtd
includelib oldnames
includelib legacy_stdio_definitions.lib
; imported functions
extrn printf:near
.data ; initialized global vars
IntegerFormat db "The result is: %d",0dh,0ah,0
GlobWord db "This is just a test",0dh,0ah,0
GlobFstC dd "i"
GlobSecC db "g"
.code
public main
main proc
xor eax, eax
xor ecx, ecx
xor ebx, ebx
mov ecx, -1
mov ebx, offset GlobWord
SwitchChars:
inc ecx
movsx eax, byte ptr [ebx + ecx]
cmp eax, 0
je Exit
cmp eax, GlobFstC
jne SwitchChars
mov byte ptr [ebx + ecx], GlobSecC
jmp SwitchChars
Exit:
movsx eax, GlobWord
push eax
push offset IntegerFormat
call printf ; call printf(IntegerFormat, 3)
add esp, 8
xor eax, eax
ret
main endp
end
the code is for switching first char in the second one in the string, error A2070 "invalid instruction operands" on the line "mov byte ptr [ebx + ecx], GlobSecC"
any suggestions to fix / better way to go through String in masm 32?