我有一个工作简单的自定义操作系统(现在做的不多:D)。现在我正在使用一个不支持键盘的程序集文件(boot.s)。
程序集文件(boot.s):
# set magic number to 0x1BADB002 to identified by bootloader
.set MAGIC, 0x1BADB002
# set flags to 0
.set FLAGS, 0
# set the checksum
.set CHECKSUM, -(MAGIC + FLAGS)
# set multiboot enabled
.section .multiboot
# define type to long for each data defined as above
.long MAGIC
.long FLAGS
.long CHECKSUM
# set the stack bottom
stackBottom:
# define the maximum size of stack to 512 bytes
.skip 512
# set the stack top which grows from higher to lower
stackTop:
.section .text
.global _start
.type _start, @function
_start:
# assign current stack pointer location to stackTop
mov $stackTop, %esp
# call the kernel main source
call KERNEL_MAIN
cli
# put system in infinite loop
hltLoop:
hlt
jmp hltLoop
.size _start, . - _start
我认为这是缺少的部分,但它是 intel 语法,我不能使用它。
load_idt:
mov edx, [esp + 4]
lidt [edx]
sti
ret
read_port:
mov edx, [esp + 4]
in al, dx
ret
write_port:
mov edx, [esp + 4]
mov al, [esp + 4 + 4]
out dx, al
ret
keyboard_handler:
call keyboard_handler
iretd
我正在使用以下命令编译 boot.s:
as --32 boot.s -o boot.o
谁能帮我将键盘部分(英特尔语法)翻译成 AT&T?:)