Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!apple!dlyons From: dlyons@Apple.COM (David A Lyons) Newsgroups: comp.sys.apple2 Subject: Re: help optimizing asm routine (and help with GetCaretTime) Message-ID: <53391@apple.Apple.COM> Date: 28 May 91 09:43:34 GMT References: <3638@kluge.fiu.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 49 In article <3638@kluge.fiu.edu> acmfiu@serss0.fiu.edu (ACMFIU) writes: >because i'm not using TextEdit for my program, i need to blink the insertion >cursor. everytime through my main event loop ('event_loop' below), i call >'blink_cursor' which accomplishes this. however, it doesn't blink the cursor >at all By the way (regarding a different message): If you're not getting null events, it's because you are getting an Update event which you are not handling. Window update events are not stored in the event queue-- if there is no higher-priority event, the system looks through all the windows front-to-back until it finds one with a non-empty update region. If you don't handle that by calling BeginUpdate, blahblahblah, EndUpdate, (which has the side-effect of emptying out the update region) then you'll get the same event again. I didn't examine your code closely enough to diagnose the real problem, but I did notice it barfs when the tick count value wraps around past zero (which happens every 2.2 years of continuous use)! -- I suggest a slightly simpler approach, using only the low word of the tick count, and also working properly when it wraps around past zero: pha pha _GetTick pla plx ;ignore high word tay ;keep copy of low word in Y sec sbc previous_ticks cmp blink_internal ;set earlier from GetCaretTime bcc dont_blink_it sty previous_ticks ... ;blink the thing, with InvertRect or whatever dont_blink_it Note that the calculation (Now - Previous) gives you a legitimate number of ticks even if it's something like $0005 minus $FFF0. That's $0015. (If you do "loop until current-ticks is greater-than-or-equal-to previous ticks plus increment" you can get stuck with "loop until X >= $FFFE", and X will go right past the big value back into the small values, if your main loop takes a significant amount of time per iteration.) -- 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.