Re: LZ: TimeOut routines


[Prev][Next][Index][Thread]

Re: LZ: TimeOut routines



Michael Wyman wrote:
> 
> Can any of you tell me how I would run a timeout routine in a program (such
> as having the calculator turn itself off if a key wasn't pressed in after
> a certain amount of time)?  I can't seem to get it to work correctly!
> 
> This is about what I've tried so far:
> 
> ld  bc, $ffff
> Loop:
> call GET_KEY
> dec bc
> jr  z, Time_Out
> or  a
> jr  z, Loop
> ret
> 

Well, the "or a" isn't needed because all that will do will or a with 
itself, leaving a. :)  Also, just loading bc with $FFFF is not enough 
time.  $FFFF is the amount of time the link port uses to check for an 
acknoledgement.  Try sending something out of the calc without a link.  
That's how much time you will get when it says "transmission error".  
You'll probably need to dec de when bc is zero and then check for de 
being zero.  call GET_KEY might change some register values, I remember 
it changes hl, but I'm not sure of the others.

> Time_Out:
> (just some other stuff)
> 
> Can any of you give me a hint?  I also tried to push bc while it was $ffff,
> then pop it each time the regular bc=0, check it to see if it was zero.  If
> not, I decreased it, pushed it, loaded $ffff into bc, and returned to the
> loop.  Maybe I was just using incorrect syntax in the commands I used, but
> please give me ideas!
> 
> Thanks,
> Michael Wyman - SeaHorse Software
> wyma0012@gold.tc.umn.edu

-- 
Compliments of:
_-_-_-_-_-_-_-_
  Alan Bailey
  mailto:bailala@mw.sisna.com
  IRC:Abalone
  Web:http://www.mw.sisna.com/users/bailala/home.htm


References: