Elliott 803 Algol 60 Compiler (reconstructed)


File: outoper.t2

For general comments see here
LineAddressObject Code LabelF1N1BF2N2CommentsCheck
1 0  ; tape1.d/outoper.t2
2 0  ;-------------------
3 0  ;
4 0  ; define local name for general work location
5 0  opindex=W2245; 
6 0  ;
7 0  ; OutOper: generate code for stacked operators
8 0  ;
9 0  =2758 
10 2758  OutOper::; 
11 2758  .ent:; 
12 2758 0010646577775 o00 stkp/lod -3;get 1st operand info @2758
13 2759   jnz     ;->binary operator
13+12759 1045310 jz .1    
13+22759+1005322 jmp OutOper.2    
13+32760  .1:; 
14 2760 0010646577776 o00 stkp/lod -2; @2760
15 2761 0124346 sub W2278   ;
16 2761+1045313 jz .1   ;
17 2762 1005374 jmp .err31   ;invalid operator @2762
18 2762+  pad     ;
18+12762+0000000 00 0    
19 2763  ;
20 2763  .1:; 
21 2763 0010646577777 o00 stkp/lod -1;
22 2764 0404306 sto W2246   ; @2764
23 2764+0604347 lod K4a   ;=4
24 2765   call     ;
24+12765 7320121004032 lnk gencode1.lnk:jmp gencode1.ent 
25 2766   pad     ; @2766
25+12766 0000000 00 0    
26 2766+0040000 o02 0   ;=1
27 2767 2710646600000 o27 stkp/lod 0;
28 2768 0010646377777 o00 stkp/sto -1; @2768
29 2769   ret     ;return
29+12769 0025427000001 o00 OutOper.lnk/jmp 1 
30 2770  ;
31 2770  .2:; 
32 2770 0404307 sto W2247   ;store LHS info @2770
33 2770+0544305 cls opindex   ;clear op index number
34 2771 0010646577777 o00 stkp/lod -1;get RHS info
35 2772 0404306 sto W2246   ;store it @2772
36 2772+0064345 and W2277   ;=0001774017777 mask out seg/off
37 2773 1145327 jz .3   ;already in Acc, handle reverse ops
38 2773+0604307 lod W2247   ;
39 2774 0204306 exa W2246   ; @2774
40 2774+0404031 sto IdInfo   ;
41 2775 1005332 jmp .4   ;->
42 2775+ ;
43 2775+ .3:; 
44 2775+0604350 lod W2280   ;=6
45 2776 0504305 ads opindex   ;add 6 to op index num @2776
46 2776+0604306 lod W2246   ;operand type
47 2777 0204307 exa W2247   ;swap with LHS info
48 2777+0404031 sto IdInfo   ;store for generate routines
49 2778  .4:; 
50 2778   call     ;mark free if temp @2778
50+12778 7323761005051 lnk FreeTemp.lnk:jmp FreeTemp.ent 
51 2779 0604031 lod IdInfo   ;
52 2779+0000000 o00 0   ;no-op
53 2780 0064324 and T_Mask   ;=0700000000000 @2780
54 2780+0124320 sub IntBit   ;=0200000000000
55 2781 1145337 jz .5   ;integer operator needed
56 2781+1125372 jn .err31a   ;boolean operator
57 2782 0604351 lod W2281   ;=12 @2782
58 2782+0504305 ads opindex   ;add 12 to op index num
59 2783 1105342 jmp .6   ;
60 2783+ ;
61 2783+ .5:; 
62 2783+0604306 lod W2246   ;
63 2784 0064324 and T_Mask   ;=0700000000000 @2784
64 2784+0124320 sub IntBit   ;=0200000000000
65 2785 1145342 jz .6   ;
66 2785+1005375 jmp .11   ;->
67 2786  ;
68 2786  ; from 2821+
69 2786  .5a:; 
70 2786 0504305 ads opindex   ;add to opindex @2786
71 2786+ .6:; 
72 2786+0604352 lod W2282   ;=-22
73 2787 0010646077776 o00 stkp/add -2;convert op to index 0..5
74 2788 1025374 jn .err31   ;operator invalid @2788
75 2788+0504305 ads opindex   ;add to opindex
76 2789 1045364 jz .9   ;op='+'
77 2789+0124313 sub K1b   ;=1
78 2790 1045367 jz .10   ;op='-' @2790
79 2790+0164347 bus K4a   ;=4 *,/,div,**
80 2791 1025374 jn .err31   ;operator invalid
81 2791+ .7:; 
82 2791+0604353 lod W2283   ;=07077777777777
83 2792 0464307 ans W2247   ; @2792
84 2792+0604320 lod IntBit   ;
85 2793 0504307 ads W2247   ;set result type
86 2793+0000000 o00 0   ;no-op
87 2794 0021426605406 00 opindex/lod .optab; get from table @2794
88 2795 1045374 jz .err31   ;entry=0 means invalid combination
89 2795+1025355 jn .8   ;result is integer
90 2796 0604322 lod TBool   ;TReal-TInt @2796
91 2796+0504307 ads W2247   ;modify result type to Real
92 2797  .8:; 
93 2797 0604307 lod W2247   ;
94 2797+  pad     ;no-op
94+12797+0000000 00 0    
95 2798 0010646377775 o00 stkp/sto -3;store result type @2798
96 2799 0604340 lod K2b   ;=2
97 2799+0562151 o27 stkp   ;drop stack two entries
98 2800 0021426605406 00 opindex/lod .optab; get from table (again) @2800
99 2801 0064354 and W2284   ;=037 mask off top bit
100 2801+  pad     ;no-op
100+12801+0000000 00 0    
101 2802   call     ;generate specified oper code @2802
101+12802 7320121004032 lnk gencode1.lnk:jmp gencode1.ent 
102 2803   ret     ;return
102+12803 0025427000001 o00 OutOper.lnk/jmp 1 
103 2804  ;
104 2804  .9:; 
105 2804 0010646577774 o00 stkp/lod -4;get possible previous operator
106 2805 0124346 sub W2278   ;=23 '-'
107 2805+1125347 jn .7   ;->
108 2806 0444305 inc opindex   ;bump opindex @2806
109 2806+1105347 jmp .7   ;->
110 2807  ;
111 2807  .10:; 
112 2807 0010646577774 o00 stkp/lod -4;
113 2808 0124346 sub W2278   ; @2808
114 2808+1125347 jn .7   ;
115 2809 0040000 o02 0   ;=1
116 2809+0564305 o27 opindex   ;
117 2810 1105347 jmp .7   ; @2810
118 2810+ ;
119 2810+ ;L2810P:
120 2810+ .err31a:; 
121 2810+ ;.2810P:
122 2810+0604357 lod W2287   ;
123 2811  _err31:; 
124 2811 1661044 lnk errlnk   ;error 31: bad operator/operand in exprn
125 2811+  ;or, missing ( after proc name 
126 2811+1001070 jmp Error   ;call error routine
127 2812  ;
128 2812  .err31:; 
129 2812 0604340 lod K2b   ;=2 @2812
130 2812+1005373 jmp _err31   ;
131 2813  ;
132 2813  ; from 2785+
133 2813  .11:; 
134 2813 0010646577776 o00 stkp/lod -2;
135 2814 0124342 sub K27   ;=27 [;;] @2814
136 2814+1045405 jz .12   ;->
137 2815 0604031 lod IdInfo   ;
138 2815+0064344 and W2276   ;
139 2816   jnz     ;
139+12816 1045401 jz .1    
139+22816+1005405 jmp OutOper.12    
139+32817  .1:; 
140 2817 0020146600000 o00 IdInfo/lod 0;
141 2818 1540000 flt 4096   ; @2818
142 2818+0000000 o00 0   ;
143 2819 0020146400000 o00 IdInfo/sto 0;
144 2820 0604322 lod TBool   ; @2820
145 2820+0504031 ads IdInfo   ;
146 2821  .12:; 
147 2821 0604351 lod W2281   ;
148 2821+1005342 jmp .5a   ;->
149 2822  ;
150 2822  .FLAG= ëÿ¿P/@hëÿ¿hX@Ø ôÿ¿ÿ04000000000000; 
151 2822  .optab:; 
152 2822 4000000000016 +14+.FLAG;+00 + int @2822
153 2823 4000000000017 +15+.FLAG;+01 - int @2823
154 2824 4000000000021 +17+.FLAG;+02 * int @2824
155 2825 0000000000012 +10;+03 / real @2825
156 2826 4000000000022 +18+.FLAG;+04 DIV int @2826
157 2827 0000000000014 +12;+05 ** real @2827
158 2828 4000000000016 +14+.FLAG;+06 + int @2828
159 2829 4000000000020 +16+.FLAG;+07 - int @2829
160 2830 4000000000021 +17+.FLAG;+08 * int @2830
161 2831 0000000000013 +11;+09 / real @2831
162 2832 4000000000023 +19+.FLAG;+10 DIV int @2832
163 2833 0000000000015 +13;+11 ** real @2833
164 2834 0000000000005 +5;+12 + real @2834
165 2835 0000000000006 +6;+13 - real @2835
166 2836 0000000000010 +8;+14 * real @2836
167 2837 0000000000012 +10;+15 / real @2837
168 2838 0000000000000 +0;+16 (illegal) @2838
169 2839 0000000000014 +12;+17 ** real @2839
170 2840 0000000000005 +5;+18 + real @2840
171 2841 0000000000007 +7;+19 - real @2841
172 2842 0000000000010 +8;+20 * real @2842
173 2843 0000000000013 +11;+21 / real @2843
174 2844 0000000000000 +0;+22 (illegal) (Div/Float) @2844
175 2845 0000000000015 +13;+23 ** real @2845
176 2846  ;--------------------------------------------------------------------

Page created by Bill Purvis, last updated: January 09 2004