;- By Leo 'Nudel' Davidson, 6-Jan-1996
;- Code for getting number of rows for Active window based on the 'C' source
;- to ReSize, ©1995 P.Marquardt.   I would have preferred to do this using the
;- AmigaANSI command sequence, but I couldn't work out how to use it.

; Having written this I then realised that to write a routine to display the
; "Press any key to continue" message and then continue when the user presses
; a key couldn't be done without using the console device or some other thing.
; So I still need to use the damn thing -- I certainly don't feel like
; investigating how to use it just for this stupid help-text displaying routine,
; but if the console were used for the pause-prompt, it might as well be used
; to get the terminal rows, too, as that is a better method. All in all, I just
; with all this stuff could be done using the Input() and Output() handles, or
; with some new functions to talk _properly_ to your console without having to
; go to levels as low as talking to the console.device. Or have I been spoilt
; by the simplicity of other parts of the OS?... Hell, maybe these routines
; already exist or it's all really simple to do, in which case I wish I either
; had the documentation on how to do it, or the existing documentation pointed
; you in the direction of where the hell it is, because what I have points you
; around in circles to things which nearly do what I'm looking for, or things
; which describe bits of what I want to do but never explain how on Earth you
; actually use them....  God dammit, I just want to say FUCK!!!!!!!!!  Ahh,
; that's better, got that off my chest... Right, let's put on some load music
; (oh, there is already some on, okay) and code something else instead...
; People can just use nice, small fonts and huge overscan displays like I do,
; then the help text will fit on their screen anyway - so fukem.

; If anyone can help me with this stuff, please email me
; leo.davidson@keble.oxford.ac.uk

	Sub.l	d0,d0			Lock entire structure (only option anyway).
	N_CallInt LockIBase		Lock Intuition base.
;;;;;;;	d0 must be left alone as it contains pointer for unlock.
;;;;;;; No library calls should be made while intuition is locked, and it should
;;;;;;;	be unlocked ASAP.

	Move.l	N_IntBase(a5),a0	Point to Intuition base.
	Move.l	ib_ActiveWindow(a0),a0	Point to Active Window.
	Sub.w	d2,d2
	Move.w	wd_Height(a0),d1	Height of window,
	Move.b	wd_BorderTop(a0),d2	-._ Subtract
	Sub.w	d2,d1			-'  BorderTop.
	Move.b	wd_BorderBottom(a0),d2	-._ Subtract
	Sub.w	d2,d1			-'  BorderBottom. -- Now have window height.

	Move.l	wd_RPort(a0),a0		Point to window's Rastport.
	Move.l	rp_Font(a0),a0		Point to the textfont node.
	Move.w	tf_YSize(a0),d2		Height of the font.

	Movem.w	d1/d2,-(SP)
	Move.l	d0,a0			Lock to a0,
	N_CallInt UnlockIBase		Unlock Intuition base.
	Movem.w	(SP)+,d1/d2

	Divu.w	d2,d1			Divide window height by font height.
	And.l	#$FFFF,d1		Clear remainder. -- Now have number of rows.
;-------------------------------------------------------------------------------------;
	Lea	Buffer1(a5),a1		Output the number for testing.
;;;;;;;	Move.l	d1,d1
	Bsr	N2A3Dig
	Move.b	#10,(a1)

	Lea	Buffer1(a5),a0
	Moveq	#4,d3
	Bsr	CLIRite
