initial
[fpgammix.git] / workloads / overflow3.S
blob378ee5bbc822d43db376c20c96273c0578b8b241
1 #define IOSPACE $250
3         .text
4 #if 1
5 /* Handler for TRIP             #0 */
6         PUSHJ   255,TripHandler
7         PUT     rJ,$255
8         GET     $255,rB
9         RESUME
10 /* Handler for exception D      #10 integer Divide check */
11         PUSHJ   255,ExcDHandler
12         PUT     rJ,$255
13         GET     $255,rB
14         RESUME
15 /* Handler for exception V      #20 integer oVerflow */
16         PUSHJ   255,ExcVHandler
17         PUT     rJ,$255
18         GET     $255,rB
19         RESUME
20 /* Handler for exception W      #30 float-to-fix overfloW */
21         PUSHJ   255,ExcWHandler
22         PUT     rJ,$255
23         GET     $255,rB
24         RESUME
25 /* Handler for exception I      #40 Invalid operation */
26         PUSHJ   255,ExcIHandler
27         PUT     rJ,$255
28         GET     $255,rB
29         RESUME
30 /* Handler for exception O      #50 floating Overflow */
31         PUSHJ   255,ExcOHandler
32         PUT     rJ,$255
33         GET     $255,rB
34         RESUME
35 /* Handler for exception U      #60 floating Underflow */
36         PUSHJ   255,ExcUHandler
37         PUT     rJ,$255
38         GET     $255,rB
39         RESUME
40 /* Handler for exception Z      #70 floating division by Zero */
41         PUSHJ   255,ExcZHandler
42         PUT     rJ,$255
43         GET     $255,rB
44         RESUME
45 /* Handler for exception X      #80 floating ineXact */
46         PUSHJ   255,ExcXHandler
47         PUT     rJ,$255
48         GET     $255,rB
49         RESUME
52 /*      LOC     #10000 */
54 Main    SETH    IOSPACE,1               /* IOSPACE pointer */
55         SETL    $0,TrapVector
56         PUT     rT,$0
57         /*SETL  $0,1234
58         PUT     rTT,$0
59         SETL    $1,'A'
60         PUSHJ   $0,Putch*/
62         TRAP    3,5,'B'
64         POP     0,0
66         SETL    $2,#23
67         SETL    $7,#7777
68         SETL    $11,#1111
69         SETL    $13,#1313
70         TRIP    7,11,13
71         PUSHJ   255,Start
72         TRIP    2,3
74 TripHandler     GET     $250,rA
75                 GET     $251,rX
76                 GET     $252,rY
77                 GET     $253,rZ
78                 ADDU    $250,$251,$252
79                 POP     0,0
80 ExcDHandler     GET     $250,rA
81                 POP     0,0
82 ExcVHandler     GET     $250,rA
83                 POP     0,0
84 ExcWHandler     GET     $250,rA
85                 POP     0,0
86 ExcIHandler     GET     $250,rA
87                 POP     0,0
88 ExcOHandler     GET     $250,rA
89                 POP     0,0
90 ExcUHandler     GET     $250,rA
91                 POP     0,0
92 ExcZHandler     GET     $250,rA
93                 POP     0,0
94 ExcXHandler     GET     $250,rA
95                 POP     0,0
98 Start   SETL    $0,#FF00  % #3FFFF is the most ones I can use in a PUT rA instruction
99         INCML   $0,#0
100         PUT     rA,$0
101         SETL    $250,#16c1
102         INCML   $250,#7777
103         INCMH   $250,#7777
104         INCH    $250,#7777
105         SETL    $3,#1
107 L:2     MUL     $0,$250,2
108         ADD     $3,$3,1
109         ADD     $250,$0,$250
110         CMP     $0,$3,3
111         PBNZ    $0,L:2
112         POP     1,0
114 TrapVector      PUSHJ   255,TrapHandler
115                 PUT     rJ,$255
116                 GET     $255,rBB
117                 RESUME  1
120 TrapHandler     GET     $1,rBB
121                 GET     $1,rXX
122                 GET     $1,rYY
123                 GET     $1,rZZ
124                 GET     $0,rJ
125                 SETL    $2,'T'
126                 PUSHJ   $1,Putch
127                 PUT     rJ,$0
128                 POP     0,0
130 Putch   LDT     $1,IOSPACE,0
131         PBOD    $1,Putch
132         STBU    $0,IOSPACE
133         POP     0,0
134 #else
136 Blah            JMP     Blah
138 Main            SETL    $0,TrapVector
139                 PUT     rT,$0
140                 TRAP    3,5,'B'
141                 POP     0,0
142                 SWYM
144 TrapVector      PUSHJ   255,TrapHandler
145                 PUT     rJ,$255
146                 GET     $255,rBB
147                 RESUME  1
149 TrapHandler     POP     0,0
150 #endif