home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 152.lha / Console / console.asm next >
Assembly Source File  |  1988-04-26  |  1KB  |  50 lines

  1. ************************************
  2. * Code to spawn a new Console Task *
  3. * (C) 1986 Commodore-Amiga
  4. *
  5. ************************************
  6.     include    "window.i"
  7.  
  8.     xdef    _NewConsole
  9.     xdef    _CloseConsole
  10.     xref    _DOSBase
  11.  
  12. startup    equ    28    DevList startup value
  13.  
  14. act_end        equ    1007
  15.  
  16. g_sendpkt    equ    48
  17. g_loaddevice    equ    112
  18. g_finddevice    equ    124
  19.  
  20. * task = NewConsole(Window)
  21. * create a console task and return its id
  22. _NewConsole:
  23.     procst    #0,d2/a2/a5
  24.     move.l    #conname,d1    d1 = mc address of "CON" string
  25.     lsr.l    #2,d1        arg1 = BCPL address
  26.     callg    g_finddevice    get console device node
  27.     move.l    d0,d1        arg1 = node
  28.     lsl.l    #2,d0        d0 = MC address of node
  29.     move.l    d0,a2        save in a2
  30.     move.l    #-1,startup(a2)    put magic value into node
  31.     move.l    arg1(a6),d2    arg2 = window structure pointer
  32.     callg    g_loaddevice
  33.     clr.l    startup(a2)    re-zero magic value
  34.     return    d2/a2/a5
  35.  
  36. * CloseConsole( task )
  37. * shutdown the console task
  38. _CloseConsole:
  39.     procst    #0,d2-d4
  40.     move.l    arg1(a6),d2    d2 = destination task
  41.     move.l    #act_end,d3    d3 = action
  42.     callg    g_sendpkt    send the pkt off
  43.     return    d2-d4
  44.  
  45.     cnop    0,4
  46.  
  47. conname    dc.b    3,'C','O','N'
  48.  
  49.     end
  50.