OSDN Git Service

* config/m68hc11/larith.asm (divmodhi4): Empty for 68HC12.
[pf3gnuchains/gcc-fork.git] / gcc / config / m68hc11 / larith.asm
1 /* libgcc1 routines for M68HC11 & M68HC12.
2    Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
10
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file with other programs, and to distribute
14 those programs without any restriction coming from the use of this
15 file.  (The General Public License restrictions do apply in other
16 respects; for example, they cover modification of the file, and
17 distribution when not linked into another program.)
18
19 This file is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; see the file COPYING.  If not, write to
26 the Free Software Foundation, 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.  */
28
29 /* As a special exception, if you link this library with other files,
30    some of which are compiled with GCC, to produce an executable,
31    this library does not by itself cause the resulting executable
32    to be covered by the GNU General Public License.
33    This exception does not however invalidate any other reasons why
34    the executable file might be covered by the GNU General Public License.  */
35
36         .file "larith.asm"
37
38         .sect .text
39         
40
41 #define REG(NAME)                       \
42 NAME:   .word 0;                        \
43         .type NAME,@object ;            \
44         .size NAME,2
45
46 #ifdef L_regs_min
47 /* Pseudo hard registers used by gcc.
48    They must be located in page0. 
49    They will normally appear at the end of .page0 section.  */
50 #ifdef mc68hc12
51         .sect .bss
52 #else
53         .sect .page0
54 #endif
55         .globl _.tmp,_.frame
56         .globl _.z,_.xy
57 REG(_.tmp)
58 REG(_.z)
59 REG(_.xy)
60 REG(_.frame)
61
62 #endif
63
64 #ifdef L_regs_d1_8
65 /* Pseudo hard registers used by gcc.
66    They must be located in page0. 
67    They will normally appear at the end of .page0 section.  */
68 #ifdef mc68hc12
69         .sect .bss
70 #else
71         .sect .page0
72 #endif
73         .globl _.d1,_.d2,_.d3,_.d4,_.d5,_.d6
74         .globl _.d7,_.d8
75 REG(_.d1)
76 REG(_.d2)
77 REG(_.d3)
78 REG(_.d4)
79 REG(_.d5)
80 REG(_.d6)
81 REG(_.d7)
82 REG(_.d8)
83
84 #endif
85
86 #ifdef L_regs_d8_16
87 /* Pseudo hard registers used by gcc.
88    They must be located in page0. 
89    They will normally appear at the end of .page0 section.  */
90         .sect .page0
91         .globl _.d9,_.d10,_.d11,_.d12,_.d13,_.d14
92         .globl _.d15,_.d16
93 REG(_.d9)
94 REG(_.d10)
95 REG(_.d11)
96 REG(_.d12)
97 REG(_.d13)
98 REG(_.d14)
99 REG(_.d15)
100 REG(_.d16)
101
102 #endif
103
104 #ifdef L_regs_d17_32
105 /* Pseudo hard registers used by gcc.
106    They must be located in page0. 
107    They will normally appear at the end of .page0 section.  */
108 #ifdef mc68hc12
109         .sect .bss
110 #else
111         .sect .page0
112 #endif
113         .globl _.d17,_.d18,_.d19,_.d20,_.d21,_.d22
114         .globl _.d23,_.d24,_.d25,_.d26,_.d27,_.d28
115         .globl _.d29,_.d30,_.d31,_.d32
116 REG(_.d17)
117 REG(_.d18)
118 REG(_.d19)
119 REG(_.d20)
120 REG(_.d21)
121 REG(_.d22)
122 REG(_.d23)
123 REG(_.d24)
124 REG(_.d25)
125 REG(_.d26)
126 REG(_.d27)
127 REG(_.d28)
128 REG(_.d29)
129 REG(_.d30)
130 REG(_.d31)
131 REG(_.d32)
132 #endif
133
134 #ifdef L_premain
135 ;;
136 ;; Specific initialization for 68hc11 before the main.
137 ;; Nothing special for a generic routine; Just enable interrupts.
138 ;;
139         .sect .text
140         .globl __premain
141 __premain:
142         clra
143         tap     ; Clear both I and X.
144         rts
145 #endif
146
147 #ifdef L__exit
148 ;;
149 ;; Exit operation.  Just loop forever and wait for interrupts.
150 ;; (no other place to go)
151 ;;
152         .sect .text
153         .globl _exit    
154         .globl exit
155         .weak  exit
156 exit:
157 _exit:
158 fatal:
159         cli
160         wai
161         bra fatal
162 #endif
163
164 #ifdef L_abort
165 ;;
166 ;; Abort operation.  This is defined for the GCC testsuite.
167 ;;
168         .sect .text
169         .globl abort
170 abort:
171         ldd     #255            ; 
172 #ifdef mc68hc12
173         trap    #0x30
174 #else
175         .byte 0xCD              ; Generate an illegal instruction trap
176         .byte 0x03              ; The simulator catches this and stops.
177 #endif
178         jmp _exit
179 #endif
180         
181 #ifdef L_cleanup
182 ;;
183 ;; Cleanup operation used by exit().
184 ;;
185         .sect .text
186         .globl _cleanup
187 _cleanup:
188         rts
189 #endif
190
191 ;-----------------------------------------
192 ; required gcclib code
193 ;-----------------------------------------
194 #ifdef L_memcpy
195         .sect .text
196         .weak memcpy
197         .globl memcpy
198         .globl __memcpy
199 ;;;
200 ;;; void* memcpy(void*, const void*, size_t)
201 ;;; 
202 ;;; D    = dst  Pmode
203 ;;; 2,sp = src  Pmode
204 ;;; 4,sp = size HImode (size_t)
205 ;;; 
206 __memcpy:
207 memcpy:
208 #ifdef mc68hc12
209         ldx     2,sp
210         ldy     4,sp
211         pshd
212         xgdy
213         lsrd
214         bcc     Start
215         movb    1,x+,1,y+
216 Start:
217         beq     Done
218 Loop:
219         movw    2,x+,2,y+
220         dbne    d,Loop
221 Done:
222         puld
223         rts
224 #else
225         xgdy
226         tsx
227         ldd     4,x
228         ldx     2,x             ; SRC = X, DST = Y
229         cpd     #0
230         beq     End
231         pshy
232         inca                    ; Correction for the deca below
233 L0:
234         psha                    ; Save high-counter part
235 L1:
236         ldaa    0,x             ; Copy up to 256 bytes
237         staa    0,y
238         inx
239         iny
240         decb
241         bne     L1
242         pula
243         deca
244         bne     L0
245         puly                    ; Restore Y to return the DST
246 End:
247         xgdy
248         rts
249 #endif
250 #endif
251
252 #ifdef L_memset
253         .sect .text
254         .globl memset
255         .globl __memset
256 ;;;
257 ;;; void* memset(void*, int value, size_t)
258 ;;; 
259 #ifndef __HAVE_SHORT_INT__
260 ;;; D    = dst  Pmode
261 ;;; 2,sp = src  SImode
262 ;;; 6,sp = size HImode (size_t)
263         val  = 5
264         size = 6
265 #else
266 ;;; D    = dst  Pmode
267 ;;; 2,sp = src  SImode
268 ;;; 6,sp = size HImode (size_t)
269         val  = 3
270         size = 4
271 #endif
272 __memset:
273 memset:
274 #ifdef mc68hc12
275         xgdx
276         ldab    val,sp
277         ldy     size,sp
278         pshx
279         beq     End
280 Loop:
281         stab    1,x+
282         dbne    y,Loop
283 End:
284         puld
285         rts
286 #else
287         xgdx
288         tsy
289         ldab    val,y
290         ldy     size,y          ; DST = X, CNT = Y
291         beq     End
292         pshx
293 L0:
294         stab    0,x             ; Fill up to 256 bytes
295         inx
296         dey
297         bne     L0
298         pulx                    ; Restore X to return the DST
299 End:
300         xgdx
301         rts
302 #endif
303 #endif
304                 
305 #ifdef L_adddi3
306         .sect .text
307         .globl ___adddi3
308
309 ___adddi3:
310         tsx
311         pshb
312         psha
313         ldd     8,x
314         addd    16,x
315         pshb
316         psha
317
318         ldd     6,x
319         adcb    15,x
320         adca    14,x
321         pshb
322         psha
323
324         ldd     4,x
325         adcb    13,x
326         adca    12,x
327         pshb
328         psha
329         
330         ldd     2,x
331         adcb    11,x
332         adca    10,x
333         tsx
334         ldy     6,x
335
336         std     0,y
337         pulx
338         stx     2,y
339         pulx
340         stx     4,y
341         pulx
342         stx     6,y
343         pulx
344         rts
345 #endif
346
347 #ifdef L_subdi3
348         .sect .text
349         .globl ___subdi3
350
351 ___subdi3:
352         tsx
353         pshb
354         psha
355         ldd     8,x
356         subd    16,x
357         pshb
358         psha
359
360         ldd     6,x
361         sbcb    15,x
362         sbca    14,x
363         pshb
364         psha
365
366         ldd     4,x
367         sbcb    13,x
368         sbca    12,x
369         pshb
370         psha
371         
372         ldd     2,x
373         sbcb    11,x
374         sbca    10,x
375         
376         tsx
377         ldy     6,x
378
379         std     0,y
380         pulx
381         stx     2,y
382         pulx
383         stx     4,y
384         pulx
385         stx     6,y
386         pulx
387         rts
388 #endif
389         
390 #ifdef L_notdi2
391         .sect .text
392         .globl ___notdi2
393
394 ___notdi2:
395         tsy
396         xgdx
397         ldd     8,y
398         coma
399         comb
400         std     6,x
401         
402         ldd     6,y
403         coma
404         comb
405         std     4,x
406
407         ldd     4,y
408         coma
409         comb
410         std     2,x
411
412         ldd     2,y
413         coma
414         comb
415         std     0,x
416         rts
417 #endif
418         
419 #ifdef L_negsi2
420         .sect .text
421         .globl ___negsi2
422
423 ___negsi2:
424         comb
425         coma
426         addd    #1
427         xgdx
428         eorb    #0xFF
429         eora    #0xFF
430         adcb    #0
431         adca    #0
432         xgdx
433         rts
434 #endif
435
436 #ifdef L_one_cmplsi2
437         .sect .text
438         .globl ___one_cmplsi2
439
440 ___one_cmplsi2:
441         comb
442         coma
443         xgdx
444         comb
445         coma
446         xgdx
447         rts
448 #endif
449         
450 #ifdef L_ashlsi3
451         .sect .text
452         .globl ___ashlsi3
453
454 ___ashlsi3:
455         xgdy
456         clra
457         andb    #0x1f
458         xgdy
459         beq     Return
460 Loop:
461         lsld
462         xgdx
463         rolb
464         rola
465         xgdx
466         dey
467         bne     Loop
468 Return:
469         rts
470 #endif
471
472 #ifdef L_ashrsi3
473         .sect .text
474         .globl ___ashrsi3
475
476 ___ashrsi3:
477         xgdy
478         clra
479         andb    #0x1f
480         xgdy
481         beq     Return
482 Loop:
483         xgdx
484         asra
485         rorb
486         xgdx
487         rora
488         rorb
489         dey
490         bne     Loop
491 Return:
492         rts
493 #endif
494
495 #ifdef L_lshrsi3
496         .sect .text
497         .globl ___lshrsi3
498
499 ___lshrsi3:
500         xgdy
501         clra
502         andb    #0x1f
503         xgdy
504         beq     Return
505 Loop:
506         xgdx
507         lsrd
508         xgdx
509         rora
510         rorb
511         dey
512         bne     Loop
513 Return:
514         rts
515 #endif
516
517 #ifdef L_lshrhi3
518         .sect .text
519         .globl ___lshrhi3
520
521 ___lshrhi3:
522         cpx     #16
523         bge     Return_zero
524         cpx     #0
525         beq     Return
526 Loop:
527         lsrd
528         dex
529         bne     Loop
530 Return:
531         rts
532 Return_zero:
533         clra
534         clrb
535         rts
536 #endif
537         
538 #ifdef L_lshlhi3
539         .sect .text
540         .globl ___lshlhi3
541
542 ___lshlhi3:
543         cpx     #16
544         bge     Return_zero
545         cpx     #0
546         beq     Return
547 Loop:
548         lsld
549         dex
550         bne     Loop
551 Return:
552         rts
553 Return_zero:
554         clra
555         clrb
556         rts
557 #endif
558
559 #ifdef L_ashrhi3
560         .sect .text
561         .globl ___ashrhi3
562
563 ___ashrhi3:
564         cpx     #16
565         bge     Return_minus_1_or_zero
566         cpx     #0
567         beq     Return
568 Loop:
569         asra
570         rorb
571         dex
572         bne     Loop
573 Return:
574         rts
575 Return_minus_1_or_zero:
576         clrb
577         tsta
578         bpl     Return_zero
579         comb
580 Return_zero:
581         tba
582         rts
583 #endif
584         
585 #ifdef L_ashrqi3
586         .sect .text
587         .globl ___ashrqi3
588
589 ___ashrqi3:
590         cmpa    #8
591         bge     Return_minus_1_or_zero
592         tsta
593         beq     Return
594 Loop:
595         asrb
596         deca
597         bne     Loop
598 Return:
599         rts
600 Return_minus_1_or_zero:
601         clrb
602         tstb
603         bpl     Return_zero
604         coma
605 Return_zero:
606         tab
607         rts
608 #endif
609
610 #ifdef L_lshlqi3
611         .sect .text
612         .globl ___lshlqi3
613
614 ___lshlqi3:
615         cmpa    #8
616         bge     Return_zero
617         tsta
618         beq     Return
619 Loop:
620         lslb
621         deca
622         bne     Loop
623 Return:
624         rts
625 Return_zero:
626         clrb
627         rts
628 #endif
629
630 #ifdef L_divmodhi4
631 #ifndef mc68hc12
632 /* 68HC12 signed divisions are generated inline (idivs).  */
633
634         .sect .text
635         .globl __divmodhi4
636
637 ;
638 ;; D = numerator
639 ;; X = denominator
640 ;;
641 ;; Result:      D = D / X
642 ;;              X = D % X
643 ;; 
644 __divmodhi4:
645         tsta
646         bpl     Numerator_pos
647         comb                    ; D = -D <=> D = (~D) + 1
648         coma
649         xgdx
650         inx
651         tsta
652         bpl     Numerator_neg_denominator_pos
653 Numerator_neg_denominator_neg:
654         comb                    ; X = -X
655         coma
656         addd    #1
657         xgdx
658         idiv
659         coma
660         comb
661         xgdx                    ; Remainder <= 0 and result >= 0
662         inx
663         rts
664
665 Numerator_pos_denominator_pos:
666         xgdx
667         idiv
668         xgdx                    ; Both values are >= 0
669         rts
670         
671 Numerator_pos:
672         xgdx
673         tsta
674         bpl     Numerator_pos_denominator_pos
675 Numerator_pos_denominator_neg:
676         coma                    ; X = -X
677         comb
678         xgdx
679         inx
680         idiv
681         xgdx                    ; Remainder >= 0 but result <= 0
682         coma
683         comb
684         addd    #1
685         rts
686         
687 Numerator_neg_denominator_pos:
688         xgdx
689         idiv
690         coma                    ; One value is > 0 and the other < 0
691         comb                    ; Change the sign of result and remainder
692         xgdx
693         inx
694         coma
695         comb
696         addd    #1
697         rts
698 #endif /* !mc68hc12 */
699 #endif
700
701 #ifdef L_mulqi3
702        .sect .text
703        .globl __mulqi3
704
705 ;
706 ; short __mulqi3(signed char a, signed char b);
707 ;
708 ;       signed char a   -> register A
709 ;       signed char b   -> register B
710 ;
711 ; returns the signed result of A * B in register D.
712 ;
713 __mulqi3:
714         tsta
715         bmi     A_neg
716         tstb
717         bmi     B_neg
718         mul
719         rts
720 B_neg:
721         negb
722         bra     A_or_B_neg
723 A_neg:
724         nega
725         tstb
726         bmi     AB_neg
727 A_or_B_neg:
728         mul
729         coma
730         comb
731         addd    #1
732         rts
733 AB_neg:
734         negb
735         mul
736         rts
737 #endif
738         
739 #ifdef L_mulhi3
740         .sect .text
741         .globl ___mulhi3
742
743 ;
744 ;
745 ;  unsigned short ___mulhi3(unsigned short a, unsigned short b)
746 ;
747 ;       a = register D
748 ;       b = register X
749 ;
750 ___mulhi3:
751 #ifdef mc68hc12
752         pshx                    ; Preserve X
753         exg     x,y
754         emul
755         exg     x,y
756         pulx
757 #else
758         stx     *_.tmp
759         pshb
760         ldab    *_.tmp+1
761         mul                     ; A.high * B.low
762         ldaa    *_.tmp
763         stab    *_.tmp
764         pulb
765         pshb
766         mul                     ; A.low * B.high
767         addb    *_.tmp
768         stab    *_.tmp
769         ldaa    *_.tmp+1
770         pulb
771         mul                     ; A.low * B.low
772         adda    *_.tmp
773 #endif
774         rts
775 #endif
776
777 #ifdef L_mulhi32
778         .sect .text
779         .globl __mulhi32
780
781 ;
782 ;
783 ;  unsigned long __mulhi32(unsigned short a, unsigned short b)
784 ;
785 ;       a = register D
786 ;       b = value on stack
787 ;
788 ;       +---------------+
789 ;       |  B low        | <- 5,x
790 ;       +---------------+
791 ;       |  B high       | <- 4,x
792 ;       +---------------+
793 ;       |  PC low       |  
794 ;       +---------------+
795 ;       |  PC high      |  
796 ;       +---------------+
797 ;       |  A low        |
798 ;       +---------------+
799 ;       |  A high       |
800 ;       +---------------+  <- 0,x
801 ;
802 ;
803 ;      <B-low>    5,x
804 ;      <B-high>   4,x
805 ;      <ret>      2,x
806 ;      <A-low>    1,x
807 ;      <A-high>   0,x
808 ;
809 __mulhi32:
810 #ifdef mc68hc12
811         ldy     2,sp
812         emul
813         exg     x,y
814 #else
815         pshb
816         psha
817         tsx
818         ldab    4,x
819         mul
820         xgdy                    ; A.high * B.high
821         ldab    5,x
822         pula
823         mul                     ; A.high * B.low
824         std     *_.tmp
825         ldaa    1,x
826         ldab    4,x
827         mul                     ; A.low * B.high
828         addd    *_.tmp
829         stab    *_.tmp
830         tab
831         aby
832         bcc     N
833         ldab    #0xff
834         aby
835         iny
836 N:
837         ldab    5,x
838         pula
839         mul                     ; A.low * B.low
840         adda    *_.tmp
841         bcc     Ret
842         iny
843 Ret:
844         pshy
845         pulx
846 #endif
847         rts
848         
849 #endif
850
851 #ifdef L_mulsi3
852         .sect .text
853         .globl __mulsi3
854
855 ;
856 ;      <B-low>    8,y
857 ;      <B-high>   6,y
858 ;      <ret>      4,y
859 ;       <tmp>     2,y
860 ;      <A-low>    0,y
861 ;
862 ; D,X   -> A
863 ; Stack -> B
864 ;
865 ; The result is:
866 ;
867 ;       (((A.low * B.high) + (A.high * B.low)) << 16) + (A.low * B.low)
868 ;
869 ;
870 ;
871
872 __mulsi3:
873 #ifdef mc68hc12
874         pshd                            ; Save A.low
875         ldy     4,sp
876         emul                            ; A.low * B.high
877         ldy     6,sp
878         exg     x,d
879         emul                            ; A.high * B.low
880         leax    d,x
881         ldy     6,sp
882         puld
883         emul                            ; A.low * B.low
884         exg     d,y
885         leax    d,x
886         exg     d,y
887         rts
888 #else
889 B_low   =       8
890 B_high  =       6
891 A_low   =       0
892 A_high  =       2
893         pshx
894         pshb
895         psha
896         tsy
897 ;
898 ; If B.low is 0, optimize into: (A.low * B.high) << 16
899 ;
900         ldd     B_low,y
901         beq     B_low_zero
902 ;
903 ; If A.high is 0, optimize into: (A.low * B.high) << 16 + (A.low * B.low)
904 ;
905         stx     *_.tmp
906         beq     A_high_zero
907         bsr     ___mulhi3               ; A.high * B.low
908 ;
909 ; If A.low is 0, optimize into: (A.high * B.low) << 16
910 ;
911         ldx     A_low,y
912         beq     A_low_zero              ; X = 0, D = A.high * B.low
913         std     2,y
914 ;
915 ; If B.high is 0, we can avoid the (A.low * B.high) << 16 term.
916 ;
917         ldd     B_high,y
918         beq     B_high_zero
919         bsr     ___mulhi3               ; A.low * B.high
920         addd    2,y
921         std     2,y
922 ;
923 ; Here, we know that A.low and B.low are not 0.
924 ;
925 B_high_zero:
926         ldd     B_low,y                 ; A.low is on the stack
927         bsr     __mulhi32               ; A.low * B.low
928         xgdx
929         tsy                             ; Y was clobbered, get it back
930         addd    2,y
931 A_low_zero:                             ; See A_low_zero_non_optimized below
932         xgdx
933 Return:
934         ins
935         ins
936         ins
937         ins
938         rts
939 ;
940
941 ; A_low_zero_non_optimized:
942 ;
943 ; At this step, X = 0 and D = (A.high * B.low)
944 ; Optimize into: (A.high * B.low) << 16
945 ;
946 ;       xgdx
947 ;       clra                    ; Since X was 0, clearing D is superfuous.
948 ;       clrb
949 ;       bra     Return
950 ; ----------------
951 ; B.low == 0, the result is:    (A.low * B.high) << 16
952 ;
953 ; At this step:
954 ;   D = B.low                           = 0 
955 ;   X = A.high                          ?
956 ;       A.low is at A_low,y             ?
957 ;       B.low is at B_low,y             ?
958 ;
959 B_low_zero:
960         ldd     A_low,y
961         beq     Zero1
962         ldx     B_high,y
963         beq     Zero2
964         bsr     ___mulhi3
965 Zero1:
966         xgdx
967 Zero2:
968         clra
969         clrb
970         bra     Return
971 ; ----------------
972 ; A.high is 0, optimize into: (A.low * B.high) << 16 + (A.low * B.low)
973 ;
974 ; At this step:
975 ;   D = B.low                           != 0 
976 ;   X = A.high                          = 0
977 ;       A.low is at A_low,y             ?
978 ;       B.low is at B_low,y             ?
979 ;
980 A_high_zero:
981         ldd     A_low,y         ; A.low
982         beq     Zero1
983         ldx     B_high,y        ; B.high
984         beq     A_low_B_low
985         bsr     ___mulhi3
986         std     2,y
987         bra     B_high_zero     ; Do the (A.low * B.low) and the add.
988
989 ; ----------------
990 ; A.high and B.high are 0 optimize into: (A.low * B.low)
991 ;
992 ; At this step:
993 ;   D = B.high                          = 0 
994 ;   X = A.low                           != 0
995 ;       A.low is at A_low,y             != 0
996 ;       B.high is at B_high,y           = 0
997 ;
998 A_low_B_low:
999         ldd     B_low,y                 ; A.low is on the stack
1000         bsr     __mulhi32
1001         bra     Return
1002 #endif
1003 #endif
1004
1005 #ifdef L_map_data
1006
1007         .sect   .install3,"ax",@progbits
1008         .globl  __map_data_section
1009
1010 __map_data_section:
1011         ldd     #__data_section_size
1012         beq     Done
1013         ldx     #__data_image
1014         ldy     #__data_section_start
1015 Loop:
1016 #ifdef mc68hc12
1017         movb    1,x+,1,y+
1018         dbne    d,Loop
1019 #else
1020         psha
1021         ldaa    0,x
1022         staa    0,y
1023         pula
1024         inx
1025         iny
1026         subd    #1
1027         bne     Loop
1028 #endif
1029 Done:
1030
1031 #endif
1032
1033 #ifdef L_init_bss
1034
1035         .sect   .install3,"ax",@progbits
1036         .globl  __init_bss_section
1037
1038 __init_bss_section:
1039         ldd     #__bss_size
1040         beq     Done
1041         ldx     #__bss_start
1042 Loop:
1043 #ifdef mc68hc12
1044         clr     1,x+
1045         dbne    d,Loop
1046 #else
1047         clr     0,x
1048         inx
1049         subd    #1
1050         bne     Loop
1051 #endif
1052 Done:
1053
1054 #endif
1055         
1056 ;-----------------------------------------
1057 ; end required gcclib code
1058 ;-----------------------------------------