flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Main > check for a keystroke, not WAIT for a keystroke | 
| Author | 
 | 
| LocoDelAssembly 26 Sep 2009, 15:12 Diguidi, the problem is that Int16/AH=01 does not remove the keystroke from the buffer. The code you need is something like this:
 Code: get_keystroke: mov ah, 1 int $16 jz do_something_while_there_is_no_keystroke ; We already have our keystroke but we are going to call Int16/AH=0 to remove it (and get it again) xor ah, ah int $16 | |||
|  26 Sep 2009, 15:12 | 
 | 
| Diguidi 26 Sep 2009, 15:22 ok we call another function which removes the keystroke from the buffer.
 there is no function which clears the buffer only ? thanks LocoDelAssembly | |||
|  26 Sep 2009, 15:22 | 
 | 
| LocoDelAssembly 26 Sep 2009, 15:42 Not sure but I wouldn't advice it as you may miss some keystrokes that way. If you need a clear procedure then you could use this:     Code: clear_keystroke_buffer.remove: mov ah, 0 int $16 clear_keystroke_buffer: ; Call here mov ah, 1 int $16 jnz .remove ret | |||
|  26 Sep 2009, 15:42 | 
 | 
| Diguidi 26 Sep 2009, 16:15 ok thanks a lot ! | |||
|  26 Sep 2009, 16:15 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.