简体   繁体   English

字符串 Output 在实模式下使用 LODS 指令

[英]String Output in Real-Mode by using LODS instruction

I'm need to write function, which output a string in real-mode.我需要在实模式下写 function,其中 output 是一个字符串。 There is that code:有那个代码:

;; ds:si - string address, cx - length of string
   cld
putc:
   lods
   mov ah, 0x0E
   xor bh, bh    
   int 0x10          ;; display character, advancing cursor and scrolling screen
                     ;; as necessary
   loop putc

But it output only first character few (defined by the CX register) times, ae the SI register don't increase.但它 output 只有第一个字符很少(由 CX 寄存器定义)次,ae SI 寄存器不增加。 Is where a error?是哪里出错了?

lods isn't a valid instruction mnemonic; lods不是有效的指令助记符; you probably mean lodsb .你可能是说lodsb

On my assembler (nasm), a token that isn't a valid mnemonic gets parsed as a label instead, and so no code is emitted.在我的汇编程序 (nasm) 上,不是有效助记符的标记被解析为 label,因此不会发出任何代码。 Thus your lods is effectively a no-op, so no wonder SI doesn't increment.因此,您的lods实际上是一个空操作,所以难怪 SI 不会增加。 (The assembler does give a warning though, does yours?) (不过,汇编器确实会发出警告,你的呢?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM