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:
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.
Array
is an array of words (because ofdw
) and soArray
itself contains the bytes28h, 00h, 43h, 00h, a4h, 00h
, etc. Is that what you wanted? Keep in mind x86 is little-endian and sodw 28h
is the two bytes28h,00h
in that order. – Nate Eldredge