home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / languages / ezasm_431 / window.s < prev   
Text File  |  1991-01-17  |  2KB  |  147 lines

  1.  
  2.  
  3.  
  4. *    Opens a window, gets the window's fontdata into our CHIP area
  5. *        and blits part of it into the window.
  6.  
  7. *    ( uses "ENDS" for data at bottom )
  8. *    ( text might be trashed under 2.0 )
  9.  
  10. *    click left mouse button to exit
  11.  
  12.             
  13.         include     "intuition/intuition.i"
  14.         include     "exec/types.i"
  15.         include     "graphics/gfx.i"
  16.         include     "graphics/rastport.i"
  17.  
  18.  
  19.  
  20. CLEAR_CHIP    equ    $10002
  21.  
  22.  
  23.         CSEG
  24.  
  25.  
  26.  
  27. LONG    Wind _IntuitionBase FontData Planes _GfxBase
  28.  
  29.  
  30.         FontData = AllocMem( 2048 #CLEAR_CHIP )
  31.         beq    Quit
  32.  
  33.         _IntuitionBase = OpenLibrary( #intuiname 0 )
  34.         beq    Quit
  35.  
  36.         _GfxBase = OpenLibrary( #graphname 0 )
  37.         beq    Quit
  38.  
  39.         Wind = OpenWindow( #newwin )
  40.         beq    Quit
  41.  
  42.  
  43.  
  44. *    a handy debugging aid!
  45.  
  46. *    ( just remove the '*', change the color, and be sure a label's
  47. *    before the next one )
  48.  
  49. *        d6 = 1000
  50. *1$        d7 = 10000
  51. *2$        ($dff180) = $0f0 w    ;GREEN
  52. *        dbf    d7,2$
  53. *        dbf    d6,1$
  54.  
  55.  
  56.  
  57.  
  58.  
  59. *   load fontdata into our chip area
  60.  
  61.         a0 = Wind
  62.         a1 = wd_RPort(a0)
  63.         a2 = rp_Font(a1)
  64.         a3 = tf_CharData(a2)
  65.             
  66.         d1 = 383
  67.         a4 = FontData
  68. FontLoop    (a4)+ = (a3)+ l
  69.         dbf    d1,FontLoop
  70.  
  71.  
  72. *   get addr of windows 1st bitplane
  73.  
  74.         a2 = rp_BitMap(a1)
  75.         Planes = bm_Planes(a2)
  76.  
  77.  
  78. *   blit out first portion of fontdata
  79.  
  80.  
  81.         a6 = $dff000
  82.             
  83.         $40(a6) = $03aa        ;BLTCON0  USE: C D  D=C
  84.         $60(a6) = $007a w    ;BLTCMOD
  85.         $66(a6) = $000a w    ;BLTDMOD
  86.             
  87.         d1 = Planes            
  88.         d1 += 1605
  89.         $54(a6) = d1
  90.             
  91.         $48(a6) = FontData
  92.             
  93.         $74(a6) = 0 w        ;BLTADAT
  94.         $72(a6) = 0 w        ;BLTBDAT
  95.             
  96.         $96(a6) = $8240        ;DMACON   SET DMAEN BLTEN
  97.             
  98.         $58(a6) = 547        ;BLTSIZE
  99.  
  100.  
  101. BlitWait    ($dff002):6 = 1 BlitWait    ;DMACONR  BBUSY?
  102.  
  103. QuitLoop    ($bfe001):6 = 1 QuitLoop    ;wait for LMB down
  104.  
  105.  
  106. Quit
  107.         Wind != 0 {
  108.             CloseWindow( Wind )
  109.         }
  110.  
  111.         _IntuitionBase != 0 {
  112.             CloseLibrary( _IntuitionBase )
  113.         }
  114.  
  115.         _GfxBase != 0 {
  116.             CloseLibrary( _GfxBase )
  117.         }
  118.  
  119.         FontData != 0 {            
  120.             FreeMem( FontData 2048 )
  121.         }
  122.  
  123.  
  124.         ENDS
  125.  
  126.  
  127.         DSEG
  128.  
  129.  
  130.  
  131. newwin        ds.w    0
  132.  
  133.         dc.w    0,0,640,200
  134.         dc.b    -1,-1
  135.         dc.l    0
  136.         dc.l    WINDOWDRAG|WINDOWSIZING|SIZEBRIGHT|ACTIVATE|SMART_REFRESH
  137.         dc.l    0,0,0,0,0
  138.         dc.w    100,100,640,400
  139.         dc.w    WBENCHSCREEN
  140.  
  141.  
  142. intuiname    dc.b    "intuition.library",0
  143. graphname    dc.b    "graphics.library",0
  144.  
  145.  
  146.         END
  147.