home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff236.lzh / XprZmodem / funky.asm < prev    next >
Assembly Source File  |  1989-08-09  |  2KB  |  89 lines

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