I've just recently started with SMC (Self Modifying Code) and I'm having some problems:
.model tiny
.stack
.data
key db 01h
.code
org 0100h
mov cx,3
StrLoop:
dec cx
mov di,(offset fix)
add di,cx
mov al,[di]
xor al,key
mov [di],al
jcxz OutLoop
jmp StrLoop
OutLoop:
fix db 0B9h, 036h, 003h ;mov ax,0237h
ret
end main
This is my SMC.COM source. This works, but when I convert it to a EXE then it goes haywire. The correct data seems to not get targeted. I use MASM, please help.