Those lines seems to have no effect on my machine. So, I commented them
out:
; mov ah, 11h
; int 16h
; je pre_quit
> mov ah,8h
After trying to figure out why your code didn't work for a while, I realized
that you probably confused ah=8h with ah=6h. It seems that ah=8h doesn't
check for extended keys. I think what you want is:
kbwait:
mov ah,6h
mov dl,0ffh ; needed to select input
> int 21h
It seems you are missing a wait loop. The function returns ZF set for no
key available. It sets AL=0, if not an extended key. But, you must wait
until a key is available (ZF clear) to check for AL=0... So:
int21h
jz kbwait ; wait for key
> cmp al,0 ; if not extended key
> jnz quit
> int 21h
> jmp quit
>
> pre_quit:
> mov al,0
> quit:
> mov ah,4ch
> int 21h
>
In total, I get this:
org 100h
; mov ah, 11h
; int 16h
; je pre_quit
kbdwait:
; mov ah,8h
mov ah,6h ; read w/extended
mov dl,0ffh ; input
int 21h
jz kbdwait ; wait for key
cmp al,0 ; if not extended key
jnz quit
int 21h
jmp quit
pre_quit:
mov al,0
quit:
mov ah,4ch
int 21h
HTH,
Rod Pemberton
PS. Threw on comp.os.msdos.programmer in case someone there knows how to do
it with ah=8h, or has a better method.
According to my docs the jz kbdwait should not be required as int 21
func 08h is supposed to wait for the next key press or return the last
key pressed. My dos machine is lent out so I can't test.
The cmp al, 0 is required to check for extended keys.
int 16h, func 00h also waits.
This func returns scan codes in ah and ascii in al. al will be zero if a
non-ascii key was pressed. This func doesn't require a second call to
get the extended keys
int21 and int16 both have funcs to check for a key being ready to
prevent waits.
Alex