如何使用 PutInt 从寄存器 CL 打印



我想将两个8位寄存器加在一起并打印结果。我想添加寄存器 CL 和 CH。我用 -1275 填充了 ECX,我想看看如果我减去这两个寄存器会得到什么结果,我该怎么做?

这是我写的,但是我在第 13 行收到一个错误,说操作码和操作数的组合无效。为什么我不能使用 PutInt 从 CL 打印?我需要做什么?

%include "io.mac"
.STACK 100H 
.DATA
   msg4  db "The result is: ",0
   .CODE
        .STARTUP
    mov ECX,1111101100000101b

    PutStr msg4  ; print msg4 on the output
    add CL, CH   ; Add results
    PutInt CL   ; output int from register CL <-- line 13
    nwln
    done:                        
        .EXIT

PutInt 不接受 8 位操作数。但是您可以使用CX:

mov CH, 0 ; clear high-byte
PutInt CX

高字节通过简单的 mov 操作清除,就是这样。

最新更新