相关疑难解决方法(0)

组装键盘IO口

我看过以下主题

我有兴趣通过 IN / OUT 指令联系键盘并设置各种模式,例如打开大写锁定 LED。到目前为止,我在这样做时遇到了问题。以下链接可能会有所帮助。

我尝试了各种组合,例如

mov al,0EDh           ;ED command - Send LED bits. The next byte written to port 60h updates the LEDs on the keyboard.
out 60h,al            ;out on port 60h
mov al,00000111b      ;led status - all leds on. bits 3-7 = reserved(zero)
out 60h,al            ;out on port 60h
Run Code Online (Sandbox Code Playgroud)

我将不胜感激任何帮助。谢谢。

编辑:正如我所说,使用端口 60h 不起作用我在网上搜索了 0040:0017 的用法。其中一个网站指出,第 5、6、7 位包含有关 LED 状态的数据

我尝试使用此代码:

mov al,es:[0017h]
or al,11100000b
mov es:[0017h],al
Run Code Online (Sandbox Code Playgroud)

它也不起作用。

我可能做错了,所以任何人都可以帮助我或向我发送打开所有 3 个 LED 的工作代码吗? …

keyboard x86 assembly

5
推荐指数
1
解决办法
6320
查看次数

自己内核的键盘中断处理程序(C)

我正在写一个小操作系统作为学校分配的一部分,但是当我得到键盘输入时我被卡住了(按键 - >在屏幕上显示它).我正在使用osdev.org的bare Bones教程(gcc交叉编译器,GRUB引导程序,ld链接器),因为我处于保护模式,所以我不能使用BIOS中断进行输入,这就是为什么我必须编写自己的中断处理程序( ?)但即使在我阅读了一些osdev文章和论坛讨论后,我也不确定该怎么做.非常相似的问题(http://forum.osdev.org/viewtopic.php?f=1&t=9746),除了我不知道如何"设置中断".

#if !defined(__cplusplus)
#include <stdbool.h> /* C doesn't have booleans by default. */
#endif
#include <stddef.h>
#include <stdint.h>
#define INT_DISABLE 0
#define INT_ENABLE  0x200
#define PIC1 0x20
#define PIC2 0xA0

#define ICW1 0x11
#define ICW4 0x01

void outb( unsigned short port, unsigned char val )
{
   asm volatile("outb %0, %1" : : "a"(val), "Nd"(port) );
}

static __inline unsigned char inb (unsigned short int port)
{
  unsigned char _v;

  __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" …
Run Code Online (Sandbox Code Playgroud)

x86 gcc kernel inline-assembly osdev

3
推荐指数
1
解决办法
3130
查看次数

标签 统计

x86 ×2

assembly ×1

gcc ×1

inline-assembly ×1

kernel ×1

keyboard ×1

osdev ×1