如何在 Linux 主机上的 gnuforth 代码中触发大写锁定

问题描述 投票:0回答:1

如何从 gnu-forth 中的代码触发大写锁定? 目前作为我使用的临时解决方案

: caps s" xdotool key Caps_Lock" system ;  

我正在寻找完整的 gforth 代码解决方案或 abi 代码汇编解决方案

我还尝试了许多围绕外部 nasm 代码的解决方案,但 xdotool 可用,所以我更喜欢使用它。

我尝试了很多方法https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/386-Assembler.html#g_t386-Assembler文档到目前为止还没有结果。

喜欢

abi-code toto                                                                                                                                                                                                                                 
0x3A .b al mov                                                                                                                                                                                                                                
0x02 .b ah mov                                                                                                                                                                                                                                
0x80 int                                                                                                                                                                                                                                      
ret                                                                                                                                                                                                                                           
end-code  

等等...没有结果

I near solution I think I also tryied to work around asm code below 
  ; Open /dev/port for I/O operations
  mov eax, 5        ; syscall number for sys_open
  mov ebx, dev_port ; pointer to the filename "/dev/port"
  mov ecx, 2        ; O_RDWR mode
  int 0x80          ; Call the kernel

  ; Enable Caps Lock by sending the scancode to the keyboard controller
  mov dx, 0x60      ; Port 0x60 is the keyboard controller data port
  mov al, [capslock_scancode]
  out dx, al

那么如何从 gnuforth 代码触发 ON 大写锁定?

assembly keyboard abi forth gforth
1个回答
0
投票

好吧,事实上我可以改变这一切的逻辑,从为什么 toupper 与接受

'toupper' ( c1 -- c2 ) gforth-0.2 "toupper"
'accept' ( c-addr +n1 -- +n2  ) core "accept"

所以我需要一个大写锁定触发器,但更好的解决方案是强制转换,使中间词应用于

( addr len -- addr len )

上的 toupper

就像打电话给topper一样

: >UPPER  ( addr len -- addr len)
  2DUP bounds do
    I C@ TOUPPER I C! \ convert each char in loop
  loop ; \ over the whole string

这样我就可以使用

pad dup 16 $INPUT >UPPER  

无需修改大写锁定状态,也无需修改 tty 设置

因此我仍然对大写锁定触发器感兴趣,以满足未来的潜在需求

© www.soinside.com 2019 - 2024. All rights reserved.