I solved this using the example provided by the emulator.
Basically, matrices in an assembly are declared the same as regular variables, for example, a 2x2 matrix is โโdeclared as follows:
matrix db ?,?,?,? ; Obviously `?` can be replaced by any value or matrix db dup('?')
The user then decides where he believes the โlineโ ends and the other begins. For example, if we have a variable with bytes 1,2,3,4, the user can assume that 1,2 is one row and 3.4 is another.
Here's how you point to an element in a matrix:
mov bx,0 lea si,matrix mov matriz[si][bx],0 ; [si][bx] holds the value of the first cell
Now, if each line contains 2 elements, you just need to do this to go to the second line:
add bx,2 mov matriz[si][bx],1 ; Now [si][bx] points to cell 0x1
source share