initial
[fpgammix.git] / workloads / overflow2.mms
blob1d56be924abacbf95c0cd5cff8ec9f48caa25832
1 foo     GREG
3         LOC     #0
4 ; Handler for TRIP              #0
5         PUSHJ   255,TripHandler
6         PUT     rJ,$255
7         GET     $255,rB
8         RESUME
9 ; Handler for exception D       #10 integer Divide check
10         PUSHJ   255,ExcDHandler
11         PUT     rJ,$255
12         GET     $255,rB
13         RESUME
14 ; Handler for exception V       #20 integer oVerflow
15         PUSHJ   255,ExcVHandler
16         PUT     rJ,$255
17         GET     $255,rB
18         RESUME
19 ; Handler for exception W       #30 float-to-fix overfloW
20         PUSHJ   255,ExcWHandler
21         PUT     rJ,$255
22         GET     $255,rB
23         RESUME
24 ; Handler for exception I       #40 Invalid operation
25         PUSHJ   255,ExcIHandler
26         PUT     rJ,$255
27         GET     $255,rB
28         RESUME
29 ; Handler for exception O       #50 floating Overflow
30         PUSHJ   255,ExcOHandler
31         PUT     rJ,$255
32         GET     $255,rB
33         RESUME
34 ; Handler for exception U       #60 floating Underflow
35         PUSHJ   255,ExcUHandler
36         PUT     rJ,$255
37         GET     $255,rB
38         RESUME
39 ; Handler for exception Z       #70 floating division by Zero
40         PUSHJ   255,ExcZHandler
41         PUT     rJ,$255
42         GET     $255,rB
43         RESUME
44 ; Handler for exception X       #80 floating ineXact
45         PUSHJ   255,ExcXHandler
46         PUT     rJ,$255
47         GET     $255,rB
48         RESUME
50 Start   PUSHJ   255,Main
51         TRIP    2,3
52         TRAP    0,1
54 TripHandler     GET     foo,rA
55                 POP     0,0
56 ExcDHandler     GET     foo,rA
57                 POP     0,0
58 ExcVHandler     GET     foo,rA
59                 POP     0,0
60 ExcWHandler     GET     foo,rA
61                 POP     0,0
62 ExcIHandler     GET     foo,rA
63                 POP     0,0
64 ExcOHandler     GET     foo,rA
65                 POP     0,0
66 ExcUHandler     GET     foo,rA
67                 POP     0,0
68 ExcZHandler     GET     foo,rA
69                 POP     0,0
70 ExcXHandler     GET     foo,rA
71                 POP     0,0
74         LOC     #10000
75 Main    SETL    $0,#0000  % #3FFFF is the most ones I can use in a PUT rA instruction
76         INCML   $0,#0
77         PUT     rA,$0
78         TRAP    
79         SETL    foo,#16c1
80         INCML   foo,#7777
81         INCMH   foo,#7777
82         INCH    foo,#7777
83         SETL    $3,#1
85 L:2     MUL     $0,foo,2
86         ADD     $3,$3,1
87         ADD     foo,$0,foo
88         CMP     $0,$3,30
89         PBNZ    $0,L:2
90         POP     1,0
92 ; Overflow handler
93         GET     $8,rY
94         GET     $9,rX
95         GET     $10,rZ
96         GET     $11,rW
97 ; Change the result
98         ADDU    $8,$8,$0
99         ADDU    $8,$8,$10
100         ADDU    $8,$8,$11
101         PUT     rZ,$8
102         ANDNH   $9,#FF00
103         ORH     $9,#0200
104         SETH    $9,1
106 1H      SETL    $11,'+'
107         LDTU    $10,$9,4
108         PBOD    $10,1B
109         STBU    $11,$9,7
111         RESUME