


*	Opens a window, gets the window's fontdata into our CHIP area
*		and blits part of it into the window.

*	( uses "ENDS" for data at bottom )
*	( text might be trashed under 2.0 )

*	click left mouse button to exit

			
		include     "intuition/intuition.i"
		include     "exec/types.i"
		include     "graphics/gfx.i"
		include     "graphics/rastport.i"



CLEAR_CHIP	equ	$10002


		CSEG



LONG	Wind _IntuitionBase FontData Planes _GfxBase


		FontData = AllocMem( 2048 #CLEAR_CHIP )
		beq	Quit

		_IntuitionBase = OpenLibrary( #intuiname 0 )
		beq	Quit

		_GfxBase = OpenLibrary( #graphname 0 )
		beq	Quit

		Wind = OpenWindow( #newwin )
		beq	Quit



*	a handy debugging aid!

*	( just remove the '*', change the color, and be sure a label's
*	before the next one )

*		d6 = 1000
*1$		d7 = 10000
*2$		($dff180) = $0f0 w	;GREEN
*		dbf	d7,2$
*		dbf	d6,1$





*   load fontdata into our chip area

		a0 = Wind
		a1 = wd_RPort(a0)
		a2 = rp_Font(a1)
		a3 = tf_CharData(a2)
			
		d1 = 383
		a4 = FontData
FontLoop	(a4)+ = (a3)+ l
		dbf	d1,FontLoop


*   get addr of windows 1st bitplane

		a2 = rp_BitMap(a1)
		Planes = bm_Planes(a2)


*   blit out first portion of fontdata


		a6 = $dff000
			
		$40(a6) = $03aa		;BLTCON0  USE: C D  D=C
		$60(a6) = $007a w	;BLTCMOD
		$66(a6) = $000a w	;BLTDMOD
			
		d1 = Planes			
		d1 += 1605
		$54(a6) = d1
			
		$48(a6) = FontData
			
		$74(a6) = 0 w		;BLTADAT
		$72(a6) = 0 w		;BLTBDAT
			
		$96(a6) = $8240		;DMACON   SET DMAEN BLTEN
			
		$58(a6) = 547		;BLTSIZE


BlitWait	($dff002):6 = 1 BlitWait	;DMACONR  BBUSY?

QuitLoop	($bfe001):6 = 1 QuitLoop	;wait for LMB down


Quit
		Wind != 0 {
			CloseWindow( Wind )
		}

		_IntuitionBase != 0 {
			CloseLibrary( _IntuitionBase )
		}

		_GfxBase != 0 {
			CloseLibrary( _GfxBase )
		}

		FontData != 0 {			
			FreeMem( FontData 2048 )
		}


		ENDS


		DSEG



newwin		ds.w	0

		dc.w    0,0,640,200
		dc.b    -1,-1
		dc.l    0
		dc.l    WINDOWDRAG|WINDOWSIZING|SIZEBRIGHT|ACTIVATE|SMART_REFRESH
		dc.l    0,0,0,0,0
		dc.w    100,100,640,400
		dc.w    WBENCHSCREEN


intuiname	dc.b    "intuition.library",0
graphname	dc.b    "graphics.library",0


		END
