1 % Run some simple tests on DIV (signed)
3 % This depends on working GETA, LDOU, PUT
8 Main GETA $255,Traphandler
10 PUT rT,$255 % We only try this in supervisor mode
13 Loop PUT rA,0 % clear current exception
14 LDOU $1,$0,0 % Quotent
15 LDOU $2,$0,8 % Divisor
16 LDOU $3,$0,16 % Expected result
17 LDOU $4,$0,24 % Expected remainder
18 LDOU $7,$0,32 % Expected exception
20 DIV $5,$1,$2 % check result
24 GET $5,rR % check remainder
28 GET $5,rA % check current exception
29 AND $5,$5,(1<<6)|(1<<7) % keep only DV bits
33 ADDU $0,$0,40 % move to next data tuple
40 Done TRAP 0,Fputs,StdOut
43 PassMsg BYTE "Passed",#a,0
44 FailMsg BYTE "Failed!",#a,0
46 Numbers OCTA -17092006
59 OCTA #8000000000000017
62 OCTA #8000000000000017
63 OCTA 1<<7 % expect the D divide exception
77 OCTA #8000000000000000
78 OCTA #FFFFFFFFFFFFFFFF
79 OCTA #8000000000000000
81 OCTA 1<<6 % expect the V integer overflow exception
83 OCTA #8000000000000017
86 OCTA #8000000000000017
87 OCTA 1<<7 % expect the D divide exception
91 % XXX This should be a separate module prefixed to .txt files
92 % XXX I just need to pick a good address for the Traphandler
93 % This has no impact on mmix simulation, but is for RTL
94 Traphandler GET $255,rBB