Hi Eric

> Am 30.05.2025 um 14:34 schrieb Eric Auer via Freedos-devel 
> <freedos-devel@lists.sourceforge.net>:
> 
> 
> /* ---- BIOS keyboard routines with 84 and 102 key keyboard support ---- */
> int Xbioskey(int cmd)
> {
>    static int keybase = -1;
>    union REGS kregs;
>    if (keybase < 0) {
>        volatile char far *kbtype = MK_FP(0x40,0x96); /* BIOS data flag */
>        keybase = ( ((*kbtype) & 0x10) != 0 ) ? 0x10 : 0;
>        /* 0 for 84 key XT mode, 0x10 for 102 key AT mode. */
>        /* (0x20 for 122 key mode, which is not used here) */
>    }
>    kregs.h.ah = (char) (keybase + cmd);
>    kregs.h.al = 0;
>    int86(0x16, &kregs, &kregs);
>    if ( (cmd == 1) && (kregs.x.flags & 0x40 /* zero flag */) )
>        return 0;
>    return kregs.x.ax;
> }
> 
> So whether int 16 function 0/1 or 10/11 are used depends
> on the 40:96 bit 4 flag freshly read for each BIOS call.

To me it looks like 40:96 is read only once, as the static variable keybase is 
set to a value >= 0 on first call. I think it is the same function contained in 
0.9a.

> 
> /* ---- Test for keystroke ---- */
> BOOL keyhit(void)
> {
> #if MSC | WATCOM
>    return (kbhit() ? TRUE : FALSE);
> #else
>    return (Xbioskey(1) != 0) ? TRUE : FALSE;
> #endif
> }
> 
> As you see, only Turbo C relies on Xbioskey, the other
> dialects hope that kbhit of the C library is good enough!

Which as I found out is "suboptimal", as kbhit of Watcom uses a DOS function. 
This resulted in ^C getting put onto the screen when CTRL+C was pressed 
(fixed). 

Bernd



_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to