home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / window.lzh / WINDOW / CONSOLE.ASM next >
Encoding:
Assembly Source File  |  1991-11-01  |  1.5 KB  |  68 lines

  1. **********************************************
  2. * console.asm
  3. * contents: code to spawn a new console task  
  4. * From Tim King (more or less)
  5. * (C) 1986 Commodore-Amiga
  6. *
  7. * (c) 1986 Commodore-Amiga, Inc.
  8. * This file may be used in any manner, as long as this copyright notice
  9. * remains intact.
  10. *         andy finkel
  11. *        Commodore-Amiga
  12. *
  13. ************************************
  14.     include    "window.i"
  15.  
  16.     xdef    _NewConsole
  17.     xdef    _CloseConsole
  18.     xref    _DOSBase
  19.  
  20. * offset into device style DevList structure
  21. * (the include file said the DevList structure
  22. * needed some work !)
  23. startup    equ    28
  24.  
  25. act_end        equ    1007
  26.  
  27. g_sendpkt    equ    48
  28. g_loaddevice    equ    112
  29. g_finddevice    equ    124
  30.  
  31. * task = NewConsole(Window)
  32. * create a console task in an already opened window
  33. * and return its handle
  34.  
  35. _NewConsole:
  36.     procst    #0,d2/a2/a5
  37.     move.l    #conname,d1    d1 = address of "CON" string
  38.     lsr.l    #2,d1        arg1 = BCPL address of string
  39.     callg    g_finddevice    get console device node
  40.     move.l    d0,d1        send it in arg1
  41.     lsl.l    #2,d0        d0 = address of node
  42.     move.l    d0,a2        save it in a2
  43.     move.l    #-1,startup(a2)    tell it not to create another window
  44.     move.l    arg1(a6),d2    arg2 = window structure pointer
  45.     callg    g_loaddevice
  46.     clr.l    startup(a2)    zero startup- we're cool now
  47.     return    d2/a2/a5
  48.  
  49. * CloseConsole( task )
  50. * shutdown the console task
  51. _CloseConsole:
  52.     procst    #0,d2-d4
  53.     move.l    arg1(a6),d2    d2 = destination task
  54.     move.l    #act_end,d3    d3 = action
  55.     callg    g_sendpkt    send the pkt off
  56.     return    d2-d4
  57.  
  58.     cnop    0,4
  59.  
  60. conname    dc.b    3,'C','O','N'
  61.  
  62.     end
  63.  
  64. ****************************
  65. * end of file console.asm
  66. ****************************
  67.