home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 3 / CD_Magazyn_EXEC_nr_3.iso / Recent / game / wb / Klotz.lha / Klotz / src / EntryExit.asm < prev    next >
Assembly Source File  |  1998-02-18  |  1KB  |  74 lines

  1. *
  2. *    $VER: EntryExit.asm 1.1 (4.10.94) mymacros2.2
  3. *                1.0 (17.7.93)
  4. *                MedRes Team
  5. StartUp
  6.     move.l  ExecBase,a6
  7.     cmpi.w  #37,LIB_VERSION(a6)     Man sollte mind. WB 2.0 haben
  8.     blt.s    .NOVersion
  9. * globale Daten in allokierten Puffer
  10.     move.l  #LOCLEN,d0
  11.     move.l  #MEMF_PUBLIC!MEMF_CLEAR,d1
  12.     CALL    AllocVec
  13.     tst.l   d0
  14.     bne     .AllocOK
  15. .NOVersion
  16.     moveq   #20,d0
  17.     rts
  18. .AllocOK
  19.     move.l  d0,a4
  20.     reloc.l a6,SysBase
  21.     clra.l  a1
  22.     CALL    FindTask
  23.     move.l  d0,a3
  24.     reloc.l a3,OwnTask
  25.     move.l  a4,TC_Userdata(a3)   TaskUserData zeigt auf globale Daten
  26.     move.l  pr_CLI(a3),d0
  27.     bne     .notFromWB
  28.  
  29. .fromWB
  30.     lea     pr_MsgPort(a3),a0
  31.     CALL    WaitPort
  32.     lea     pr_MsgPort(a3),a0
  33.     CALL    GetMsg
  34.     reloc.l d0,WBenchMsg
  35. .notFromWB
  36.     bsr     main
  37.     moveq   #RETURN_OK,d0
  38. exit
  39.     bsr.s   getA4
  40.     move.l  d0,d2
  41.     copy.l  OwnTask,a3
  42.     move.l  pr_ReturnAddr(a3),a5
  43.     subq.l  #4,a5
  44.     move.l  a5,sp
  45.  
  46.     copy.l  SysBase,a6
  47.  
  48.     copy.l  WBenchMsg,d0
  49.     beq     .noWBExit
  50.  
  51.     CALL    Forbid
  52.     move.l  d0,a1
  53.     CALL    ReplyMsg
  54. .noWBExit
  55.     move.l  a4,a1
  56.     CALL    FreeVec        Aua - das hat gefehlt !
  57.     move.l  d2,d0
  58.     rts
  59. getA4
  60. * <= a4 : Globale Datenstruktur
  61.     push    a0-a1/a6/d0-d1
  62.     move.l  ExecBase,a6
  63.     clra.l  a1
  64.     CALL    FindTask
  65.     move.l  d0,a0
  66.     move.l  TC_Userdata(a0),a4
  67.     pop     a0-a1/a6/d0-d1
  68.     rts
  69. * Daten
  70.     loc.l   SysBase
  71.     loc.l   OwnTask
  72.     loc.l   WBenchMsg
  73.  
  74.