Reputation: 853
Let say I have an array of numbers
.DATA
number DB 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80
How can I assign the starting point of this array at memory address 100h?
Upvotes: 0
Views: 1133
Reputation: 5775
If you need your array number
reside at linear address 00100h, you would have to copy it there at run-time:
SUB AX,AX
MOV ES,AX
MOV DI,100h ; Let ES:DI point at the linear address 100h.
MOV AX,.DATA
MOV DS,AX
MOV SI,number ; Let DS:SI point at the array.
MOV CX,80 ; Size of the array.
CLD
REP MOVSB ; Copy the array to the linear address 100h.
This is not a good idea, the first 1024 bytes of linear address space is reserved for interrupt vectors, you would overwrite addresses of INT 40h
and higher, see DOS memory map
You probably want your array reside at offset 100h from the beginning of segment .DATA
. Fill the first 256 bytes in this segment with anything this long, for instance `
.DATA
DB 100h DUP (0)
number DB 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80
Upvotes: 1