grub4dos icon indicating copy to clipboard operation
grub4dos copied to clipboard

grub4efi - call Fn.20 not working ?

Open steve6375 opened this issue 4 years ago • 7 comments

call Fn.20

get character from kbd buffer

needed for two reasons

  1. Check to see if key pressed without pausing
  2. Used with Fn.19 to soak up all characters in kbd buffer

It does not seem to work?

I also tested these... Fn.0 works (except for memory access to BIOS ROM - e.g. call Fn.0 0 0xFFFF5 | set biosdate= ) Fn.2 works Fn.4 works Fn.5 works Fn.6 works Fn.11 works Fn.12 works Fn.19 works Fn.24 works Fn.73 works Fn.77 works

steve6375 avatar Jul 24 '21 12:07 steve6375

UEFI规范,checkkey函数会吸收 kbd 缓冲区中的所有字符,不需要再使用getkey。 因此,要注意保留checkkey函数的返回值。

yaya2007 avatar Jul 25 '21 01:07 yaya2007

If I do not press any key then @retval returns a strange value?? 4,294,967,295 = 0xFFFFFFFF

image

steve6375 avatar Jul 25 '21 07:07 steve6375

grub4dos returns -1 image

steve6375 avatar Jul 25 '21 08:07 steve6375

4,294,967,295 = 0xFFFFFFFF 就是32位的-1

yaya2007 avatar Jul 26 '21 07:07 yaya2007

but grub4dos returns 0xFFFFFFFFFFFFFFFF = -1 grub4efi returns 0xFFFFFFFF which is not -1 not consistent???

steve6375 avatar Jul 26 '21 07:07 steve6375

This grub4dos code to soak up key presses in the keyboard buffer does not work in grub4efi

call Fn.20 ;; if not %@retval%==-1 call Fn.19
call Fn.20 ;; if not %@retval%==-1 call Fn.19
call Fn.20 ;; if not %@retval%==-1 call Fn.19

also, if one character is in keyboard buffer, because Fn.20 absorbs a key, when Fn.19 is called it waits for a key press which is not correct.

e.g. call Fn.73 3 ;; call Fn.20 ;; if not %@retval%==-1 call Fn.19 now quickly press one key and wait - it will call Fn.19 and wait for another key press.

So Fn.20 function is not correct - it is not same as grub4dos, it should not absorb a key press or remove key from buffer.

Does Fn.20 call ReadKeyStroke() or ReadKeyStrokeEx() ??? https://edk2-docs.gitbook.io/edk-ii-uefi-driver-writer-s-guide/22_text_console_driver_design_guidelines/222_simple_text_input_protocol_implementation/2222_readkeystroke_and_readkeystrokeex_implementat Does this also remove character from buffer?

steve6375 avatar Jul 26 '21 10:07 steve6375

bios模块提供检查键和获得键两个函数。检查键不吸收键盘缓存。 而uefi模块只提供获得键。肯定要吸收键盘缓存。 grub4dos检查键函数的功能是:没有按键,执行任务一;有按键,执行获得键函数,获取键值,执行任务二。 grub4dos获得键函数的功能是:没有按键一直等待,直到获得键值。 另外特别提醒,在批处理里面使用-1,要谨慎,它可能是0xffffffff,也可能是0xffffffffffffffff。

yaya2007 avatar Jul 26 '21 12:07 yaya2007