Masm error A2075: jump too far: 30 bytes

My ma'am will give me a task in which I have to make a program that will enter keyboard input and check the normal order of nested brackets. eg:

input = {[()]}, output = correct format, input = ({[]}) output = incorrect

My program:

.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

but when I compile this code, masm shows me an error:

The jmp icon is too far 30 bytes.

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

+4
source share
1 answer

loop l1 . LOOP ( -128 +127 ).

dec cx
jne l1
+6

Source: https://habr.com/ru/post/1608874/


All Articles