	opt c+,d+

; this program will open and close a simple window and output a text 
; message on the screen

openlib	= -30-378
closelib	= -414
execbase	= 4

; calls to amiga DOS

open	= -30
close	= -30-6
write	= -48
ioerr	= -132
mode_old	= 1005
alloc_abs	= -$cc


run:
	bsr init	;initialisation
	bsr test	; system-test
	nop
	bra qu	; quit and exit
	
test:
	move.l #title,d0
	bsr pmsg
	bsr pcrlf
	bsr pcrlf
	
	
	rts
	
init:		; system initialization and open
	move.l execbase,a6 ; number of execute library
	lea disname(pc),a1
	moveq #0,d0
	jsr openlib(a6) ; open DOS-library
	move.l d0,dosbase
	beq error
	lea consolname(pc),a1 ; console definition
	move.l mode_old,d0
	bsr openfile	; console open
	beq error
	move.l d0,conhandle
	
	rts
	
	
pmsg:		; print message (d0)
	movem.l d0-d7/a0-a6,-(sp)
	move.l d0,a0
	move.l a0,d2
	clr.l d3
ploop:
	tst.b (a0)+
	beq pmsg
	addq.l #1,d3
	bra ploop	; length calculate
	
	
	
