I'm need to write function, which output a string in real-mode. 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, a.e. the SI register don't increase. Is where a error?
CodePudding user response:
lods
isn't a valid instruction mnemonic; you probably mean 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. Thus your lods
is effectively a no-op, so no wonder SI doesn't increment. (The assembler does give a warning though, does yours?)