我收到消息“(76)每当我输入时,相对跳出超出范围的000Eh字节”和(79)相对跳出范围超出0007h字节“ CMP八进制,'3'。我应该做到第7个八进制数,但是当我尝试做第三个八进制数时它总是给我一个错误。我只能做0,1和2直到它给了我一个错误。我不知道自己应该做什么。就我所教的而言,我已尽力而为,但我仍然无法得到任何结果。请帮助我。我是新的装配。 PS我正在使用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
答案 0 :(得分:2)
在您的文件中添加.386
指令,以便能够使用80386引入的较大偏移的相对跳转指令。或者,找到有问题的跳转并将其替换为如下内容:
jnz foo ; this jump is too long
替换为
jz bar ; opposite conditional
jmp foo ; unconditional jumps can have larger offsets
bar:
...