; Startup code for the GNU regular expression library. ; Edwin Hoogerbeets 18/07/89 ; ; This file may be copied and distributed under the GNU Public ; Licence. See the comment at the top of regex.c for details. ; ; Adapted from Elib by Jim Mackraz, mklib by Edwin Hoogerbeets, and the ; GNU regular expression package by the Free Software Foundation. ; Copyright (C) 1986 by Manx Software Systems, Inc. ; *** But FUNKIFIED by jimm *** ; library base in D0 ; segment list in A0 ; execbase in A6 ; Initial startup routine for Aztec C. ; NOTE: code down to "start" must be placed at beginning of ; all programs linked with Aztec Linker using small ; code or small data. a4save dc.l 0 public .begin ; just to resolve label .begin public _funkyInit _funkyInit: near code movem.l d0/d2/d3/d4-d7/a2-a6,-(sp) ; FUNKY use a0, not a1 for segment list move.l a0,a4 ;BPTR to code seg add.l a4,a4 add.l a4,a4 ;now real address of code seg move.l (a4),a4 ;indirect to get data segment BPTR add.l a4,a4 ;convert to real pointer add.l a4,a4 ;real address of data seg link field ; same as crt0.a68 add.l #32766+4,a4 ;bias appropriately (+4 is for link) lea __H1_end,a1 lea __H2_org,a2 cmp.l a1,a2 ;check if BSS and DATA together bne start ;no, don't have to clear move.w #((__H2_end-__H2_org)/4)-1,d1 bmi start ;skip if no bss move.l #0,d2 loop move.l d2,(a1)+ ;clear out memory dbra d1,loop start lea a4save,a1 ;get address of a4save move.l a4,(a1) ;save a4 ; FUNKY ; move.l sp,__savsp ;save stack pointer (can't fexec) ; move.l 4,a6 ;get Exec's library base pointer move.l a6,_SysBase ;put where we can get it movem.l d0/a0,-(sp) ; pass base and seglist jsr _funkymain ; FUNKY addq.l #8,sp ;pop args to funkymain() ; can pop better (?) movem.l (sp)+,d0/d2/d3/d4-d7/a2-a6 rts ;and return public _geta4 _geta4: move.l a4save,a4 rts dseg _SysBase dc.l 0 public _funkymain public _SysBase public __H1_end,__H2_org,__H2_end end