home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Dev / asm / DemoStartUP.lha / DemoStartUPv1.0 / sources / softirq.asm < prev    next >
Encoding:
Assembly Source File  |  2001-05-02  |  2.7 KB  |  183 lines

  1. ; - [ SoftIRQ ] -
  2.  
  3. ;///XDEF
  4.     xdef    _SoftIRQ
  5.     xdef    _StartSoftInt
  6.     xdef    _StopSoftInt
  7.     xdef    _si_micro
  8.     xdef    _si_secs
  9.     xdef    _si_func
  10. ;///
  11. ;///XREF
  12.     xref    _DosBase
  13.     xref    _IntuitionBase
  14.     xref    _GfxBase
  15.     xref    _CyberGfxBase
  16.  
  17.     xref    _screen
  18.     xref    _thisTasksigf
  19.     xref    _thisTask
  20.  
  21.     xref    _P61_Master
  22.     xref    _nfsc
  23. ;///
  24. ;///Includes
  25.         include    "basemacros.i"
  26.  
  27.     incdir    include:
  28.  
  29.     include    devices/timer.i
  30.  
  31.     include exec/interrupts.i
  32.     include    exec/lists.i
  33.     include    exec/execbase.i
  34.     include exec/types.i
  35.     include    exec/exec.i
  36.     include exec/libraries.i
  37.     include exec/io.i
  38.     include exec/memory.i
  39.     include exec/ports.i
  40.  
  41.     include utility/tagitem.i
  42.  
  43.     include    intuition/intuition.i
  44.  
  45.     include dos/dostags.i
  46.  
  47.     include    hardware/blit.i
  48.     include    hardware/custom.i
  49.         include hardware/dmabits.i
  50.     include    hardware/intbits.i
  51.     include hardware/rawkeys.i
  52.  
  53.     include    LVO/graphics_lib.i
  54.     include    LVO/dos_lib.i
  55.     include LVO/exec_lib.i
  56.     include    LVO/intuition_lib.i
  57.     include    LVO/cybergraphics_lib.i
  58.     include    LVO/asl_lib.i
  59.  
  60.     include    libraries/asl.i
  61.         include    libraries/dosextens.i
  62.  
  63.     include cybergraphx/cybergraphics.i
  64.  
  65.     include    graphics/view.i
  66. ;///
  67.  
  68. _SoftIRQ
  69.     movem.l    d0-a6,-(sp)
  70.  
  71.         tst.b    _nfsc
  72.         bne.s    .out
  73.     
  74.         move.l    _IntuitionBase,a0
  75.     move.l  ib_FirstScreen(a0),a0
  76.     move.l    _screen,a1
  77.     cmp.l    a0,a1
  78.     bne.s    .no
  79.  
  80.     move.l    _thisTask,a1
  81.     move.l    _thisTasksigf,d0
  82.     callExe    Signal
  83.  
  84.     move.w    #64,_P61_Master
  85.         bra.s    .out
  86. .no
  87.     move.w    #16,_P61_Master
  88.  
  89.  
  90. .out
  91.     movem.l    (sp)+,d0-a6
  92.     rts
  93.  
  94.  
  95.  
  96. _si_micro
  97. si_micro    dc.l    0
  98. _si_secs
  99. si_secs        dc.l    1
  100. _si_func
  101. si_func        dc.l    0
  102.  
  103. _StartSoftInt:
  104.  
  105.     movem.l    d0-a6,-(sp)
  106.     move.l    4.w,a6
  107.     lea    _mp(pc),a0
  108.     move.b    #PA_SOFTINT,MP_FLAGS(a0)
  109.     lea    _si(pc),a2
  110.     move.l    a2,MP_SOFTINT(a0)
  111.     lea    MP_MSGLIST(a0),a1
  112.     NEWLIST    a1
  113.  
  114.     lea    _softint_code_l1(pc),a1
  115.     move.l  a1,IS_CODE(a2)
  116.  
  117.     lea    _tr(pc),a1
  118.     move.l    a0,MN_REPLYPORT(a1)
  119.  
  120.     lea    TimerName(pc),a0
  121.     move.l    #UNIT_MICROHZ,d0    ;#UNIT_VBLANK,d0
  122.     moveq    #0,d1
  123.     call    OpenDevice
  124.     tst.l    d0
  125.     bne.s    .notimer
  126.     move.w    #1,_enabled
  127.     bsr    _softint_code_l1 ;start...
  128.  
  129. .notimer
  130.     movem.l    (sp)+,d0-a6
  131.     rts
  132.  
  133. _StopSoftInt
  134.     movem.l    d0-a6,-(sp)
  135.     move.w    #0,_enabled
  136.     move.l    $4.w,a6
  137.     tst.w    _active
  138.     beq.s    .la1
  139.     lea    _tr(pc),a1
  140.     call    AbortIO
  141. ;.laa
  142. ;     tst.w     _active
  143. ;     bne.s     .laa ; !!!
  144. .la1
  145.     lea    _tr(pc),a1
  146.     call    CloseDevice
  147.     movem.l    (sp)+,d0-a6
  148.     rts
  149.  
  150. _softint_code_l1:
  151.     move.w    #0,_active
  152.     tst.w    _enabled
  153.     beq.s    .noten
  154.     movem.l    d0-a6,-(sp)
  155.     move.l    si_func(pc),d0
  156.     beq.s    .na
  157.     move.l    d0,a0
  158.     jsr    (a0)
  159. .na
  160.     lea    _tr(pc),a0
  161.     move.w  #TR_ADDREQUEST,IO_COMMAND(a0)
  162.     lea    IOTV_TIME(a0),a0
  163.     move.l    si_micro,TV_MICRO(a0)
  164.     move.l    si_secs,TV_SECS(a0)
  165.     move.l    4.w,a6
  166.     lea    _tr(pc),a1
  167.     call    SendIO
  168.     move.w    #1,_active
  169.     movem.l    (sp)+,d0-a6
  170. .noten
  171.     rts
  172.  
  173. _tr    dcb.b   IOTV_SIZE,0
  174. _mp    dcb.b   MP_SIZE,0
  175. _si    dcb.b   IS_SIZE,0
  176. _enabled
  177.     dc.w    0
  178. _active
  179.     dc.w    0
  180.  
  181. TimerName    dc.b    "timer.device",0
  182.  
  183.