home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 278.lha / RegexLibrary_v1.0 / startup.asm < prev    next >
Assembly Source File  |  1989-08-06  |  3KB  |  85 lines

  1. ;  Startup code for the GNU regular expression library.
  2. ;  Edwin Hoogerbeets 18/07/89
  3. ;
  4. ;  This file may be copied and distributed under the GNU Public
  5. ;  Licence. See the comment at the top of regex.c for details.
  6. ;
  7. ;  Adapted from Elib by Jim Mackraz, mklib by Edwin Hoogerbeets, and the
  8. ;  GNU regular expression package by the Free Software Foundation.
  9.  
  10. ; Copyright (C) 1986 by Manx Software Systems, Inc.
  11. ; ***   But FUNKIFIED by jimm ***
  12. ;       library base in D0
  13. ;       segment list in A0
  14. ;       execbase in A6
  15. ;       Initial startup routine for Aztec C.
  16. ;       NOTE: code down to "start" must be placed at beginning of
  17. ;               all programs linked with Aztec Linker using small
  18. ;               code or small data.
  19.  
  20.  
  21. a4save  dc.l    0
  22.  
  23.         public  .begin                  ; just to resolve label
  24. .begin
  25.         public  _funkyInit
  26. _funkyInit:
  27.  
  28.         near    code
  29.  
  30.         movem.l d0/d2/d3/d4-d7/a2-a6,-(sp)
  31.  
  32.         ; FUNKY use a0, not a1 for segment list
  33.         move.l  a0,a4                   ;BPTR to code seg
  34.         add.l   a4,a4
  35.         add.l   a4,a4                   ;now real address of code seg
  36.  
  37.         move.l  (a4),a4                 ;indirect to get data segment BPTR
  38.         add.l   a4,a4                   ;convert to real pointer
  39.         add.l   a4,a4                   ;real address of data seg link field
  40.  
  41.         ; same as crt0.a68
  42.         add.l   #32766+4,a4             ;bias appropriately (+4 is for link)
  43.         lea     __H1_end,a1
  44.         lea     __H2_org,a2
  45.         cmp.l   a1,a2                   ;check if BSS and DATA together
  46.         bne     start                   ;no, don't have to clear
  47.         move.w  #((__H2_end-__H2_org)/4)-1,d1
  48.         bmi     start                   ;skip if no bss
  49.         move.l  #0,d2
  50. loop
  51.         move.l  d2,(a1)+                ;clear out memory
  52.         dbra    d1,loop
  53.  
  54. start
  55.         lea     a4save,a1               ;get address of a4save
  56.         move.l  a4,(a1)                 ;save a4
  57. ;       FUNKY
  58. ;       move.l  sp,__savsp              ;save stack pointer (can't fexec)
  59. ;       move.l  4,a6                    ;get Exec's library base pointer
  60.         move.l  a6,_SysBase             ;put where we can get it
  61.  
  62.         movem.l d0/a0,-(sp)             ; pass base and seglist
  63.         jsr     _funkymain              ; FUNKY
  64.         addq.l  #8,sp                   ;pop args to  funkymain()
  65.                                         ; can pop better (?)
  66.  
  67.         movem.l (sp)+,d0/d2/d3/d4-d7/a2-a6
  68.         rts                             ;and return
  69.  
  70.         public  _geta4
  71. _geta4:
  72.         move.l  a4save,a4
  73.         rts
  74.  
  75.         dseg
  76.  
  77.  
  78. _SysBase        dc.l    0
  79.  
  80.         public  _funkymain
  81.         public  _SysBase
  82.         public  __H1_end,__H2_org,__H2_end
  83.  
  84.         end
  85.