Assembly masm错误A2075:跳转目标太远:30字节
我的夫人给我布置了一个作业,我必须制作一个程序,通过键盘输入,并检查嵌套括号的常规顺序。 例如: 输入={[()]},输出=格式正确,输入=({[]})输出=不正确 我的节目:Assembly masm错误A2075:跳转目标太远:30字节,assembly,x86,masm,Assembly,X86,Masm,我的夫人给我布置了一个作业,我必须制作一个程序,通过键盘输入,并检查嵌套括号的常规顺序。 例如: 输入={[()]},输出=格式正确,输入=({[]})输出=不正确 我的节目: .model small .stack 100h .386 .data msg1 db "this is a correct format of nested brackets$" msg2 db "this is no a correct format of nested brakets$" .code m
.model small
.stack 100h
.386
.data
msg1 db "this is a correct format of nested brackets$"
msg2 db "this is no a correct format of nested brakets$"
.code
main proc
mov ax,@data
mov ds,ax
mov cx,15
push '#'
l1:
mov ah,1
int 21h
cmp al,'['
je pushh1
cmp al,'{'
je pushh2
cmp al,'('
je pushh3
cmp al,']'
je pop1
cmp al,'}'
je pop2
cmp al,')'
je pop3
jmp ser
pushh1:
pop dx
cmp dx,'('
push dx
je wrongorder
movzx dx,al
push dx
jmp ser
pushh2:
pop dx
cmp dx,'['
je wrongorder
cmp dx,'('
je wrongorder
push dx
movzx dx,al
push dx
jmp ser
pushh3:
pop dx
cmp dx,'{'
push dx
je wrongorder
movzx dx,al
push dx
jmp ser
wrongorder:
mov dx,'*'
push dx
jmp ser
pop1:
pop dx
cmp dx,'#'
push dx
je ser
pop dx
cmp dx,'{'
push dx
je ser
pop dx
cmp dx,'('
push dx
je ser
pop dx
jmp ser
pop2:
pop dx
cmp dx,'#'
push dx
je ser
pop dx
cmp dx,'('
push dx
je ser
pop dx
cmp dx,'['
push dx
je ser
pop dx
jmp ser
pop3:
pop dx
cmp dx,'#'
push dx
je ser
pop dx
cmp dx,'{'
push dx
je ser
pop dx
cmp dx,'['
push dx
je ser
pop dx
ser:
cmp al,'q'
je labo
loop l1
labo:
mov ah,2
mov dl,0ah
int 21h
mov dl,0dh
int 21h
mov ah,2h
pop dx
;int 21h
cmp dx,'#'
je labe
cmp dx,'#'
jnz labr
labe:
mov dx, offset msg1
mov ah,9h
int 21h
jmp lab8
labr:
mov dx, offset msg2
mov ah,9h
int 21h
lab8:
mov ah,4ch
int 21h
main endp
end main
但是当我编译这段代码时,masm向我显示了一个错误:
jmp目标太远,超过30字节
请告诉我应该如何处理此消息并运行我的程序。循环l1导致错误<代码>循环只能执行短跳转(–128到+127字节)。换成
dec cx
jne l1
汇编器到底在抱怨哪个跳转?因为您的目标是80386,所以我希望MASM在无法进行短距离跳远时自动使用近距离跳远。MASM有一个
选项LJMP
,用于启用跳转延长,但默认情况下应该启用。养成在操作码中添加一些注释的习惯。六个月后,你将不记得它做了什么/它是如何进行的。