*********************************************************
*							*
*		      Console				*
*							*
*		    Version 1.0				*
*							*
*		  14 February, 1989			*
*							*
*********************************************************

**	Tabstops : variable
**	Assemble with Macro68

;date 03-Mar-89


;Dr J. Szajman
;38 Ludbrook Ave
;South Caulfield
;Melbourne, Vic.  3162
;Australia


**      Permission is granted to purchasers of Macro68 to modify this source
**      file.  Permission is further granted to distribute the source code that
**      they have modified subject to the following conditions:
**      1.  That the original, unaltered, source is included with the
**          distribution.
**      2.  That no charge is made for the distribution, other than the cost of
**          media.                    (Distribution via Fred Fish is permitted)
**      3.  That my copyright notice remains as part of this and any other
**          file adapted from this file.


;-----------------  Modifications  -------------------------------------

;date 05-Feb-89
;Version 1.0
;date 28-Feb-89
;Open console, set font, read and write routines

;-----------------------------------------------------------------------


;Register usage:

;	d0 = scratch
;	d1 = scratch
;	d2 = scratch
;	d3 = error code
;	d4 =
;	d5 =
;	d6 =
;	d7 =

;	a0 =
;	a1 =
;	a2 =
;	a3 = IOStd
;	a4 =
;	a5 =
;	a6 = _AbsExecBase
;	a7 = stack pointer


***********************************************************************
	ifnd	_AbsExecBase

_AbsExecBase	equ	4		;exec library base

**********  exec.lib offsets  **********

_LVOFindTask	equ	-$126
_LVOOldOpenLibrary	equ	-$198
_LVOCloseLibrary	equ	-$19E
_LVOOpenDevice	equ	-$1BC
_LVOCloseDevice	equ	-$1C2
_LVODoIO	equ	-$1C8
_LVOOpenLibrary	equ	-$228

**********  exec definitions  **********

NT_MSGPORT	equ	4		;MSGPort structure
NT_MESSAGE	equ	5		;MSGPort structure
PA_SIGNAL	equ	0		;MSGPort structure
MP_SIGTASK	equ	$10		;MSGPort structure
LH_SIZE	equ	$E		;SIZEOFF(List struct)

IO_UNIT	equ	$18		;IOStd structure
IO_COMMAND	equ	$1C		;IOStd structure
IO_ACTUAL	equ	$20		;IOStd structure
IO_LENGTH	equ	$24		;IOStd structure
IO_DATA	equ	$28		;IOStd structure

CMD_READ	equ	2
CMD_WRITE	equ	3


**********  DOS.lib offsets   **********

_LVOWrite	equ	-$30
_LVOOutput	equ	-$3C
_LVODelay	equ	-$C6

**********  intuition.lib offsets  **********

_LVOCloseWindow	equ	-$48
_LVOGetPrefs	equ	-$84
_LVOOpenWindow	equ	-$CC	

**********  intuition definitions  **********

WBENCHSCREEN	equ	1
WINDOWSIZING	equ	1
WINDOWDRAG	equ	2
WINDOWDEPTH	equ	4
ACTIVATE	equ	$1000

nw_LeftEdge	equ	0		;NewWindow structure
nw_TopEdge	equ	2		;NewWindow structure
nw_Width	equ	4		;NewWindow structure
nw_Height	equ	6		;NewWindow structure
nw_MaxWidth	equ	42		;NewWindow structure
nw_MaxHeight	equ	44		;NewWindow structure
nw_SIZE	equ	48

wd_Width	equ	8		;Window structure
wd_Height	equ	10		;Window structure
wd_RPort	equ	50		;APTR RastPort

**********  graphics.lib offsets  **********

_LVOSetFont	equ	-$42
_LVOCloseFont	equ	-$4E

**********  graphics definitions  **********

gb_NormalDisplayRows	equ $D8
gb_NormalDisplayColumns	equ $DA

tf_YSize	equ	20		;TextFont structure
tf_XSize	equ	24		;TextFont structure
tf_Baseline	equ	26		;TextFont structure

