home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d110 / pdc.lha / Pdc / examples / Window.asm < prev   
Assembly Source File  |  1987-10-28  |  4KB  |  158 lines

  1. * Tue Aug  4 18:04:09 1987
  2. * Message : #6516    From: Colin Fox
  3. * Group      : Amiga related Topics
  4. * Length  : 758    words
  5. * Subject : Assem. Example
  6. * Replies : 1
  7. *
  8. * Enter    a READ MESSAGE sub-command or type ? for help.
  9. * Read MESSAGE > Show
  10. *
  11. * Here is an example program, that opens a window on the workbench,
  12. *  waits for you to click the close box, then it goes away.
  13. *  It was posted before, but some of the lines got mixed.
  14. *  This    is a fixed version that    should alleviate the problem.
  15.  
  16.  
  17. ******************************************************************
  18.  
  19.     XREF    _AbsExecBase    it's defined in amiga.lib
  20.  
  21. * These    are the    includes that are used in this example.    This is    so
  22. * you needn't use any INCLUDES while assembling this file.
  23.  
  24. wd_UserPort    EQU    86
  25. im_Class    EQU    20
  26.  
  27. ACTIVATE    EQU    $1000 means "activate the window when it opens"
  28. CLOSEWINDOW    EQU    $0200 this is the only message we want to get
  29.  
  30. WINDOWCLOSE    EQU    $0008 these are    the system gadgets that    are
  31. WINDOWSIZING    EQU    $0001 to be attatched to the window
  32. WINDOWDRAG    EQU    $0002
  33. WINDOWDEPTH    EQU    $0004
  34.  
  35. WBENCHSCREEN    EQU    $0001
  36.  
  37.  
  38.  
  39. SYS    MACRO
  40.     XREF    _LVO\1        this is    so the linker knows what to link in
  41.     JSR    _LVO\1(A6)    this is    the system call
  42.     ENDM
  43.  
  44. ***************************************************
  45.  
  46.     MOVE.L    _AbsExecBase,A6
  47.     MOVE.L    A6,_SysBase
  48.  
  49. * The above two    lines are necessary if you don't use AStartup, and we needn't
  50. * for this example.
  51.  
  52. **************************************************
  53.  
  54. OpenIntuition
  55.  
  56.     MOVE.L    _SysBase,A6
  57.     MOVE.L    #IntuitName,A1        The name of the    library
  58.     MOVEQ    #0,D0            Don't care which version
  59.     SYS    OpenLibrary        open it!
  60.     MOVE.L    D0,IntuitionBase    save the location of the library
  61.     BEQ    ByeBye            if there was a problem,    exit.
  62.  
  63. OpenWindow
  64.  
  65.     MOVE.L    IntuitionBase,A6    Library    Anchor
  66.     MOVE.L    #NewWindow,A0        my own NewWindow structure
  67.     SYS    OpenWindow        open it!
  68.     MOVE.L    D0,WindowPnt        save pointer to    Window Structure
  69.     BEQ    EndIntuit        if there was a proble, exit.
  70.  
  71.     MOVE.L    D0,A0                Pointer    to Window
  72.     MOVE.L    wd_UserPort(A0),UserPnt        Pointer    to UserPort
  73.  
  74. ***************************************************
  75.  
  76. Main
  77.     MOVE.L    _SysBase,A6        Library    pointer
  78.     MOVE.L    UserPnt,A0        UserPort pointer
  79.     SYS    WaitPort        wait for user to do something
  80.  
  81.     MOVE.L    _SysBase,A6        Library    pointer
  82.     MOVE.L    UserPnt,A0        UserPort pointer
  83.     SYS    GetMsg            Get a message
  84.  
  85.     MOVE.L    D0,A1
  86.     MOVE.L    _SysBase,A6
  87.     SYS    ReplyMsg        all messages must be REPLY'd to
  88.  
  89. * Normally, there would    be a check to see what kind of message it was, but
  90. * since    the only message we are    allowing is CLOSEWINDOW, then that is the
  91. * only message we'll get. So, we'll skip the check in this example.
  92.  
  93. ***************************************************
  94.  
  95. EndWindow
  96.  
  97.     MOVE.L    WindowPnt,A0         Pointer to    the System's Window Struct.
  98.     MOVE.L    IntuitionBase,A6
  99.     SYS    CloseWindow
  100.  
  101. EndIntuit
  102.  
  103.     MOVE.L    _SysBase,A6
  104.     MOVE.L    IntuitionBase,A1     The library we opened
  105.     SYS    CloseLibrary
  106.  
  107. ByeBye
  108.     MOVEQ    #0,D0             For a clean return    code
  109.     RTS
  110.  
  111. ****************************************************
  112.  
  113.     SECTION    Data,DATA
  114.  
  115.  
  116. myIDCMP         EQU  CLOSEWINDOW
  117. myFlags         EQU  ACTIVATE!WINDOWCLOSE!WINDOWSIZING!WINDOWDEPTH!WINDOWDRAG
  118.  
  119.  
  120. Title         DC.B    'Window Title',0        The name of the window
  121. IntuitName   DC.B    'intuition.library',0
  122.  
  123.  
  124.      CNOP    0,4     this is for safety, to align NewWindow properly
  125.  
  126. NewWindow
  127.         DC.W    0        Left Edge
  128.         DC.W    0        Top Edge
  129.         DC.W    150        Width
  130.         DC.W    150        Height
  131.         DC.B    3        Detail Pen
  132.         DC.B    1        Block Pen
  133.         DC.L    myIDCMP        IDCMP flags
  134.         DC.L    myFlags        Window flags
  135.         DC.L    0        First gadget in    list
  136.         DC.L    0        Check mark
  137.         DC.L    Title        Window title
  138.         DC.L    0        Screen (0 = workbench)
  139.         DC.L    0        Custom Bitmap
  140.         DC.W    40        Minimum    width
  141.         DC.W    100        Minimum    height
  142.         DC.W    320        Maximum    width
  143.         DC.W    200        Maximum    height
  144.         DC.W    WBENCHSCREEN    Type of    screen
  145.  
  146.  
  147. **************************************************
  148.  
  149.     SECTION    mem,BSS
  150.  
  151. _SysBase    DS.L    1
  152. IntuitionBase    DS.L    1
  153.  
  154. WindowPnt    DS.L    1
  155. UserPnt        DS.L    1
  156.  
  157.         END
  158. ˜€µtŸ›Áƒù    @~ ÿOE0kx·g°"Û'¸¦kÞ/>€kn~qƒd