我正在尝试使用tasm和tlink在程序集x86中实现一个算法。
当我在dosbox中使用命令运行它时: tasm / zi base tlink / v base 我收到以下错误:"编译时出错 - 致命:在模块BASE.ASM中遇到32位"
我发现问题出现在" condtwo"但我找不到这个错误。
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