rp_Font	equ	$34		;RastPort structure


**********  diskfont.lib offsets  **********

_LVOOpenDiskFont	equ	-$1E

**********  Definitions  **********

cu_XCP	equ	$26		;ConUnit structure
cu_YCP	equ	$28		;ConUnit structure
cu_XMax	equ	$2A		;ConUnit structure
cu_YMax	equ	$2C		;ConUnit structure
cu_XRSize	equ	$2E		;ConUnit structure
cu_YRSize	equ	$30		;ConUnit structure
cu_YROrigin	equ	$34		;ConUnit structure
cu_XCCP	equ	$3E		;ConUnit structure
cu_YCCP	equ	$40		;ConUnit structure
cu_Font	equ	$114	;ConUnit structure

	endc

CTRLC	equ	3		;CTRL C (^C)

**********    ERROR definitions    ***************

ERROR_WINDOW_FAIL	equ	206
ERROR_INTUIBASE	equ	302
ERROR_GFXBASE	equ	303
ERROR_DISKFONTLIB	equ	306
ERROR_DOSOUTPUT	equ	310
ERROR_CONSOLE	equ	320
ERROR_CONREAD	equ	330
ERROR_CONWRITE	equ	335
ERROR_DISKFONT	equ	350

;______________________________________________________________________

;Error Codes

;206	Can't open window
;302	Can't open intuition library
;303	Can't open graphics library
;306	Can't open diskfont library 
;310	Can't get DOS output file-handle
;320	Can't open console device
;330	Error while reading console window
;335	Error while writting to console window
;350	Can't open diskfont

**************************************************
	exeobj
	errfile	'ram:assem.output'
	objfile	'ram:con'
	strict
**************************************************


	SECTION Console,CODE

;Open DOS and intuition libraries
;DOS library is required for displaying errors and time delay

	movea.l	(_AbsExecBase),a6
	lea	(dos_lib),a1
	jsr	(_LVOOldOpenLibrary,a6)	;open DOS library
	move.l	d0,(DosBASE)
	exg	d0,a6
	jsr	(_LVOOutput,a6)
	movea.l	(_AbsExecBase),a6
	move.l	#ERROR_DOSOUTPUT,d3
	move.l	d0,(output)
	beq.w	exit1	;can't get output
	lea	(intuition_lib),a1
	jsr	(_LVOOldOpenLibrary,a6)	;open INTUITION lib
	move.l	d0,(IntuitionBASE)
	bne.b	open_graphics
	lea	(intuition_err),a0
	bsr.w	display
	move.l	#ERROR_INTUIBASE,d3
	bra.w	exit1
	

open_graphics	lea	(graphics_lib),a1
	jsr	(_LVOOldOpenLibrary,a6)
	move.l	d0,(GfxBASE)
	bne.b	window_stuff
	movea.l	d0,a1
	lea	(graphics_err),a0
	bsr.w	display
	move.l	#ERROR_GFXBASE,d3
	bra.w	exit2

;Open intuition window

window_stuff	move.l	#0,d0	;x,y
	move.w	#640,d1	;w
	swap	d1
	move.w	#256,d1	;h
	bsr.w	open_window
	move.l	d0,d3
	bne.w	exit3
	lea	(iostd_s),a3
	bsr.w	open_console	;open console
	move.l	d0,d3
	bne.w	exit4

;Read and write to console window (maximum 255 charcters)

write_first_msg	lea	(text1),a0	;pointer to text
	move.l	#text1_length,d0	;length of text
	bsr.w	WriteCon	;write initial message
	move.l	d0,d3
	bne.w	exit5	;error
	move.l	#$FF,d1	;max number of chars
	lea	(read_buffer),a0
loop	moveq	#1,d0	;read one char only
	bsr.w	ReadCon
	move.l	d0,d3
	bne.w	exit5
	moveq	#1,d0
	bsr.w	WriteCon	;display char
	move.l	d0,d3
	bne.w	exit5
	cmpi.b	#CTRLC,(a0)+	;last char?. Bump ptr
	dbeq	d1,loop
