I am trying to write a substring macro and this is the closest I have gotten.
macro substring source, start_index, sub_length
{
param db source
strt db start_index
mov dx, 00h
mov cx, start_index
check_substr:
cmp cx, sub_length
je end_substr
jb add_substr
add_substr:
push word [param + strt]
mov cx, strt
inc cx
mov word [strt], cx
jmp check_substr
end_substr:
charCount db 0
mov word [charCount], cx
return_substr db 0
substr_memcount db 0
make_subStr:
if charCount > 0
popw dx
mov word [return_substr + substr_memcount], dx
inc [substr_memcount]
dec cx
mov word [charCount], cx
jmp make_subStr
else
jmp clear_regs
end if
clear_regs:
mov cx, 00h
mov dx, return_substr
}
Why is this not working.