[comp.lang.pascal] procession towards keypressed continues

bobb@vice.ICO.TEK.COM (Bob Beauchaine) (05/15/91)

In article <1991May14.151208.11501@javelin.sim.es.com> tpehrson@javelin.sim.es.com writes:
>i finally got my kepressed function, as follows:
>
> function keypressed:boolean;
>  var regs:registers;
>   begin
>    with regs do begin
>     ah:=$00; keypressed:=(FZero and flags)=$00;
>    end;
>   end;
>
>and my code looks something like:
>
>...
> while not keypressed do begin
>  otherstuff; morestuff; end;
> case upcase(readkey) of
>...
>
>and now my gripes:
>
>1. otherstuff et al is never being reached.  i suppose i have some initializ-
>   ation that needs doing.  what and how?
>
>2. once 1 is resolved, a second key will be required at the (readkey), correct?
>   i would like to know an efficient way around this (use the key that was   
>   pressed to bypass not keypressed). 
>

  This is going to sound pompous but oh well, it's been that kind of day...

  Since you've been posting this question repeatedly for a week now, it
  seems that we need to resolve the problem.  

  First, look at your code as posted above.  From what I can see, you
  either don't have documentation for the copy of Turbo you're trying
  to use, or you don't know how to glean information from said documentation.

  You're code fragment sets a variable (regs.ah) to 0.  The next line is 
  where you're checking for a keypress.  How exactly do you think that
  the two actions are related?  You're "otherstuff" section of code
  doesn't get called because you're not even close to having a replacement
  for keypressed.  You need to do one of two things:  download a canned
  solution (like offered at garbo or simtel) to your problem, or learn
  a whole lot more about the maching you're programming on before you
  try a low level interface routine.  That's why high level languages
  were invented in the first place.

  [ off pulpit]

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 

Bob Beauchaine bobb@vice.ICO.TEK.COM 

C: The language that combines the power of assembly language with the 
   flexibility of assembly language.

   "It seems that the less a statesman amounts to, the more he appears
   to love the flag".

defaria@hpcupt3.cup.hp.com (Andy DeFaria) (05/16/91)

I remember something  about this keypressed thing  but  the  note has since
expired on my  machine.  Why do   you need  a  different keypressed routine
other   than the  one  that TP  provides?  Your  usage  of this home-brewed
keypressed routine does not demostrate the need for a "special" keypressed.

kai@kaiki.toppoint.de (Kai Voelcker) (05/17/91)

tpehrson@javelin.sim.es.com (Tim Clinkenpeel) writes:

> i finally got my kepressed function, as follows:
> 
>  function keypressed:boolean;
>   var regs:registers;
>    begin
>     with regs do begin
>      ah:=$00; keypressed:=(FZero and flags)=$00;
--------- the int call is missing !!
>     end;
>    end;
> 
> and my code looks something like:
> 
> ...
>  while not keypressed do begin
>   otherstuff; morestuff; end;
>  case upcase(readkey) of
> ...
> 
> and now my gripes:
> 
> 1. otherstuff et al is never being reached.  i suppose i have some initializ-
				^^^^^^^^^^^^^ of course not
>    ation that needs doing.  what and how?
> 
> 2. once 1 is resolved, a second key will be required at the (readkey), correc
>    i would like to know an efficient way around this (use the key that was   
>    pressed to bypass not keypressed). 

Why do You don't use direct bios calls? These TP syndroms especially for
readkey are nonsense. Use int 16h to get ascii value and scancode at one time.
And use inline, did You ever see what TP produces for an intr(,,) call ???
 ________________________________________________________________________
 | Kai Voelcker, Kappelner Str 18, D-2300 Kiel 1, voice: +49 431 335605 |
 | kai@kaiki.toppoint.de    interests: 386asm, c, pascal; OR algorithms |
 |   >>>  polite notice: I have to pay for incoming mail. Thanks  <<<   |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~