本文介绍了MASM错误A2075:跳转目标太远:由30个字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的太太给我,我必须做出一个计划,将通过键盘输入,并检查嵌套括号的传统秩序的任务。
例如:

My ma'am give me an assignment in which i have to make a program which will take input through keyboard and check the conventional order of the nested brackets.for example:

输入 = {[()]},输出 =正确的格式,输入 =({[]})输出 =不正确

我的程序:

.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

但是当我编译这个code中的MASM显示我的错误:

but when i compile this code the masm shows me an error:

JMP目的地太远了30个字节。

请告诉我,我应该做些什么来摆脱这个消息并运行我的程序。

Please tell me what should i do to get rid of this message and run my program.

推荐答案

循环L1 导致错误。 LOOP 只能执行短跳跃(-128到+127字节)。通过

loop l1 causes the error. LOOP can only perform short jumps (–128 to +127 bytes). Replace it by

dec cx
jne l1

这篇关于MASM错误A2075:跳转目标太远:由30个字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 04:31