; NoBorder 1.2 : make current shell window full screen (640x256 or bigger)
; by Kyzer/CSG
; $VER: NoBorder.asm 1.2 (24.04.98)
;
	incdir	include:
	include	lvo/exec_lib.i
	include	lvo/dos_lib.i
	include	lvo/intuition_lib.i
	include	intuition/intuition.i
	include	intuition/screens.i	

	move.l	4.w,a6
	lea	intname(pc),a1
	moveq	#32,d0
	jsr	_LVOOpenLibrary(a6)
	move.l	d0,a6
	moveq	#0,d0
	jsr	_LVOLockIBase(a6)
	move.l	d0,d7

	move.l	ib_ActiveScreen(a6),a5
	move.w	sc_Width(a5),d2
	move.w	sc_Height(a5),d3

	move.l	ib_ActiveWindow(a6),a5
	ori.l	#WFLG_BACKDROP!WFLG_BORDERLESS,wd_Flags(a5)
	clr.l	wd_FirstGadget(a5)
	clr.l	wd_BorderLeft(a5)	; clr wd_Border(Left|Right|Top|Bottom)

	move.l	d7,a0
	jsr	_LVOUnlockIBase(a6)

	move.w	wd_LeftEdge(a5),d0
	move.w	wd_TopEdge(a5),d1
	neg.w	d0
	neg.w	d1
	move.l	a5,a0
	jsr	_LVOMoveWindow(a6)
	move.w	d2,d0
	move.w	d3,d1
	move.l	a5,a0
	jsr	_LVOWindowLimits(a6)
	move.w	d2,d0
	move.w	d3,d1
	sub.w	wd_Width(a5),d0
	sub.w	wd_Height(a5),d1
	move.l	a5,a0
	jsr	_LVOSizeWindow(a6)
	move.l	a6,a1
	move.l	4.w,a6
	jsr	_LVOCloseLibrary(a6)

	lea	dosname(pc),a1
	moveq	#32,d0
	jsr	_LVOOpenLibrary(a6)
	move.l	d0,a6
	jsr	_LVOOutput(a6)
	move.l	d0,d1
	lea	reset(pc),a0
	move.l	a0,d2
	moveq.l	#6,d3
	jsr	_LVOWrite(a6)
	move.l	a6,a1
	move.l	4.w,a6
	jsr	_LVOCloseLibrary(a6)
	moveq	#0,d0
	rts

dosname	dc.b	'dos.library',0
intname	dc.b	'intuition.library',0
reset	dc.b	$1b,'c', $9b,'H', $9b,'J'

; note: This is ONLY designed to work when a CON: shell windows is the
;	current window.! Don't run it on KingCon/RCON/ViNCEd or from
;	DOPUS / filemaster as a CRASH islikely. Its only real use is in
;	 startup-sequences to make an 80x32 cli screen.

;	Use it to replace the old BORDER command.