loop_exit	exg	a0,a2
	lea	(text2),a0
	move.l	#text2_length,d0
	bsr.w	WriteCon
	move.l	d0,d3
	bne.w	exit5

;Warning console device does not work with proportional font!

;Subroutine set_font will not overwrite old font line except when
;the last character is typed above bottom line of text, ie, up/down
;arrows are used to move the cursor above the bottom line.

;Text is printed four times using courier font
;Courier font can be found in FONTS directory on EXTAS disk (v1.3)

;Set 11 point none-proportional courier font.

	lea	(textattr_s),a0
	move.w	#11,(4,a0)	;11 point font
	bsr.w	set_font
	move.l	d0,d3
	bne.w	exit5
	movea.l	a0,a4	;TextFont pointer
	lea	(read_buffer),a0
	move.l	a2,d0
	sub.l	a0,d0	;no of characters
	movea.l	a3,a1
	bsr.w	WriteCon
	move.l	d0,d3	;save error code
	cmpa.l	#0,a4	;is font open?
	beq.w	delay
	exg	a4,a1
	jsr	(_LVOCloseFont,a6)

;Set 13 point none-proportional courier font.

	lea	(textattr_s),a0
	move.w	#13,(4,a0)
	bsr.w	set_font
	move.l	d0,d3
	bne.w	exit5
	movea.l	a0,a4	;TextFont pointer
	lea	(read_buffer),a0
	move.l	a2,d0
	sub.l	a0,d0	;no of characters
	movea.l	a3,a1
	bsr.w	WriteCon
	move.l	d0,d3	;save error code
	cmpa.l	#0,a4	;is font open?
	beq.w	delay
	exg	a4,a1
	jsr	(_LVOCloseFont,a6)

;Set 15 point none-proportional courier font.

	lea	(textattr_s),a0
	move.w	#15,(4,a0)
	bsr.w	set_font
	move.l	d0,d3
	bne.w	exit5
	movea.l	a0,a4	;TextFont pointer
	lea	(read_buffer),a0
	move.l	a2,d0
	sub.l	a0,d0	;no of characters
	movea.l	a3,a1
	bsr.w	WriteCon
	move.l	d0,d3	;save error code
	cmpa.l	#0,a4	;is font open?
	beq.b	delay
	exg	a4,a1
	jsr	(_LVOCloseFont,a6)

;Set 18 point none-proportional courier font.

	lea	(textattr_s),a0
	move.w	#18,(4,a0)
	bsr.w	set_font
	move.l	d0,d3
	bne.b	exit5
	movea.l	a0,a4	;TextFont pointer
	lea	(read_buffer),a0
	move.l	a2,d0
	sub.l	a0,d0	;no of characters
	movea.l	a3,a1
	bsr.w	WriteCon
	move.l	d0,d3	;save error code
	cmpa.l	#0,a4	;is font open?
	beq.b	delay
	exg	a4,a1
	jsr	(_LVOCloseFont,a6)

;Set 24 point none-proportional courier font.

	lea	(textattr_s),a0
	move.w	#24,(4,a0)
	bsr.w	set_font
	move.l	d0,d3
	bne.b	exit5
	movea.l	a0,a4	;TextFont pointer
	lea	(read_buffer),a0
	move.l	a2,d0
	sub.l	a0,d0	;no of characters
	movea.l	a3,a1
	bsr.w	WriteCon
	move.l	d0,d3	;save error code
	cmpa.l	#0,a4	;is font open?
	beq.b	delay
	exg	a4,a1
	jsr	(_LVOCloseFont,a6)

delay	tst.l	d3
	bne.b	exit5
	move.l	#500,d1	;pause for 10 seconds
	movea.l	(DosBASE),a6
	jsr	(_LVODelay,a6)
	movea.l	(_AbsExecBase),a6
	moveq	#0,d3	;no error

;Cleanup - close console.device and libraries

exit5	movea.l	a3,a1
	jsr	(_LVOCloseDevice,a6)
