* Tue Aug 4 18:04:09 1987 * Message : #6516 From: Colin Fox * Group : Amiga related Topics * Length : 758 words * Subject : Assem. Example * Replies : 1 * * Enter a READ MESSAGE sub-command or type ? for help. * Read MESSAGE > Show * * Here is an example program, that opens a window on the workbench, * waits for you to click the close box, then it goes away. * It was posted before, but some of the lines got mixed. * This is a fixed version that should alleviate the problem. ****************************************************************** XREF _AbsExecBase it's defined in amiga.lib * These are the includes that are used in this example. This is so * you needn't use any INCLUDES while assembling this file. wd_UserPort EQU 86 im_Class EQU 20 ACTIVATE EQU $1000 means "activate the window when it opens" CLOSEWINDOW EQU $0200 this is the only message we want to get WINDOWCLOSE EQU $0008 these are the system gadgets that are WINDOWSIZING EQU $0001 to be attatched to the window WINDOWDRAG EQU $0002 WINDOWDEPTH EQU $0004 WBENCHSCREEN EQU $0001 SYS MACRO XREF _LVO\1 this is so the linker knows what to link in JSR _LVO\1(A6) this is the system call ENDM *************************************************** MOVE.L _AbsExecBase,A6 MOVE.L A6,_SysBase * The above two lines are necessary if you don't use AStartup, and we needn't * for this example. ************************************************** OpenIntuition MOVE.L _SysBase,A6 MOVE.L #IntuitName,A1 The name of the library MOVEQ #0,D0 Don't care which version SYS OpenLibrary open it! MOVE.L D0,IntuitionBase save the location of the library BEQ ByeBye if there was a problem, exit. OpenWindow MOVE.L IntuitionBase,A6 Library Anchor MOVE.L #NewWindow,A0 my own NewWindow structure SYS OpenWindow open it! MOVE.L D0,WindowPnt save pointer to Window Structure BEQ EndIntuit if there was a proble, exit. MOVE.L D0,A0 Pointer to Window MOVE.L wd_UserPort(A0),UserPnt Pointer to UserPort *************************************************** Main MOVE.L _SysBase,A6 Library pointer MOVE.L UserPnt,A0 UserPort pointer SYS WaitPort wait for user to do something MOVE.L _SysBase,A6 Library pointer MOVE.L UserPnt,A0 UserPort pointer SYS GetMsg Get a message MOVE.L D0,A1 MOVE.L _SysBase,A6 SYS ReplyMsg all messages must be REPLY'd to * Normally, there would be a check to see what kind of message it was, but * since the only message we are allowing is CLOSEWINDOW, then that is the * only message we'll get. So, we'll skip the check in this example. *************************************************** EndWindow MOVE.L WindowPnt,A0 Pointer to the System's Window Struct. MOVE.L IntuitionBase,A6 SYS CloseWindow EndIntuit MOVE.L _SysBase,A6 MOVE.L IntuitionBase,A1 The library we opened SYS CloseLibrary ByeBye MOVEQ #0,D0 For a clean return code RTS **************************************************** SECTION Data,DATA myIDCMP EQU CLOSEWINDOW myFlags EQU ACTIVATE!WINDOWCLOSE!WINDOWSIZING!WINDOWDEPTH!WINDOWDRAG Title DC.B 'Window Title',0 The name of the window IntuitName DC.B 'intuition.library',0 CNOP 0,4 this is for safety, to align NewWindow properly NewWindow DC.W 0 Left Edge DC.W 0 Top Edge DC.W 150 Width DC.W 150 Height DC.B 3 Detail Pen DC.B 1 Block Pen DC.L myIDCMP IDCMP flags DC.L myFlags Window flags DC.L 0 First gadget in list DC.L 0 Check mark DC.L Title Window title DC.L 0 Screen (0 = workbench) DC.L 0 Custom Bitmap DC.W 40 Minimum width DC.W 100 Minimum height DC.W 320 Maximum width DC.W 200 Maximum height DC.W WBENCHSCREEN Type of screen ************************************************** SECTION mem,BSS _SysBase DS.L 1 IntuitionBase DS.L 1 WindowPnt DS.L 1 UserPnt DS.L 1 END t @~OE0kxg"'k/>kn~qd