Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 汇编非法指令_Assembly_Tasm - Fatal编程技术网

Assembly 汇编非法指令

Assembly 汇编非法指令,assembly,tasm,Assembly,Tasm,我正在从事TASM 16位汇编中的一个项目,我似乎对以下代码片段的循环有问题: assume cs:code,ds:code code segment start: mov ah,1 ;read 1st digit from keyboard int 21h ;add it to register mov ch,10 ;prepare to multply by 10 sub al,'0' ;covert first digit to data

我正在从事TASM 16位汇编中的一个项目,我似乎对以下代码片段的循环有问题:

assume cs:code,ds:code
code    segment
start:
    mov ah,1    ;read 1st digit from keyboard
    int 21h ;add it to register
    mov ch,10   ;prepare to multply by 10
    sub al,'0'  ;covert first digit to data from ascii
    mul ch  ;multiply first digit by 10
    mov dl,al   ;save digit to dl
    mov ah, 1   ;read second digit
    int 21h;    ;save it to al register
    sub al,'0'  ;convert second value from ascii
    add dl,al   ;add al to furst value for final desired result
    mov cl,2    ;set start point for squaring
reset:
    mov bh,0
    mov ch,0
    add bh,cl
code    ends
    end start   
但重置后添加标签会导致“意外的文件结尾”错误:


在我看来,你的
结束-开始
好像放错地方了。我很确定这需要在
代码结束之前完成。让我想知道,当
loop1:
丢失时,为什么没有出现错误。:)

我发现,我使用的模拟器出现了一个问题,复制/粘贴我在记事本中编写的代码导致模拟器崩溃。手动输入每一行解决了这个问题。

当它是汇编代码时,为什么要添加
?第二个代码示例也可以无错误地进行汇编(TASM 4.1)。这可能是文本编辑器的错误。再次尝试修改,或剪切包含
loop1:
的3行,然后重新键入。
assume cs:code,ds:code
code    segment
start:  
    mov ah,1    ;read 1st digit from keyboard
    int 21h ;add it to register
    mov ch,10   ;prepare to multply by 10
    sub al,'0'  ;covert first digit to data from ascii
    mul ch  ;multiply first digit by 10
    mov dl,al   ;save digit to dl
    mov ah, 1   ;read second digit
    int 21h;    ;save it to al register 
    sub al,'0'  ;convert second value from ascii
    add dl,al   ;add al to furst value for final desired result
    mov cl,2    ;set start point for squaring
reset:
    mov bh,0
    mov ch,0    
loop1:
    add bh,cl
code    ends
    end start