exit4	movea.l	(window_ptr),a0
	movea.l	(IntuitionBASE),a6
	jsr	(_LVOCloseWindow,a6)
	movea.l	(_AbsExecBase),a6
exit3	movea.l	(GfxBASE),a1
	jsr	(_LVOCloseLibrary,a6)
exit2	movea.l	(IntuitionBASE),a1
	jsr	(_LVOCloseLibrary,a6)
exit1	movea.l	(DosBASE),a1
	jsr	(_LVOCloseLibrary,a6)
	move.l	d3,d0	;error code
	rts



;Read console.
;entry - d0 - length
;        a0 = pointer to buffer
;        IOStd structure
;exit  - d0 = error code (0 if succesfull)
;used  - d0

ReadCon	movem.l	d1/a0/a1/a6,-(sp)
	lea	(iostd_s),a1
	move.l	a0,(IO_DATA,a1)	;prepare IOStd
	move.l	d0,(IO_LENGTH,a1)
	move.w	#CMD_READ,(IO_COMMAND,a1)
	movea.l	(_AbsExecBase),a6
	jsr	(_LVODoIO,a6)	;do I/O
	tst.l	d0	;test flag
	beq.b	ReadCon_exit
	lea	(read_err),a0
	bsr.b	display
	move.l	#ERROR_CONREAD,d0	;error code
ReadCon_exit	movem.l	(sp)+,d1/a0/a1/a6
	rts

;Write to console.
;entry - d0 - length
;        a0 = pointer to text
;        IOStd structure
;exit  - d0 = error code (0 if successfull)
;used  - d0

WriteCon	movem.l	d1/a0/a1/a6,-(sp)
	lea	(iostd_s),a1
	move.l	a0,(IO_DATA,a1)	;prepare IOStd
	move.l	d0,(IO_LENGTH,a1)
	move.w	#CMD_WRITE,(IO_COMMAND,a1)
	movea.l	(_AbsExecBase),a6
	jsr	(_LVODoIO,a6)	;do I/O
	tst.l	d0	;test flag
	beq.b	WriteCon_exit
	lea	(write_err),a0
	bsr.b	display
	move.l	#ERROR_CONWRITE,d0	;error code
WriteCon_exit	movem.l	(sp)+,d1/a0/a1/a6
	rts


;Display ASCII text
;entry - a0 - points to msg
;        DosBASE
;used  - NONE

display	movem.l	d0-d3/a6,-(a7)
	move.l	a0,d2
	moveq	#-1,d3
display_loop1	addq.l	#1,d3
	cmpi.b	#0,(a0)+
	bne.b	display_loop1
	move.l	(output),d1	;file handle
	movea.l	(DosBASE),a6
	jsr	(_LVOWrite,a6)	;display error
	movem.l	(a7)+,d0-d3/a6	;restore registers
	rts

;Open window
;entry - d0 = x,y
;        d1 = w,h
;exit  - a0 = window pointer
;        d0 = error code
;used  - a0,a1,d0,d1

open_window	move.l	a6,-(sp)
	lea	(new_window),a0
	movea.l	(GfxBASE),a1
	move.w	(gb_NormalDisplayColumns,a1),(nw_MaxWidth,a0)
	move.w	(gb_NormalDisplayRows,a1),(nw_MaxHeight,a0)
	move.w	d0,(nw_TopEdge,a0)
	add.w	d1,d0	;trap height errors
	swap	d0
	move.w	d0,(nw_LeftEdge,a0)
	move.w	d1,(nw_Height,a0)
	swap	d1
	move.w	d1,(nw_Width,a0)
	add.w	d1,d0	;trap width error
	cmp.w	(nw_MaxWidth,a0),d0
	bls.b	open_wind_rows
	move.l	a0,-(sp)
	lea	(wind_width_err),a0
	bsr.w	display
	movea.l	(sp)+,a0
	move.w	#0,(nw_LeftEdge,a0)
	move.w	(nw_MaxWidth,a0),(nw_Width,a0)
