	opt	l-

*screen.s

	incdir	":include/"
	include	exec/exec_lib.i
	include	intuition/intuition.i
	include	intuition/intuition_lib.i
	include	graphics/graphics_lib.i
	include	graphics/text.i

	moveq	#0,d0			;Intuition oeffnen
	lea	int_name(pc),a1
	CALLEXEC OpenLibrary
	tst.l	d0
	beq	abbruch		
	move.l	d0,_IntuitionBase	

	moveq	#0,d0			;Graphics oeffnen 
	lea	graf_name(pc),a1
	CALLEXEC OpenLibrary
	tst.l	d0
	beq	closeint		
	move.l	d0,_GfxBase

	lea	NewScreen(pc),a0
	CALLINT	OpenScreen		;Open Screen
	tst.l	d0
	beq	closegfx		
	move.l	d0,Screen		;in Window eintragen!

	lea	NewWindow(pc),a0	;Open Window
	CALLINT	OpenWindow
	tst.l	d0
	beq	closescr			
	move.l	d0,Window			

	move.l	d0,a1			;Text ausgeben
	move.l	wd_RPort(a1),a1		;Move
	moveq	#100,d0				
	moveq	#50,d1				
	CALLGRAF Move				

	move.l	Window(pc),a0		;print
	move.l	wd_RPort(a0),a1		
	lea	msg(pc),a0
	moveq	#msglen,d0
	CALLGRAF Text				

	move.l	Window(pc),a0		;warte Event
	move.l	wd_UserPort(a0),a0
	move.b	MP_SIGBIT(a0),d1	
	moveq	#0,d0
	bset	d1,d0				
	CALLEXEC Wait

	move.l	Window(pc),a0		;close all
	CALLINT CloseWindow

closescr
	move.l	Screen(pc),a0
	CALLINT CloseScreen

closegfx
	move.l	_GfxBase(pc),a1
	CALLEXEC CloseLibrary

closeint
	move.l	_IntuitionBase(pc),a1
	CALLEXEC CloseLibrary

abbruch
	rts


NewScreen	dc.w	0,0		left, top
		dc.w	320,200		width, height
		dc.w	2		depth
		dc.b	0,1		pens
		dc.w	0		viewmodes
		dc.w	CUSTOMSCREEN	type
		dc.l	Font		font
		dc.l	screen_title	title
		dc.l	0		gadgets
		dc.l	0		bitmap
Font	
		dc.l	font_name
		dc.w	TOPAZ_SIXTY
		dc.b	FS_NORMAL
		dc.b	FPF_ROMFONT

W_Gadgets equ   WINDOWDRAG!WINDOWDEPTH!WINDOWCLOSE
W_Extras  equ   SMART_REFRESH!ACTIVATE
W_Title dc.b    'Fenster-Titel',0
	cnop	0,2

NewWindow	
        dc.w	20,20               ;links, oben
	dc.w	300,100		    ;Breite, Hoehe
	dc.b	0,1		    ;Pens des Screen
	dc.l	CLOSEWINDOW
        dc.l    W_Gadgets!W_Extras  ;Window Flags
	dc.l	0		    ;KeinUser-Gadget
	dc.l	0	            ;keine User-Checkmark
	dc.l	W_Title  	    ;Titel des Window	
Screen	ds.l	1	            ;eigener Screen
	dc.l	0		    ;keine Super Bitmap
	dc.w	100,20,640,200      ;Limits von Window-Groesse
	dc.w	CUSTOMSCREEN	    ;Use our screen

_IntuitionBase	dc.l	0	
_GfxBase	dc.l	0		
Window		dc.l	0


int_name	INTNAME
graf_name	GRAFNAME
msg		dc.b	'Hallo Amiga'
msglen		equ      *-msg
		cnop	0,2
screen_title	dc.b	'Unser Screen',0
font_name	dc.b	'topaz.font',0


