Multiplication test bench

From Zet
Jump to: navigation, search

This example tests these instructions:

  • mul, imul and aad. Examples include:
  1. word / byte
  2. positive * positive
  3. negative * positive
  4. 0, 1, -1 multiply
  5. max range: ffff x ffff
  6. 2 random values

Code

<embed_code>17_mul.s</embed_code>

Results

Memory contents at the end should be:

0x00:  0x0015  0x0000  0x5ce0  0xa31f  0x0001  0xffff  0x0000  0xffff
0x10:  0x0001  0xfffe  0x0000  0x0000  0x0000  0xeeeb  0xa509  0x4220
0x20:  0x008c  0xffff  0x23dc  0xffff  0xff01  0xff00  0xffff  0xffff
0x30:  0x0000  0x0000  0xeeeb  0xb00d  0xf900  0xXXXX  0x0015  0x0000
0x40:  0x5ce0  0x0000  0x0001  0xffff  0xffff  0xffff  0x0001  0x0000
0x50:  0x0000  0x0000  0x0000  0xeeeb  0xa509  0xfb45  0x008c  0xffff
0x60:  0xffdc  0xffff  0xff01  0xffff  0xffff  0xffff  0x0000  0x0000
0x70:  0xeeeb  0x020d  0xf900  0x00f6  0x00ed  0x00ff  0x00a8  0xXXXX
0x80:  0xXXXX  0xXXXX  0xXXXX  0xXXXX  0x0892  0x0086  0x0097  0x0086
0x90:  0x0803  0x0046  0x0002  0x0086  0x0082  0x0883  0x0887  0x0046
0xa0:  0x0002  0x0086  0x0002  0x0002  0x0803  0x0046  0x0803  0x0086
0xb0:  0x0883  0x0082  0x0887  0x0046  0x0803  0x0086  0x0803  0x0002

Contents of addresses 0x80-0x8f, could be too:

0x80:  0xXXXX  0xXXXX  0xXXXX  0xXXXX  0x0082  0x0086  0x0086  0x0086

As some flags of aad doesn't care.