open_wind_rows	swap	d0
	cmp.w	(nw_MaxHeight,a0),d0
	bls.b	open_window_vert
	move.l	a0,-(sp)
	lea	(wind_height_err),a0
	bsr.w	display
	movea.l	(sp)+,a0
	move.w	#0,(nw_TopEdge,a0)
	move.w	(nw_MaxHeight,a0),(nw_Height,a0)
open_window_vert	movea.l	(IntuitionBASE),a6
	jsr	(_LVOOpenWindow,a6)	;open window
	movea.l	d0,a0
	move.l	d0,(window_ptr)
	clr.l	d0
	cmpa.l	#0,a0
	bne.b	open_window_exit
	lea	(window_err),a0
	bsr.w	display
	move.l	#ERROR_WINDOW_FAIL,d0
open_window_exit	movea.l	(sp)+,a6
	rts





;Initialize message port and open console device
;entry - a0 = window pointer
;         IOStsReq
;        MsgPort structure
;exit  - d0 = error code
;used  - d0

open_console	movem.l	d0/d1/a0-a2/a6,-(sp)
	lea	(iostd_s),a2
	move.l	a0,(IO_DATA,a2)	;link IOStd to window
	movea.l	#0,a1

;Set up message port
;If DoIO is used no need to allocate signal or AddPort

	movea.l	(_AbsExecBase),a6
	jsr	(_LVOFindTask,a6)	;find own task
	lea	(msgport_s),a0
	move.l	d0,(MP_SIGTASK,a0)	;fill structure
	lea	(msgportlist_s),a0

	move.l	a0,(a0)	;NEWLIST macro
	addq.l	#4,(a0)	;   initialize list
	clr.l	(4,a0)	;   structure
	move.l	a0,(8,a0)

;Open console device (unit is always 0)

	lea	(console_dev),a0
	clr.l	d0	;unit
	movea.l	a2,a1	;IOStd pointer
	clr.l	d1
	jsr	(_LVOOpenDevice,a6)	;open console Device
	tst.l	d0
	beq.b	open_console_exit
	lea	(OpenDevErr),a0
	bsr	display
	move.l	#ERROR_CONSOLE,d0
open_console_exit	movem.l	(sp)+,d0/d1/a0-a2/a6
	rts

;Set new font.  Adjust ConUnit structure.
;entry - initialized textattr structure
;        GfxBASE
;        window_ptr (long word with window pointer)
;        IOStd Structure
;exit  - a0 = TextFont pointer
;        d0 = error code
;used  - a0,d0

set_font	movem.l	d1-d3/a1/a4/a5/a6,-(sp)
	lea	(diskfont_lib),a1
	clr.l	d0
	jsr	(_LVOOpenLibrary,a6)	;open diskfont library
	tst.l	d0
	bne.b	open_disk_font
	lea	(open_disk_font_err),a0
	bsr.w	display
	move.l	#ERROR_DISKFONTLIB,d0
	bra.w	set_font_exit

open_disk_font	exg	d0,a6
	lea	(textattr_s),a0	;TextAttr structure
	jsr	(_LVOOpenDiskFont,a6)
	exg	d0,a4
	movea.l	(_AbsExecBase),a1
	exg	a1,a6
	jsr	(_LVOCloseLibrary,a6)	;close diskfont lib
	move.l	a4,d0	;set flag
	bne.b	setfont
	lea	(font_err),a0
	bsr.w	display
	move.l	#ERROR_DISKFONT,d0
	bra.w	set_font_exit

setfont	move.l	#4,d0
	lea	(cursor_off),a0
	bsr.w	WriteCon	;turn off cursor
	movea.l	(GfxBASE),a6
	movea.l	(window_ptr),a1	;window pointer
	movea.l	(wd_RPort,a1),a1	;RastPort
	movea.l	a1,a5	;save
	movea.l	a4,a0	;TextFont structure
	jsr	(_LVOSetFont,a6)	;new font
	lea	(iostd_s),a1
	movea.l	(IO_UNIT,a1),a1	;ptr to ConUnit struct

