	opt c+,d+
	
; this routine will open a simple window

execbase 	= 4	; base address of the exec.library
openlib	= -30-378	; offset for the openlib function
closelib	= -414	
open	= -30	; offset for the dos function open
mode_old	= 1005
close	= -36
ioerr	= -132

init:

; open 'dos.library'
	move.l execbase,a6 ; base address in a6
	lea dosname(pc),a1 ; address of library name
	moveq #0,d0	; version number (unimportant)
	jsr openlib(a6) ; call the function
	move.l d0,dosbase ; save the dos base address
	beq error
	
; this will open the window

	lea consolename(pc),a1 ; console definition
	move.l #mode_old,d0 ; mode
	bsr openfile	; console open
	beq error	; didn't work
	move.l d0,conhandle 
	
loop:	bra loop

; should i now want to close the window i would call this routine

	move.l conhandle,d1 ; handle number in d1
	move.l dosbase,a6 ; dos base address in a6
	jsr close(a6)
		
	
error:
	move.l dosbase,a6
	jsr ioerr(a6)
	move d0,d5
	move.l #-1,d7	; flag
	
openfile:		; open file
	move.l a1,d1
	move.l d0,d2
	move dosbase,a6
	jsr open(a6)
	tst.l d0
	rts
	

dosname:		; name of library to be opened
	dc.b 'dos.library',0,0
	even
	
dosbase:
	ds.l 1	; spot for dos base address
	even
consolename:
	dc.b 'con:0/100/64/100/***** HI THERE - BAZ - *****',0,0
	even
conhandle:	
	ds.l 1	; space for console handle
	
