home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d01xx / d0155.lha / AsmExamples / Screen.a < prev   
Text File  |  1988-10-02  |  3KB  |  117 lines

  1. * Simple Assembly language example. Eats away a little ram
  2. * from WorkBench use, should probably link with some startup
  3. * code to handle the WBenchMsg coming to the task.
  4.  
  5.    option nl
  6.    INCLUDE "intuition/intuition.i"
  7.    
  8.    option l
  9.    XREF _AbsExecBase
  10.    
  11.    XREF _LVOOpenLibrary
  12.    XREF _LVOCloseLibrary
  13.    XREF _LVOOpenScreen
  14.    XREF _LVOCloseScreen
  15.    XREF _LVOWaitPort
  16.    XREF _LVOOpenWindow
  17.    XREF _LVOCloseWindow
  18.    XREF _LVOExit
  19.  
  20.    lea         DosName,a1        ; Need this only to call Exit()
  21.    clr.l    d0
  22.    movea.l  _AbsExecBase,a6
  23.    jsr      _LVOOpenLibrary(a6)        ; Ought to make things secure,
  24.    tst.l    d0
  25.    beq      exit
  26.    move.l   d0,DosBase
  27.  
  28.    lea         IntuitionName,a1
  29.    clr.l    d0
  30.    movea.l  _AbsExecBase,a6
  31.    jsr      _LVOOpenLibrary(a6)        ; Ought to make things secure,
  32.    tst.l    d0
  33.    beq      exit
  34.  
  35.    move.l   d0,IntuiBase
  36.    move.l   d0,a6        ; Need pointer right away
  37.    lea      MyNewScreen,a0
  38.    jsr      _LVOOpenScreen(a6)        ; No error checking done
  39.    tst.l    d0
  40.    beq      3$
  41.  
  42.    move.l   d0,MyScreen
  43.    move.l   d0,NewWindowScreen
  44.    movea.l  IntuiBase,a6
  45.    lea      MyNewWindow,a0
  46.    jsr      _LVOOpenWindow(a6)        ; Still no error checking
  47.    tst.l    d0
  48.    beq      2$
  49.  
  50.    move.l   d0,MyWindow
  51.    move.l   d0,a0
  52.    move.l   wd_UserPort(a0),a0
  53.    movea.l  _AbsExecBase,a6
  54.    jsr      _LVOWaitPort(a6)        ; Wait for close gadget
  55.    
  56.    movea.l  IntuiBase,a6
  57.    movea.l  MyWindow,a0
  58.    jsr      _LVOCloseWindow(a6)
  59. 2$:
  60.    movea.l  IntuiBase,a6
  61.    movea.l  MyScreen,a0
  62.    jsr      _LVOCloseScreen(a6)
  63. 3$:
  64.    movea.l  _AbsExecBase,a6
  65.    move.l   IntuiBase,a1
  66.    jsr      _LVOCloseLibrary(a6)
  67. exit:
  68.    clr.l    d1            ; Return code for CLI
  69.    movea.l  DosBase,a6
  70.    jsr         _LVOExit(a6)    ; Clean exit from WB also
  71.  
  72. * Data section
  73.  
  74. **************** Screen data
  75.  
  76. MyScreen:
  77.    dc.l 0
  78.  
  79. MyNewScreen:  dc.w 0,0,320,256   ;size filled in later
  80.               dc.w 4      ;depth
  81.               dc.b 0,1
  82.               dc.w 0      ;viewmodes
  83.               dc.w CUSTOMSCREEN
  84.               dc.l 0
  85.               dc.l ScreenTitle
  86.               dc.l 0,0
  87.  
  88. **************** Window data
  89.  
  90. MyWindow:
  91.    dc.l 0
  92.  
  93. MyFlags       EQU SMART_REFRESH!ACTIVATE!WINDOWDEPTH!WINDOWDRAG!WINDOWCLOSE
  94. MyNewWindow:  dc.w 0,30,250,100
  95.               dc.b 2,5
  96.               dc.l CLOSEWINDOW    ; IDCMP Flags
  97.               dc.l MyFlags
  98.               dc.l 0,0
  99.               dc.l WindowTitle
  100. NewWindowScreen: dc.l 0        ; Screen to be filled in later
  101.               dc.l 0        ; Pointer to bitmap
  102.               dc.w 0,0,0,0
  103.               dc.w CUSTOMSCREEN
  104.  
  105. ScreenTitle:
  106.    dc.b 'Assembly Language Screen!',0
  107. WindowTitle:
  108.    dc.b 'Assembly Language is fun!',0
  109. IntuitionName:
  110.    dc.b 'intuition.library',0
  111. IntuiBase:
  112.    dc.l 0
  113. DosName:
  114.    dc.b 'dos.library',0
  115. DosBase:
  116.    dc.l 0
  117.