home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / util / reqtools-2.2b.lha / ReqTools-2.2b / Glue / GCC / gcc_glue.lha / blib / c.s next >
Encoding:
Text File  |  1994-04-19  |  1.7 KB  |  107 lines

  1.  
  2. | stripped baserelative startup code for gcc v2.3.3
  3. | (c) by Gunther Nikl Die Jan 11 17:45 1994
  4. | No real bugs known
  5.  
  6. | some specific defines
  7.  
  8. _LVOForbid    =    -132
  9. _LVOGetMsg    =    -372
  10. _LVOReplyMsg    =    -378
  11. _LVOWaitPort    =    -384
  12. _LVOCloseLibrary =    -414
  13. _LVOOpenLibrary    =    -552
  14.  
  15. _LVOCurrentDir    =    -126
  16.  
  17. | public symbols
  18.  
  19.         .globl    __exit
  20.         .globl    _geta4
  21.  
  22.         .text
  23.  
  24. | first entry - init some vars, check for cli or wb start
  25.  
  26. start:        moveml    d2-d7/a2-a6,sp@-
  27.  
  28.         jbsrs    _geta4
  29.  
  30.         movel    sp,a4@(_SaveSP:W)
  31.         movel    4:W,a6
  32.         movel    a6,a4@(_SysBase:W)
  33.  
  34.         movel    a6@(276),a3
  35.         tstl    a3@(172)
  36.         bnes    fromCLI
  37.  
  38. | wb start - get wbmsg, open dos, change dir
  39.  
  40. fromWB:        lea    a3@(92),a0
  41.         jsr    a6@(_LVOWaitPort)
  42.         lea    a3@(92),a0
  43.         jsr    a6@(_LVOGetMsg)
  44.         movel    d0,a4@(_WbMsg:W)
  45.  
  46. | cli start - open dos
  47.  
  48. fromCLI:    jbsrs    OpenDOS
  49.         beqs    cleanup
  50.         movel    a4@(_WbMsg:W),d1
  51.         beqs    isCLI
  52.         movel    d1,a1
  53.         movel    a1@(36),a1
  54.         movel    a1@,d1
  55.         jsr    a6@(_LVOCurrentDir)
  56. isCLI:        jbsr    __main
  57.         jras    cleanup
  58.  
  59. | exit() entry - get return val, restore stackptr
  60.  
  61. __exit:        movel    sp@(4:W),d0
  62.         movel    a4@(_SaveSP:W),sp
  63.  
  64. | cleanup - close dos, reply wbmsg
  65.  
  66. cleanup:    movel    d0,d7
  67.         movel    a4@(_SysBase:W),a6
  68.         movel    a4@(_DOSBase:W),d0
  69.         beqs    nodos
  70.         movel    d0,a1
  71.         jsr    a6@(_LVOCloseLibrary)
  72. nodos:        movel    a4@(_WbMsg:W),d2
  73.         beqs    todos
  74.         jsr    a6@(_LVOForbid)
  75.         movel    d2,a1
  76.         jsr    a6@(_LVOReplyMsg)
  77. todos:        movel    d7,d0
  78.         moveml    sp@+,d2-d7/a2-a6
  79.         rts
  80.  
  81. | get baseptr
  82.  
  83. _geta4:        lea    ___a4_init,a4
  84.         rts
  85.  
  86. | open dos v33+
  87.  
  88. OpenDOS:    lea    pc@(DosName+2),a1
  89.         movql    #33,d0
  90.         jsr    a6@(_LVOOpenLibrary)
  91.         movel    d0,a6
  92.         movel    a6,a4@(_DOSBase:W)
  93.         rts
  94.  
  95. DosName:    .asciz    "dos.library"
  96.  
  97.         .even
  98.  
  99. | data area
  100.  
  101.         .data
  102.  
  103. .comm        _SysBase,4
  104. .comm        _DOSBase,4
  105. .comm        _SaveSP,4
  106. .comm        _WbMsg,4
  107.