Pristine Ack-5.5
[Ack-5.5.git] / mach / mantra / int / mloop8
1 .sect .text
2 .sect .rom
3 .sect .data
4 .sect .bss
5 .sect .text
6 !-------------------------------------------------------------------------
7 !               TEST AND BRANCH GROUP
8 !-------------------------------------------------------------------------
9
10 tlt_z:  testen  (sp)+   ; blt   true    ; cl    -(sp)   ; jmp   (a4)
11 tle_z:  testen  (sp)+   ; ble   true    ; cl    -(sp)   ; jmp   (a4)
12 teq_z:  testen  (sp)+   ; beq   true    ; cl    -(sp)   ; jmp   (a4)
13 tne_z:  testen  (sp)+   ; bne   true    ; cl    -(sp)   ; jmp   (a4)
14 tge_z:  testen  (sp)+   ; bge   true    ; cl    -(sp)   ; jmp   (a4)
15 tgt_z:  testen  (sp)+   ; bgt   true    ; cl    -(sp)   ; jmp   (a4)
16
17 true:           mov     #1,-(sp) ;      jmp     (a4)
18
19 zlt_s0:         testen  (sp)+   ;       blt     bra_s0  ; bra nobr2
20 zlt_l:          testen  (sp)+   ;       blt     bra_l   ; bra nobr3
21 zlt_q:          move.l  (sp)+,d0
22                 testen  (sp)+   ;       blt     1f      ; jmp (a4)
23 zle_s0:         testen  (sp)+   ;       ble     bra_s0  ; bra nobr2
24 zle_l:          testen  (sp)+   ;       ble     bra_l   ; bra nobr3
25 zle_q:          move.l  (sp)+,d0
26                 testen  (sp)+   ;       ble     1f      ; jmp (a4)
27 zeq_s0:         testen  (sp)+   ;       beq     bra_s0  ; bra nobr2
28 zeq_s1:         testen  (sp)+   ;       beq     bra_s1  ; bra nobr2
29 zeq_l:          testen  (sp)+   ;       beq     bra_l   ; bra nobr3
30 zeq_q:          move.l  (sp)+,d0
31                 testen  (sp)+   ;       beq     1f      ; jmp (a4)
32 zne_s0:         testen  (sp)+   ;       bne     bra_s0  ; bra nobr2
33 zne_s_1:        testen  (sp)+   ;       bne     bra_s_1 ; bra nobr2
34 zne_l:          testen  (sp)+   ;       bne     bra_l   ; bra nobr3
35 zne_q:          move.l  (sp)+,d0
36                 testen  (sp)+   ;       bne     1f      ; jmp (a4)
37 zge_s0:         testen  (sp)+   ;       bge     bra_s0  ; bra nobr2
38 zge_l:          testen  (sp)+   ;       bge     bra_l   ; bra nobr3
39 zge_q:          move.l  (sp)+,d0
40                 testen  (sp)+   ;       bge     1f      ; jmp (a4)
41 zgt_s0:         testen  (sp)+   ;       bgt     bra_s0  ; bra nobr2
42 zgt_l:          testen  (sp)+   ;       bgt     bra_l   ; bra nobr3
43 zgt_q:          move.l  (sp)+,d0
44                 testen  (sp)+   ;       bgt     1f      ; jmp (a4)
45
46 blt_s0:         comp    (sp)+,(sp)+ ;   blt bra_s0 ;    bra nobr2
47 blt_l:          comp    (sp)+,(sp)+ ;   blt bra_l ;     bra nobr3
48 blt_q:          move.l  (sp)+,d0
49                 comp    (sp)+,(sp)+ ;   blt 1f ;        jmp (a4)
50 ble_s0:         comp    (sp)+,(sp)+ ;   ble bra_s0 ;    bra nobr2
51 ble_l:          comp    (sp)+,(sp)+ ;   ble bra_l ;     bra nobr3
52 ble_q:          move.l  (sp)+,d0
53                 comp    (sp)+,(sp)+ ;   ble 1f ;        jmp (a4)
54 beq_s0:         comp    (sp)+,(sp)+ ;   beq bra_s0 ;    bra nobr2
55 beq_l:          comp    (sp)+,(sp)+ ;   beq bra_l ;     bra nobr3
56 beq_q:          move.l  (sp)+,d0
57                 comp    (sp)+,(sp)+ ;   beq 1f ;        jmp (a4)
58 bne_s0:         comp    (sp)+,(sp)+ ;   bne bra_s0 ;    bra nobr2
59 bne_l:          comp    (sp)+,(sp)+ ;   bne bra_l ;     bra nobr3
60 bne_q:          move.l  (sp)+,d0
61                 comp    (sp)+,(sp)+ ;   bne 1f ;        jmp (a4)
62 bge_s0:         comp    (sp)+,(sp)+ ;   bge bra_s0 ;    bra nobr2
63 bge_l:          comp    (sp)+,(sp)+ ;   bge bra_l ;     bra nobr3
64 bge_q:          move.l  (sp)+,d0
65                 comp    (sp)+,(sp)+ ;   bge 1f ;        jmp (a4)
66 bgt_s0:         comp    (sp)+,(sp)+ ;   bgt bra_s0 ;    bra nobr2
67 bgt_l:          comp    (sp)+,(sp)+ ;   bgt bra_l ;     bra nobr3
68 bgt_q:          move.l  (sp)+,d0
69                 comp    (sp)+,(sp)+ ;   bgt 1f ;        jmp (a4)
70
71 bra_s0:
72                         move.l  d6,d0
73 0:                      move.b  (a3)+,d0
74 1:                      add.l   d0,a3   ;       jmp     (a4)
75 bra_l:          move.b  (a3)+,-(sp) ;   move.b  (a3)+,1(sp)
76                 move.w  (sp)+,d0 ;      ext.l   d0
77                 bra     1b
78 bra_q:
79                 move.l  (sp)+,d0 ;      bra     1b
80 bra_s1:         move.w  #0x100,d0 ;     bra     0b
81 bra_s_1:        move.l  #-1,d0  ;       bra     0b
82 bra_s_2:        move.l  #-0x200,d0 ;    bra     0b
83 nobr2:          add.l   #1,a3   ;       jmp     (a4)
84 nobr3:          add.l   #2,a3   ;       jmp     (a4)
85
86 !---------------------------------------------------------------------------
87 !               COMPARE GROUP
88 !-----------------------------------------------------------------------------
89
90 cmi_z:          mov     (sp)+,d0 ;      bra     0f
91 cmi_l:          adroff          ;       move.w  (a5),d0
92 0:              sub.w   wrd,d0 ;        beq     cmi_1W
93                 sub.w   wrd,d0 ;        beq     cmi_2W
94                 bra     e_oddz
95 cmi_1W:         comp    (sp)+,(sp)+ ;   bgt     1f      ;       beq 2f
96 3:              mov     #-1,-(sp) ;     jmp     (a4)
97 1:              mov     #1,-(sp) ;      jmp     (a4)
98 2:              cl      -(sp)   ;       jmp     (a4)
99 cmi_2W:
100 #ifdef  lword
101                 bsr     no8bar  ;       bra     e_oddz
102 #endif
103                 cmp.l   (sp)+,(sp)+ ;   blt     3b      ;       beq 2b
104                 bra     1b
105
106 cmu_z:          mov     (sp)+,d0 ;      bra     4f
107 cmu_l:          adroff          ;       move.w  (a5),d0
108 4:              sub.w   wrd,d0  ;       bne     5f
109                 comp    (sp)+,(sp)+ ;   bcs     3b
110                 beq     2b      ;       bra     1b
111 5:              sub.w   wrd,d0  ;       bne     e_oddz
112 #ifdef lword
113                 bsr     no8bar  ;       bra     e_oddz
114 #endif
115 cmp_z:          cmp.l   (sp)+,(sp)+ ;   bcs     3b
116                 beq     2b      ;       bra     1b
117
118 cms_l:          adroff          ;       move.w  (a5),d0
119                 bra     0f
120 cms_z:          mov     (sp)+,d0 ;      bra     0f
121 cms_s0:         move.l  d6,d0   ;       move.b  (a3)+,d0
122 0:              move.l  d0,d1   ;       move.l  sp,a0
123                 asri    wmu,d1  ;       subt    #1,d1
124                 add.l   d0,sp   ;       move.l  sp,d2
125 1:              comp    (a0)+,(sp)+ ;   bne     2f
126                 dbra    d1,1b
127                 mov     d6,-(sp) ;      jmp     (a4)
128 2:              add.l   d0,d2   ;       move.l  d2,sp
129                 move.l  #1,d1   ;       mov     d1,-(sp)
130                 jmp     (a4)
131
132
133 !               DUMMY FLOAT ROUTINES. POINTER ADJUSTMENT AND WARNING
134
135 cmf_s0:         move.l  d6,d0   ;       move.b  (a3)+,d0
136 #ifdef FLTRAP
137 9:              add.w   d0,d0   ;       add.l   d0,sp
138                 cl      -(sp)
139                 bra     flnim   
140 #else
141 9:
142                 checkfsize
143 4:
144                 jsr     .cmf4
145                 lea     8(sp),sp
146                 mov     d0,-(sp)
147                 jmp     (a4)
148 8:
149                 jsr     .cmf8
150                 lea     16(sp),sp
151                 mov     d0,-(sp)
152                 jmp     (a4)
153 #endif
154 cmf_l:          adroff          ;       move.w  (a5),d0 ;       bra 9b
155 cmf_z:          mov     (sp)+,d0 ;      bra     9b
156
157 !-------------------------------------------------------------------------
158 !               CALL AND RETURN GROUP
159 !----------------------------------------------------------------------------
160
161 cai_z:          move.l  (sp)+,d0 ;      bra     1f
162 cal_q:          move.l  (sp)+,d0 ;      bra     1f
163 cal_l:          adroff          ;       move.w  (a5),d0 ;       bra 1f
164 cal_s0:         move.w  d6,d0   ;       move.b  (a3)+,d0 ;      bra 1f
165 cal_1:  cal_2:  cal_3:  cal_4:  cal_5:  cal_6:  cal_7:  cal_8:
166 cal_9:  cal_10: cal_11: cal_12: cal_13: cal_14: cal_15: cal_16:
167 cal_17: cal_18: cal_19: cal_20: cal_21: cal_22: cal_23: cal_24:
168 cal_25: cal_26: cal_27: cal_28:
169                 asr.w   #2,d0   ;       sub.w   #0x3F,d0
170 lblcal:
171 1:              cmp.l   nproc,d0 ;      bhi     e_badpc
172                 asl.l   #3,d0
173 #if     flow + count + prof
174                 move.l  d0,d1   ;       asl.l   #1,d1
175                 add.l   d1,d0                           !PROC DES. 24 BYTES
176 #endif
177                 move.l  (a6),-(sp)
178                 move.l  4(a6),-(sp) ;   move.l  a3,-(sp)
179                 link    a2,#0   ;       move.l  d0,a0
180                 add.l   pd,a0                           !a0 points at proc. des.
181 #if     prof+count+flow
182                 tst.l   20(a0)          !A FILE NAME DEFINED IN THIS PROC
183                 bne     4f              !YES ? CONTINUE
184                 move.l  8(sp),20(a0)    !NO ? TAKE OLD FILE NAME
185 4:              move.l  curproc,8(sp)   !SAVE OLD PROCEDURE DESCRIPTOR
186                 move.l  a0,curproc      !CONTINUE WITH NEW ONE
187                 move.l  8(a0),d0        !COUNT POINTER MINUS LINE NUMBER
188                 sub.l   12(a0),d0       !OF FIRST LINE IN countfld
189                 move.l  d0,countfld
190 #endif
191                 move.l  (a0)+,d1 ;      sub.l   d1,sp
192                 claimstack      ;       add.l   d1,sp
193                 tst.l   d1      ;       beq     3f
194                 sub.l   #1,d1   ;       asr.l   wmu,d1
195 2:              mov     und,-(sp) ;     dbra    d1,2b
196 3:              move.l  (a0),a3 ;       jmp     (a4)
197
198 ret_l:          adroff          ;       move.w  (a5),d0
199                 bra     1f
200 ret_s0:         move.l  #0,d0   ;       move.b  (a3)+,d0
201 1:              blt     e_oddz  ;       beq     ret_0
202                 comp    #32,d0  ;       ble     2f
203                 bsr     e_badlfr
204 2:              sub.w   #1,d0   ;       asr.w   wmu,d0
205                 bra     5f
206 ret_1W:         move.l  #0,d0
207 5:              move.w  d0,retsize                      !RETSIZE CONTAINS 
208 3:              mov     (sp)+,(a5)+ ;   dbra    d0,3b   ! #WORDS-1
209                 lea     retarea,a5 ;    bra     4f
210 ret_0:          move.w  #-1,retsize
211 4:              unlk    a2      ;       cmp.l   a2,d6
212                 bne     9f
213                 cl      -(sp)
214                 jsr     hlt_z 
215 9:
216                 move.l  (sp)+,a3
217                 move.l  (sp)+,a0                !FILE OR PROC DES BASE IN a0
218 #if     count+flow+prof
219                 move.l  a0,curproc              !SAVE PROC DES BASE CUR PROC
220                 move.l  8(a0),d0                !d0 IS COUNT
221                 sub.l   12(a0),d0               !d0 IS COUNT-FIRST LINE
222                 move.l  d0,countfld             !RESTORE POINTER
223                 beq     1f                      !NO LINES IN CALLER
224                 add.l   (sp),d0                 !ADD LINE NUMBER
225                 move.l  d0,countptr
226 1:
227 #if     prof
228                 beq     5f
229                 asl.l   #2,d0
230                 add.l   ltime,d0
231                 move.l  d0,profile              !profile POINTS AT COUNT 
232 5:
233 #endif
234                 move.l  20(a0),a0               !POINTER TO FILE NAME IN a0
235 #endif
236                 move.l  a0,4(a6)                        !OLD FILE ADDRESS
237                 move.l  (sp)+,(a6)                      !OLD LINE NUMBER
238                 jmp     (a4)
239
240 lfr_1W:         move.w  d6,d0   ;       move.l  wrd,d1
241 0:              cmp.w   retsize,d0 ;    beq     1f
242                 bsr     e_badlfr
243 1:              add.l   d1,a5
244 2:              mov     -(a5),-(sp) ;   dbra    d0,2b
245 5:              jmp     (a4)
246 lfr_l:          move.b  (a3)+,-(sp) ;   move.b  (a3)+,1(sp)
247                 move.w  (sp)+,d0 ;      bra     3f
248 lfr_s0:         move.l  d6,d0   ;       move.b  (a3)+,d0
249 3:              move.l  d7,d2   ;       move.l  d0,d1
250 4:              asr.w   #1,d0   ;       bcs     e_illins
251                 dbra    d2,4b   ;       beq     5b
252                 sub.w   #1,d0   ;       bra     0b
253 lfr_2W:         move.l  wrd,d1  ;       add.l   d1,d1
254                 move.l  #1,d0   ;       bra     0b
255
256 e_badlfr:       mov     #0x1C,-(sp) ;   bra     error