;Copy new font parameters to ConUnit structure

	move.w	(tf_XSize,a4),d0
xpos	move.w	(cu_XRSize,a1),d2	;old font size
	move.w	d0,(cu_XRSize,a1)
	clr.l	d1
	movea.l	(window_ptr),a0
	move.w	(wd_Width,a0),d1	;window width
	sub.w	#8+16,d1	;2*border sizing gad. 
	divu.w	d0,d1
	subq.w	#1,d1	;allow for 0th char
	bge.b	xpos_positive
	moveq	#0,d1
xpos_positive	move.w	d1,(cu_XMax,a1)	;max no of chars/line
	move.w	d2,d1
	mulu.w	(cu_XCP,a1),d1	;pixel position
	divu.w	d0,d1	;new char position
	cmp.w	(cu_XMax,a1),d1
	ble.b	xcur
	moveq	#0,d1	;start of line
xcur	move.w	d1,(cu_XCP,a1)
	mulu.w	(cu_XCCP,a1),d2	;pixel pos of cursor
	divu.w	d0,d2	;new cursor position
	cmp.w	(cu_XMax,a1),d2
	ble.b	ypos_size
	moveq	#0,d2
ypos_size	move.w	d2,(cu_XCCP,a1)
	move.w	(cu_YRSize,a1),d2	;old font height
	move.w	(tf_YSize,a4),d0
	move.w	d0,(cu_YRSize,a1)	;height
	clr.l	d1
	move.w	(wd_Height,a0),d1	;height of window
	sub.w	(cu_YROrigin,a1),d1	;less menu bar
	subq.w	#4,d1	;less bottom border
	divu.w	d0,d1
	subq.w	#1,d1	;line count
	bge.b	ypos_positive
	moveq	#0,d1
ypos_positive	move.w	d1,(cu_YMax,a1)
	move.w	d2,d1
	mulu.w	(cu_YCP,a1),d1	;pixel height
	add.w	d2,d1
	addq.w	#1,d1	;last pixel of line+1
	divu.w	d0,d1	;new char position
	swap	d1
	move.w	d1,d3	;remainder
	swap	d1
	tst.w	d3
	beq.b	ypos1	;no reminder?
	addq.w	#1,d1	;go to next line
ypos1	cmp.w	(cu_YMax,a1),d1	;last line of window?
	ble.b	ypos2
	lea	(scroll_up),a0
	movem.l	d0/a0/a1,-(sp)
	move.l	#3,d0
	bsr.w	WriteCon	;scroll up
	movem.l	(sp)+,d0/a0/a1	
	move.w	(cu_YMax,a1),d1
ypos2	move.w	d1,(cu_YCP,a1)
	mulu.w	(cu_YCCP,a1),d2	;pixel height of cur
	divu.w	d0,d2	;new cursor pos
	swap	d2
	move.w	d2,d3	;remainder
	swap	d2
	tst.w	d3
	beq.b	ycur1	;no reminder
	addq.w	#1,d2	;go to next line
ycur1	cmp.w	(cu_YMax,a1),d2	;last line of window?
	ble.b	ycur2
	move.w	(cu_YMax,a1),d2	;cursor on bottom line
ycur2	move.w	d2,(cu_YCCP,a1)
	lea	(cu_Font,a1),a1	;font ptr in ConUnit
	lea	(rp_Font,a5),a0	;font ptr in RastPort
	move.l	#13,d0	;no of bytes - 1
set_font_lp1	move.b	(a0)+,(a1)+
	dbf	d0,set_font_lp1
	move.l	#4,d0
	lea	(cursor_on),a0
	bsr.w	WriteCon	;turn on cursor
	movea.l	a4,a0	;TextFont pointer
	clr.l	d0
set_font_exit	movem.l	(sp)+,d1-d3/a1/a4/a5/a6
	rts


	SECTION	VARIABLES,DATA

DosBASE	dc.l	0
IntuitionBASE	dc.l	0
GfxBASE	dc.l	0

window_ptr	dc.l	0
output	dc.l	0

