diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-11-08 08:23:44 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-11-08 08:23:44 +0800 |
| commit | c6ab70ee3c9dea7c341b13a3363c758b9623f468 (patch) | |
| tree | 3e0ed98c1c5ce2c034da252b4e785a16c2d6648f | |
| parent | 2ba58d6b68e02a4aa9cd6e2a61990f8f2713f08c (diff) | |
| download | rcc-project-c6ab70ee3c9dea7c341b13a3363c758b9623f468.tar.gz rcc-project-c6ab70ee3c9dea7c341b13a3363c758b9623f468.tar.xz | |
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
| -rw-r--r-- | mubios/arch/irq.S | 15 | ||||
| -rw-r--r-- | mubios/core/bda.c | 4 | ||||
| -rw-r--r-- | mubios/services/int16.c | 7 |
3 files changed, 17 insertions, 9 deletions
diff --git a/mubios/arch/irq.S b/mubios/arch/irq.S index 5745911..4e3b4e2 100644 --- a/mubios/arch/irq.S +++ b/mubios/arch/irq.S @@ -22,6 +22,9 @@ .equ BDA_TIMER_COUNTER, 0x046C .equ BDA_TIMER_ROLLOVER, 0x0470 + .equ BDA_BASE, 0x0400 + .equ BDA_KBD_BUFFER_START, 0x001E + .equ BDA_KBD_BUFFER_END, 0x003E .equ TIMER_TICKS_PER_DAY_LOW, 0x00B0 .equ TIMER_TICKS_PER_DAY_HIGH, 0x0018 @@ -74,6 +77,7 @@ irq1_entry: push bx push dx push ds + push si # Read the PS/2 scan code before sending EOI. in al, 0x60 @@ -88,22 +92,25 @@ irq1_entry: mov bx, word ptr [0x041C] mov ax, bx add ax, 2 - cmp ax, 0x043E + cmp ax, BDA_KBD_BUFFER_END jb irq1_next_tail_ready - mov ax, 0x041E + mov ax, BDA_KBD_BUFFER_START irq1_next_tail_ready: cmp ax, word ptr [0x041A] je irq1_send_eoi - mov byte ptr [bx], 0 - mov byte ptr [bx + 1], dl + mov si, bx + add si, BDA_BASE + mov byte ptr [si], 0 + mov byte ptr [si + 1], dl mov word ptr [0x041C], ax irq1_send_eoi: mov al, 0x20 out 0x20, al + pop si pop ds pop dx pop bx diff --git a/mubios/core/bda.c b/mubios/core/bda.c index 7220719..105812e 100644 --- a/mubios/core/bda.c +++ b/mubios/core/bda.c @@ -45,8 +45,8 @@ bda_init (void) store_u16 (bda + BDA_CONVENTIONAL_MEMORY_OFFSET, (u16)(ebda_base >> 10)); - store_u16 (bda + 0x001Au, 0x041Eu); - store_u16 (bda + 0x001Cu, 0x041Eu); + store_u16 (bda + 0x001Au, 0x001Eu); + store_u16 (bda + 0x001Cu, 0x001Eu); } struct ivt_entry diff --git a/mubios/services/int16.c b/mubios/services/int16.c index 7acccfb..4a04828 100644 --- a/mubios/services/int16.c +++ b/mubios/services/int16.c @@ -23,7 +23,8 @@ #define BDA_KBD_HEAD 0x041Au #define BDA_KBD_TAIL 0x041Cu #define BDA_KBD_BUFFER 0x041Eu -#define BDA_KBD_BUFFER_END 0x043Eu +#define BDA_KBD_BUFFER_START 0x001Eu +#define BDA_KBD_BUFFER_END 0x003Eu static u8 scancode_to_ascii (u8 scancode) @@ -124,7 +125,7 @@ int16_service (struct bios_regs *regs) } position = *head; - value = buffer[(position - BDA_KBD_BUFFER) >> 1]; + value = buffer[(position - BDA_KBD_BUFFER_START) >> 1]; scancode = (u8)(value >> 8); ascii = scancode_to_ascii (scancode); @@ -136,7 +137,7 @@ int16_service (struct bios_regs *regs) position += 2; if (position >= BDA_KBD_BUFFER_END) - position = BDA_KBD_BUFFER; + position = BDA_KBD_BUFFER_START; *head = position; } |
