home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff353.lzh / AztecArp / crt0.asm < prev    next >
Assembly Source File  |  1990-06-02  |  2KB  |  98 lines

  1. ; Initial startup routine for Aztec 'C' and ARP
  2. ; NB: This should allow access to all Aztec Features, math, etc.
  3. ;     Could be made smaller if only for CLI, only for Workbench,
  4. ;     Could be made smaller if only this or that.
  5. ;
  6. ; Created 11/08/87 by -+=SDB+=- from crt0.a68 file provided by Manx
  7. ; Copyright (c) 1987 by Scott Ballantyne, may be freely
  8. ; used by Arp Supporters/users
  9. ;
  10. ; 10-Mar-90:    Some minor rework for Aztec 5.0 release.
  11. ;        This should rather use rstart.asm code.
  12. ;
  13. ;    INCLUDE "asmsupp.i"
  14.     INCLUDE "exec/types.i"
  15. ;    INCLUDE "exec/exec_lib.i"
  16.     INCLUDE "exec/alerts.i"
  17.     INCLUDE "libraries/arpbase.i"
  18.  
  19.     XREF    _LVOOpenLibrary
  20.     XREF    _LVOAlert
  21.  
  22.     mc68881
  23.     entry    .begin
  24.     public    .begin
  25. .begin
  26.     bsr    _geta4            ;get A4
  27.     lea    __H1_end,a1
  28.     lea    __H2_org,a2
  29.     cmp.l    a1,a2            ;check if BSS and DATA together
  30.     bne    start            ;no, don't have to clear
  31.     move.w    #((__H2_end-__H2_org)/4)-1,d1
  32.     bmi    start            ;skip if no bss
  33.     move.l    #0,d2
  34. loop
  35.     move.l    d2,(a1)+                ;clear out memory
  36.     dbra    d1,loop
  37.  
  38. start
  39.     move.l    sp,__savsp        ;save stack pointer
  40.     move.l    4,a6            ;get Exec's library base pointer
  41.     move.l    a6,_SysBase        ;put where we can get it
  42.     movem.l d0/a0,-(sp)             ;save CLI command parameters
  43.  
  44.     btst.b    #4,$129(a6)             ;check for 68881 flag in AttnFlags
  45.     beq    1$            ;skip if not
  46.     lea    2$,a5
  47.     jsr    -30(a6)                 ;do it in supervisor mode
  48.     bra    1$
  49. 2$
  50.     clr.l    -(sp)
  51.     frestore (sp)+                  ;reset the ffp stuff
  52.     rte                ;and return
  53. 1$
  54.  
  55.     if 0
  56.  
  57.     lea    ARPNAME,a1        ;get name of arp_library
  58.     moveq.l #ArpVersion,d0
  59.     SYSCALL OpenLibrary
  60.     move.l    d0,_ArpBase        ; set up pointer
  61. ;    move.l  d0,_DOSBase        ; also as Dos pointer
  62.     bne    3$            ; skip if okay
  63.     add.w    #8,sp
  64.     GURU    AG_OpenLib!AO_ArpLib,0,0
  65. 3$
  66.     move.l    d0,a0
  67.     move.l    DosBase(a0),_DOSBase    ; Give free dos.library
  68.     move.l    GfxBase(a0),_GfxBase    ; Give free graphics.library
  69.     move.l    IntuiBase(a0),_IntuitionBase ; and free intuition.library
  70.  
  71.     endc
  72.  
  73.     jsr    __main            ;call the startup stuff
  74. 4$
  75.     add.w    #8,sp            ;pop args
  76.     rts                ;and return
  77.  
  78. ; ARPNAME:      ArpName
  79.  
  80.     public    _geta4
  81. _geta4:
  82.     far    data
  83.     lea    __H1_org+32766,a4
  84.     rts
  85.  
  86.     public    __main,__H0_org
  87.  
  88.     dseg
  89.  
  90.     public    _SysBase,__savsp,___sloppy__  ; ,_DOSBase
  91.     public    __H1_org,__H1_end,__H2_org,__H2_end
  92.  
  93. ;    public  _ArpBase
  94. ;    public  _IntuitionBase,_GfxBase
  95.  
  96. ___sloppy__:
  97.     dc.l    0
  98.