I noticed something interesting with my code when doing a multidimensional array. In this example, we assume the array is more like a grid.
So the first objective is to initialize the grid with all null values. I'm working in a DOSBOX environment.
I tried the first code and not only did the attempt fail, but the DOSBOX screen froze and I had to close it manually.
nrows equ 100
ncols equ 100
agrid times nrows times ncols db 0
xor AX,AX
mov CX,nrows*ncols-1
clearram:
mov BX,CX
mov [CS:agrid+BX],AL
loop clearram
I changed one line. Code is shown below.
nrows equ 100
ncols equ 100
agrid times (nrows*ncols) db 0
xor AX,AX
mov CX,nrows*ncols-1
clearram:
mov BX,CX
mov [CS:agrid+BX],AL
loop clearram
Whats interesting is this one works flawlessly.
What does nasm do behind the scenes with space initialization when the keyword "times" is used twice?