I have in my simple program loaded some strings into

mov si, song

witch load:

song:
%if 1
dw E0, C, A, E1, C, A, E2, B, A, E3, C, B
%endif
dw E0, C, A, E1, C, A, 0

E0 equ 14000 etc...

Im loading elements from it with

 lodsw; (one transition use three of them)

And I need to do it with

 mov and inc

I tried

mov ax, [si+dx]
inc dx

But this dont want to work, Any ideas

有帮助吗?

解决方案

lodsw is equivalent (if omitting flags) to

mov ax, word [si]
add si, 2

I am not sure you can use dx in an address expression like [si+dx] (in 16-bit mode, only si, di, bp and bx are index registers). If you don't want to change si, use bx.

(By the way: do you really want to write 16-bit code? It's quite outdated. NASM compiles 32-bit code perfectly.)

其他提示

Since your table consists of "dw" (16bit values), you'll need increment dx by 2

mov ax, [si+dx]
inc dx
inc dx

or just

mov ax, [si+dx]
add dx, 2
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top