[comp.sys.apple2] GetCaretTime

acmfiu@serss0.fiu.edu (ACMFIU) (05/23/91)

GetCaretTime returns the number of ticks that is to occur between cursor
blinks. because i'm handling my own blinking cursor, i need to use this.
so, am i correct in thinking that i have some counter that i increment
through my main loop and when it gets to the value returned by GetCaretTime
i blink the cursor. if so, then i must be doing something wrong because
the cursor is blinking awefully fast.

the value that GetCaretTime returns to me is $1e. my code looks like the
following:


	inc	num_ticks
	pha
	pha
	_GetCaretTime
	pla
	ply
	cmp	num_ticks
	beq	:1
	rts

:1	jsr	draw_cursor
	stz	num_ticks

:2	pha
	pha
	_GetCaretTime
	pla
	ply
	cmp	num_ticks
	bne	:2

	stz	num_ticks
	jsr	erase_cursor


NOTE: the above code is only for blinking the cursor. i know i'm suppose
to handle keypresses between blinking and erasing the cursor but that's
not the issue here.

also, i update on the main event loop because i never get null events for
some reason.

albert

toddpw@nntp-server.caltech.edu (Todd P. Whitesel) (05/23/91)

acmfiu@serss0.fiu.edu (ACMFIU) writes:

>GetCaretTime returns the number of ticks that is to occur between cursor
>blinks. because i'm handling my own blinking cursor, i need to use this.
>so, am i correct in thinking that i have some counter that i increment
>through my main loop and when it gets to the value returned by GetCaretTime
>i blink the cursor. if so, then i must be doing something wrong because
>the cursor is blinking awefully fast.

That's because you aren't counting TICKS (heartbeat interrupts). You're
counting _GetCaretTime calls, neglecting the counter code.

>also, i update on the main event loop because i never get null events for
>some reason.

I believe TaskMaster does not return until its internal call to GetNextEvent
returns a non-null event the application wishes to see, which would make it
a 'WaitNextEvent' call with automatic handling of certain events.

Todd Whitesel
toddpw @ tybalt.caltech.edu

dlyons@Apple.COM (David A Lyons) (05/28/91)

In article <1991May23.060838.342@nntp-server.caltech.edu> toddpw@nntp-server.caltech.edu (Todd P. Whitesel) writes:
>[...]
>I believe TaskMaster does not return until its internal call to GetNextEvent
>returns a non-null event the application wishes to see [...]

Actually TaskMaster is perfectly happy to give you a null event.
Each TaskMaster call calls GetNextEvent exactly once or zeronce (once
normally, but zeronce if you set the flag bit saying that you've
already filled in the task record with an event you want it to handle
for you).
-- 
David A. Lyons, Apple Computer, Inc.      |   DAL Systems
Apple II System Software Engineer         |   P.O. Box 875
America Online: Dave Lyons                |   Cupertino, CA 95015-0875
GEnie:DAVE.LYONS  CompuServe:72177,3233 Internet:dlyons@apple.com

My opinions are my own, not Apple's.