Search code examples
assemblyx86emu8086

Memory address and array, assembly x86


I have this code on Emu8086:

Mov Bx,0000h
Mov Cx,0ah 
Mov Si,0200h
Fillup:
Mov Ax,Array[bx]
Mov Ds:[Si],Ax
Inc Bx
inc si                           
loop FillUp

Array dw 28h,43h,0a4h,4ch,81h,21h,0ceh,0fh,2dh,87h

When emulating this happens:

Image

The memory table looks like this:

Address Value
0200 28
02001 00
02002 43
02003 00
02004 a4

Enter the digit every two steps, and I don't know why it happens.

I have tried many ways to cycle, but I can't find the solution.

One last qustion

How can I initialize an array of n elements at a specific memory address?

For example, how can I make my entire array of 10 elements that are from the address 0200h? Without moving from the array to the memory address.


Solution

  • The source is an array of words. Change 'dw' to 'db'.