dos_lib	dc.b	'dos.library',0
intuition_lib	dc.b	'intuition.library',0
graphics_lib	dc.b	'graphics.library',0
diskfont_lib	dc.b	'diskfont.library',0
console_dev	dc.b	'console.device',0

text1	dc.b	'Console device is ready.  To quit type CTRL C',10,10
text1_length	equ	*-text1
text2	dc.b	10,10,'Window will close in 10 sec.  Typed text is shown below.',10,10,0
text2_length	equ	*-text2

cursor_off	dc.b	$9B,'0 p'	;cursor off
cursor_on	dc.b	$9B,'1 p'	;cursor on
scroll_up	dc.b	$9B,'1S'

intuition_err	dc.b	10,'*****  Error, cannot open intuition library',10,0
graphics_err	dc.b	10,'*****  Error, cannot open graphics library',10,0
open_disk_font_err	dc.b	10,'*****  Error, cannot open disk font library',10,0
window_err	dc.b	10,'*****  Error, cannot open window',10,0
wind_width_err	dc.b	10,'*****  Warning, horizontal window size exceeded',10,0
wind_height_err	dc.b	10,'*****  Warning, vertical window size exceeded',10,0
OpenDevErr	dc.b	10,'*****  Cannot open Console Device.',10,10,0
read_err	dc.b	10,'*****  Error while reading console',10,10,0
write_err	dc.b	10,'*****  Error while writing to console',10,10,0
font_err	dc.b	10,'*****  Cannot find courier font',10,10,0

read_buffer	dcb.b	$100,0

	SECTION	STRUCTURES,DATA

;**********  TextAttr Structure  **********

textattr_s	dc.l	fontname	;ta_Name
	dc.w	11	;ta_YSize
	dc.b	0	;ta_Style
	dc.b	2	;ta_Flags

;**********  MsgPort Structure  **********

msgport_s	dc.l	0	;LN_SUCC
	dc.l	0	;LN_PRED
	dc.b	NT_MSGPORT	;LN_TYPE
	dc.b	0	;LN_PRI
	dc.l	0	;LN_NAME
	dc.b	PA_SIGNAL	;MP_FLAGS
	dc.b	0	;MP_SIGBIT
	dc.l	0	;MP_SIGTASK

msgportlist_s	dcb.b	LH_SIZE,0	;list structure


**********  IOStdReq Structure  **********

iostd_s	dc.l	0	;ln_Succ
	dc.l	0	;ln_Pred
	dc.b	NT_MESSAGE	;ln_Type
	dc.b	0	;ln_Pri
	dc.l	0	;ln_Name

	dc.l	msgport_s	;mn_ReplyPort
	dc.w	0	;mn_Length

	dc.l	0	;io_Device
	dc.l	0	;io_unit
	dc.w	0	;io_Command
	dc.b	0	;io_Flags
	dc.b	0	;io_error

	dc.l	0	;io_Actual
	dc.l	1	;io_Length
	dc.l	0	;io_Data
	dc.l	0	;io_Offset

new_window	dc.w	0	;nw_LeftEdge
	dc.w	20	;nw_TopEdge
	dc.w	640	;nw_Width
	dc.w	150	;nw_Height
	dc.b	-1	;nw_DetailPen
	dc.b	-1	;nw_BlockPen
	dc.l	0	;nw_IDCMPFlags
	dc.l	WINDOWSIZING!WINDOWDRAG!WINDOWDEPTH!ACTIVATE
	dc.l	0	;nw_FirstGadget
	dc.l	0	;nw_CheckMark
	dc.l	title	;nw_Title
	dc.l	0	;nw_Screen
	dc.l	0	;nw_BitMap
	dc.w	10	;mw_MinWidth
	dc.w	10	;nw_MinHeight
	dc.w	640	;nw_MaxWidth
	dc.w	200	;nw_MaxHeight
	dc.w	WBENCHSCREEN	;nw_Type

title	dc.b	'Console Window',0
fontname	dc.b	'courier.font',0

	end
