assembly 相对跳跃超出范围

vzgqcmou  于 2023-01-17  发布在  其他
关注(0)|答案(1)|浏览(137)

我明白了**”(76)相对跳转超出范围000Eh字节”(79)每当我输入CMP八进制“3”时,相对跳转超出范围0007h字节”**。我应该一直执行到第7个八进制数字,但当我尝试执行第3个八进制数字时,它总是给我一个错误。我只能执行0,1,和2,直到它给我一个错误。我不知道我应该做什么。我已经尝试了我所能做的一切,因为我已经被教导,但我仍然不能得到任何结果。请帮助我。我是新的组装。P.S.我正在使用DOSBox 0.74

.Model small

.data
txt1 db "Octal to Binary Converter$"
txt2 db "Enter an Octal Symbol: $"
title0 db "000$"
title1 db "001$"
title2 db "010$"
title3 db "011$"
title4 db "100$"
title5 db "101$"
title6 db "110$"
title7 db "111$"

mess db "Press ESC to exit...$"
invalid db "Input is invalid. Try again.$"
keypress db ?
octal db ?

.code
Start:
Mov AX, @data
Mov ds, ax

sys_st:
Mov AH, 6
Mov AL, 0
Mov BH, 15
Mov ch, 0
Mov cl, 0
Mov DH, 100
Mov DL , 100
Int 10H

Mov AH, 2
Mov BH, 0
Mov DL, 5
Mov DH, 5
Int 10H 

Mov AH, 9
Lea DX, txt1 
Int 21H

JMP sys_st2

sys_st2:
Mov AH, 2
Mov BH, 0
Mov DL, 5
Mov DH, 8
Int 10H 

Mov AH, 9
Lea DX, txt2 
Int 21H 

Mov AH, 1
Int 21H
Mov octal, AL 

CMP octal, '0'
JE sys_0

CMP octal, '1'
JE sys_1

CMP octal, '2'
JE sys_2

CMP octal, '3'
JE sys_3

CMP octal, '0'
JNE sys_invalid

CMP octal, '1'
JNE sys_invalid

CMP octal, '2'
JNE sys_invalid

CMP octal, '3'
JNE sys_invalid

sys_0:
Mov AH, 2
Mov BH, 0
Mov DL, 11
Mov DH, 11 
Int 10H

Mov AH, 9
Lea DX, title0 
Int 21H 

Mov AH, 2 
Mov BH, 0
Mov DL, 5
Mov DH, 15 
Int 10H 

JMP sys_exit

sys_1:
Mov AH, 2 
Mov BH, 0
Mov DL, 11
Mov DH, 11 
Int 10H 

Mov AH, 9
Lea DX, title1
Int 21H 

Mov AH, 2 
Mov BH, 0
Mov DL, 5
Mov DH, 15 
Int 10H 

JMP sys_exit

sys_2:
Mov AH, 2 
Mov BH, 0
Mov DL, 11
Mov DH, 11 
Int 10H 

Mov AH, 9
Lea DX, title2
Int 21H 

Mov AH, 2 
Mov BH, 0
Mov DL, 5
Mov DH, 15 
Int 10H 

JMP sys_exit

sys_3:
Mov AH, 2 
Mov BH, 0
Mov DL, 11
Mov DH, 11 
Int 10H 

Mov AH, 9
Lea DX, title3
Int 21H 

Mov AH, 2 
Mov BH, 0
Mov DL, 5
Mov DH, 15 
Int 10H 

JMP sys_exit

sys_invalid: 
Mov AH, 2 
Mov BH, 0
Mov DL, 5 
Mov DH, 11 
Int 10H 

Mov AH, 9
Lea DX, invalid 
Int 21H 

Mov AH, 1 
Int 21H 
JMP sys_st 

sys_exit: 

Mov AH, 2
Mov BH, 0
Mov DL, 5
Mov DH, 14
Int 10H 

Mov AH, 9
Lea DX, mess 
Int 21H 

Mov AH, 1 
Int 21H 
Mov keypress, AL 

CMP keypress, 27
JNE sys_exit 

JMP exit 

Exit: 
Mov AH, 4ch 
Int 21H 
End Start
vom3gejh

vom3gejh1#

在文件中添加一个.386指令,以便能够使用80386引入的偏移量较大的相对跳转指令。或者,找到有问题的跳转,并将其替换为如下内容:

jnz foo ; this jump is too long

替换为

jz bar ; opposite conditional
   jmp foo ; unconditional jumps can have larger offsets
bar:
   ...

相关问题