簡體   English   中英

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

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

我需要在實模式下寫 function,其中 output 是一個字符串。 有那個代碼:

;; 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

但它 output 只有第一個字符很少(由 CX 寄存器定義)次,ae SI 寄存器不增加。 是哪里出錯了?

lods不是有效的指令助記符; 你可能是說lodsb

在我的匯編程序 (nasm) 上,不是有效助記符的標記被解析為 label,因此不會發出任何代碼。 因此,您的lods實際上是一個空操作,所以難怪 SI 不會增加。 (不過,匯編器確實會發出警告,你的呢?)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM