Hi!

I'm new here and I want to learn ASM but first, I need to write a program in assembler that calculates the product of two square matrices with n rows and columns with elements defined by one word and values in the field [-88.87].

Can you help me ?

I'm new here and I want to learn ASM but first, I need to write a program in assembler that calculates the product of two square matrices with n rows and columns with elements defined by one word and values in the field [-88.87].

Can you help me ?

Maybe you should write this program in a higher level language first.

values in the field [-88.87].

I don't even understand what that means. Well if you are using word values you may use something similar to mov edx, dword ptr provided that a word size is two bytes, ebx holds some base pointer and ecx holds the index count. It may also be easier to do it by hand a few times to work out an algorithm first. That's what I usually do in programming exercises

**GoldStar611**,

Probably he means that matrices' elements belong to range -88…87? If he's talking about finite field, more information needed.

_____________

**jmk**,

Prove that you're serious about learning Asm. Post the code you've written for this program thus far.

Yes, matrices' elements belong to range -88…87. I need the code that multiply two square matrices, and the elements to belong to range -88...87

**jmk**,

Prove that you're serious about learning Asm. Post the code you've written for this program thus far.

**jmk**,

Is this the only restriction? Dot product in matrix multiplication follows ordinary (integer) rules for multiplication and addition (i.e. product matrix elements can be outside that range)? Results can overflow 16-bit signed range (-32,768…32,767) even for 5×5 matrices.

Don't expect much help if you don't cooperate (show your efforts so far).

`include io.h`

.model small

.stack 128h

.data

m dw ?

n dw ?

mat1 dw 100 dup(100 dup(?))

mat2 dw 100 dup(100 dup(?))

.code

mov Ax, @data

mov DS, Ax

putsi <Number of lines and columns '>

geti

mov m,ax

xor ax,ax

xor si,si

xor bx,bx

mov cx,m

et1:

push cx

mov cx,m

xor bx,bx

et2:

putsi <'Numbers for matrix1['>

puti si

putsi <']['

puti bx

putsi <']='>

geti

mov mat1,ax

add bx,2

loop et2

pop cx

add si,2

loop et1

moc cx,m

et3:

push cx

mov cx,m

xor bx,bx

et4:

putsi <'Numbers for matrix2['>

puti si

putsi <']['

puti bx

putsi <']='>

geti

mov mat2,ax

add bx,2

loop et3

pop cx

add si,2

loop et4

**jmk**,

Are you sure something can compile that?

**include io.h**— hmm, why not? Probably it contains those

**putsi**/

**puti**/

**geti**things.

**putsi <Number of lines and columns '>**— looks like compiler is not MASM, unmatched single quote not inside double quotes.

**putsi <']['**— another strange parameter.

**moc cx,m**— I think, enough already.

Mock-up won't help you. Show something real. Or ask relevant questions about implementation details.