Division test bench

From Zet
Jump to: navigation, search

This example tests these instructions:

  • div, idiv and aam. Examples include:
  1. word / byte
  2. positive / positive
  3. negative / positive
  4. positive / negative
  5. negative / negative
  6. 0, 1, -1 division
  7. overflow and int 0
  8. 2 random values




Memory contents at the end should be:

0x000:  0x1000  0xf000  0x0000  0xffff  0xa321  0x66fb  0xffff  0x0001
0x010:  0xffff  0xffff  0xffff  0xffff  0xc3da  0xae8e  0xfbb4  0x2821
0x020:  0x5e00  0x0004  0x0005  0x5e00  0x00ff  0x9ec4  0xa320  0xffff
0x030:  0x0120  0xffff  0xffff  0x0120  0x8a00  0xae8e  0x5091  0x0669
0x040:  0x0000  0x00fa  0x0014  0xffff  0xc3da  0xa320  0xffff  0x0001
0x050:  0x0000  0xffff  0x0001  0x0000  0x0d7f  0xae8e  0xf568  0xf110
0x060:  0x25c9  0x0004  0x0005  0x25c9  0x00ff  0xc3da  0xa320  0x00ff
0x070:  0x0120  0xffff  0x0001  0x0120  0x18ff  0xae8e  0x89f3  0x0669
0x080:  0x0004  0x0005  0xffff  0xff00  0x1905  0xff00  0x0000  0x1901
0x090:  0x0000  0xff00  0x0006  0x0006  0x0002  0x0006  0x0002  0x0002
0x0a0:  0x0016  0x0002  0x0006  0x0006  0x0002  0x0006  0x0002  0x0002
0x0b0:  0x0016  0x0006  0x0002  0x0002  0x0006  0x0002  0x0006  0x0006
0x0c0:  0x0012  0x0006  0x0002  0x0002  0x0006  0x0002  0x0006  0x0006
0x0d0:  0x0002  0x0004  0x005f  0x0081  0x009e  0x0002  0x0002  0x0004
0x0e0:  0x010d  0x0128  0x0002  0x0002  0x0002  0x0197  0x0002  0x0004
0x0f0:  0x0002  0x020f  0x0002  0x0249  0x0002  0x0004  0x0002  0x02af
0x100:  0x02c4  0x0002  0x0002  0x02f4  0x0002  0x0002  0xXXXX  0xXXXX