I am trying to implement an algorithm in assembly x86 using tasm and tlink.
when I run it in dosbox with the commands: tasm /zi base tlink /v base I get the following error: "Error when compiling - Fatal: 32-bit encounterd in module BASE.ASM"
I figured out that the problem is in "condtwo" but I cant find the bug.
MODEL small
.386
STACK 100h
DATASEG
; --------------------------
string db "aaabbbaaabbbaaa"
break db "$"
w dd 4095
maxl dd 31
maxm dd 0
offst dd 0
p dd 7
stringsize dd 0
la db 0
lb db 0
k dd 0
inword dd 0h
arr dd ?
; --------------------------
CODESEG
start:
mov eax, @data
mov ds, eax
; --------------------------
call strlen
call maxmatch
; --------------------------
strlen proc
xor eax, eax
xor cx, cx
mov si, offset string
stringlen:
mov ah, [byte ptr si]
inc al
inc si
cmp ah, [break]
jne stringlen
dec al
mov ah, 0
mov [stringsize], eax
ret
endp strlen
maxmatch proc
xor edx, edx
minpw:
mov eax, [p]
inc eax
mov ebx, [w]
cmp eax, ebx
jbe inip
ja iniw
inip:
mov ecx, eax
dec ecx
jmp mainloop
iniw:
mov ecx, ebx
dec ecx
mainloop:
inc edx
mov [k], 0
mov eax, [stringsize]
sub eax, [p]
cmp eax, [maxl]
jbe ininp
ja iniml
ininp:
mov ebx, eax
jmp condtwo
iniml:
mov ebx, [maxl]
jmp condtwo
condtwo:
mov esi, offset string
add si, [word ptr p]
mov eax, [dword ptr si]
sub si, [word ptr edx]
cmp [dword ptr si], eax
je loopbody
loopbody:
inc [k]
cmp [k], ebx
jb condtwo
mov eax, [k]
cmp [maxm], eax
jb consuccess
consuccess:
mov [maxm], eax
mov offst, edx
loop mainloop
endp maxmatch
exit:
mov ax, 4c00h
int 21h
END start